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 Object


Field Summary
static boolean DEBUG_ENABLED
           
 
Constructor Summary
JAXBDSContext(JAXBContext jaxbContext)
          "Dispatch" Constructor Use this full constructor when the JAXBContent is provided by the customer.
JAXBDSContext(String contextPackage)
          Deprecated.  
JAXBDSContext(TreeSet<String> packages)
          Slightly slower constructor
JAXBDSContext(TreeSet<String> packages, String packagesKey)
          Full Constructor JAXBDSContext (most performant)
 
Method Summary
protected  AttachmentMarshaller createAttachmentMarshaller(XMLStreamWriter writer)
          Create an AttachmentMarshaller to marshal MTOM/SWA Attachments
protected  AttachmentUnmarshaller createAttachmentUnmarshaller(org.apache.axiom.util.stax.xop.MimePartProvider mimePartProvider)
          Create an Attachment unmarshaller for unmarshalling MTOM/SWA Attachments
 ClassLoader getClassLoader()
           
 JAXBUtils.CONSTRUCTION_TYPE getConstructionType()
           
 TreeSet<String> getContextPackages()
           
 JAXBContext getJAXBContext()
           
 JAXBContext getJAXBContext(ClassLoader cl)
           
 JAXBContext getJAXBContext(ClassLoader cl, boolean forceArrays)
           
 MessageContext getMessageContext()
           
 Class getProcessType()
           
 boolean isxmlList()
           
 void marshal(Object obj, XMLStreamWriter writer)
          Marshal the jaxb object
 void setIsxmlList(boolean isxmlList)
           
 void setMessageContext(MessageContext messageContext)
           
 void setProcessType(Class type)
          The procesess type to indicate the class of the target of the unmarshaling.
 void setWebServiceNamespace(String namespace)
           
 Object unmarshal(XMLStreamReader inputReader)
          Unmarshal the xml into a JAXB object
static Object unmarshalAsListOrArray(XMLStreamReader reader, Unmarshaller u, Class type)
          convert the String into a list or array
static Object unmarshalByElement(Unmarshaller u, XMLStreamReader reader)
          Preferred way to unmarshal objects
static Object unmarshalByType(Unmarshaller u, XMLStreamReader reader, 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(TreeSet<String> packages,
                     String packagesKey)
Full Constructor JAXBDSContext (most performant)

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

JAXBDSContext

public JAXBDSContext(TreeSet<String> packages)
Slightly slower constructor

Parameters:
packages -

JAXBDSContext

public JAXBDSContext(String contextPackage)
Deprecated. 

Normal Constructor JAXBBlockContext

Parameters:
contextPackage -

JAXBDSContext

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

Parameters:
jaxbContext -
Method Detail

getContextPackages

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

getJAXBContext

public JAXBContext getJAXBContext()
                           throws JAXBException
Throws:
JAXBException

getJAXBContext

public JAXBContext getJAXBContext(ClassLoader cl)
                           throws JAXBException
Returns:
get the JAXBContext
Throws:
JAXBException

getJAXBContext

public JAXBContext getJAXBContext(ClassLoader cl,
                                  boolean forceArrays)
                           throws JAXBException
Parameters:
ClassLoader -
forceArrays - boolean (if true, then JAXBContext will automatically contain arrays)
Returns:
get the JAXBContext
Throws:
JAXBException

setWebServiceNamespace

public void setWebServiceNamespace(String namespace)

getProcessType

public Class getProcessType()
Returns:
RPC Declared Type

setProcessType

public void setProcessType(Class type)
The procesess type to indicate the class of the target of the unmarshaling. This method should only be used in the cases where the element being unmarshaled is not known to the JAXBContext (examples include RPC/Literal processing and Doc/Literal Wrapped processing with a non-element wrapper class)

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 ClassLoader getClassLoader()

createAttachmentMarshaller

protected AttachmentMarshaller createAttachmentMarshaller(XMLStreamWriter writer)
Create an AttachmentMarshaller to marshal MTOM/SWA Attachments

Parameters:
writer -
Returns:

createAttachmentUnmarshaller

protected AttachmentUnmarshaller createAttachmentUnmarshaller(org.apache.axiom.util.stax.xop.MimePartProvider mimePartProvider)
Create an Attachment unmarshaller for unmarshalling MTOM/SWA Attachments

Returns:
AttachmentUnmarshaller

unmarshal

public Object unmarshal(XMLStreamReader inputReader)
                 throws JAXBException
Unmarshal the xml into a JAXB object

Parameters:
inputReader -
Returns:
Throws:
JAXBException

marshal

public void marshal(Object obj,
                    XMLStreamWriter writer)
             throws JAXBException
Marshal the jaxb object

Parameters:
obj -
writer -
am - AttachmentMarshaller, optional Attachment
Throws:
JAXBException

unmarshalByType

public static Object unmarshalByType(Unmarshaller u,
                                     XMLStreamReader reader,
                                     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 Object unmarshalAsListOrArray(XMLStreamReader reader,
                                            Unmarshaller u,
                                            Class type)
                                     throws IllegalAccessException,
                                            ParseException,
                                            NoSuchMethodException,
                                            InstantiationException,
                                            DatatypeConfigurationException,
                                            InvocationTargetException,
                                            JAXBException
convert the String into a list or array

Type Parameters:
T -
Parameters:
jaxb -
type -
Returns:
Throws:
IllegalAccessException
ParseException
NoSuchMethodException
InstantiationException
DatatypeConfigurationException
InvocationTargetException
JAXBException

unmarshalByElement

public static Object unmarshalByElement(Unmarshaller u,
                                        XMLStreamReader reader)
                                 throws WebServiceException
Preferred way to unmarshal objects

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


Copyright © 2004-2012 The Apache Software Foundation. All Rights Reserved.