Package org.apache.airavata.workflow.model.graph

Examples of org.apache.airavata.workflow.model.graph.Port


        List<GpelAssignCopy> copies = new ArrayList<GpelAssignCopy>();
        List<OutputNode> outputNodes = GraphUtil.getNodes(this.graph, OutputNode.class);
        this.remainNodes.removeAll(outputNodes);
        for (OutputNode outputNode : outputNodes) {
            Port port = outputNode.getPort();
            GpelAssignCopyFrom from = createAssignCopyFrom(port);
            GpelAssignCopyTo to = createAssignCopyTo(port, false);

            copies.add(new GpelAssignCopy(this.bpelNS, from, to));
        }
View Full Code Here


        this.process.addMessageVariable(outputVariableName, namespace, portTypeQName.getLocalPart());

        // Assign
        List<GpelAssignCopy> copies = new ArrayList<GpelAssignCopy>();
        for (Port port : node.getInputPorts()) {
            Port fromPort = port.getFromPort();
            if (fromPort == null) {
                // optional input
                continue;
            }
            GpelAssignCopyFrom from = createAssignCopyFrom(port);
View Full Code Here

     * @throws GraphException
     */
    private GpelAssignCopyFrom createAssignCopyFrom(Port port) throws GraphException {
        GpelAssignCopyFrom from = new GpelAssignCopyFrom(this.bpelNS);

        Port fromPort = port.getFromPort();
        Node fromNode = fromPort.getNode();
        if (fromNode instanceof InputNode) {
            from.setVariable(WORKFLOW_INPUT_NAME);
            from.setPart(WorkflowWSDL.INPUT_PART_NAME);
            from.setQuery("/" + this.typesNamespace.getPrefix() + ":"
                    + this.workflowWSDL.getWorkflowInputMessageElelmentName() + "/" + fromNode.getID());
        } else if (fromNode instanceof ConstantNode) {
            ConstantNode constNode = (ConstantNode) fromNode;
            Object value = constNode.getValue();
            // The namaspace and name of the literal element will be set
            // correctly in from.setLiteral().
            XmlElement literalElement = XMLUtil.BUILDER.newFragment(GpelAssignCopyFrom.LITERAL_EL);
            literalElement.addChild(value);
            from.setLiteral(literalElement);
        } else if (fromNode instanceof WSNode) {
            String fromID = fromNode.getID();
            WSComponent fromWsdlComponent = (WSComponent) fromNode.getComponent();

            WSComponentPort fromWsdlPort = (WSComponentPort) fromPort.getComponentPort();

            from.setVariable(fromID + OUTPUT_SUFFIX);
            from.setPart(fromWsdlComponent.getOutputPartName());

            if (fromWsdlPort.isSchemaUsed()) {
                String typesTargetNamespace = fromWsdlPort.getTargetNamespace();
                XmlNamespace namespace = XMLUtil.declareNamespaceIfNecessary(fromID.toLowerCase() + TYPENS_SUFFIX,
                        typesTargetNamespace, false, this.process.xml());

                from.setQuery("/" + namespace.getPrefix() + ":" + fromWsdlComponent.getOutputTypeName() + "/"
                        + fromWsdlPort.getName());
            } else {
                // No query needed?
            }
        } else if (fromNode instanceof ForEachNode) {
            from.setVariable(fromNode.getID() + FOREACH_VALUE_SUFFIX);
        } else if (fromNode instanceof EndForEachNode) {
            from.setVariable(fromNode.getID() + ARRAY_SUFIX);
        } else if (fromNode instanceof EndifNode) {
            // endif has multiple outputs, so we use port ID here.
            from.setVariable(fromPort.getID() + OUTPUT_SUFFIX);
        } else if (fromNode instanceof ReceiveNode) {
            if (fromPort instanceof EPRPort) {
                from.setPartnerLink(fromNode.getID() + PARTNER_LINK_NAME_SUFFIX);
                from.setEndpointReference("myRole");
            } else {
View Full Code Here

                }
            }
        }

        // Check control dependency.
        Port port = node.getControlInPort();
        if (port != null) {
            Collection<Node> fromNodes = port.getFromNodes();
            for (Node fromNode : fromNodes) {
                if (nodes.contains(fromNode)) {
                    return false;
                }
            }
View Full Code Here

        }
        // replace $1, $2,... with actual value.
        List<? extends Port> inputPorts = ifNode.getInputPorts();
        ArrayList<GpelAssignCopy> copies = new ArrayList<GpelAssignCopy>();
        for (int i = 0; i < inputPorts.size(); i++) {
            Port port = inputPorts.get(i);
            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);
View Full Code Here

        for (int i = 0; i < outputPorts.size(); i++) {
            DataPort outputPort = outputPorts.get(i);
            String variable = outputPort.getID() + OUTPUT_SUFFIX;
            int index = ifBlock ? i : i + outputPorts.size();
            DataPort inputPort = endifNode.getInputPort(index);
            Port fromPort = inputPort.getFromPort();
            GpelAssignCopyFrom from = createAssignCopyFrom(fromPort);
            GpelAssignCopyTo to = new GpelAssignCopyTo(this.bpelNS);
            to.setVariable(variable);
            GpelAssignCopy copy = new GpelAssignCopy(this.bpelNS, from, to);
            copies.add(copy);
View Full Code Here

    private Set<Node> getIfBlock(Node node, boolean ifBlock) throws GraphException {
        Set<Node> block = new HashSet<Node>();

        int index = ifBlock ? 0 : 1;
        Port controlOutPort = node.getControlOutPorts().get(index);
        for (Node nextNode : controlOutPort.getToNodes()) {
            block.add(nextNode);
            getSpecialBlock(nextNode, 0, block, IfNode.class, EndifNode.class);
        }
        return block;
    }
View Full Code Here

        for (int i = 0; i < outputPorts.size(); i++) {
            DataPort outputPort = outputPorts.get(i);
            String variable = outputPort.getID() + OUTPUT_SUFFIX;
            int index = blockBlock ? i : i + outputPorts.size();
            DataPort inputPort = endBlockNode.getInputPort(index);
            Port fromPort = inputPort.getFromPort();
            GpelAssignCopyFrom from = createAssignCopyFrom(fromPort);
            GpelAssignCopyTo to = new GpelAssignCopyTo(this.bpelNS);
            to.setVariable(variable);
            GpelAssignCopy copy = new GpelAssignCopy(this.bpelNS, from, to);
            copies.add(copy);
View Full Code Here

    private Set<Node> getBlockBlock(Node node, boolean blockBlock) throws GraphException {
        Set<Node> block = new HashSet<Node>();

        int index = blockBlock ? 0 : 1;
        Port controlOutPort = node.getControlOutPorts().get(index);
        for (Node nextNode : controlOutPort.getToNodes()) {
            block.add(nextNode);
            getSpecialBlock(nextNode, 0, block, BlockNode.class, EndBlockNode.class);
        }
        return block;
    }
View Full Code Here

    @Override
    protected void edgeWasAdded(Edge edge) throws GraphException {
        super.edgeWasAdded(edge);

        if (edge instanceof DataEdge) {
            Port toPort = edge.getToPort();
            Node toNode = toPort.getNode();
            Port fromPort = edge.getFromPort();
            Node fromNode = fromPort.getNode();

            if (!(toNode instanceof ResourceNode && fromNode instanceof ResourceNode)) {
                throw new GraphException("Cannot connect Resource Node to other type of nodes");
            }
        }
View Full Code Here

TOP

Related Classes of org.apache.airavata.workflow.model.graph.Port

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.