⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 symboltable.java

📁 Java有关XML编程需要用到axis 的源代码 把里面bin下的包导入相应的Java工程 进行使用
💻 JAVA
📖 第 1 页 / 共 5 页
字号:
    public Map getElementIndex() {        return elementIndex;    }    /**     * Return an unmodifiable map of qnames -> Elements in the symbol     * table.     *      * @return an unmodifiable <code>Map</code> value     */    public Map getTypeIndex() {        return typeIndex;    }    /**     * Return the count of TypeEntries in the symbol table.     *      * @return an <code>int</code> value     */    public int getTypeEntryCount() {        return elementTypeEntries.size() + typeTypeEntries.size();    }    /**     * Get the Definition.  The definition is null until     * populate is called.     *      * @return      */    public Definition getDefinition() {        return def;    }    // getDefinition    /**     * Get the WSDL URI.  The WSDL URI is null until populate     * is called, and ONLY if a WSDL URI is provided.     *      * @return      */    public String getWSDLURI() {        return wsdlURI;    }    // getWSDLURI    /**     * Are we wrapping literal soap body elements.     *      * @return      */    public boolean isWrapped() {        return wrapped;    }    /**     * Turn on/off element wrapping for literal soap body's.     *      * @param wrapped      */    public void setWrapped(boolean wrapped) {        this.wrapped = wrapped;    }    /**     * Dump the contents of the symbol table.  For debugging purposes only.     *      * @param out      */    public void dump(java.io.PrintStream out) {        out.println();        out.println(Messages.getMessage("symbolTable00"));        out.println("-----------------------");        Iterator it = symbolTable.values().iterator();        while (it.hasNext()) {            Vector v = (Vector) it.next();            for (int i = 0; i < v.size(); ++i) {                out.println(v.elementAt(i).getClass().getName());                out.println(v.elementAt(i));            }        }        out.println("-----------------------");    }    // dump    /**     * Call this method if you have a uri for the WSDL document     *      * @param uri wsdlURI the location of the WSDL file.     * @throws IOException                       * @throws WSDLException                     * @throws SAXException                      * @throws ParserConfigurationException      */    public void populate(String uri)            throws IOException, WSDLException, SAXException,            ParserConfigurationException {        populate(uri, null, null);    }    // populate    /**     * Method populate     *      * @param uri           * @param username      * @param password      * @throws IOException                       * @throws WSDLException                     * @throws SAXException                      * @throws ParserConfigurationException      */    public void populate(String uri, String username, String password)            throws IOException, WSDLException, SAXException,            ParserConfigurationException {        if (verbose) {            System.out.println(Messages.getMessage("parsing00", uri));        }        Document doc = XMLUtils.newDocument(uri, username, password);        this.wsdlURI = uri;        try {            File f = new File(uri);            if (f.exists()) {                uri = f.toURL().toString();            }        } catch (Exception e) {        }        populate(uri, doc);    }    // populate    /**     * Call this method if your WSDL document has already been parsed as an XML DOM document.     *      * @param 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.     * @param doc     doc This is the XML Document containing the WSDL.     * @throws IOException                       * @throws SAXException                      * @throws WSDLException                     * @throws ParserConfigurationException      */    public void populate(String context, Document doc)            throws IOException, SAXException, WSDLException,            ParserConfigurationException {        WSDLReader reader = WSDLFactory.newInstance().newWSDLReader();        reader.setFeature("javax.wsdl.verbose", verbose);        this.def = reader.readWSDL(context, doc);        add(context, def, doc);    }    // populate    /**     * 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.     *      * @param context      * @param def          * @param doc          * @throws IOException                       * @throws SAXException                      * @throws WSDLException                     * @throws ParserConfigurationException      */    protected void add(String context, Definition def, Document doc)            throws IOException, SAXException, WSDLException,            ParserConfigurationException {        URL contextURL = (context == null)                ? null                : getURL(null, context);        populate(contextURL, def, doc, null);        processTypes();        checkForUndefined();        populateParameters();        setReferences(def, doc);    // uses wrapped flag set in populateParameters    }    // add    /**     * Scan the Definition for undefined objects and throw an error.     *      * @param def           * @param filename      * @throws IOException      */    private void checkForUndefined(Definition def, String filename)            throws IOException {        if (def != null) {            // Bindings            Iterator ib = def.getBindings().values().iterator();            while (ib.hasNext()) {                Binding binding = (Binding) ib.next();                if (binding.isUndefined()) {                    if (filename == null) {                        throw new IOException(                                Messages.getMessage(                                        "emitFailtUndefinedBinding01",                                        binding.getQName().getLocalPart()));                    } else {                        throw new IOException(                                Messages.getMessage(                                        "emitFailtUndefinedBinding02",                                        binding.getQName().getLocalPart(), filename));                    }                }            }            // portTypes            Iterator ip = def.getPortTypes().values().iterator();            while (ip.hasNext()) {                PortType portType = (PortType) ip.next();                if (portType.isUndefined()) {                    if (filename == null) {                        throw new IOException(                                Messages.getMessage(                                        "emitFailtUndefinedPort01",                                        portType.getQName().getLocalPart()));                    } else {                        throw new IOException(                                Messages.getMessage(                                        "emitFailtUndefinedPort02",                                        portType.getQName().getLocalPart(), filename));                    }                }            }            /*             * tomj: This is a bad idea, faults seem to be undefined             * / RJB reply:  this MUST be done for those systems that do something with             * / messages.  Perhaps we have to do an extra step for faults?  I'll leave             * / this commented for now, until someone uses this generator for something             * / other than WSDL2Java.             *           // Messages             *           Iterator i = def.getMessages().values().iterator();             *           while (i.hasNext()) {             *               Message message = (Message) i.next();             *               if (message.isUndefined()) {             *                   throw new IOException(             *                           Messages.getMessage("emitFailtUndefinedMessage01",             *                                   message.getQName().getLocalPart()));             *               }             *           }             */        }    }    /**     * Scan the symbol table for undefined types and throw an exception.     *      * @throws IOException      */    private void checkForUndefined() throws IOException {        Iterator it = symbolTable.values().iterator();        while (it.hasNext()) {            Vector v = (Vector) it.next();            for (int i = 0; i < v.size(); ++i) {                SymTabEntry entry = (SymTabEntry) v.get(i);                // Report undefined types                if (entry instanceof UndefinedType) {                    QName qn = entry.getQName();                    // Special case dateTime/timeInstant that changed                    // from version to version.                    if ((qn.getLocalPart().equals(                            "dateTime") && !qn.getNamespaceURI().equals(                                    Constants.URI_2001_SCHEMA_XSD)) || (qn.getLocalPart().equals(                                            "timeInstant") && qn.getNamespaceURI().equals(                                                    Constants.URI_2001_SCHEMA_XSD))) {                        throw new IOException(                                Messages.getMessage(                                        "wrongNamespace00", qn.getLocalPart(),                                        qn.getNamespaceURI()));                    }                    // Check for a undefined XSD Schema Type and throw                    // an unsupported message instead of undefined                    if (SchemaUtils.isSimpleSchemaType(qn)) {                        throw new IOException(                                Messages.getMessage(                                        "unsupportedSchemaType00", qn.getLocalPart()));                    }                    // last case, its some other undefined thing                    throw new IOException(                            Messages.getMessage(                                    "undefined00", qn.toString()));                }    // if undefined                else if (entry instanceof UndefinedElement) {                    throw new IOException(                            Messages.getMessage(                                    "undefinedElem00", entry.getQName().toString()));                }            }        }    }                // checkForUndefined    /**     * 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.     * NOTE:  filename is used only by checkForUndefined so that it can report which WSDL file     * has the problem.  If we're on the primary WSDL file, then we don't know the name and     * filename will be null.  But we know the names of all imported files.     */    private URLHashSet importedFiles = new URLHashSet();    /**     * Method populate     *      * @param context       * @param def           * @param doc           * @param filename      * @throws IOException                       * @throws ParserConfigurationException      * @throws SAXException                      * @throws WSDLException                     */    private void populate(            URL context, Definition def, Document doc, String filename)            throws IOException, ParserConfigurationException, SAXException,            WSDLException {        if (doc != null) {            populateTypes(context, doc);            if (addImports) {                // Add the symbols from any xsd:import'ed documents.                lookForImports(context, doc);            }        }        if (def != null) {            checkForUndefined(def, filename);            if (addImports) {                // Add the symbols from the wsdl:import'ed WSDL documents                Map imports = def.getImports();                Object[] importKeys = imports.keySet().toArray();

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -