Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.apache.axis.wsdl.fromJava
Class Types  view Types download Types.java

java.lang.Object
  extended byorg.apache.axis.wsdl.fromJava.Types

public class Types
extends java.lang.Object

Description:

This class is used to recursively serializes a Java Class into an XML Schema representation.

It has utility methods to create a schema node, assosiate namespaces to the various types


Field Summary
(package private)  java.util.List beanCompatErrs
          Field beanCompatErrs
(package private)  Definition def
          Field def
(package private)  org.apache.axis.encoding.TypeMapping defaultTM
          Field defaultTM
(package private)  org.w3c.dom.Document docHolder
          todo ravi: Get rid of Doccument fragment and import node stuuf, once I have a handle on the wsdl4j mechanism to get at types.
(package private)  Emitter emitter
          The java to wsdl emitter
protected static org.apache.commons.logging.Log log
          Field log
(package private)  java.lang.Class[] mappedTypes
          Which types have we already written?
(package private)  Namespaces namespaces
          Field namespaces
(package private)  java.util.HashMap schemaElementNames
          Field schemaElementNames
(package private)  java.util.HashMap schemaTypes
          Field schemaTypes
(package private)  java.util.HashMap schemaUniqueElementNames
          Field schemaUniqueElementNames
private  org.apache.axis.description.ServiceDesc serviceDesc
          Field serviceDesc
(package private)  java.util.List stopClasses
          Field stopClasses
(package private)  java.lang.String targetNamespace
          Field targetNamespace
(package private)  org.apache.axis.encoding.TypeMapping tm
          Field tm
(package private)  java.util.HashMap wrapperMap
          Field wrapperMap
private  java.util.Set writtenElementQNames
          Keep track of the element QNames we've written to avoid dups
(package private)  org.w3c.dom.Element wsdlTypesElem
          Field wsdlTypesElem
 
Constructor Summary
Types(Definition def, org.apache.axis.encoding.TypeMapping tm, org.apache.axis.encoding.TypeMapping defaultTM, Namespaces namespaces, java.lang.String targetNamespace, java.util.List stopClasses, org.apache.axis.description.ServiceDesc serviceDesc)
          This class serailizes a Class to XML Schema.
Types(Definition def, org.apache.axis.encoding.TypeMapping tm, org.apache.axis.encoding.TypeMapping defaultTM, Namespaces namespaces, java.lang.String targetNamespace, java.util.List stopClasses, org.apache.axis.description.ServiceDesc serviceDesc, Emitter emitter)
          This class serailizes a Class to XML Schema.
 
Method Summary
private  boolean addToElementsList(javax.xml.namespace.QName qName)
          Add the element to an ArrayList and return true if the Schema element needs to be generated If the element already exists, just return false to indicate that the type is already generated in a previous iteration
private  boolean addToTypesList(javax.xml.namespace.QName qName)
          Add the type to an ArrayList and return true if the Schema node needs to be generated If the type already exists, just return false to indicate that the type is already generated in a previous iteration
 org.w3c.dom.Element createArrayElement(java.lang.String componentTypeName)
          Method createArrayElement
 org.w3c.dom.Element createAttributeElement(java.lang.String elementName, java.lang.Class javaType, javax.xml.namespace.QName xmlType, boolean nullable, org.w3c.dom.Document docHolder)
          Create Attribute Element with a given name and type
private  void createDocumentFragment()
          Method createDocumentFragment
 org.w3c.dom.Element createElement(java.lang.String elementName)
          Create a DOM Element in this context
 org.w3c.dom.Element createElement(java.lang.String elementName, java.lang.String elementType, boolean nullable, boolean omittable, org.w3c.dom.Document docHolder)
          Create Element with a given name and type
 org.w3c.dom.Element createElementWithAnonymousType(java.lang.String elementName, java.lang.Class fieldType, boolean omittable, org.w3c.dom.Document ownerDocument)
          Write an <element> with an anonymous internal ComplexType
 org.w3c.dom.Element createLiteralArrayElement(java.lang.String componentType, javax.xml.namespace.QName itemName)
          Create an array which is a wrapper type for "item" elements of a component type.
private static java.lang.Class getComponentType(java.lang.Class clazz)
           
static java.lang.String getLocalNameFromFullName(java.lang.String full)
          Utility method to get the local class name from a fully qualified java class name
 Namespaces getNamespaces()
          Return the namespaces object for the current context
