Package org.apache.airavata.xbaya.wf

Examples of org.apache.airavata.xbaya.wf.Workflow


     * @throws ComponentRegistryException
     * @throws ComponentException
     * @throws ComponentRegistryException
     */
    public Workflow createIfWorkflow() throws GraphException, ComponentException, ComponentRegistryException {
        Workflow workflow = new Workflow();

        // Name, description
        workflow.setName("If test");
        workflow.setDescription("Workflow that tests if");

        Graph graph = workflow.getGraph();

        // x
        InputNode x = (InputNode) workflow.addNode(this.inputComponent);
        x.setPosition(new Point(10, 10));

        // y
        InputNode y = (InputNode) workflow.addNode(this.inputComponent);
        y.setPosition(new Point(10, 90));

        // const0
        ConstantNode const0 = (ConstantNode) workflow.addNode(this.constantComponent);
        const0.setPosition(new Point(20, 180));

        // if
        IfNode ifNode = (IfNode) workflow.addNode(this.ifComponent);
        ifNode.setPosition(new Point(170, 180));

        // Adder nodes
        Component adderComp = this.componentRegistry.getComponent(Adder.WSDL_PATH);

        Node adder = workflow.addNode(adderComp);
        adder.setPosition(new Point(400, 10));

        // Multiplier node
        Component multiComp = this.componentRegistry.getComponent(Multiplier.WSDL_PATH);

        Node multiplier = workflow.addNode(multiComp);
        multiplier.setPosition(new Point(400, 90));

        // endif
        Node endif = workflow.addNode(this.endifComponent);
        endif.setPosition(new Point(550, 40));

        // Output
        OutputNode output = (OutputNode) workflow.addNode(this.outputComponent);
        output.setConfiguredName("output");
        output.setPosition(new Point(700, 40));

        // Connect ports
        graph.addEdge(x.getOutputPort(0), adder.getInputPort(0));
View Full Code Here


    /**
     * Exports a Scufl script to the local file
     */
    public void exportScuflScript() {
        Workflow workflow = this.engine.getWorkflow();
        ScuflScript script = new ScuflScript(workflow, this.engine.getConfiguration());

        // Check if there is any errors in the workflow first.
        ArrayList<String> warnings = new ArrayList<String>();
        if (!script.validate(warnings)) {
View Full Code Here

     * @throws GraphException
     * @throws ComponentRegistryException
     * @throws ComponentException
     */
    public Workflow createReceiveWorkflow() throws GraphException, ComponentException, ComponentRegistryException {
        Workflow workflow = new Workflow();

        // Name, description
        workflow.setName("Receive test");
        workflow.setDescription("Workflow that tests receive");

        Graph graph = workflow.getGraph();

        // Adder nodes
        Component echoComponent = this.componentRegistry.getComponent(Echo.WSDL_PATH);

        Node echo = workflow.addNode(echoComponent);
        echo.setPosition(new Point(40, 40));

        // receive
        ReceiveNode receive = (ReceiveNode) workflow.addNode(this.receiveComponent);
        receive.setPosition(new Point(200, 200));

        // Output
        OutputNode output1 = (OutputNode) workflow.addNode(this.outputComponent);
        output1.setPosition(new Point(350, 40));

        OutputNode output2 = (OutputNode) workflow.addNode(this.outputComponent);
        output2.setPosition(new Point(350, 200));

        // Connect ports
        graph.addEdge(receive.getEPRPort(), echo.getInputPort(0));
        graph.addEdge(echo.getOutputPort(0), output1.getInputPort(0));
View Full Code Here

    /**
     * Exports a Jython script to the local file
     */
    public void exportJythonScript() {
        Workflow workflow = this.engine.getWorkflow();
        JythonScript script = new JythonScript(workflow, this.engine.getConfiguration());

        // Check if there is any errors in the workflow first.
        ArrayList<String> warnings = new ArrayList<String>();
        if (!script.validate(warnings)) {
View Full Code Here

     * @throws GraphException
     * @throws ComponentRegistryException
     */
    public Workflow createGFacWorkflow() throws ComponentException, GraphException, ComponentRegistryException {

        Workflow workflow = new Workflow();

        // Name, description
        workflow.setName("GFac test workflow");
        workflow.setDescription("GFac test workflow");

        Graph graph = workflow.getGraph();

        // Adder node
        Component gfacComp = this.componentRegistry.getComponent(GFAC_TEST_AWSDL);
        Node gfacNode = workflow.addNode(gfacComp);
        gfacNode.setPosition(new Point(250, 100));

        // Input parameter node 1
        InputNode paramNode1 = (InputNode) workflow.addNode(this.inputComponent);
        paramNode1.setPosition(new Point(50, 50));
        String paramValue1 = "300";
        paramNode1.setDefaultValue(paramValue1);

        // Output parameter
        OutputNode outParamNode = (OutputNode) workflow.addNode(this.outputComponent);
        outParamNode.setPosition(new Point(300, 220));

        // Connect ports
        graph.addEdge(paramNode1.getOutputPort(0), gfacNode.getInputPort(0));
        graph.addEdge(gfacNode.getOutputPort(0), outParamNode.getInputPort(0));
View Full Code Here

     * @throws GraphException
     * @throws ComponentException
     * @throws ComponentRegistryException
     */
    public Workflow createLoanWorkflow() throws GraphException, ComponentException, ComponentRegistryException {
        Workflow workflow = new Workflow();

        // Name, description
        workflow.setName("Loan Approval");
        workflow.setDescription("Loan Approval");

        Graph graph = workflow.getGraph();

        // amount
        InputNode amount = (InputNode) workflow.addNode(this.inputComponent);
        amount.setPosition(new Point(10, 10));

        // if
        IfNode ifNode = (IfNode) workflow.addNode(this.ifComponent);
        ifNode.setPosition(new Point(200, 100));

        // Approver nodes
        Component approverComponent = this.componentRegistry.getComponent(Approver.WSDL_PATH);

        Node approver = workflow.addNode(approverComponent);
        approver.setPosition(new Point(350, 10));

        // const
        ConstantNode constYes = (ConstantNode) workflow.addNode(this.constantComponent);
        constYes.setPosition(new Point(350, 200));

        // endif
        Node endif = workflow.addNode(this.endifComponent);
        endif.setPosition(new Point(550, 100));

        // Output
        OutputNode output = (OutputNode) workflow.addNode(this.outputComponent);
        output.setPosition(new Point(700, 100));

        // Connect ports
        graph.addEdge(amount.getOutputPort(0), approver.getInputPort(0));
        graph.addEdge(amount.getOutputPort(0), ifNode.getInputPort(0));
View Full Code Here

    /**
     * Opens a current workflow from the local file.
     */
    public void openWorkflow() {
        Workflow workflow = null;
        workflow = getWorkflow();
        if (null != workflow) {
            this.engine.setWorkflow(workflow);
        }
    }
View Full Code Here

    /**
     * @param workflow
     * @return
     */
    public Workflow getWorkflow() {
        Workflow workflow = null;
        int returnVal = this.graphFileChooser.showOpenDialog(this.engine.getGUI().getFrame());

        if (returnVal == JFileChooser.APPROVE_OPTION) {
            File file = this.graphFileChooser.getSelectedFile();
            logger.info(file.getPath());

            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);
                }

            } catch (IOException e) {
                this.engine.getErrorWindow().error(ErrorMessages.OPEN_FILE_ERROR, e);
            } catch (GraphException e) {
View Full Code Here

            String path = file.getPath();
            if (!path.endsWith(XBayaConstants.WORKFLOW_FILE_SUFFIX)) {
                file = new File(path + XBayaConstants.WORKFLOW_FILE_SUFFIX);
            }

            Workflow workflow = this.engine.getWorkflow();
            try {
                XMLUtil.saveXML(workflow.toXML(), file);
            } catch (IOException e) {
                this.engine.getErrorWindow().error(ErrorMessages.WRITE_FILE_ERROR, e);
            } catch (RuntimeException e) {
                this.engine.getErrorWindow().error(ErrorMessages.GRAPH_SAVE_ERROR, e);
            } catch (Error e) {
View Full Code Here

    public void importWorkflow() {
        int returnVal = this.graphFileChooser.showOpenDialog(this.engine.getGUI().getFrame());
        if (returnVal == JFileChooser.APPROVE_OPTION) {
            File file = this.graphFileChooser.getSelectedFile();

            Workflow workflow = this.engine.getWorkflow();
            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);
                }
                workflow.importWorkflow(importedWorkflow);
                this.engine.setWorkflow(workflow);
            } catch (IOException e) {
                this.engine.getErrorWindow().error(ErrorMessages.OPEN_FILE_ERROR, e);
View Full Code Here

TOP

Related Classes of org.apache.airavata.xbaya.wf.Workflow

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.