Class SymbolTable


  • public class SymbolTable
    extends java.lang.Object
    This class represents a table of all of the top-level symbols from a set of WSDL Definitions and DOM Documents: XML types; WSDL messages, portTypes, bindings, and services.

    This symbolTable contains entries of the form where key is of type QName and value is of type Vector. The Vector's elements are all of the objects that have the given QName. This is necessary since names aren't unique among the WSDL types. message, portType, binding, service, could all have the same QName and are differentiated merely by type. SymbolTable contains type-specific getters to bypass the Vector layer: public PortTypeEntry getPortTypeEntry(QName name), etc.

    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.lang.String ANON_TOKEN
      Field ANON_TOKEN
      protected java.util.HashMap derivedTypes  
      protected java.util.Map node2ExtensionBase
      cache of nodes -> base types for complexTypes.
      protected boolean quiet
      Field quiet
    • Constructor Summary

      Constructors 
      Constructor Description
      SymbolTable​(BaseTypeMapping btm, boolean addImports, boolean verbose, boolean nowrap)
      Construct a symbol table with the given Namespaces.
    • Method Summary

      All Methods Instance Methods Concrete Methods Deprecated Methods 
      Modifier and Type Method Description
      protected void add​(java.lang.String context, javax.wsdl.Definition def, org.w3c.dom.Document doc)
      Add the given Definition and Document information to the symbol table (including imported symbols), populating it with SymTabEntries for each of the top-level symbols.
      protected void createTypeFromRef​(org.w3c.dom.Node node)
      Node may contain a reference (via type=, ref=, or element= attributes) to another type.
      void dump​(java.io.PrintStream out)
      Dump the contents of the symbol table.
      protected void ensureOperationMessageValid​(javax.wsdl.Message message)
      ensures that a message in a <input>, <output>, or <fault> element in an <operation> element is valid.
      protected void ensureOperationsOfPortTypeValid​(javax.wsdl.PortType portType)
      ensures that an an element <portType> is valid.
      protected void ensureOperationValid​(javax.wsdl.Operation operation)
      ensures that an an element <operation> within an element <portType> is valid.
      protected boolean existsPortWithName​(QName name)
      checks whether there exists a WSDL port with a given name in the current symbol table
      SymTabEntry get​(QName qname, java.lang.Class cls)
      Get the entry with the given QName of the given class.
      BindingEntry getBindingEntry​(QName qname)
      Get the BindingEntry with the given QName.
      javax.wsdl.Definition getDefinition()
      Get the Definition.
      Element getElement​(QName qname)
      Get the Element TypeEntry with the given QName.
      java.util.Map getElementFormDefaults()  
      java.util.Map getElementIndex()
      Return an unmodifiable map of qnames -> Elements in the symbol table.
      java.util.HashMap getHashMap()
      Get the raw symbol table HashMap.
      java.util.List getMessageEntries()  
      MessageEntry getMessageEntry​(QName qname)
      Get the MessageEntry with the given QName.
      Parameters getOperationParameters​(javax.wsdl.Operation operation, java.lang.String namespace, BindingEntry bindingEntry)
      For the given operation, this method returns the parameter info conveniently collated.
      void getParametersFromParts​(java.util.Vector v, java.util.Collection parts, boolean literal, java.lang.String opName, BindingEntry bindingEntry)
      This method returns a vector containing Parameters which represent each Part (shouldn't we call these "Parts" or something?) This routine does the wrapped doc/lit processing.
      PortTypeEntry getPortTypeEntry​(QName qname)
      Get the PortTypeEntry with the given QName.
      ServiceEntry getServiceEntry​(QName qname)
      Get the ServiceEntry with the given QName.
      java.util.Vector getSymbols​(QName qname)
      Get the list of entries with the given QName.
      Type getType​(QName qname)
      Get the Type TypeEntry with the given QName.
      TypeEntry getTypeEntry​(QName qname, boolean wantElementType)
      Get the type entry for the given qname.
      int getTypeEntryCount()
      Return the count of TypeEntries in the symbol table.
      java.util.Map getTypeIndex()
      Return an unmodifiable map of qnames -> Elements in the symbol table.
      java.util.Vector getTypes()
      Deprecated.
      use specialized get{Element,Type}Index() methods instead
      java.lang.String getWSDLURI()
      Get the WSDL URI.
      boolean isKnownNamespace​(java.lang.String namespace)
      Check if this is a known namespace (soap-enc or schema xsd or schema xsi or xml)
      boolean isQuiet()
      Method isQuiet
      boolean isWrapped()
      Are we wrapping literal soap body elements.
      void populate​(java.lang.String uri)
      Call this method if you have a uri for the WSDL document
      void populate​(java.lang.String uri, java.lang.String username, java.lang.String password)
      Method populate
      void populate​(java.lang.String context, org.w3c.dom.Document doc)
      Call this method if your WSDL document has already been parsed as an XML DOM document.
      void populateTypes​(java.net.URL context, org.w3c.dom.Document doc)
      Populate the symbol table with all of the Types from the Document.
      protected void processTypes()  
      void setQuiet​(boolean quiet)
      Method setQuiet
      void setWrapArrays​(boolean wrapArrays)  
      void setWrapped​(boolean wrapped)
      Turn on/off element wrapping for literal soap body's.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • derivedTypes

        protected java.util.HashMap derivedTypes
      • node2ExtensionBase

        protected final java.util.Map node2ExtensionBase
        cache of nodes -> base types for complexTypes. The cache is built on nodes because multiple TypeEntry objects may use the same node.
      • quiet

        protected boolean quiet
        Field quiet
      • ANON_TOKEN

        public static final java.lang.String ANON_TOKEN
        Field ANON_TOKEN
        See Also:
        Constant Field Values
    • Constructor Detail

      • SymbolTable

        public SymbolTable​(BaseTypeMapping btm,
                           boolean addImports,
                           boolean verbose,
                           boolean nowrap)
        Construct a symbol table with the given Namespaces.
        Parameters:
        btm -
        addImports -
        verbose -
        nowrap -
    • Method Detail

      • isQuiet

        public boolean isQuiet()
        Method isQuiet
        Returns:
      • setQuiet

        public void setQuiet​(boolean quiet)
        Method setQuiet
        Parameters:
        quiet -
      • getHashMap

        public java.util.HashMap getHashMap()
        Get the raw symbol table HashMap.
        Returns:
      • getSymbols

        public java.util.Vector getSymbols​(QName qname)
        Get the list of entries with the given QName. Since symbols can share QNames, this list is necessary. This list will not contain any more than one element of any given SymTabEntry.
        Parameters:
        qname -
        Returns:
      • get

        public SymTabEntry get​(QName qname,
                               java.lang.Class cls)
        Get the entry with the given QName of the given class. If it does not exist, return null.
        Parameters:
        qname -
        cls -
        Returns:
      • getTypeEntry

        public TypeEntry getTypeEntry​(QName qname,
                                      boolean wantElementType)
        Get the type entry for the given qname.
        Parameters:
        qname -
        wantElementType - boolean that indicates type or element (for type= or ref=)
        Returns:
      • getType

        public Type getType​(QName qname)
        Get the Type TypeEntry with the given QName. If it doesn't exist, return null.
        Parameters:
        qname -
        Returns:
      • getElement

        public Element getElement​(QName qname)
        Get the Element TypeEntry with the given QName. If it doesn't exist, return null.
        Parameters:
        qname -
        Returns:
      • getMessageEntry

        public MessageEntry getMessageEntry​(QName qname)
        Get the MessageEntry with the given QName. If it doesn't exist, return null.
        Parameters:
        qname -
        Returns:
      • getPortTypeEntry

        public PortTypeEntry getPortTypeEntry​(QName qname)
        Get the PortTypeEntry with the given QName. If it doesn't exist, return null.
        Parameters:
        qname -
        Returns:
      • getBindingEntry

        public BindingEntry getBindingEntry​(QName qname)
        Get the BindingEntry with the given QName. If it doesn't exist, return null.
        Parameters:
        qname -
        Returns:
      • getServiceEntry

        public ServiceEntry getServiceEntry​(QName qname)
        Get the ServiceEntry with the given QName. If it doesn't exist, return null.
        Parameters:
        qname -
        Returns:
      • getTypes

        public java.util.Vector getTypes()
        Deprecated.
        use specialized get{Element,Type}Index() methods instead
        Get the list of all the XML schema types in the symbol table. In other words, all entries that are instances of TypeEntry.
        Returns:
      • getElementIndex

        public java.util.Map getElementIndex()
        Return an unmodifiable map of qnames -> Elements in the symbol table.
        Returns:
        an unmodifiable Map value
      • getTypeIndex

        public java.util.Map getTypeIndex()
        Return an unmodifiable map of qnames -> Elements in the symbol table.
        Returns:
        an unmodifiable Map value
      • getTypeEntryCount

        public int getTypeEntryCount()
        Return the count of TypeEntries in the symbol table.
        Returns:
        an int value
      • getDefinition

        public javax.wsdl.Definition getDefinition()
        Get the Definition. The definition is null until populate is called.
        Returns:
      • getWSDLURI

        public java.lang.String getWSDLURI()
        Get the WSDL URI. The WSDL URI is null until populate is called, and ONLY if a WSDL URI is provided.
        Returns:
      • isWrapped

        public boolean isWrapped()
        Are we wrapping literal soap body elements.
        Returns:
      • setWrapped

        public void setWrapped​(boolean wrapped)
        Turn on/off element wrapping for literal soap body's.
        Parameters:
        wrapped -
      • dump

        public void dump​(java.io.PrintStream out)
        Dump the contents of the symbol table. For debugging purposes only.
        Parameters:
        out -
      • populate

        public void populate​(java.lang.String uri)
                      throws java.io.IOException,
                             javax.wsdl.WSDLException,
                             org.xml.sax.SAXException,
                             javax.xml.parsers.ParserConfigurationException
        Call this method if you have a uri for the WSDL document
        Parameters:
        uri - wsdlURI the location of the WSDL file.
        Throws:
        java.io.IOException
        javax.wsdl.WSDLException
        org.xml.sax.SAXException
        javax.xml.parsers.ParserConfigurationException
      • populate

        public void populate​(java.lang.String uri,
                             java.lang.String username,
                             java.lang.String password)
                      throws java.io.IOException,
                             javax.wsdl.WSDLException,
                             org.xml.sax.SAXException,
                             javax.xml.parsers.ParserConfigurationException
        Method populate
        Parameters:
        uri -
        username -
        password -
        Throws:
        java.io.IOException
        javax.wsdl.WSDLException
        org.xml.sax.SAXException
        javax.xml.parsers.ParserConfigurationException
      • populate

        public void populate​(java.lang.String context,
                             org.w3c.dom.Document doc)
                      throws java.io.IOException,
                             org.xml.sax.SAXException,
                             javax.wsdl.WSDLException,
                             javax.xml.parsers.ParserConfigurationException
        Call this method if your WSDL document has already been parsed as an XML DOM document.
        Parameters:
        context - context This is directory context for the Document. If the Document were from file "/x/y/z.wsdl" then the context could be "/x/y" (even "/x/y/z.wsdl" would work). If context is null, then the context becomes the current directory.
        doc - doc This is the XML Document containing the WSDL.
        Throws:
        java.io.IOException
        org.xml.sax.SAXException
        javax.wsdl.WSDLException
        javax.xml.parsers.ParserConfigurationException
      • add

        protected void add​(java.lang.String context,
                           javax.wsdl.Definition def,
                           org.w3c.dom.Document doc)
                    throws java.io.IOException,
                           org.xml.sax.SAXException,
                           javax.wsdl.WSDLException,
                           javax.xml.parsers.ParserConfigurationException
        Add the given Definition and Document information to the symbol table (including imported symbols), populating it with SymTabEntries for each of the top-level symbols. When the symbol table has been populated, iterate through it, setting the isReferenced flag appropriately for each entry.
        Parameters:
        context -
        def -
        doc -
        Throws:
        java.io.IOException
        org.xml.sax.SAXException
        javax.wsdl.WSDLException
        javax.xml.parsers.ParserConfigurationException
      • isKnownNamespace

        public boolean isKnownNamespace​(java.lang.String namespace)
        Check if this is a known namespace (soap-enc or schema xsd or schema xsi or xml)
        Parameters:
        namespace -
        Returns:
        true if this is a know namespace.
      • populateTypes

        public void populateTypes​(java.net.URL context,
                                  org.w3c.dom.Document doc)
                           throws java.io.IOException,
                                  org.xml.sax.SAXException,
                                  javax.wsdl.WSDLException,
                                  javax.xml.parsers.ParserConfigurationException
        Populate the symbol table with all of the Types from the Document.
        Parameters:
        context -
        doc -
        Throws:
        java.io.IOException
        org.xml.sax.SAXException
        javax.wsdl.WSDLException
        javax.xml.parsers.ParserConfigurationException
      • createTypeFromRef

        protected void createTypeFromRef​(org.w3c.dom.Node node)
                                  throws java.io.IOException
        Node may contain a reference (via type=, ref=, or element= attributes) to another type. Create a Type object representing this referenced type.
        Parameters:
        node -
        Throws:
        java.io.IOException
      • ensureOperationMessageValid

        protected void ensureOperationMessageValid​(javax.wsdl.Message message)
                                            throws java.io.IOException
        ensures that a message in a <input>, <output>, or <fault> element in an <operation> element is valid. In particular, ensures that
        1. an attribute message is present (according to the XML Schema for WSDL 1.1 message is required

        2. the value of attribute message (a QName) refers to an already defined message

        Note: this method should throw a javax.wsdl.WSDLException rather than a java.io.IOException

        Parameters:
        message - the message object
        Throws:
        java.io.IOException - thrown, if the message is not valid
      • ensureOperationValid

        protected void ensureOperationValid​(javax.wsdl.Operation operation)
                                     throws java.io.IOException
        ensures that an an element <operation> within an element <portType> is valid. Throws an exception if the operation is not valid.

        Note: this method should throw a javax.wsdl.WSDLException rather than a java.io.IOException

        Parameters:
        operation - the operation element
        Throws:
        java.io.IOException - thrown, if the element is not valid.
        java.lang.IllegalArgumentException - thrown, if operation is null
      • ensureOperationsOfPortTypeValid

        protected void ensureOperationsOfPortTypeValid​(javax.wsdl.PortType portType)
                                                throws java.io.IOException
        ensures that an an element <portType> is valid. Throws an exception if the portType is not valid.

        Note: this method should throw a javax.wsdl.WSDLException rather than a java.io.IOException

        Parameters:
        portType - the portType element
        Throws:
        java.io.IOException - thrown, if the element is not valid.
        java.lang.IllegalArgumentException - thrown, if operation is null
      • getOperationParameters

        public Parameters getOperationParameters​(javax.wsdl.Operation operation,
                                                 java.lang.String namespace,
                                                 BindingEntry bindingEntry)
                                          throws java.io.IOException
        For the given operation, this method returns the parameter info conveniently collated. There is a bit of processing that is needed to write the interface, stub, and skeleton. Rather than do that processing 3 times, it is done once, here, and stored in the Parameters object.
        Parameters:
        operation -
        namespace -
        bindingEntry -
        Returns:
        Throws:
        java.io.IOException
      • getParametersFromParts

        public void getParametersFromParts​(java.util.Vector v,
                                           java.util.Collection parts,
                                           boolean literal,
                                           java.lang.String opName,
                                           BindingEntry bindingEntry)
                                    throws java.io.IOException
        This method returns a vector containing Parameters which represent each Part (shouldn't we call these "Parts" or something?) This routine does the wrapped doc/lit processing. It is also used for generating Faults, and this really confuses things but we need to do the same processing for the fault messages. This whole method is waaaay too complex. It needs rewriting (for instance, we sometimes new up a Parameter, then ignore it in favor of another we new up.)
        Parameters:
        v - The output vector of parameters
        parts - The parts of the message
        literal - Are we in a literal operation (or fault)?
        opName - The operation (or fault) name
        bindingEntry - The binding for this operation - can be NULL if we are looking at a fault
        Throws:
        java.io.IOException - when encountering an error in the WSDL
      • existsPortWithName

        protected boolean existsPortWithName​(QName name)
        checks whether there exists a WSDL port with a given name in the current symbol table
        Parameters:
        name - the QName of the port. Note: only the local part of the qname is relevant, since port names are not qualified with a namespace. They are of type nmtoken in WSDL 1.1 and of type ncname in WSDL 1.2
        Returns:
        true, if there is a port element with the specified name; false, otherwise
      • processTypes

        protected void processTypes()
      • getMessageEntries

        public java.util.List getMessageEntries()
      • setWrapArrays

        public void setWrapArrays​(boolean wrapArrays)
      • getElementFormDefaults

        public java.util.Map getElementFormDefaults()