Package org.xmlpull.infoset

Examples of org.xmlpull.infoset.XmlNamespace


            Port fromPort = port.getFromPort();
            if (fromPort != null) {
                String variableName = port.getID() + INPUT_SUFFIX;

                GpelVariable ifVar = new GpelVariable(this.process.xml().getNamespace(), variableName);
                XmlNamespace xsdNS = process.xml().lookupNamespaceByName(WSConstants.XSD_NS_URI);
                if (null != xsdNS && xsdNS.getPrefix() != null) {
                    ifVar.xml().setAttributeValue("element",
                            xsdNS.getPrefix() + ":" + WSConstants.XSD_ANY_TYPE.getLocalPart());
                } else {
                    this.process.xml().declareNamespace(WSConstants.XSD_NS);
                    ifVar.xml().setAttributeValue("element",
                            WSConstants.XSD_NS.getPrefix() + ":" + WSConstants.XSD_ANY_TYPE.getLocalPart());
                }
                this.process.getVariables().addVariable(ifVar);

                GpelAssignCopyFrom from = createAssignCopyFrom(fromPort);
                GpelAssignCopyTo to = new GpelAssignCopyTo(this.bpelNS);
                to.setVariable(variableName);
                GpelAssignCopy copy = new GpelAssignCopy(this.bpelNS, from, to);
                copies.add(copy);

                booleanExpression = booleanExpression.replaceAll("\\$" + i, "\\$" + variableName);
            }
        }
        if (copies.size() > 0) {
            GpelAssign assign = new GpelAssign(this.bpelNS, copies);
            sequence.addActivity(assign);
        }
        GpelCondition condition = new GpelCondition(this.bpelNS, booleanExpression);

        //
        // If block
        //
        EndifNode endifNode = getEndifNode(ifNode);
        GpelSequence ifSequence = createIfSequence(ifNode, endifNode, true, parentBlock);
        GpelIf gpelIf = new GpelIf(this.bpelNS, condition, ifSequence);

        //
        // Else block
        //
        GpelSequence elseSequence = createIfSequence(ifNode, endifNode, false, parentBlock);
        GpelElse gpelElse = new GpelElse(this.bpelNS, elseSequence);
        gpelIf.setElse(gpelElse);

        //
        // Create global variables for endif.
        //
        for (Port outputPort : endifNode.getOutputPorts()) {
            String variable = outputPort.getID() + OUTPUT_SUFFIX;
            GpelVariable ifVar = new GpelVariable(this.process.xml().getNamespace(), variable);
            XmlNamespace xsdNS = process.xml().lookupNamespaceByName(WSConstants.XSD_NS_URI);
            if (null != xsdNS && xsdNS.getPrefix() != null) {
                ifVar.xml().setAttributeValue("element",
                        xsdNS.getPrefix() + ":" + WSConstants.XSD_ANY_TYPE.getLocalPart());
            } else {
                this.process.xml().declareNamespace(WSConstants.XSD_NS);
                ifVar.xml().setAttributeValue("element",
                        WSConstants.XSD_NS.getPrefix() + ":" + WSConstants.XSD_ANY_TYPE.getLocalPart());
            }
View Full Code Here


        WsdlPortType portType = this.workflowWSDL.addReceivePortType(operationName, node);
        QName portTypeQName = portType.getQName();

        // Partner link
        String partnerLinkName = createPartnerLinkName(id);
        XmlNamespace partnerLinkTypeNS = this.targetNamespace;
        String partnerLinkTypeName = id + PARTNER_LINK_TYPE_SUFFIX;
        String myRollName = id + MY_ROLE_SUFFIX;
        this.process.addPartnerLink(partnerLinkName, partnerLinkTypeNS, partnerLinkTypeName, myRollName, null);
        this.workflowWSDL.addPartnerLinkTypeAndRoll(partnerLinkTypeName, myRollName, portTypeQName);
View Full Code Here

            throw new IllegalStateException("NO Port found in the workflow WSDL:" + workflowName);
        }
        String targetNamespace = gpelProcess.getTargetNamespace();
        String targetNamespacePrefix = "wfns";

        XmlNamespace odeNs = builder.newNamespace("http://www.apache.org/ode/schemas/dd/2007/03");
        XmlElement deploy = builder.newFragment(odeNs, "deploy");
        deploy.declareNamespace(PROCESS, targetNamespace);
        deploy.declareNamespace(targetNamespacePrefix, workflowWSDL.getTargetNamespace());

        XmlElement process = deploy.addElement(odeNs, PROCESS);
