org.openspml.v2.util
Class SimpleSPMLMarshaller

java.lang.Object
  extended byorg.openspml.v2.util.SimpleSPMLMarshaller
All Implemented Interfaces:
SPMLMarshaller

public class SimpleSPMLMarshaller
extends java.lang.Object
implements SPMLMarshaller

This is a class that we can use in the web.xml to marshall and unmarshall requests and responses. It's suitable for use as a bootstrap.


Constructor Summary
SimpleSPMLMarshaller()
           
 
Method Summary
 java.lang.String getUniqueName()
          Marshaller implementations should provide a unique name.
 void init(java.util.Map map)
          Called during initialization.
 java.lang.String marshallResponse(Response response)
           
 Request unmarshallRequest(java.lang.String s)
          Process a request.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SimpleSPMLMarshaller

public SimpleSPMLMarshaller()
Method Detail

init

public void init(java.util.Map map)
          throws Spml2Exception
Description copied from interface: SPMLMarshaller
Called during initialization.

Specified by:
init in interface SPMLMarshaller
Throws:
Spml2Exception

getUniqueName

public java.lang.String getUniqueName()
Description copied from interface: SPMLMarshaller
Marshaller implementations should provide a unique name.

Specified by:
getUniqueName in interface SPMLMarshaller
Returns:
get us a name to know this object by...

unmarshallRequest

public Request unmarshallRequest(java.lang.String s)
                          throws Spml2Exception
Description copied from interface: SPMLMarshaller
Process a request.

This is expected to take XML (or some other text format) and convert it to and from the Java classes in the msg package.

If the marshaller does not recognize the request, it must return null.

If the marshaller recognizes the message, it must return a properly formatted string (likely of XML) containing the entire response; including error responses.

The marshaller is expected to throw any exception, but should catch SPMLExceptions and return the approriately formatted response. Other exceptions will be handled in the upper levels.

Specified by:
unmarshallRequest in interface SPMLMarshaller
Throws:
Spml2Exception

marshallResponse

public java.lang.String marshallResponse(Response response)
                                  throws Spml2Exception
Specified by:
marshallResponse in interface SPMLMarshaller
Throws:
Spml2Exception


Copyright © Sun Microsystems, Inc. All Rights Reserved.