Class MCRMetadataStore

java.lang.Object
org.mycore.datamodel.ifs2.MCRStore
org.mycore.datamodel.ifs2.MCRMetadataStore
Direct Known Subclasses:
MCRVersioningMetadataStore

public class MCRMetadataStore extends MCRStore
Stores XML metadata documents (or optionally any other BLOB data) in a persistent filesystem structure For each object type, a store must be defined as follows: MCR.IFS2.Store.DocPortal_document.Class=org.mycore.datamodel.ifs2.MCRMetadataStore MCR.IFS2.Store.DocPortal_document.BaseDir=/foo/bar MCR.IFS2.Store.DocPortal_document.SlotLayout=4-2-2 MCR.IFS2.Store.DocPortal_document.ForceXML=true (which is default)
Author:
Frank Lützenkirchen
  • Field Details

    • LOGGER

      public static final Logger LOGGER
    • forceXML

      protected boolean forceXML
      If true (which is default), store will enforce it gets XML to store, otherwise any binary content can be stored here. Override with MCR.IFS2.Store.<ObjectType>.ForceXML=true|false
    • forceDocType

      protected String forceDocType
  • Constructor Details

    • MCRMetadataStore

      public MCRMetadataStore()
  • Method Details

    • init

      protected void init(String type)
      Initializes a new metadata store instance.
      Overrides:
      init in class MCRStore
      Parameters:
      type - the document type that is stored in this store
    • init

      protected void init(MCRStore.MCRStoreConfig config)
      Initializes a new metadata store instance.
      Overrides:
      init in class MCRStore
      Parameters:
      config - the configuration for the store
    • shouldForceXML

      protected boolean shouldForceXML()
    • create

      Stores a newly created document, using the next free ID.
      Parameters:
      xml - the XML document to be stored
      Returns:
      the stored metadata object
      Throws:
      IOException
      JDOMException
    • create

      public MCRStoredMetadata create(MCRContent xml, int id) throws IOException, JDOMException
      Stores a newly created document under the given ID.
      Parameters:
      xml - the XML document to be stored
      id - the ID under which the document should be stored
      Returns:
      the stored metadata object
      Throws:
      IOException
      JDOMException
    • retrieve

      public MCRStoredMetadata retrieve(int id) throws IOException
      Returns the metadata stored under the given ID, or null
      Parameters:
      id - the ID of the XML document
      Returns:
      the metadata stored under that ID, or null when there is no such metadata object
      Throws:
      IOException
    • buildMetadataObject

      protected MCRStoredMetadata buildMetadataObject(Path fo, int id)
      Builds a new stored metadata object in this store
      Parameters:
      fo - the FileObject that stores the data
      id - the ID of the metadata object