You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airavata.apache.org by sa...@apache.org on 2014/04/14 20:30:19 UTC
[17/90] [abbrv] [partial] AIRAVATA-1124
http://git-wip-us.apache.org/repos/asf/airavata/blob/0e2c10f5/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/globus/GridFTPFileTransferClient.java
----------------------------------------------------------------------
diff --git a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/globus/GridFTPFileTransferClient.java b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/globus/GridFTPFileTransferClient.java
deleted file mode 100644
index 7d6530b..0000000
--- a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/globus/GridFTPFileTransferClient.java
+++ /dev/null
@@ -1,238 +0,0 @@
-///*
-// *
-// * Licensed to the Apache Software Foundation (ASF) under one
-// * or more contributor license agreements. See the NOTICE file
-// * distributed with this work for additional information
-// * regarding copyright ownership. The ASF licenses this file
-// * to you under the Apache License, Version 2.0 (the
-// * "License"); you may not use this file except in compliance
-// * with the License. You may obtain a copy of the License at
-// *
-// * http://www.apache.org/licenses/LICENSE-2.0
-// *
-// * Unless required by applicable law or agreed to in writing,
-// * software distributed under the License is distributed on an
-// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// * KIND, either express or implied. See the License for the
-// * specific language governing permissions and limitations
-// * under the License.
-// *
-// */
-//
-//package org.apache.airavata.xbaya.globus;
-//
-//import org.globusonline.transfer.APIError;
-//import org.globusonline.transfer.BaseTransferAPIClient;
-//import org.globusonline.transfer.JSONTransferAPIClient;
-//import org.json.JSONArray;
-//import org.json.JSONException;
-//import org.json.JSONObject;
-//
-//import java.io.IOException;
-//import java.security.GeneralSecurityException;
-//import java.text.DateFormat;
-//import java.text.SimpleDateFormat;
-//import java.util.Date;
-//import java.util.HashMap;
-//import java.util.Iterator;
-//import java.util.Map;
-//
-//public class GridFTPFileTransferClient {
-// private JSONTransferAPIClient client;
-// private static DateFormat isoDateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ");
-//
-// public GridFTPFileTransferClient(JSONTransferAPIClient client) {
-// this.client = client;
-// }
-//
-// public static void main(String args[]) {
-// String username = "heshan";
-// String caFile = "/home/heshan/Dev/globusonline/transfer-api-client-java.git/trunk/ca/gd-bundle_ca.cert";
-// String certFile = "/tmp/x509up_u780936";
-// String keyFile = "/tmp/x509up_u780936";
-// String baseUrl = null;
-//
-// String sourceEndpoint = "xsede#ranger";
-// String sourceFilePath = "~/tmp.log";
-// String destEndpoint = "xsede#trestles";
-// String destFilePath = "~/tmp.log.copy";
-//
-// // String destEndpoint = "heshan#my_testEndpoint";
-// // String sourceFilePath = "~/var_tables.mod";
-// try {
-// JSONTransferAPIClient c = new JSONTransferAPIClient(username, caFile, certFile, keyFile, baseUrl);
-// System.out.println("base url: " + c.getBaseUrl());
-// GridFTPFileTransferClient e = new GridFTPFileTransferClient(c);
-// e.transfer(sourceEndpoint, sourceFilePath, destEndpoint, destFilePath);
-// } catch (Exception e) {
-// e.printStackTrace();
-// }
-// }
-//
-// /**
-// * Transfers a file from source endpoint to destination endpoint.
-// *
-// * @param sourceEndpoint
-// * Source endpoint
-// * @param sourceFilePath
-// * Source file path
-// * @param destEndpoint
-// * Destination endpoint
-// * @param destFilePath
-// * Destination file path
-// * @throws IOException
-// * IOException
-// * @throws JSONException
-// * JSONException
-// * @throws GeneralSecurityException
-// * GeneralSecurityException
-// * @throws APIError
-// * APIError
-// */
-// public void transfer(String sourceEndpoint, String sourceFilePath, String destEndpoint, String destFilePath)
-// throws IOException, JSONException, GeneralSecurityException, APIError {
-// System.out.println("Starting transfer...");
-//
-// // displayTasksummary();
-// // displayTaskList(60 * 60 * 24 * 7); // tasks at most a week old
-// // displayEndpointList();
-//
-// if (!autoActivate(sourceEndpoint) || !autoActivate(destEndpoint)) {
-// System.err.println("Unable to auto activate go tutorial endpoints, " + " exiting");
-// return;
-// }
-//
-// // displayLs(sourceEndpoint, "~");
-// // displayLs(destEndpoint, "~");
-//
-// JSONTransferAPIClient.Result r = client.getResult(FileTransferConstants.SUBMISSION_ID_ENDPOINT);
-// String submissionId = r.document.getString(FileTransferConstants.VALUE);
-// JSONObject transfer = new JSONObject();
-// transfer.put(FileTransferConstants.DATA_TYPE, FileTransferConstants.TRANSFER);
-// transfer.put(FileTransferConstants.SUBMISSION_ID, submissionId);
-// JSONObject item = new JSONObject();
-// item.put(FileTransferConstants.DATA_TYPE, FileTransferConstants.TRANSFER_ITEM);
-// item.put(FileTransferConstants.SOURCE_ENDPOINT, sourceEndpoint);
-// item.put(FileTransferConstants.SOURCE_PATH, sourceFilePath);
-// item.put(FileTransferConstants.DESTINATION_ENDPOINT, destEndpoint);
-// item.put(FileTransferConstants.DESTINATION_PATH, destFilePath);
-// transfer.append(FileTransferConstants.DATA, item);
-//
-// r = client.postResult(FileTransferConstants.TRANSFER_ENDPOINT, transfer.toString(), null);
-// String taskId = r.document.getString(FileTransferConstants.TASK_ID);
-// if (!waitForTask(taskId, 120)) {
-// System.out.println("Transfer not complete after 2 minutes, exiting");
-// return;
-// }
-//
-// System.out.println("Transfer completed...");
-//
-// // displayTasksummary();
-// // displayLs(destEndpoint, "~");
-// }
-//
-// public void displayTasksummary() throws IOException, JSONException, GeneralSecurityException, APIError {
-// JSONTransferAPIClient.Result r = client.getResult("/tasksummary");
-// System.out.println("Task Summary for " + client.getUsername() + ": ");
-// Iterator keysIter = r.document.sortedKeys();
-// while (keysIter.hasNext()) {
-// String key = (String) keysIter.next();
-// if (!key.equals("DATA_TYPE"))
-// System.out.println(" " + key + ": " + r.document.getString(key));
-// }
-// }
-//
-// public void displayTaskList(long maxAge) throws IOException, JSONException, GeneralSecurityException, APIError {
-// Map<String, String> params = new HashMap<String, String>();
-// if (maxAge > 0) {
-// long minTime = System.currentTimeMillis() - 1000 * maxAge;
-// params.put("filter", "request_time:" + isoDateFormat.format(new Date(minTime)) + ",");
-// }
-// JSONTransferAPIClient.Result r = client.getResult("/task_list", params);
-//
-// int length = r.document.getInt("length");
-// if (length == 0) {
-// System.out.println("No tasks were submitted in the last " + maxAge + " seconds");
-// return;
-// }
-// JSONArray tasksArray = r.document.getJSONArray("DATA");
-// for (int i = 0; i < tasksArray.length(); i++) {
-// JSONObject taskObject = tasksArray.getJSONObject(i);
-// System.out.println("Task " + taskObject.getString("task_id") + ":");
-// displayTask(taskObject);
-// }
-// }
-//
-// private static void displayTask(JSONObject taskObject) throws JSONException {
-// Iterator keysIter = taskObject.sortedKeys();
-// while (keysIter.hasNext()) {
-// String key = (String) keysIter.next();
-// if (!key.equals("DATA_TYPE") && !key.equals("LINKS") && !key.endsWith("_link")) {
-// System.out.println(" " + key + ": " + taskObject.getString(key));
-// }
-// }
-// }
-//
-// public boolean autoActivate(String endpointName) throws IOException, JSONException, GeneralSecurityException,
-// APIError {
-// // Note: in a later release, auto-activation will be done at
-// // /autoactivate instead.
-// String resource = BaseTransferAPIClient.endpointPath(endpointName) + "/autoactivate";
-// JSONTransferAPIClient.Result r = client.postResult(resource, null, null);
-// String code = r.document.getString("code");
-// if (code.startsWith("AutoActivationFailed")) {
-// return false;
-// }
-// return true;
-// }
-//
-// public void displayLs(String endpointName, String path) throws IOException, JSONException,
-// GeneralSecurityException, APIError {
-// Map<String, String> params = new HashMap<String, String>();
-// if (path != null) {
-// params.put("path", path);
-// }
-// String resource = BaseTransferAPIClient.endpointPath(endpointName) + "/ls";
-// JSONTransferAPIClient.Result r = client.getResult(resource, params);
-// System.out.println("Contents of " + path + " on " + endpointName + ":");
-//
-// JSONArray fileArray = r.document.getJSONArray("DATA");
-// for (int i = 0; i < fileArray.length(); i++) {
-// JSONObject fileObject = fileArray.getJSONObject(i);
-// System.out.println(" " + fileObject.getString("name"));
-// Iterator keysIter = fileObject.sortedKeys();
-// while (keysIter.hasNext()) {
-// String key = (String) keysIter.next();
-// if (!key.equals("DATA_TYPE") && !key.equals("LINKS") && !key.endsWith("_link") && !key.equals("name")) {
-// System.out.println(" " + key + ": " + fileObject.getString(key));
-// }
-// }
-// }
-//
-// }
-//
-// public boolean waitForTask(String taskId, int timeout) throws IOException, JSONException, GeneralSecurityException,
-// APIError {
-// String status = "ACTIVE";
-// JSONTransferAPIClient.Result r;
-//
-// String resource = "/task/" + taskId;
-// Map<String, String> params = new HashMap<String, String>();
-// params.put("fields", "status");
-//
-// while (timeout > 0 && status.equals("ACTIVE")) {
-// r = client.getResult(resource, params);
-// status = r.document.getString("status");
-// try {
-// Thread.sleep(10000);
-// } catch (InterruptedException e) {
-// return false;
-// }
-// timeout -= 10;
-// }
-//
-// if (status.equals("ACTIVE"))
-// return false;
-// return true;
-// }
-//}
http://git-wip-us.apache.org/repos/asf/airavata/blob/0e2c10f5/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/graph/controller/NodeController.java
----------------------------------------------------------------------
diff --git a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/graph/controller/NodeController.java b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/graph/controller/NodeController.java
deleted file mode 100644
index 3ecf54c..0000000
--- a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/graph/controller/NodeController.java
+++ /dev/null
@@ -1,199 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.airavata.xbaya.graph.controller;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import org.apache.airavata.workflow.model.graph.Edge;
-import org.apache.airavata.workflow.model.graph.Graph;
-import org.apache.airavata.workflow.model.graph.GraphPiece;
-import org.apache.airavata.workflow.model.graph.Node;
-import org.apache.airavata.workflow.model.graph.Node.NodeExecutionState;
-import org.apache.airavata.workflow.model.graph.Port;
-import org.apache.airavata.workflow.model.graph.amazon.InstanceNode;
-import org.apache.airavata.workflow.model.graph.amazon.TerminateInstanceNode;
-import org.apache.airavata.workflow.model.graph.dynamic.DynamicNode;
-import org.apache.airavata.workflow.model.graph.subworkflow.SubWorkflowNode;
-import org.apache.airavata.workflow.model.graph.system.BlockNode;
-import org.apache.airavata.workflow.model.graph.system.ConstantNode;
-import org.apache.airavata.workflow.model.graph.system.DifferedInputNode;
-import org.apache.airavata.workflow.model.graph.system.DoWhileNode;
-import org.apache.airavata.workflow.model.graph.system.EndBlockNode;
-import org.apache.airavata.workflow.model.graph.system.EndDoWhileNode;
-import org.apache.airavata.workflow.model.graph.system.EndForEachNode;
-import org.apache.airavata.workflow.model.graph.system.EndifNode;
-import org.apache.airavata.workflow.model.graph.system.ExitNode;
-import org.apache.airavata.workflow.model.graph.system.ForEachNode;
-import org.apache.airavata.workflow.model.graph.system.IfNode;
-import org.apache.airavata.workflow.model.graph.system.InputNode;
-import org.apache.airavata.workflow.model.graph.system.MemoNode;
-import org.apache.airavata.workflow.model.graph.system.OutputNode;
-import org.apache.airavata.workflow.model.graph.system.ReceiveNode;
-import org.apache.airavata.workflow.model.graph.system.S3InputNode;
-import org.apache.airavata.workflow.model.graph.system.StreamSourceNode;
-import org.apache.airavata.workflow.model.graph.ws.WSNode;
-import org.apache.airavata.workflow.model.graph.ws.WorkflowNode;
-import org.apache.airavata.xbaya.ui.graph.EdgeGUI;
-import org.apache.airavata.xbaya.ui.graph.GraphGUI;
-import org.apache.airavata.xbaya.ui.graph.GraphPieceGUI;
-import org.apache.airavata.xbaya.ui.graph.NodeGUI;
-import org.apache.airavata.xbaya.ui.graph.PortGUI;
-import org.apache.airavata.xbaya.ui.graph.amazon.InstanceNodeGUI;
-import org.apache.airavata.xbaya.ui.graph.amazon.TerminateInstanceNodeGUI;
-import org.apache.airavata.xbaya.ui.graph.dynamic.DynamicNodeGUI;
-import org.apache.airavata.xbaya.ui.graph.subworkflow.SubWorkflowNodeGUI;
-import org.apache.airavata.xbaya.ui.graph.system.BlockNodeGUI;
-import org.apache.airavata.xbaya.ui.graph.system.ConstantNodeGUI;
-import org.apache.airavata.xbaya.ui.graph.system.DifferedInputNodeGUI;
-import org.apache.airavata.xbaya.ui.graph.system.DoWhileNodeGUI;
-import org.apache.airavata.xbaya.ui.graph.system.EndBlockNodeGUI;
-import org.apache.airavata.xbaya.ui.graph.system.EndDoWhileNodeGUI;
-import org.apache.airavata.xbaya.ui.graph.system.EndForEachNodeGUI;
-import org.apache.airavata.xbaya.ui.graph.system.EndifNodeGUI;
-import org.apache.airavata.xbaya.ui.graph.system.ExitNodeGUI;
-import org.apache.airavata.xbaya.ui.graph.system.ForEachNodeGUI;
-import org.apache.airavata.xbaya.ui.graph.system.IfNodeGUI;
-import org.apache.airavata.xbaya.ui.graph.system.InputNodeGUI;
-import org.apache.airavata.xbaya.ui.graph.system.MemoNodeGUI;
-import org.apache.airavata.xbaya.ui.graph.system.OutputNodeGUI;
-import org.apache.airavata.xbaya.ui.graph.system.ReceiveNodeGUI;
-import org.apache.airavata.xbaya.ui.graph.system.S3InputNodeGUI;
-import org.apache.airavata.xbaya.ui.graph.system.StreamSourceNodeGUI;
-import org.apache.airavata.xbaya.ui.graph.ws.WSNodeGUI;
-import org.apache.airavata.xbaya.ui.graph.ws.WorkflowNodeGUI;
-
-public class NodeController {
- private static Map<GraphPiece,GraphPieceGUI> nodeMap=new HashMap<GraphPiece, GraphPieceGUI>();
-// private static Map<Port,PortGUI> portMap=new HashMap<Port, PortGUI>();
-
- public static GraphPieceGUI getGUI(GraphPiece node){
- if (!nodeMap.containsKey(node)){
- nodeMap.put(node,createNodeGUI(node));
- }
- return nodeMap.get(node);
- }
-
- public static GraphGUI getGUI(Graph node){
- return (GraphGUI)getGUI((GraphPiece)node);
- }
-
- public static NodeGUI getGUI(Node node){
- return (NodeGUI)getGUI((GraphPiece)node);
- }
-
- public static EdgeGUI getGUI(Edge port){
- return (EdgeGUI)getGUI((GraphPiece)port);
- }
-
- public static PortGUI getGUI(Port port){
- return (PortGUI)getGUI((GraphPiece)port);
- }
-
-// public static PortGUI getGUI(Port node){
-// if (!portMap.containsKey(node)){
-// portMap.put(node,createPortGUI(node));
-// }
-// return portMap.get(node);
-// }
-//
-// private static PortGUI createPortGUI(Port port){
-// PortGUI portGUI=new PortGUI(port);
-// return portGUI;
-// }
-
- private static GraphPieceGUI createNodeGUI(GraphPiece node){
- GraphPieceGUI nodeGUI=null;
- if (node instanceof SubWorkflowNode){
- nodeGUI=new SubWorkflowNodeGUI((SubWorkflowNode)node);
- } else if (node instanceof DynamicNode){
- nodeGUI=new DynamicNodeGUI((DynamicNode)node);
- } else if (node instanceof ConstantNode){
- nodeGUI=new ConstantNodeGUI((ConstantNode)node);
- } else if (node instanceof IfNode){
- nodeGUI=new IfNodeGUI((IfNode)node);
- } else if (node instanceof ExitNode){
- nodeGUI=new ExitNodeGUI((ExitNode)node);
- } else if (node instanceof OutputNode){
- nodeGUI=new OutputNodeGUI((OutputNode)node);
- } else if (node instanceof DifferedInputNode){
- nodeGUI=new DifferedInputNodeGUI((DifferedInputNode)node);
- } else if (node instanceof BlockNode){
- nodeGUI=new BlockNodeGUI((BlockNode)node);
- } else if (node instanceof EndForEachNode){
- nodeGUI=new EndForEachNodeGUI((EndForEachNode)node);
- } else if (node instanceof S3InputNode){
- nodeGUI=new S3InputNodeGUI((S3InputNode)node);
- } else if (node instanceof ForEachNode){
- nodeGUI=new ForEachNodeGUI((ForEachNode)node);
- }else if (node instanceof DoWhileNode){
- nodeGUI=new DoWhileNodeGUI((DoWhileNode)node);
- } else if (node instanceof EndDoWhileNode){
- nodeGUI=new EndDoWhileNodeGUI((EndDoWhileNode)node);
- } else if (node instanceof MemoNode){
- nodeGUI=new MemoNodeGUI((MemoNode)node);
- } else if (node instanceof ReceiveNode){
- nodeGUI=new ReceiveNodeGUI((ReceiveNode)node);
- } else if (node instanceof InputNode){
- nodeGUI=new InputNodeGUI((InputNode)node);
- } else if (node instanceof EndifNode){
- nodeGUI=new EndifNodeGUI((EndifNode)node);
- } else if (node instanceof EndBlockNode){
- nodeGUI=new EndBlockNodeGUI((EndBlockNode)node);
- } else if (node instanceof WorkflowNode){
- nodeGUI=new WorkflowNodeGUI((WorkflowNode)node);
- } else if (node instanceof WSNode){
- nodeGUI=new WSNodeGUI((WSNode)node);
-// } else if (node instanceof Graph){
-// nodeGUI=new GraphGUI((Graph)node);
-// } else if (node instanceof GraphPiece){
-// nodeGUI=new GraphPieceGUI((GraphPiece)node);
- } else if (node instanceof Port){
- nodeGUI=new PortGUI((Port)node);
- } else if (node instanceof Edge){
- nodeGUI=new EdgeGUI((Edge)node);
- } else if (node instanceof TerminateInstanceNode){
- nodeGUI=new TerminateInstanceNodeGUI((TerminateInstanceNode)node);
- } else if (node instanceof InstanceNode){
- nodeGUI=new InstanceNodeGUI((InstanceNode)node);
- } else if (node instanceof StreamSourceNode){
- nodeGUI=new StreamSourceNodeGUI((StreamSourceNode)node);
- } else if (node instanceof Graph){
- nodeGUI=new GraphGUI((Graph)node);
- }
-
- return nodeGUI;
- }
-
- public static boolean isFinished(Node node){
- return node.getState() == NodeExecutionState.FINISHED;
- }
- public static boolean isWaiting(Node node){
- return node.getState() == NodeExecutionState.WAITING;
- }
- public static boolean isRunning(Node node){
- return node.getState() == NodeExecutionState.EXECUTING;
- }
- public static boolean isFailed(Node node){
- return node.getState() == NodeExecutionState.FAILED;
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/0e2c10f5/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/interpretor/DoWhileHandler.java
----------------------------------------------------------------------
diff --git a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/interpretor/DoWhileHandler.java b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/interpretor/DoWhileHandler.java
deleted file mode 100644
index a9b1027..0000000
--- a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/interpretor/DoWhileHandler.java
+++ /dev/null
@@ -1,251 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.airavata.xbaya.interpretor;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-import java.util.concurrent.Callable;
-import java.util.concurrent.ExecutorService;
-
-import javax.xml.xpath.XPath;
-import javax.xml.xpath.XPathConstants;
-import javax.xml.xpath.XPathExpressionException;
-import javax.xml.xpath.XPathFactory;
-
-import org.apache.airavata.workflow.model.component.Component;
-import org.apache.airavata.workflow.model.component.ws.WSComponent;
-import org.apache.airavata.workflow.model.exceptions.WorkflowException;
-import org.apache.airavata.workflow.model.exceptions.WorkflowRuntimeException;
-import org.apache.airavata.workflow.model.graph.ControlPort;
-import org.apache.airavata.workflow.model.graph.DataPort;
-import org.apache.airavata.workflow.model.graph.Node;
-import org.apache.airavata.workflow.model.graph.Node.NodeExecutionState;
-import org.apache.airavata.workflow.model.graph.impl.EdgeImpl;
-import org.apache.airavata.workflow.model.graph.system.DoWhileNode;
-import org.apache.airavata.workflow.model.graph.system.EndDoWhileNode;
-import org.apache.airavata.xbaya.graph.controller.NodeController;
-import org.apache.airavata.xbaya.invoker.Invoker;
-import org.apache.airavata.xbaya.ui.monitor.MonitorEventHandler.NodeState;
-import org.apache.airavata.xbaya.util.InterpreterUtil;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class DoWhileHandler implements Callable<Boolean> {
- private static Logger log = LoggerFactory.getLogger(DoWhileHandler.class);
- private DoWhileNode dowhilenode;
- private Map<Node, Invoker> invokerMap;
- private ArrayList<Node> waitingNode;
- private ArrayList<Node> finishedNodes;
- private WorkflowInterpreter interpreter;
- private ExecutorService threadExecutor;
-
- /**
- *
- * Constructs a DoWhileHandler.
- *
- * @param node
- * @param invokerMap
- * @param waitingNode
- * @param finishedNodes
- * @param interpreter
- */
-
- public DoWhileHandler(DoWhileNode node, Map<Node, Invoker> invokerMap, ArrayList<Node> waitingNode, ArrayList<Node> finishedNodes,
- WorkflowInterpreter interpreter, ExecutorService threadExecutor) {
- this.dowhilenode = node;
- this.invokerMap = invokerMap;
- this.waitingNode = waitingNode;
- this.finishedNodes = finishedNodes;
- this.interpreter = interpreter;
- this.threadExecutor = threadExecutor;
- }
-
- /**
- * To evaluate dowhile condition with the input values
- *
- * @param doWhileNode
- * @param inputPorts
- * @param invokerMap
- * @return boolean value
- * @throws WorkFlowInterpreterException
- * @throws XBayaException
- */
- private boolean evaluate(DoWhileNode doWhileNode, List<DataPort> inputPorts, Map<Node, Invoker> invokerMap) throws WorkFlowInterpreterException,
- WorkflowException {
- String booleanExpression = doWhileNode.getXpath();
- if (booleanExpression == null) {
- throw new WorkFlowInterpreterException("XPath for if cannot be null");
- }
-
- int i = 0;
- for (DataPort port : inputPorts) {
- Object inputVal1 = InterpreterUtil.findInputFromPort(port, invokerMap);
- if (null == inputVal1) {
- throw new WorkFlowInterpreterException("Unable to find inputs for the node:" + doWhileNode.getID());
- }
- booleanExpression = booleanExpression.replaceAll("\\$" + i, "'" + inputVal1 + "'");
- i++;
- }
- Boolean result = new Boolean(false);
- // Now the XPath expression
- try {
- XPathFactory xpathFact = XPathFactory.newInstance();
- XPath xpath = xpathFact.newXPath();
- result = (Boolean) xpath.evaluate(booleanExpression, booleanExpression, XPathConstants.BOOLEAN);
- } catch (XPathExpressionException e) {
- throw new WorkFlowInterpreterException("Cannot evaluate XPath in If Condition: " + booleanExpression);
- }
- return result.booleanValue();
- }
-
- /**
- * To get only web service components attached to dowhile
- *
- * @param waitingNode
- * @return list
- */
- private ArrayList<Node> handleDowhile(ArrayList<Node> waitingNode, ArrayList<Node> finishedNodes) {
- ArrayList<Node> list = new ArrayList<Node>();
- for (Node node : waitingNode) {
- Component component = node.getComponent();
- if (component instanceof WSComponent) {
- ControlPort control = node.getControlInPort();
- boolean controlDone = true;
- if (control != null) {
- for (EdgeImpl edge : control.getEdges()) {
- controlDone = controlDone && (finishedNodes.contains(edge.getFromPort().getNode())
- || ((ControlPort) edge.getFromPort()).isConditionMet());
- }
- }
-
- /*
- * Check for input ports
- */
- List<DataPort> inputPorts = node.getInputPorts();
- boolean inputsDone = true;
- for (DataPort dataPort : inputPorts) {
- inputsDone = inputsDone && finishedNodes.contains(dataPort.getFromNode());
- }
- if (inputsDone && controlDone) {
- list.add(node);
- }
- }
- }
-
- return list;
- }
-
- /**
- * @see java.util.concurrent.Callable#call()
- */
- @Override
- public Boolean call() throws Exception {
- log.debug("Invoked Dowhile node");
- SystemComponentInvoker dowhileinvoker = new SystemComponentInvoker();
- // TODO check for multiple input case
- Object inputVal1 = InterpreterUtil.findInputFromPort(this.dowhilenode.getInputPort(0), this.invokerMap);
- dowhileinvoker.addOutput(this.dowhilenode.getOutputPort(0).getID(), inputVal1);
- this.invokerMap.put(this.dowhilenode, dowhileinvoker);
- this.finishedNodes.add(this.dowhilenode);
-
- ArrayList<Node> readyNodes = this.handleDowhile(this.waitingNode, this.finishedNodes);
-
- // When you are starting 1st time its getting input from 1st node and
- // invoking all the webservice components
- if (readyNodes.size() != 1) {
- throw new WorkflowRuntimeException("More than one dowhile execution not supported");
- }
- Node donode = readyNodes.get(0);
- this.interpreter.handleWSComponent(donode);
- log.debug("Invoked service " + donode.getName());
-
- List<DataPort> inputPorts = this.dowhilenode.getInputPorts();
- boolean runflag = true;
- while (runflag) {
- while (true) {
- if (NodeController.isRunning(donode) || NodeController.isWaiting(donode)) {
- Thread.sleep(500);
- log.debug("Service " + donode.getName() + " waiting");
- } else if (NodeController.isFinished(donode)) {
- log.debug("Service " + donode.getName() + " Finished");
- List<DataPort> ports = this.dowhilenode.getOutputPorts();
- for (int outputPortIndex = 0, inputPortIndex = 1; outputPortIndex < ports.size(); outputPortIndex++) {
- Object inputValue = InterpreterUtil.findInputFromPort(this.dowhilenode.getInputPort(inputPortIndex), this.invokerMap);
- dowhileinvoker.addOutput(this.dowhilenode.getOutputPort(outputPortIndex).getID(), inputValue);
- }
- break;
- } else if (NodeController.isFailed(donode)) {
- log.debug("Service " + donode.getName() + " Failed");
- runflag = false;
- dowhilenode.setState(NodeExecutionState.FAILED);
- this.threadExecutor.shutdown();
- return false;
- } else if (donode.isBreak()) {
- log.debug("Service " + donode.getName() + " set to break");
- runflag = false;
- break;
- } else {
- log.error("Service " + donode.getName() + " have unknow status");
- throw new WorkFlowInterpreterException("Unknow status of the node");
- }
- }
-
- this.invokerMap.put(this.dowhilenode, dowhileinvoker);
- log.debug("Going to evaluate do while expression for " + donode.getName());
- if (!evaluate(this.dowhilenode, inputPorts, this.invokerMap)) {
- log.debug("Expression evaluation is false so calling EndDoWhile");
- runflag = false;
- } else {
- if (readyNodes.size() != 1) {
- throw new WorkFlowInterpreterException("More than one dowhile execution not supported");
- }
-
- Node whileNode = readyNodes.get(0);
- log.debug("Expression evaluation is true so invoking service again " + whileNode.getName());
-
- this.interpreter.handleWSComponent(whileNode);
- }
- }
- // WS node should be done
- dowhilenode.setState(NodeExecutionState.FINISHED);
- EndDoWhileNode endDoWhileNode = this.dowhilenode.getEndDoWhileNode();
-
- // /////////////////////////////////////////////////////////
- // // Do WHile finished execution thus we can set the //////
- // //inputs to the EndDOWHile and resume the executions/////
- SystemComponentInvoker invoker = new SystemComponentInvoker();
-
- List<DataPort> inputports = endDoWhileNode.getInputPorts();
-
- for (int inputPortIndex = 0; inputPortIndex < inputports.size(); inputPortIndex++) {
- Object inputVal = dowhileinvoker.getOutput(inputports.get(inputPortIndex).getFromPort().getID());
- invoker.addOutput(endDoWhileNode.getOutputPort(inputPortIndex).getID(), inputVal);
- }
-
- this.invokerMap.put(endDoWhileNode, invoker);
- // TODO send mail once the iterations have converged
-
- endDoWhileNode.setState(NodeExecutionState.FINISHED);
- this.threadExecutor.shutdown();
- return true;
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/0e2c10f5/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/interpretor/ExperimentTemplate.java
----------------------------------------------------------------------
diff --git a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/interpretor/ExperimentTemplate.java b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/interpretor/ExperimentTemplate.java
deleted file mode 100644
index c08ee34..0000000
--- a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/interpretor/ExperimentTemplate.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.xbaya.interpretor;
-
-import java.util.List;
-
-public class ExperimentTemplate {
- private List<WorkflowExecutionTemplate> workflowExecutionTemplates;
-
- public List<WorkflowExecutionTemplate> getWorkflowExecutionTemplates() {
- return workflowExecutionTemplates;
- }
-
- public void setWorkflowExecutionTemplates(
- List<WorkflowExecutionTemplate> workflowExecutionTemplates) {
- this.workflowExecutionTemplates = workflowExecutionTemplates;
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/0e2c10f5/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/interpretor/GUIWorkflowInterpreterInteractorImpl.java
----------------------------------------------------------------------
diff --git a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/interpretor/GUIWorkflowInterpreterInteractorImpl.java b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/interpretor/GUIWorkflowInterpreterInteractorImpl.java
deleted file mode 100644
index 526610d..0000000
--- a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/interpretor/GUIWorkflowInterpreterInteractorImpl.java
+++ /dev/null
@@ -1,211 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.airavata.xbaya.interpretor;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Map;
-
-import org.apache.airavata.workflow.model.graph.Node;
-import org.apache.airavata.workflow.model.graph.ws.WSGraph;
-import org.apache.airavata.workflow.model.wf.Workflow;
-import org.apache.airavata.workflow.model.wf.WorkflowExecutionState;
-import org.apache.airavata.ws.monitor.MonitorException;
-import org.apache.airavata.xbaya.XBayaEngine;
-import org.apache.airavata.xbaya.graph.controller.NodeController;
-import org.apache.airavata.xbaya.ui.XBayaGUI;
-import org.apache.airavata.xbaya.ui.dialogs.WaitDialog;
-import org.apache.airavata.xbaya.ui.graph.subworkflow.SubWorkflowNodeGUI;
-import org.apache.airavata.xbaya.ui.graph.system.DifferedInputHandler;
-import org.apache.airavata.xbaya.ui.utils.Cancelable;
-import org.apache.airavata.xbaya.util.InterpreterUtil;
-
-public class GUIWorkflowInterpreterInteractorImpl implements
- WorkflowInterpreterInteractor {
- private XBayaGUI xbayaGUI;
- private Workflow workflow;
- private XBayaEngine engine;
-
- private Map<String, WaitDialog> taskDialogs = new HashMap<String, WaitDialog>();
-
- public GUIWorkflowInterpreterInteractorImpl(XBayaEngine engine,
- Workflow workflow) {
- this.engine = engine;
- this.xbayaGUI = engine.getGUI();
- this.setWorkflow(workflow);
- }
-
- @Override
- public boolean notify(WorkflowExecutionMessage messageType, WorkflowInterpreterConfiguration config, Object data) {
- switch (messageType) {
- case NODE_STATE_CHANGED:
- xbayaGUI.getGraphCanvas().repaint();
- break;
- case EXECUTION_STATE_CHANGED:
- WorkflowExecutionState state = (WorkflowExecutionState) data;
- // if (state==WorkflowExecutionState.PAUSED ||
- // state==WorkflowExecutionState.STOPPED) {
- // if (getWorkflow().getExecutionState() ==
- // WorkflowExecutionState.RUNNING
- // || getWorkflow().getExecutionState() ==
- // WorkflowExecutionState.STEP) {
- // } else {
- // throw new WorkflowRuntimeException(
- // "Cannot pause when not running");
- // }
- // }
- getWorkflow().setExecutionState(state);
- if (state==WorkflowExecutionState.PAUSED){
- if (config.getWorkflow().getExecutionState() == WorkflowExecutionState.RUNNING
- || config.getWorkflow().getExecutionState() == WorkflowExecutionState.STEP) {
- config.getGUI().getToolbar().getPlayAction()
- .actionPerformed(null);
- }
- }
- break;
- case EXECUTION_TASK_START:
- TaskNotification task = (TaskNotification) data;
- final WaitDialog waitDialog = new WaitDialog(new Cancelable() {
- @Override
- public void cancel() {
- // Do nothing
- }
- }, task.messageTitle, task.message, this.xbayaGUI);
- new Thread(new Runnable() {
- @Override
- public void run() {
- waitDialog.show();
- }
- }).start();
- taskDialogs.put(task.messageId, waitDialog);
- break;
- case EXECUTION_TASK_END:
- task = (TaskNotification) data;
- if (taskDialogs.containsKey(task.messageId)) {
- taskDialogs.get(task.messageId).hide();
- taskDialogs.remove(task.messageId);
- }
- break;
- case EXECUTION_ERROR:
- xbayaGUI.getErrorWindow().error((Exception) data);
- break;
- case OPEN_SUBWORKFLOW:
- ((SubWorkflowNodeGUI) NodeController.getGUI((Node) data))
- .openWorkflowTab(config.getGUI());
- break;
- case EXECUTION_CLEANUP:
- this.engine.resetWorkflowInterpreter();
- try {
- config.getMonitor().stop();
- } catch (MonitorException e) {
- e.printStackTrace();
- } finally {
- this.engine.getMonitor().resetEventData();
- }
- break;
- case HANDLE_DEPENDENT_NODES_DIFFERED_INPUTS:
- ArrayList<Node> waitingNodes = InterpreterUtil.getWaitingNodesDynamically((WSGraph)data);
- for (Node readyNode : waitingNodes) {
- DifferedInputHandler.handleDifferredInputsofDependentNodes(
- readyNode, config.getGUI());
- }
- break;
- default:
- return false;
- }
- return true;
- }
-
- @Override
- public Object retrieveData(WorkflowExecutionMessage messageType, WorkflowInterpreterConfiguration config, Object data)
- throws Exception {
- Object result = null;
- switch (messageType) {
- case INPUT_WORKFLOWINTERPRETER_FOR_WORKFLOW:
- Workflow subWorkflow= (Workflow) data;
- WorkflowInterpreterConfiguration workflowInterpreterConfiguration = new WorkflowInterpreterConfiguration(subWorkflow,config.getTopic(),config.getMessageBoxURL(), config.getMessageBrokerURL(), config.getRegistry(), config.getConfiguration(), config.getGUI(), this.engine.getMonitor());
- workflowInterpreterConfiguration.setActOnProvenance(config.isActOnProvenance());
- workflowInterpreterConfiguration.setSubWorkflow(true);
- if (config.isTestMode()){
- workflowInterpreterConfiguration.setNotifier(new StandaloneNotificationSender(workflowInterpreterConfiguration.getTopic(),workflowInterpreterConfiguration.getWorkflow()));
- }
- result = new WorkflowInterpreter(workflowInterpreterConfiguration,
- new GUIWorkflowInterpreterInteractorImpl(engine,
- config.getWorkflow()));
- this.engine.registerWorkflowInterpreter((WorkflowInterpreter)result);
- break;
-// case INPUT_GSS_CREDENTIAL:
-// MyProxyChecker myProxyChecker = new MyProxyChecker(this.engine);
-// myProxyChecker.loadIfNecessary();
-// MyProxyClient myProxyClient = this.engine.getMyProxyClient();
-// result = myProxyClient.getProxy();
-// break;
-// case INPUT_LEAD_CONTEXT_HEADER:
-// Node node = (Node) data;
-// result = XBayaUtil.buildLeadContextHeader(this.getWorkflow(),
-// config.getConfiguration(),
-// new MonitorConfiguration(config.getMessageBrokerURL(),
-// config.getTopic(), true,
-// config
-// .getMessageBoxURL()), node.getID(),
-// null);
-// break;
- default:
- break;
- }
- return result;
- }
-
- public Workflow getWorkflow() {
- return workflow;
- }
-
- public void setWorkflow(Workflow workflow) {
- this.workflow = workflow;
- }
-
- @Override
- public void pauseExecution(WorkflowInterpreterConfiguration config) {
- notify(WorkflowExecutionMessage.EXECUTION_STATE_CHANGED,config, WorkflowExecutionState.PAUSED);
- }
-
- @Override
- public void resumeExecution(WorkflowInterpreterConfiguration config) {
- notify(WorkflowExecutionMessage.EXECUTION_STATE_CHANGED,config, WorkflowExecutionState.RUNNING);
- }
-
- @Override
- public void terminateExecution(WorkflowInterpreterConfiguration config) {
- notify(WorkflowExecutionMessage.EXECUTION_STATE_CHANGED,config, WorkflowExecutionState.STOPPED);
- }
-
- @Override
- public boolean isExecutionPaused(WorkflowInterpreterConfiguration config) {
- return config.getWorkflow().getExecutionState()==WorkflowExecutionState.PAUSED;
- }
-
- @Override
- public boolean isExecutionTerminated(WorkflowInterpreterConfiguration config) {
- return config.getWorkflow().getExecutionState()==WorkflowExecutionState.STOPPED;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/0e2c10f5/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/interpretor/HeaderConstants.java
----------------------------------------------------------------------
diff --git a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/interpretor/HeaderConstants.java b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/interpretor/HeaderConstants.java
deleted file mode 100644
index 1e0bf7c..0000000
--- a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/interpretor/HeaderConstants.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.airavata.xbaya.interpretor;
-
-public interface HeaderConstants {
-
- public static final String HEADER_ELEMENT_GFAC = "gfac";
- public static final String HEADER_ELEMENT_REGISTRY = "registry";
- public static final String HEADER_ELEMENT_PROXYSERVER = "proxyserver";
- public static final String HEADER_ELEMENT_MSGBOX = "msgbox";
- public static final String HEADER_ELEMENT_DSC = "dsc";
- public static final String HEADER_ELEMENT_BROKER = "broker";
-
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/airavata/blob/0e2c10f5/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/interpretor/SSWorkflowInterpreterInteractorImpl.java
----------------------------------------------------------------------
diff --git a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/interpretor/SSWorkflowInterpreterInteractorImpl.java b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/interpretor/SSWorkflowInterpreterInteractorImpl.java
deleted file mode 100644
index 32bd66b..0000000
--- a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/interpretor/SSWorkflowInterpreterInteractorImpl.java
+++ /dev/null
@@ -1,118 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.airavata.xbaya.interpretor;
-
-import org.apache.airavata.workflow.model.wf.Workflow;
-import org.apache.airavata.workflow.model.wf.WorkflowExecutionState;
-
-public class SSWorkflowInterpreterInteractorImpl implements
- WorkflowInterpreterInteractor {
-
- @Override
- public boolean notify(WorkflowExecutionMessage messageType, WorkflowInterpreterConfiguration config, Object data) {
- switch (messageType) {
- case NODE_STATE_CHANGED:
- break;
- case EXECUTION_STATE_CHANGED:
- WorkflowExecutionState state = (WorkflowExecutionState) data;
- config.getWorkflow().setExecutionState(state);
-// if (state == WorkflowExecutionState.PAUSED
-// || state == WorkflowExecutionState.STOPPED) {
-// config.getWorkflow().setExecutionState(WorkflowExecutionState.STOPPED);
-// }else if (state == WorkflowExecutionState.RUNNING) {
-// config.getWorkflow().setExecutionState(WorkflowExecutionState.RUNNING);
-// }
- break;
- case EXECUTION_TASK_START:
- break;
- case EXECUTION_TASK_END:
- break;
- case OPEN_SUBWORKFLOW:
- break;
- case HANDLE_DEPENDENT_NODES_DIFFERED_INPUTS:
- break;
- default:
- return false;
- }
- return true;
- }
-
- @Override
- public Object retrieveData(WorkflowExecutionMessage messageType, WorkflowInterpreterConfiguration config, Object data)
- throws Exception {
- Object result = null;
- switch (messageType) {
- case INPUT_WORKFLOWINTERPRETER_FOR_WORKFLOW:
- Workflow subWorkflow= (Workflow) data;
- WorkflowInterpreterConfiguration workflowInterpreterConfiguration = new WorkflowInterpreterConfiguration(subWorkflow,config.getTopic(),config.getMessageBoxURL(), config.getMessageBrokerURL(), config.getRegistry(), config.getConfiguration(), config.getGUI(), config.getMonitor());
- if (config.isTestMode()){
- workflowInterpreterConfiguration.setNotifier(new StandaloneNotificationSender(workflowInterpreterConfiguration.getTopic(),workflowInterpreterConfiguration.getWorkflow()));
- }
- result = new WorkflowInterpreter(workflowInterpreterConfiguration
- ,
- new SSWorkflowInterpreterInteractorImpl());
- break;
-// case INPUT_GSS_CREDENTIAL:
-// WorkflowInterpreter w = (WorkflowInterpreter) data;
-// result = SecurityUtil.getGSSCredential(w.getUsername(),
-// w.getPassword(), w.getConfig().getConfiguration().getMyProxyServer());
-// break;
-// case INPUT_LEAD_CONTEXT_HEADER:
-// Node node = (Node) data;
-// result = XBayaUtil.buildLeadContextHeader(config.getWorkflow(), config.getConfiguration(),
-// new MonitorConfiguration(config.getMessageBrokerURL(),
-// config.getTopic(), true,
-// config.getMessageBoxURL()), node.getID(),
-// null);
-// break;
- default:
- break;
- }
- return result;
- }
-
- @Override
- public void pauseExecution(WorkflowInterpreterConfiguration config) {
- notify(WorkflowExecutionMessage.EXECUTION_STATE_CHANGED,config, WorkflowExecutionState.PAUSED);
- }
-
- @Override
- public void resumeExecution(WorkflowInterpreterConfiguration config) {
- notify(WorkflowExecutionMessage.EXECUTION_STATE_CHANGED,config, WorkflowExecutionState.RUNNING);
- }
-
- @Override
- public void terminateExecution(WorkflowInterpreterConfiguration config) {
- notify(WorkflowExecutionMessage.EXECUTION_STATE_CHANGED,config, WorkflowExecutionState.STOPPED);
- }
-
- @Override
- public boolean isExecutionPaused(WorkflowInterpreterConfiguration config) {
- return config.getWorkflow().getExecutionState()==WorkflowExecutionState.PAUSED;
- }
-
- @Override
- public boolean isExecutionTerminated(WorkflowInterpreterConfiguration config) {
- return config.getWorkflow().getExecutionState()==WorkflowExecutionState.STOPPED;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/0e2c10f5/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/interpretor/StandaloneNotificationSender.java
----------------------------------------------------------------------
diff --git a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/interpretor/StandaloneNotificationSender.java b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/interpretor/StandaloneNotificationSender.java
deleted file mode 100644
index 432bc56..0000000
--- a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/interpretor/StandaloneNotificationSender.java
+++ /dev/null
@@ -1,135 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.airavata.xbaya.interpretor;
-
-import java.net.URI;
-import java.util.List;
-
-import org.apache.airavata.common.utils.StringUtil;
-import org.apache.airavata.workflow.model.graph.Node.NodeExecutionState;
-import org.apache.airavata.workflow.model.graph.system.InputNode;
-import org.apache.airavata.workflow.model.graph.system.OutputNode;
-import org.apache.airavata.workflow.model.graph.util.GraphUtil;
-import org.apache.airavata.workflow.model.wf.Workflow;
-import org.apache.airavata.xbaya.XBayaConstants;
-import org.apache.airavata.xbaya.graph.controller.NodeController;
-import org.apache.airavata.xbaya.jython.lib.ServiceNotifiable;
-import org.apache.airavata.xbaya.jython.lib.StandaloneServiceNotificationSender;
-import org.apache.airavata.xbaya.jython.lib.WorkflowNotifiable;
-import org.apache.airavata.xbaya.ui.monitor.MonitorEventHandler.NodeState;
-import org.apache.axis2.addressing.EndpointReference;
-import org.python.core.PyObject;
-
-public class StandaloneNotificationSender implements WorkflowNotifiable {
-
- private Workflow workflow;
- private URI workflowID;
-
- public StandaloneNotificationSender(String topic, Workflow workflow) {
- this.workflow = workflow;
- this.workflowID = URI.create(StringUtil.convertToJavaIdentifier(topic));
- }
-
- @Override
- public EndpointReference getEventSink() {
- return new EndpointReference(XBayaConstants.DEFAULT_BROKER_URL.toString());
- }
-
- @Override
- public void workflowStarted(PyObject[] args, String[] keywords) {
- List<InputNode> inputs = GraphUtil.getInputNodes(this.workflow.getGraph());
- for (InputNode inputNode : inputs) {
- inputNode.setState(NodeExecutionState.FINISHED);
- }
-
- }
-
- @Override
- public void workflowStarted(Object[] args, String[] keywords) {
- List<InputNode> inputs = GraphUtil.getInputNodes(this.workflow.getGraph());
- for (InputNode inputNode : inputs) {
- inputNode.setState(NodeExecutionState.FINISHED);
- }
- }
-
- @Override
- public void workflowFinished(Object[] args, String[] keywords) {
- List<OutputNode> outputs = GraphUtil.getOutputNodes(this.workflow.getGraph());
- for (OutputNode outputNode : outputs) {
- outputNode.setState(NodeExecutionState.EXECUTING);
- }
-
- }
-
- @Override
- public void sendingPartialResults(Object[] args, String[] keywords) {
- // noop
-
- }
-
- @Override
- public void workflowFinished(PyObject[] args, String[] keywords) {
- List<OutputNode> outputs = GraphUtil.getOutputNodes(this.workflow.getGraph());
- for (OutputNode outputNode : outputs) {
- outputNode.setState(NodeExecutionState.EXECUTING);
- }
-
- }
-
- @Override
- public void workflowTerminated() {
- // noop
-
- }
-
- @Override
- public void workflowFailed(String message) {
- // noop
-
- }
-
- @Override
- public void workflowFailed(Throwable e) {
- // noop
-
- }
-
- @Override
- public void workflowFailed(String message, Throwable e) {
- // noop
-
- }
-
- @Override
- public ServiceNotifiable createServiceNotificationSender(String nodeID) {
- return new StandaloneServiceNotificationSender(this.workflow, this.workflowID);
- }
-
- @Override
- public void cleanup(){
-
- }
-
- public String getTopic() {
- return this.workflowID.toASCIIString();
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/0e2c10f5/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/interpretor/SystemComponentInvoker.java
----------------------------------------------------------------------
diff --git a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/interpretor/SystemComponentInvoker.java b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/interpretor/SystemComponentInvoker.java
deleted file mode 100644
index d6a075a..0000000
--- a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/interpretor/SystemComponentInvoker.java
+++ /dev/null
@@ -1,114 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.airavata.xbaya.interpretor;
-
-import java.util.Hashtable;
-import java.util.Map;
-
-import org.apache.airavata.workflow.model.exceptions.WorkflowException;
-import org.apache.airavata.xbaya.invoker.Invoker;
-
-import xsul.wsif.WSIFMessage;
-import xsul.xwsif_runtime.WSIFClient;
-
-public class SystemComponentInvoker implements Invoker {
-
- private Map<String, Object> outputs = new Hashtable<String, Object>();
-
- /**
- *
- * @param key
- * @param value
- */
- public void addOutput(String key, Object value) {
- outputs.put(key, value);
- }
-
- /**
- * @see org.apache.airavata.xbaya.invoker.Invoker#getOutput(java.lang.String)
- */
- @Override
- public Object getOutput(String name) {
- Object out = null;
- while (out == null) {
- try {
- out = this.outputs.get(name);
- Thread.sleep(200);
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- }
- return out;
- }
-
- /**
- * @see org.apache.airavata.xbaya.invoker.Invoker#getOutputs()
- */
- @Override
- public WSIFMessage getOutputs() {
- return null;
- }
-
- /**
- * @see org.apache.airavata.xbaya.invoker.Invoker#invoke()
- */
- @Override
- public boolean invoke() {
- return true;
- }
-
- /**
- * @see org.apache.airavata.xbaya.invoker.Invoker#setInput(java.lang.String, java.lang.Object)
- */
- @Override
- public void setInput(String name, Object value) {
- }
-
- /**
- * @see org.apache.airavata.xbaya.wXPath Operatorsorkflow.Invoker#setOperation(java.lang.String)
- */
- @Override
- public void setOperation(String operationName) {
- }
-
- /**
- * @see org.apache.airavata.xbaya.invoker.Invoker#setup()
- */
- @Override
- public void setup() {
- }
-
- @Override
- public WSIFClient getClient() {
- return null;
- }
-
- @Override
- public WSIFMessage getInputs() throws WorkflowException {
- return null;
- }
-
- @Override
- public WSIFMessage getFault() throws WorkflowException {
- return null;
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/airavata/blob/0e2c10f5/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/interpretor/WorkFlowInterpreterException.java
----------------------------------------------------------------------
diff --git a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/interpretor/WorkFlowInterpreterException.java b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/interpretor/WorkFlowInterpreterException.java
deleted file mode 100644
index 7ec87e5..0000000
--- a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/interpretor/WorkFlowInterpreterException.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.xbaya.interpretor;
-
-public class WorkFlowInterpreterException extends RuntimeException {
-
- public WorkFlowInterpreterException() {
- super();
- }
-
- public WorkFlowInterpreterException(String message) {
- super(message);
- }
-
- public WorkFlowInterpreterException(Throwable e) {
- super(e);
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/airavata/blob/0e2c10f5/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/interpretor/WorkflowExecutionMessage.java
----------------------------------------------------------------------
diff --git a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/interpretor/WorkflowExecutionMessage.java b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/interpretor/WorkflowExecutionMessage.java
deleted file mode 100644
index 98743a4..0000000
--- a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/interpretor/WorkflowExecutionMessage.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.airavata.xbaya.interpretor;
-
-public enum WorkflowExecutionMessage {
- NODE_STATE_CHANGED,
- //this.engine.getGUI().getGraphCanvas().repaint();
- EXECUTION_STATE_CHANGED,
- EXECUTION_RESUME,
- EXECUTION_TASK_START,
- EXECUTION_TASK_END,
- EXECUTION_ERROR,
- EXECUTION_CLEANUP,
- OPEN_SUBWORKFLOW,
- HANDLE_DEPENDENT_NODES_DIFFERED_INPUTS,
- INPUT_WORKFLOWINTERPRETER_FOR_WORKFLOW,
- INPUT_GSS_CREDENTIAL,
- INPUT_LEAD_CONTEXT_HEADER,
- INPUT_GFAC_INVOKER,
-
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/0e2c10f5/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/interpretor/WorkflowExecutionTemplate.java
----------------------------------------------------------------------
diff --git a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/interpretor/WorkflowExecutionTemplate.java b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/interpretor/WorkflowExecutionTemplate.java
deleted file mode 100644
index 4c34032..0000000
--- a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/interpretor/WorkflowExecutionTemplate.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.airavata.xbaya.interpretor;
-
-import java.util.List;
-
-import org.apache.airavata.client.api.ExperimentAdvanceOptions;
-import org.apache.airavata.workflow.model.wf.WorkflowInput;
-
-public class WorkflowExecutionTemplate {
- private String workflowTemplateName;
- private List<WorkflowInput> input;
- private ExperimentAdvanceOptions advanceOptions;
- public String getWorkflowTemplateName() {
- return workflowTemplateName;
- }
- public void setWorkflowTemplateName(String workflowTemplateName) {
- this.workflowTemplateName = workflowTemplateName;
- }
- public List<WorkflowInput> getInput() {
- return input;
- }
- public void setInput(List<WorkflowInput> input) {
- this.input = input;
- }
- public ExperimentAdvanceOptions getAdvanceOptions() {
- return advanceOptions;
- }
- public void setAdvanceOptions(ExperimentAdvanceOptions advanceOptions) {
- this.advanceOptions = advanceOptions;
- }
-}