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 java.lang.Object
implements Java2WSDLConstants, SchemaGenerator


Field Summary
protected  java.lang.String attrFormDefault
           
protected  java.lang.ClassLoader classLoader
           
protected  java.lang.String className
           
protected  java.lang.String customSchemaLocation
           
protected  java.lang.String elementFormDefault
           
protected  java.util.ArrayList excludeMethods
           
protected  java.util.ArrayList extraClasses
           
protected  boolean generateBaseException
           
protected  java.lang.String mappingFileLocation
           
protected  org.codehaus.jam.JMethod[] methods
           
protected  MethodTable methodTable
           
static java.lang.String NAME_SPACE_PREFIX
           
protected  java.util.ArrayList nonRpcMethods
           
protected  NamespaceGenerator nsGen
           
protected  java.util.Map pkg2nsmap
           
protected  java.lang.String schema_namespace_prefix
           
protected  java.util.Map schemaMap
           
protected  java.lang.String schemaTargetNameSpace
           
protected  AxisService service
           
protected  java.lang.Class serviceClass
           
protected  java.lang.String targetNamespace
           
protected  java.util.Map 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(java.lang.ClassLoader loader, java.lang.String className, java.lang.String schematargetNamespace, java.lang.String schematargetNamespacePrefix, AxisService service)
           
 
Method Summary
protected  void addContentToMethodSchemaType(org.apache.ws.commons.schema.XmlSchemaSequence sequence, QName schemaTypeName, java.lang.String paraName, boolean isArray)
           
protected  void addImport(org.apache.ws.commons.schema.XmlSchema xmlSchema, QName schemaTypeName)
           
protected  java.lang.String generatePrefix()
           
 java.util.Collection generateSchema()
          Generates schema for all the parameters in method.
protected  void generateSchemaforFieldsandProperties(org.apache.ws.commons.schema.XmlSchema xmlSchema, org.apache.ws.commons.schema.XmlSchemaSequence sequence, org.codehaus.jam.JClass type, java.lang.String name, boolean isArryType)
           
protected  java.lang.String getActualQualifiedName(org.codehaus.jam.JClass type)
           
 java.lang.String getAttrFormDefault()
           
protected  org.apache.ws.commons.schema.XmlSchemaForm getAttrFormDefaultSetting()
           
protected  org.apache.ws.commons.schema.XmlSchemaComplexType getComplexTypeForElement(org.apache.ws.commons.schema.XmlSchema xmlSchema, QName name)
           
static java.lang.String getCorrectName(java.lang.String wrongName)
          JAM converts the first letter of a field into uppercase, so field "foo" would end up called "Foo".
 java.lang.String getCustomSchemaLocation()
           
 java.lang.String getElementFormDefault()
           
protected  org.apache.ws.commons.schema.XmlSchemaForm getElementFormDefaultSetting()
           
 java.util.ArrayList getExtraClasses()
           
 java.lang.String getMappingFileLocation()
           
 org.codehaus.jam.JMethod[] getMethods()
           
 NamespaceGenerator getNsGen()
           
 java.util.Map getPkg2nsmap()
           
protected  java.lang.String getQualifiedName(org.codehaus.jam.JClass type)
           
protected  java.lang.String getQualifiedName(org.codehaus.jam.JMethod method)
           
protected  java.lang.String getQualifiedName(org.codehaus.jam.JPackage packagez)
           
protected  java.lang.String getQualifiedName(org.codehaus.jam.JParameter parameter)
           
protected  java.lang.String getQualifiedName(org.codehaus.jam.JProperty peroperty)
           
 java.lang.String getSchemaTargetNameSpace()
           
protected  java.lang.String getSimpleName(org.codehaus.jam.JClass type)
           
protected  java.lang.String getSimpleName(org.codehaus.jam.JMethod method)
           
protected  java.lang.String getSimpleName(org.codehaus.jam.JParameter parameter)
           
