uk.org.ogsadai.common.serializer
Class SerializerUtils

java.lang.Object
  |
  +--uk.org.ogsadai.common.serializer.SerializerUtils

public class SerializerUtils
extends java.lang.Object

A set of useful methods related to serialization, deserialization and building and parsing SOAP messages.

Author:
The OGSA-DAI Project Team

Field Summary
private static java.lang.String COPYRIGHT_NOTICE
           
private static DAILogger LOG
           
 
Constructor Summary
SerializerUtils()
           
 
Method Summary
static org.w3c.dom.Document toDocument(org.apache.axis.message.MessageElement element)
          Deserialize the given MessageElement into a DOM Document.
static org.w3c.dom.Document toDocument(org.apache.axis.message.MessageElement[] elements)
          Deserialize the first MessageElement in the given array into a DOM Document
static org.w3c.dom.Element toElement(org.apache.axis.message.MessageElement element)
          Deserialize the given MessageElement into a DOM Element.
static org.w3c.dom.Element[] toElement(org.apache.axis.message.MessageElement[] elements)
          Deserialize the MessageElements in the given array into DOM Elements
static org.apache.axis.message.MessageElement[] toMessage(javax.xml.namespace.QName name, java.lang.Object value)
          Create an array of org.apache.axis.nessage.MessageElement objects where the first in the array contains an element with the given name and value.
static java.lang.Object toObject(org.apache.axis.message.MessageElement element)
          Deserialize the given MessageElement into an object.
static java.lang.Object toObject(org.apache.axis.message.MessageElement[] elements)
          Deserialize the first MessageElement in the given array into an object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

COPYRIGHT_NOTICE

private static final java.lang.String COPYRIGHT_NOTICE
See Also:
Constant Field Values

LOG

private static final DAILogger LOG
Constructor Detail

SerializerUtils

public SerializerUtils()
Method Detail

toMessage

public static org.apache.axis.message.MessageElement[] toMessage(javax.xml.namespace.QName name,
                                                                 java.lang.Object value)
Create an array of org.apache.axis.nessage.MessageElement objects where the first in the array contains an element with the given name and value.

If the given object is a string, qualified name or byte array then an attribute of form xsd:type="xsd:string", xsd:type="xsd:QName" or xsd:type="xsd:base64Binary" is added to the first MessageElement in the array.

This is because this information, though added anyway, was being removed just prior to transmission of the message for reasons that are unclear.

Parameters:
name - Qualified name of message element.
value - Content of message element.
Returns:
an array containing a single SOAP message element

toObject

public static java.lang.Object toObject(org.apache.axis.message.MessageElement[] elements)
                                 throws DAISerializationException
Deserialize the first MessageElement in the given array into an object.

Parameters:
elements - Array of MessageElements.
Returns:
deserialized object or null if elements is null or empty.
Throws:
DAISerializationException - if an XML type is unsupported or if it has no deserializer or another problem occurs.
See Also:
toObject(org.apache.axis.message.MessageElement)

toObject

public static java.lang.Object toObject(org.apache.axis.message.MessageElement element)
                                 throws DAISerializationException
Deserialize the given MessageElement into an object.

Parameters:
element - The MessageElement to be deserialized.
Returns:
deserialized object or null if elements is null.
Throws:
DAISerializationException - if an XML type is unsupported or if it has no deserializer or another problem occurs.

toDocument

public static org.w3c.dom.Document toDocument(org.apache.axis.message.MessageElement[] elements)
                                       throws DAISerializationException
Deserialize the first MessageElement in the given array into a DOM Document

Parameters:
elements - Array of MessageElements.
Returns:
deserialized Document or null if elements is null or empty.
Throws:
DAISerializationException - if a problem occurs during deserialization.
See Also:
toDocument(org.apache.axis.message.MessageElement)

toDocument

public static org.w3c.dom.Document toDocument(org.apache.axis.message.MessageElement element)
                                       throws DAISerializationException
Deserialize the given MessageElement into a DOM Document.

Parameters:
element - MessageElement to be deserialized.
Returns:
deserialized Document.
Throws:
DAISerializationException - if a problem occurs during deserialization.
See Also:
toElement(org.apache.axis.message.MessageElement)

toElement

public static org.w3c.dom.Element[] toElement(org.apache.axis.message.MessageElement[] elements)
                                       throws DAISerializationException
Deserialize the MessageElements in the given array into DOM Elements

Parameters:
elements - array of MessageElements.
Returns:
deserialized Elements or null if elements is null or empty.
Throws:
DAISerializationException - if a problem occurs during deserialization.
See Also:
toElement(org.apache.axis.message.MessageElement)

toElement

public static org.w3c.dom.Element toElement(org.apache.axis.message.MessageElement element)
                                     throws DAISerializationException
Deserialize the given MessageElement into a DOM Element.

Parameters:
element - MessageElement to be deserialized.
Returns:
deserialized Element.
Throws:
DAISerializationException - if a problem occurs during deserialization.