View Full Code Here

        org.xmlpull.infoset.XmlElement xml = workflowWsdl.xml();
        Iterator<XmlNamespace> itr = xml.namespaces().iterator();

        LinkedList<XmlNamespace> namespaces = new LinkedList<XmlNamespace>();
        while (itr.hasNext()) {
            XmlNamespace ns = itr.next();
            if (!"http://schemas.xmlsoap.org/ws/2004/03/partner-link/".equals(ns.getName())) {
                namespaces.add(ns);
            }
        }

        xml.removeAllNamespaceDeclarations();

        for (XmlNamespace xmlNamespace : namespaces) {
            xml.declareNamespace(xmlNamespace);
        }

        xml.setAttributeValue("xmlns:plnk", "http://docs.oasis-open.org/wsbpel/2.0/plnktype");

        Iterator<org.xmlpull.infoset.XmlElement> plItr = xml.elements(null, "partnerLinkType").iterator();
        while (plItr.hasNext()) {
            org.xmlpull.infoset.XmlElement xmlElement = plItr.next();
            XmlNamespace plinkNs = BUILDER.newNamespace("http://docs.oasis-open.org/wsbpel/2.0/plnktype");
            xmlElement.setNamespace(plinkNs);
            Iterator childItr = xmlElement.children().iterator();
            while (childItr.hasNext()) {
                Object object = (Object) childItr.next();
                if (object instanceof org.xmlpull.infoset.XmlElement) {
View Full Code Here

            // Add the namespace to the lead context

            org.xmlpull.infoset.XmlElement types = wsdl.getTypes();
            // get the ns of schema from existing element
            XmlNamespace schemaNs = BUILDER.newNamespace("xsd", "http://www.w3.org/2001/XMLSchema");

            addCrosscutImportsIfNecessary(wsdl);

            org.xmlpull.infoset.XmlElement schema = BUILDER.newFragment(schemaNs, SCHEMA);
            types.addElement(0, schema);

            org.xmlpull.infoset.XmlElement importElement = BUILDER.newFragment(schema.getNamespace(), IMPORT);
            importElement.setAttributeValue(NAMESPACE, LEAD_CONTEXT_HEADER_NS);
            importElement.setAttributeValue(SCHEMA_LOCATION, SCHEMA_LOCATION_URI);
            schema.addElement(0, importElement);

            wsdl.xml().declareNamespace(BUILDER.newNamespace(LC, LEAD_CONTEXT_HEADER_NS));

            Iterator<WsdlPortType> iterator = wsdl.portTypes().iterator();
            while (iterator.hasNext()) {
                WsdlPortType portType = iterator.next();
                Iterator<WsdlPortTypeOperation> operations = portType.operations().iterator();
                while (operations.hasNext()) {
                    WsdlPortTypeOperation operation = operations.next();
                    WsdlMessagePart leadHeaderPart = new WsdlMessagePart(LEAD_HEADER);
                    leadHeaderPart.setName(LEAD_HEADER);
                    // we hand set this element to xml because when you use the
                    // API it doent add the namespace correctly
                    leadHeaderPart.xml().setAttributeValue(ELEMENT, LC_CONTEXT);

                    wsdl.getMessage(operation.getInput().getMessage().getLocalPart()).addPart(leadHeaderPart);
                }
            }

            Iterator<WsdlBinding> bindingItr = wsdl.bindings().iterator();
            while (bindingItr.hasNext()) {
                WsdlBinding wsdlBinding = (WsdlBinding) bindingItr.next();
                Iterator<WsdlBindingOperation> operationsItr = wsdlBinding.operations().iterator();
                while (operationsItr.hasNext()) {
                    WsdlBindingOperation wsdlBindingOperation = (WsdlBindingOperation) operationsItr.next();
                    org.xmlpull.infoset.XmlElement input = wsdlBindingOperation.xml().element(INPUT);
                    org.xmlpull.infoset.XmlElement body = input.element(BODY);
                    if (body == null) {
                        // This is a HTTP binding so continue with the next
                        continue;

                    }

                    body.setAttributeValue(PARTS, INPUT);
                    XmlNamespace ns = body.getNamespace();

                    org.xmlpull.infoset.XmlElement header = input.newElement(ns, HEADER);
                    header.setAttributeValue(PART, LEAD_HEADER);
                    header.setAttributeValue(USE, LITERAL);
                    String inputMessage = findInputMessage(wsdlBindingOperation, wsdl);
View Full Code Here

     *
     * @param wsdl
     */
    private void addCrosscutImportsIfNecessary(WsdlDefinitions wsdl) {
        org.xmlpull.infoset.XmlElement types = wsdl.getTypes();
        XmlNamespace schemaNs = BUILDER.newNamespace("xsd", "http://www.w3.org/2001/XMLSchema");
        Iterable<org.xmlpull.infoset.XmlElement> schemas = types.elements(null, SCHEMA);
        for (org.xmlpull.infoset.XmlElement schema : schemas) {

            if (WSDLUtil.attributeExist(schema, "type", "crosscutns:LeadCrosscutParameters")) {
                // so its there now check whether the impport is already there
View Full Code Here

        return element;
    }

    private void setTypeAttribute(XmlElement element, QName type) {
        String namespaceURI = type.getNamespaceURI();
        XmlNamespace namespace = element.lookupNamespaceByName(namespaceURI);
        element.setAttributeValue(WSConstants.TYPE_ATTRIBUTE, namespace.getPrefix() + ":" + type.getLocalPart());

    }
View Full Code Here

                this.definitions.getTypes().addChild(XMLUtil.deepClone(newSchema));

                String prefix = declareNamespaceIfNecessary(paramType.getPrefix(), paramType.getNamespaceURI(), false);
                return new QName(paramType.getNamespaceURI(), paramType.getLocalPart(), prefix);
            } else {
                XmlNamespace namespace = this.definitions.xml().lookupNamespaceByName(paramType.getNamespaceURI());
                return new QName(paramType.getNamespaceURI(), paramType.getLocalPart(), namespace.getPrefix());
            }
        } catch (UtilsException e) {
            e.printStackTrace();
        }
        return null;
View Full Code Here

        }
        return portType;
    }

    private String declareNamespaceIfNecessary(String prefixCandidate, String uri, boolean alwaysUseSuffix) {
        XmlNamespace namespace = this.definitions.xml().lookupNamespaceByName(uri);
        if (namespace == null) {
            return declareNamespace(prefixCandidate, uri, alwaysUseSuffix);
        } else {
            return namespace.getPrefix();
        }
    }
View Full Code Here

        XmlElement bpelElement = workflowElement.element(BPEL_TAG);
        if (bpelElement != null) {
            try {
                String bpelString = bpelElement.requiredText();
                XmlNamespace gpelNS = XmlInfosetBuilder.newInstance().newNamespace(BPELScript.GPEL, BPELScript.GPELNS);
                GpelConstants.GPEL_NS = gpelNS;
                this.gpelProcess = new GpelProcess(XMLUtil.stringToXmlElement(bpelString));
            } catch (RuntimeException e) {
                String error = "Failed to parse the BPEL document.";
                throw new GraphException(error, e);
View Full Code Here

TOP

Related Classes of org.xmlpull.infoset.XmlNamespace

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.