public class MetadataWriter
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
protected CollectionConfig |
collectionConfig
NOT YET DOCUMENTED
|
protected DcsDataRecord |
dcsDataRecord
NOT YET DOCUMENTED
|
protected XMLDocReader |
docReader
NOT YET DOCUMENTED
|
protected boolean |
finalAndValid
Description of the Field
|
protected org.dom4j.Document |
itemRecord
NOT YET DOCUMENTED
|
protected MetadataReader |
mdReader
NOT YET DOCUMENTED
|
protected java.lang.String |
nsdlItemId |
protected java.lang.String |
recId
NOT YET DOCUMENTED
|
protected RepositoryManager |
rm
NOT YET DOCUMENTED
|
protected javax.servlet.ServletContext |
servletContext
NOT YET DOCUMENTED
|
protected XMLConversionService |
xmlConversionService
NOT YET DOCUMENTED
|
Constructor and Description |
---|
MetadataWriter()
Constructor for the MetadataWriter object
|
MetadataWriter(javax.servlet.ServletContext servletContext)
Constructor for the MetadataWriter object
|
Modifier and Type | Method and Description |
---|---|
protected NdrRequest |
addMetadataRequest(NdrRequest ndrRequest,
java.lang.String resHandle)
Augment provided NdrRequest to form an "addMetadataRequest" request to
create a new NDR object.
|
protected CollectionConfig |
getCollectionConfig(java.lang.String collection)
Gets the collectionConfig attribute of the RepositoryWriterPlugin object
|
protected org.dom4j.Document |
getItemRecord(java.lang.String recordXml)
Gets the metadata record as a dom4j.Document, converting from recordXml if
it is provided, or obtaining from the index (via docReader) otherwise.
|
protected MetaDataFramework |
getMetaDataFramework(java.lang.String xmlFormat)
Gets the metaDataFramework attribute of the MetadataWriter object
|
protected MetadataReader |
getMetadataReader()
Gets the metadataReader attribute of the MetadataWriter object
|
protected java.lang.String |
getResourceHandle(java.lang.String resourceUrl)
Obtain a resource handle from the NDR for the provided resourceURL.
|
protected java.lang.String |
getResourceUrl(org.dom4j.Document itemRecord)
Get and validate the URL using the urlPath configured for this framework
(NOTE: url path must be configured for the framework of the record to be
written).
|
protected java.lang.Object |
getServletContextAttribute(java.lang.String attrName)
Gets the requiredContextAttributeValue attribute of the MetadataWriterPlugin
object
|
protected java.lang.String |
getValueOrNull(java.lang.String s)
Gets the valueOrNull attribute of the MetadataWriter object
|
protected NdrRequest |
getWriteRequest(java.lang.String resourceUrl,
java.lang.String resHandle)
Returns NdrRequest to write metadata to NDR, either as a new metadata
object or by updating an existing object.
|
protected void |
init(java.lang.String recordXml)
Initialize required values and services for the MetadataWriter.
|
protected NdrRequest |
modifyMetadataRequest(NdrRequest ndrRequest,
java.lang.String resHandle,
org.dom4j.Element nsdl_dc_stream)
Augment provided NdrRequest to form a "modifyMetadataRequest" request for
updating an existing metadata object in the NDR.
|
void |
setServletContext(javax.servlet.ServletContext servletContext)
Sets the servletContext attribute of the MetadataWriter object
|
SyncReportEntry |
write(java.lang.String recId,
DcsDataRecord dcsDataRecord)
Convenience method to write the metadata record identified by recId along
with dcsDataRecord, to the NDR.
|
SyncReportEntry |
write(java.lang.String recId,
java.lang.String recordXml,
DcsDataRecord dcsDataRecord)
Writes metadata record to NDR using provided "recordXml" metadata if
provided, or metadata obtained from from the index if recordXml is null.
|
protected javax.servlet.ServletContext servletContext
protected MetadataReader mdReader
protected RepositoryManager rm
protected java.lang.String recId
protected XMLDocReader docReader
protected DcsDataRecord dcsDataRecord
protected CollectionConfig collectionConfig
protected XMLConversionService xmlConversionService
protected org.dom4j.Document itemRecord
protected boolean finalAndValid
protected java.lang.String nsdlItemId
public MetadataWriter()
public MetadataWriter(javax.servlet.ServletContext servletContext) throws java.lang.Exception
servletContext
- NOT YET DOCUMENTEDjava.lang.Exception
- NOT YET DOCUMENTEDpublic void setServletContext(javax.servlet.ServletContext servletContext)
servletContext
- The new servletContext valueprotected void init(java.lang.String recordXml) throws java.lang.Exception
RepositoryManager, docReader, itemRecord, xmlConversionService, collectionConfig.
recordXml
- metadata, can be null.java.lang.Exception
- NOT YET DOCUMENTEDpublic SyncReportEntry write(java.lang.String recId, DcsDataRecord dcsDataRecord) throws java.lang.Exception
This method is called from OUTSIDE the metadata editor (e.g., Sync), when there is not access to the actual XML of the record.
recId
- NOT YET DOCUMENTEDdcsDataRecord
- NOT YET DOCUMENTEDjava.lang.Exception
- NOT YET DOCUMENTEDpublic SyncReportEntry write(java.lang.String recId, java.lang.String recordXml, DcsDataRecord dcsDataRecord) throws java.lang.Exception
recId
- recordId, used to obtain metadata from index if
necessaryrecordXml
- metadata as String (optionally provided)dcsDataRecord
- auxillary information about the metadata recordjava.lang.Exception
- NOT YET DOCUMENTEDprotected NdrRequest getWriteRequest(java.lang.String resourceUrl, java.lang.String resHandle) throws java.lang.Exception
resHandle
- resource object handleresourceUrl
- NOT YET DOCUMENTEDjava.lang.Exception
- if unable to build ndr requestprotected NdrRequest addMetadataRequest(NdrRequest ndrRequest, java.lang.String resHandle) throws java.lang.Exception
resHandle
- resource object handlendrRequest
- The feature to be added to the Metadata attributejava.lang.Exception
- if unable to build ndr requestprotected NdrRequest modifyMetadataRequest(NdrRequest ndrRequest, java.lang.String resHandle, org.dom4j.Element nsdl_dc_stream) throws java.lang.Exception
Collection-level objects (AggHandle and MdpHandle) are non-null only if the metadata is a NSDL collection record (i.e., ncs_collect format).
resHandle
- resource object handlendrRequest
- NOT YET DOCUMENTEDnsdl_dc_stream
- NOT YET DOCUMENTEDjava.lang.Exception
- if unable to build ndr requestprotected MetadataReader getMetadataReader() throws java.lang.Exception
java.lang.Exception
- NOT YET DOCUMENTEDprotected java.lang.String getResourceHandle(java.lang.String resourceUrl) throws java.lang.Exception
resourceUrl
- url for the resorce to be found or createdjava.lang.Exception
- if a collection aggregator is not found, or if the
resource cannot be created or modified.protected org.dom4j.Document getItemRecord(java.lang.String recordXml) throws java.lang.Exception
recordXml
- metadata record as XML Stringjava.lang.Exception
- if provided recordXml is not well-formed.protected java.lang.String getValueOrNull(java.lang.String s)
s
- Description of the Parameterprotected java.lang.String getResourceUrl(org.dom4j.Document itemRecord) throws java.lang.Exception
itemRecord
- NOT YET DOCUMENTEDjava.lang.Exception
- if resourceUrl cannot be obtainedprotected java.lang.Object getServletContextAttribute(java.lang.String attrName) throws java.lang.Exception
attrName
- NOT YET DOCUMENTEDjava.lang.Exception
- NOT YET DOCUMENTEDprotected CollectionConfig getCollectionConfig(java.lang.String collection) throws java.lang.Exception
collection
- NOT YET DOCUMENTEDjava.lang.Exception
- NOT YET DOCUMENTEDprotected MetaDataFramework getMetaDataFramework(java.lang.String xmlFormat) throws java.lang.Exception
xmlFormat
- NOT YET DOCUMENTEDjava.lang.Exception
- NOT YET DOCUMENTED