org.openspml.message
Class SpmlResponse

java.lang.Object
  |
  +--org.openspml.message.SpmlResponse
Direct Known Subclasses:
AddResponse, BatchResponse, CancelResponse, DeleteResponse, ExtendedResponse, ModifyResponse, SchemaResponse, SearchResponse, StatusResponse

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

The base class for all class' representing SPML response messages.


Field Summary
static java.lang.String ERROR_CUSTOM_ERROR
          Error code indicating that a PSP specific error was returned.
static java.lang.String ERROR_MALFORMED_REQUEST
          Error code indicating a request formatting error.
static java.lang.String ERROR_NO_SUCH_IDENTIFIER
          Error code indicating that the identifier provided in the request did not match an object managed by the server.
static java.lang.String ERROR_NO_SUCH_REQUEST
          Error code indicating that the the identifier for an extended request was not recognized.
static java.lang.String ERROR_UNSUPPORTED_IDENTIFIER_TYPE
          Error code indicating that an identifier type used in the request is not supported by the server.
static java.lang.String ERROR_UNSUPPORTED_OPERATION
          Error code indicating that the requested operation is not supported by the server.
static java.lang.String RESULT_FAILURE
          Result code representing failure.
static java.lang.String RESULT_PENDING
          Result code indicating that the request is still pending.
static java.lang.String RESULT_SUCCESS
          Result codes representing success.
 
Fields inherited from interface org.openspml.message.Constants
ACTION_PREFIX, ENUM_PREFIX
 
Constructor Summary
SpmlResponse()
           
 
Method Summary
 void addExtendedErrorMessage(java.lang.String s)
          Add an extended error message as an operational attribute.
static SpmlResponse createResponseForRequest(org.openspml.message.Element domel)
          Static method to create an empty response object that corresponds to an request element.
static SpmlResponse createResponseForRequest(XmlElement e)
          Static method to create an empty response object that corresponds to an request element.
 void dumpFile(java.lang.String name)
          Handy function to call in the debugger.
 java.lang.String getError()
           
 java.lang.String getErrorMessage()
           
 java.util.List getExtendedErrorMessages()
           
 Attribute getOperationalAttribute(java.lang.String name)
           
 java.util.List getOperationalAttributes()
           
 java.lang.Object getOperationalAttributeValue(java.lang.String name)
           
 java.lang.String getRequestId()
           
 java.lang.String getResult()
           
 boolean isFailure()
           
static SpmlResponse parseResponse(org.openspml.message.Element domel)
          Static method to parse any root SPML response.
static SpmlResponse parseResponse(java.lang.String xml)
          Static method to parse the XML for one of the SpmlResponse classes and return the correct object.
static SpmlResponse parseResponse(XmlElement e)
          Static method to parse any root SPML response.
 void removeOperationalAttribute(java.lang.String name)
           
 void setError(java.lang.String s)
           
 void setErrorMessage(java.lang.String s)
           
 void setErrorMessage(java.lang.Throwable t)
           
 void setOperationalAttribute(Attribute a)
           
 void setOperationalAttribute(java.lang.String name, java.lang.Object value)
           
 void setOperationalAttributes(java.util.List l)
           
 void setOperationalAttributes(java.util.Map src)
          Sets the list of attributes from a map of name/value pairs.
 void setRequestId(java.lang.String s)
           
 void setResult(java.lang.String s)
           
 void throwErrors()
          Examine the response for errors.
 java.lang.String toXml()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

RESULT_SUCCESS

public static final java.lang.String RESULT_SUCCESS
Result codes representing success.

RESULT_FAILURE

public static final java.lang.String RESULT_FAILURE
Result code representing failure.

RESULT_PENDING

public static final java.lang.String RESULT_PENDING
Result code indicating that the request is still pending.

ERROR_MALFORMED_REQUEST

public static final java.lang.String ERROR_MALFORMED_REQUEST
Error code indicating a request formatting error.

ERROR_UNSUPPORTED_OPERATION

public static final java.lang.String ERROR_UNSUPPORTED_OPERATION
Error code indicating that the requested operation is not supported by the server.

ERROR_UNSUPPORTED_IDENTIFIER_TYPE

public static final java.lang.String ERROR_UNSUPPORTED_IDENTIFIER_TYPE
Error code indicating that an identifier type used in the request is not supported by the server.

ERROR_NO_SUCH_IDENTIFIER

public static final java.lang.String ERROR_NO_SUCH_IDENTIFIER
Error code indicating that the identifier provided in the request did not match an object managed by the server.

ERROR_NO_SUCH_REQUEST

public static final java.lang.String ERROR_NO_SUCH_REQUEST
Error code indicating that the the identifier for an extended request was not recognized. // ?? true, or is this used for statusRequest/cancelRequst?

ERROR_CUSTOM_ERROR

public static final java.lang.String ERROR_CUSTOM_ERROR
Error code indicating that a PSP specific error was returned.
Constructor Detail

SpmlResponse

public SpmlResponse()
Method Detail

setRequestId

public void setRequestId(java.lang.String s)

setResult

public void setResult(java.lang.String s)

setError

public void setError(java.lang.String s)

setErrorMessage

public void setErrorMessage(java.lang.String s)

setErrorMessage

public void setErrorMessage(java.lang.Throwable t)

addExtendedErrorMessage

public void addExtendedErrorMessage(java.lang.String s)
Add an extended error message as an operational attribute. This is not part of the standard, but is commonly convenient.

setOperationalAttributes

public void setOperationalAttributes(java.util.List l)

setOperationalAttributes

public void setOperationalAttributes(java.util.Map src)
Sets the list of attributes from a map of name/value pairs.

setOperationalAttribute

public void setOperationalAttribute(Attribute a)

setOperationalAttribute

public void setOperationalAttribute(java.lang.String name,
                                    java.lang.Object value)

removeOperationalAttribute

public void removeOperationalAttribute(java.lang.String name)

getResult

public java.lang.String getResult()

isFailure

public boolean isFailure()

getError

public java.lang.String getError()

getErrorMessage

public java.lang.String getErrorMessage()

getRequestId

public java.lang.String getRequestId()

getExtendedErrorMessages

public java.util.List getExtendedErrorMessages()

getOperationalAttributes

public java.util.List getOperationalAttributes()

getOperationalAttribute

public Attribute getOperationalAttribute(java.lang.String name)

getOperationalAttributeValue

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

throwErrors

public void throwErrors()
                 throws SpmlException
Examine the response for errors. If errors are found, format them into a single message and throw an exception containing the message.

toXml

public java.lang.String toXml()

parseResponse

public static SpmlResponse parseResponse(java.lang.String xml)
                                  throws SpmlException
Static method to parse the XML for one of the SpmlResponse classes and return the correct object. Will accept a complete or a disembodied SpmlResponse element.

parseResponse

public static SpmlResponse parseResponse(org.openspml.message.Element domel)
Static method to parse any root SPML response.

parseResponse

public static SpmlResponse parseResponse(XmlElement e)
Static method to parse any root SPML response.

createResponseForRequest

public static SpmlResponse createResponseForRequest(org.openspml.message.Element domel)
Static method to create an empty response object that corresponds to an request element. This is used in cases where we couldn't parse the request, but the response we send back with the error messages is expected to match the request.

createResponseForRequest

public static SpmlResponse createResponseForRequest(XmlElement e)
Static method to create an empty response object that corresponds to an request element. This is used in cases where we couldn't parse the request, but the response we send back with the error messages is expected to match the request.

dumpFile

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