static java.lang.String getPackageNameFromFullName(java.lang.String full)
          Utility method to get the package name from a fully qualified java class name
 java.lang.String getQNameString(javax.xml.namespace.QName qname)
          Return a string suitable for representing a given QName in the context of this WSDL document.
 org.apache.axis.description.ServiceDesc getServiceDesc()
          return the service description
 java.util.List getStopClasses()
          Return the list of classes that we should not emit WSDL for.
 javax.xml.namespace.QName getTypeQName(java.lang.Class javaType)
          Return the QName of the specified javaType
(package private)  boolean implementsSimpleType(java.lang.Class type)
          Does the class implement SimpleType
 void insertTypesFragment(org.w3c.dom.Document doc)
          Inserts the type fragment into the given wsdl document and ensures that definitions from each embedded schema are allowed to reference schema components from the other sibling schemas.
 boolean isAcceptableAsAttribute(java.lang.Class type)
          Is the given class acceptable as an attribute
private  boolean isAnonymousType(javax.xml.namespace.QName type)
          Method isAnonymousType
static boolean isArray(java.lang.Class clazz)
           
protected  boolean isBeanCompatible(java.lang.Class javaType, boolean issueErrors)
          isBeanCompatible
static boolean isEnumClass(java.lang.Class cls)
          Returns true if indicated type matches the JAX-RPC enumeration class.
static boolean isNullable(java.lang.Class type)
          Determines if the field is nullable.
private  boolean isPresent(java.lang.String list, java.lang.String namespace)
          check if the namespace is present in the list.
(package private)  boolean isSimpleType(java.lang.Class type)
          Is the given class one of the simple types? In other words, do we have a mapping for this type which is in the xsd or soap-enc namespaces?
 void loadInputSchema(java.lang.String inputSchema)
          Loads the types from the input schema file.
 void loadInputTypes(java.lang.String inputWSDL)
          Load the types from the input wsdl file.
private  boolean makeTypeElement(java.lang.Class type, javax.xml.namespace.QName qName, org.w3c.dom.Element containingElement)
          Create a schema type element (either simpleType or complexType) for the particular type/qName combination.
private  void processSymTabEntries(org.apache.axis.wsdl.symbolTable.SymbolTable symbolTable)
          Walk the type/element entries in the symbol table and add each one to the list of processed types.
 void updateNamespaces()
          Method updateNamespaces
 void writeElementDecl(javax.xml.namespace.QName qname, java.lang.Class javaType, javax.xml.namespace.QName typeQName, boolean nillable, javax.xml.namespace.QName itemQName)
          Create a top-level element declaration in our generated schema
 javax.xml.namespace.QName writeElementForPart(java.lang.Class type, javax.xml.namespace.QName qname)
          Write out an element referenced by a part element attribute.
 org.w3c.dom.Element writeEnumType(javax.xml.namespace.QName qName, java.lang.Class cls)
          Write Enumeration Complex Type (Only supports enumeration classes of string types)
 void writeSchemaElement(javax.xml.namespace.QName qName, org.w3c.dom.Element element)
          Deprecated. Please use writeSchemaElement(String namespaceURI, Element element)
 void writeSchemaElement(java.lang.String namespaceURI, org.w3c.dom.Element element)
          Write out the given Element into the appropriate schema node.
 void writeSchemaElementDecl(javax.xml.namespace.QName qname, org.w3c.dom.Element element)
          Method writeSchemaElementDecl
 void writeSchemaTypeDecl(javax.xml.namespace.QName qname, org.w3c.dom.Element element)
          Method writeSchemaTypeDecl
 java.lang.String writeType(java.lang.Class type)
          Write a schema representation for the given Class.
 java.lang.String writeType(java.lang.Class type, javax.xml.namespace.QName qName)
          Write a schema representation for the given Class.
 javax.xml.namespace.QName writeTypeAndSubTypeForPart(java.lang.Class type, javax.xml.namespace.QName qname)
          Write out a type (and its subtypes) referenced by a part type attribute.
private  javax.xml.namespace.QName writeTypeAsElement(java.lang.Class type, javax.xml.namespace.QName qName)
          Create a schema element for the given type
 javax.xml.namespace.QName writeTypeForPart(java.lang.Class type, javax.xml.namespace.QName qname)
          Write out a type referenced by a part type attribute.
private  javax.xml.namespace.QName writeTypeNamespace(java.lang.Class type, javax.xml.namespace.QName qName)
          write out the namespace declaration and return the type QName for the given Class
