org.apache.axis2.jaxws.runtime.description.marshal.impl
Class PackageSetBuilder

java.lang.Object
  extended by org.apache.axis2.jaxws.runtime.description.marshal.impl.PackageSetBuilder

public class PackageSetBuilder
extends Object

In order to marshal or unmarshal the user data, we need to know the set of packages involved. The set of packages is used to construct an appropriate JAXBContext object during the marshalling/unmarshalling.

There are two ways to get this data.

Schema Walk (preferred): Get the list of packages by walking the schemas that are referenced by the wsdl (or generated wsdl). Each schema represents a different package. The package is obtained using the jaxb customization or JAXB default ns<->package rule.

Annotation Walk(secondary) : Walk the list of Endpoints, Operations, Parameters, etc. and build a list of packages by looking at the classes involved.

The Schema Walk is faster and more complete, but relies on the presence of the schema or wsdl.

The Annotation Walk is slower and is not complete. For example, the annotation walk may not discover the packages for derived types that are defined in a different schema than the formal parameter types.


Method Summary
static String getPackageFromClass(Class cls)
          Return the package associated with the class name.
static String getPackageFromClassName(String className)
          Return the package associated with the class name.
static TreeSet<String> getPackagesFromAnnotations(ServiceDescription serviceDesc, MarshalServiceRuntimeDescription msrd)
           
static TreeSet<String> getPackagesFromSchema(ServiceDescription serviceDesc)
          Walks the schemas of the serviceDesc's wsdl (or generated wsdl) to determine the list of packages.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getPackagesFromSchema

public static TreeSet<String> getPackagesFromSchema(ServiceDescription serviceDesc)
Walks the schemas of the serviceDesc's wsdl (or generated wsdl) to determine the list of packages. This is the preferred algorithm for discovering the package set.

Parameters:
serviceDesc - ServiceDescription
Returns:
Set of Packages

getPackagesFromAnnotations

public static TreeSet<String> getPackagesFromAnnotations(ServiceDescription serviceDesc,
                                                         MarshalServiceRuntimeDescription msrd)
Parameters:
serviceDescription - ServiceDescription
Returns:
Set of Packages

getPackageFromClassName

public static String getPackageFromClassName(String className)
Return the package associated with the class name. The className may not be specified (in which case a null Package is returned). If class has anunnamed package return ""

Parameters:
className - String (may be null or empty)
Returns:
String or null if problems occur

getPackageFromClass

public static String getPackageFromClass(Class cls)
Return the package associated with the class name. The className may not be specified (in which case a null Package is returned). if class has unnamed package return ""

Parameters:
cls - Class
Returns:
String or null


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