Class 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 Details

    • LOGGER

      protected static final Logger 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

      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
    • init

      protected void init(MCRStore.MCRStoreConfig config)
      Description copied from class: MCRMetadataStore
      Initializes a new metadata store instance.
      Overrides:
      init in class MCRMetadataStore
      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

      public void verify() throws MCRPersistenceException
      Checks to local SVN repository for errors
      Throws:
      MCRPersistenceException - if 'svn verify' fails
    • create

      public MCRVersionedMetadata create(MCRContent xml, int id) throws IOException, JDOMException
      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:
      IOException
      JDOMException
    • create

      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:
      IOException
      JDOMException
    • retrieve

      public MCRVersionedMetadata retrieve(int id) throws IOException
      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:
      IOException
    • 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 IOException
      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:
      IOException
    • buildMetadataObject

      protected MCRVersionedMetadata buildMetadataObject(Path 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