org.apache.axis2.description.java2wsdl
Class DefaultSchemaGenerator

java.lang.Object
  extended by org.apache.axis2.description.java2wsdl.DefaultSchemaGenerator
All Implemented Interfaces:
Java2WSDLConstants, SchemaGenerator
Direct Known Subclasses:
DocLitBareSchemaGenerator, JaxbSchemaGenerator

public class DefaultSchemaGenerator
extends Object
implements Java2WSDLConstants, SchemaGenerator


Nested Class Summary
 class DefaultSchemaGenerator.MathodComparator
           
 class DefaultSchemaGenerator.PropertyComparator
           
 
Field Summary
protected  String attrFormDefault
           
protected  ClassLoader classLoader
           
protected  String className
           
protected  String customSchemaLocation
           
protected  String elementFormDefault
           
protected  ArrayList<String> excludeMethods
           
protected  ArrayList<String> extraClasses
           
protected  boolean generateBaseException
           
protected  boolean isGenerateWrappedArrayTypes
           
protected  String mappingFileLocation
           
protected  Method[] methods
           
protected  MethodTable methodTable
           
static String NAME_SPACE_PREFIX
           
protected  ArrayList<String> nonRpcMethods
           
protected  NamespaceGenerator nsGen
           
protected  Map<String,String> pkg2nsmap
           
protected  String schema_namespace_prefix
           
protected  Map<String,org.apache.ws.commons.schema.XmlSchema> schemaMap
           
protected  String schemaTargetNameSpace
           
protected  AxisService service
           
protected  Class<?> serviceClass
           
protected  boolean sortAttributes
           
protected  String targetNamespace
           
protected  Map<String,String> targetNamespacePrefixMap
           
protected  TypeTable typeTable
           
protected  boolean useWSDLTypesNamespace
           
protected  org.apache.ws.commons.schema.XmlSchemaCollection xmlSchemaCollection
           
 
Fields inherited from interface org.apache.axis2.description.java2wsdl.Java2WSDLConstants
ATTR_FORM_DEFAULT_OPTION, ATTR_FORM_DEFAULT_OPTION_LONG, ATTRIBUTE_NAME, AXIS2_NAMESPACE_PREFIX, AXIS2_XSD, BINDING_LOCAL_NAME, BINDING_NAME_SUFFIX, CLASSNAME_OPTION, CLASSNAME_OPTION_LONG, CLASSPATH_OPTION, CLASSPATH_OPTION_LONG, COLON_SEPARATOR, CUSTOM_SCHEMA_LOCATION, CUSTOM_SCHEMA_LOCATION_LONG, DEFAULT_LOCATION_URL, DEFAULT_SCHEMA_NAMESPACE_PREFIX, DEFAULT_TARGET_NAMESPACE, DEFAULT_TARGET_NAMESPACE_PREFIX, DEFAULT_WSDL_NAMESPACE_PREFIX, DOC_LIT_BARE, DOC_LIT_BARE_LONG, DOC_LIT_BARE_PARAMETER, DOCUMENT, ELEMENT_ATTRIBUTE_NAME, ELEMENT_FORM_DEFAULT_OPTION, ELEMENT_FORM_DEFAULT_OPTION_LONG, EXTRA_CLASSES_DEFAULT_OPTION, EXTRA_CLASSES_DEFAULT_OPTION_LONG, FAULT_LOCAL_NAME, FAULT_MESSAGE, FORM_DEFAULT_QUALIFIED, FORM_DEFAULT_UNQUALIFIED, HTTP_BINDING, HTTP_NAMESPACE, HTTP_PORT, HTTP_PREFIX, IN_PUT_LOCAL_NAME, JAVA_PKG_2_NSMAP_OPTION, JAVA_PKG_2_NSMAP_OPTION_LONG, LITERAL, LOCATION, LOCATION_OPTION, LOCATION_OPTION_LONG, MESSAGE_LOCAL_NAME, MESSAGE_SUFFIX, MIME_NAMESPACE, MIME_PREFIX, NAMESPACE_GENERATOR_OPTION, NAMESPACE_GENERATOR_OPTION_LONG, OPERATION_LOCAL_NAME, OUT_PUT_LOCAL_NAME, OUTPUT_FILENAME_OPTION, OUTPUT_FILENAME_OPTION_LONG, OUTPUT_LOCATION_OPTION, OUTPUT_LOCATION_OPTION_LONG, PARAMETERS, PART_ATTRIBUTE_NAME, PORT, PORT_NAME_SUFFIX, PORT_TYPE_LOCAL_NAME, PORT_TYPE_SUFFIX, REQUEST, REQUEST_MESSAGE, RESPONSE, RESPONSE_MESSAGE, RESULT, SCHEMA_GENERATOR_OPTION, SCHEMA_GENERATOR_OPTION_LONG, SCHEMA_MAPPING_FILE_LOCATION, SCHEMA_MAPPING_FILE_LOCATION_LONG, SCHEMA_NAMESPACE_PRFIX, SCHEMA_TARGET_NAMESPACE_OPTION, SCHEMA_TARGET_NAMESPACE_OPTION_LONG, SCHEMA_TARGET_NAMESPACE_PREFIX_OPTION, SCHEMA_TARGET_NAMESPACE_PREFIX_OPTION_LONG, SERVICE_LOCAL_NAME, SERVICE_NAME_OPTION, SERVICE_NAME_OPTION_LONG, SOAP_ACTION, SOAP_ADDRESS, SOAP_BODY, SOAP_USE, SOAP11_PREFIX, SOAP11PORT, SOAP12_PREFIX, SOAP12BINDING_NAME_SUFFIX, SOAP12PORT, SOLE_INPUT, STYLE, STYLE_OPTION, STYLE_OPTION_LONG, TARGET_NAMESPACE_OPTION, TARGET_NAMESPACE_OPTION_LONG, TARGET_NAMESPACE_PREFIX_OPTION, TARGET_NAMESPACE_PREFIX_OPTION_LONG, TARGETNAMESPACE_PREFIX, TRANSPORT, TRANSPORT_URI, URI_2001_SCHEMA_XSD, URI_WSDL11_SOAP, URI_WSDL12_SOAP, URN_PREFIX, USE_OPTION, USE_OPTION_LONG, WSAD_NS, WSDL_NAMESPACE, WSDL_VERSION_1, WSDL_VERSION_2, WSDL_VERSION_2_OPTIONAL, WSDL_VERSION_OPTION, WSDL_VERSION_OPTION_LONG
 