private  void writeTypeNamespace(java.lang.String namespaceURI)
          write out the namespace declaration.
 void writeWrappedParameter(org.w3c.dom.Element sequence, java.lang.String name, javax.xml.namespace.QName type, java.lang.Class javaType)
          Write a parameter (a sub-element) into a sequence generated by writeWrapperElement() above.
 org.w3c.dom.Element writeWrapperElement(javax.xml.namespace.QName qname, boolean request, boolean hasParams)
          Write the element definition for a WRAPPED operation.
private  void writeWsdlTypesElement()
          Get the Types element for the WSDL document.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

protected static org.apache.commons.logging.Log log
Field log


def

Definition def
Field def


namespaces

Namespaces namespaces
Field namespaces


tm

org.apache.axis.encoding.TypeMapping tm
Field tm


defaultTM

org.apache.axis.encoding.TypeMapping defaultTM
Field defaultTM


targetNamespace

java.lang.String targetNamespace
Field targetNamespace


wsdlTypesElem

org.w3c.dom.Element wsdlTypesElem
Field wsdlTypesElem


schemaTypes

java.util.HashMap schemaTypes
Field schemaTypes


schemaElementNames

java.util.HashMap schemaElementNames
Field schemaElementNames


schemaUniqueElementNames

java.util.HashMap schemaUniqueElementNames
Field schemaUniqueElementNames


wrapperMap

java.util.HashMap wrapperMap
Field wrapperMap


stopClasses

java.util.List stopClasses
Field stopClasses


beanCompatErrs

java.util.List beanCompatErrs
Field beanCompatErrs


serviceDesc

private org.apache.axis.description.ServiceDesc serviceDesc
Field serviceDesc


writtenElementQNames

private java.util.Set writtenElementQNames
Keep track of the element QNames we've written to avoid dups


mappedTypes

java.lang.Class[] mappedTypes
Which types have we already written?


emitter

Emitter emitter
The java to wsdl emitter


docHolder

org.w3c.dom.Document docHolder
todo ravi: Get rid of Doccument fragment and import node stuuf, once I have a handle on the wsdl4j mechanism to get at types.

Switch over notes: remove docHolder, docFragment in favor of wsdl4j Types

DocumentFragment docFragment;

DocumentFragment docFragment;

DocumentFragment docFragment;

DocumentFragment docFragment;

Constructor Detail

Types

public Types(Definition def,
             org.apache.axis.encoding.TypeMapping tm,
             org.apache.axis.encoding.TypeMapping defaultTM,
             Namespaces namespaces,
             java.lang.String targetNamespace,
             java.util.List stopClasses,
             org.apache.axis.description.ServiceDesc serviceDesc)
This class serailizes a Class to XML Schema. The constructor provides the context for the streamed node within the WSDL document


Types

public Types(Definition def,
             org.apache.axis.encoding.TypeMapping tm,
             org.apache.axis.encoding.TypeMapping defaultTM,
             Namespaces namespaces,
             java.lang.String targetNamespace,
             java.util.List stopClasses,
             org.apache.axis.description.ServiceDesc serviceDesc,
             Emitter emitter)
This class serailizes a Class to XML Schema. The constructor provides the context for the streamed node within the WSDL document

Method Detail

isArray

public static boolean isArray(java.lang.Class clazz)

getComponentType

private static java.lang.Class getComponentType(java.lang.Class clazz)

getNamespaces

public Namespaces getNamespaces()
Return the namespaces object for the current context


loadInputSchema

public void loadInputSchema(java.lang.String inputSchema)
                     throws java.io.IOException,
                            WSDLException,
                            org.xml.sax.SAXException,
                            javax.xml.parsers.ParserConfigurationException
Loads the types from the input schema file.


processSymTabEntries

private void processSymTabEntries(org.apache.axis.wsdl.symbolTable.SymbolTable symbolTable)
Walk the type/element entries in the symbol table and add each one to the list of processed types. This prevents the types from being duplicated.


loadInputTypes

public void loadInputTypes(java.lang.String inputWSDL)
                    throws java.io.IOException,
                           WSDLException,
                           org.xml.sax.SAXException,
                           javax.xml.parsers.ParserConfigurationException
Load the types from the input wsdl file.


writeTypeForPart

public javax.xml.namespace.QName writeTypeForPart(java.lang.Class type,
                                                  javax.xml.namespace.QName qname)
                                           throws org.apache.axis.AxisFault
Write out a type referenced by a part type attribute.


writeTypeAndSubTypeForPart

public javax.xml.namespace.QName writeTypeAndSubTypeForPart(java.lang.Class type,
                                                            javax.xml.namespace.QName qname)
                                                     throws org.apache.axis.AxisFault
