Class MCROAISetManager

java.lang.Object
org.mycore.oai.MCROAISetManager

public class MCROAISetManager extends Object
Manager class to handle OAI-PMH set specific behavior. For a data provider instance, set support is optional and must be configured as described below. Typically, sets are mapped to categories of a classification in MyCoRe. The set specifications are read from one or more URIs using MCRURIResolver. This allows for sets that are typically built by applying an xsl stylesheet to the output of the classification URI resolver, but also for other ways to dynamically create set specifications, or for a static set specification that is read from an xml file. Example:
 MCR.OAIDataProvider.OAI.Sets.OA=webapp:oai/open_access.xml
 MCR.OAIDataProvider.OAI.Sets.DDC=xslStyle:classification2sets:classification:DDC
 
The first line reads a set specification from a static xml file stored in the web application. The DINI certificate demands that there always is a set open_access that contains all public Open Access documents. Since this set always exists, its set specification can be read from a static file. The second line uses the classification resolver to read in a classification, then transforms the xml to build set specifications from the listed categories. It is recommended not to list sets that are completely empty, to simplify harvesting. The fastest way to accomplish this is to somehow ensure that no set specifications from empty sets are delivered from the URIs, which means that the classification resolver filters out empty categories, or the xsl stylesheet somehow decides to filter empty sets. Another way to filter out empty sets can be activated by setting a property: MCR.OAIDataProvider.OAI.FilterEmptySets=true When set to true, the MCRSetManager handler filters out empty sets itself after reading in the URIs. This is done by constructing a query for each set and looking for matching hits. Set queries are built using the OAI Adapter's buildSetCondition method. Filtering empty sets this way may be useful for some implementations, but it is slower and should be avoided for large set hierarchies.
Author:
Frank Lützenkirchen, Matthias Eichner
See Also:
  • Field Details

    • LOGGER

      protected static final Logger LOGGER
    • configPrefix

      protected String configPrefix
    • setConfigurationMap

      protected final Map<String,MCROAISetConfiguration<?,?,?>> setConfigurationMap
    • classLastModified

      protected long classLastModified
      Time in milliseconds when the classification changed.
    • cacheMaxAge

      protected int cacheMaxAge
      Time in minutes.
    • cachedSetList

      protected final org.mycore.oai.pmh.OAIDataList<MCRSet> cachedSetList
  • Constructor Details

    • MCROAISetManager

      public MCROAISetManager()
  • Method Details

    • init

      public void init(String configPrefix, int cacheMaxAge)
    • updateURIs

      protected void updateURIs()
    • getDefinedSetIds

      public List<String> getDefinedSetIds()
    • get

      public org.mycore.oai.pmh.OAIDataList<MCRSet> get()
      Returns a list of OAI-PMH sets defined by MyCoRe.
      Returns:
      list of oai sets
    • getDirectList

      public org.mycore.oai.pmh.OAIDataList<MCRSet> getDirectList()
    • getConfig

      public <Q, R, K> MCROAISetConfiguration<Q,R,K> getConfig(String setId)
      Returns the MCROAISetConfiguration for the given set id.
      Type Parameters:
      Q - value of the configuration
      R - Result collection type
      K - Key value type for a single hit
      Parameters:
      setId - the set identifier
      Returns:
      the configuration for this set
    • createSetList

      protected org.mycore.oai.pmh.OAIDataList<MCRSet> createSetList()
    • get

      public static <T extends org.mycore.oai.pmh.Set> T get(String setSpec, org.mycore.oai.pmh.OAIDataList<T> setList)
      Returns the set with the specified setSpec from the set list or null, if no set with that setSpec is found.
      Parameters:
      setSpec - identifier of the set
      setList - list of sets
      Returns:
      the set with setSpec
    • contains

      public static boolean contains(String setSpec, org.mycore.oai.pmh.OAIDataList<? extends org.mycore.oai.pmh.Set> setList)
      Returns true if setList contains a set with specified setSpec.
      Parameters:
      setSpec - identifier of the set
      setList - list of sets
      Returns:
      true if the list contains the set