Constructor Summary
DefaultSchemaGenerator(ClassLoader loader, String className, String schematargetNamespace, String schematargetNamespacePrefix, AxisService service)
           
 
Method Summary
protected  void addContentToMethodSchemaType(org.apache.ws.commons.schema.XmlSchemaSequence sequence, QName schemaTypeName, String paraName, boolean isArray)
           
protected  void addImport(org.apache.ws.commons.schema.XmlSchema xmlSchema, QName schemaTypeName)
           
protected  String generatePrefix()
           
 Collection<org.apache.ws.commons.schema.XmlSchema> generateSchema()
          Generates schema for all the parameters in method.
protected  QName generateSchema(Class<?> javaType)
          Generate schema construct for given type
protected  void generateSchemaforFieldsandProperties(org.apache.ws.commons.schema.XmlSchema xmlSchema, org.apache.ws.commons.schema.XmlSchemaSequence sequence, Class<?> type, String name, boolean isArrayType)
           
protected  void generateSchemaforGenericFields(org.apache.ws.commons.schema.XmlSchema xmlSchema, org.apache.ws.commons.schema.XmlSchemaSequence sequence, Type genericType, String name)
           
 String getAttrFormDefault()
           
protected  org.apache.ws.commons.schema.XmlSchemaForm getAttrFormDefaultSetting()
           
protected  String getClassName(Class<?> type)
           
protected  org.apache.ws.commons.schema.XmlSchemaComplexType getComplexTypeForElement(org.apache.ws.commons.schema.XmlSchema xmlSchema, QName name)
           
 String getCustomSchemaLocation()
           
 String getElementFormDefault()
           
protected  org.apache.ws.commons.schema.XmlSchemaForm getElementFormDefaultSetting()
           
 ArrayList<String> getExtraClasses()
           
 String getMappingFileLocation()
           
 Method[] getMethods()
           
 NamespaceGenerator getNsGen()
           
protected  String getParameterName(Annotation[][] parameterAnnotation, int j, String[] parameterNames)
           
 Map<String,String> getPkg2nsmap()
           
protected  String getQualifiedName(Package packagez)
           
 String getSchemaTargetNameSpace()
           
protected  String getSimpleClassName(Class type)
           
 String getTargetNamespace()
           
 TypeTable getTypeTable()
           
protected  org.apache.ws.commons.schema.XmlSchema getXmlSchema(String targetNamespace)
           
protected  boolean isDataHandler(Class<?> clazz)
           
 boolean isUseWSDLTypesNamespace()
           
