DLESE Tools
v1.6.0

org.dlese.dpc.ndr.request
Class NdrRequest

java.lang.Object
  extended by org.dlese.dpc.ndr.request.SimpleNdrRequest
      extended by org.dlese.dpc.ndr.request.NdrRequest
Direct Known Subclasses:
CountMembersRequest, FindRequest, ListMembersRequest, SignedNdrRequest

public class NdrRequest
extends SimpleNdrRequest

Class to communiate directly with NDR via NDRConnection. Builds the inputXML parameter that is sent as part a POST request.

Version:
$Id: NdrRequest.java,v 1.18 2010/05/28 19:16:43 ostwald Exp $
Author:
Jonathan Ostwald

Field Summary
protected  InputXML inputXML
          NOT YET DOCUMENTED
protected  NDRConstants.NDRObjectType objectType
          NOT YET DOCUMENTED
protected  String payload
           
 
Fields inherited from class org.dlese.dpc.ndr.request.SimpleNdrRequest
handle, requestAgent, verb, verbose
 
Constructor Summary
NdrRequest()
          Constructor for the NdrRequest object
NdrRequest(String verb)
          Constructor for the NdrRequest object with specified verb.
NdrRequest(String verb, String handle)
          Constructor for the NdrRequest object with specified verb and handle.
 
Method Summary
 void addCommand(String type, Element element)
          Adds a command represented as an Element of the specified type.
 void addCommand(String type, Element element, String action)
          Adds a command represented as an Element of the specified type and with the specified action.
 void addCommand(String type, String prop, String value)
          Adds a command specified as a prop and value pair of the specified type.
 void addCommand(String type, String prop, String value, String action)
          Adds a command specified as a prop and value pair of the specified type and action.
 void addDataStreamCmd(String format, Element content)
          Adds a datastream command to the data component with given datastream of specified format (e.g., "ndsl_dc");
 void addDataStreamCmd(String format, Element content, String action)
          Adds a datastream command to the data component with given datastream of specified format (e.g., "ndsl_dc");
 void addDCStreamCmd(Element oai_dc)
          Adds a feature to the DCStreamCmd attribute of the NdrRequest object
 void addDleseCommand(String type, String prop, String value)
          Adds a feature to the DleseCommand attribute of the NdrRequest object
 void addDleseCommand(String type, String prop, String value, String action)
          Adds a feature to the DleseCommand attribute of the NdrRequest object
 void addNativeDataStreamCmd(String format, Element content)
           
 void addNativeDataStreamCmd(String format, Element content, String action)
           
 void addNcsPropertyCmd(String prop, String value)
          Adds a property command with the specified property belonging to the dlese namespace.
 void addNcsPropertyCmd(String prop, String value, String action)
          Adds a property command with the specified property belonging to the dlese namespace.
 void addNcsRelationshipCmd(String prop, String value)
          Adds a feature to the NcsRelationshipCmd attribute of the NdrRequest object
 void addNcsRelationshipCmd(String prop, String value, String action)
          Adds a property command with the specified property belonging to the dlese namespace.
 void addOaiVisibilityCmd(NDRConstants.OAIVisibilty visibility)
          Adds a feature to the OaiVisibilityCmd attribute of the NdrRequest object
 void addOaiVisibilityCmd(NDRConstants.OAIVisibilty visibility, String action)
          Adds a feature to the OaiVisibilityCmd attribute of the NdrRequest object
 void addQualifiedCommand(Namespace namespace, String type, String prop, String value)
          Adds a feature to the QualifiedCommand attribute of the NdrRequest object
 void addQualifiedCommand(Namespace namespace, String type, String prop, String value, String action)
          Adds a feature to the QualifiedCommand attribute of the NdrRequest object
 void addServiceDescriptionCmd(Element content)
          Adds a serviceDescription command to the data element.
 void addServiceDescriptionCmd(Element content, String action)
          Adds a feature to the ServiceDescriptionCmd attribute of the NdrRequest object
 void addStateCmd(NDRConstants.ObjectState state)
          Adds a feature to the StateCmd attribute of the NdrRequest object
 void addStateCmd(NDRConstants.ObjectState state, String action)
          Adds a feature to the StateCmd attribute of the NdrRequest object
protected  InputXMLComponent getComponent(String type)
          Gets the component of specified type ("property", "data", "relationship" from the InfoXML instance, if it exists.
 InputXML getInputXML()
          Gets the inputXML attribute of the NdrRequest object, which stores the commands for this request.
protected  NDRConnection getNDRConnection(String path, String inputXMLStr)
          Creates connection and adds payload in the form of inputXML parameter.
 NDRConstants.NDRObjectType getObjectType()
          Gets the objectType attribute of the NdrRequest object
protected  String getPayload()
          A human readable representation of the XMLInput payload of the request.
 void report(String path)
          NOT YET DOCUMENTED
 void setDataInfoStream(String format, Element info)
          Sets the dataInfoStream attribute of the NdrRequest object
 void setObjectType(NDRConstants.NDRObjectType objectType)
          Sets the objectType attribute of the NdrRequest object
 InfoXML submit()
          NOT YET DOCUMENTED
 InfoXML submit(String inputXMLStr)
          NOT YET DOCUMENTED
 
Methods inherited from class org.dlese.dpc.ndr.request.SimpleNdrRequest
getDebug, getHandle, getNDRConnection, getRequestAgent, getVerb, getVerbose, makePath, pp, prtln, prtlnErr, report, setDebug, setHandle, setRequestAgent, setVerb, setVerbose
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

inputXML

protected InputXML inputXML
NOT YET DOCUMENTED


objectType

protected NDRConstants.NDRObjectType objectType
NOT YET DOCUMENTED


payload

protected String payload
Constructor Detail

NdrRequest

public NdrRequest()
Constructor for the NdrRequest object


NdrRequest

public NdrRequest(String verb)
Constructor for the NdrRequest object with specified verb.

Parameters:
verb - NOT YET DOCUMENTED

NdrRequest

public NdrRequest(String verb,
                  String handle)
Constructor for the NdrRequest object with specified verb and handle.

Parameters:
verb - NOT YET DOCUMENTED
handle - NOT YET DOCUMENTED
Method Detail

getInputXML

public InputXML getInputXML()
Gets the inputXML attribute of the NdrRequest object, which stores the commands for this request.

Returns:
The inputXML value

getPayload

protected String getPayload()
A human readable representation of the XMLInput payload of the request.

Returns:
The payload value

setObjectType

public void setObjectType(NDRConstants.NDRObjectType objectType)
Sets the objectType attribute of the NdrRequest object

Parameters:
objectType - The new objectType value

getObjectType

public NDRConstants.NDRObjectType getObjectType()
Gets the objectType attribute of the NdrRequest object

Returns:
The objectType value

getComponent

protected InputXMLComponent getComponent(String type)
                                  throws Exception
Gets the component of specified type ("property", "data", "relationship" from the InfoXML instance, if it exists.

Parameters:
type - NOT YET DOCUMENTED
Returns:
The component value
Throws:
Exception - If inputXML does not exist or the specified type is unknown

addCommand

public void addCommand(String type,
                       Element element)
Adds a command represented as an Element of the specified type.

Parameters:
type - command type ("property", "relationship", or "data")
element - command represented as Element.

addCommand

public void addCommand(String type,
                       Element element,
                       String action)
Adds a command represented as an Element of the specified type and with the specified action.

Parameters:
type - The feature to be added to the Command attribute
element - The feature to be added to the Command attribute
action - specifies command action ("delete", "add")

addCommand

public void addCommand(String type,
                       String prop,
                       String value)
Adds a command specified as a prop and value pair of the specified type.

Parameters:
type - The feature to be added to the Command attribute
prop - The feature to be added to the Command attribute
value - The feature to be added to the Command attribute

addCommand

public void addCommand(String type,
                       String prop,
                       String value,
                       String action)
Adds a command specified as a prop and value pair of the specified type and action.

Parameters:
type - The feature to be added to the Command attribute
prop - The feature to be added to the Command attribute
value - The feature to be added to the Command attribute
action - The feature to be added to the Command attribute

addNcsPropertyCmd

public void addNcsPropertyCmd(String prop,
                              String value)
Adds a property command with the specified property belonging to the dlese namespace.

Parameters:
prop - The feature to be added to the NcsProperty attribute
value - The feature to be added to the NcsProperty attribute

addNcsPropertyCmd

public void addNcsPropertyCmd(String prop,
                              String value,
                              String action)
Adds a property command with the specified property belonging to the dlese namespace.

Parameters:
prop - The feature to be added to the NcsProperty attribute
value - The feature to be added to the NcsProperty attribute
action - The feature to be added to the NcsProperty attribute

addNcsRelationshipCmd

public void addNcsRelationshipCmd(String prop,
                                  String value)
Adds a feature to the NcsRelationshipCmd attribute of the NdrRequest object

Parameters:
prop - The feature to be added to the NcsRelationshipCmd attribute
value - The feature to be added to the NcsRelationshipCmd attribute

addNcsRelationshipCmd

public void addNcsRelationshipCmd(String prop,
                                  String value,
                                  String action)
Adds a property command with the specified property belonging to the dlese namespace.

Parameters:
prop - The feature to be added to the NcsProperty attribute
value - The feature to be added to the NcsProperty attribute
action - The feature to be added to the NcsProperty attribute

addDleseCommand

public void addDleseCommand(String type,
                            String prop,
                            String value)
Adds a feature to the DleseCommand attribute of the NdrRequest object

Parameters:
type - The feature to be added to the DleseCommand attribute
prop - The feature to be added to the DleseCommand attribute
value - The feature to be added to the DleseCommand attribute

addDleseCommand

public void addDleseCommand(String type,
                            String prop,
                            String value,
                            String action)
Adds a feature to the DleseCommand attribute of the NdrRequest object

Parameters:
type - The feature to be added to the DleseCommand attribute
prop - The feature to be added to the DleseCommand attribute
value - The feature to be added to the DleseCommand attribute
action - The feature to be added to the DleseCommand attribute

addQualifiedCommand

public void addQualifiedCommand(Namespace namespace,
                                String type,
                                String prop,
                                String value)
Adds a feature to the QualifiedCommand attribute of the NdrRequest object

Parameters:
namespace - The feature to be added to the QualifiedCommand attribute
type - The feature to be added to the QualifiedCommand attribute
prop - The feature to be added to the QualifiedCommand attribute
value - The feature to be added to the QualifiedCommand attribute

addQualifiedCommand

public void addQualifiedCommand(Namespace namespace,
                                String type,
                                String prop,
                                String value,
                                String action)
Adds a feature to the QualifiedCommand attribute of the NdrRequest object

Parameters:
namespace - The feature to be added to the QualifiedCommand attribute
type - The feature to be added to the QualifiedCommand attribute
prop - The feature to be added to the QualifiedCommand attribute
value - The feature to be added to the QualifiedCommand attribute
action - The feature to be added to the QualifiedCommand attribute

addNativeDataStreamCmd

public void addNativeDataStreamCmd(String format,
                                   Element content)
                            throws Exception
Throws:
Exception

addNativeDataStreamCmd

public void addNativeDataStreamCmd(String format,
                                   Element content,
                                   String action)
                            throws Exception
Throws:
Exception

addDataStreamCmd

public void addDataStreamCmd(String format,
                             Element content)
                      throws Exception
Adds a datastream command to the data component with given datastream of specified format (e.g., "ndsl_dc");

Parameters:
format - format of the datastream
content - datastream represented as Element
Throws:
Exception - If inputXML does not exist or content element is null

addDataStreamCmd

public void addDataStreamCmd(String format,
                             Element content,
                             String action)
                      throws Exception
Adds a datastream command to the data component with given datastream of specified format (e.g., "ndsl_dc");

Parameters:
format - The feature to be added to the DataStreamCmd attribute
content - The feature to be added to the DataStreamCmd attribute
action - The feature to be added to the DataStreamCmd attribute
Throws:
Exception - If inputXML does not exist or content element is null

setDataInfoStream

public void setDataInfoStream(String format,
                              Element info)
                       throws Exception
Sets the dataInfoStream attribute of the NdrRequest object

Parameters:
format - The new dataInfoStream value
info - The new dataInfoStream value
Throws:
Exception - NOT YET DOCUMENTED

addServiceDescriptionCmd

public void addServiceDescriptionCmd(Element content)
                              throws Exception
Adds a serviceDescription command to the data element.

Parameters:
content - ServiceDescription as Element
Throws:
Exception - if inputXML does not exist

addStateCmd

public void addStateCmd(NDRConstants.ObjectState state)
Adds a feature to the StateCmd attribute of the NdrRequest object

Parameters:
state - The feature to be added to the StateCmd attribute

addStateCmd

public void addStateCmd(NDRConstants.ObjectState state,
                        String action)
Adds a feature to the StateCmd attribute of the NdrRequest object

Parameters:
state - The feature to be added to the StateCmd attribute
action - The feature to be added to the StateCmd attribute

addOaiVisibilityCmd

public void addOaiVisibilityCmd(NDRConstants.OAIVisibilty visibility)
Adds a feature to the OaiVisibilityCmd attribute of the NdrRequest object

Parameters:
visibility - The feature to be added to the OaiVisibilityCmd attribute

addOaiVisibilityCmd

public void addOaiVisibilityCmd(NDRConstants.OAIVisibilty visibility,
                                String action)
Adds a feature to the OaiVisibilityCmd attribute of the NdrRequest object

Parameters:
visibility - The feature to be added to the OaiVisibilityCmd attribute
action - The feature to be added to the OaiVisibilityCmd attribute

addServiceDescriptionCmd

public void addServiceDescriptionCmd(Element content,
                                     String action)
                              throws Exception
Adds a feature to the ServiceDescriptionCmd attribute of the NdrRequest object

Parameters:
content - The feature to be added to the ServiceDescriptionCmd attribute
action - The feature to be added to the ServiceDescriptionCmd attribute
Throws:
Exception - if inputXML does not exist

addDCStreamCmd

public void addDCStreamCmd(Element oai_dc)
                    throws Exception
Adds a feature to the DCStreamCmd attribute of the NdrRequest object

Parameters:
oai_dc - The feature to be added to the DCStreamCmd attribute
Throws:
Exception - NOT YET DOCUMENTED

getNDRConnection

protected NDRConnection getNDRConnection(String path,
                                         String inputXMLStr)
                                  throws Exception
Creates connection and adds payload in the form of inputXML parameter.

Payload is the request objects's inputXML attribute, which is overidden by the inputXMLStr parameter if present. This allows a caller to create an inputXMLStr external to the request, which is helpful in debugging.

Parameters:
path - NOT YET DOCUMENTED
inputXMLStr - NOT YET DOCUMENTED
Returns:
The nDRConnection value
Throws:
Exception - NOT YET DOCUMENTED

submit

public InfoXML submit()
               throws Exception
NOT YET DOCUMENTED

Overrides:
submit in class SimpleNdrRequest
Returns:
NOT YET DOCUMENTED
Throws:
Exception - NOT YET DOCUMENTED

submit

public InfoXML submit(String inputXMLStr)
               throws Exception
NOT YET DOCUMENTED

Overrides:
submit in class SimpleNdrRequest
Parameters:
inputXMLStr - NOT YET DOCUMENTED
Returns:
NOT YET DOCUMENTED
Throws:
Exception - NOT YET DOCUMENTED

report

public void report(String path)
NOT YET DOCUMENTED


DLESE Tools
v1.6.0