You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airavata.apache.org by sa...@apache.org on 2014/07/12 00:21:21 UTC

[08/20] updating xbaya gui to the new airavata

http://git-wip-us.apache.org/repos/asf/airavata/blob/3e6c815a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/test/service/multiplier/MultiplierService.java
----------------------------------------------------------------------
diff --git a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/test/service/multiplier/MultiplierService.java b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/test/service/multiplier/MultiplierService.java
deleted file mode 100644
index e4d910b..0000000
--- a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/test/service/multiplier/MultiplierService.java
+++ /dev/null
@@ -1,132 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.airavata.xbaya.test.service.multiplier;
-
-import java.io.File;
-
-import org.apache.airavata.common.utils.XMLUtil;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import xsul.lead.LeadContextHeader;
-import xsul.wsdl.WsdlDefinitions;
-import xsul.xhandler_soap_sticky_header.StickySoapHeaderHandler;
-import xsul.xservo.XService;
-import xsul.xservo_soap.XSoapDocLiteralService;
-import xsul.xservo_soap_http.HttpBasedServices;
-
-public class MultiplierService {
-
-    private final static String SERVICE_NAME = "MultiplierService";
-
-    private final static String BASE_WSDL_LOCATION = "wsdls/math/multiplier-wsdl.xml";
-
-    private final static String OUTPUT_WSDL_LOCATION = "wsdls/sample/multiplier-wsdl.xml";
-
-    private final static Logger logger = LoggerFactory.getLogger(MultiplierService.class);
-
-    private HttpBasedServices httpServices;
-
-    private XService xservice;
-
-    private int port;
-
-    /**
-     * Constructs a MultiplierService.
-     * 
-     */
-    public MultiplierService() {
-        this(0);
-    }
-
-    /**
-     * Constructs a MultiplierService.
-     * 
-     * @param port
-     */
-    public MultiplierService(int port) {
-        this.port = port;
-    }
-
-    /**
-     * Runs the service.
-     */
-    public void run() {
-        this.httpServices = new HttpBasedServices(this.port);
-        logger.info("Server started on " + this.httpServices.getServerPort());
-
-        logger.info("Using WSDL for service description from " + BASE_WSDL_LOCATION);
-        this.xservice = this.httpServices.addService(new XSoapDocLiteralService(SERVICE_NAME, BASE_WSDL_LOCATION,
-                new MultiplierImpl()));
-        this.xservice.addHandler(new StickySoapHeaderHandler("retrieve-lead-header", LeadContextHeader.TYPE));
-        this.xservice.startService();
-        logger.info("Service started");
-        logger.info("Service WSDL available at " + getServiceWsdlLocation());
-    }
-
-    /**
-     * Returns the location of the WSDL.
-     * 
-     * @return The location of the WSDL
-     */
-    public String getServiceWsdlLocation() {
-        return this.httpServices.getServer().getLocation() + "/" + SERVICE_NAME + "?wsdl";
-    }
-
-    /**
-     * Returns the WSDL of the service.
-     * 
-     * @return The WSDL of the service.
-     */
-    public WsdlDefinitions getWsdl() {
-        return this.xservice.getWsdl();
-    }
-
-    /**
-     * Shutdowns the service.
-     */
-    public void shutdownServer() {
-        this.httpServices.getServer().shutdownServer();
-    }
-
-    /**
-     * @param args
-     */
-    public static void main(String[] args) {
-        try {
-            int port = 0;
-            if (args.length == 2) {
-                if ("-port".equalsIgnoreCase(args[0])) {
-                    port = Integer.parseInt(args[1]);
-                }
-            }
-            MultiplierService service = new MultiplierService(port);
-            service.run();
-            WsdlDefinitions wsdl = service.getWsdl();
-            File wsdlFile = new File(OUTPUT_WSDL_LOCATION);
-            XMLUtil.saveXML(wsdl, wsdlFile);
-        } catch (Exception e) {
-            logger.error(e.getMessage(), e);
-        }
-    }
-
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/airavata/blob/3e6c815a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/test/util/WorkflowCreator.java
----------------------------------------------------------------------
diff --git a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/test/util/WorkflowCreator.java b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/test/util/WorkflowCreator.java
index 708788a..b4ff48c 100644
--- a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/test/util/WorkflowCreator.java
+++ b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/test/util/WorkflowCreator.java
@@ -1,741 +1,741 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.airavata.xbaya.test.util;
-
-import java.awt.Point;
-
-import org.apache.airavata.workflow.model.component.Component;
-import org.apache.airavata.workflow.model.component.ComponentException;
-import org.apache.airavata.workflow.model.component.ComponentRegistryException;
-import org.apache.airavata.workflow.model.component.local.LocalComponentRegistry;
-import org.apache.airavata.workflow.model.component.system.ConstantComponent;
-import org.apache.airavata.workflow.model.component.system.DoWhileComponent;
-import org.apache.airavata.workflow.model.component.system.EndDoWhileComponent;
-import org.apache.airavata.workflow.model.component.system.EndForEachComponent;
-import org.apache.airavata.workflow.model.component.system.EndifComponent;
-import org.apache.airavata.workflow.model.component.system.ForEachComponent;
-import org.apache.airavata.workflow.model.component.system.IfComponent;
-import org.apache.airavata.workflow.model.component.system.InputComponent;
-import org.apache.airavata.workflow.model.component.system.OutputComponent;
-import org.apache.airavata.workflow.model.component.system.ReceiveComponent;
-import org.apache.airavata.workflow.model.graph.Graph;
-import org.apache.airavata.workflow.model.graph.GraphException;
-import org.apache.airavata.workflow.model.graph.Node;
-import org.apache.airavata.workflow.model.graph.system.ConstantNode;
-import org.apache.airavata.workflow.model.graph.system.DoWhileNode;
-import org.apache.airavata.workflow.model.graph.system.IfNode;
-import org.apache.airavata.workflow.model.graph.system.InputNode;
-import org.apache.airavata.workflow.model.graph.system.OutputNode;
-import org.apache.airavata.workflow.model.graph.system.ReceiveNode;
-import org.apache.airavata.workflow.model.wf.Workflow;
-import org.apache.airavata.xbaya.file.XBayaPathConstants;
-import org.apache.airavata.xbaya.test.service.adder.Adder;
-import org.apache.airavata.xbaya.test.service.approver.Approver;
-import org.apache.airavata.xbaya.test.service.arrayadder.ArrayAdder;
-import org.apache.airavata.xbaya.test.service.arraygen.ArrayGenerator;
-import org.apache.airavata.xbaya.test.service.echo.Echo;
-import org.apache.airavata.xbaya.test.service.multiplier.Multiplier;
-
-public class WorkflowCreator {
-
-    /**
-     * GFAC_TEST_AWSDL
-     */
-    public static final String GFAC_TEST_AWSDL = "TestCMD_Example1_AWSDL.xml";
-
-    private Component inputComponent;
-
-    private Component outputComponent;
-
-    private LocalComponentRegistry componentRegistry;
-
-    private ConstantComponent constantComponent;
-
-    private ForEachComponent splitComponent;
-
-    private EndForEachComponent mergeComponent;
-
-    private IfComponent ifComponent;
-
-    private EndifComponent endifComponent;
-
-    private ReceiveComponent receiveComponent;
-
-    private DoWhileComponent doWhileComponent;
-
-    private EndDoWhileComponent endDoWhileComponent;
-
-    /**
-     * Constructs a WorkflowCreator.
-     */
-    public WorkflowCreator() {
-        this.componentRegistry = new LocalComponentRegistry(XBayaPathConstants.WSDL_DIRECTORY);
-        this.inputComponent = new InputComponent();
-        this.outputComponent = new OutputComponent();
-        this.constantComponent = new ConstantComponent();
-        this.splitComponent = new ForEachComponent();
-        this.mergeComponent = new EndForEachComponent();
-        this.ifComponent = new IfComponent();
-        this.endifComponent = new EndifComponent();
-        this.receiveComponent = new ReceiveComponent();
-        this.doWhileComponent = new DoWhileComponent();
-        this.endDoWhileComponent = new EndDoWhileComponent();
-    }
-
-    /**
-     * @return The graph
-     * @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));
-        graph.addEdge(adderNode.getOutputPort(0), outParamNode.getInputPort(0));
-
-        // Set the default values
-        // This needs to be after connection.
-        String paramValue1 = "2";
-        paramNode1.setDefaultValue(paramValue1);
-        String paramValue2 = "3";
-        paramNode2.setDefaultValue(paramValue2);
-        return workflow;
-    }
-
-    /**
-     * @return The graph
-     * @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));
-        graph.addEdge(adderNode1.getOutputPort(0), multiNode.getInputPort(0));
-        graph.addEdge(inputNode3.getOutputPort(0), multiNode.getInputPort(1));
-        graph.addEdge(multiNode.getOutputPort(0), outputNode.getInputPort(0));
-
-        // Set the default values
-        // This needs to be after connection.
-        inputNode1.setConfiguredName("a");
-        inputNode2.setConfiguredName("b");
-        inputNode3.setConfiguredName("c");
-        inputNode1.setConfigured(true);
-        inputNode2.setConfigured(true);
-        inputNode3.setConfigured(true);
-        inputNode1.setDefaultValue("2");
-        inputNode2.setDefaultValue("3");
-        inputNode3.setDefaultValue("4");
-        outputNode.setConfiguredName("z");
-        outputNode.setConfigured(true);
-
-        return workflow;
-    }
-
-    /**
-     * @return The graph
-     * @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));
-        graph.addEdge(inputNode3.getOutputPort(0), adderNode2.getInputPort(0));
-        graph.addEdge(inputNode4.getOutputPort(0), adderNode2.getInputPort(1));
-        graph.addEdge(adderNode1.getOutputPort(0), multiNode.getInputPort(0));
-        graph.addEdge(adderNode2.getOutputPort(0), multiNode.getInputPort(1));
-        graph.addEdge(multiNode.getOutputPort(0), outputNode.getInputPort(0));
-
-        // Set the default values
-        // This needs to be after connection.
-        inputNode1.setConfiguredName("a");
-        inputNode2.setConfiguredName("b");
-        inputNode3.setConfiguredName("c");
-        inputNode4.setConfiguredName("d");
-        inputNode1.setDescription("This is the first input.");
-        inputNode2.setDescription("This is the second input.");
-        inputNode3.setDescription("This is the third input.");
-        inputNode4.setDescription("This is the fourth input.");
-        inputNode1.setConfigured(true);
-        inputNode2.setConfigured(true);
-        inputNode3.setConfigured(true);
-        inputNode4.setConfigured(true);
-        inputNode1.setDefaultValue("2");
-        inputNode2.setDefaultValue("3");
-        inputNode3.setDefaultValue("4");
-        inputNode4.setDefaultValue("5");
-        outputNode.setConfiguredName("z");
-        outputNode.setConfigured(true);
-
-        return workflow;
-    }
-
-    /**
-     * @return The graph
-     * @throws ComponentException
-     * @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));
-        graph.addEdge(adderNode.getOutputPort(0), outParamNode.getInputPort(0));
-
-        // Set the default value of an input and the constant.
-        // This needs to be after connection.
-        String paramValue1 = "2";
-        inputNode.setDefaultValue(paramValue1);
-        String paramValue2 = "3";
-        constantNode.setValue(paramValue2);
-        return workflow;
-    }
-
-    /**
-     * @return The workflow
-     * @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));
-        graph.addEdge(arrayGenerator.getOutputPort(0), arrayAdder.getInputPort(0));
-        graph.addEdge(arrayAdder.getOutputPort(0), output.getInputPort(0));
-
-        // Set the default values
-        // This needs to be after connection.
-        String n = "5";
-        inputN.setDefaultValue(n);
-
-        return workflow;
-    }
-
-    /**
-     * @return The workflow
-     * @throws ComponentException
-     * @throws GraphException
-     * @throws ComponentRegistryException
-     */
-    public Workflow createForEachWorkflow() throws ComponentException, GraphException, ComponentRegistryException {
-        Workflow workflow = new Workflow();
-
-        // Name, description
-        workflow.setName("ForEach test");
-        workflow.setDescription("Workflow that tests if");
-
-        Graph graph = workflow.getGraph();
-
-        // x
-        InputNode inputX = (InputNode) workflow.addNode(this.inputComponent);
-        inputX.setPosition(new Point(0, 0));
-
-        // 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(120, 80));
-
-        // Split
-        Node split = workflow.addNode(this.splitComponent);
-        split.setPosition(new Point(310, 80));
-
-        // Adder
-        Component adderComponent = this.componentRegistry.getComponent(Adder.WSDL_PATH);
-        Node adder = workflow.addNode(adderComponent);
-        adder.setPosition(new Point(440, 40));
-
-        // Merge
-        Node merge = workflow.addNode(this.mergeComponent);
-        merge.setPosition(new Point(580, 40));
-
-        // Output
-        OutputNode output = (OutputNode) workflow.addNode(this.outputComponent);
-        output.setConfiguredName("output");
-        output.setPosition(new Point(720, 40));
-
-        // Connect ports
-        graph.addEdge(inputX.getOutputPort(0), adder.getInputPort(0));
-        graph.addEdge(inputN.getOutputPort(0), arrayGenerator.getInputPort(0));
-        graph.addEdge(arrayGenerator.getOutputPort(0), split.getInputPort(0));
-        graph.addEdge(split.getOutputPort(0), adder.getInputPort(1));
-        graph.addEdge(adder.getOutputPort(0), merge.getInputPort(0));
-        graph.addEdge(merge.getOutputPort(0), output.getInputPort(0));
-
-        // Set the default values
-        // This needs to be after connection.
-        String x = "2";
-        inputX.setDefaultValue(x);
-        String n = "3";
-        inputN.setDefaultValue(n);
-
-        return workflow;
-    }
-
-    /**
-     * @return The workflow
-     * @throws ComponentException
-     * @throws GraphException
-     * @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));
-        graph.addEdge(x.getOutputPort(0), multiplier.getInputPort(0));
-        graph.addEdge(y.getOutputPort(0), adder.getInputPort(1));
-        graph.addEdge(y.getOutputPort(0), multiplier.getInputPort(1));
-        graph.addEdge(const0.getOutputPort(0), ifNode.getInputPort(0));
-        graph.addEdge(ifNode.getControlOutPorts().get(0), adder.getControlInPort());
-        graph.addEdge(ifNode.getControlOutPorts().get(1), multiplier.getControlInPort());
-        graph.addEdge(adder.getOutputPort(0), endif.getInputPort(0));
-        graph.addEdge(multiplier.getOutputPort(0), endif.getInputPort(1));
-        graph.addEdge(endif.getOutputPort(0), output.getInputPort(0));
-
-        // Set the default values
-        // This needs to be after connection.
-        x.setDefaultValue("2");
-        y.setDefaultValue("3");
-        const0.setValue("adder");
-        ifNode.setXPath("$0 = 'adder'");
-
-        return workflow;
-    }
-
-    /**
-     * @return The workflow
-     * @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));
-        graph.addEdge(receive.getOutputPort(0), output2.getInputPort(0));
-        graph.addEdge(echo.getControlOutPorts().get(0), receive.getControlInPort());
-
-        // Confugure
-        output1.setConfiguredName("output1");
-        output1.setConfigured(true);
-        output2.setConfiguredName("output2");
-        output2.setConfigured(true);
-
-        return workflow;
-
-    }
-
-    /**
-     * @return The graph
-     * @throws ComponentException
-     * @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));
-
-        return workflow;
-    }
-
-    /**
-     * @return The workflow created.
-     * @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));
-        graph.addEdge(ifNode.getControlOutPorts().get(0), approver.getControlInPort());
-        graph.addEdge(ifNode.getControlOutPorts().get(1), constYes.getControlInPort());
-        graph.addEdge(approver.getOutputPort(0), endif.getInputPort(0));
-        graph.addEdge(constYes.getOutputPort(0), endif.getInputPort(1));
-        graph.addEdge(endif.getOutputPort(0), output.getInputPort(0));
-
-        // Set the default values
-        // This needs to be after connection.
-        amount.setDefaultValue("500");
-        constYes.setValue("Yes");
-        ifNode.setXPath("$0 > 1000");
-        output.setConfiguredName("accept");
-        output.setConfigured(true);
-
-        return workflow;
-    }
-    /**
-     * Create a dowhile workflow
-     * @return Workflow created.
-     * @throws GraphException
-     * @throws ComponentException
-     * @throws ComponentRegistryException
-     */
-    public Workflow createDoWhileWorkflow() throws GraphException, ComponentException, ComponentRegistryException {
-        Workflow workflow = new Workflow();
-
-        // Name, description
-        workflow.setName("Do While");
-        workflow.setDescription("Do While");
-
-        Graph graph = workflow.getGraph();
-
-        // amount
-        InputNode amount = (InputNode) workflow.addNode(this.inputComponent);
-        amount.setPosition(new Point(10, 10));
-
-        // if
-        DoWhileNode doWhileNode = (DoWhileNode) workflow.addNode(this.doWhileComponent);
-        doWhileNode.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 endDoWhile = workflow.addNode(this.endDoWhileComponent);
-        endDoWhile.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), doWhileNode.getInputPort(0));
-        graph.addEdge(doWhileNode.getControlOutPorts().get(0), approver.getControlInPort());
-        graph.addEdge(doWhileNode.getControlOutPorts().get(1), constYes.getControlInPort());
-        graph.addEdge(approver.getOutputPort(0), endDoWhile.getInputPort(0));
-        graph.addEdge(constYes.getOutputPort(0), endDoWhile.getInputPort(1));
-        graph.addEdge(endDoWhile.getOutputPort(0), output.getInputPort(0));
-
-        // Set the default values
-        // This needs to be after connection.
-        amount.setDefaultValue("0");
-        constYes.setValue("Yes");
-        doWhileNode.setXpath("$1 = 1");
-        output.setConfiguredName("accept");
-        output.setConfigured(true);
-
-        return workflow;
-    }
-}
\ No newline at end of file
+///*
+// *
+// * Licensed to the Apache Software Foundation (ASF) under one
+// * or more contributor license agreements.  See the NOTICE file
+// * distributed with this work for additional information
+// * regarding copyright ownership.  The ASF licenses this file
+// * to you under the Apache License, Version 2.0 (the
+// * "License"); you may not use this file except in compliance
+// * with the License.  You may obtain a copy of the License at
+// *
+// *   http://www.apache.org/licenses/LICENSE-2.0
+// *
+// * Unless required by applicable law or agreed to in writing,
+// * software distributed under the License is distributed on an
+// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// * KIND, either express or implied.  See the License for the
+// * specific language governing permissions and limitations
+// * under the License.
+// *
+// */
+//
+//package org.apache.airavata.xbaya.test.util;
+//
+//import java.awt.Point;
+//
+//import org.apache.airavata.workflow.model.component.Component;
+//import org.apache.airavata.workflow.model.component.ComponentException;
+//import org.apache.airavata.workflow.model.component.ComponentRegistryException;
+//import org.apache.airavata.workflow.model.component.local.LocalComponentRegistry;
+//import org.apache.airavata.workflow.model.component.system.ConstantComponent;
+//import org.apache.airavata.workflow.model.component.system.DoWhileComponent;
+//import org.apache.airavata.workflow.model.component.system.EndDoWhileComponent;
+//import org.apache.airavata.workflow.model.component.system.EndForEachComponent;
+//import org.apache.airavata.workflow.model.component.system.EndifComponent;
+//import org.apache.airavata.workflow.model.component.system.ForEachComponent;
+//import org.apache.airavata.workflow.model.component.system.IfComponent;
+//import org.apache.airavata.workflow.model.component.system.InputComponent;
+//import org.apache.airavata.workflow.model.component.system.OutputComponent;
+//import org.apache.airavata.workflow.model.component.system.ReceiveComponent;
+//import org.apache.airavata.workflow.model.graph.Graph;
+//import org.apache.airavata.workflow.model.graph.GraphException;
+//import org.apache.airavata.workflow.model.graph.Node;
+//import org.apache.airavata.workflow.model.graph.system.ConstantNode;
+//import org.apache.airavata.workflow.model.graph.system.DoWhileNode;
+//import org.apache.airavata.workflow.model.graph.system.IfNode;
+//import org.apache.airavata.workflow.model.graph.system.InputNode;
+//import org.apache.airavata.workflow.model.graph.system.OutputNode;
+//import org.apache.airavata.workflow.model.graph.system.ReceiveNode;
+//import org.apache.airavata.workflow.model.wf.Workflow;
+//import org.apache.airavata.xbaya.file.XBayaPathConstants;
+//import org.apache.airavata.xbaya.test.service.adder.Adder;
+//import org.apache.airavata.xbaya.test.service.approver.Approver;
+//import org.apache.airavata.xbaya.test.service.arrayadder.ArrayAdder;
+//import org.apache.airavata.xbaya.test.service.arraygen.ArrayGenerator;
+//import org.apache.airavata.xbaya.test.service.echo.Echo;
+//import org.apache.airavata.xbaya.test.service.multiplier.Multiplier;
+//
+//public class WorkflowCreator {
+//
+//    /**
+//     * GFAC_TEST_AWSDL
+//     */
+//    public static final String GFAC_TEST_AWSDL = "TestCMD_Example1_AWSDL.xml";
+//
+//    private Component inputComponent;
+//
+//    private Component outputComponent;
+//
+//    private LocalComponentRegistry componentRegistry;
+//
+//    private ConstantComponent constantComponent;
+//
+//    private ForEachComponent splitComponent;
+//
+//    private EndForEachComponent mergeComponent;
+//
+//    private IfComponent ifComponent;
+//
+//    private EndifComponent endifComponent;
+//
+//    private ReceiveComponent receiveComponent;
+//
+//    private DoWhileComponent doWhileComponent;
+//
+//    private EndDoWhileComponent endDoWhileComponent;
+//
+//    /**
+//     * Constructs a WorkflowCreator.
+//     */
+//    public WorkflowCreator() {
+//        this.componentRegistry = new LocalComponentRegistry(XBayaPathConstants.WSDL_DIRECTORY);
+//        this.inputComponent = new InputComponent();
+//        this.outputComponent = new OutputComponent();
+//        this.constantComponent = new ConstantComponent();
+//        this.splitComponent = new ForEachComponent();
+//        this.mergeComponent = new EndForEachComponent();
+//        this.ifComponent = new IfComponent();
+//        this.endifComponent = new EndifComponent();
+//        this.receiveComponent = new ReceiveComponent();
+//        this.doWhileComponent = new DoWhileComponent();
+//        this.endDoWhileComponent = new EndDoWhileComponent();
+//    }
+//
+//    /**
+//     * @return The graph
+//     * @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));
+//        graph.addEdge(adderNode.getOutputPort(0), outParamNode.getInputPort(0));
+//
+//        // Set the default values
+//        // This needs to be after connection.
+//        String paramValue1 = "2";
+//        paramNode1.setDefaultValue(paramValue1);
+//        String paramValue2 = "3";
+//        paramNode2.setDefaultValue(paramValue2);
+//        return workflow;
+//    }
+//
+//    /**
+//     * @return The graph
+//     * @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));
+//        graph.addEdge(adderNode1.getOutputPort(0), multiNode.getInputPort(0));
+//        graph.addEdge(inputNode3.getOutputPort(0), multiNode.getInputPort(1));
+//        graph.addEdge(multiNode.getOutputPort(0), outputNode.getInputPort(0));
+//
+//        // Set the default values
+//        // This needs to be after connection.
+//        inputNode1.setConfiguredName("a");
+//        inputNode2.setConfiguredName("b");
+//        inputNode3.setConfiguredName("c");
+//        inputNode1.setConfigured(true);
+//        inputNode2.setConfigured(true);
+//        inputNode3.setConfigured(true);
+//        inputNode1.setDefaultValue("2");
+//        inputNode2.setDefaultValue("3");
+//        inputNode3.setDefaultValue("4");
+//        outputNode.setConfiguredName("z");
+//        outputNode.setConfigured(true);
+//
+//        return workflow;
+//    }
+//
+//    /**
+//     * @return The graph
+//     * @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));
+//        graph.addEdge(inputNode3.getOutputPort(0), adderNode2.getInputPort(0));
+//        graph.addEdge(inputNode4.getOutputPort(0), adderNode2.getInputPort(1));
+//        graph.addEdge(adderNode1.getOutputPort(0), multiNode.getInputPort(0));
+//        graph.addEdge(adderNode2.getOutputPort(0), multiNode.getInputPort(1));
+//        graph.addEdge(multiNode.getOutputPort(0), outputNode.getInputPort(0));
+//
+//        // Set the default values
+//        // This needs to be after connection.
+//        inputNode1.setConfiguredName("a");
+//        inputNode2.setConfiguredName("b");
+//        inputNode3.setConfiguredName("c");
+//        inputNode4.setConfiguredName("d");
+//        inputNode1.setDescription("This is the first input.");
+//        inputNode2.setDescription("This is the second input.");
+//        inputNode3.setDescription("This is the third input.");
+//        inputNode4.setDescription("This is the fourth input.");
+//        inputNode1.setConfigured(true);
+//        inputNode2.setConfigured(true);
+//        inputNode3.setConfigured(true);
+//        inputNode4.setConfigured(true);
+//        inputNode1.setDefaultValue("2");
+//        inputNode2.setDefaultValue("3");
+//        inputNode3.setDefaultValue("4");
+//        inputNode4.setDefaultValue("5");
+//        outputNode.setConfiguredName("z");
+//        outputNode.setConfigured(true);
+//
+//        return workflow;
+//    }
+//
+//    /**
+//     * @return The graph
+//     * @throws ComponentException
+//     * @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));
+//        graph.addEdge(adderNode.getOutputPort(0), outParamNode.getInputPort(0));
+//
+//        // Set the default value of an input and the constant.
+//        // This needs to be after connection.
+//        String paramValue1 = "2";
+//        inputNode.setDefaultValue(paramValue1);
+//        String paramValue2 = "3";
+//        constantNode.setValue(paramValue2);
+//        return workflow;
+//    }
+//
+//    /**
+//     * @return The workflow
+//     * @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));
+//        graph.addEdge(arrayGenerator.getOutputPort(0), arrayAdder.getInputPort(0));
+//        graph.addEdge(arrayAdder.getOutputPort(0), output.getInputPort(0));
+//
+//        // Set the default values
+//        // This needs to be after connection.
+//        String n = "5";
+//        inputN.setDefaultValue(n);
+//
+//        return workflow;
+//    }
+//
+//    /**
+//     * @return The workflow
+//     * @throws ComponentException
+//     * @throws GraphException
+//     * @throws ComponentRegistryException
+//     */
+//    public Workflow createForEachWorkflow() throws ComponentException, GraphException, ComponentRegistryException {
+//        Workflow workflow = new Workflow();
+//
+//        // Name, description
+//        workflow.setName("ForEach test");
+//        workflow.setDescription("Workflow that tests if");
+//
+//        Graph graph = workflow.getGraph();
+//
+//        // x
+//        InputNode inputX = (InputNode) workflow.addNode(this.inputComponent);
+//        inputX.setPosition(new Point(0, 0));
+//
+//        // 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(120, 80));
+//
+//        // Split
+//        Node split = workflow.addNode(this.splitComponent);
+//        split.setPosition(new Point(310, 80));
+//
+//        // Adder
+//        Component adderComponent = this.componentRegistry.getComponent(Adder.WSDL_PATH);
+//        Node adder = workflow.addNode(adderComponent);
+//        adder.setPosition(new Point(440, 40));
+//
+//        // Merge
+//        Node merge = workflow.addNode(this.mergeComponent);
+//        merge.setPosition(new Point(580, 40));
+//
+//        // Output
+//        OutputNode output = (OutputNode) workflow.addNode(this.outputComponent);
+//        output.setConfiguredName("output");
+//        output.setPosition(new Point(720, 40));
+//
+//        // Connect ports
+//        graph.addEdge(inputX.getOutputPort(0), adder.getInputPort(0));
+//        graph.addEdge(inputN.getOutputPort(0), arrayGenerator.getInputPort(0));
+//        graph.addEdge(arrayGenerator.getOutputPort(0), split.getInputPort(0));
+//        graph.addEdge(split.getOutputPort(0), adder.getInputPort(1));
+//        graph.addEdge(adder.getOutputPort(0), merge.getInputPort(0));
+//        graph.addEdge(merge.getOutputPort(0), output.getInputPort(0));
+//
+//        // Set the default values
+//        // This needs to be after connection.
+//        String x = "2";
+//        inputX.setDefaultValue(x);
+//        String n = "3";
+//        inputN.setDefaultValue(n);
+//
+//        return workflow;
+//    }
+//
+//    /**
+//     * @return The workflow
+//     * @throws ComponentException
+//     * @throws GraphException
+//     * @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));
+//        graph.addEdge(x.getOutputPort(0), multiplier.getInputPort(0));
+//        graph.addEdge(y.getOutputPort(0), adder.getInputPort(1));
+//        graph.addEdge(y.getOutputPort(0), multiplier.getInputPort(1));
+//        graph.addEdge(const0.getOutputPort(0), ifNode.getInputPort(0));
+//        graph.addEdge(ifNode.getControlOutPorts().get(0), adder.getControlInPort());
+//        graph.addEdge(ifNode.getControlOutPorts().get(1), multiplier.getControlInPort());
+//        graph.addEdge(adder.getOutputPort(0), endif.getInputPort(0));
+//        graph.addEdge(multiplier.getOutputPort(0), endif.getInputPort(1));
+//        graph.addEdge(endif.getOutputPort(0), output.getInputPort(0));
+//
+//        // Set the default values
+//        // This needs to be after connection.
+//        x.setDefaultValue("2");
+//        y.setDefaultValue("3");
+//        const0.setValue("adder");
+//        ifNode.setXPath("$0 = 'adder'");
+//
+//        return workflow;
+//    }
+//
+//    /**
+//     * @return The workflow
+//     * @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));
+//        graph.addEdge(receive.getOutputPort(0), output2.getInputPort(0));
+//        graph.addEdge(echo.getControlOutPorts().get(0), receive.getControlInPort());
+//
+//        // Confugure
+//        output1.setConfiguredName("output1");
+//        output1.setConfigured(true);
+//        output2.setConfiguredName("output2");
+//        output2.setConfigured(true);
+//
+//        return workflow;
+//
+//    }
+//
+//    /**
+//     * @return The graph
+//     * @throws ComponentException
+//     * @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));
+//
+//        return workflow;
+//    }
+//
+//    /**
+//     * @return The workflow created.
+//     * @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));
+//        graph.addEdge(ifNode.getControlOutPorts().get(0), approver.getControlInPort());
+//        graph.addEdge(ifNode.getControlOutPorts().get(1), constYes.getControlInPort());
+//        graph.addEdge(approver.getOutputPort(0), endif.getInputPort(0));
+//        graph.addEdge(constYes.getOutputPort(0), endif.getInputPort(1));
+//        graph.addEdge(endif.getOutputPort(0), output.getInputPort(0));
+//
+//        // Set the default values
+//        // This needs to be after connection.
+//        amount.setDefaultValue("500");
+//        constYes.setValue("Yes");
+//        ifNode.setXPath("$0 > 1000");
+//        output.setConfiguredName("accept");
+//        output.setConfigured(true);
+//
+//        return workflow;
+//    }
+//    /**
+//     * Create a dowhile workflow
+//     * @return Workflow created.
+//     * @throws GraphException
+//     * @throws ComponentException
+//     * @throws ComponentRegistryException
+//     */
+//    public Workflow createDoWhileWorkflow() throws GraphException, ComponentException, ComponentRegistryException {
+//        Workflow workflow = new Workflow();
+//
+//        // Name, description
+//        workflow.setName("Do While");
+//        workflow.setDescription("Do While");
+//
+//        Graph graph = workflow.getGraph();
+//
+//        // amount
+//        InputNode amount = (InputNode) workflow.addNode(this.inputComponent);
+//        amount.setPosition(new Point(10, 10));
+//
+//        // if
+//        DoWhileNode doWhileNode = (DoWhileNode) workflow.addNode(this.doWhileComponent);
+//        doWhileNode.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 endDoWhile = workflow.addNode(this.endDoWhileComponent);
+//        endDoWhile.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), doWhileNode.getInputPort(0));
+//        graph.addEdge(doWhileNode.getControlOutPorts().get(0), approver.getControlInPort());
+//        graph.addEdge(doWhileNode.getControlOutPorts().get(1), constYes.getControlInPort());
+//        graph.addEdge(approver.getOutputPort(0), endDoWhile.getInputPort(0));
+//        graph.addEdge(constYes.getOutputPort(0), endDoWhile.getInputPort(1));
+//        graph.addEdge(endDoWhile.getOutputPort(0), output.getInputPort(0));
+//
+//        // Set the default values
+//        // This needs to be after connection.
+//        amount.setDefaultValue("0");
+//        constYes.setValue("Yes");
+//        doWhileNode.setXpath("$1 = 1");
+//        output.setConfiguredName("accept");
+//        output.setConfigured(true);
+//
+//        return workflow;
+//    }
+//}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/airavata/blob/3e6c815a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/XBayaGUI.java
----------------------------------------------------------------------
diff --git a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/XBayaGUI.java b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/XBayaGUI.java
index 0e36d3e..32743a5 100644
--- a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/XBayaGUI.java
+++ b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/XBayaGUI.java
@@ -48,9 +48,7 @@ import javax.swing.WindowConstants;
 import javax.swing.event.ChangeEvent;
 import javax.swing.event.ChangeListener;
 
