org.mycore.datamodel.ifs2
Class MCRVersioningMetadataStore

java.lang.Object
  extended by org.mycore.datamodel.ifs2.MCRStore
      extended by org.mycore.datamodel.ifs2.MCRMetadataStore
          extended by org.mycore.datamodel.ifs2.MCRVersioningMetadataStore

public class MCRVersioningMetadataStore
extends MCRMetadataStore

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

Field Summary
protected static Logger LOGGER
           
protected  org.tmatesoft.svn.core.SVNURL repURL
           
 
Fields inherited from class org.mycore.datamodel.ifs2.MCRMetadataStore
forceXML
 
Fields inherited from class org.mycore.datamodel.ifs2.MCRStore
ASCENDING, DESCENDING, dir, id, idLength, lastID, offset, prefix, slotLength, stores, suffix
 
Constructor Summary
MCRVersioningMetadataStore()
           
 
Method Summary
protected  MCRVersionedMetadata buildMetadataObject(org.apache.commons.vfs.FileObject fo, int id)
          Builds a new stored metadata object in this store
 MCRVersionedMetadata create(MCRContent xml)
          Stores a newly created document, using the next free ID.
 MCRVersionedMetadata 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 store
(package private)  org.tmatesoft.svn.core.io.SVNRepository getRepository()
          Returns the SVN repository used to manage metadata versions in this store.
(package private)  org.tmatesoft.svn.core.SVNURL getRepositoryURL()
          Returns the URL of the SVN repository used to manage metadata versions in this store.
static MCRVersioningMetadataStore getStore(String type)
          Returns the store for the given metadata document type
protected  void init(String type)
          Initializes a new metadata store instance.
 MCRVersionedMetadata retrieve(int id)
          Returns the metadata stored under the given ID, or null.
 void updateAll()
          Updates all stored metadata to the latest revision in SVN
 
Methods inherited from class org.mycore.datamodel.ifs2.MCRMetadataStore
shouldForceXML
 
Methods inherited from class org.mycore.datamodel.ifs2.MCRStore
delete, exists, getBaseDir, getHighestStoredID, getID, getNextFreeID, getSlot, getSlotPath, getSlotPaths, listIDs
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LOGGER

protected static final Logger LOGGER

repURL

protected org.tmatesoft.svn.core.SVNURL repURL
Constructor Detail

MCRVersioningMetadataStore

public MCRVersioningMetadataStore()
Method Detail

getStore

public static MCRVersioningMetadataStore getStore(String type)
Returns the store for the given metadata document type

Parameters:
type - the type of metadata to store
Returns:
the store for this metadata type

init

protected void init(String type)
Description copied from class: MCRMetadataStore
Initializes a new metadata store instance.

Overrides:
init in class MCRMetadataStore
Parameters:
type - the document type that is stored in this store

getRepository

org.tmatesoft.svn.core.io.SVNRepository getRepository()
                                                throws Exception
Returns the SVN repository used to manage metadata versions in this store.

Returns:
the SVN repository used to manage metadata versions in this store.
Throws:
Exception

getRepositoryURL

org.tmatesoft.svn.core.SVNURL getRepositoryURL()
                                         throws Exception
Returns the URL of the SVN repository used to manage metadata versions in this store.

Returns:
the URL of the SVN repository used to manage metadata versions in this store.
Throws:
Exception

create

public MCRVersionedMetadata create(MCRContent xml,
                                   int id)
                            throws Exception
Description copied from class: MCRMetadataStore
Stores a newly created document under the given ID.

Overrides:
create in class MCRMetadataStore
Parameters:
xml - the XML document to be stored
id - the ID under which the document should be stored
Returns:
the stored metadata object
Throws:
Exception

create

public MCRVersionedMetadata create(MCRContent xml)
                            throws Exception
Description copied from class: MCRMetadataStore
Stores a newly created document, using the next free ID.

Overrides:
create in class MCRMetadataStore
Parameters:
xml - the XML document to be stored
Returns:
the stored metadata object
Throws:
Exception

retrieve

public MCRVersionedMetadata retrieve(int id)
                              throws Exception
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 class MCRMetadataStore
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:
Exception

updateAll

public void updateAll()
               throws Exception
Updates all stored metadata to the latest revision in SVN

Throws:
Exception

delete

public void delete(int id)
            throws Exception
Description copied from class: MCRStore
Deletes the data stored under the given ID from the store

Overrides:
delete in class MCRStore
Parameters:
id - the ID of the document to be deleted
Throws:
Exception

buildMetadataObject

protected MCRVersionedMetadata buildMetadataObject(org.apache.commons.vfs.FileObject fo,
                                                   int id)
Description copied from class: MCRMetadataStore
Builds a new stored metadata object in this store

Overrides:
buildMetadataObject in class MCRMetadataStore
Parameters:
fo - the FileObject that stores the data
id - the ID of the metadata object