org.apache.axis2.datasource.jaxb
Class JAXBDSContext

java.lang.Object
  extended by org.apache.axis2.datasource.jaxb.JAXBDSContext
Direct Known Subclasses:
JAXBBlockContext

public class JAXBDSContext
extends java.lang.Object


Field Summary
static boolean DEBUG_ENABLED
           
 
Constructor Summary
JAXBDSContext(javax.xml.bind.JAXBContext jaxbContext)
          "Dispatch" Constructor Use this full constructor when the JAXBContent is provided by the customer.
JAXBDSContext(java.lang.String contextPackage)
          Deprecated.  
JAXBDSContext(java.util.TreeSet<java.lang.String> packages)
          Slightly slower constructor
JAXBDSContext(java.util.TreeSet<java.lang.String> packages, java.lang.String packagesKey)
          Full Constructor JAXBDSContext (most performant)
 
Method Summary
protected  javax.xml.bind.attachment.AttachmentMarshaller createAttachmentMarshaller(javax.xml.stream.XMLStreamWriter writer)
          Create an AttachmentMarshaller to marshal MTOM/SWA Attachments
protected  javax.xml.bind.attachment.AttachmentUnmarshaller createAttachmentUnmarshaller()
          Create an Attachment unmarshaller for unmarshalling MTOM/SWA Attachments
 java.lang.ClassLoader getClassLoader()
           
 JAXBUtils.CONSTRUCTION_TYPE getConstructionType()
           
 java.util.TreeSet<java.lang.String> getContextPackages()
           
 javax.xml.bind.JAXBContext getJAXBContext()
           
 javax.xml.bind.JAXBContext getJAXBContext(java.lang.ClassLoader cl)
           
 MessageContext getMessageContext()
           
 java.lang.Class getProcessType()
           
 boolean isxmlList()
           
 void marshal(java.lang.Object obj, javax.xml.stream.XMLStreamWriter writer)
          Marshal the jaxb object
 void setIsxmlList(boolean isxmlList)
           
 void setMessageContext(MessageContext messageContext)
           
 void setProcessType(java.lang.Class type)
          Set RPC Declared Type.
 java.lang.Object unmarshal(javax.xml.stream.XMLStreamReader reader)
          Unmarshal the xml into a JAXB object
static java.lang.Object unmarshalAsListOrArray(javax.xml.stream.XMLStreamReader reader, javax.xml.bind.Unmarshaller u, java.lang.Class type)
          convert the String into a list or array
static java.lang.Object unmarshalByElement(javax.xml.bind.Unmarshaller u, javax.xml.stream.XMLStreamReader reader)
          Preferred way to unmarshal objects
static java.lang.Object unmarshalByType(javax.xml.bind.Unmarshaller u, javax.xml.stream.XMLStreamReader reader, java.lang.Class type, boolean isList, JAXBUtils.CONSTRUCTION_TYPE ctype)
          The root element being read is defined by schema/JAXB; however its contents are known by schema/JAXB.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEBUG_ENABLED

public static final boolean DEBUG_ENABLED
Constructor Detail

JAXBDSContext

public JAXBDSContext(java.util.TreeSet<java.lang.String> packages,
                     java.lang.String packagesKey)
Full Constructor JAXBDSContext (most performant)

Parameters:
packages - Set of packages needed by the JAXBContext.

JAXBDSContext

public JAXBDSContext(java.util.TreeSet<java.lang.String> packages)
Slightly slower constructor

Parameters:
packages -

JAXBDSContext

public JAXBDSContext(java.lang.String contextPackage)
Deprecated. 

Normal Constructor JAXBBlockContext

Parameters:
contextPackage -

JAXBDSContext

public JAXBDSContext(javax.xml.bind.JAXBContext jaxbContext)
"Dispatch" Constructor Use this full constructor when the JAXBContent is provided by the customer.

Parameters:
jaxbContext -
Method Detail

getContextPackages

public java.util.TreeSet<java.lang.String> getContextPackages()
Returns:
Class representing type of the element

getJAXBContext

public javax.xml.bind.JAXBContext getJAXBContext()
                                          throws javax.xml.bind.JAXBException
