Package org.mycore.datamodel.ifs2
Class MCRVersioningMetadataStore
java.lang.Object
org.mycore.datamodel.ifs2.MCRStore
org.mycore.datamodel.ifs2.MCRMetadataStore
org.mycore.datamodel.ifs2.MCRVersioningMetadataStore
Stores metadata objects both in a local filesystem structure and in a
Subversion repository. Changes can be tracked and restored. To enable
versioning, configure the repository URL, for example
MCR.IFS2.Store.DocPortal_document.SVNRepositoryURL=file:///foo/svnroot/
- 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 static final Logger
protected org.tmatesoft.svn.core.SVNURL
protected static final boolean
Fields inherited from class org.mycore.datamodel.ifs2.MCRMetadataStore
forceDocType, forceXML
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 MCRVersionedMetadata
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.void
delete
(int id) Deletes the data stored under the given ID from the storeprotected 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 null.static boolean
When metadata is saved, this results in SVN commit.void
Updates all stored metadata to the latest revision in SVNvoid
verify()
Checks to local SVN repository for errorsMethods inherited from class org.mycore.datamodel.ifs2.MCRMetadataStore
shouldForceXML
Methods inherited from class org.mycore.datamodel.ifs2.MCRStore
exists, getBaseDirectory, getHighestStoredID, getID, getNextFreeID, getSlot, getStoreConfig, getStoredIDs, isEmpty, listIDs, setStoreConfig
-
Field Details
-
LOGGER
-
repURL
protected org.tmatesoft.svn.core.SVNURL repURL -
SYNC_LAST_MODIFIED_ON_SVN_COMMIT
protected static final boolean SYNC_LAST_MODIFIED_ON_SVN_COMMIT
-
-
Constructor Details
-
MCRVersioningMetadataStore
public MCRVersioningMetadataStore()
-
-
Method Details
-
init
Description copied from class:MCRMetadataStore
Initializes a new metadata store instance.- Overrides:
init
in classMCRMetadataStore
- Parameters:
type
- the document type that is stored in this store
-
init
Description copied from class:MCRMetadataStore
Initializes a new metadata store instance.- Overrides:
init
in classMCRMetadataStore
- Parameters:
config
- the configuration for the store
-
shouldSyncLastModifiedOnSVNCommit
public static boolean shouldSyncLastModifiedOnSVNCommit()When metadata is saved, this results in SVN commit. If the property MCR.IFS2.SyncLastModifiedOnSVNCommit=true (which is default), the last modified date of the metadata file in the store will be set to the exactly same timestamp as the SVN commit. Due to permission restrictions on Linux systems, this may fail, so you can disable that behaviour.- Returns:
- true, if last modified of file should be same as timestamp of SVN commit
-
verify
Checks to local SVN repository for errors- Throws:
MCRPersistenceException
- if 'svn verify' fails
-
create
Description copied from class:MCRMetadataStore
Stores a newly created document under the given ID.- Overrides:
create
in classMCRMetadataStore
- 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
-
create
Description copied from class:MCRMetadataStore
Stores a newly created document, using the next free ID.- Overrides:
create
in classMCRMetadataStore
- Parameters:
xml
- the XML document to be stored- Returns:
- the stored metadata object
- Throws:
IOException
JDOMException
-
retrieve
Returns the metadata stored under the given ID, or null. Note that this metadata may not exist currently in the store, it may be a deleted version, which can be restored then.- Overrides:
retrieve
in classMCRMetadataStore
- 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
-
updateAll
Updates all stored metadata to the latest revision in SVN- Throws:
Exception
-
delete
Description copied from class:MCRStore
Deletes the data stored under the given ID from the store- Overrides:
delete
in classMCRStore
- Parameters:
id
- the ID of the document to be deleted- Throws:
IOException
-
buildMetadataObject
Description copied from class:MCRMetadataStore
Builds a new stored metadata object in this store- Overrides:
buildMetadataObject
in classMCRMetadataStore
- Parameters:
fo
- the FileObject that stores the dataid
- the ID of the metadata object
-