airavata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From shame...@apache.org
Subject [2/3] airavata git commit: Removed old xbaya workflow class dependency
Date Mon, 01 Feb 2016 21:48:40 GMT
Removed old xbaya workflow class dependency


Project: http://git-wip-us.apache.org/repos/asf/airavata/repo
Commit: http://git-wip-us.apache.org/repos/asf/airavata/commit/225f462b
Tree: http://git-wip-us.apache.org/repos/asf/airavata/tree/225f462b
Diff: http://git-wip-us.apache.org/repos/asf/airavata/diff/225f462b

Branch: refs/heads/develop
Commit: 225f462badbc1bf18c8585f9f1eddd36bb0f8e09
Parents: 9859af3
Author: Shameera Rathnayaka <shameerainfo@gmail.com>
Authored: Mon Feb 1 16:48:00 2016 -0500
Committer: Shameera Rathnayaka <shameerainfo@gmail.com>
Committed: Mon Feb 1 16:48:00 2016 -0500

----------------------------------------------------------------------
 .../main/resources/airavata-server.properties   |   2 +-
 modules/workflow/workflow-core/pom.xml          |   5 -
 .../core/SimpleWorkflowInterpreter.java         |  46 +--
 .../airavata/workflow/core/WorkflowBuilder.java |  15 +
 .../workflow/core/WorkflowEnactmentService.java |   4 +-
 .../airavata/workflow/core/WorkflowFactory.java |  34 ++-
 .../workflow/core/WorkflowFactoryImpl.java      |  74 -----
 .../airavata/workflow/core/WorkflowParser.java  |  18 +-
 .../workflow/core/dag/nodes/InputNode.java      |  37 +++
 .../workflow/core/dag/nodes/InputNodeImpl.java  | 105 +++++++
 .../workflow/core/dag/nodes/OutputNode.java     |  37 +++
 .../workflow/core/dag/nodes/OutputNodeImpl.java | 108 +++++++
 .../core/dag/nodes/WorkflowInputNode.java       |  37 ---
 .../core/dag/nodes/WorkflowInputNodeImpl.java   | 105 -------
 .../core/dag/nodes/WorkflowOutputNode.java      |  37 ---
 .../core/dag/nodes/WorkflowOutputNodeImpl.java  | 108 -------
 .../core/parser/AiravataWorkflowBuilder.java    | 117 ++++++++
 .../core/parser/AiravataWorkflowParser.java     | 287 -------------------
 .../core/parser/JsonWorkflowParser.java         |  63 +++-
 .../workflow/core/parser/PortContainer.java     |  53 ----
 .../core/parser/AiravataWorkflowParserTest.java | 119 --------
 .../core/parser/JsonWorkflowParserTest.java     | 130 +++++++++
 22 files changed, 682 insertions(+), 859 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/airavata/blob/225f462b/modules/configuration/server/src/main/resources/airavata-server.properties
----------------------------------------------------------------------
diff --git a/modules/configuration/server/src/main/resources/airavata-server.properties b/modules/configuration/server/src/main/resources/airavata-server.properties
index 78997db..445449c 100644
--- a/modules/configuration/server/src/main/resources/airavata-server.properties
+++ b/modules/configuration/server/src/main/resources/airavata-server.properties
@@ -154,7 +154,7 @@ workflowserver=org.apache.airavata.api.server.WorkflowServer
 enactment.thread.pool.size=10
 
 #to define custom workflow parser user following property
-#workflow.parser=org.apache.airavata.workflow.core.parser.AiravataWorkflowParser
+#workflow.parser=org.apache.airavata.workflow.core.parser.AiravataWorkflowBuilder
 
 
 

http://git-wip-us.apache.org/repos/asf/airavata/blob/225f462b/modules/workflow/workflow-core/pom.xml
----------------------------------------------------------------------
diff --git a/modules/workflow/workflow-core/pom.xml b/modules/workflow/workflow-core/pom.xml
index 31e0301..bb1ea79 100644
--- a/modules/workflow/workflow-core/pom.xml
+++ b/modules/workflow/workflow-core/pom.xml
@@ -34,11 +34,6 @@
         <!-- Airavata default parser dependency -->
         <dependency>
             <groupId>org.apache.airavata</groupId>
-            <artifactId>airavata-workflow-model-core</artifactId>
-            <version>${project.version}</version>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.airavata</groupId>
             <artifactId>airavata-registry-cpi</artifactId>
             <version>${project.version}</version>
         </dependency>

http://git-wip-us.apache.org/repos/asf/airavata/blob/225f462b/modules/workflow/workflow-core/src/main/java/org/apache/airavata/workflow/core/SimpleWorkflowInterpreter.java
----------------------------------------------------------------------
diff --git a/modules/workflow/workflow-core/src/main/java/org/apache/airavata/workflow/core/SimpleWorkflowInterpreter.java b/modules/workflow/workflow-core/src/main/java/org/apache/airavata/workflow/core/SimpleWorkflowInterpreter.java
index defbad4..01ad6bb 100644
--- a/modules/workflow/workflow-core/src/main/java/org/apache/airavata/workflow/core/SimpleWorkflowInterpreter.java
+++ b/modules/workflow/workflow-core/src/main/java/org/apache/airavata/workflow/core/SimpleWorkflowInterpreter.java
@@ -37,9 +37,9 @@ import org.apache.airavata.registry.cpi.*;
 import org.apache.airavata.workflow.core.dag.edge.Edge;
 import org.apache.airavata.workflow.core.dag.nodes.ApplicationNode;
 import org.apache.airavata.workflow.core.dag.nodes.NodeState;
-import org.apache.airavata.workflow.core.dag.nodes.WorkflowInputNode;
+import org.apache.airavata.workflow.core.dag.nodes.InputNode;
 import org.apache.airavata.workflow.core.dag.nodes.WorkflowNode;
-import org.apache.airavata.workflow.core.dag.nodes.WorkflowOutputNode;
+import org.apache.airavata.workflow.core.dag.nodes.OutputNode;
 import org.apache.airavata.workflow.core.dag.port.InPort;
 import org.apache.airavata.workflow.core.dag.port.OutPort;
 import org.slf4j.Logger;