protected  void processException(Method jMethod, AxisOperation axisOperation)
          This method will generate Schema element for all the excetion types in a given JMethod - No matter what it will generate Schema element for java.lang.Exception so that for other exception which extend java.lang.Excetion can use as the base class type
protected  Method[] processMethods(Method[] declaredMethods)
           
protected  String resolveSchemaNamespace(String packageName)
           
 void setAttrFormDefault(String attrFormDefault)
           
 void setAxisService(AxisService service)
           
 void setCustomSchemaLocation(String customSchemaLocation)
           
 void setElementFormDefault(String elementFormDefault)
           
 void setExcludeMethods(ArrayList<String> excludeMethods)
           
 void setExtraClasses(ArrayList<String> extraClasses)
           
 void setMappingFileLocation(String mappingFileLocation)
           
 void setNonRpcMethods(ArrayList<String> nonRpcMethods)
           
 void setNsGen(NamespaceGenerator nsGen)
           
 void setPkg2nsmap(Map<String,String> pkg2nsmap)
           
 void setUseWSDLTypesNamespace(boolean useWSDLTypesNamespace)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NAME_SPACE_PREFIX

public static final String NAME_SPACE_PREFIX
See Also:
Constant Field Values

targetNamespacePrefixMap

protected Map<String,String> targetNamespacePrefixMap

schemaMap

protected Map<String,org.apache.ws.commons.schema.XmlSchema> schemaMap

xmlSchemaCollection

protected org.apache.ws.commons.schema.XmlSchemaCollection xmlSchemaCollection

classLoader

protected ClassLoader classLoader

className

protected String className

typeTable

protected TypeTable typeTable

methods

protected Method[] methods

methodTable

protected MethodTable methodTable

schemaTargetNameSpace

protected String schemaTargetNameSpace

schema_namespace_prefix

protected String schema_namespace_prefix

attrFormDefault

protected String attrFormDefault

elementFormDefault

protected String elementFormDefault

excludeMethods

protected ArrayList<String> excludeMethods

extraClasses

protected ArrayList<String> extraClasses

useWSDLTypesNamespace

protected boolean useWSDLTypesNamespace

pkg2nsmap

protected Map<String,String> pkg2nsmap

nsGen

protected NamespaceGenerator nsGen

targetNamespace

protected String targetNamespace

nonRpcMethods

protected ArrayList<String> nonRpcMethods

serviceClass

protected Class<?> serviceClass

service

protected AxisService service

customSchemaLocation

protected String customSchemaLocation

mappingFileLocation

protected String mappingFileLocation

generateBaseException

protected boolean generateBaseException

sortAttributes

protected boolean sortAttributes

isGenerateWrappedArrayTypes

protected boolean isGenerateWrappedArrayTypes
Constructor Detail

DefaultSchemaGenerator

public DefaultSchemaGenerator(ClassLoader loader,
                              String className,
                              String schematargetNamespace,
                              String schematargetNamespacePrefix,
                              AxisService service)
                       throws Exception
Throws:
Exception
Method Detail

getNsGen

public NamespaceGenerator getNsGen()
                            throws Exception
Throws:
Exception

setNsGen

public void setNsGen(NamespaceGenerator nsGen)
Specified by:
setNsGen in interface SchemaGenerator

generateSchema

public Collection<org.apache.ws.commons.schema.XmlSchema> generateSchema()
                                                                  throws Exception
Generates schema for all the parameters in method. First generates schema for all different parameter type and later refers to them.

Specified by:
generateSchema in interface SchemaGenerator
Returns:
Returns XmlSchema.
Throws:
Exception

processMethods

protected Method[] processMethods(Method[] declaredMethods)
                           throws Exception
Throws:
Exception

processException

protected void processException(Method jMethod,
                                AxisOperation axisOperation)
                         throws Exception
This method will generate Schema element for all the excetion types in a given JMethod - No matter what it will generate Schema element for java.lang.Exception so that for other exception which extend java.lang.Excetion can use as the base class type

Throws:
Exception

generateSchema

protected QName generateSchema(Class<?> javaType)
                        throws Exception
Generate schema construct for given type

Parameters:
javaType - : Class to whcih need to generate Schema
Returns:
: Generated QName
Throws:
Exception

generateSchemaforFieldsandProperties

protected void generateSchemaforFieldsandProperties(org.apache.ws.commons.schema.XmlSchema xmlSchema,
                                                    org.apache.ws.commons.schema.XmlSchemaSequence sequence,
                                                    Class<?> type,
                                                    String name,
                                                    boolean isArrayType)
                                             throws Exception
