Package org.mycore.datamodel.ifs2
Class MCRMetadataStore
java.lang.Object
org.mycore.datamodel.ifs2.MCRStore
org.mycore.datamodel.ifs2.MCRMetadataStore
- Direct Known Subclasses:
MCRVersioningMetadataStore
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
-
Nested Class Summary
Nested classes/interfaces inherited from class org.mycore.datamodel.ifs2.MCRStore
MCRStore.MCRStoreConfig
-
Field Summary
Modifier and TypeFieldDescriptionprotected String
protected boolean
If true (which is default), store will enforce it gets XML to store, otherwise any binary content can be stored here.static final Logger
Fields inherited from class org.mycore.datamodel.ifs2.MCRStore
ASCENDING, baseDirectory, DESCENDING, id, idLength, lastID, offset, prefix, slotLength, suffix
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected MCRStoredMetadata
buildMetadataObject
(Path fo, int id) Builds a new stored metadata object in this storecreate
(MCRContent xml) Stores a newly created document, using the next free ID.create
(MCRContent xml, int id) Stores a newly created document under the given ID.protected void
Initializes a new metadata store instance.protected void
init
(MCRStore.MCRStoreConfig config) Initializes a new metadata store instance.retrieve
(int id) Returns the metadata stored under the given ID, or nullprotected boolean
Methods inherited from class org.mycore.datamodel.ifs2.MCRStore
delete, exists, getBaseDirectory, getHighestStoredID, getID, getNextFreeID, getSlot, getStoreConfig, getStoredIDs, isEmpty, listIDs, setStoreConfig
-
Field Details
-
LOGGER
-
forceXML
protected boolean forceXMLIf 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
-
-
Constructor Details
-
MCRMetadataStore
public MCRMetadataStore()
-
-
Method Details
-
init
Initializes a new metadata store instance. -
init
Initializes a new metadata store instance. -
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
Stores a newly created document under the given ID.- Parameters:
xml
- the XML document to be storedid
- the ID under which the document should be stored- Returns:
- the stored metadata object
- Throws:
IOException
JDOMException
-
retrieve
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
Builds a new stored metadata object in this store- Parameters:
fo
- the FileObject that stores the dataid
- the ID of the metadata object
-