Interface MCRXMLMetadataManagerAdapter

All Known Implementing Classes:
MCRDefaultXMLMetadataManager, MCROCFLXMLMetadataManager

public interface MCRXMLMetadataManagerAdapter
Provides an abstract class for persistence managers of MCRObject and MCRDerivate xml metadata to extend, with methods to perform CRUD operations on object metadata. The default xml metadata manager is MCRDefaultXMLMetadataManager. If you wish to use another manager implementation instead, change the following property accordingly: MCR.Metadata.Manager.Class=org.mycore.datamodel.common.MCRDefaultXMLMetadataManager Xml metadata managers have a default class they will instantiate for every store. If you wish to use a different default class, change the following property accordingly. For example, when using the MCRDefaultXMLMetadataManager: MCR.Metadata.Store.DefaultClass=org.mycore.datamodel.ifs2.MCRVersioningMetadataStore The following directory will be used by xml metadata managers to keep up-to-date store contents in. This directory will be created if it does not exist yet. MCR.Metadata.Store.BaseDir=/path/to/metadata/dir For each project and type, subdirectories will be created below this path, for example %MCR.Metadata.Store.BaseDir%/DocPortal/document/. If an SVN-based store is configured, then the following property will be used to store and manage local SVN repositories: MCR.Metadata.Store.SVNBase=file:///path/to/local/svndir/ It is also possible to change individual properties per project and object type and overwrite the defaults, for example MCR.IFS2.Store.Class=org.mycore.datamodel.ifs2.MCRVersioningMetadataStore MCR.IFS2.Store.SVNRepositoryURL=file:///use/other/location/for/document/versions/ MCR.IFS2.Store.SlotLayout=2-2-2-2 See documentation of MCRStore, MCRMetadataStore and the MCRXMLMetadataManager extensions (e.g. MCRDefaultXMLMetadataManager) for details.
Author:
Christoph Neidahl (OPNA2608)
  • Method Details

    • reload

      void reload()
      Reads configuration properties, checks and creates base directories and builds the singleton.
    • verifyStore

      void verifyStore(String base)
      Try to validate a store.
      Parameters:
      base - The base ID of a to-be-validated store
    • create

      void create(MCRObjectID mcrid, MCRContent xml, Date lastModified) throws MCRPersistenceException
      Stores metadata of a new MCRObject in the persistent store.
      Parameters:
      mcrid - the MCRObjectID
      xml - the xml metadata of the MCRObject
      lastModified - the date of last modification to set
      Throws:
      MCRPersistenceException - the object couldn't be created due persistence problems
    • delete

      void delete(MCRObjectID mcrid) throws MCRPersistenceException
      Delete metadata in store.
      Parameters:
      mcrid - the MCRObjectID
      Throws:
      MCRPersistenceException - if an error occurs during the deletion
    • update

      void update(MCRObjectID mcrid, MCRContent xml, Date lastModified) throws MCRPersistenceException
      Updates metadata of existing MCRObject in the persistent store.
      Parameters:
      mcrid - the MCRObjectID
      xml - the xml metadata of the MCRObject
      lastModified - the date of last modification to set
      Throws:
      MCRPersistenceException
    • retrieveContent

      MCRContent retrieveContent(MCRObjectID mcrid) throws IOException
      Retrieves the (latest) content of a metadata object.
      Parameters:
      mcrid - the id of the object to be retrieved
      Returns:
      a MCRContent representing the MCRObject or null if there is no such object
      Throws:
      IOException
    • retrieveContent

      MCRContent retrieveContent(MCRObjectID mcrid, String revision) throws IOException
      Retrieves the content of a specific revision of a metadata object.
      Parameters:
      mcrid - the id of the object to be retrieved
      revision - the revision to be returned, specify -1 if you want to retrieve the latest revision (includes deleted objects also)
      Returns:
      a MCRContent representing the MCRObject of the given revision or null if there is no such object with the given revision
      Throws:
      IOException
    • listRevisions

      List<? extends MCRAbstractMetadataVersion<?>> listRevisions(MCRObjectID id) throws IOException
      Lists all versions of this metadata object available in the subversion repository.
      Parameters:
      id - the id of the object to be retrieved
      Returns:
      List with all MCRMetadataVersion of the given object or null if the id is null or the metadata store doesn't support versioning
      Throws:
      IOException
    • getHighestStoredID

      int getHighestStoredID(String project, String type)
      This method returns the highest stored ID number for a given MCRObjectID base, or 0 if no object is stored for this type and project.
      Parameters:
      project - the project ID part of the MCRObjectID base
      type - the type ID part of the MCRObjectID base
      Returns:
      the highest stored ID number as a String
      Throws:
      MCRPersistenceException - if a persistence problem is occurred
    • exists

      boolean exists(MCRObjectID mcrid) throws MCRPersistenceException
      Checks if an object with the given MCRObjectID exists in the store.
      Parameters:
      mcrid - the MCRObjectID to check
      Returns:
      true if the ID exists, or false if it doesn't
      Throws:
      MCRPersistenceException - if an error occurred in the store
    • listIDsForBase

      List<String> listIDsForBase(String base)
      Lists all MCRObjectIDs stored for the given base, which is {project}_{type}
      Parameters:
      base - the MCRObjectID base, e.g. DocPortal_document
      Returns:
      List of Strings with all MyCoRe identifiers found in the metadata stores for the given base
    • listIDsOfType

      List<String> listIDsOfType(String type)
      Lists all MCRObjectIDs stored for the given object type, for all projects
      Parameters:
      type - the MCRObject type, e.g. document
      Returns:
      List of Strings with all MyCoRe identifiers found in the metadata store for the given type
    • listIDs

      List<String> listIDs()
      Lists all MCRObjectIDs of all types and projects stored in any metadata store
      Returns:
      List of Strings with all MyCoRe identifiers found in the metadata store
    • getObjectTypes

      Collection<String> getObjectTypes()
      Returns all stored object types of MCRObjects/MCRDerivates.
      Returns:
      Collection of Strings with all object types
      See Also:
    • getObjectBaseIds

      Collection<String> getObjectBaseIds()
      Returns all used base ids of MCRObjects/MCRDerivates.
      Returns:
      Collection of Strings with all object base identifier
      See Also:
    • retrieveObjectDates

      List<MCRObjectIDDate> retrieveObjectDates(List<String> ids) throws IOException
      Returns an enhanced list of object ids and their last modified date
      Parameters:
      ids - MCRObject ids
      Throws:
      IOException
    • getLastModified

      long getLastModified(MCRObjectID id) throws IOException
      Returns the time when the xml data of a MCRObject was last modified.
      Parameters:
      id - the MCRObjectID of an object
      Returns:
      the last modification data of the object
      Throws:
      IOException - thrown while retrieving the object from the store
    • getLastModifiedHandle

      MCRCache.ModifiedHandle getLastModifiedHandle(MCRObjectID id, long expire, TimeUnit unit)
      Parameters:
      id -
      expire -
      unit -
      Returns: