Package javax.wsdl

Examples of javax.wsdl.QName


        if (node == null) {
            return re;
        }

        // If the node kind is an element, dive into it.
        QName nodeKind = Utils.getNodeQName(node);
        if (nodeKind != null &&
            nodeKind.getLocalPart().equals("element") &&
            Constants.isSchemaXSD(nodeKind.getNamespaceURI())) {
            NodeList children = node.getChildNodes();
            Node node2 = null;
            for (int j = 0; j < children.getLength() && node2 == null; j++) {
                QName kind2 = Utils.getNodeQName(children.item(j));
                if (kind2 != null &&
                    (kind2.getLocalPart().equals("simpleType") ||
                     kind2.getLocalPart().equals("complexType") ||
                     kind2.getLocalPart().equals("simpleContent")) &&
                    Constants.isSchemaXSD(kind2.getNamespaceURI())) {
                    node2 = children.item(j);
                    node = node2;
                }
            }
        }
        // Get the node kind, expecting a schema simpleType
        nodeKind = Utils.getNodeQName(node);
        if (nodeKind != null &&
            (nodeKind.getLocalPart().equals("simpleType") ||
             nodeKind.getLocalPart().equals("complexType")) &&
            Constants.isSchemaXSD(nodeKind.getNamespaceURI())) {

            // Under the complexType there could be a complexContent.
            NodeList children = node.getChildNodes();
            Node complexContent = null;
            Node extension = null;
            if (nodeKind.getLocalPart().equals("complexType")) {
                for (int j = 0; j < children.getLength() && complexContent == null; j++) {
                    QName complexContentKind = Utils.getNodeQName(children.item(j));
                    if (complexContentKind != null &&
                        (complexContentKind.getLocalPart().equals("complexContent") ||
                         complexContentKind.getLocalPart().equals("simpleContent"))&&
                        Constants.isSchemaXSD(complexContentKind.getNamespaceURI()))
                        complexContent = children.item(j);
                }
                node = complexContent;
            }
            // Now get the extension or restriction node
            if (node != null) {
                children = node.getChildNodes();
                for (int j = 0; j < children.getLength() && re == null; j++) {
                    QName reKind = Utils.getNodeQName(children.item(j));
                    if (reKind != null &&
                        (reKind.getLocalPart().equals("extension") ||
                         reKind.getLocalPart().equals("restriction")) &&
                        Constants.isSchemaXSD(reKind.getNamespaceURI()))
                        re = children.item(j);
                }
            }
        }
           
View Full Code Here


     * @param dims is the output value that contains the number of dimensions if return is not null
     * @return QName or null
     */
    public static QName getArrayElementQName(Node node, IntHolder dims) {
        dims.value = 1// assume 1 dimension
        QName qName = getCollectionElementQName(node);
        if (qName == null) {
            qName = getArrayElementQName_JAXRPC(node, dims);
        }
        return qName;
    }
View Full Code Here

        if (node == null) {
            return null;
        }

        // If the node kind is an element, dive get its type.
        QName nodeKind = Utils.getNodeQName(node);
        if (nodeKind != null &&
            nodeKind.getLocalPart().equals("element") &&
            Constants.isSchemaXSD(nodeKind.getNamespaceURI())) {

            // Get the qName of just the type.
            // The compare it against the full type of the node, which
            // takes into account maxOccurs and could return a collection type.
            // If different, return just the type (which is the collection element type).
            QName justTypeQName = Utils.getNodeTypeRefQName(node, "type");
            if (justTypeQName != null) {
                QName fullTypeQName = Utils.getNodeTypeRefQName(node, new BooleanHolder());
                if (justTypeQName != fullTypeQName)
                    return justTypeQName;
            }
        }
        return null;
View Full Code Here

        if (node == null) {
            return null;
        }

        // If the node kind is an element, dive into it.
        QName nodeKind = Utils.getNodeQName(node);
        if (nodeKind != null &&
            nodeKind.getLocalPart().equals("element") &&
            Constants.isSchemaXSD(nodeKind.getNamespaceURI())) {
            NodeList children = node.getChildNodes();
            Node complexNode = null;
            for (int j = 0; j < children.getLength() && complexNode == null; j++) {
                QName complexKind = Utils.getNodeQName(children.item(j));
                if (complexKind != null &&
                    complexKind.getLocalPart().equals("complexType") &&
                    Constants.isSchemaXSD(complexKind.getNamespaceURI())) {
                    complexNode = children.item(j);
                    node = complexNode;
                }
            }
        }
        // Get the node kind, expecting a schema complexType
        nodeKind = Utils.getNodeQName(node);
        if (nodeKind != null &&
            nodeKind.getLocalPart().equals("complexType") &&
            Constants.isSchemaXSD(nodeKind.getNamespaceURI())) {

            // Under the complexType there should be a complexContent.
            // (There may be other #text nodes, which we will ignore).
            NodeList children = node.getChildNodes();
            Node complexContentNode = null;
            for (int j = 0; j < children.getLength() && complexContentNode == null; j++) {
                QName complexContentKind = Utils.getNodeQName(children.item(j));
                if (complexContentKind != null &&
                    (complexContentKind.getLocalPart().equals("complexContent") ||
                    complexContentKind.getLocalPart().equals("simpleContent")) &&
                    Constants.isSchemaXSD(complexContentKind.getNamespaceURI()))
                    complexContentNode = children.item(j);
            }

            // Under the complexContent there should be a restriction.
            // (There may be other #text nodes, which we will ignore).
            Node restrictionNode = null;
            if (complexContentNode != null) {
                children = complexContentNode.getChildNodes();
                for (int j = 0; j < children.getLength() && restrictionNode == null; j++) {
                    QName restrictionKind = Utils.getNodeQName(children.item(j));
                    if (restrictionKind != null &&
                        restrictionKind.getLocalPart().equals("restriction") &&
                        Constants.isSchemaXSD(restrictionKind.getNamespaceURI()))
                        restrictionNode = children.item(j);
                }
            }

            // The restriction node must have a base of soapenc:Array. 
            QName baseType = null;
            if (restrictionNode != null) {
                baseType = Utils.getNodeTypeRefQName(restrictionNode, "base");
                if (baseType != null &&
                    baseType.getLocalPart().equals("Array") &&
                    Constants.isSOAP_ENC(baseType.getNamespaceURI()))
                    ; // Okay
                else
                    baseType = null// Did not find base=soapenc:Array
            }

           
            // Under the restriction there should be an attribute OR a sequence/all group node.
            // (There may be other #text nodes, which we will ignore).
            Node groupNode = null;
            Node attributeNode = null;
            if (baseType != null) {
                children = restrictionNode.getChildNodes();
                for (int j = 0;
                     j < children.getLength() && groupNode == null && attributeNode == null;
                     j++) {
                    QName kind = Utils.getNodeQName(children.item(j));
                    if (kind != null &&
                        (kind.getLocalPart().equals("sequence") ||
                         kind.getLocalPart().equals("all")) &&
                        Constants.isSchemaXSD(kind.getNamespaceURI())) {
                        groupNode = children.item(j);
                    }
                    if (kind != null &&
                        kind.getLocalPart().equals("attribute") &&
                        Constants.isSchemaXSD(kind.getNamespaceURI())) {
                        // If the attribute node does not have ref="soapenc:arrayType"
                        // then keep looking.
                        QName refQName = Utils.getNodeTypeRefQName(children.item(j), "ref");
                        if (refQName != null &&
                            refQName.getLocalPart().equals("arrayType") &&
                            Constants.isSOAP_ENC(refQName.getNamespaceURI())) {
                            attributeNode = children.item(j);
                        }
                    }
                }
            }

            // If there is an attribute node, look at wsdl:arrayType to get the element type
            if (attributeNode != null) {
                String wsdlArrayTypeValue = null;
                Vector attrs = Utils.getAttributesWithLocalName(attributeNode, "arrayType");
                for (int i=0; i < attrs.size() && wsdlArrayTypeValue == null; i++) {
                    Node attrNode = (Node) attrs.elementAt(i);
                    String attrName = attrNode.getNodeName();
                    QName attrQName = Utils.getQNameFromPrefixedName(attributeNode, attrName);
                    if (Constants.isWSDL(attrQName.getNamespaceURI())) {
                        wsdlArrayTypeValue = attrNode.getNodeValue();
                    }
                }

                // The value could have any number of [] or [,] on the end
                // Strip these off to get the prefixed name.
                // The convert the prefixed name into a qname.
                // Count the number of [ and , to get the dim information.
                if (wsdlArrayTypeValue != null) {
                    int i = wsdlArrayTypeValue.indexOf('[');
                    if (i > 0) {
                        String prefixedName = wsdlArrayTypeValue.substring(0,i);
                        String mangledString = wsdlArrayTypeValue.replace(',', '[');
                        dims.value = 0;
                        int index = mangledString.indexOf('[');
                        while (index > 0) {
                            dims.value++;
                            index = mangledString.indexOf('[',index+1);
                        }
                       
                        return Utils.getQNameFromPrefixedName(restrictionNode, prefixedName);
                    }
                }
            } else if (groupNode != null) {

                // Get the first element node under the group node.      
                NodeList elements = groupNode.getChildNodes();
                Node elementNode = null;
                for (int i=0; i < elements.getLength() && elementNode == null; i++) {
                    QName elementKind = Utils.getNodeQName(elements.item(i));
                    if (elementKind != null &&
                        elementKind.getLocalPart().equals("element") &&
                        Constants.isSchemaXSD(elementKind.getNamespaceURI())) {
                        elementNode = elements.item(i);
                    }
                }
                
                // The element node should have maxOccurs="unbounded" and
View Full Code Here

        if (node == null) {
            return null;
        }
        // Check for SimpleContent
        // If the node kind is an element, dive into it.
        QName nodeKind = Utils.getNodeQName(node);
        if (nodeKind != null &&
            nodeKind.getLocalPart().equals("element") &&
            Constants.isSchemaXSD(nodeKind.getNamespaceURI())) {
            NodeList children = node.getChildNodes();
            Node complexNode = null;
            for (int j = 0; j < children.getLength() && complexNode == null; j++) {
                QName complexKind = Utils.getNodeQName(children.item(j));
                if (complexKind != null &&
                    complexKind.getLocalPart().equals("complexType") &&
                    Constants.isSchemaXSD(complexKind.getNamespaceURI())) {
                    complexNode = children.item(j);
                    node = complexNode;
                }
            }
        }

        // Expecting a schema complexType
        nodeKind = Utils.getNodeQName(node);
        if (nodeKind != null &&
            nodeKind.getLocalPart().equals("complexType") &&
            Constants.isSchemaXSD(nodeKind.getNamespaceURI())) {

            // Under the complexType there could be complexContent/simpleContent
            // and extension elements if this is a derived type.  Skip over these.
            NodeList children = node.getChildNodes();
            Node content = null;
            Node extension = null;
            for (int j = 0; j < children.getLength() && content == null; j++) {
                QName complexContentKind = Utils.getNodeQName(children.item(j));
                if (complexContentKind != null &&
                    Constants.isSchemaXSD(complexContentKind.getNamespaceURI())) {
                    if (complexContentKind.getLocalPart().equals("complexContent") ||
                        complexContentKind.getLocalPart().equals("simpleContent")) {
                        content = children.item(j);
                    }
                }
            }
            // Check for extensions
            if (content != null) {
                children = content.getChildNodes();
                for (int j = 0; j < children.getLength(); j++) {
                    QName extensionKind = Utils.getNodeQName(children.item(j));
                    if (extensionKind != null &&
                            extensionKind.getLocalPart().equals("extension") &&
                            Constants.isSchemaXSD(extensionKind.getNamespaceURI())) {
                        extension = children.item(j);
                        break;
                    }
                }
            }
           
            if (extension != null) {
                node = extension;
            }
           
            // examine children of the node for <attribute> elements
            children = node.getChildNodes();
            for (int i = 0; i < children.getLength(); i++) {
                Node child = children.item(i);
                nodeKind = Utils.getNodeQName(child);
                if (nodeKind == null ||
                        ! nodeKind.getLocalPart().equals("attribute"))
                    continue;
               
                // we have an attribute node
                if (v == null)
                    v = new Vector();
               
                // type
                QName typeAttr = Utils.getNodeTypeRefQName(child, "type");
                TypeEntry type = symbolTable.getTypeEntry(typeAttr, false);
                // name
                QName name = Utils.getNodeNameQName(child);
                // add type and name to vector, skip it if we couldn't parse it
                // XXX - this may need to be revisited.
                if (type != null && name != null) {
                    v.add(type);
                    v.add(name.getLocalPart());
                }
            }
        }           
        return v;
    }
View Full Code Here

                        tEntry = refType;
                        dims += tEntry.getDimensions();
                        refType = tEntry.getRefType();
                    }
                    // Get the QName to javify
                    QName typeQName = tEntry.getQName();
                    if (typeQName.getLocalPart().lastIndexOf(SymbolTable.ANON_TOKEN) >= 0) {
                        // This is an anonymous type name.
                        // Axis uses '>' as a nesting token to generate
                        // unique qnames for anonymous types.
                        // Only consider the localName after the last '>' when
                        // generating the java name
                        String localName = typeQName.getLocalPart();
                        localName =
                            localName.substring(
                                localName.lastIndexOf(SymbolTable.ANON_TOKEN)+1);
                        typeQName = new QName(typeQName.getNamespaceURI(), localName);
                        // If there is already an existing type, there will be a
                        // collision.  If there is an existing anon type, there will be a
                        // collision.  In both cases, the java type name should be mangled.
                        if (symbolTable.getType(typeQName) != null ||
                            anonQNames.get(typeQName) != null) {
                            localName += "Type" + uniqueNum++;
                            typeQName = new QName(typeQName.getNamespaceURI(), localName);
                        }
                        anonQNames.put(typeQName, typeQName);
                    }
                    entry.setName(symbolTable.getJavaName(typeQName) + dims);
                }