Throws:
Exception

generateSchemaforGenericFields

protected void generateSchemaforGenericFields(org.apache.ws.commons.schema.XmlSchema xmlSchema,
                                              org.apache.ws.commons.schema.XmlSchemaSequence sequence,
                                              Type genericType,
                                              String name)
                                       throws Exception
Throws:
Exception

isDataHandler

protected boolean isDataHandler(Class<?> clazz)

addContentToMethodSchemaType

protected void addContentToMethodSchemaType(org.apache.ws.commons.schema.XmlSchemaSequence sequence,
                                            QName schemaTypeName,
                                            String paraName,
                                            boolean isArray)

getComplexTypeForElement

protected org.apache.ws.commons.schema.XmlSchemaComplexType getComplexTypeForElement(org.apache.ws.commons.schema.XmlSchema xmlSchema,
                                                                                     QName name)

getXmlSchema

protected org.apache.ws.commons.schema.XmlSchema getXmlSchema(String targetNamespace)

getTypeTable

public TypeTable getTypeTable()
Specified by:
getTypeTable in interface SchemaGenerator

getMethods

public Method[] getMethods()
Specified by:
getMethods in interface SchemaGenerator

generatePrefix

protected String generatePrefix()

setExcludeMethods

public void setExcludeMethods(ArrayList<String> excludeMethods)
Specified by:
setExcludeMethods in interface SchemaGenerator

getSchemaTargetNameSpace

public String getSchemaTargetNameSpace()
Specified by:
getSchemaTargetNameSpace in interface SchemaGenerator

addImport

protected void addImport(org.apache.ws.commons.schema.XmlSchema xmlSchema,
                         QName schemaTypeName)

getAttrFormDefault

public String getAttrFormDefault()

setAttrFormDefault

public void setAttrFormDefault(String attrFormDefault)
Specified by:
setAttrFormDefault in interface SchemaGenerator

getElementFormDefault

public String getElementFormDefault()

setElementFormDefault

public void setElementFormDefault(String elementFormDefault)
Specified by:
setElementFormDefault in interface SchemaGenerator

getAttrFormDefaultSetting

protected org.apache.ws.commons.schema.XmlSchemaForm getAttrFormDefaultSetting()

getElementFormDefaultSetting

protected org.apache.ws.commons.schema.XmlSchemaForm getElementFormDefaultSetting()

getExtraClasses

public ArrayList<String> getExtraClasses()

setExtraClasses

public void setExtraClasses(ArrayList<String> extraClasses)
Specified by:
setExtraClasses in interface SchemaGenerator

resolveSchemaNamespace

protected String resolveSchemaNamespace(String packageName)
                                 throws Exception
Throws:
Exception

isUseWSDLTypesNamespace

public boolean isUseWSDLTypesNamespace()

setUseWSDLTypesNamespace

public void setUseWSDLTypesNamespace(boolean useWSDLTypesNamespace)
Specified by:
setUseWSDLTypesNamespace in interface SchemaGenerator

getPkg2nsmap

public Map<String,String> getPkg2nsmap()

setPkg2nsmap

public void setPkg2nsmap(Map<String,String> pkg2nsmap)
Specified by:
setPkg2nsmap in interface SchemaGenerator

getTargetNamespace

public String getTargetNamespace()
Specified by:
getTargetNamespace in interface SchemaGenerator

getClassName

protected String getClassName(Class<?> type)

getSimpleClassName

protected String getSimpleClassName(Class type)

getQualifiedName

protected String getQualifiedName(Package packagez)

setNonRpcMethods

public void setNonRpcMethods(ArrayList<String> nonRpcMethods)
Specified by:
setNonRpcMethods in interface SchemaGenerator

setAxisService

public void setAxisService(AxisService service)
Specified by:
setAxisService in interface SchemaGenerator

getCustomSchemaLocation

public String getCustomSchemaLocation()
Specified by:
getCustomSchemaLocation in interface SchemaGenerator

setCustomSchemaLocation

public void setCustomSchemaLocation(String customSchemaLocation)
Specified by:
setCustomSchemaLocation in interface SchemaGenerator

getMappingFileLocation

public String getMappingFileLocation()
Specified by:
getMappingFileLocation in interface SchemaGenerator

setMappingFileLocation

public void setMappingFileLocation(String mappingFileLocation)
Specified by:
setMappingFileLocation in interface SchemaGenerator

getParameterName

protected String getParameterName(Annotation[][] parameterAnnotation,
                                  int j,
                                  String[] parameterNames)


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