Class NSDLCollectionWriter

java.lang.Object
org.dlese.dpc.schemedit.ndr.writer.MetadataWriter
org.dlese.dpc.schemedit.ndr.writer.NSDLCollectionWriter

public class NSDLCollectionWriter extends MetadataWriter
Creates or updates the NDR Objects necessary to create a NSDL collection in the NDR, namely the collection Metadata Record, Collection Resource, Collection Aggregator, and Collection MetadataProvider.

NOTE: A NSDL collection is different from the representation of a DLESE/NCS collection in the NDR. A NCS collection consists of only a MetadataProvider, Aggregator and item-level Metadata objects. If we are creating an NSDL collection for an EXISTING NCS collection we need to do some additional operations, which are NOT YET IMPLEMENTED:

  • connect the existing MetadataProvider object to the newly created Collection Aggregator
  • add a "memberOf" relation to each resource object that points to the Collection Aggregator.
Author:
Jonathan Ostwald
  • Constructor Details

    • NSDLCollectionWriter

      public NSDLCollectionWriter(ServletContext servletContext) throws Exception
      Constructor for the NSDLCollectionWriter object
      Parameters:
      servletContext - NOT YET DOCUMENTED
      Throws:
      Exception - NOT YET DOCUMENTED
  • Method Details

    • write

      public SyncReportEntry write(String recId, DcsDataRecord dcsDataRecord) throws Exception
      Convenience write method that doesn't require ncs_collect metadata to be supplied (this will be obtained from index in the callee).
      Overrides:
      write in class MetadataWriter
      Parameters:
      recId - NOT YET DOCUMENTED
      dcsDataRecord - NOT YET DOCUMENTED
      Returns:
      NOT YET DOCUMENTED
      Throws:
      Exception - NOT YET DOCUMENTED
    • write

      public SyncReportEntry write(String recId, String recordXml, DcsDataRecord dcsDataRecord) throws Exception
      Creates or updates collection-level NDR Objects necessary to define a NSDL collection in the NDR, including collection-level metadata object, collection resource, and collection aggregator.

      NOTE: if the NCSL collection already exists, then there is a possibility that the collection's resource URL has been modified. For this reason, we have to locate the collection definition objects in the NDR by other means than the resource URL ...

      Overrides:
      write in class MetadataWriter
      Parameters:
      recId - record id, used to obtain collection metadata from index if necessary
      recordXml - collection metadata as String (optionally provided)
      dcsDataRecord - auxillary information about the collection metadata record
      Returns:
      NOT YET DOCUMENTED
      Throws:
      Exception - NOT YET DOCUMENTED
    • getMetadataForRelationsToAdd

      protected List getMetadataForRelationsToAdd(String resourceHandle)
      Gets the metadataForRelationsToAdd attribute of the NSDLCollectionWriter object. To the "metadataFor" relation created by MetadataWriter we add a "meatadataFor" relation to the collection resource.
      Parameters:
      resourceHandle - Description of the Parameter
      Returns:
      The metadataForRelationsToAdd value
    • addMetadataRequest

      protected NdrRequest addMetadataRequest(NdrRequest ndrRequest, String resHandle) throws Exception
      Adds a feature to the MetadataRequest attribute of the NSDLCollectionWriter object
      Overrides:
      addMetadataRequest in class MetadataWriter
      Parameters:
      ndrRequest - The feature to be added to the MetadataRequest attribute
      resHandle - The feature to be added to the MetadataRequest attribute
      Returns:
      Description of the Return Value
      Throws:
      Exception - Description of the Exception
    • modifyMetadataRequest

      protected NdrRequest modifyMetadataRequest(NdrRequest ndrRequest, String resHandle, org.dom4j.Element nsdl_dc_stream) throws Exception
      Description of the Method
      Overrides:
      modifyMetadataRequest in class MetadataWriter
      Parameters:
      ndrRequest - Description of the Parameter
      resHandle - Description of the Parameter
      nsdl_dc_stream - Description of the Parameter
      Returns:
      Description of the Return Value
      Throws:
      Exception - Description of the Exception
    • getMetadataReader

      protected MetadataReader getMetadataReader() throws Exception
      Gets the metadataReader attribute of the NSDLCollectionWriter object
      Overrides:
      getMetadataReader in class MetadataWriter
      Returns:
      The metadataReader value
      Throws:
      Exception - NOT YET DOCUMENTED
    • getNCSCollectionConfig

      protected org.dom4j.Element getNCSCollectionConfig()
      Returns the collection_config data_stream from the collection MDP if possible. Used to test whether the NSDL Collection governs a collection whose items are managed in the NCS.
      Returns:
      The the collection_config data stream from the collection mdpReader
    • getNCSCollectionNativeFormat

      protected String getNCSCollectionNativeFormat()
      For Collections whose items are managed by this NCS instance, we can find the itemFormat by inspecting the "collection_config" stream of the Collection MetadataProvider object.
      Returns:
      The nCSCollectionNativeFormat value