Class RepositoryWriter

java.lang.Object
org.dlese.dpc.schemedit.repository.RepositoryWriter

public class RepositoryWriter extends Object
The class includes methods to create, copy, and put Records to the main Repository, and RepositoryWriterPlugins if so configured.
Author:
ostwald

  • Constructor Details

    • RepositoryWriter

      protected RepositoryWriter(ServletContext servletContext)
      Constructor for the RepositoryWriter object
      Parameters:
      servletContext - NOT YET DOCUMENTED
  • Method Details

    • addPlugin

      public void addPlugin(RepositoryWriterPlugin plugin)
      Register a RepositoryWriterPlugin.
      Parameters:
      plugin - the RepositoryWriterPlugin
    • removePlugin

      public void removePlugin(RepositoryWriterPlugin plugin)
      Unregister a RepositoryWriterPlugin.
      Parameters:
      plugin - the RepositoryWriterPlugin
    • getPlugins

      public List getPlugins()
      Gets the registered RepositoryWriterPlugins
      Returns:
      The plugins value
    • writeRecord

      protected void writeRecord(String recId, String recordXml, XMLDocReader docReader, DcsDataRecord dcsDataRecord) throws RecordUpdateException, Exception
      Convenience method for RepositoryServices calls that have the docReader handy, calls writeRecord after computing required params.
      Parameters:
      recId - metadata record id
      recordXml - metadata record as xml string
      docReader - docReader for metadata
      dcsDataRecord - dcsDataRecord for metadata
      Throws:
      RecordUpdateException - if record cannot be written to index
      Exception - NOT YET DOCUMENTED
    • writeRecord

      protected void writeRecord(String recordXml, String xmlFormat, String collection, String id, DcsDataRecord dcsDataRecord) throws RecordUpdateException, Exception
      Writes provided metadata to the index and to other registered repositories, such as the NDR.

      First try to write to the external repository. This attempt may fail before the record has been indexed the first time, if a RepositoryWriterPlugin required the index (as the NDR plugin does). In this case, a syncError is registered in the index.

      Parameters:
      recordXml - metadata record as xml string
      xmlFormat - format of metadata
      collection - collection key of metadata record (e.g., "dcc")
      id - metadata record id
      dcsDataRecord - dcsDataRecord for metadata
      Throws:
      RecordUpdateException - if record cannot be written to index
      Exception - NOT YET DOCUMENTED
    • deleteRecord

      protected boolean deleteRecord(String recId, DcsDataRecord dcsDataRecord) throws Exception
      Delete a record from the repository.

      Current plugin exception policy: If there is a pluginError, the record is NOT deleted, but instead it is re-indexed as a sync-error.

      Parameters:
      recId - NOT YET DOCUMENTED
      dcsDataRecord - NOT YET DOCUMENTED
      Returns:
      NOT YET DOCUMENTED
      Throws:
      Exception - NOT YET DOCUMENTED
    • deleteCollection

      protected boolean deleteCollection(CollectionConfig config) throws Exception
      Delete a collection from the local repository. Called by RepositoryService
      Parameters:
      config - NOT YET DOCUMENTED
      Returns:
      NOT YET DOCUMENTED
      Throws:
      Exception - NOT YET DOCUMENTED
    • init

      protected void init() throws Exception
      NOT YET DOCUMENTED
      Throws:
      Exception - NOT YET DOCUMENTED