Package org.apache.airavata.xbaya.wf

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


    /**
   *
   */
    public void save() {
        Workflow wf = this.engine.getWorkflow();
        if (0 == wf.getGraph().getNodes().size()) {
            this.engine.getErrorWindow().warning("Workflow is Empty");
            return;
        }
        GpelProcess process;
        try {

            int returnVal = this.bpelFileChooser.showSaveDialog(this.engine.getGUI().getFrame());
            if (returnVal == JFileChooser.APPROVE_OPTION) {
                File file = this.bpelFileChooser.getSelectedFile();

                String path = file.getPath();

                // Remove ".bpel" at the end if any
                if (path.endsWith(XBayaConstants.BPEL_SUFFIX)) {
                    path = path.substring(0, path.length() - XBayaConstants.BPEL_SUFFIX.length());
                }

                // Add ".bpel" at the end of the file name
                File bpelFile = new File(path + XBayaConstants.BPEL_SUFFIX);
                // Add ".wsdl" at the end of the file name
                File wsdlFile = new File(path + XBayaConstants.WSDL_SUFFIX);
                // todo this has to fix, for compilation purpose passing dummy value instead of xregistry url
                URI temp = null;
                try {
                    temp = new URI("temp");
                } catch (URISyntaxException e) {
                    e.printStackTrace(); // To change body of catch statement use File | Settings | File Templates.
                }
                process = wf.getOdeProcess(WSDLUtil.appendWSDLQuary(temp), this.engine.getConfiguration().getODEURL());
                String processString = process.xmlStringPretty();
                FileWriter writer = new FileWriter(bpelFile);
                writer.write(processString);
                writer.close();

                WsdlDefinitions workflowWSDL = wf.getOdeWorkflowWSDL(this.engine.getConfiguration().getDSCURL(),
                        this.engine.getConfiguration().getODEURL());
                String workflowWsdlStr = XmlConstants.BUILDER.serializeToStringPretty(workflowWSDL.xml());
                writer = new FileWriter(wsdlFile);
                writer.write(workflowWsdlStr);

                Map<String, WsdlDefinitions> wsdlMap = wf.getOdeServiceWSDLs(
                        this.engine.getConfiguration().getDSCURL(), this.engine.getConfiguration().getODEURL());
                Set<String> keySet = wsdlMap.keySet();
                for (String string : keySet) {
                    writer = new FileWriter(new File(wsdlFile.getParent(), QName.valueOf(string).getLocalPart()));
                    writer.write(XmlConstants.BUILDER.serializeToStringPretty(wsdlMap.get(string).xml()));
                    writer.close();
                }

                XmlElement deployDescriptor = wf.getODEDeploymentDescriptor(this.engine.getConfiguration().getDSCURL(),
                        this.engine.getConfiguration().getODEURL());
                writer = new FileWriter(new File(wsdlFile.getParent(), "deploy.xml"));
                writer.write(XmlConstants.BUILDER.serializeToString(deployDescriptor));
                writer.close();

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

    /**
     * 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 ComponentException
     * @throws GraphException
     * @throws ComponentRegistryException
     */
    public Workflow createSimpleMathWorkflow() throws ComponentException, GraphException, ComponentRegistryException {
        Workflow workflow = new Workflow();

        // Name, description
        workflow.setName("Simple math workflow");
        workflow.setDescription("Simple math workflow");

        Graph graph = workflow.getGraph();

        // Adder node
        Component adderComp = this.componentRegistry.getComponent(Adder.WSDL_PATH);
        Node adderNode = workflow.addNode(adderComp);
        adderNode.setPosition(new Point(250, 100));

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

        // Input parameter node 2
        InputNode paramNode2 = (InputNode) workflow.addNode(this.inputComponent);
        paramNode2.setPosition(new Point(50, 120));

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

        // Connect ports
        graph.addEdge(paramNode1.getOutputPort(0), adderNode.getInputPort(0));
        graph.addEdge(paramNode2.getOutputPort(0), adderNode.getInputPort(1));
View Full Code Here

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

        // Name, description
        workflow.setName("Math workflow");
        workflow.setDescription("A workflow that calculates (a + b) * c.");

        Graph graph = workflow.getGraph();

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

        Node adderNode1 = workflow.addNode(adderComp);
        adderNode1.setPosition(new Point(170, 50));

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

        Node multiNode = workflow.addNode(multiComp);
        multiNode.setPosition(new Point(320, 130));

        // Input node 1
        InputNode inputNode1 = (InputNode) workflow.addNode(this.inputComponent);
        inputNode1.setPosition(new Point(20, 30));

        // Input node 2
        InputNode inputNode2 = (InputNode) workflow.addNode(this.inputComponent);
        inputNode2.setPosition(new Point(20, 100));

        // Input node 3
        InputNode inputNode3 = (InputNode) workflow.addNode(this.inputComponent);
        inputNode3.setPosition(new Point(20, 170));

        // Output
        OutputNode outputNode = (OutputNode) workflow.addNode(this.outputComponent);
        outputNode.setPosition(new Point(500, 130));

        // Connect ports
        graph.addEdge(inputNode1.getOutputPort(0), adderNode1.getInputPort(0));
        graph.addEdge(inputNode2.getOutputPort(0), adderNode1.getInputPort(1));
View Full Code Here

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

        // Name, description
        workflow.setName("Complex math workflow");
        workflow.setDescription("Complex math workflow");

        Graph graph = workflow.getGraph();

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

        Node adderNode1 = workflow.addNode(adderComp);
        adderNode1.setPosition(new Point(170, 50));

        Node adderNode2 = workflow.addNode(adderComp);
        adderNode2.setPosition(new Point(170, 210));

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

        Node multiNode = workflow.addNode(multiComp);
        multiNode.setPosition(new Point(320, 130));

        // Input node 1
        InputNode inputNode1 = (InputNode) workflow.addNode(this.inputComponent);
        inputNode1.setPosition(new Point(20, 30));

        // Input node 2
        InputNode inputNode2 = (InputNode) workflow.addNode(this.inputComponent);
        inputNode2.setPosition(new Point(20, 100));

        // Input node 3
        InputNode inputNode3 = (InputNode) workflow.addNode(this.inputComponent);
        inputNode3.setPosition(new Point(20, 170));

        // Input node 4
        InputNode inputNode4 = (InputNode) workflow.addNode(this.inputComponent);
        inputNode4.setPosition(new Point(20, 240));

        // Output
        OutputNode outputNode = (OutputNode) workflow.addNode(this.outputComponent);
        outputNode.setPosition(new Point(500, 130));

        // Connect ports
        graph.addEdge(inputNode1.getOutputPort(0), adderNode1.getInputPort(0));
        graph.addEdge(inputNode2.getOutputPort(0), adderNode1.getInputPort(1));
View Full Code Here

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

        Workflow workflow = new Workflow();

        // Name, description
        workflow.setName("Math with const");
        workflow.setDescription("Math with const");

        Graph graph = workflow.getGraph();

        // Adder node
        Component adderComp = this.componentRegistry.getComponent(Adder.WSDL_PATH);
        Node adderNode = workflow.addNode(adderComp);
        adderNode.setPosition(new Point(250, 100));

        // Input parameter node
        InputNode inputNode = (InputNode) workflow.addNode(this.inputComponent);
        inputNode.setPosition(new Point(50, 50));

        // Constant node
        ConstantNode constantNode = (ConstantNode) workflow.addNode(this.constantComponent);
        constantNode.setPosition(new Point(50, 120));

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

        // Connect ports
        graph.addEdge(inputNode.getOutputPort(0), adderNode.getInputPort(0));
        graph.addEdge(constantNode.getOutputPort(0), adderNode.getInputPort(1));
View Full Code Here

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

        // Name, description
        workflow.setName("Array test");
        workflow.setDescription("A workflow that tests arrays");

        Graph graph = workflow.getGraph();

        // n
        InputNode inputN = (InputNode) workflow.addNode(this.inputComponent);
        inputN.setPosition(new Point(0, 80));

        // Array generator
        Component arrayGeneratorComponent = this.componentRegistry.getComponent(ArrayGenerator.WSDL_PATH);
        Node arrayGenerator = workflow.addNode(arrayGeneratorComponent);
        arrayGenerator.setPosition(new Point(150, 80));

        // Array adder
        Component arrayAdderComponent = this.componentRegistry.getComponent(ArrayAdder.WSDL_PATH);
        Node arrayAdder = workflow.addNode(arrayAdderComponent);
        arrayAdder.setPosition(new Point(400, 80));

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

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

      url = (new File(fileName)).toURL();
    }
    Properties properties = new Properties();
    properties.load(url.openStream());
    try {
      Workflow workflow = new Workflow(this.workflow);
      List<NodeImpl> inputs = workflow.getGraph().getNodes();
      int inputSize = 0;
      for (NodeImpl input : inputs) {
        if (input instanceof InputNode) {
          inputSize++;
        }
View Full Code Here

    @Test
    public void testScheduleDynamically() throws IOException, URISyntaxException, XBayaException {
        logger.info("Running SimpleMathWorkflowTest...");
        URL systemResource = this.getClass().getClassLoader().getSystemResource("SimpleMath.xwf");
        Workflow workflow = new Workflow(WorkflowTestUtils.readWorkflow(systemResource));
        WorkflowInterpreter interpretor = new WorkflowInterpreter(WorkflowTestUtils.getConfiguration(), UUID.randomUUID().toString(),
                workflow, "NA", "NA",true);
        interpretor.scheduleDynamically();
    }
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.