Package org.mycore.datamodel.common
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 Summary
Modifier and TypeMethodDescriptionvoid
create
(MCRObjectID mcrid, MCRContent xml, Date lastModified) Stores metadata of a new MCRObject in the persistent store.void
delete
(MCRObjectID mcrid) Delete metadata in store.boolean
exists
(MCRObjectID mcrid) Checks if an object with the given MCRObjectID exists in the store.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.long
Returns the time when the xml data of a MCRObject was last modified.getLastModifiedHandle
(MCRObjectID id, long expire, TimeUnit unit) Returns all used base ids of MCRObjects/MCRDerivates.Returns all stored object types of MCRObjects/MCRDerivates.listIDs()
Lists all MCRObjectIDs of all types and projects stored in any metadata storelistIDsForBase
(String base) Lists all MCRObjectIDs stored for the given base, which is {project}_{type}listIDsOfType
(String type) Lists all MCRObjectIDs stored for the given object type, for all projectsList<? extends MCRAbstractMetadataVersion<?>>
Lists all versions of this metadata object available in the subversion repository.void
reload()
Reads configuration properties, checks and creates base directories and builds the singleton.retrieveContent
(MCRObjectID mcrid) Retrieves the (latest) content of a metadata object.retrieveContent
(MCRObjectID mcrid, String revision) Retrieves the content of a specific revision of a metadata object.retrieveObjectDates
(List<String> ids) Returns an enhanced list of object ids and their last modified datevoid
update
(MCRObjectID mcrid, MCRContent xml, Date lastModified) Updates metadata of existing MCRObject in the persistent store.void
verifyStore
(String base) Try to validate a store.
-
Method Details
-
reload
void reload()Reads configuration properties, checks and creates base directories and builds the singleton. -
verifyStore
Try to validate a store.- Parameters:
base
- The base ID of a to-be-validated store
-
create
Stores metadata of a new MCRObject in the persistent store.- Parameters:
mcrid
- the MCRObjectIDxml
- the xml metadata of the MCRObjectlastModified
- the date of last modification to set- Throws:
MCRPersistenceException
- the object couldn't be created due persistence problems
-
delete
Delete metadata in store.- Parameters:
mcrid
- the MCRObjectID- Throws:
MCRPersistenceException
- if an error occurs during the deletion
-
update
Updates metadata of existing MCRObject in the persistent store.- Parameters:
mcrid
- the MCRObjectIDxml
- the xml metadata of the MCRObjectlastModified
- the date of last modification to set- Throws:
MCRPersistenceException
-
retrieveContent
Retrieves the (latest) content of a metadata object.- Parameters:
mcrid
- the id of the object to be retrieved- Returns:
- a
MCRContent
representing theMCRObject
ornull
if there is no such object - Throws:
IOException
-
retrieveContent
Retrieves the content of a specific revision of a metadata object.- Parameters:
mcrid
- the id of the object to be retrievedrevision
- the revision to be returned, specify -1 if you want to retrieve the latest revision (includes deleted objects also)- Returns:
- a
MCRContent
representing theMCRObject
of the given revision ornull
if there is no such object with the given revision - Throws:
IOException
-
listRevisions
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 allMCRMetadataVersion
of the given object or null if the id is null or the metadata store doesn't support versioning- Throws:
IOException
-
getHighestStoredID
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 basetype
- 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
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
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
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
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
Returns an enhanced list of object ids and their last modified date- Parameters:
ids
- MCRObject ids- Throws:
IOException
-
getLastModified
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
- Parameters:
id
-expire
-unit
-- Returns:
-