DLESE Tools
v1.6.0

org.dlese.dpc.schemedit.repository
Class RepositoryWriter

java.lang.Object
  extended by 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 Summary
protected RepositoryWriter(ServletContext servletContext)
          Constructor for the RepositoryWriter object
 
Method Summary
 void addPlugin(RepositoryWriterPlugin plugin)
          Register a RepositoryWriterPlugin.
protected  boolean deleteCollection(CollectionConfig config)
          Delete a collection from the local repository.
protected  boolean deleteRecord(String recId, DcsDataRecord dcsDataRecord)
          Delete a record from the repository.
 List getPlugins()
          Gets the registered RepositoryWriterPlugins
protected  void init()
          NOT YET DOCUMENTED
 void removePlugin(RepositoryWriterPlugin plugin)
          Unregister a RepositoryWriterPlugin.
protected  void writeRecord(String recordXml, String xmlFormat, String collection, String id, DcsDataRecord dcsDataRecord)
          Writes provided metadata to the index and to other registered repositories, such as the NDR.
protected  void writeRecord(String recId, String recordXml, XMLDocReader docReader, DcsDataRecord dcsDataRecord)
          Convenience method for RepositoryServices calls that have the docReader handy, calls writeRecord after computing required params.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RepositoryWriter

protected RepositoryWriter(ServletContext servletContext)
Constructor for the RepositoryWriter object

Parameters:
servletContext - NOT YET DOCUMENTED
Method Detail

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

DLESE Tools
v1.6.0