Write out a type (and its subtypes) referenced by a part type attribute.


writeElementForPart

public javax.xml.namespace.QName writeElementForPart(java.lang.Class type,
                                                     javax.xml.namespace.QName qname)
                                              throws org.apache.axis.AxisFault
Write out an element referenced by a part element attribute.


writeWrapperElement

public org.w3c.dom.Element writeWrapperElement(javax.xml.namespace.QName qname,
                                               boolean request,
                                               boolean hasParams)
                                        throws org.apache.axis.AxisFault
Write the element definition for a WRAPPED operation. This will write out any necessary namespace/schema declarations, an an element definition with an internal (anonymous) complexType. The name of the element will be *foo*Request or *foo*Response depending on whether the request boolean is true. If the operation contains parameters, then we also generate a >sequence< node underneath the complexType, and return it for later use by writeWrappedParameter() below.


writeWrappedParameter

public void writeWrappedParameter(org.w3c.dom.Element sequence,
                                  java.lang.String name,
                                  javax.xml.namespace.QName type,
                                  java.lang.Class javaType)
                           throws org.apache.axis.AxisFault
Write a parameter (a sub-element) into a sequence generated by writeWrapperElement() above.


isAnonymousType

private boolean isAnonymousType(javax.xml.namespace.QName type)
Method isAnonymousType


writeTypeAsElement

private javax.xml.namespace.QName writeTypeAsElement(java.lang.Class type,
                                                     javax.xml.namespace.QName qName)
                                              throws org.apache.axis.AxisFault
Create a schema element for the given type


writeTypeNamespace

private javax.xml.namespace.QName writeTypeNamespace(java.lang.Class type,
                                                     javax.xml.namespace.QName qName)
write out the namespace declaration and return the type QName for the given Class


writeTypeNamespace

private void writeTypeNamespace(java.lang.String namespaceURI)
write out the namespace declaration.


getTypeQName

public javax.xml.namespace.QName getTypeQName(java.lang.Class javaType)
Return the QName of the specified javaType


getQNameString

public java.lang.String getQNameString(javax.xml.namespace.QName qname)
Return a string suitable for representing a given QName in the context of this WSDL document. If the namespace of the QName is not yet registered, we will register it up in the Definitions.


getPackageNameFromFullName

public static java.lang.String getPackageNameFromFullName(java.lang.String full)
Utility method to get the package name from a fully qualified java class name


getLocalNameFromFullName

public static java.lang.String getLocalNameFromFullName(java.lang.String full)
Utility method to get the local class name from a fully qualified java class name


writeSchemaTypeDecl

public void writeSchemaTypeDecl(javax.xml.namespace.QName qname,
                                org.w3c.dom.Element element)
                         throws org.apache.axis.AxisFault
Method writeSchemaTypeDecl


writeSchemaElementDecl

public void writeSchemaElementDecl(javax.xml.namespace.QName qname,
                                   org.w3c.dom.Element element)
                            throws org.apache.axis.AxisFault
Method writeSchemaElementDecl


writeSchemaElement

public void writeSchemaElement(javax.xml.namespace.QName qName,
                               org.w3c.dom.Element element)
                        throws org.apache.axis.AxisFault
Deprecated. Please use writeSchemaElement(String namespaceURI, Element element)


writeSchemaElement

public void writeSchemaElement(java.lang.String namespaceURI,
                               org.w3c.dom.Element element)
                        throws org.apache.axis.AxisFault
Write out the given Element into the appropriate schema node. If need be create the schema node as well


isPresent

private boolean isPresent(java.lang.String list,
                          java.lang.String namespace)
check if the namespace is present in the list.


writeWsdlTypesElement

private void writeWsdlTypesElement()
Get the Types element for the WSDL document. If not present, create one


writeType

public java.lang.String writeType(java.lang.Class type)
                           throws org.apache.axis.AxisFault
Write a schema representation for the given Class. Recurse through all the public fields as well as fields represented by java bean compliant accessor methods.

Then return the qualified string representation of the generated type


writeType

public java.lang.String writeType(java.lang.Class type,
                                  javax.xml.namespace.QName qName)
                           throws org.apache.axis.AxisFault
Write a schema representation for the given Class. Recurse through all the public fields as well as fields represented by java bean compliant accessor methods.

Then return the qualified string representation of the generated type


createArrayElement

public org.w3c.dom.Element createArrayElement(java.lang.String componentTypeName)
Method createArrayElement


