org.apache.axis.wsdl.toJava
Class Utils

java.lang.Object
  |
  +--org.apache.axis.wsdl.toJava.Utils

public class Utils
extends java.lang.Object

This class contains static utility methods for the emitter.

Author:
Rich Scheuerle (scheu@us.ibm.com), Tom Jordahl (tomj@macromedia.com)

Constructor Summary
Utils()
           
 
Method Summary
static java.lang.String capitalizeFirstChar(java.lang.String name)
          Capitalize the first character of the name.
static java.lang.String genQNameAttributeString(javax.wsdl.QName qname, java.lang.String prefix)
          Generate an XML prefixed attribute value with a corresponding xmlns declaration for the prefix.
static java.lang.String getAttribute(org.w3c.dom.Node node, java.lang.String attr)
          Given a node, return the value of the given attribute.
static java.util.Vector getAttributesWithLocalName(org.w3c.dom.Node node, java.lang.String localName)
          Given a node, return the attributes that have the specified local name.
static QName getAxisQName(javax.wsdl.QName qname)
           
static java.util.HashSet getDerivedTypes(TypeEntry type, SymbolTable symbolTable)
          This method returns a set of all types that are derived from this type via an extension of a complexType
static java.lang.String getExceptionName(javax.wsdl.Fault fault)
          Given a fault, return the Java class name of the exception to be generated from this fault
static java.lang.String getFullExceptionName(javax.wsdl.Fault fault, SymbolTable symbolTable, java.lang.String namespace)
          Given a fault, return the fully qualified Java class name of the exception to be generated from this fault
static java.lang.String getJavaLocalName(java.lang.String fullName)
          Query Java Local Name
static java.lang.String getJavaPackageName(java.lang.String fullName)
          Query Java Package Name
static java.util.HashSet getNestedTypes(TypeEntry type, SymbolTable symbolTable, boolean derivedFlag)
          This method returns a set of all the nested types.
static java.lang.String getNewQName(QName qname)
          Common code for generating a QName in emitted code.
static javax.wsdl.QName getNillableQName(javax.wsdl.QName qName)
          getNillableQName returns the QName to use if the nillable=true attribute is used.
static javax.wsdl.QName getNodeNameQName(org.w3c.dom.Node node)
          XML nodes may have a name attribute.
static javax.wsdl.QName getNodeQName(org.w3c.dom.Node node)
          An xml element may have a name.
static javax.wsdl.QName getNodeTypeRefQName(org.w3c.dom.Node node, BooleanHolder forElement)
          XML nodes may have a type/ref attribute.
static javax.wsdl.QName getNodeTypeRefQName(org.w3c.dom.Node node, java.lang.String typeAttrName)
          Obtain the QName of the type/ref using the indicated attribute name.
static javax.wsdl.QName getQNameFromPrefixedName(org.w3c.dom.Node node, java.lang.String prefixedName)
          Convert a prefixed name into a qname
static java.lang.String getScopedAttribute(org.w3c.dom.Node node, java.lang.String attr)
          Given a node, return the value of the given attribute.
static javax.wsdl.QName getWSDLQName(QName qname)
           
static java.lang.String holder(TypeEntry type, SymbolTable symbolTable)
          Given a type, return the Java mapping of that type's holder.
static java.lang.String makePackageName(java.lang.String namespace)
           
static java.lang.String xmlNameToJava(java.lang.String name)
          Map an XML name to a valid Java identifier
static java.lang.String xmlNameToJavaClass(java.lang.String name)
          Map an XML name to a valid Java identifier w/ capitolized first letter
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Utils

public Utils()
Method Detail

capitalizeFirstChar

public static java.lang.String capitalizeFirstChar(java.lang.String name)
Capitalize the first character of the name.

getNillableQName

public static javax.wsdl.QName getNillableQName(javax.wsdl.QName qName)
getNillableQName returns the QName to use if the nillable=true attribute is used. For example: The QName "xsd:int" maps to a java int. However if an element with a type="xsd:int" also has the "nillable=true" attribute, the type should be an Integer (not an int). So in these circumstances, this routine is called with xsd:int to get a suitable qname (soapenc:int) which maps to Integer.
Parameters:
QName -  

getScopedAttribute

public static java.lang.String getScopedAttribute(org.w3c.dom.Node node,
                                                  java.lang.String attr)
Given a node, return the value of the given attribute. If the attribute does not exist, searching continues through ancestor nodes until found. This method is useful for finding attributes that pertain to a group of contained nodes (i.e. xlmns, xmlns:tns, targetNamespace, name)

getAttribute

public static java.lang.String getAttribute(org.w3c.dom.Node node,
                                            java.lang.String attr)
Given a node, return the value of the given attribute. Returns null if the attribute is not found

getAttributesWithLocalName

public static java.util.Vector getAttributesWithLocalName(org.w3c.dom.Node node,
                                                          java.lang.String localName)
Given a node, return the attributes that have the specified local name. Returns null if the attribute is not found