@@ -59,7 +59,7 @@ import java.util.concurrent.ConcurrentHashMap;
 class SimpleWorkflowInterpreter{
 
     private static final Logger log = LoggerFactory.getLogger(SimpleWorkflowInterpreter.class);
-    private List<WorkflowInputNode> workflowInputNodes;
+    private List<InputNode> inputNodes;
 
     private ExperimentModel experiment;
 
@@ -72,7 +72,7 @@ class SimpleWorkflowInterpreter{
     private Map<String, WorkflowContext> processingQueue = new ConcurrentHashMap<String, WorkflowContext>();
     private Map<String, WorkflowContext> completeList = new HashMap<String, WorkflowContext>();
     private Registry registry;
-    private List<WorkflowOutputNode> completeWorkflowOutputs = new ArrayList<WorkflowOutputNode>();
+    private List<OutputNode> completeWorkflowOutputs = new ArrayList<OutputNode>();
     private RabbitMQProcessLaunchPublisher publisher;
     private RabbitMQStatusConsumer statusConsumer;
     private String consumerId;
@@ -97,20 +97,20 @@ class SimpleWorkflowInterpreter{
      * @throws Exception
      */
     void launchWorkflow() throws Exception {
-        WorkflowFactoryImpl wfFactory = WorkflowFactoryImpl.getInstance();
-        WorkflowParser workflowParser = wfFactory.getWorkflowParser(experiment.getExperimentId(), credentialToken);
+        WorkflowBuilder workflowBuilder = WorkflowFactory.getWorkflowBuilder(experiment.getExperimentId(), credentialToken, null);
+
         log.debug("Initialized workflow parser");
-        setWorkflowInputNodes(workflowParser.parse());
+        setInputNodes(workflowBuilder.build());
         log.debug("Parsed the workflow and got the workflow input nodes");
         // process workflow input nodes
-        processWorkflowInputNodes(getWorkflowInputNodes());
+        processWorkflowInputNodes(getInputNodes());
         if (readyList.isEmpty()) {
             StringBuilder sb = new StringBuilder();
-            for (WorkflowInputNode workflowInputNode : workflowInputNodes) {
+            for (InputNode inputNode : inputNodes) {
                 sb.append(", ");
-                sb.append(workflowInputNode.getInputObject().getName());
+                sb.append(inputNode.getInputObject().getName());
                 sb.append("=");
-                sb.append(workflowInputNode.getInputObject().getValue());
+                sb.append(inputNode.getInputObject().getValue());
             }
             throw new AiravataException("No workflow application node is in ready state to run with experiment inputs" + sb.toString());
         }
@@ -128,8 +128,8 @@ class SimpleWorkflowInterpreter{
             throw new AiravataException("No workflow application node is in ready state to run");
         }
         for (WorkflowNode readyNode : readyList.values()) {
-            if (readyNode instanceof WorkflowOutputNode) {
-                WorkflowOutputNode wfOutputNode = (WorkflowOutputNode) readyNode;
+            if (readyNode instanceof OutputNode) {
+                OutputNode wfOutputNode = (OutputNode) readyNode;
                 wfOutputNode.getOutputObject().setValue(wfOutputNode.getInPort().getInputObject().getValue());
                 addToCompleteOutputNodeList(wfOutputNode);
                 continue;
@@ -151,7 +151,7 @@ class SimpleWorkflowInterpreter{
 
     private void saveWorkflowOutputs() throws AppCatalogException {
         List<OutputDataObjectType> outputDataObjects = new ArrayList<OutputDataObjectType>();
-        for (WorkflowOutputNode completeWorkflowOutput : completeWorkflowOutputs) {
+        for (OutputNode completeWorkflowOutput : completeWorkflowOutputs) {
             outputDataObjects.add(completeWorkflowOutput.getOutputObject());
         }
         RegistryFactory.getAppCatalog().getWorkflowCatalog()
@@ -183,9 +183,9 @@ class SimpleWorkflowInterpreter{
             executionUnit = ExecutionUnit.APPLICATION;
             executionData = ((ApplicationNode) readyNode).getApplicationId();
             setupNodeDetailsInput(((ApplicationNode) readyNode), wfNodeDetails);
-        } else if (readyNode instanceof WorkflowInputNode) {
+        } else if (readyNode instanceof InputNode) {
             executionUnit = ExecutionUnit.INPUT;
-        } else if (readyNode instanceof WorkflowOutputNode) {
+        } else if (readyNode instanceof OutputNode) {
             executionUnit = ExecutionUnit.OUTPUT;
         }
         wfNodeDetails.setExecutionUnit(executionUnit);
@@ -206,9 +206,9 @@ class SimpleWorkflowInterpreter{
     }
 
 
-    private void processWorkflowInputNodes(List<WorkflowInputNode> wfInputNodes) {
+    private void processWorkflowInputNodes(List<InputNode> wfInputNodes) {
         Set<WorkflowNode> tempNodeSet = new HashSet<WorkflowNode>();
-        for (WorkflowInputNode wfInputNode : wfInputNodes) {
+        for (InputNode wfInputNode : wfInputNodes) {
             if (wfInputNode.isReady()) {
                 log.debug("Workflow node : " + wfInputNode.getId() + " is ready to execute");
                 for (Edge edge : wfInputNode.getOutPort().getOutEdges()) {
@@ -227,12 +227,12 @@ class SimpleWorkflowInterpreter{
     }
 
 
-    public List<WorkflowInputNode> getWorkflowInputNodes() throws Exception {
-        return workflowInputNodes;
+    public List<InputNode> getInputNodes() throws Exception {
+        return inputNodes;
     }
 
-    public void setWorkflowInputNodes(List<WorkflowInputNode> workflowInputNodes) {
-        this.workflowInputNodes = workflowInputNodes;
+    public void setInputNodes(List<InputNode> inputNodes) {
+        this.inputNodes = inputNodes;
     }
 
     private Registry getRegistry() throws RegistryException {
@@ -282,7 +282,7 @@ class SimpleWorkflowInterpreter{
     }
 
 
-    private void addToCompleteOutputNodeList(WorkflowOutputNode wfOutputNode) {
+    private void addToCompleteOutputNodeList(OutputNode wfOutputNode) {
         completeWorkflowOutputs.add(wfOutputNode);
         readyList.remove(wfOutputNode.getId());
     }

http://git-wip-us.apache.org/repos/asf/airavata/blob/225f462b/modules/workflow/workflow-core/src/main/java/org/apache/airavata/workflow/core/WorkflowBuilder.java
----------------------------------------------------------------------
diff --git a/modules/workflow/workflow-core/src/main/java/org/apache/airavata/workflow/core/WorkflowBuilder.java b/modules/workflow/workflow-core/src/main/java/org/apache/airavata/workflow/core/WorkflowBuilder.java
new file mode 100644
index 0000000..a794282
--- /dev/null
+++ b/modules/workflow/workflow-core/src/main/java/org/apache/airavata/workflow/core/WorkflowBuilder.java
@@ -0,0 +1,15 @@
+package org.apache.airavata.workflow.core;
+
+import org.apache.airavata.workflow.core.dag.nodes.InputNode;
+
+import java.util.List;
+
+/**
+ * Created by syodage on 2/1/16.
+ */
+public interface WorkflowBuilder {
+
+    public List<InputNode> build() throws Exception;
+
+    public List<InputNode> build(String workflow) throws Exception;
+}

http://git-wip-us.apache.org/repos/asf/airavata/blob/225f462b/modules/workflow/workflow-core/src/main/java/org/apache/airavata/workflow/core/WorkflowEnactmentService.java
----------------------------------------------------------------------
diff --git a/modules/workflow/workflow-core/src/main/java/org/apache/airavata/workflow/core/WorkflowEnactmentService.java b/modules/workflow/workflow-core/src/main/java/org/apache/airavata/workflow/core/WorkflowEnactmentService.java
index 8ca0706..aaa3073 100644
--- a/modules/workflow/workflow-core/src/main/java/org/apache/airavata/workflow/core/WorkflowEnactmentService.java
+++ b/modules/workflow/workflow-core/src/main/java/org/apache/airavata/workflow/core/WorkflowEnactmentService.java
@@ -137,7 +137,7 @@ public class WorkflowEnactmentService {
                     // output changes it is ok to ignore this.
                 }
 
-            }else if (msgCtx.getType() == MessageType.TASKOUTPUT) {
+            }else if (msgCtx.getType() == MessageType.PROCESSOUTPUT) {
                 TaskOutputChangeEvent event = (TaskOutputChangeEvent) msgCtx.getEvent();
                 TaskIdentifier taskIdentifier = event.getTaskIdentity();
                 simpleWorkflowInterpreter = getInterpreter(taskIdentifier.getExperimentId());
@@ -150,7 +150,7 @@ public class WorkflowEnactmentService {
                     throw new IllegalArgumentException("Error while processing TaskOutputChangeEvent, " +
                             "There is no registered workflow for experiment Id : " + taskIdentifier.getExperimentId());
                 }
-                message = "Received task output change event , expId : " + taskIdentifier.getExperimentId() + ", taskId : " + taskIdentifier.getTaskId() + ", workflow node Id : " + taskIdentifier.getWorkflowNodeId();
+                message = "Received task output change event , expId : " + taskIdentifier.getExperimentId() + ", taskId : " + taskIdentifier.getTaskId();
                 log.debug(message);
             } else {
                 // not interested, ignores

http://git-wip-us.apache.org/repos/asf/airavata/blob/225f462b/modules/workflow/workflow-core/src/main/java/org/apache/airavata/workflow/core/WorkflowFactory.java
----------------------------------------------------------------------
diff --git a/modules/workflow/workflow-core/src/main/java/org/apache/airavata/workflow/core/WorkflowFactory.java b/modules/workflow/workflow-core/src/main/java/org/apache/airavata/workflow/core/WorkflowFactory.java
index ee89dd9..f232efa 100644
--- a/modules/workflow/workflow-core/src/main/java/org/apache/airavata/workflow/core/WorkflowFactory.java
+++ b/modules/workflow/workflow-core/src/main/java/org/apache/airavata/workflow/core/WorkflowFactory.java
@@ -21,11 +21,41 @@
 
 package org.apache.airavata.workflow.core;
 
+import org.apache.airavata.common.exception.ApplicationSettingsException;
+import org.apache.airavata.common.utils.ServerSettings;
+import org.apache.airavata.workflow.core.parser.AiravataWorkflowBuilder;
+import org.apache.airavata.workflow.core.parser.JsonWorkflowParser;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.lang.reflect.Constructor;
+
 /**
  * All classes implement this WorkflowFactory interface, should be abstract or singleton.
  */
-public interface WorkflowFactory {
+public class WorkflowFactory {
+
+    private static final Logger log = LoggerFactory.getLogger(WorkflowFactory.class);
+
+
+    public static WorkflowBuilder getWorkflowBuilder(String experimentId, String credentialToken, String workflowString) throws Exception {
+        return new AiravataWorkflowBuilder(experimentId, credentialToken, getWorkflowParser(workflowString));
+    }
 
-    public WorkflowParser getWorkflowParser(String experimentId, String credentialToken) throws Exception;
+    public static WorkflowParser getWorkflowParser(String workflowString) throws Exception {
+        WorkflowParser workflowParser = null;
+        try {
+            String wfParserClassName = ServerSettings.getWorkflowParser();
+            Class<?> aClass = Class.forName(wfParserClassName);
+            Constructor<?> constructor = aClass.getConstructor(String.class);
+            workflowParser = (WorkflowParser) constructor.newInstance(workflowString);
+        } catch (ApplicationSettingsException e) {
+            log.info("A custom workflow parser is not defined, Use default Airavata JSON workflow parser");
+        }
+        if (workflowParser == null) {
+            workflowParser = new JsonWorkflowParser(workflowString);
+        }
+        return workflowParser;
+    }
 
 }

http://git-wip-us.apache.org/repos/asf/airavata/blob/225f462b/modules/workflow/workflow-core/src/main/java/org/apache/airavata/workflow/core/WorkflowFactoryImpl.java
----------------------------------------------------------------------
diff --git a/modules/workflow/workflow-core/src/main/java/org/apache/airavata/workflow/core/WorkflowFactoryImpl.java b/modules/workflow/workflow-core/src/main/java/org/apache/airavata/workflow/core/WorkflowFactoryImpl.java
deleted file mode 100644
index 1df2084..0000000
--- a/modules/workflow/workflow-core/src/main/java/org/apache/airavata/workflow/core/WorkflowFactoryImpl.java
+++ /dev/null
@@ -1,74 +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.workflow.core;
-
-import org.apache.airavata.common.exception.ApplicationSettingsException;
-import org.apache.airavata.common.utils.ServerSettings;
-import org.apache.airavata.workflow.core.parser.AiravataWorkflowParser;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.lang.reflect.Constructor;
-
-/**
- * Singleton class, only one instance can exist in runtime.
- */
-public class WorkflowFactoryImpl implements WorkflowFactory {
-
-    private static final Logger log = LoggerFactory.getLogger(WorkflowFactoryImpl.class);
-
-    private static WorkflowFactoryImpl workflowFactoryImpl;
-
-    private WorkflowFactoryImpl(){
-
-    }
-
-    public static WorkflowFactoryImpl getInstance() {
-        if (workflowFactoryImpl == null) {
-            synchronized (WorkflowFactory.class) {
-                if (workflowFactoryImpl == null) {
-                    workflowFactoryImpl = new WorkflowFactoryImpl();
-                }
-            }
-        }
-        return workflowFactoryImpl;
-    }
-
-
-    @Override
-    public WorkflowParser getWorkflowParser(String experimentId, String credentialToken) throws Exception {
-        WorkflowParser workflowParser = null;
-        try {
-            String wfParserClassName = ServerSettings.getWorkflowParser();
-            Class<?> aClass = Class.forName(wfParserClassName);
-            Constructor<?> constructor = aClass.getConstructor(String.class, String.class);
-            workflowParser = (WorkflowParser) constructor.newInstance(experimentId, credentialToken);
-        } catch (ApplicationSettingsException e) {
-            log.info("A custom workflow parser is not defined, Use default Airavata workflow parser");
-        }
-        if (workflowParser == null) {
-            workflowParser = new AiravataWorkflowParser(experimentId, credentialToken);
-        }
-        return workflowParser;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/airavata/blob/225f462b/modules/workflow/workflow-core/src/main/java/org/apache/airavata/workflow/core/WorkflowParser.java
----------------------------------------------------------------------
diff --git a/modules/workflow/workflow-core/src/main/java/org/apache/airavata/workflow/core/WorkflowParser.java b/modules/workflow/workflow-core/src/main/java/org/apache/airavata/workflow/core/WorkflowParser.java
index 8d284dd..46bc1d8 100644
--- a/modules/workflow/workflow-core/src/main/java/org/apache/airavata/workflow/core/WorkflowParser.java
+++ b/modules/workflow/workflow-core/src/main/java/org/apache/airavata/workflow/core/WorkflowParser.java
@@ -21,12 +21,26 @@
 
 package org.apache.airavata.workflow.core;
 
-import org.apache.airavata.workflow.core.dag.nodes.WorkflowInputNode;
+import org.apache.airavata.workflow.core.dag.edge.Edge;
+import org.apache.airavata.workflow.core.dag.nodes.ApplicationNode;
+import org.apache.airavata.workflow.core.dag.nodes.InputNode;
+import org.apache.airavata.workflow.core.dag.nodes.OutputNode;
+import org.apache.airavata.workflow.core.dag.port.Port;
 
 import java.util.List;
 
 public interface WorkflowParser {
 
-    public List<WorkflowInputNode> parse() throws Exception;
+    public void parse() throws Exception;
+
+    public List<InputNode> getInputNodes() throws Exception;
+
+    public List<OutputNode> getOutputNodes() throws Exception;
+
+    public List<ApplicationNode> getApplicationNodes() throws Exception;
+
+    public List<Port> getPorts() throws Exception;
+
+    public List<Edge> getEdges() throws Exception;
 
 }

http://git-wip-us.apache.org/repos/asf/airavata/blob/225f462b/modules/workflow/workflow-core/src/main/java/org/apache/airavata/workflow/core/dag/nodes/InputNode.java
----------------------------------------------------------------------
diff --git a/modules/workflow/workflow-core/src/main/java/org/apache/airavata/workflow/core/dag/nodes/InputNode.java b/modules/workflow/workflow-core/src/main/java/org/apache/airavata/workflow/core/dag/nodes/InputNode.java
new file mode 100644
index 0000000..6dec125
--- /dev/null
+++ b/modules/workflow/workflow-core/src/main/java/org/apache/airavata/workflow/core/dag/nodes/InputNode.java
@@ -0,0 +1,37 @@
+/*
+ *
+ * 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.workflow.core.dag.nodes;
+
+import org.apache.airavata.model.application.io.InputDataObjectType;
+import org.apache.airavata.workflow.core.dag.port.OutPort;
+
+public interface InputNode extends WorkflowNode {
+
+    public InputDataObjectType getInputObject();
+
+    public void setInputObject(InputDataObjectType inputObject);
+
+    public OutPort getOutPort();
+
+    public void setOutPort(OutPort outPort);
+
+}

http://git-wip-us.apache.org/repos/asf/airavata/blob/225f462b/modules/workflow/workflow-core/src/main/java/org/apache/airavata/workflow/core/dag/nodes/InputNodeImpl.java
----------------------------------------------------------------------
diff --git a/modules/workflow/workflow-core/src/main/java/org/apache/airavata/workflow/core/dag/nodes/InputNodeImpl.java b/modules/workflow/workflow-core/src/main/java/org/apache/airavata/workflow/core/dag/nodes/InputNodeImpl.java
new file mode 100644
index 0000000..59984d7
--- /dev/null
+++ b/modules/workflow/workflow-core/src/main/java/org/apache/airavata/workflow/core/dag/nodes/InputNodeImpl.java
@@ -0,0 +1,105 @@
+/*
+ * 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.workflow.core.dag.nodes;
+
+import org.apache.airavata.model.ComponentState;
+import org.apache.airavata.model.ComponentStatus;
+import org.apache.airavata.model.NodeModel;
+import org.apache.airavata.model.application.io.InputDataObjectType;
+import org.apache.airavata.workflow.core.dag.port.OutPort;
+
+public class InputNodeImpl implements InputNode {
+
+    private NodeModel nodeModel;
+    private OutPort outPort;
+    private InputDataObjectType inputDataObjectType;
+
+    public InputNodeImpl(NodeModel nodeModel) {
+        this.nodeModel = nodeModel;
+    }
+
+    @Override
+    public void setNodeModel(NodeModel nodeModel) {
+        this.nodeModel = nodeModel;
+    }
+
+    @Override
+    public NodeModel getNodeModel() {
+        return nodeModel;
+    }
+
+    @Override
+    public String getId() {
+        return getNodeModel().getNodeId();
+    }
+
+    @Override
+    public String getName() {
+        return getNodeModel().getName();
+    }
+
+    @Override
+    public NodeType getType() {
+        return NodeType.WORKFLOW_INPUT;
+    }
+
+    @Override
+    public ComponentState getState() {
+        return getStatus().getState();
+    }
+
+    @Override
+    public ComponentStatus getStatus() {
+        return getNodeModel().getStatus();
+    }
+
+    @Override
+    public void setStatus(ComponentStatus newStatus) {
+        getNodeModel().setStatus(newStatus);
+    }
+
+    @Override
+    public boolean isReady() {
+        return (inputDataObjectType.getValue() != null && !inputDataObjectType.getValue().equals(""))
+                || !inputDataObjectType.isIsRequired();
+    }
+
+    @Override
+    public InputDataObjectType getInputObject() {
+        return this.inputDataObjectType;
+    }
+
+    @Override
+    public void setInputObject(InputDataObjectType inputObject) {
+        this.inputDataObjectType = inputObject;
+    }
+
+    @Override
+    public OutPort getOutPort() {
+        return this.outPort;
+    }
+
+    @Override
+    public void setOutPort(OutPort outPort) {
+        this.outPort = outPort;
+    }
+
+
+}

http://git-wip-us.apache.org/repos/asf/airavata/blob/225f462b/modules/workflow/workflow-core/src/main/java/org/apache/airavata/workflow/core/dag/nodes/OutputNode.java
----------------------------------------------------------------------
diff --git a/modules/workflow/workflow-core/src/main/java/org/apache/airavata/workflow/core/dag/nodes/OutputNode.java b/modules/workflow/workflow-core/src/main/java/org/apache/airavata/workflow/core/dag/nodes/OutputNode.java
new file mode 100644
index 0000000..7378c96
--- /dev/null
+++ b/modules/workflow/workflow-core/src/main/java/org/apache/airavata/workflow/core/dag/nodes/OutputNode.java
@@ -0,0 +1,37 @@
+/*
+ *
+ * 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.workflow.core.dag.nodes;
+
+import org.apache.airavata.model.application.io.OutputDataObjectType;
+import org.apache.airavata.workflow.core.dag.port.InPort;
+
+public interface OutputNode extends WorkflowNode {
+
+    public OutputDataObjectType getOutputObject();
+
+    public void setOutputObject(OutputDataObjectType outputObject);
+
+    public InPort getInPort();
+
+    public void setInPort(InPort inPort);
+
+}

http://git-wip-us.apache.org/repos/asf/airavata/blob/225f462b/modules/workflow/workflow-core/src/main/java/org/apache/airavata/workflow/core/dag/nodes/OutputNodeImpl.java
----------------------------------------------------------------------
diff --git a/modules/workflow/workflow-core/src/main/java/org/apache/airavata/workflow/core/dag/nodes/OutputNodeImpl.java b/modules/workflow/workflow-core/src/main/java/org/apache/airavata/workflow/core/dag/nodes/OutputNodeImpl.java
new file mode 100644
index 0000000..5eada1c
--- /dev/null
+++ b/modules/workflow/workflow-core/src/main/java/org/apache/airavata/workflow/core/dag/nodes/OutputNodeImpl.java
@@ -0,0 +1,108 @@
+/*
+ *
+ * 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.workflow.core.dag.nodes;
+
+import org.apache.airavata.model.ComponentState;
+import org.apache.airavata.model.ComponentStatus;
+import org.apache.airavata.model.NodeModel;
+import org.apache.airavata.model.application.io.OutputDataObjectType;
+import org.apache.airavata.workflow.core.dag.port.InPort;
+
+public class OutputNodeImpl implements OutputNode {
+
+    private NodeModel nodeModel;
+    private OutputDataObjectType outputDataObjectType;
+    private InPort inPort;
+
+    public OutputNodeImpl(NodeModel nodeModel) {
+        this.nodeModel = nodeModel;
+    }
+
+    @Override
+    public void setNodeModel(NodeModel nodeModel) {
+        this.nodeModel = nodeModel;
+    }
+
+    @Override
+    public NodeModel getNodeModel() {
+        return nodeModel;
+    }
+
+    @Override
+    public String getId() {
+        return getNodeModel().getNodeId();
+    }
+
+    @Override
+    public String getName() {
+        return getNodeModel().getName();
+    }
+
+    @Override
+    public NodeType getType() {
+        return NodeType.WORKFLOW_OUTPUT;
+    }
+
+    @Override
+    public ComponentState getState() {
+        return getStatus().getState();
+    }
+
+    @Override
+    public ComponentStatus getStatus() {
+        return getNodeModel().getStatus();
+    }
+
+    @Override
+    public void setStatus(ComponentStatus newStatus) {
+        getNodeModel().setStatus(newStatus);
+    }
+
+
+    @Override
+    public boolean isReady() {
+        return !(inPort.getInputObject() == null || inPort.getInputObject().getValue() == null
+                || inPort.getInputObject().getValue().equals(""));
+    }
+
+    @Override
+    public OutputDataObjectType getOutputObject() {
+        return this.outputDataObjectType;
+    }
+
+    @Override
+    public void setOutputObject(OutputDataObjectType outputObject) {
+        this.outputDataObjectType = outputObject;
+    }
+
+    @Override
+    public InPort getInPort() {
+        return this.inPort;
+    }
+
+    @Override
+    public void setInPort(InPort inPort) {
+        this.inPort = inPort;
+    }
+
+}
+

http://git-wip-us.apache.org/repos/asf/airavata/blob/225f462b/modules/workflow/workflow-core/src/main/java/org/apache/airavata/workflow/core/dag/nodes/WorkflowInputNode.java
----------------------------------------------------------------------
diff --git a/modules/workflow/workflow-core/src/main/java/org/apache/airavata/workflow/core/dag/nodes/WorkflowInputNode.java b/modules/workflow/workflow-core/src/main/java/org/apache/airavata/workflow/core/dag/nodes/WorkflowInputNode.java
deleted file mode 100644
index 939ba16..0000000
--- a/modules/workflow/workflow-core/src/main/java/org/apache/airavata/workflow/core/dag/nodes/WorkflowInputNode.java
+++ /dev/null
@@ -1,37 +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.workflow.core.dag.nodes;
-
-import org.apache.airavata.model.application.io.InputDataObjectType;
-import org.apache.airavata.workflow.core.dag.port.OutPort;
-
-public interface WorkflowInputNode extends WorkflowNode {
-
-    public InputDataObjectType getInputObject();
-
-    public void setInputObject(InputDataObjectType inputObject);
-
-    public OutPort getOutPort();
-
-    public void setOutPort(OutPort outPort);
-
-}

http://git-wip-us.apache.org/repos/asf/airavata/blob/225f462b/modules/workflow/workflow-core/src/main/java/org/apache/airavata/workflow/core/dag/nodes/WorkflowInputNodeImpl.java
----------------------------------------------------------------------
diff --git a/modules/workflow/workflow-core/src/main/java/org/apache/airavata/workflow/core/dag/nodes/WorkflowInputNodeImpl.java b/modules/workflow/workflow-core/src/main/java/org/apache/airavata/workflow/core/dag/nodes/WorkflowInputNodeImpl.java
deleted file mode 100644
index 3ecc865..0000000
--- a/modules/workflow/workflow-core/src/main/java/org/apache/airavata/workflow/core/dag/nodes/WorkflowInputNodeImpl.java
+++ /dev/null
@@ -1,105 +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.workflow.core.dag.nodes;
-
-import org.apache.airavata.model.ComponentState;
-import org.apache.airavata.model.ComponentStatus;
-import org.apache.airavata.model.NodeModel;
-import org.apache.airavata.model.application.io.InputDataObjectType;
-import org.apache.airavata.workflow.core.dag.port.OutPort;
-
-public class WorkflowInputNodeImpl implements WorkflowInputNode {
-
-    private NodeModel nodeModel;
-    private OutPort outPort;
-    private InputDataObjectType inputDataObjectType;
-
-    public WorkflowInputNodeImpl(NodeModel nodeModel) {
-        this.nodeModel = nodeModel;
-    }
-
-    @Override
-    public void setNodeModel(NodeModel nodeModel) {
-        this.nodeModel = nodeModel;
-    }
-
-    @Override
-    public NodeModel getNodeModel() {
-        return nodeModel;
-    }
-
-    @Override
-    public String getId() {
-        return getNodeModel().getNodeId();
-    }
-
-    @Override
-    public String getName() {
-        return getNodeModel().getName();
-    }
-
-    @Override
-    public NodeType getType() {
-        return NodeType.WORKFLOW_INPUT;
-    }
-
-    @Override
-    public ComponentState getState() {
-        return getStatus().getState();
-    }
-
-    @Override
-    public ComponentStatus getStatus() {
-        return getNodeModel().getStatus();
-    }
-
-    @Override
-    public void setStatus(ComponentStatus newStatus) {
-        getNodeModel().setStatus(newStatus);
-    }
-
-    @Override
-    public boolean isReady() {
-        return (inputDataObjectType.getValue() != null && !inputDataObjectType.getValue().equals(""))
-                || !inputDataObjectType.isIsRequired();
-    }
-
-    @Override
-    public InputDataObjectType getInputObject() {
-        return this.inputDataObjectType;
-    }
-
-    @Override
-    public void setInputObject(InputDataObjectType inputObject) {
-        this.inputDataObjectType = inputObject;
-    }
-
-    @Override
-    public OutPort getOutPort() {
-        return this.outPort;
-    }
-
-    @Override
-    public void setOutPort(OutPort outPort) {
-        this.outPort = outPort;
-    }
-
-
-}

http://git-wip-us.apache.org/repos/asf/airavata/blob/225f462b/modules/workflow/workflow-core/src/main/java/org/apache/airavata/workflow/core/dag/nodes/WorkflowOutputNode.java
----------------------------------------------------------------------
diff --git a/modules/workflow/workflow-core/src/main/java/org/apache/airavata/workflow/core/dag/nodes/WorkflowOutputNode.java b/modules/workflow/workflow-core/src/main/java/org/apache/airavata/workflow/core/dag/nodes/WorkflowOutputNode.java
deleted file mode 100644
index 1b984be..0000000
--- a/modules/workflow/workflow-core/src/main/java/org/apache/airavata/workflow/core/dag/nodes/WorkflowOutputNode.java
+++ /dev/null
@@ -1,37 +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.workflow.core.dag.nodes;
-
-import org.apache.airavata.model.application.io.OutputDataObjectType;
-import org.apache.airavata.workflow.core.dag.port.InPort;
-
-public interface WorkflowOutputNode extends WorkflowNode {
-
-    public OutputDataObjectType getOutputObject();
-
-    public void setOutputObject(OutputDataObjectType outputObject);
-
-    public InPort getInPort();
-
-    public void setInPort(InPort inPort);
-
-}

http://git-wip-us.apache.org/repos/asf/airavata/blob/225f462b/modules/workflow/workflow-core/src/main/java/org/apache/airavata/workflow/core/dag/nodes/WorkflowOutputNodeImpl.java
----------------------------------------------------------------------
diff --git a/modules/workflow/workflow-core/src/main/java/org/apache/airavata/workflow/core/dag/nodes/WorkflowOutputNodeImpl.java b/modules/workflow/workflow-core/src/main/java/org/apache/airavata/workflow/core/dag/nodes/WorkflowOutputNodeImpl.java
deleted file mode 100644
index 5844753..0000000
--- a/modules/workflow/workflow-core/src/main/java/org/apache/airavata/workflow/core/dag/nodes/WorkflowOutputNodeImpl.java
+++ /dev/null
@@ -1,108 +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.workflow.core.dag.nodes;
-
-import org.apache.airavata.model.ComponentState;
-import org.apache.airavata.model.ComponentStatus;
-import org.apache.airavata.model.NodeModel;
-import org.apache.airavata.model.application.io.OutputDataObjectType;
-import org.apache.airavata.workflow.core.dag.port.InPort;
-
-public class WorkflowOutputNodeImpl implements WorkflowOutputNode {
-
-    private NodeModel nodeModel;
-    private OutputDataObjectType outputDataObjectType;
-    private InPort inPort;
-
-    public WorkflowOutputNodeImpl(NodeModel nodeModel) {
-        this.nodeModel = nodeModel;
-    }
-
-    @Override
-    public void setNodeModel(NodeModel nodeModel) {
-        this.nodeModel = nodeModel;
-    }
-
-    @Override
-    public NodeModel getNodeModel() {
-        return nodeModel;
-    }
-
-    @Override
-    public String getId() {
-        return getNodeModel().getNodeId();
-    }
-
-    @Override
-    public String getName() {
-        return getNodeModel().getName();
-    }
-
-    @Override
-    public NodeType getType() {
-        return NodeType.WORKFLOW_OUTPUT;
-    }
-
-    @Override
-    public ComponentState getState() {
-        return getStatus().getState();
-    }
-
-    @Override
-    public ComponentStatus getStatus() {
-        return getNodeModel().getStatus();
-    }
-
-    @Override
-    public void setStatus(ComponentStatus newStatus) {
-        getNodeModel().setStatus(newStatus);
-    }
-
-
-    @Override
-    public boolean isReady() {
-        return !(inPort.getInputObject() == null || inPort.getInputObject().getValue() == null
-                || inPort.getInputObject().getValue().equals(""));
-    }
-
-    @Override
-    public OutputDataObjectType getOutputObject() {
-        return this.outputDataObjectType;
-    }
-
-    @Override
-    public void setOutputObject(OutputDataObjectType outputObject) {
-        this.outputDataObjectType = outputObject;
-    }
-
-    @Override
-    public InPort getInPort() {
-        return this.inPort;
-    }
-
-    @Override
-    public void setInPort(InPort inPort) {
-        this.inPort = inPort;
-    }
-
-}
-

http://git-wip-us.apache.org/repos/asf/airavata/blob/225f462b/modules/workflow/workflow-core/src/main/java/org/apache/airavata/workflow/core/parser/AiravataWorkflowBuilder.java
----------------------------------------------------------------------
diff --git a/modules/workflow/workflow-core/src/main/java/org/apache/airavata/workflow/core/parser/AiravataWorkflowBuilder.java b/modules/workflow/workflow-core/src/main/java/org/apache/airavata/workflow/core/parser/AiravataWorkflowBuilder.java
new file mode 100644
index 0000000..e50b245
--- /dev/null
+++ b/modules/workflow/workflow-core/src/main/java/org/apache/airavata/workflow/core/parser/AiravataWorkflowBuilder.java
@@ -0,0 +1,117 @@
+/*
+ *
+ * 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.workflow.core.parser;
+
+import org.apache.airavata.model.application.io.InputDataObjectType;
+import org.apache.airavata.model.application.io.OutputDataObjectType;
+import org.apache.airavata.model.experiment.ExperimentModel;
+import org.apache.airavata.registry.core.experiment.catalog.impl.RegistryFactory;
+import org.apache.airavata.registry.cpi.*;
+import org.apache.airavata.workflow.core.WorkflowBuilder;
+import org.apache.airavata.workflow.core.WorkflowParser;
+import org.apache.airavata.workflow.core.dag.edge.DirectedEdge;
+import org.apache.airavata.workflow.core.dag.edge.Edge;
+import org.apache.airavata.workflow.core.dag.nodes.ApplicationNode;
+import org.apache.airavata.workflow.core.dag.nodes.ApplicationNodeImpl;
+import org.apache.airavata.workflow.core.dag.nodes.InputNode;
+import org.apache.airavata.workflow.core.dag.nodes.WorkflowNode;
+import org.apache.airavata.workflow.core.dag.nodes.OutputNode;
+import org.apache.airavata.workflow.core.dag.nodes.OutputNodeImpl;
+import org.apache.airavata.workflow.core.dag.port.*;
+
+import java.util.*;
+
+public class AiravataWorkflowBuilder implements WorkflowBuilder {
+
+    private String credentialToken ;
+    private WorkflowParser workflowParser;
+    private ExperimentModel experiment;
+
+
+    public AiravataWorkflowBuilder(String experimentId, String credentialToken, WorkflowParser workflowParser) throws RegistryException {
+        this.experiment = getExperiment(experimentId);
+        this.credentialToken = credentialToken;
+        this.workflowParser = workflowParser;
+    }
+
+    public AiravataWorkflowBuilder(ExperimentModel experiment, String credentialToken , WorkflowParser workflowParser) {
+        this.credentialToken = credentialToken;
+        this.experiment = experiment;
+        this.workflowParser = workflowParser;
+    }
+
+    @Override
+    public List<InputNode> build() throws Exception {
+        return parseWorkflow(getWorkflowFromExperiment(experiment));
+    }
+
+    @Override
+    public List<InputNode> build(String workflow) throws Exception {
+        return parseWorkflow(workflow);
+    }
+
+    public List<InputNode> parseWorkflow(String workflow) throws Exception {
+
+        List<InputNode> inputNodes = workflowParser.getInputNodes();
+        List<ApplicationNode> applicationNodes = workflowParser.getApplicationNodes();
+        List<Port> ports = workflowParser.getPorts();
+        List<Edge> edges = workflowParser.getEdges();
+        List<OutputNode> outputNodes = workflowParser.getOutputNodes();
+
+        // travel breath first and build relation between each workflow component
+        Queue<WorkflowNode> queue = new LinkedList<>();
+        List<InputDataObjectType> experimentInputs = experiment.getExperimentInputs();
+        Map<String,InputDataObjectType> inputDataMap=new HashMap<String, InputDataObjectType>();
+        for (InputDataObjectType dataObjectType : experimentInputs) {
+            inputDataMap.put(dataObjectType.getName(), dataObjectType);
+        }
+
+        return inputNodes;
+    }
+
+
+    private OutputDataObjectType getOutputDataObject(InputDataObjectType inputObject) {
+        OutputDataObjectType outputDataObjectType = new OutputDataObjectType();
+        outputDataObjectType.setApplicationArgument(inputObject.getApplicationArgument());
+        outputDataObjectType.setName(inputObject.getName());
+        outputDataObjectType.setType(inputObject.getType());
+        outputDataObjectType.setValue(inputObject.getValue());
+        return outputDataObjectType;
+    }
+
+    private ExperimentModel getExperiment(String experimentId) throws RegistryException {
+        Registry registry = RegistryFactory.getRegistry();
+        return (ExperimentModel)registry.getExperimentCatalog().get(ExperimentCatalogModelType.EXPERIMENT, experimentId);
+    }
+
+    private String getWorkflowFromExperiment(ExperimentModel experiment) throws RegistryException, AppCatalogException {
+        WorkflowCatalog workflowCatalog = getWorkflowCatalog();
+
+        // FIXME: return workflow string
+        return null;
+    }
+
+    private WorkflowCatalog getWorkflowCatalog() throws AppCatalogException {
+        return RegistryFactory.getAppCatalog().getWorkflowCatalog();
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/airavata/blob/225f462b/modules/workflow/workflow-core/src/main/java/org/apache/airavata/workflow/core/parser/AiravataWorkflowParser.java
----------------------------------------------------------------------
diff --git a/modules/workflow/workflow-core/src/main/java/org/apache/airavata/workflow/core/parser/AiravataWorkflowParser.java b/modules/workflow/workflow-core/src/main/java/org/apache/airavata/workflow/core/parser/AiravataWorkflowParser.java
deleted file mode 100644
index 0844219..0000000
--- a/modules/workflow/workflow-core/src/main/java/org/apache/airavata/workflow/core/parser/AiravataWorkflowParser.java
+++ /dev/null
@@ -1,287 +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.workflow.core.parser;
-
-import org.apache.airavata.model.application.io.InputDataObjectType;
-import org.apache.airavata.model.application.io.OutputDataObjectType;
-import org.apache.airavata.model.experiment.ExperimentModel;
-import org.apache.airavata.registry.core.experiment.catalog.impl.RegistryFactory;
-import org.apache.airavata.registry.cpi.*;
-import org.apache.airavata.workflow.core.WorkflowParser;
-import org.apache.airavata.workflow.core.dag.edge.DirectedEdge;
-import org.apache.airavata.workflow.core.dag.edge.Edge;
-import org.apache.airavata.workflow.core.dag.nodes.ApplicationNode;
-import org.apache.airavata.workflow.core.dag.nodes.ApplicationNodeImpl;
-import org.apache.airavata.workflow.core.dag.nodes.WorkflowInputNode;
-import org.apache.airavata.workflow.core.dag.nodes.WorkflowInputNodeImpl;
-import org.apache.airavata.workflow.core.dag.nodes.WorkflowNode;
-import org.apache.airavata.workflow.core.dag.nodes.WorkflowOutputNode;
-import org.apache.airavata.workflow.core.dag.nodes.WorkflowOutputNodeImpl;
-import org.apache.airavata.workflow.core.dag.port.InPort;
-import org.apache.airavata.workflow.core.dag.port.InputPortIml;
-import org.apache.airavata.workflow.core.dag.port.OutPort;
-import org.apache.airavata.workflow.core.dag.port.OutPortImpl;
-import org.apache.airavata.workflow.model.component.ComponentException;
-import org.apache.airavata.workflow.model.component.system.ConstantComponent;
-import org.apache.airavata.workflow.model.component.system.InputComponent;
-import org.apache.airavata.workflow.model.component.system.S3InputComponent;
-import org.apache.airavata.workflow.model.graph.DataEdge;
-import org.apache.airavata.workflow.model.graph.DataPort;
-import org.apache.airavata.workflow.model.graph.GraphException;
-import org.apache.airavata.workflow.model.graph.Node;
-import org.apache.airavata.workflow.model.graph.impl.NodeImpl;
-import org.apache.airavata.workflow.model.graph.system.OutputNode;
-import org.apache.airavata.workflow.model.graph.system.SystemDataPort;
-import org.apache.airavata.workflow.model.graph.ws.WSNode;
-import org.apache.airavata.workflow.model.graph.ws.WSPort;
-import org.apache.airavata.workflow.model.wf.Workflow;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-public class AiravataWorkflowParser implements WorkflowParser {
-
-    private String credentialToken ;
-
-    private ExperimentModel experiment;
-    private Map<String, WorkflowNode> wfNodes = new HashMap<String, WorkflowNode>();
-
-
-    public AiravataWorkflowParser(String experimentId, String credentialToken) throws RegistryException {
-        this.experiment = getExperiment(experimentId);
-        this.credentialToken = credentialToken;
-    }
-
-    public AiravataWorkflowParser(ExperimentModel experiment, String credentialToken) {
-        this.credentialToken = credentialToken;
-        this.experiment = experiment;
-    }
-
-    @Override
-    public List<WorkflowInputNode> parse() throws RegistryException, AppCatalogException,
-            ComponentException, GraphException {
-        return parseWorkflow(getWorkflowFromExperiment(experiment));
-    }
-
-    public List<WorkflowInputNode> parseWorkflow(Workflow workflow) {
-        List<Node> gNodes = getInputNodes(workflow);
-        List<WorkflowInputNode> wfInputNodes = new ArrayList<WorkflowInputNode>();
-        List<PortContainer> portContainers = new ArrayList<PortContainer>();
-        List<InputDataObjectType> experimentInputs = experiment.getExperimentInputs();
-        Map<String,InputDataObjectType> inputDataMap=new HashMap<String, InputDataObjectType>();
-        WorkflowInputNode wfInputNode = null;
-        for (InputDataObjectType dataObjectType : experimentInputs) {
-            inputDataMap.put(dataObjectType.getName(), dataObjectType);
-        }
-        for (Node gNode : gNodes) {
-            wfInputNode = new WorkflowInputNodeImpl(gNode.getID(), gNode.getName());
-            wfInputNode.setInputObject(inputDataMap.get(wfInputNode.getId()));
-            if (wfInputNode.getInputObject() == null) {
-                throw new RuntimeException("Workflow Input object is not set, workflow node id: " + wfInputNode.getId());
-            }
-            portContainers.addAll(processOutPorts(gNode, wfInputNode));
-            wfInputNodes.add(wfInputNode);
-        }
-
-        // while port container is not empty iterate graph and build the workflow DAG.
-        buildModel(portContainers);
-
-        return wfInputNodes;
-    }
-
-    private void buildModel(List<PortContainer> portContainerList) {
-        // end condition of recursive call.
-        if (portContainerList == null || portContainerList.isEmpty()) {
-            return ;
-        }
-        DataPort dataPort = null;
-        InPort inPort = null;
-        ApplicationNode wfApplicationNode = null;
-        WorkflowOutputNode wfOutputNode = null;
-        List<PortContainer> nextPortContainerList = new ArrayList<PortContainer>();
-        for (PortContainer portContainer : portContainerList) {
-            dataPort = portContainer.getDataPort();
-            inPort = portContainer.getInPort();
-            Node node = dataPort.getNode();
-            if (node instanceof WSNode) {
-                WSNode wsNode = (WSNode) node;
-                WorkflowNode wfNode = wfNodes.get(wsNode.getID());
-                if (wfNode == null) {
-                    wfApplicationNode = createApplicationNode(wsNode);
-                    wfNodes.put(wfApplicationNode.getId(), wfApplicationNode);
-                    nextPortContainerList.addAll(processOutPorts(wsNode, wfApplicationNode));
-                } else if (wfNode instanceof ApplicationNode) {
-                    wfApplicationNode = (ApplicationNode) wfNode;
-                } else {
-                    throw new IllegalArgumentException("Only support for ApplicationNode implementation, but found other type for node implementation");
-                }
-                inPort.setNode(wfApplicationNode);
-                wfApplicationNode.addInPort(inPort);
-
-            }else if (node instanceof OutputNode) {
-                OutputNode oNode = (OutputNode) node;
-                wfOutputNode = createWorkflowOutputNode(oNode);
-                wfOutputNode.setInPort(inPort);
-                inPort.setNode(wfOutputNode);
-                wfNodes.put(wfOutputNode.getId(), wfOutputNode);
-            }
-        }
-        buildModel(nextPortContainerList);
-
-    }
-
-    private WorkflowOutputNode createWorkflowOutputNode(OutputNode oNode) {
-        WorkflowOutputNodeImpl workflowOutputNode = new WorkflowOutputNodeImpl(oNode.getID(), oNode.getName());
-        OutputDataObjectType outputDataObjectType = new OutputDataObjectType();
-        outputDataObjectType.setType(oNode.getParameterType());
-        outputDataObjectType.setName(oNode.getID());
-        workflowOutputNode.setOutputObject(outputDataObjectType);
-        return workflowOutputNode;
-    }
-
-    private ApplicationNode createApplicationNode(WSNode wsNode) {
-        ApplicationNode applicationNode = new ApplicationNodeImpl(wsNode.getID(),
-                wsNode.getComponent().getApplication().getName(),
-                wsNode.getComponent().getApplication().getApplicationId());
-        return applicationNode;
-    }
-
-    private List<PortContainer> processOutPorts(Node node, WorkflowNode wfNode) {
-        OutPort outPort ;
-        Edge edge;
-        InPort inPort = null;
-        List<PortContainer> portContainers = new ArrayList<PortContainer>();
-        for (DataPort dataPort : node.getOutputPorts()) {
-            outPort = createOutPort(dataPort);
-            for (DataEdge dataEdge : dataPort.getEdges()) {
-                edge = new DirectedEdge();
-                edge.setFromPort(outPort);
-                outPort.addEdge(edge);
-                inPort = createInPort(dataEdge.getToPort());
-                edge.setToPort(inPort);
-                inPort.addEdge(edge);
-                portContainers.add(new PortContainer(dataEdge.getToPort(), inPort));
-            }
-            outPort.setNode(wfNode);
-            if (wfNode instanceof WorkflowInputNode) {
-                WorkflowInputNode workflowInputNode = (WorkflowInputNode) wfNode;
-                workflowInputNode.setOutPort(outPort);
-            } else if (wfNode instanceof ApplicationNode) {
-                ApplicationNode applicationNode = ((ApplicationNode) wfNode);
-                applicationNode.addOutPort(outPort);
-            }
-        }
-        return portContainers;
-    }
-
-    private OutPort createOutPort(DataPort dataPort) {
-        OutPortImpl outPort = new OutPortImpl(dataPort.getID());
-        OutputDataObjectType outputDataObjectType = new OutputDataObjectType();
-        if (dataPort instanceof WSPort) {
-            WSPort wsPort = (WSPort) dataPort;
-            outputDataObjectType.setName(wsPort.getComponentPort().getName());
-            outputDataObjectType.setType(wsPort.getType());
-        }else if (dataPort instanceof SystemDataPort) {
-            SystemDataPort sysPort = (SystemDataPort) dataPort;
-            outputDataObjectType.setName(sysPort.getFromNode().getName());
-            outputDataObjectType.setType(sysPort.getType());
-        }
-
-        outPort.setOutputObject(outputDataObjectType);
-        return outPort;
-    }
-
-    private InPort createInPort(DataPort toPort) {
-        InPort inPort = new InputPortIml(toPort.getID());
-        InputDataObjectType inputDataObjectType = new InputDataObjectType();
-        if (toPort instanceof WSPort) {
-            WSPort wsPort = (WSPort) toPort;
-            inputDataObjectType.setName(wsPort.getName());
-            inputDataObjectType.setType(wsPort.getType());
-            inputDataObjectType.setApplicationArgument(wsPort.getComponentPort().getApplicationArgument());
-            inputDataObjectType.setIsRequired(!wsPort.getComponentPort().isOptional());
-            inputDataObjectType.setInputOrder(wsPort.getComponentPort().getInputOrder());
-
-            inPort.setDefaultValue(wsPort.getComponentPort().getDefaultValue());
-        }else if (toPort instanceof SystemDataPort) {
-            SystemDataPort sysPort = (SystemDataPort) toPort;
-            inputDataObjectType.setName(sysPort.getName());
-            inputDataObjectType.setType(sysPort.getType());
-        }
-        inPort.setInputObject(inputDataObjectType);
-        return inPort;
-    }
-
-    private InputDataObjectType getInputDataObject(DataPort dataPort) {
-        InputDataObjectType inputDataObject = new InputDataObjectType();
-        inputDataObject.setName(dataPort.getName());
-        if (dataPort instanceof WSPort) {
-            WSPort port = (WSPort) dataPort;
-            inputDataObject.setInputOrder(port.getComponentPort().getInputOrder());
-            inputDataObject.setApplicationArgument(port.getComponentPort().getApplicationArgument() == null ?
-                    "" : port.getComponentPort().getApplicationArgument());
-            inputDataObject.setType(dataPort.getType());
-        }
-        return inputDataObject;
-    }
-
-    private OutputDataObjectType getOutputDataObject(InputDataObjectType inputObject) {
-        OutputDataObjectType outputDataObjectType = new OutputDataObjectType();
-        outputDataObjectType.setApplicationArgument(inputObject.getApplicationArgument());
-        outputDataObjectType.setName(inputObject.getName());
-        outputDataObjectType.setType(inputObject.getType());
-        outputDataObjectType.setValue(inputObject.getValue());
-        return outputDataObjectType;
-    }
-
-    private ExperimentModel getExperiment(String experimentId) throws RegistryException {
-        Registry registry = RegistryFactory.getRegistry();
-        return (ExperimentModel)registry.getExperimentCatalog().get(ExperimentCatalogModelType.EXPERIMENT, experimentId);
-    }
-
-    private Workflow getWorkflowFromExperiment(ExperimentModel experiment) throws RegistryException, AppCatalogException, GraphException, ComponentException {
-        WorkflowCatalog workflowCatalog = getWorkflowCatalog();
-        return new Workflow(workflowCatalog.getWorkflow(experiment.getExecutionId()).getGraph());
-    }
-
-    private WorkflowCatalog getWorkflowCatalog() throws AppCatalogException {
-        return RegistryFactory.getAppCatalog().getWorkflowCatalog();
-    }
-
-    private ArrayList<Node> getInputNodes(Workflow wf) {
-        ArrayList<Node> list = new ArrayList<Node>();
-        List<NodeImpl> nodes = wf.getGraph().getNodes();
-        for (Node node : nodes) {
-            String name = node.getComponent().getName();
-            if (InputComponent.NAME.equals(name) || ConstantComponent.NAME.equals(name) || S3InputComponent.NAME.equals(name)) {
-                list.add(node);
-            }
-        }
-        return list;
-    }
-
-    public Map<String, WorkflowNode> getWfNodes() {
-        return wfNodes;
-    }
-}

http://git-wip-us.apache.org/repos/asf/airavata/blob/225f462b/modules/workflow/workflow-core/src/main/java/org/apache/airavata/workflow/core/parser/JsonWorkflowParser.java
----------------------------------------------------------------------
diff --git a/modules/workflow/workflow-core/src/main/java/org/apache/airavata/workflow/core/parser/JsonWorkflowParser.java b/modules/workflow/workflow-core/src/main/java/org/apache/airavata/workflow/core/parser/JsonWorkflowParser.java
index 6c839e7..59576b3 100644
--- a/modules/workflow/workflow-core/src/main/java/org/apache/airavata/workflow/core/parser/JsonWorkflowParser.java
+++ b/modules/workflow/workflow-core/src/main/java/org/apache/airavata/workflow/core/parser/JsonWorkflowParser.java
@@ -1,21 +1,76 @@
 package org.apache.airavata.workflow.core.parser;
 
+import com.google.gson.JsonObject;
 import org.apache.airavata.workflow.core.WorkflowParser;
-import org.apache.airavata.workflow.core.dag.nodes.WorkflowInputNode;
+import org.apache.airavata.workflow.core.dag.edge.Edge;
+import org.apache.airavata.workflow.core.dag.nodes.ApplicationNode;
+import org.apache.airavata.workflow.core.dag.nodes.InputNode;
+import org.apache.airavata.workflow.core.dag.nodes.OutputNode;
+import org.apache.airavata.workflow.core.dag.port.Port;
 
 import java.util.List;
 
 /**
  * Created by syodage on 1/27/16.
  */
-public class JsonWorkflowParser implements WorkflowParser {
+public class JsonWorkflowParser implements WorkflowParser{
 
-    public JsonWorkflowParser(String workflowDescription) {
+    private final String workflow;
 
+    public JsonWorkflowParser(String jsonWorkflowString) {
+        workflow = jsonWorkflowString;
+    }
+
+
+    @Override
+    public void parse() throws Exception {
+        // TODO parse json string and construct components
+    }
+
+    @Override
+    public List<InputNode> getInputNodes() throws Exception {
+        return null;
     }
 
     @Override
-    public List<WorkflowInputNode> parse() throws Exception {
+    public List<OutputNode> getOutputNodes() throws Exception {
+        return null;
+    }
+
+    @Override
+    public List<ApplicationNode> getApplicationNodes() throws Exception {
+        return null;
+    }
+
+    @Override
+    public List<Port> getPorts() throws Exception {
+        return null;
+    }
+
+    @Override
+    public List<Edge> getEdges() throws Exception {
+        return null;
+    }
+
+
+    private InputNode createInputNode(JsonObject jNode) {
+        return null;
+    }
+
+    private OutputNode createOutputNode(JsonObject jNode) {
+        return null;
+    }
+
+    private ApplicationNode createApplicationNode(JsonObject jNode) {
+        return null;
+    }
+
+    private Port createPort(JsonObject jPort){
+        return null;
+    }
+
+
+    private Edge createEdge(JsonObject jEdge) {
         return null;
     }
 }

http://git-wip-us.apache.org/repos/asf/airavata/blob/225f462b/modules/workflow/workflow-core/src/main/java/org/apache/airavata/workflow/core/parser/PortContainer.java
----------------------------------------------------------------------
diff --git a/modules/workflow/workflow-core/src/main/java/org/apache/airavata/workflow/core/parser/PortContainer.java b/modules/workflow/workflow-core/src/main/java/org/apache/airavata/workflow/core/parser/PortContainer.java
deleted file mode 100644
index 536199c..0000000
--- a/modules/workflow/workflow-core/src/main/java/org/apache/airavata/workflow/core/parser/PortContainer.java
+++ /dev/null
@@ -1,53 +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.workflow.core.parser;
-
-import org.apache.airavata.workflow.core.dag.port.InPort;
-import org.apache.airavata.workflow.model.graph.DataPort;
-
-
-public class PortContainer {
-    private DataPort dataPort;
-    private InPort inPort;
-
-
-    public PortContainer(DataPort dataPort, InPort inPort) {
-        this.dataPort = dataPort;
-        this.inPort = inPort;
-    }
-
-    public DataPort getDataPort() {
-        return dataPort;
-    }
-
-    public void setDataPort(DataPort dataPort) {
-        this.dataPort = dataPort;
-    }
-
-    public InPort getInPort() {
-        return inPort;
-    }
-
-    public void setInPort(InPort inPort) {
-        this.inPort = inPort;
-    }
-}

http://git-wip-us.apache.org/repos/asf/airavata/blob/225f462b/modules/workflow/workflow-core/src/test/java/org/apache/airavata/workflow/core/parser/AiravataWorkflowParserTest.java
----------------------------------------------------------------------
diff --git a/modules/workflow/workflow-core/src/test/java/org/apache/airavata/workflow/core/parser/AiravataWorkflowParserTest.java b/modules/workflow/workflow-core/src/test/java/org/apache/airavata/workflow/core/parser/AiravataWorkflowParserTest.java
deleted file mode 100644
index 6f35e30..0000000
--- a/modules/workflow/workflow-core/src/test/java/org/apache/airavata/workflow/core/parser/AiravataWorkflowParserTest.java
+++ /dev/null
@@ -1,119 +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.workflow.core.parser;
-
-import org.apache.airavata.model.application.io.DataType;
-import org.apache.airavata.model.application.io.InputDataObjectType;
-import org.apache.airavata.model.experiment.ExperimentModel;
-import org.apache.airavata.workflow.core.dag.nodes.ApplicationNode;
-import org.apache.airavata.workflow.core.dag.nodes.WorkflowInputNode;
-import org.apache.airavata.workflow.core.dag.nodes.WorkflowNode;
-import org.apache.airavata.workflow.core.dag.nodes.WorkflowOutputNode;
-import org.apache.airavata.workflow.model.wf.Workflow;
-import org.junit.After;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Test;
-
-import java.io.BufferedReader;
-import java.io.InputStreamReader;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-
-public class AiravataWorkflowParserTest {
-
-    @Before
-    public void setUp() throws Exception {
-
-    }
-
-    @After
-    public void tearDown() throws Exception {
-
-    }
-
-    @Test
-    public void testWorkflowParse() throws Exception {
-        Assert.assertNotNull("Test file (ComplexMathWorkflow.awf) is missing", getClass().getResource("/ComplexMathWorkflow.awf"));
-        InputStreamReader isr = new InputStreamReader(this.getClass().getResourceAsStream("/ComplexMathWorkflow.awf"));
-        BufferedReader br = new BufferedReader(isr);
-        StringBuffer sb = new StringBuffer();
-        String nextLine = br.readLine();
-        while (nextLine != null) {
-            sb.append(nextLine);
-            nextLine = br.readLine();
-        }
-        Workflow workflow = new Workflow(sb.toString());
-        ExperimentModel experiment = new ExperimentModel();
-        InputDataObjectType x = new InputDataObjectType();
-        x.setValue("6");
-        x.setType(DataType.STRING);
-        x.setName("x");
-
-        InputDataObjectType y = new InputDataObjectType();
-        y.setValue("8");
-        y.setType(DataType.STRING);
-        y.setName("y");
-
-        InputDataObjectType z = new InputDataObjectType();
-        z.setValue("10");
-        z.setType(DataType.STRING);
-        z.setName("y_2");
-
-        List<InputDataObjectType> inputs = new ArrayList<InputDataObjectType>();
-        inputs.add(x);
-        inputs.add(y);
-        inputs.add(z);
-        experiment.setExperimentInputs(inputs);
-        // create parser
-        AiravataWorkflowParser parser = new AiravataWorkflowParser(experiment, "testCredentialId");
-        List<WorkflowInputNode> workflowInputNodes = parser.parseWorkflow(workflow);
-        Assert.assertNotNull(workflowInputNodes);
-        Assert.assertEquals(3, workflowInputNodes.size());
-        for (WorkflowInputNode workflowInputNode : workflowInputNodes) {
-            Assert.assertNotNull(workflowInputNode.getOutPort());
-            Assert.assertNotNull(workflowInputNode.getInputObject());
-        }
-
-        Map<String, WorkflowNode> wfNodes = parser.getWfNodes();
-        for (String wfId : wfNodes.keySet()) {
-            WorkflowNode wfNode = wfNodes.get(wfId);
-            if (wfNode instanceof ApplicationNode) {
-                ApplicationNode node = (ApplicationNode) wfNode;
-                Assert.assertEquals(2, node.getInputPorts().size());
-                Assert.assertNotNull(node.getInputPorts().get(0).getInputObject());
-                Assert.assertNotNull(node.getInputPorts().get(1).getInputObject());
-                Assert.assertNotNull(node.getInputPorts().get(0).getEdge());
-                Assert.assertNotNull(node.getInputPorts().get(1).getEdge());
-
-                Assert.assertEquals(1, node.getOutputPorts().size());
-                Assert.assertEquals(1, node.getOutputPorts().get(0).getOutEdges().size());
-                Assert.assertNotNull(node.getOutputPorts().get(0).getOutEdges().get(0));
-            } else if (wfNode instanceof WorkflowOutputNode) {
-                WorkflowOutputNode workflowOutputNode = (WorkflowOutputNode) wfNode;
-                Assert.assertNotNull(workflowOutputNode.getInPort());
-            }
-        }
-
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/airavata/blob/225f462b/modules/workflow/workflow-core/src/test/java/org/apache/airavata/workflow/core/parser/JsonWorkflowParserTest.java
----------------------------------------------------------------------
diff --git a/modules/workflow/workflow-core/src/test/java/org/apache/airavata/workflow/core/parser/JsonWorkflowParserTest.java b/modules/workflow/workflow-core/src/test/java/org/apache/airavata/workflow/core/parser/JsonWorkflowParserTest.java
new file mode 100644
index 0000000..95a2579
--- /dev/null
+++ b/modules/workflow/workflow-core/src/test/java/org/apache/airavata/workflow/core/parser/JsonWorkflowParserTest.java
@@ -0,0 +1,130 @@
+/*
+ *
+ * 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.workflow.core.parser;
+
+import org.apache.airavata.model.application.io.DataType;
+import org.apache.airavata.model.application.io.InputDataObjectType;
+import org.apache.airavata.model.experiment.ExperimentModel;
+import org.apache.airavata.workflow.core.WorkflowParser;
+import org.apache.airavata.workflow.core.dag.nodes.ApplicationNode;
+import org.apache.airavata.workflow.core.dag.nodes.InputNode;
+import org.apache.airavata.workflow.core.dag.nodes.WorkflowNode;
+import org.apache.airavata.workflow.core.dag.nodes.OutputNode;
+import org.junit.After;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+
+import java.io.BufferedReader;
+import java.io.InputStreamReader;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+public class JsonWorkflowParserTest {
+
+    @Before
+    public void setUp() throws Exception {
+
+    }
+
+    @After
+    public void tearDown() throws Exception {
+
+    }
+
+    @Test
+    public void testWorkflowParse() throws Exception {
+        Assert.assertNotNull("Test file (ComplexMathWorkflow.awf) is missing", getClass().getResource("/ComplexMathWorkflow.awf"));
+        InputStreamReader isr = new InputStreamReader(this.getClass().getResourceAsStream("/ComplexMathWorkflow.awf"));
+        BufferedReader br = new BufferedReader(isr);
+        StringBuffer sb = new StringBuffer();
+        String nextLine = br.readLine();
+        while (nextLine != null) {
+            sb.append(nextLine);
+            nextLine = br.readLine();
+        }
+//        Workflow workflow = new Workflow(sb.toString());
+        ExperimentModel experiment = new ExperimentModel();
+        InputDataObjectType x = new InputDataObjectType();
+        x.setValue("6");
+        x.setType(DataType.STRING);
+        x.setName("x");
+
+        InputDataObjectType y = new InputDataObjectType();
+        y.setValue("8");
+        y.setType(DataType.STRING);
+        y.setName("y");
+
+        InputDataObjectType z = new InputDataObjectType();
+        z.setValue("10");
+        z.setType(DataType.STRING);
+        z.setName("y_2");
+
+        List<InputDataObjectType> inputs = new ArrayList<InputDataObjectType>();
+        inputs.add(x);
+        inputs.add(y);
+        inputs.add(z);
+        experiment.setExperimentInputs(inputs);
+        // create parser
+        WorkflowParser parser = new JsonWorkflowParser("workflow string");
+        parser.parse();
+        List<InputNode> inputNodes = parser.getInputNodes();
+        Assert.assertNotNull(inputNodes);
+        Assert.assertEquals(3, inputNodes.size());
+        for (InputNode inputNode : inputNodes) {
+            Assert.assertNotNull(inputNode.getOutPort());
+            Assert.assertNotNull(inputNode.getInputObject());
+        }
+
+        Map<String, WorkflowNode> wfNodes = getWorkflowNodeMap(parser.getApplicationNodes());
+        for (String wfId : wfNodes.keySet()) {
+            WorkflowNode wfNode = wfNodes.get(wfId);
+            if (wfNode instanceof ApplicationNode) {
+                ApplicationNode node = (ApplicationNode) wfNode;
+                Assert.assertEquals(2, node.getInputPorts().size());
+                Assert.assertNotNull(node.getInputPorts().get(0).getInputObject());
+                Assert.assertNotNull(node.getInputPorts().get(1).getInputObject());
+                Assert.assertNotNull(node.getInputPorts().get(0).getEdge());
+                Assert.assertNotNull(node.getInputPorts().get(1).getEdge());
+
+                Assert.assertEquals(1, node.getOutputPorts().size());
+                Assert.assertEquals(1, node.getOutputPorts().get(0).getOutEdges().size());
+                Assert.assertNotNull(node.getOutputPorts().get(0).getOutEdges().get(0));
+            } else if (wfNode instanceof OutputNode) {
+                OutputNode outputNode = (OutputNode) wfNode;
+                Assert.assertNotNull(outputNode.getInPort());
+            }
+        }
+
+    }
+
+    private Map<String, WorkflowNode> getWorkflowNodeMap(List<ApplicationNode> applicationNodes) {
+        Map<String, WorkflowNode> map = new HashMap<>();
+        for (ApplicationNode applicationNode : applicationNodes) {
+            map.put(applicationNode.getApplicationId(), applicationNode);
+        }
+
+        return map;
+    }
+}
\ No newline at end of file


Mime
View raw message