Throws:
javax.xml.bind.JAXBException

getJAXBContext

public javax.xml.bind.JAXBContext getJAXBContext(java.lang.ClassLoader cl)
                                          throws javax.xml.bind.JAXBException
Returns:
get the JAXBContext
Throws:
javax.xml.bind.JAXBException

getProcessType

public java.lang.Class getProcessType()
Returns:
RPC Declared Type

setProcessType

public void setProcessType(java.lang.Class type)
Set RPC Declared Type. The use of use this property if the message is style=document is discouraged.

Parameters:
type -

getConstructionType

public JAXBUtils.CONSTRUCTION_TYPE getConstructionType()

isxmlList

public boolean isxmlList()

setIsxmlList

public void setIsxmlList(boolean isxmlList)

getMessageContext

public MessageContext getMessageContext()

setMessageContext

public void setMessageContext(MessageContext messageContext)

getClassLoader

public java.lang.ClassLoader getClassLoader()

createAttachmentMarshaller

protected javax.xml.bind.attachment.AttachmentMarshaller createAttachmentMarshaller(javax.xml.stream.XMLStreamWriter writer)
Create an AttachmentMarshaller to marshal MTOM/SWA Attachments

Parameters:
writer -
Returns:

createAttachmentUnmarshaller

protected javax.xml.bind.attachment.AttachmentUnmarshaller createAttachmentUnmarshaller()
Create an Attachment unmarshaller for unmarshalling MTOM/SWA Attachments

Returns:
AttachmentUnmarshaller

unmarshal

public java.lang.Object unmarshal(javax.xml.stream.XMLStreamReader reader)
                           throws javax.xml.bind.JAXBException
Unmarshal the xml into a JAXB object

Parameters:
reader -
Returns:
Throws:
javax.xml.bind.JAXBException

marshal

public void marshal(java.lang.Object obj,
                    javax.xml.stream.XMLStreamWriter writer)
             throws javax.xml.bind.JAXBException
Marshal the jaxb object

Parameters:
obj -
writer -
am - AttachmentMarshaller, optional Attachment
Throws:
javax.xml.bind.JAXBException

unmarshalByType

public static java.lang.Object unmarshalByType(javax.xml.bind.Unmarshaller u,
                                               javax.xml.stream.XMLStreamReader reader,
                                               java.lang.Class type,
                                               boolean isList,
                                               JAXBUtils.CONSTRUCTION_TYPE ctype)
                                        throws WebServiceException
The root element being read is defined by schema/JAXB; however its contents are known by schema/JAXB. Therefore we use unmarshal by the declared type (This method is used to unmarshal rpc elements)

Parameters:
u - Unmarshaller
reader - XMLStreamReader
type - Class
Returns:
Object
Throws:
WebServiceException

unmarshalAsListOrArray

public static java.lang.Object unmarshalAsListOrArray(javax.xml.stream.XMLStreamReader reader,
                                                      javax.xml.bind.Unmarshaller u,
                                                      java.lang.Class type)
                                               throws java.lang.IllegalAccessException,
                                                      java.text.ParseException,
                                                      java.lang.NoSuchMethodException,
                                                      java.lang.InstantiationException,
                                                      javax.xml.datatype.DatatypeConfigurationException,
                                                      java.lang.reflect.InvocationTargetException,
                                                      javax.xml.bind.JAXBException
convert the String into a list or array

Type Parameters:
T -
Parameters:
jaxb -
type -
Returns:
Throws:
java.lang.IllegalAccessException
java.text.ParseException
java.lang.NoSuchMethodException
java.lang.InstantiationException
javax.xml.datatype.DatatypeConfigurationException
java.lang.reflect.InvocationTargetException
javax.xml.bind.JAXBException

unmarshalByElement

public static java.lang.Object unmarshalByElement(javax.xml.bind.Unmarshaller u,
                                                  javax.xml.stream.XMLStreamReader reader)
                                           throws WebServiceException
Preferred way to unmarshal objects

Parameters:
u - Unmarshaller
reader - XMLStreamReader
Returns:
Object that represents an element
Throws:
WebServiceException


Copyright © 2007 Apache Web Services Project. All Rights Reserved.