DLESE Tools
v1.6.0

org.dlese.dpc.schemedit.ndr.writer
Class NSDLCollectionWriter

java.lang.Object
  extended by org.dlese.dpc.schemedit.ndr.writer.MetadataWriter
      extended by 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:

Author:
Jonathan Ostwald

Field Summary
 
Fields inherited from class org.dlese.dpc.schemedit.ndr.writer.MetadataWriter
collectionConfig, dcsDataRecord, docReader, finalAndValid, itemRecord, mdReader, nsdlItemId, recId, rm, servletContext, xmlConversionService
 
Constructor Summary
NSDLCollectionWriter(ServletContext servletContext)
          Constructor for the NSDLCollectionWriter object
 
Method Summary
protected  NdrRequest addMetadataRequest(NdrRequest ndrRequest, String resHandle)
          Adds a feature to the MetadataRequest attribute of the NSDLCollectionWriter object
protected  List getMetadataForRelationsToAdd(String resourceHandle)
          Gets the metadataForRelationsToAdd attribute of the NSDLCollectionWriter object.
protected  MetadataReader getMetadataReader()
          Gets the metadataReader attribute of the NSDLCollectionWriter object
protected  Element getNCSCollectionConfig()
          Returns the collection_config data_stream from the collection MDP if possible.
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.
protected  NdrRequest modifyMetadataRequest(NdrRequest ndrRequest, String resHandle, Element nsdl_dc_stream)
          Description of the Method
 SyncReportEntry write(String recId, DcsDataRecord dcsDataRecord)
          Convenience write method that doesn't require ncs_collect metadata to be supplied (this will be obtained from index in the callee).
 SyncReportEntry write(String recId, String recordXml, DcsDataRecord dcsDataRecord)
          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.
 
Methods inherited from class org.dlese.dpc.schemedit.ndr.writer.MetadataWriter
getCollectionConfig, getItemRecord, getMetaDataFramework, getResourceHandle, getResourceUrl, getServletContextAttribute, getValueOrNull, getWriteRequest, init, setServletContext
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NSDLCollectionWriter

public NSDLCollectionWriter(ServletContext servletContext)
                     throws Exception
Constructor for the NSDLCollectionWriter object

Parameters:
servletContext - NOT YET DOCUMENTED
Throws:
Exception - NOT YET DOCUMENTED
Method Detail

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,
                                           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 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

DLESE Tools
v1.6.0