|
DLESE Tools v1.6.0 |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.dlese.dpc.ndr.reader.NdrObjectReader
public class NdrObjectReader
Base Class for reading NDR responses to GET Requests, used primarily to support NDR Import operations. Extended to read specific types of NDR Objects, such as Metadata and MetadataProvider.
Field Summary | |
---|---|
protected String |
createdDate
|
protected Document |
doc
|
protected List |
dsFormats
|
protected String |
handle
|
protected String |
lastModifiedDate
|
protected String |
nativeDataStreamFormat
Native data stream format for this object |
protected org.jaxen.SimpleNamespaceContext |
nsContext
nsContext to support xpath ops |
protected NDRConstants.NDRObjectType |
objectType
|
Constructor Summary | |
---|---|
NdrObjectReader(Document response)
Constructor for the NdrObjectReader object with a XML Document (for testing purposes) |
|
NdrObjectReader(Document ndrResponse,
String nativeDataStreamFormat)
Constructor for the NdrObjectReader object |
|
NdrObjectReader(String handle)
Constructor for the NdrObjectReader object with ndrHandle |
|
NdrObjectReader(String handle,
String nativeDataStreamFormat)
Constructor for the NdrObjectReader object with ndrHandle and specified nativeDataStreamFormat. |
Method Summary | |
---|---|
Element |
getCanonicalNsdlDcDataStream()
Returns the NON_NATIVE data stream labeled simply as "nsdl_dc" with no version |
Date |
getCreated()
Gets the fedora-view:createdDate property of the NdrObject as a Date object |
String |
getCreatedDate()
Gets the fedora-view:createdDate property of the NdrObject |
Element |
getDataStream(String format)
Gets the dataStream of the NdrObjectReader for specified format. |
Element |
getDataStream(String format,
String version)
Gets the dataStream matching the provided formatSpec, or null if requested stream is not present. |
Document |
getDocument()
Gets the original "get" response for this reader object as a dom4j.Document instance. |
Set |
getFormats()
Returns the data stream formats as a Set. |
String |
getHandle()
Gets the handle attribute of the NdrObjectReader object. |
Date |
getLastModified()
Gets the fedora-view:lastModifiedDate property of the NdrObject as a Date object |
String |
getLastModifiedDate()
Gets the fedora-view:lastModifiedDate property of the NdrObject as a string |
Element |
getNativeDataStream(String format)
Gets the native dataStream of the NdrObject for the specified native "format". |
Element |
getNativeDataStream(String format,
String version)
Gets the navite dataStream of the NdrObject for specified format and version. |
protected Node |
getNode(String xpath)
Gets a single Node satisfying give XPath. |
protected List |
getNodes(String path)
Get all Nodes satisfying the given xpath. |
protected String |
getNodeText(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. |
String |
getProperty(String prop)
Gets the specified property of the NdrObjectReader object (returning the first if more than one property is present). |
List |
getPropertyValues(String name)
Gets a list of values for the specified property |
String |
getRelationship(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. |
List |
getRelationshipValues(String name)
Gets all the relationships for the specified name. |
NDRConstants.ObjectState |
getState()
Gets the fedora-model:state property of the NdrObject |
protected XPath |
getXPath(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(Node node)
Prints a dom4j.Node as formatted string. |
static void |
setDebug(boolean bool)
Sets the debug attribute of the NdrObjectReader class |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected Document doc
protected List dsFormats
protected String handle
protected NDRConstants.NDRObjectType objectType
protected String lastModifiedDate
protected String createdDate
protected String nativeDataStreamFormat
protected org.jaxen.SimpleNamespaceContext nsContext
Constructor Detail |
---|
public NdrObjectReader(Document response) throws Exception
response
- NOT YET DOCUMENTED
Exception
- NOT YET DOCUMENTEDpublic NdrObjectReader(String handle) throws Exception
handle
- handle of NDR object to read
Exception
- if object cannot be read from NDRpublic NdrObjectReader(String handle, String nativeDataStreamFormat) throws Exception
handle
- handle of NDR object to readnativeDataStreamFormat
- native metadata format (helps extract native
data_stream)
Exception
- NOT YET DOCUMENTEDpublic NdrObjectReader(Document ndrResponse, String nativeDataStreamFormat) throws Exception
nativeDataStreamFormat
- NOT YET DOCUMENTEDndrResponse
- NOT YET DOCUMENTED
Exception
- NOT YET DOCUMENTEDMethod Detail |
---|
protected org.jaxen.SimpleNamespaceContext getNsContext()
public Document getDocument()
public String getProperty(String prop)
prop
- Description of the Parameter
public List getPropertyValues(String name)
name
- propertyname, qualifed with "nsdl" if no namespace prefix is
present.
public String getRelationship(String name)
name
- relationship name ("auth:authorizedToChange")
public List getRelationshipValues(String name)
name
- Relationship name ("auth:authorizedToChange)
public String getHandle()
public NDRConstants.NDRObjectType getObjectType()
public NDRConstants.ObjectState getState()
public String getLastModifiedDate()
public Date getLastModified()
public String getCreatedDate()
public 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 Set getFormats()
public Element getNativeDataStream(String format)
Note: this method cannot return a non-native datastream.
format
- native datastream format (e.g., "oai_dc")
public Element getNativeDataStream(String format, 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 Element getDataStream(String format)
format
- datastream format (e.g., "nsdl_dc")
public Element getDataStream(String format, String version)
format
- datastream format (e.g., "nsdl_dc")version
- version (e.g., "v1.01")
public Element getCanonicalNsdlDcDataStream()
protected List getNodes(String path)
path
- NOT YET DOCUMENTED
protected XPath getXPath(String path)
getNsContext
)
path
- string representation of an xpath
protected Node getNode(String xpath)
xpath
- an XPath
protected String getNodeText(String xpath)
xpath
- an XPath
public static void setDebug(boolean bool)
bool
- The new debug valueprotected static void pp(Node node)
node
- NOT YET DOCUMENTED
|
DLESE Tools v1.6.0 |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |