Class NdrRequest

java.lang.Object
org.dlese.dpc.ndr.request.SimpleNdrRequest
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 Details

  • Constructor Details

    • 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 Details

    • 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, org.dom4j.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, org.dom4j.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(org.dom4j.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(org.dom4j.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, org.dom4j.Element content) throws Exception
      Throws:
      Exception
    • addNativeDataStreamCmd

      public void addNativeDataStreamCmd(String format, org.dom4j.Element content, String action) throws Exception
      Throws:
      Exception
    • addDataStreamCmd

      public void addDataStreamCmd(String format, org.dom4j.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, org.dom4j.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, org.dom4j.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(org.dom4j.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(org.dom4j.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(org.dom4j.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