-import org.apache.airavata.client.api.exception.AiravataAPIInvocationException;
 import org.apache.airavata.common.utils.SwingUtil;
-import org.apache.airavata.common.utils.XMLUtil;
 import org.apache.airavata.workflow.model.component.Component;
 import org.apache.airavata.workflow.model.component.ComponentException;
 import org.apache.airavata.workflow.model.exceptions.WorkflowException;
@@ -78,7 +76,6 @@ import org.apache.airavata.xbaya.ui.graph.GraphCanvasListener;
 import org.apache.airavata.xbaya.ui.menues.XBayaMenu;
 import org.apache.airavata.xbaya.ui.utils.ErrorMessages;
 import org.apache.airavata.xbaya.ui.views.ComponentViewer;
-import org.apache.airavata.xbaya.ui.views.JCRBrowserPanel;
 import org.apache.airavata.xbaya.ui.views.MonitorPanel;
 import org.apache.airavata.xbaya.ui.views.PortViewer;
 import org.apache.airavata.xbaya.ui.widgets.ScrollPanel;
@@ -87,7 +84,6 @@ import org.apache.airavata.xbaya.ui.widgets.XBayaToolBar;
 import org.apache.airavata.xbaya.ui.widgets.component.ComponentSelector;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
-import org.xmlpull.infoset.XmlElement;
 
 public class XBayaGUI implements EventListener, XBayaExecutionModeListener {
 
@@ -400,7 +396,7 @@ public class XBayaGUI implements EventListener, XBayaExecutionModeListener {
     
     private List<ChangeListener> tabChangeListeners=new ArrayList<ChangeListener>();
 
-	private JCRBrowserPanel jcrBrowserPanel;
+//	private JCRBrowserPanel jcrBrowserPanel;
     
     public void addWorkflowTabChangeListener(ChangeListener listener){
 		graphTabbedPane.addChangeListener(listener);
@@ -648,27 +644,27 @@ public class XBayaGUI implements EventListener, XBayaExecutionModeListener {
 
     }
 
-    public void viewJCRBrowserPanel(){
-    	if (jcrBrowserPanel!=null){
-    		jcrBrowserPanel=componentTabbedPane.indexOfComponent(jcrBrowserPanel)==-1? null:jcrBrowserPanel;
-    	}
-    	if (jcrBrowserPanel==null) {
-			jcrBrowserPanel = new JCRBrowserPanel(engine);
-			this.componentTabbedPane.add(jcrBrowserPanel);
-			int index=this.componentTabbedPane.getTabCount()-1;
-			this.componentTabbedPane.setTitleAt(1, "Airavata Registry");
-			TabLabelButton tabLabelButton = new TabLabelButton(componentTabbedPane, "Close JCR Browser");
-			tabLabelButton.setCloseButtonListener(new ActionListener(){
-				@Override
-				public void actionPerformed(ActionEvent arg0) {
-					componentTabbedPane.remove(jcrBrowserPanel);
-				}
-				
-			});
-			this.componentTabbedPane.setTabComponentAt(index, tabLabelButton);
-		}
-		componentTabbedPane.setSelectedComponent(jcrBrowserPanel);
-    }
+//    public void viewJCRBrowserPanel(){
+//    	if (jcrBrowserPanel!=null){
+//    		jcrBrowserPanel=componentTabbedPane.indexOfComponent(jcrBrowserPanel)==-1? null:jcrBrowserPanel;
+//    	}
+//    	if (jcrBrowserPanel==null) {
+//			jcrBrowserPanel = new JCRBrowserPanel(engine);
+//			this.componentTabbedPane.add(jcrBrowserPanel);
+//			int index=this.componentTabbedPane.getTabCount()-1;
+//			this.componentTabbedPane.setTitleAt(1, "Airavata Registry");
+//			TabLabelButton tabLabelButton = new TabLabelButton(componentTabbedPane, "Close JCR Browser");
+//			tabLabelButton.setCloseButtonListener(new ActionListener(){
+//				@Override
+//				public void actionPerformed(ActionEvent arg0) {
+//					componentTabbedPane.remove(jcrBrowserPanel);
+//				}
+//				
+//			});
+//			this.componentTabbedPane.setTabComponentAt(index, tabLabelButton);
+//		}
+//		componentTabbedPane.setSelectedComponent(jcrBrowserPanel);
+//    }
     
     public void viewComponentTree(){
     	componentTabbedPane.setSelectedComponent(compTreeXBayapanel.getSwingComponent());
@@ -827,19 +823,17 @@ public class XBayaGUI implements EventListener, XBayaExecutionModeListener {
     
     private void loadDefaultGraph() {
         if (this.engine.getConfiguration().getWorkflow() != null) {
-            this.newGraphCanvas(true, false);
-            try {
-            	String xml = this.engine.getConfiguration().getAiravataAPI().getWorkflowManager().getWorkflowAsString(this.engine.getConfiguration().getWorkflow());
-                XmlElement xwf = XMLUtil.stringToXmlElement(xml);
-                Workflow workflow = new Workflow(xwf);
-                setWorkflow(workflow);
-            } catch (AiravataAPIInvocationException e) {
-               getErrorWindow().error(ErrorMessages.REPOSITORY_CONFIGURATION_IS_WRONG_FAILED_TO_LOAD_THE_WORKFLOW, e);
-            } catch (GraphException e) {
-                getErrorWindow().error(ErrorMessages.WORKFLOW_IS_WRONG, e);
-            } catch (ComponentException e) {
-                getErrorWindow().error(ErrorMessages.COMPONENT_FORMAT_ERROR, e);
-            }
+//            this.newGraphCanvas(true, false);
+//            try {
+//            	String xml = this.engine.getConfiguration().getAiravataAPI().getWorkflowManager().getWorkflowAsString(this.engine.getConfiguration().getWorkflow());
+//                XmlElement xwf = XMLUtil.stringToXmlElement(xml);
+//                Workflow workflow = new Workflow(xwf);
+//                setWorkflow(workflow);
+//            } catch (GraphException e) {
+//                getErrorWindow().error(ErrorMessages.WORKFLOW_IS_WRONG, e);
+//            } catch (ComponentException e) {
+//                getErrorWindow().error(ErrorMessages.COMPONENT_FORMAT_ERROR, e);
+//            }
         }
 
     }

http://git-wip-us.apache.org/repos/asf/airavata/blob/3e6c815a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/dialogs/descriptors/ApplicationDescriptionAdvancedOptionDialog.java
----------------------------------------------------------------------
diff --git a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/dialogs/descriptors/ApplicationDescriptionAdvancedOptionDialog.java b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/dialogs/descriptors/ApplicationDescriptionAdvancedOptionDialog.java
deleted file mode 100644
index fe72516..0000000
--- a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/dialogs/descriptors/ApplicationDescriptionAdvancedOptionDialog.java
+++ /dev/null
@@ -1,358 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.airavata.xbaya.ui.dialogs.descriptors;
-
-import java.awt.Font;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-import java.awt.event.WindowAdapter;
-import java.awt.event.WindowEvent;
-
-import javax.swing.BorderFactory;
-import javax.swing.JButton;
-import javax.swing.JDialog;
-import javax.swing.JLabel;
-import javax.swing.JScrollPane;
-import javax.swing.JSeparator;
-import javax.swing.JTable;
-import javax.swing.ListSelectionModel;
-import javax.swing.SwingConstants;
-import javax.swing.event.ListSelectionEvent;
-import javax.swing.event.ListSelectionListener;
-import javax.swing.event.TableModelEvent;
-import javax.swing.event.TableModelListener;
-import javax.swing.table.DefaultTableModel;
-
-import org.apache.airavata.client.api.AiravataAPI;
-import org.apache.airavata.common.utils.SwingUtil;
-import org.apache.airavata.commons.gfac.type.ApplicationDescription;
-//import org.apache.airavata.registry.api.AiravataRegistry2;
-import org.apache.airavata.schemas.gfac.ApplicationDeploymentDescriptionType;
-import org.apache.airavata.schemas.gfac.NameValuePairType;
-import org.apache.airavata.xbaya.ui.widgets.GridPanel;
-import org.apache.airavata.xbaya.ui.widgets.XBayaLabel;
-import org.apache.airavata.xbaya.ui.widgets.XBayaTextField;
-
-public class ApplicationDescriptionAdvancedOptionDialog extends JDialog {
-    private static final long serialVersionUID = 3920479739097405014L;
-    private XBayaTextField txtInputDir;
-    private XBayaTextField txtOutputDir;
-    private XBayaTextField txtSTDIN;
-    private XBayaTextField txtSTDOUT;
-    private XBayaTextField txtSTDERR;
-    private JTable tblEnv;
-    private ApplicationDescription shellApplicationDescription;
-    private DefaultTableModel defaultTableModel;
-    private boolean tableModelChanging = false;
-    private JButton btnDeleteVariable;
-    private JButton okButton;
-    private AiravataAPI registry;
-	private XBayaTextField txtWorkingDir;
-
-    /**
-     * Launch the application.
-     */
-    public static void main(String[] args) {
-        try {
-            ApplicationDescriptionAdvancedOptionDialog dialog = new ApplicationDescriptionAdvancedOptionDialog(null,
-                    null);
-            dialog.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
-            dialog.setVisible(true);
-        } catch (Exception e) {
-            e.printStackTrace();
-        }
-    }
-
-    /**
-     * Create the dialog.
-     */
-    public ApplicationDescriptionAdvancedOptionDialog(AiravataAPI registry, ApplicationDescription descriptor) {
-        addWindowListener(new WindowAdapter() {
-            @Override
-            public void windowOpened(WindowEvent arg0) {
-                loadApplicationDescriptionAdvancedOptions();
-            }
-        });
-        setRegistry(registry);
-        setShellApplicationDescription(descriptor);
-        initGUI();
-    }
-
-    public void open() {
-        setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
-        setVisible(true);
-    }
-
-    protected ApplicationDescriptionAdvancedOptionDialog getDialog() {
-        return this;
-    }
-
-    public void close() {
-        getDialog().setVisible(false);
-    }
-
-    @SuppressWarnings("serial")
-	private void initGUI() {
-        setTitle("Application Description Advance Options");
-        setModal(true);
-        setBounds(100, 100, 600, 400);
-        setLocationRelativeTo(null);
-        GridPanel buttonPane = new GridPanel();
-        okButton = new JButton("Update");
-        okButton.setActionCommand("OK");
-        okButton.addActionListener(new ActionListener() {
-            public void actionPerformed(ActionEvent e) {
-                saveApplicationDescriptionAdvancedOptions();
-                close();
-            }
-        });
-        getRootPane().setDefaultButton(okButton);
-    
-    
-        JButton cancelButton = new JButton("Cancel");
-        cancelButton.setActionCommand("Cancel");
-        cancelButton.addActionListener(new ActionListener() {
-            public void actionPerformed(ActionEvent e) {
-                close();
-            }
-        });
-            
-        
-        
-    	GridPanel panel = new GridPanel();
-        
-        txtInputDir = new XBayaTextField();
-        
-        XBayaLabel lblInputDirectory = new XBayaLabel("Input directory",txtInputDir);
-
-        JLabel lblLocations = new JLabel("Locations");
-        lblLocations.setFont(new Font("Tahoma", Font.BOLD, 11));
-
-        txtOutputDir = new XBayaTextField();
-        XBayaLabel lblOutputDirectory = new XBayaLabel("Output directory",txtOutputDir);
-
-        txtWorkingDir = new XBayaTextField();
-        XBayaLabel lblWorkingDir = new XBayaLabel("Static Working directory",txtWorkingDir);
-        
-        JLabel lblProgramData = new JLabel("Program data");
-        lblProgramData.setFont(new Font("Tahoma", Font.BOLD, 11));
-
-
-        txtSTDIN = new XBayaTextField();
-        XBayaLabel lblStdin = new XBayaLabel("STDIN",txtSTDIN);
-
-
-        txtSTDOUT = new XBayaTextField();
-        XBayaLabel lblStdout = new XBayaLabel("STDOUT",txtSTDOUT);
-
-
-        txtSTDERR = new XBayaTextField();
-        XBayaLabel lblStderr = new XBayaLabel("STDERR",txtSTDERR);
-
-        JLabel other = new JLabel("Other");
-        other.setFont(new Font("Tahoma", Font.BOLD, 11));
-
-        JSeparator separator_1 = new JSeparator();
-        separator_1.setOrientation(SwingConstants.VERTICAL);
-
-        JLabel lblEnvironmentalVariables = new JLabel("Environmental Variables");
-        lblEnvironmentalVariables.setFont(new Font("Tahoma", Font.BOLD, 11));
-
-        JScrollPane scrollPane = new JScrollPane();
-
-        btnDeleteVariable = new JButton("Delete variable");
-        btnDeleteVariable.addActionListener(new ActionListener() {
-            public void actionPerformed(ActionEvent e) {
-                deleteSelectedRows();
-            }
-        });
-        btnDeleteVariable.setEnabled(false);
-        tblEnv = new JTable();
-        tblEnv.setFillsViewportHeight(true);
-        scrollPane.setViewportView(tblEnv);
-        tblEnv.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
-        defaultTableModel = new DefaultTableModel(new Object[][] { { null, null }, }, new String[] { "Name",
-                "Value" }) {
-            @SuppressWarnings("rawtypes")
-			Class[] columnTypes = new Class[] { String.class, String.class };
-
-            @SuppressWarnings({ "rawtypes", "unchecked" })
-			public Class getColumnClass(int columnIndex) {
-                return columnTypes[columnIndex];
-            }
-        };
-        tblEnv.setModel(defaultTableModel);
-        defaultTableModel.addTableModelListener(new TableModelListener() {
-            public void tableChanged(TableModelEvent arg0) {
-                if (!tableModelChanging) {
-                    addNewRowIfLastIsNotEmpty();
-                }
-            }
-
-        });
-        tblEnv.getColumnModel().getColumn(0).setPreferredWidth(67);
-        tblEnv.getColumnModel().getColumn(1).setPreferredWidth(158);
-        ListSelectionModel selectionModel = tblEnv.getSelectionModel();
-        selectionModel.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
-
-        selectionModel.addListSelectionListener(new ListSelectionListener() {
-            public void valueChanged(ListSelectionEvent e) {
-                btnDeleteVariable.setEnabled(tblEnv.getSelectedRows().length > 0);
-            }
-
-        });
-        
-        GridPanel leftPanel = new GridPanel();
-        leftPanel.add(lblLocations);
-        leftPanel.add(new JLabel());
-        leftPanel.add(lblInputDirectory);
-        leftPanel.add(txtInputDir);
-        leftPanel.add(lblOutputDirectory);
-        leftPanel.add(txtOutputDir);
-        leftPanel.add(lblWorkingDir);
-        leftPanel.add(txtWorkingDir);
-        leftPanel.add(lblProgramData);
-        
-        leftPanel.add(new JLabel());
-        leftPanel.add(lblStdin);
-        leftPanel.add(txtSTDIN);
-        leftPanel.add(lblStdout);
-        leftPanel.add(txtSTDOUT);
-        leftPanel.add(lblStderr);
-        leftPanel.add(txtSTDERR);
-        
-        SwingUtil.layoutToGrid(leftPanel.getSwingComponent(), 8, 2, SwingUtil.WEIGHT_NONE, 1);
-        
-        GridPanel rightPanel = new GridPanel();
-        rightPanel.add(lblEnvironmentalVariables);
-        rightPanel.add(scrollPane);
-        rightPanel.add(btnDeleteVariable);
-        rightPanel.getSwingComponent().setSize(150, -1);
-        leftPanel.getSwingComponent().setSize(150, -1);
-        SwingUtil.layoutToGrid(rightPanel.getSwingComponent(), 3, 1, 1, 0);
-        
-        GridPanel p=new GridPanel();
-        p.add(leftPanel);
-        p.add(new JSeparator(JSeparator.VERTICAL));
-        p.layout(1,2, 0,0);
-        panel.add(p);
-        panel.add(rightPanel);
-        panel.getSwingComponent().setBorder(BorderFactory.createEtchedBorder());
-
-        SwingUtil.layoutToGrid(panel.getSwingComponent(), 1, 2, SwingUtil.WEIGHT_NONE, SwingUtil.WEIGHT_EQUALLY);
-        
-        buttonPane.add(okButton);
-        buttonPane.add(cancelButton);
-        buttonPane.getSwingComponent().setBorder(BorderFactory.createEtchedBorder());
-
-        getContentPane().add(panel.getSwingComponent());
-        getContentPane().add(buttonPane.getSwingComponent());
-        SwingUtil.layoutToGrid(getContentPane(), 2, 1, 0, 0);
-        setResizable(true);
-        getRootPane().setDefaultButton(okButton);
-    }
-
-    private void deleteSelectedRows() {
-        // TODO confirm deletion of selected rows
-        int selectedRow = tblEnv.getSelectedRow();
-        while (selectedRow >= 0) {
-            defaultTableModel.removeRow(selectedRow);
-            selectedRow = tblEnv.getSelectedRow();
-        }
-        addNewRowIfLastIsNotEmpty();
-    }
-
-    public ApplicationDescription getApplicationDescription() {
-        return shellApplicationDescription;
-    }
-
-    public ApplicationDeploymentDescriptionType getShellApplicationDescriptionType() {
-        return (ApplicationDeploymentDescriptionType)shellApplicationDescription.getType();
-    }
-    
-    public void setShellApplicationDescription(ApplicationDescription shellApplicationDescription) {
-        this.shellApplicationDescription = shellApplicationDescription;
-    }
-
-    private void addNewRowIfLastIsNotEmpty() {
-        Object varName = null;
-        if (defaultTableModel.getRowCount() > 0) {
-            varName = defaultTableModel.getValueAt(defaultTableModel.getRowCount() - 1, 0);
-        }
-        if (defaultTableModel.getRowCount() == 0 || (varName != null && !varName.equals(""))) {
-            defaultTableModel.addRow(new Object[] { null, null });
-        }
-    }
-
-    private void saveApplicationDescriptionAdvancedOptions() {
-    	getShellApplicationDescriptionType().setInputDataDirectory(txtInputDir.getText());
-    	getShellApplicationDescriptionType().setOutputDataDirectory(txtOutputDir.getText());
-    	getShellApplicationDescriptionType().setStaticWorkingDirectory(txtWorkingDir.getText());
-    	getShellApplicationDescriptionType().setStandardInput(txtSTDIN.getText());
-    	getShellApplicationDescriptionType().setStandardOutput(txtSTDOUT.getText());
-    	getShellApplicationDescriptionType().setStandardError(txtSTDERR.getText());
-    	
-    	while(getShellApplicationDescriptionType().getApplicationEnvironmentArray().length>0){
-    		getShellApplicationDescriptionType().removeApplicationEnvironment(0);
-    	}
-    	for (int i = 0; i < defaultTableModel.getRowCount(); i++) {
-            String parameterName = (String) defaultTableModel.getValueAt(i, 0);
-            String paramValue = (String) defaultTableModel.getValueAt(i, 1);
-            if (parameterName != null && !parameterName.trim().equals("")) {
-            	NameValuePairType envType = getShellApplicationDescriptionType().addNewApplicationEnvironment();
-        		envType.setName(parameterName);
-                envType.setValue(paramValue);
-            }
-        }
-    }
-
-    private void loadApplicationDescriptionAdvancedOptions() {
-        txtInputDir.setText(getShellApplicationDescriptionType().getInputDataDirectory());
-        txtOutputDir.setText(getShellApplicationDescriptionType().getOutputDataDirectory());
-        txtWorkingDir.setText(getShellApplicationDescriptionType().getStaticWorkingDirectory());
-        txtSTDIN.setText(getShellApplicationDescriptionType().getStandardInput());
-        txtSTDOUT.setText(getShellApplicationDescriptionType().getStandardOutput());
-        txtSTDERR.setText(getShellApplicationDescriptionType().getStandardError());
-        tableModelChanging = true;
-        while(defaultTableModel.getRowCount()>0){
-    		defaultTableModel.removeRow(0);
-    	}
-        NameValuePairType[] envParams = getShellApplicationDescriptionType().getApplicationEnvironmentArray();
-    	for (NameValuePairType envParam : envParams) {
-    		defaultTableModel.addRow(new Object[] { envParam.getName(),envParam.getValue()});
-		}
-    	addNewRowIfLastIsNotEmpty();
-        tableModelChanging = false;
-    }
-
-
-
-    public AiravataAPI getRegistry() {
-        return registry;
-    }
-
-    public void setRegistry(AiravataAPI registry) {
-        this.registry = registry;
-    }
-
-
-}