protected  java.lang.String getSimpleName(org.codehaus.jam.JProperty peroperty)
           
 java.lang.String getTargetNamespace()
           
 TypeTable getTypeTable()
           
protected  org.apache.ws.commons.schema.XmlSchema getXmlSchema(java.lang.String targetNamespace)
           
protected  boolean isDataHandler(org.codehaus.jam.JClass clazz)
           
 boolean isUseWSDLTypesNamespace()
           
protected  void processException(org.codehaus.jam.JMethod 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  org.codehaus.jam.JMethod[] processMethods(org.codehaus.jam.JMethod[] declaredMethods)
           
protected  java.lang.String resolveSchemaNamespace(java.lang.String packageName)
           
 void setAttrFormDefault(java.lang.String attrFormDefault)
           
 void setAxisService(AxisService service)
           
 void setCustomSchemaLocation(java.lang.String customSchemaLocation)
           
 void setElementFormDefault(java.lang.String elementFormDefault)
           
 void setExcludeMethods(java.util.ArrayList excludeMethods)
           
 void setExtraClasses(java.util.ArrayList extraClasses)
           
 void setMappingFileLocation(java.lang.String mappingFileLocation)
           
 void setNonRpcMethods(java.util.ArrayList nonRpcMethods)
           
 void setNsGen(NamespaceGenerator nsGen)
           
 void setPkg2nsmap(java.util.Map 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 java.lang.String NAME_SPACE_PREFIX
See Also:
Constant Field Values

targetNamespacePrefixMap

protected java.util.Map targetNamespacePrefixMap

schemaMap

protected java.util.Map schemaMap

xmlSchemaCollection

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

classLoader

protected java.lang.ClassLoader classLoader

className

protected java.lang.String className

typeTable

protected TypeTable typeTable

methods

protected org.codehaus.jam.JMethod[] methods

methodTable

protected MethodTable methodTable

schemaTargetNameSpace

protected java.lang.String schemaTargetNameSpace

schema_namespace_prefix

protected java.lang.String schema_namespace_prefix

attrFormDefault

protected java.lang.String attrFormDefault

elementFormDefault

protected java.lang.String elementFormDefault

excludeMethods

protected java.util.ArrayList excludeMethods

extraClasses

protected java.util.ArrayList extraClasses

useWSDLTypesNamespace

protected boolean useWSDLTypesNamespace

pkg2nsmap

protected java.util.Map pkg2nsmap

nsGen

protected NamespaceGenerator nsGen

targetNamespace

protected java.lang.String targetNamespace

nonRpcMethods

protected java.util.ArrayList nonRpcMethods

serviceClass

protected java.lang.Class serviceClass

service

protected AxisService service

customSchemaLocation

protected java.lang.String customSchemaLocation

mappingFileLocation

protected java.lang.String mappingFileLocation

generateBaseException

protected boolean generateBaseException
Constructor Detail

DefaultSchemaGenerator

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

getNsGen

public NamespaceGenerator getNsGen()
                            throws java.lang.Exception
Throws:
java.lang.Exception

setNsGen

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

generateSchema

public java.util.Collection generateSchema()
                                    throws java.lang.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:
java.lang.Exception

processMethods

protected org.codehaus.jam.JMethod[] processMethods(org.codehaus.jam.JMethod[] declaredMethods)
                                             throws java.lang.Exception
Throws:
java.lang.Exception

processException

protected void processException(org.codehaus.jam.JMethod jMethod,
                                AxisOperation axisOperation)
                         throws java.lang.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:
java.lang.Exception

getCorrectName

public static java.lang.String getCorrectName(java.lang.String wrongName)
JAM converts the first letter of a field into uppercase, so field "foo" would end up called "Foo". This method corrects that problem.

Parameters:
wrongName -
Returns:
the right name, using english as the locale for case conversion

generateSchemaforFieldsandProperties

protected void generateSchemaforFieldsandProperties(org.apache.ws.commons.schema.XmlSchema xmlSchema,
                                                    org.apache.ws.commons.schema.XmlSchemaSequence sequence,
                                                    org.codehaus.jam.JClass type,
                                                    java.lang.String name,
                                                    boolean isArryType)
                                             throws java.lang.Exception
Throws:
java.lang.Exception

isDataHandler

protected boolean isDataHandler(org.codehaus.jam.JClass clazz)

addContentToMethodSchemaType

protected void addContentToMethodSchemaType(org.apache.ws.commons.schema.XmlSchemaSequence sequence,
                                            QName schemaTypeName,
                                            java.lang.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(java.lang.String targetNamespace)

getTypeTable

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

getMethods

public org.codehaus.jam.JMethod[] getMethods()
Specified by:
getMethods in interface SchemaGenerator

generatePrefix

protected java.lang.String generatePrefix()

setExcludeMethods

public void setExcludeMethods(java.util.ArrayList excludeMethods)
Specified by:
setExcludeMethods in interface SchemaGenerator

getSchemaTargetNameSpace

public java.lang.String getSchemaTargetNameSpace()
Specified by:
getSchemaTargetNameSpace in interface SchemaGenerator

addImport

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

getAttrFormDefault

public java.lang.String getAttrFormDefault()

setAttrFormDefault

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

getElementFormDefault

public java.lang.String getElementFormDefault()

setElementFormDefault

public void setElementFormDefault(java.lang.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 java.util.ArrayList getExtraClasses()

setExtraClasses

public void setExtraClasses(java.util.ArrayList extraClasses)
Specified by:
setExtraClasses in interface SchemaGenerator

resolveSchemaNamespace

protected java.lang.String resolveSchemaNamespace(java.lang.String packageName)
                                           throws java.lang.Exception
Throws:
java.lang.Exception

isUseWSDLTypesNamespace

public boolean isUseWSDLTypesNamespace()

setUseWSDLTypesNamespace

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

getPkg2nsmap

public java.util.Map getPkg2nsmap()

setPkg2nsmap

public void setPkg2nsmap(java.util.Map pkg2nsmap)
Specified by:
setPkg2nsmap in interface SchemaGenerator

getTargetNamespace

public java.lang.String getTargetNamespace()
Specified by:
getTargetNamespace in interface SchemaGenerator

getSimpleName

protected java.lang.String getSimpleName(org.codehaus.jam.JMethod method)

getSimpleName

protected java.lang.String getSimpleName(org.codehaus.jam.JClass type)

getSimpleName

protected java.lang.String getSimpleName(org.codehaus.jam.JProperty peroperty)

getSimpleName

protected java.lang.String getSimpleName(org.codehaus.jam.JParameter parameter)

getQualifiedName

protected java.lang.String getQualifiedName(org.codehaus.jam.JMethod method)

getActualQualifiedName

protected java.lang.String getActualQualifiedName(org.codehaus.jam.JClass type)

getQualifiedName

protected java.lang.String getQualifiedName(org.codehaus.jam.JClass type)

getQualifiedName

protected java.lang.String getQualifiedName(org.codehaus.jam.JProperty peroperty)

getQualifiedName

protected java.lang.String getQualifiedName(org.codehaus.jam.JParameter parameter)

getQualifiedName

protected java.lang.String getQualifiedName(org.codehaus.jam.JPackage packagez)

setNonRpcMethods

public void setNonRpcMethods(java.util.ArrayList nonRpcMethods)
Specified by:
setNonRpcMethods in interface SchemaGenerator

setAxisService

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

getCustomSchemaLocation

public java.lang.String getCustomSchemaLocation()
Specified by:
getCustomSchemaLocation in interface SchemaGenerator

setCustomSchemaLocation

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

getMappingFileLocation

public java.lang.String getMappingFileLocation()
Specified by:
getMappingFileLocation in interface SchemaGenerator

setMappingFileLocation

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


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