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

Examples of org.apache.airavata.workflow.model.graph.ws.WSGraph


            try {
                String path = file.getPath();

                if (path.endsWith(XBayaConstants.GRAPH_FILE_SUFFIX)) {
                    WSGraph graph = WSGraphFactory.createGraph(file);
                    workflow = Workflow.graphToWorkflow(graph);
                } else {
                    XmlElement workflowElement = XMLUtil.loadXML(file);
                    workflow = new Workflow(workflowElement);
                }
View Full Code Here


            try {

                String path = file.getPath();
                Workflow importedWorkflow;
                if (path.endsWith(XBayaConstants.GRAPH_FILE_SUFFIX)) {
                    WSGraph importedGraph = WSGraphFactory.createGraph(file);
                    importedWorkflow = Workflow.graphToWorkflow(importedGraph);
                } else {
                    XmlElement importedWorkflowElement = XMLUtil.loadXML(file);
                    importedWorkflow = new Workflow(importedWorkflowElement);
                }
View Full Code Here

            try {
                String path = file.getPath();

                if (path.endsWith(XBayaConstants.GRAPH_FILE_SUFFIX)) {
                    WSGraph graph = WSGraphFactory.createGraph(file);
                    workflow = Workflow.graphToWorkflow(graph);
                } else {
                    XmlElement workflowElement = XMLUtil.loadXML(file);
                    workflow = new Workflow(workflowElement);
                }
View Full Code Here

            try {
                String path = file.getPath();

                if (path.endsWith(XBayaConstants.GRAPH_FILE_SUFFIX)) {
                    WSGraph graph = WSGraphFactory.createGraph(file);
                    workflow = Workflow.graphToWorkflow(graph);
                } else {
                    XmlElement workflowElement = XMLUtil.loadXML(file);
                    workflow = new Workflow(workflowElement);
                }
View Full Code Here

            try {

                String path = file.getPath();
                Workflow importedWorkflow;
                if (path.endsWith(XBayaConstants.GRAPH_FILE_SUFFIX)) {
                    WSGraph importedGraph = WSGraphFactory.createGraph(file);
                    importedWorkflow = Workflow.graphToWorkflow(importedGraph);
                } else {
                    XmlElement importedWorkflowElement = XMLUtil.loadXML(file);
                    importedWorkflow = new Workflow(importedWorkflowElement);
                }
View Full Code Here

            try {
                String path = file.getPath();

                if (path.endsWith(XBayaConstants.GRAPH_FILE_SUFFIX)) {
                    WSGraph graph = WSGraphFactory.createGraph(file);
                    workflow = Workflow.graphToWorkflow(graph);
                } else {
                    XmlElement workflowElement = XMLUtil.loadXML(file);
                    workflow = new Workflow(workflowElement);
                }
View Full Code Here

     * @return The workflow that needs to be executed.
     * @throws GraphException
     * @throws MonitorException
     */
    public Workflow createDifference() throws GraphException, MonitorException {
        WSGraph originalGraph = this.modifiedWorkflow.getGraph();
        Workflow workflow = this.modifiedWorkflow.clone();
        String name = workflow.getName();
        name += " (diff)";
        workflow.setName(name);
        WSGraph graph = workflow.getGraph();

        // Remove the finished node.
        removeFinishedNodes(originalGraph, graph);

        Set<WSPort> originalFromPorts = getFinalOutputPorts(originalGraph, graph);

        // Create input nodes for unconnected input ports.
        createInputNodes(graph, originalFromPorts);

        // Set default values.
        for (WSPort originalFromPort : originalFromPorts) {
            // TODO handle the case that node is not WSNode.
            Node originalFromNode = originalFromPort.getNode();
            String fromNodeID = originalFromNode.getID();
            String output;
            if (originalFromNode instanceof InputNode) {
                // notification that includes the input of the workflow.
                output = getWorkflowInput(fromNodeID);
            } else if (originalFromNode instanceof WSNode) {
                // Retrieve input value from notification.
                WSComponent component = ((WSNode) originalFromNode).getComponent();
                String messageName = component.getOutputTypeName();
                String parameterName = originalFromPort.getComponentPort().getName();
                output = getOutput(fromNodeID, messageName, parameterName);
            } else {
                // This should not happen.
                throw new WorkflowRuntimeException(originalFromNode.getClass().getName());
            }
            Port originalToPort = originalFromPort.getToPorts().get(0);
            PortImpl toPort = graph.getPort(originalToPort.getID());
            InputNode inputNode = (InputNode) toPort.getFromNode();
            inputNode.setDefaultValue(output);
        }

        return workflow;
View Full Code Here

    }

    private void executeToMiddle(Workflow workflow, MonitorNotifier notifier) throws XmlValidationException,
            ComponentException {
        WSGraph graph = workflow.getGraph();

        String adder1ID = "Adder_add";
        String adder2ID = "Adder_add_2";

        NodeImpl a = graph.getNode("a");
        NodeImpl b = graph.getNode("b");
        NodeImpl c = graph.getNode("c");
        NodeImpl d = graph.getNode("d");
        NodeImpl adder = graph.getNode(adder1ID);
        NodeImpl adder2 = graph.getNode(adder2ID);

        WsdlDefinitions workflowWSDL = workflow.getWorkflowWSDL();
        DSCUtil.convertToCWSDL(workflowWSDL, URI.create("http://example.com"));
        HashMap<String, String> inputMap = new HashMap<String, String>();
        inputMap.put("a", "2");
View Full Code Here

        repaintAndWait(3);
    }

    private void modifyWorkflow(Workflow workflow) throws ComponentException, ComponentRegistryException,
            GraphException {
        WSGraph graph = workflow.getGraph();

        OutputComponent outputComponent = new OutputComponent();
        LocalComponentRegistry registry = new LocalComponentRegistry(XBayaPathConstants.WSDL_DIRECTORY);
        Component adderComponent = registry.getComponent(Adder.WSDL_PATH);
        Component multiplierComponent = registry.getComponent(Multiplier.WSDL_PATH);

        NodeImpl c = graph.getNode("c");
        NodeImpl d = graph.getNode("d");
        NodeImpl adder = graph.getNode("Adder_add");
        NodeImpl adder2 = graph.getNode("Adder_add_2");
        NodeImpl multiplier = graph.getNode("Multiplier_multiply");

        // Remove Adder_2 and replace with Multiplier_2.
        graph.removeNode(adder2);
        repaintAndWait(1);

        Node multiplier2 = workflow.addNode(multiplierComponent);
        multiplier2.setPosition(new Point(170, 210));
        repaintAndWait(1);

        graph.addEdge(c.getOutputPort(0), multiplier2.getInputPort(0));
        repaintAndWait(1);

        graph.addEdge(d.getOutputPort(0), multiplier2.getInputPort(1));
        repaintAndWait(1);

        graph.addEdge(multiplier2.getOutputPort(0), multiplier.getInputPort(1));
        repaintAndWait(1);

        // Add one more adder and an output.
        Node adder3 = workflow.addNode(adderComponent);
        adder3.setPosition(new Point(320, 300));
        repaintAndWait(1);

        graph.addEdge(adder.getOutputPort(0), adder3.getInputPort(0));
        repaintAndWait(1);

        graph.addEdge(multiplier2.getOutputPort(0), adder3.getInputPort(1));
        repaintAndWait(1);

        Node output2 = workflow.addNode(outputComponent);
        output2.setPosition(new Point(500, 300));
        repaintAndWait(1);

        graph.addEdge(adder3.getOutputPort(0), output2.getInputPort(0));
        repaintAndWait(1);
    }
View Full Code Here

            try {
                String path = file.getPath();

                if (path.endsWith(XBayaConstants.GRAPH_FILE_SUFFIX)) {
                    WSGraph graph = WSGraphFactory.createGraph(file);
                    workflow = Workflow.graphToWorkflow(graph);
                } else {
                    XmlElement workflowElement = XMLUtil.loadXML(file);
                    workflow = new Workflow(workflowElement);
                }
View Full Code Here

TOP

Related Classes of org.apache.airavata.workflow.model.graph.ws.WSGraph

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.