View Full Code Here

                    if (v.elementAt(0) instanceof Element) {
                        e = (Element)v.elementAt(0);
                    } else {
                        e = (Element)v.elementAt(1);
                    }
                    QName eType = Utils.getNodeTypeRefQName(e.getNode(), "type");
                    if (eType != null && eType.equals(e.getQName()))
                        resolve = false;
                }

                // Other Special Case:
                // If the names are already different, no mangling is needed.
                if (resolve) {
                    resolve = false// Assume false
                    String name = null;
                    for (int i = 0; i < v.size() && !resolve; ++i) {
                        SymTabEntry entry = (SymTabEntry) v.elementAt(i);
                         if (entry instanceof MessageEntry ||
                             entry instanceof BindingEntry) {
                             ; // Don't process these
                         } else if (name== null) {
                             name = entry.getName();
                         } else if (name.equals(entry.getName())) {
                             resolve = true// Need to do resolution
                         }

                    }
                }

                // Full Mangle if resolution is necessary.
                if (resolve) {
                    boolean firstType = true;
                    for (int i = 0; i < v.size(); ++i) {
                        SymTabEntry entry = (SymTabEntry) v.elementAt(i);
                        if (entry instanceof Element) {
                            entry.setName(mangleName(entry.getName(),
                                    "_ElemType"));
                            // If this global element was defined using
                            // an anonymous type, then need to change the
                            // java name of the anonymous type to match.
                            QName anonQName = new QName(entry.getQName().getNamespaceURI(),
                                                        SymbolTable.ANON_TOKEN +
                                                        entry.getQName().getLocalPart());
                            TypeEntry anonType = symbolTable.getType(anonQName);
                            if (anonType != null) {
                                anonType.setName(entry.getName());
View Full Code Here

                                        JavaTypeWriter.HOLDER_IS_NEEDED,
                                        new Boolean(true));

                                // If the type is a DefinedElement, need to
                                // set HOLDER_IS_NEEDED on the anonymous type.
                                QName anonQName = SchemaUtils.
                                    getElementAnonQName(p.getType().getNode());
                                if (anonQName != null) {
                                    TypeEntry anonType =
                                        symbolTable.getType(anonQName);
                                    if (anonType != null) {
View Full Code Here

    /**
     * Constructor.
     */
    protected JavaUndeployWriter(Emitter emitter, Definition definition, SymbolTable symbolTable) {
        super(emitter,
                new QName(definition.getTargetNamespace(), "undeploy"),
                "",
                "wsdd",
                JavaUtils.getMessage("genUndeploy00"), "undeploy");
        this.definition = definition;
        this.symbolTable = symbolTable;
View Full Code Here

     * Constructor.
     */
    protected JavaHolderWriter(Emitter emitter, TypeEntry type) {
        super(
                emitter,
                new QName(
                        type.getQName().getNamespaceURI(),
                        Utils.holder(type,emitter.getSymbolTable()).substring(
                        Utils.holder(type,emitter.getSymbolTable()).lastIndexOf('.')+1)),
                null,
                "java",
View Full Code Here

TOP

Related Classes of javax.wsdl.QName

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.