airavata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From shame...@apache.org
Subject [05/50] [abbrv] airavata git commit: Remove workflow engine class from the module
Date Thu, 26 Mar 2015 17:08:04 GMT
Remove workflow engine class from the module


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

Branch: refs/heads/master
Commit: 9fcf22671b1423ca15d8953c51a4e12bdaf00fe0
Parents: 263522a
Author: shamrath <shameerainfo@gmail.com>
Authored: Mon Feb 16 22:11:08 2015 -0500
Committer: shamrath <shameerainfo@gmail.com>
Committed: Mon Feb 16 22:11:08 2015 -0500

----------------------------------------------------------------------
 .../workflow/engine/SimpleWorkflowEngine.java   | 31 --------------------
 .../engine/SimpleWorkflowInterpreter.java       | 11 +++++--
 .../simple/workflow/engine/WorkflowFactory.java |  2 +-
 .../workflow/engine/WorkflowFactoryImpl.java    | 19 ++++++++++--
 .../engine/parser/AiravataDefaultParser.java    |  7 +++--
 .../parser/AiravataDefaultParserTest.java       |  4 +++
 6 files changed, 35 insertions(+), 39 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/airavata/blob/9fcf2267/modules/simple-workflow/src/main/java/org/apache/ariavata/simple/workflow/engine/SimpleWorkflowEngine.java
----------------------------------------------------------------------
diff --git a/modules/simple-workflow/src/main/java/org/apache/ariavata/simple/workflow/engine/SimpleWorkflowEngine.java
b/modules/simple-workflow/src/main/java/org/apache/ariavata/simple/workflow/engine/SimpleWorkflowEngine.java
deleted file mode 100644
index ff057fb..0000000
--- a/modules/simple-workflow/src/main/java/org/apache/ariavata/simple/workflow/engine/SimpleWorkflowEngine.java
+++ /dev/null
@@ -1,31 +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.ariavata.simple.workflow.engine;
-
-public class SimpleWorkflowEngine{
-
-
-    public void invoke () {
-        WorkflowParser parser = WorkflowFactoryImpl.getInstance().getWorkflowParser();
-
-    }
-}

http://git-wip-us.apache.org/repos/asf/airavata/blob/9fcf2267/modules/simple-workflow/src/main/java/org/apache/ariavata/simple/workflow/engine/SimpleWorkflowInterpreter.java
----------------------------------------------------------------------
diff --git a/modules/simple-workflow/src/main/java/org/apache/ariavata/simple/workflow/engine/SimpleWorkflowInterpreter.java
b/modules/simple-workflow/src/main/java/org/apache/ariavata/simple/workflow/engine/SimpleWorkflowInterpreter.java
index b4bc9a2..3d5b99a 100644
--- a/modules/simple-workflow/src/main/java/org/apache/ariavata/simple/workflow/engine/SimpleWorkflowInterpreter.java
+++ b/modules/simple-workflow/src/main/java/org/apache/ariavata/simple/workflow/engine/SimpleWorkflowInterpreter.java
@@ -52,7 +52,7 @@ import java.util.List;
 import java.util.Map;
 import java.util.Set;
 
-public class SimpleWorkflowInterpreter {
+public class SimpleWorkflowInterpreter implements Runnable{
 
 
     private List<WorkflowInputNode> workflowInputNodes;
@@ -151,6 +151,7 @@ public class SimpleWorkflowInterpreter {
         Set<WorkflowNode> tempNodeSet = new HashSet<WorkflowNode>();
         for (WorkflowInputNode wfInputNode : wfInputNodes) {
             if (wfInputNode.isSatisfy()) {
+
 //                for (Edge edge : wfInputNode.getOutputLinks()) {
 //                    WorkflowUtil.copyValues(wfInputNode.getInputObject(), edge.getToPort().getInputObject());
 //                    tempNodeSet.add(edge.getToPort().getNode());
@@ -171,7 +172,8 @@ public class SimpleWorkflowInterpreter {
         if (workflowInputNodes == null) {
             // read workflow description from registry and parse it
             WorkflowFactoryImpl wfFactory = WorkflowFactoryImpl.getInstance();
-            List<WorkflowInputNode> wfInputNodes = wfFactory.getWorkflowParser().parse();
+            List<WorkflowInputNode> wfInputNodes = wfFactory.getWorkflowParser(experiment.getExperimentID(),
+                    credentialToken).parse();
             setWorkflowInputNodes(wfInputNodes);
         }
         return workflowInputNodes;
@@ -287,4 +289,9 @@ public class SimpleWorkflowInterpreter {
         }
 
     }
+
+    @Override
+    public void run() {
+        // TODO: Auto generated method body.
+    }
 }

http://git-wip-us.apache.org/repos/asf/airavata/blob/9fcf2267/modules/simple-workflow/src/main/java/org/apache/ariavata/simple/workflow/engine/WorkflowFactory.java
----------------------------------------------------------------------
diff --git a/modules/simple-workflow/src/main/java/org/apache/ariavata/simple/workflow/engine/WorkflowFactory.java
b/modules/simple-workflow/src/main/java/org/apache/ariavata/simple/workflow/engine/WorkflowFactory.java
index 867bc80..6cfceaf 100644
--- a/modules/simple-workflow/src/main/java/org/apache/ariavata/simple/workflow/engine/WorkflowFactory.java
+++ b/modules/simple-workflow/src/main/java/org/apache/ariavata/simple/workflow/engine/WorkflowFactory.java
@@ -5,6 +5,6 @@ package org.apache.ariavata.simple.workflow.engine;
  */
 public interface WorkflowFactory {
 
-    public WorkflowParser getWorkflowParser();
+    public WorkflowParser getWorkflowParser(String experimentId, String credentialToken);
 
 }

http://git-wip-us.apache.org/repos/asf/airavata/blob/9fcf2267/modules/simple-workflow/src/main/java/org/apache/ariavata/simple/workflow/engine/WorkflowFactoryImpl.java
----------------------------------------------------------------------
diff --git a/modules/simple-workflow/src/main/java/org/apache/ariavata/simple/workflow/engine/WorkflowFactoryImpl.java
b/modules/simple-workflow/src/main/java/org/apache/ariavata/simple/workflow/engine/WorkflowFactoryImpl.java
index a43f010..f84acc9 100644
--- a/modules/simple-workflow/src/main/java/org/apache/ariavata/simple/workflow/engine/WorkflowFactoryImpl.java
+++ b/modules/simple-workflow/src/main/java/org/apache/ariavata/simple/workflow/engine/WorkflowFactoryImpl.java
@@ -21,6 +21,8 @@
 
 package org.apache.ariavata.simple.workflow.engine;
 
+import org.apache.ariavata.simple.workflow.engine.parser.AiravataDefaultParser;
+
 /**
  * Singleton class, only one instance can exist in runtime.
  */
@@ -28,6 +30,9 @@ public class WorkflowFactoryImpl implements WorkflowFactory {
 
     private static WorkflowFactoryImpl workflowFactoryImpl;
 
+    private WorkflowEnactor workflowEnactor;
+    private WorkflowParser workflowParser;
+
     private WorkflowFactoryImpl(){
 
     }
@@ -45,8 +50,18 @@ public class WorkflowFactoryImpl implements WorkflowFactory {
 
 
     @Override
-    public WorkflowParser getWorkflowParser() {
+    public WorkflowParser getWorkflowParser(String experimentId, String credentialToken)
{
+        if (workflowParser == null) {
+            workflowParser = new AiravataDefaultParser(experimentId, credentialToken);
+        }
+        return workflowParser;
+    }
 
-        return null; // TODO: Auto generated method body.
+    @Override
+    public WorkflowEnactor getWorkflowEnactor() {
+        if (workflowEnactor == null) {
+            workflowEnactor = new WorkflowEnactor();
+        }
+        return workflowEnactor;
     }
 }

http://git-wip-us.apache.org/repos/asf/airavata/blob/9fcf2267/modules/simple-workflow/src/main/java/org/apache/ariavata/simple/workflow/engine/parser/AiravataDefaultParser.java
----------------------------------------------------------------------
diff --git a/modules/simple-workflow/src/main/java/org/apache/ariavata/simple/workflow/engine/parser/AiravataDefaultParser.java
b/modules/simple-workflow/src/main/java/org/apache/ariavata/simple/workflow/engine/parser/AiravataDefaultParser.java
index baca99e..62a76b3 100644
--- a/modules/simple-workflow/src/main/java/org/apache/ariavata/simple/workflow/engine/parser/AiravataDefaultParser.java
+++ b/modules/simple-workflow/src/main/java/org/apache/ariavata/simple/workflow/engine/parser/AiravataDefaultParser.java
@@ -125,7 +125,7 @@ public class AiravataDefaultParser implements WorkflowParser {
         DataPort dataPort = null;
         InPort inPort = null;
         ApplicationNode wfApplicationNode = null;
-        WorkflowOutputNode wfOutportNode = null;
+        WorkflowOutputNode wfOutputNode = null;
         List<PortContainer> nextPortContainerList = new ArrayList<PortContainer>();
         for (PortContainer portContainer : portContainerList) {
             dataPort = portContainer.getDataPort();
@@ -150,8 +150,9 @@ public class AiravataDefaultParser implements WorkflowParser {
 
             }else if (node instanceof OutputNode) {
                 OutputNode oNode = (OutputNode) node;
-                wfOutportNode = new WorkflowOutputNodeImpl(oNode.getID(), oNode.getName());
-                wfOutportNode.setInPort(inPort);
+                wfOutputNode = new WorkflowOutputNodeImpl(oNode.getID(), oNode.getName());
+                wfOutputNode.setInPort(inPort);
+                wfNodes.put(wfOutputNode.getNodeId(), wfOutputNode);
             }
             // set the workflow node to inPort
             // if require check the types of inputs and output ports,

http://git-wip-us.apache.org/repos/asf/airavata/blob/9fcf2267/modules/simple-workflow/src/test/java/org/apache/ariavata/simple/workflow/engine/parser/AiravataDefaultParserTest.java
----------------------------------------------------------------------
diff --git a/modules/simple-workflow/src/test/java/org/apache/ariavata/simple/workflow/engine/parser/AiravataDefaultParserTest.java
b/modules/simple-workflow/src/test/java/org/apache/ariavata/simple/workflow/engine/parser/AiravataDefaultParserTest.java
index ea955d8..1f8e9c8 100644
--- a/modules/simple-workflow/src/test/java/org/apache/ariavata/simple/workflow/engine/parser/AiravataDefaultParserTest.java
+++ b/modules/simple-workflow/src/test/java/org/apache/ariavata/simple/workflow/engine/parser/AiravataDefaultParserTest.java
@@ -8,6 +8,7 @@ import org.apache.airavata.workflow.model.wf.Workflow;
 import org.apache.ariavata.simple.workflow.engine.dag.nodes.ApplicationNode;
 import org.apache.ariavata.simple.workflow.engine.dag.nodes.WorkflowInputNode;
 import org.apache.ariavata.simple.workflow.engine.dag.nodes.WorkflowNode;
+import org.apache.ariavata.simple.workflow.engine.dag.nodes.WorkflowOutputNode;
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
@@ -77,6 +78,9 @@ public class AiravataDefaultParserTest {
                 ApplicationNode node = (ApplicationNode) wfNode;
                 Assert.assertEquals(2, node.getInputPorts().size());
                 Assert.assertEquals(1, node.getOutputPorts().size());
+            }else if (wfNode instanceof WorkflowOutputNode) {
+                WorkflowOutputNode workflowOutputNode = (WorkflowOutputNode) wfNode;
+                Assert.assertNotNull(workflowOutputNode.getInPort());
             }
         }
 


Mime
View raw message