org.mycore.datamodel.ifs2
Class MCRVersionedMetadata

java.lang.Object
  extended by org.mycore.datamodel.ifs2.MCRStoredMetadata
      extended by org.mycore.datamodel.ifs2.MCRVersionedMetadata

public class MCRVersionedMetadata
extends MCRStoredMetadata

Represents an XML metadata document that is stored in a local filesystem store and in parallel in a Subversion repository to track and restore changes.

Author:
Frank Lützenkirchen

Field Summary
protected static Logger LOGGER
          The logger
protected  long revision
          The revision number of the metadata version that is currently in the local filesystem store.
 
Fields inherited from class org.mycore.datamodel.ifs2.MCRStoredMetadata
fo, id, store
 
Constructor Summary
MCRVersionedMetadata(MCRMetadataStore store, org.apache.commons.vfs.FileObject fo, int id)
          Creates a new metadata object both in the local store and in the SVN repository
 
Method Summary
(package private)  void commit(String mode)
           
(package private)  void create(MCRContent xml)
          Stores a new metadata object first in the SVN repository, then additionally in the local store.
 void delete()
          Deletes this metadata object in the SVN repository, and in the local store.
 long getRevision()
          Returns the revision number of the version currently stored in the local filesystem store.
 MCRVersioningMetadataStore getStore()
          Returns the store this metadata document is stored in
 boolean isUpToDate()
          Checks if the version in the local store is up to date with the latest version in SVN repository
 List<MCRMetadataVersion> listVersions()
          Lists all versions of this metadata object available in the subversion repository
 void update()
          Updates the version stored in the local filesystem to the latest version from Subversion repository HEAD.
 void update(MCRContent xml)
          Updates this metadata object, first in the SVN repository and then in the local store
 
Methods inherited from class org.mycore.datamodel.ifs2.MCRStoredMetadata
getID, getLastModified, getMetadata, isDeleted, setLastModified
 
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
The logger


revision

protected long revision
The revision number of the metadata version that is currently in the local filesystem store.

Constructor Detail

MCRVersionedMetadata

MCRVersionedMetadata(MCRMetadataStore store,
                     org.apache.commons.vfs.FileObject fo,
                     int id)
Creates a new metadata object both in the local store and in the SVN repository

Parameters:
store - the store this object is stored in
fo - the file storing the data in the local filesystem
id - the id of the metadata object
Method Detail

getStore

public MCRVersioningMetadataStore getStore()
Description copied from class: MCRStoredMetadata
Returns the store this metadata document is stored in

Overrides:
getStore in class MCRStoredMetadata
Returns:
the store this metadata document is stored in

create

void create(MCRContent xml)
      throws Exception
Stores a new metadata object first in the SVN repository, then additionally in the local store.

Overrides:
create in class MCRStoredMetadata
Parameters:
xml - the metadata document to store
Throws:
Exception

update

public void update(MCRContent xml)
            throws Exception
Updates this metadata object, first in the SVN repository and then in the local store

Overrides:
update in class MCRStoredMetadata
Parameters:
xml - the new version of the document metadata
Throws:
Exception

commit

void commit(String mode)
      throws Exception
Throws:
Exception

delete

public void delete()
            throws Exception
Deletes this metadata object in the SVN repository, and in the local store.

Overrides:
delete in class MCRStoredMetadata
Throws:
Exception

update

public void update()
            throws Exception
Updates the version stored in the local filesystem to the latest version from Subversion repository HEAD.

Throws:
Exception

listVersions

public List<MCRMetadataVersion> listVersions()
                                      throws Exception
Lists all versions of this metadata object available in the subversion repository

Returns:
all stored versions of this metadata object
Throws:
Exception

getRevision

public long getRevision()
Returns the revision number of the version currently stored in the local filesystem store.

Returns:
the revision number of the local version

isUpToDate

public boolean isUpToDate()
                   throws Exception
Checks if the version in the local store is up to date with the latest version in SVN repository

Returns:
true, if the local version in store is the latest version
Throws:
Exception