Class DefaultSchemaGenerator
- java.lang.Object
-
- 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
Nested Classes Modifier and Type Class Description class
DefaultSchemaGenerator.MathodComparator
class
DefaultSchemaGenerator.PropertyComparator
-
Field Summary
-
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, DISABLE_BINDING_REST, DISABLE_BINDING_SOAP11, DISABLE_BINDING_SOAP12, DISALLOW_ANON_TYPES_OPTION, DISALLOW_ANON_TYPES_OPTION_LONG, DISALLOW_NILLABLE_ELEMENTS_OPTION, DISALLOW_NILLABLE_ELEMENTS_OPTION_LONG, DISALLOW_OPTIONAL_ELEMENTS_OPTION, DISALLOW_OPTIONAL_ELEMENTS_OPTION_LONG, 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, JAX_WS_SERVICE_OPTION, JAX_WS_SERVICE_OPTION_LONG, LITERAL, LOCATION, LOCATION_OPTION, LOCATION_OPTION_LONG, MESSAGE_LOCAL_NAME, MESSAGE_PART_NAME_OPTION, MESSAGE_PART_NAME_OPTION_LONG, 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_NAME_OPTION, PORT_TYPE_NAME_OPTION_LONG, PORT_TYPE_SUFFIX, REQUEST, REQUEST_ELEMENT_SUFFIX_OPTION, REQUEST_ELEMENT_SUFFIX_OPTION_LONG, REQUEST_MESSAGE, RESPONSE, RESPONSE_MESSAGE, REST_BINDING_NAME_OPTION_LONG, 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_BINDING_NAME_OPTION_LONG, SOAP11_PREFIX, SOAP11PORT, SOAP12_BINDING_NAME_OPTION_LONG, 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
Constructors Constructor Description DefaultSchemaGenerator(ClassLoader loader, String className, String schematargetNamespace, String schematargetNamespacePrefix, AxisService service)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description 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 typeprotected QName
generateSchemaForCollection(org.apache.ws.commons.schema.XmlSchemaSequence sequence, Type genericType, String partName)
Generate schema for collection.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)
protected QName
generateSchemaTypeForDocument(org.apache.ws.commons.schema.XmlSchemaSequence sequence, String parameterName)
Generate schema type for document.protected QName
generateSchemaTypeForMap(org.apache.ws.commons.schema.XmlSchemaSequence sequence, Type genericParameterType, String parameterName, boolean isArrayType)
Generate schema type for map.protected void
generateSchemaTypeForMapParameter(org.apache.ws.commons.schema.XmlSchemaSequence entrySequence, Type parameterType, String elementName)
Generate schema type for map parameter.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()
List<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 typeprotected 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(List<String> excludeMethods)
void
setExtraClasses(List<String> extraClasses)
void
setMappingFileLocation(String mappingFileLocation)
void
setNonRpcMethods(List<String> nonRpcMethods)
void
setNsGen(NamespaceGenerator nsGen)
void
setPkg2nsmap(Map<String,String> pkg2nsmap)
void
setUseWSDLTypesNamespace(boolean useWSDLTypesNamespace)
-
-
-
Field Detail
-
NAME_SPACE_PREFIX
public static final String NAME_SPACE_PREFIX
- See Also:
- Constant Field Values
-
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
-
useWSDLTypesNamespace
protected boolean useWSDLTypesNamespace
-
nsGen
protected NamespaceGenerator nsGen
-
targetNamespace
protected String targetNamespace
-
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 interfaceSchemaGenerator
-
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 interfaceSchemaGenerator
- 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 interfaceSchemaGenerator
-
getMethods
public Method[] getMethods()
- Specified by:
getMethods
in interfaceSchemaGenerator
-
generatePrefix
protected String generatePrefix()
-
setExcludeMethods
public void setExcludeMethods(List<String> excludeMethods)
- Specified by:
setExcludeMethods
in interfaceSchemaGenerator
-
getSchemaTargetNameSpace
public String getSchemaTargetNameSpace()
- Specified by:
getSchemaTargetNameSpace
in interfaceSchemaGenerator
-
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 interfaceSchemaGenerator
-
getElementFormDefault
public String getElementFormDefault()
-
setElementFormDefault
public void setElementFormDefault(String elementFormDefault)
- Specified by:
setElementFormDefault
in interfaceSchemaGenerator
-
getAttrFormDefaultSetting
protected org.apache.ws.commons.schema.XmlSchemaForm getAttrFormDefaultSetting()
-
getElementFormDefaultSetting
protected org.apache.ws.commons.schema.XmlSchemaForm getElementFormDefaultSetting()
-
setExtraClasses
public void setExtraClasses(List<String> extraClasses)
- Specified by:
setExtraClasses
in interfaceSchemaGenerator
-
resolveSchemaNamespace
protected String resolveSchemaNamespace(String packageName) throws Exception
- Throws:
Exception
-
isUseWSDLTypesNamespace
public boolean isUseWSDLTypesNamespace()
-
setUseWSDLTypesNamespace
public void setUseWSDLTypesNamespace(boolean useWSDLTypesNamespace)
- Specified by:
setUseWSDLTypesNamespace
in interfaceSchemaGenerator
-
setPkg2nsmap
public void setPkg2nsmap(Map<String,String> pkg2nsmap)
- Specified by:
setPkg2nsmap
in interfaceSchemaGenerator
-
getTargetNamespace
public String getTargetNamespace()
- Specified by:
getTargetNamespace
in interfaceSchemaGenerator
-
setNonRpcMethods
public void setNonRpcMethods(List<String> nonRpcMethods)
- Specified by:
setNonRpcMethods
in interfaceSchemaGenerator
-
setAxisService
public void setAxisService(AxisService service)
- Specified by:
setAxisService
in interfaceSchemaGenerator
-
getCustomSchemaLocation
public String getCustomSchemaLocation()
- Specified by:
getCustomSchemaLocation
in interfaceSchemaGenerator
-
setCustomSchemaLocation
public void setCustomSchemaLocation(String customSchemaLocation)
- Specified by:
setCustomSchemaLocation
in interfaceSchemaGenerator
-
getMappingFileLocation
public String getMappingFileLocation()
- Specified by:
getMappingFileLocation
in interfaceSchemaGenerator
-
setMappingFileLocation
public void setMappingFileLocation(String mappingFileLocation)
- Specified by:
setMappingFileLocation
in interfaceSchemaGenerator
-
getParameterName
protected String getParameterName(Annotation[][] parameterAnnotation, int j, String[] parameterNames)
-
generateSchemaTypeForMap
protected QName generateSchemaTypeForMap(org.apache.ws.commons.schema.XmlSchemaSequence sequence, Type genericParameterType, String parameterName, boolean isArrayType) throws Exception
Generate schema type for map.- Parameters:
sequence
- the sequencegenericParameterType
- the generic parameter typeparameterName
- the parameter name- Returns:
- the q name
- Throws:
Exception
- the exception
-
generateSchemaTypeForMapParameter
protected void generateSchemaTypeForMapParameter(org.apache.ws.commons.schema.XmlSchemaSequence entrySequence, Type parameterType, String elementName) throws Exception
Generate schema type for map parameter.- Parameters:
entrySequence
- the entry sequenceparameterType
- the parameter typeelementName
- the element name- Throws:
Exception
- the exception
-
generateSchemaForCollection
protected QName generateSchemaForCollection(org.apache.ws.commons.schema.XmlSchemaSequence sequence, Type genericType, String partName) throws Exception
Generate schema for collection.- Parameters:
sequence
- the sequencegenericType
- the generic typepartName
- the part name- Returns:
- the q name
- Throws:
Exception
- the exception
-
-