public class NdrObjectReader
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
protected java.lang.String |
createdDate |
protected org.dom4j.Document |
doc |
protected java.util.List |
dsFormats |
protected java.lang.String |
handle |
protected java.lang.String |
lastModifiedDate |
protected java.lang.String |
nativeDataStreamFormat
Native data stream format for this object
|
protected org.jaxen.SimpleNamespaceContext |
nsContext
nsContext to support xpath ops
|
protected NDRConstants.NDRObjectType |
objectType |
Constructor and Description |
---|
NdrObjectReader(org.dom4j.Document response)
Constructor for the NdrObjectReader object with a XML Document (for testing
purposes)
|
NdrObjectReader(org.dom4j.Document ndrResponse,
java.lang.String nativeDataStreamFormat)
Constructor for the NdrObjectReader object
|
NdrObjectReader(java.lang.String handle)
Constructor for the NdrObjectReader object with ndrHandle
|
NdrObjectReader(java.lang.String handle,
java.lang.String nativeDataStreamFormat)
Constructor for the NdrObjectReader object with ndrHandle and specified
nativeDataStreamFormat.
|
Modifier and Type | Method and Description |
---|---|
org.dom4j.Element |
getCanonicalNsdlDcDataStream()
Returns the NON_NATIVE data stream labeled simply as "nsdl_dc" with no
version
|
java.util.Date |
getCreated()
Gets the fedora-view:createdDate property of the NdrObject as a Date object
|
java.lang.String |
getCreatedDate()
Gets the fedora-view:createdDate property of the NdrObject
|
org.dom4j.Element |
getDataStream(java.lang.String format)
Gets the dataStream of the NdrObjectReader for specified format.
|
org.dom4j.Element |
getDataStream(java.lang.String format,
java.lang.String version)
Gets the dataStream matching the provided formatSpec, or null if requested
stream is not present.
|
org.dom4j.Document |
getDocument()
Gets the original "get" response for this reader object as a dom4j.Document
instance.
|
java.util.Set |
getFormats()
Returns the data stream formats as a Set.
|
java.lang.String |
getHandle()
Gets the handle attribute of the NdrObjectReader object.
|
java.util.Date |
getLastModified()
Gets the fedora-view:lastModifiedDate property of the NdrObject as a Date
object
|
java.lang.String |
getLastModifiedDate()
Gets the fedora-view:lastModifiedDate property of the NdrObject as a string
|
org.dom4j.Element |
getNativeDataStream(java.lang.String format)
Gets the native dataStream of the NdrObject for the specified native
"format".
|
org.dom4j.Element |
getNativeDataStream(java.lang.String format,
java.lang.String version)
Gets the navite dataStream of the NdrObject for specified format and
version.
|
protected org.dom4j.Node |
getNode(java.lang.String xpath)
Gets a single Node satisfying give XPath.
|
protected java.util.List |
getNodes(java.lang.String path)
Get all Nodes satisfying the given xpath.
|
protected java.lang.String |
getNodeText(java.lang.String xpath)
Return the Text of a Node satisfying the given XPath.
|
protected org.jaxen.SimpleNamespaceContext |
getNsContext()
Returns a namespace context instance, containing namespaces occuring in NDR
objects, that is used in xpath operations.
|
NDRConstants.NDRObjectType |
getObjectType()
Gets the objectType property of the NdrObject.
|
java.lang.String |
getProperty(java.lang.String prop)
Gets the specified property of the NdrObjectReader object (returning the
first if more than one property is present).
|
java.util.List |
getPropertyValues(java.lang.String name)
Gets a list of values for the specified property
|
java.lang.String |
getRelationship(java.lang.String name)
Gets the FIRST relationship (there may be more) with specified name, which
is assumed to be in "nsdl" namespace if no prefix is present.
|
java.util.List |
getRelationshipValues(java.lang.String name)
Gets all the relationships for the specified name.
|
NDRConstants.ObjectState |
getState()
Gets the fedora-model:state property of the NdrObject
|
protected org.dom4j.XPath |
getXPath(java.lang.String path)
Converts the provided xpath string into an XPath instance using the
nsContext (see
getNsContext ) |
protected void |
initDataStreams()
Builds a map containing entries for each datastream format in this object,
but does not populate the values of the map until necessary.
|
protected static void |
pp(org.dom4j.Node node)
Prints a dom4j.Node as formatted string.
|
static void |
setDebug(boolean bool)
Sets the debug attribute of the NdrObjectReader class
|
protected org.dom4j.Document doc
protected java.util.List dsFormats
protected java.lang.String handle
protected NDRConstants.NDRObjectType objectType
protected java.lang.String lastModifiedDate
protected java.lang.String createdDate
protected java.lang.String nativeDataStreamFormat
protected org.jaxen.SimpleNamespaceContext nsContext
public NdrObjectReader(org.dom4j.Document response) throws java.lang.Exception
response
- NOT YET DOCUMENTEDjava.lang.Exception
- NOT YET DOCUMENTEDpublic NdrObjectReader(java.lang.String handle) throws java.lang.Exception
handle
- handle of NDR object to readjava.lang.Exception
- if object cannot be read from NDRpublic NdrObjectReader(java.lang.String handle, java.lang.String nativeDataStreamFormat) throws java.lang.Exception
handle
- handle of NDR object to readnativeDataStreamFormat
- native metadata format (helps extract native
data_stream)java.lang.Exception
- NOT YET DOCUMENTEDpublic NdrObjectReader(org.dom4j.Document ndrResponse, java.lang.String nativeDataStreamFormat) throws java.lang.Exception
nativeDataStreamFormat
- NOT YET DOCUMENTEDndrResponse
- NOT YET DOCUMENTEDjava.lang.Exception
- NOT YET DOCUMENTEDprotected org.jaxen.SimpleNamespaceContext getNsContext()
public org.dom4j.Document getDocument()
public java.lang.String getProperty(java.lang.String prop)
prop
- Description of the Parameterpublic java.util.List getPropertyValues(java.lang.String name)
name
- propertyname, qualifed with "nsdl" if no namespace prefix is
present.public java.lang.String getRelationship(java.lang.String name)
name
- relationship name ("auth:authorizedToChange")public java.util.List getRelationshipValues(java.lang.String name)
name
- Relationship name ("auth:authorizedToChange)public java.lang.String getHandle()
public NDRConstants.NDRObjectType getObjectType()
public NDRConstants.ObjectState getState()
public java.lang.String getLastModifiedDate()
public java.util.Date getLastModified()
public java.lang.String getCreatedDate()
public java.util.Date getCreated()
protected void initDataStreams()
NOTE: datastreams ending in "_info" are ignored and therefore not accessible by "getDataStream"
DataStream elements have format attribute named "format_"+DATA_STREAM_FORMAT"
public java.util.Set getFormats()
public org.dom4j.Element getNativeDataStream(java.lang.String format)
Note: this method cannot return a non-native datastream.
format
- native datastream format (e.g., "oai_dc")public org.dom4j.Element getNativeDataStream(java.lang.String format, java.lang.String version)
Note: this method cannot return a non-native datastream.
format
- native datastream format (.e.g, "oai_dc")version
- version (e.g., "v1.01")public org.dom4j.Element getDataStream(java.lang.String format)
format
- datastream format (e.g., "nsdl_dc")public org.dom4j.Element getDataStream(java.lang.String format, java.lang.String version)
format
- datastream format (e.g., "nsdl_dc")version
- version (e.g., "v1.01")public org.dom4j.Element getCanonicalNsdlDcDataStream()
protected java.util.List getNodes(java.lang.String path)
path
- NOT YET DOCUMENTEDprotected org.dom4j.XPath getXPath(java.lang.String path)
getNsContext
)path
- string representation of an xpathprotected org.dom4j.Node getNode(java.lang.String xpath)
xpath
- an XPathprotected java.lang.String getNodeText(java.lang.String xpath)
xpath
- an XPathpublic static void setDebug(boolean bool)
bool
- The new debug valueprotected static void pp(org.dom4j.Node node)
node
- NOT YET DOCUMENTED