org.openspml.message
Class SpmlRequest

java.lang.Object
  |
  +--org.openspml.message.SpmlRequest
Direct Known Subclasses:
AddRequest, BatchRequest, CancelRequest, DeleteRequest, ExtendedRequest, ModifyRequest, SchemaRequest, SearchRequest, StatusRequest

public abstract class SpmlRequest
extends java.lang.Object
implements Constants

The base class for all SPML request objects. It provides a request ID, request mode, and a collection of vendor specfific operational attributes.


Field Summary
static java.lang.String EXEC_ASYNCHRONOUS
           
static java.lang.String EXEC_SYNCHRONOUS
          Internal constants for the execution type.
 
Fields inherited from interface org.openspml.message.Constants
ACTION_PREFIX, ENUM_PREFIX
 
Constructor Summary
SpmlRequest()
           
 
Method Summary
abstract  SpmlResponse createResponse()
          Build an empty SpmlRequest object that corresponds to this request.
 void dumpFile(java.lang.String name)
          Handy function to call in the debugger.
abstract  java.lang.String getElementName()
          Return the tag name for the request element.
 Identifier getIdentifier()
          Return the target object identifier.
 java.lang.String getIdentifierString()
          Return the target object identifier as a string.
 Attribute getOperationalAttribute(java.lang.String name)
          Lookup an attribute by name.
 java.util.List getOperationalAttributes()
          Return the list of operational attributes.
 java.lang.Object getOperationalAttributeValue(java.lang.String name)
           
 java.lang.String getRequestId()
          Return the optional request id.
 boolean isAsynchronous()
          Return true if asynchronous execution was requested.
static SpmlRequest parseRequest(org.openspml.message.Element domel)
          Parse one of the "root" requests.
static SpmlRequest parseRequest(XmlElement e)
          Parse one of the "root" requests.
 void setAsynchronous(boolean b)
          Set a flag indicating whether the request is to be performed asynchronously.
 void setIdentifier(Identifier id)
          Sets the target object identifier.
 void setIdentifier(java.lang.String id)
          Sets the target object identifier.
 void setOperationalAttribute(Attribute a)
          Set one operational attribute specified as an Attribute object.
 void setOperationalAttribute(java.lang.String name, java.lang.Object value)
          Set an operational attribute specified as a name/value pair.
 void setOperationalAttributes(java.util.List l)
          Set the list of operational attributes.
 void setRequestId(java.lang.String s)
          Set the optional request id.
 java.lang.String toXml()
          Render requst XML.
 void toXml(SpmlBuffer b)
          Render requst XML into an existing buffer.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

EXEC_SYNCHRONOUS

public static final java.lang.String EXEC_SYNCHRONOUS
Internal constants for the execution type.

EXEC_ASYNCHRONOUS

public static final java.lang.String EXEC_ASYNCHRONOUS
Constructor Detail

SpmlRequest

public SpmlRequest()
Method Detail

setRequestId

public void setRequestId(java.lang.String s)
Set the optional request id.

setAsynchronous

public void setAsynchronous(boolean b)
Set a flag indicating whether the request is to be performed asynchronously.

setOperationalAttributes

public void setOperationalAttributes(java.util.List l)
Set the list of operational attributes. The list must contain Attribute objects.
See Also:
#Attribute

setOperationalAttribute

public void setOperationalAttribute(Attribute a)
Set one operational attribute specified as an Attribute object.
See Also:
#Attribute

setOperationalAttribute

public void setOperationalAttribute(java.lang.String name,
                                    java.lang.Object value)
Set an operational attribute specified as a name/value pair.

Note that while the method allows values of any type, in practice this should be limited to String values until the specification is extended to support complex value types.


setIdentifier

public void setIdentifier(Identifier id)
Sets the target object identifier. This is relevant only for AddRequest, ModifyRequest, and DeleteRequest.

setIdentifier

public void setIdentifier(java.lang.String id)
Sets the target object identifier. This will implicitly construct an Identifier object whose type is GenericString.

createResponse

public abstract SpmlResponse createResponse()
Build an empty SpmlRequest object that corresponds to this request. Used in a few error conditions to return the expected response object when one was not actually sent back from the server.

getRequestId

public java.lang.String getRequestId()
Return the optional request id.

isAsynchronous

public boolean isAsynchronous()
Return true if asynchronous execution was requested.

getOperationalAttributes

public java.util.List getOperationalAttributes()
Return the list of operational attributes. The list will contain Attribute objects.

getIdentifier

public Identifier getIdentifier()
Return the target object identifier.
See Also:
#Identifier

getIdentifierString

public java.lang.String getIdentifierString()
Return the target object identifier as a string.

getOperationalAttribute

public Attribute getOperationalAttribute(java.lang.String name)
Lookup an attribute by name. // More common to look for these by name than in other requests? // Assuming the list is short, otherwise use a HashMap.

getOperationalAttributeValue

public java.lang.Object getOperationalAttributeValue(java.lang.String name)

getElementName

public abstract java.lang.String getElementName()
Return the tag name for the request element.

toXml

public java.lang.String toXml()
Render requst XML.

toXml

public void toXml(SpmlBuffer b)
Render requst XML into an existing buffer. According to the schema, operational attributes must come first.

parseRequest

public static SpmlRequest parseRequest(org.openspml.message.Element domel)
Parse one of the "root" requests.

parseRequest

public static SpmlRequest parseRequest(XmlElement e)
Parse one of the "root" requests.

dumpFile

public void dumpFile(java.lang.String name)
Handy function to call in the debugger.