getNodeQName

public static javax.wsdl.QName getNodeQName(org.w3c.dom.Node node)
An xml element may have a name. For example <.element name="foo" type="b:bar">. has the name "element". This routine gets the full QName of the element.

getNodeNameQName

public static javax.wsdl.QName getNodeNameQName(org.w3c.dom.Node node)
XML nodes may have a name attribute. For example <.element name="foo" type="b:bar">. has the name attribute value "foo". This routine gets the QName of the name attribute value.

getNodeTypeRefQName

public static javax.wsdl.QName getNodeTypeRefQName(org.w3c.dom.Node node,
                                                   BooleanHolder forElement)
XML nodes may have a type/ref attribute. For example <.element name="foo" type="b:bar">. has the type attribute value "b:bar". This routine gets the QName of the type/ref attribute value. Note: If the "minOccurs" and "maxOccurs" are set such that the type is a collection of "types", then an artificial qname is returned to represent the collection. If you want the QName for just the "type" without analyzing minOccurs/maxOccurs then use: getNodeTypeRefQName(node, "type") Note 2: The getNodeTypeRefQName routines also inspect the "nillable" attribute and may return an alternate QName if nillable is true.
Parameters:
node - of the reference
forElement - output parameter is set to true if QName is for an element (i.e. ref= or element= attribute was used).
QName - of type or element (depending on forElement setting)

getNodeTypeRefQName

public static javax.wsdl.QName getNodeTypeRefQName(org.w3c.dom.Node node,
                                                   java.lang.String typeAttrName)
Obtain the QName of the type/ref using the indicated attribute name. For example, the "type" attribute in an XML enumeration struct is the "base" attribute. If the "type" attribute is requested, the "nillable" attribute is also inspected to see if an alternate qname should be returned.
Parameters:
node - in the dom
typeAttrName - (type, base, element, ref)

getQNameFromPrefixedName

public static javax.wsdl.QName getQNameFromPrefixedName(org.w3c.dom.Node node,
                                                        java.lang.String prefixedName)
Convert a prefixed name into a qname

xmlNameToJava

public static java.lang.String xmlNameToJava(java.lang.String name)
Map an XML name to a valid Java identifier

xmlNameToJavaClass

public static java.lang.String xmlNameToJavaClass(java.lang.String name)
Map an XML name to a valid Java identifier w/ capitolized first letter

makePackageName

public static java.lang.String makePackageName(java.lang.String namespace)

holder

public static java.lang.String holder(TypeEntry type,
                                      SymbolTable symbolTable)
Given a type, return the Java mapping of that type's holder.

getExceptionName

public static java.lang.String getExceptionName(javax.wsdl.Fault fault)
Given a fault, return the Java class name of the exception to be generated from this fault
Parameters:
fault - - The WSDL fault object
Returns:
A Java class name for the fault

getFullExceptionName

public static java.lang.String getFullExceptionName(javax.wsdl.Fault fault,
                                                    SymbolTable symbolTable,
                                                    java.lang.String namespace)
Given a fault, return the fully qualified Java class name of the exception to be generated from this fault
Parameters:
fault - - The WSDL fault object
symbolTable - - the symbol table
Returns:
A Java class name for the fault

getDerivedTypes

public static java.util.HashSet getDerivedTypes(TypeEntry type,
                                                SymbolTable symbolTable)
This method returns a set of all types that are derived from this type via an extension of a complexType

getNestedTypes

public static java.util.HashSet getNestedTypes(TypeEntry type,
                                               SymbolTable symbolTable,
                                               boolean derivedFlag)
This method returns a set of all the nested types. Nested types are types declared within this TypeEntry (or descendents) plus any extended types and the extended type nested types The elements of the returned HashSet are Types.
Parameters:
type - is the type entry to consider
symbolTable - is the symbolTable
derivedFlag - should be set if all dependendent derived types should also be returned.

getJavaLocalName

public static java.lang.String getJavaLocalName(java.lang.String fullName)
Query Java Local Name

getJavaPackageName

public static java.lang.String getJavaPackageName(java.lang.String fullName)
Query Java Package Name

getNewQName

public static java.lang.String getNewQName(QName qname)
Common code for generating a QName in emitted code. Note that there's no semicolon at the end, so we can use this in a variety of contexts.

getAxisQName

public static QName getAxisQName(javax.wsdl.QName qname)

getWSDLQName

public static javax.wsdl.QName getWSDLQName(QName qname)

genQNameAttributeString

public static java.lang.String genQNameAttributeString(javax.wsdl.QName qname,
                                                       java.lang.String prefix)
Generate an XML prefixed attribute value with a corresponding xmlns declaration for the prefix. If there is no namespace, don't prefix the name or emit the xmlns attribute. Caller should provide the enclosing quotes. Usage: println("name=\"" + genXMLQNameString(qname, "foo") + "\""


Copyright © 2001 Apache XML Project. All Rights Reserved.