createLiteralArrayElement

public org.w3c.dom.Element createLiteralArrayElement(java.lang.String componentType,
                                                     javax.xml.namespace.QName itemName)
Create an array which is a wrapper type for "item" elements of a component type. This is basically the unencoded parallel to a SOAP-encoded array.


isEnumClass

public static boolean isEnumClass(java.lang.Class cls)
Returns true if indicated type matches the JAX-RPC enumeration class. Note: supports JSR 101 version 0.6 Public Draft


writeEnumType

public org.w3c.dom.Element writeEnumType(javax.xml.namespace.QName qName,
                                         java.lang.Class cls)
                                  throws java.lang.NoSuchMethodException,
                                         java.lang.IllegalAccessException,
                                         org.apache.axis.AxisFault
Write Enumeration Complex Type (Only supports enumeration classes of string types)


writeElementDecl

public void writeElementDecl(javax.xml.namespace.QName qname,
                             java.lang.Class javaType,
                             javax.xml.namespace.QName typeQName,
                             boolean nillable,
                             javax.xml.namespace.QName itemQName)
                      throws org.apache.axis.AxisFault
Create a top-level element declaration in our generated schema


createElement

public org.w3c.dom.Element createElement(java.lang.String elementName,
                                         java.lang.String elementType,
                                         boolean nullable,
                                         boolean omittable,
                                         org.w3c.dom.Document docHolder)
Create Element with a given name and type


createAttributeElement

public org.w3c.dom.Element createAttributeElement(java.lang.String elementName,
                                                  java.lang.Class javaType,
                                                  javax.xml.namespace.QName xmlType,
                                                  boolean nullable,
                                                  org.w3c.dom.Document docHolder)
                                           throws org.apache.axis.AxisFault
Create Attribute Element with a given name and type


isSimpleType

boolean isSimpleType(java.lang.Class type)
Is the given class one of the simple types? In other words, do we have a mapping for this type which is in the xsd or soap-enc namespaces?


isAcceptableAsAttribute

public boolean isAcceptableAsAttribute(java.lang.Class type)
Is the given class acceptable as an attribute


implementsSimpleType

boolean implementsSimpleType(java.lang.Class type)
Does the class implement SimpleType


addToTypesList

private boolean addToTypesList(javax.xml.namespace.QName qName)
Add the type to an ArrayList and return true if the Schema node needs to be generated If the type already exists, just return false to indicate that the type is already generated in a previous iteration


addToElementsList

private boolean addToElementsList(javax.xml.namespace.QName qName)
Add the element to an ArrayList and return true if the Schema element needs to be generated If the element already exists, just return false to indicate that the type is already generated in a previous iteration


isNullable

public static boolean isNullable(java.lang.Class type)
Determines if the field is nullable. All non-primitives are nillable.


createDocumentFragment

private void createDocumentFragment()
Method createDocumentFragment


updateNamespaces

public void updateNamespaces()
Method updateNamespaces


insertTypesFragment

public void insertTypesFragment(org.w3c.dom.Document doc)
Inserts the type fragment into the given wsdl document and ensures that definitions from each embedded schema are allowed to reference schema components from the other sibling schemas.


getStopClasses

public java.util.List getStopClasses()
Return the list of classes that we should not emit WSDL for.


createElement

public org.w3c.dom.Element createElement(java.lang.String elementName)
Create a DOM Element in this context


isBeanCompatible

protected boolean isBeanCompatible(java.lang.Class javaType,
                                   boolean issueErrors)
isBeanCompatible


createElementWithAnonymousType

public org.w3c.dom.Element createElementWithAnonymousType(java.lang.String elementName,
                                                          java.lang.Class fieldType,
                                                          boolean omittable,
                                                          org.w3c.dom.Document ownerDocument)
                                                   throws org.apache.axis.AxisFault
Write an <element> with an anonymous internal ComplexType


makeTypeElement

private boolean makeTypeElement(java.lang.Class type,
                                javax.xml.namespace.QName qName,
                                org.w3c.dom.Element containingElement)
                         throws org.apache.axis.AxisFault
Create a schema type element (either simpleType or complexType) for the particular type/qName combination. If the type is named, we handle inserting the new type into the appropriate <schema> in the WSDL types section. If the type is anonymous, we append the definition underneath the Element which was passed as the container (typically a field of a higher-level type or a parameter in a wrapped operation).


getServiceDesc

public org.apache.axis.description.ServiceDesc getServiceDesc()
return the service description