Return-Path: X-Original-To: apmail-airavata-commits-archive@www.apache.org Delivered-To: apmail-airavata-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 84FF0117E2 for ; Fri, 11 Jul 2014 22:21:16 +0000 (UTC) Received: (qmail 99453 invoked by uid 500); 11 Jul 2014 22:21:16 -0000 Delivered-To: apmail-airavata-commits-archive@airavata.apache.org Received: (qmail 99339 invoked by uid 500); 11 Jul 2014 22:21:16 -0000 Mailing-List: contact commits-help@airavata.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@airavata.apache.org Delivered-To: mailing list commits@airavata.apache.org Received: (qmail 99214 invoked by uid 99); 11 Jul 2014 22:21:16 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 11 Jul 2014 22:21:16 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id EF3928B7088; Fri, 11 Jul 2014 22:21:15 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: samindaw@apache.org To: commits@airavata.apache.org Date: Fri, 11 Jul 2014 22:21:30 -0000 Message-Id: <33a5fce2e0474e4abf2811388b052b34@git.apache.org> In-Reply-To: <76433eb95bf24e26969451d198111057@git.apache.org> References: <76433eb95bf24e26969451d198111057@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [17/20] updating xbaya gui to the new airavata http://git-wip-us.apache.org/repos/asf/airavata/blob/3e6c815a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/interpretor/WorkflowInterpreterConfiguration.java ---------------------------------------------------------------------- diff --git a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/interpretor/WorkflowInterpreterConfiguration.java b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/interpretor/WorkflowInterpreterConfiguration.java index e21c18c..4023c37 100644 --- a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/interpretor/WorkflowInterpreterConfiguration.java +++ b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/interpretor/WorkflowInterpreterConfiguration.java @@ -1,233 +1,233 @@ -/* - * - * 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.client.api.AiravataAPI; -import org.apache.airavata.workflow.model.wf.Workflow; -import org.apache.airavata.ws.monitor.Monitor; -import org.apache.airavata.xbaya.XBayaConfiguration; -import org.apache.airavata.xbaya.jython.lib.NotificationSender; -import org.apache.airavata.xbaya.jython.lib.WorkflowNotifiable; -import org.apache.airavata.xbaya.ui.XBayaGUI; - -import java.net.URI; - -//import org.apache.airavata.registry.api.AiravataRegistry2; - -public class WorkflowInterpreterConfiguration { -// public static final int GUI_MODE = 1; -// public static final int SERVER_MODE = 2; +///* +// * +// * 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.client.api.AiravataAPI; +//import org.apache.airavata.workflow.model.wf.Workflow; +//import org.apache.airavata.ws.monitor.Monitor; +//import org.apache.airavata.xbaya.XBayaConfiguration; +//import org.apache.airavata.xbaya.jython.lib.NotificationSender; +//import org.apache.airavata.xbaya.jython.lib.WorkflowNotifiable; +//import org.apache.airavata.xbaya.ui.XBayaGUI; +// +//import java.net.URI; +// +////import org.apache.airavata.registry.api.AiravataRegistry2; +// +//public class WorkflowInterpreterConfiguration { +//// public static final int GUI_MODE = 1; +//// public static final int SERVER_MODE = 2; +//// +// private URI messageBoxURL; +// private URI messageBrokerURL; +// private AiravataAPI registry; +// private XBayaConfiguration configuration; +// private XBayaGUI gui; +// private Monitor monitor; +// private boolean offline=false; +// private boolean runWithCrossProduct=false; +// private Workflow workflow; +// private WorkflowNotifiable notifier; +// private String topic; +// private boolean gfacEmbeddedMode = false; +// private Boolean actOnProvenance = null; +// private boolean subWorkflow; +// private boolean testMode=false; +// private AiravataAPI airavataAPI; +// private String awsAccessKey; +// private String awsSecretKey; +// +// public WorkflowInterpreterConfiguration(Workflow workflow, +// String topic, +// URI messageBoxURL, +// URI messageBrokerURL, +// AiravataAPI registry, +// XBayaConfiguration configuration, +// XBayaGUI gui,Monitor monitor) { +// this(workflow, topic, messageBoxURL,messageBrokerURL,registry,configuration,gui,monitor, true); +// } +// +// public WorkflowInterpreterConfiguration(Workflow workflow, +// String topic, +// URI messageBoxURL, +// URI messageBrokerURL, +// AiravataAPI airavataAPI, +// XBayaConfiguration configuration, +// XBayaGUI gui, +// Monitor monitor, +// boolean offline) { +// this.messageBoxURL = messageBoxURL; +// this.messageBrokerURL = messageBrokerURL; +// this.airavataAPI = airavataAPI; +// this.configuration = configuration; +// this.gui = gui; +// this.monitor = monitor; +// this.offline = offline; +// this.workflow = workflow; +// this.topic = topic; +// } // - private URI messageBoxURL; - private URI messageBrokerURL; - private AiravataAPI registry; - private XBayaConfiguration configuration; - private XBayaGUI gui; - private Monitor monitor; - private boolean offline=false; - private boolean runWithCrossProduct=false; - private Workflow workflow; - private WorkflowNotifiable notifier; - private String topic; - private boolean gfacEmbeddedMode = false; - private Boolean actOnProvenance = null; - private boolean subWorkflow; - private boolean testMode=false; - private AiravataAPI airavataAPI; - private String awsAccessKey; - private String awsSecretKey; - - public WorkflowInterpreterConfiguration(Workflow workflow, - String topic, - URI messageBoxURL, - URI messageBrokerURL, - AiravataAPI registry, - XBayaConfiguration configuration, - XBayaGUI gui,Monitor monitor) { - this(workflow, topic, messageBoxURL,messageBrokerURL,registry,configuration,gui,monitor, true); - } - - public WorkflowInterpreterConfiguration(Workflow workflow, - String topic, - URI messageBoxURL, - URI messageBrokerURL, - AiravataAPI airavataAPI, - XBayaConfiguration configuration, - XBayaGUI gui, - Monitor monitor, - boolean offline) { - this.messageBoxURL = messageBoxURL; - this.messageBrokerURL = messageBrokerURL; - this.airavataAPI = airavataAPI; - this.configuration = configuration; - this.gui = gui; - this.monitor = monitor; - this.offline = offline; - this.workflow = workflow; - this.topic = topic; - } - - public URI getMessageBoxURL() { - return messageBoxURL; - } - public void setMessageBoxURL(URI messageBoxURL) { - this.messageBoxURL = messageBoxURL; - } - public URI getMessageBrokerURL() { - return messageBrokerURL; - } - public void setMessageBrokerURL(URI messageBrokerURL) { - this.messageBrokerURL = messageBrokerURL; - } - public AiravataAPI getRegistry() { - return registry; - } - public void setRegistry(AiravataAPI registry) { - this.registry = registry; - } - public XBayaConfiguration getConfiguration() { - return configuration; - } - public void setConfiguration(XBayaConfiguration configuration) { - this.configuration = configuration; - } - public XBayaGUI getGUI() { - return gui; - } - public void setGUI(XBayaGUI gui) { - this.gui = gui; - } - public Monitor getMonitor() { - return monitor; - } - public void setMonitor(Monitor monitor) { - this.monitor = monitor; - } - - public boolean isOffline() { - return offline; - } - - public void setOffline(boolean offline) { - this.offline = offline; - } - - public boolean isRunWithCrossProduct() { - return runWithCrossProduct; - } - - public void setRunWithCrossProduct(boolean runWithCrossProduct) { - this.runWithCrossProduct = runWithCrossProduct; - } - - public Workflow getWorkflow() { - return workflow; - } - - public void setWorkflow(Workflow workflow) { - this.workflow = workflow; - } - - public WorkflowNotifiable getNotifier() { - if (notifier==null){ - notifier=new NotificationSender(getMessageBrokerURL(), getTopic()); - } - return notifier; - } - - public void validateNotifier(){ - getNotifier(); - } - - public String getTopic() { - return topic; - } - - public void setTopic(String topic) { - this.topic = topic; - } - -// public int getMode() { -// return getMonitor()==null? SERVER_MODE:GUI_MODE; -// } - - public boolean isGfacEmbeddedMode() { - return gfacEmbeddedMode; - } - - public void setGfacEmbeddedMode(boolean gfacEmbeddedMode) { - this.gfacEmbeddedMode = gfacEmbeddedMode; - } - - public Boolean isActOnProvenance() { - return actOnProvenance; - } - - public void setActOnProvenance(Boolean actOnProvenance) { - this.actOnProvenance = actOnProvenance; - } - - public boolean isSubWorkflow() { - return subWorkflow; - } - - public void setSubWorkflow(boolean subWorkflow) { - this.subWorkflow = subWorkflow; - } - - public void setNotifier(WorkflowNotifiable notifier) { - this.notifier = notifier; - setTestMode(notifier instanceof StandaloneNotificationSender); - } - - public boolean isTestMode() { - return testMode; - } - - private void setTestMode(boolean testMode) { - this.testMode = testMode; - } - - public AiravataAPI getAiravataAPI() { - return airavataAPI; - } - - public void setAiravataAPI(AiravataAPI airavataAPI) { - this.airavataAPI = airavataAPI; - } - - public String getAwsAccessKey() { - return awsAccessKey; - } - - public void setAwsAccessKey(String awsAccessKey) { - this.awsAccessKey = awsAccessKey; - } - - public String getAwsSecretKey() { - return awsSecretKey; - } - - public void setAwsSecretKey(String awsSecretKey) { - this.awsSecretKey = awsSecretKey; - } -} +// public URI getMessageBoxURL() { +// return messageBoxURL; +// } +// public void setMessageBoxURL(URI messageBoxURL) { +// this.messageBoxURL = messageBoxURL; +// } +// public URI getMessageBrokerURL() { +// return messageBrokerURL; +// } +// public void setMessageBrokerURL(URI messageBrokerURL) { +// this.messageBrokerURL = messageBrokerURL; +// } +// public AiravataAPI getRegistry() { +// return registry; +// } +// public void setRegistry(AiravataAPI registry) { +// this.registry = registry; +// } +// public XBayaConfiguration getConfiguration() { +// return configuration; +// } +// public void setConfiguration(XBayaConfiguration configuration) { +// this.configuration = configuration; +// } +// public XBayaGUI getGUI() { +// return gui; +// } +// public void setGUI(XBayaGUI gui) { +// this.gui = gui; +// } +// public Monitor getMonitor() { +// return monitor; +// } +// public void setMonitor(Monitor monitor) { +// this.monitor = monitor; +// } +// +// public boolean isOffline() { +// return offline; +// } +// +// public void setOffline(boolean offline) { +// this.offline = offline; +// } +// +// public boolean isRunWithCrossProduct() { +// return runWithCrossProduct; +// } +// +// public void setRunWithCrossProduct(boolean runWithCrossProduct) { +// this.runWithCrossProduct = runWithCrossProduct; +// } +// +// public Workflow getWorkflow() { +// return workflow; +// } +// +// public void setWorkflow(Workflow workflow) { +// this.workflow = workflow; +// } +// +// public WorkflowNotifiable getNotifier() { +// if (notifier==null){ +// notifier=new NotificationSender(getMessageBrokerURL(), getTopic()); +// } +// return notifier; +// } +// +// public void validateNotifier(){ +// getNotifier(); +// } +// +// public String getTopic() { +// return topic; +// } +// +// public void setTopic(String topic) { +// this.topic = topic; +// } +// +//// public int getMode() { +//// return getMonitor()==null? SERVER_MODE:GUI_MODE; +//// } +// +// public boolean isGfacEmbeddedMode() { +// return gfacEmbeddedMode; +// } +// +// public void setGfacEmbeddedMode(boolean gfacEmbeddedMode) { +// this.gfacEmbeddedMode = gfacEmbeddedMode; +// } +// +// public Boolean isActOnProvenance() { +// return actOnProvenance; +// } +// +// public void setActOnProvenance(Boolean actOnProvenance) { +// this.actOnProvenance = actOnProvenance; +// } +// +// public boolean isSubWorkflow() { +// return subWorkflow; +// } +// +// public void setSubWorkflow(boolean subWorkflow) { +// this.subWorkflow = subWorkflow; +// } +// +// public void setNotifier(WorkflowNotifiable notifier) { +// this.notifier = notifier; +// setTestMode(notifier instanceof StandaloneNotificationSender); +// } +// +// public boolean isTestMode() { +// return testMode; +// } +// +// private void setTestMode(boolean testMode) { +// this.testMode = testMode; +// } +// +// public AiravataAPI getAiravataAPI() { +// return airavataAPI; +// } +// +// public void setAiravataAPI(AiravataAPI airavataAPI) { +// this.airavataAPI = airavataAPI; +// } +// +// public String getAwsAccessKey() { +// return awsAccessKey; +// } +// +// public void setAwsAccessKey(String awsAccessKey) { +// this.awsAccessKey = awsAccessKey; +// } +// +// public String getAwsSecretKey() { +// return awsSecretKey; +// } +// +// public void setAwsSecretKey(String awsSecretKey) { +// this.awsSecretKey = awsSecretKey; +// } +//} http://git-wip-us.apache.org/repos/asf/airavata/blob/3e6c815a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/interpretor/WorkflowInterpreterInteractor.java ---------------------------------------------------------------------- diff --git a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/interpretor/WorkflowInterpreterInteractor.java b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/interpretor/WorkflowInterpreterInteractor.java index df39ef8..1e5a30a 100644 --- a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/interpretor/WorkflowInterpreterInteractor.java +++ b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/interpretor/WorkflowInterpreterInteractor.java @@ -1,94 +1,94 @@ -/* - * - * 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 WorkflowInterpreterInteractor { - public boolean notify(WorkflowExecutionMessage messageType, WorkflowInterpreterConfiguration config, Object data); - public Object retrieveData(WorkflowExecutionMessage messageType, WorkflowInterpreterConfiguration config, Object data) throws Exception; - public void pauseExecution(WorkflowInterpreterConfiguration config); - public void resumeExecution(WorkflowInterpreterConfiguration config); - public void terminateExecution(WorkflowInterpreterConfiguration config); - - public boolean isExecutionPaused(WorkflowInterpreterConfiguration config); - public boolean isExecutionTerminated(WorkflowInterpreterConfiguration config); - - public static class TaskNotification{ - String messageTitle; - String message; - String messageId; - public TaskNotification(String messageTitle, String message, String messageId) { - this.messageTitle=messageTitle; - this.message=message; - this.messageId=messageId; - } - } - -// public static class WorkflowExecutionData{ -// Workflow workflow; -// String topic; -// WorkflowInterpreter currentInterpreter; -// public WorkflowExecutionData(Workflow workflow,String topic, WorkflowInterpreter currentInterpreter) { -// this.workflow=workflow; -// this.topic=topic; -// this.currentInterpreter=currentInterpreter; -// } -// } +///* +// * +// * 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 WorkflowInterpreterInteractor { +// public boolean notify(WorkflowExecutionMessage messageType, WorkflowInterpreterConfiguration config, Object data); +// public Object retrieveData(WorkflowExecutionMessage messageType, WorkflowInterpreterConfiguration config, Object data) throws Exception; +// public void pauseExecution(WorkflowInterpreterConfiguration config); +// public void resumeExecution(WorkflowInterpreterConfiguration config); +// public void terminateExecution(WorkflowInterpreterConfiguration config); // -// public static class WSNodeData{ -// WSNode wsNode; -// WorkflowInterpreter currentInterpreter; -// public WSNodeData(WSNode wsNode, WorkflowInterpreter currentInterpreter) { -// this.wsNode=wsNode; -// this.currentInterpreter=currentInterpreter; -// } -// } +// public boolean isExecutionPaused(WorkflowInterpreterConfiguration config); +// public boolean isExecutionTerminated(WorkflowInterpreterConfiguration config); // -// public static class GFacInvokerData{ -// QName portTypeQName; -// WsdlDefinitions wsdl; -// String nodeID; -// String messageBoxURL; -// String gfacURL; -// WorkflowNotifiable notifier; -// String topic; -// AiravataRegistry2 registry; -// String serviceName; -// XBayaConfiguration config; -// boolean embeddedMode; -// -// public GFacInvokerData(boolean embeddedMode, QName portTypeQName, WsdlDefinitions wsdl, String nodeID, String messageBoxURL, -// String gfacURL, WorkflowNotifiable notifier,String topic,AiravataRegistry2 registry,String serviceName,XBayaConfiguration config) { -// this.embeddedMode=embeddedMode; -// this.portTypeQName = portTypeQName; -// this.wsdl = wsdl; -// this.nodeID = nodeID; -// this.messageBoxURL = messageBoxURL; -// this.gfacURL = gfacURL; -// this.notifier = notifier; -// this.topic = topic; -// this.registry = registry; -// this.serviceName = serviceName; -// this.config = config; +// public static class TaskNotification{ +// String messageTitle; +// String message; +// String messageId; +// public TaskNotification(String messageTitle, String message, String messageId) { +// this.messageTitle=messageTitle; +// this.message=message; +// this.messageId=messageId; // } // } -} +// +//// public static class WorkflowExecutionData{ +//// Workflow workflow; +//// String topic; +//// WorkflowInterpreter currentInterpreter; +//// public WorkflowExecutionData(Workflow workflow,String topic, WorkflowInterpreter currentInterpreter) { +//// this.workflow=workflow; +//// this.topic=topic; +//// this.currentInterpreter=currentInterpreter; +//// } +//// } +//// +//// public static class WSNodeData{ +//// WSNode wsNode; +//// WorkflowInterpreter currentInterpreter; +//// public WSNodeData(WSNode wsNode, WorkflowInterpreter currentInterpreter) { +//// this.wsNode=wsNode; +//// this.currentInterpreter=currentInterpreter; +//// } +//// } +//// +//// public static class GFacInvokerData{ +//// QName portTypeQName; +//// WsdlDefinitions wsdl; +//// String nodeID; +//// String messageBoxURL; +//// String gfacURL; +//// WorkflowNotifiable notifier; +//// String topic; +//// AiravataRegistry2 registry; +//// String serviceName; +//// XBayaConfiguration config; +//// boolean embeddedMode; +//// +//// public GFacInvokerData(boolean embeddedMode, QName portTypeQName, WsdlDefinitions wsdl, String nodeID, String messageBoxURL, +//// String gfacURL, WorkflowNotifiable notifier,String topic,AiravataRegistry2 registry,String serviceName,XBayaConfiguration config) { +//// this.embeddedMode=embeddedMode; +//// this.portTypeQName = portTypeQName; +//// this.wsdl = wsdl; +//// this.nodeID = nodeID; +//// this.messageBoxURL = messageBoxURL; +//// this.gfacURL = gfacURL; +//// this.notifier = notifier; +//// this.topic = topic; +//// this.registry = registry; +//// this.serviceName = serviceName; +//// this.config = config; +//// } +//// } +//} http://git-wip-us.apache.org/repos/asf/airavata/blob/3e6c815a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/interpretor/WorkflowInterpretorEventListener.java ---------------------------------------------------------------------- diff --git a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/interpretor/WorkflowInterpretorEventListener.java b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/interpretor/WorkflowInterpretorEventListener.java index 5de91e4..96fd117 100644 --- a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/interpretor/WorkflowInterpretorEventListener.java +++ b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/interpretor/WorkflowInterpretorEventListener.java @@ -1,387 +1,387 @@ -/* - * - * 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.io.IOException; -import java.net.URI; -import java.util.LinkedList; -import java.util.List; - -import org.apache.airavata.client.api.exception.AiravataAPIInvocationException; -import org.apache.airavata.common.utils.XMLUtil; -import org.apache.airavata.registry.api.workflow.NodeExecutionError; -import org.apache.airavata.workflow.model.graph.EPRPort; -import org.apache.airavata.workflow.model.graph.Edge; -import org.apache.airavata.workflow.model.graph.Graph; -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.impl.NodeImpl; -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.graph.ws.WSGraph; -import org.apache.airavata.workflow.model.wf.Workflow; -import org.apache.airavata.ws.monitor.EventData; -import org.apache.airavata.ws.monitor.MonitorException; -import org.apache.airavata.ws.monitor.MonitorUtil; -import org.apache.airavata.ws.monitor.MonitorUtil.EventType; -import org.apache.airavata.wsmg.client.ConsumerNotificationHandler; -import org.apache.airavata.wsmg.client.MsgBrokerClientException; -import org.apache.airavata.wsmg.client.NotificationHandler; -import org.apache.airavata.wsmg.client.WseMsgBrokerClient; -import org.apache.airavata.wsmg.client.msgbox.MessagePuller; -import org.apache.airavata.xbaya.XBayaConfiguration; -import org.apache.airavata.xbaya.graph.controller.NodeController; -import org.apache.airavata.xbaya.provenance.WorkflowNodeStatusUpdater; -import org.apache.airavata.xbaya.provenance.WorkflowStatusUpdater; -import org.apache.axiom.soap.SOAPEnvelope; -import org.apache.axis2.AxisFault; -import org.apache.axis2.addressing.EndpointReference; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.xmlpull.infoset.XmlElement; - -public class WorkflowInterpretorEventListener implements NotificationHandler, ConsumerNotificationHandler { - - private Workflow workflow; - private boolean pullMode; - private WseMsgBrokerClient wseClient; - private URI brokerURL; - private String topic; - private URI messageBoxURL; - private String subscriptionID; - private MessagePuller messagePuller; - private WorkflowStatusUpdater workflowStatusUpdater; - private WorkflowNodeStatusUpdater workflowNodeStatusUpdater; - private WorkflowInterpreterConfiguration workflowInterpreterConfiguration; - private String lastSubscriptionId; - - private static Logger logger = LoggerFactory.getLogger(WorkflowInterpretorEventListener.class); - - public WorkflowInterpretorEventListener(Workflow workflow, XBayaConfiguration configuration) { - this.workflow = workflow; - this.brokerURL = configuration.getBrokerURL(); - this.topic = configuration.getTopic(); - this.pullMode = true; - this.messageBoxURL = configuration.getMessageBoxURL(); - this.wseClient = new WseMsgBrokerClient(); - this.wseClient.init(this.brokerURL.toString()); - this.workflowInterpreterConfiguration = WorkflowInterpreter.getWorkflowInterpreterConfiguration(); - this.workflowNodeStatusUpdater = new WorkflowNodeStatusUpdater(this.workflowInterpreterConfiguration.getAiravataAPI()); - this.workflowStatusUpdater = new WorkflowStatusUpdater(this.workflowInterpreterConfiguration.getAiravataAPI()); - } - - public void start() throws MonitorException { - - subscribe(); - } - - public void stop() throws MonitorException { - unsubscribe(); - } - - private synchronized void subscribe() throws MonitorException { - if (this.subscriptionID != null) { - throw new IllegalStateException(); - } - try { - if (this.pullMode) { - EndpointReference messageBoxEPR = this.wseClient.createPullMsgBox(this.messageBoxURL.toString(),20000L); - this.subscriptionID = this.wseClient.subscribe(messageBoxEPR.getAddress(), this.topic, null); - this.messagePuller = this.wseClient.startPullingEventsFromMsgBox(messageBoxEPR, this, 1000L, 20000L); - } else { - String[] endpoints = this.wseClient.startConsumerService(2222, this); - this.subscriptionID = this.wseClient.subscribe(endpoints[0], this.topic, null); - } - } catch (IOException e) { - throw new MonitorException("Failed to subscribe.", e); - } catch (RuntimeException e) { - throw new MonitorException("Failed to subscribe.", e); - } - } - - /** - * Unsubscribes from the notification. - * - * @throws MonitorException - */ - private synchronized void unsubscribe() throws MonitorException { - // This method needs to be synchronized along with subscribe() because - // unsubscribe() might be called while subscribe() is being executed. - if (this.subscriptionID == null) { - throw new IllegalStateException(); - } - try { - if (this.pullMode) { - this.messagePuller.stopPulling(); - try { - Thread.sleep(100); - } catch (InterruptedException e) { - throw new MonitorException("Error during stop message puller", e); - } +///* +// * +// * 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.io.IOException; +//import java.net.URI; +//import java.util.LinkedList; +//import java.util.List; +// +//import org.apache.airavata.client.api.exception.AiravataAPIInvocationException; +//import org.apache.airavata.common.utils.XMLUtil; +//import org.apache.airavata.registry.api.workflow.NodeExecutionError; +//import org.apache.airavata.workflow.model.graph.EPRPort; +//import org.apache.airavata.workflow.model.graph.Edge; +//import org.apache.airavata.workflow.model.graph.Graph; +//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.impl.NodeImpl; +//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.graph.ws.WSGraph; +//import org.apache.airavata.workflow.model.wf.Workflow; +//import org.apache.airavata.ws.monitor.EventData; +//import org.apache.airavata.ws.monitor.MonitorException; +//import org.apache.airavata.ws.monitor.MonitorUtil; +//import org.apache.airavata.ws.monitor.MonitorUtil.EventType; +//import org.apache.airavata.wsmg.client.ConsumerNotificationHandler; +//import org.apache.airavata.wsmg.client.MsgBrokerClientException; +//import org.apache.airavata.wsmg.client.NotificationHandler; +//import org.apache.airavata.wsmg.client.WseMsgBrokerClient; +//import org.apache.airavata.wsmg.client.msgbox.MessagePuller; +//import org.apache.airavata.xbaya.XBayaConfiguration; +//import org.apache.airavata.xbaya.graph.controller.NodeController; +//import org.apache.airavata.xbaya.provenance.WorkflowNodeStatusUpdater; +//import org.apache.airavata.xbaya.provenance.WorkflowStatusUpdater; +//import org.apache.axiom.soap.SOAPEnvelope; +//import org.apache.axis2.AxisFault; +//import org.apache.axis2.addressing.EndpointReference; +//import org.slf4j.Logger; +//import org.slf4j.LoggerFactory; +//import org.xmlpull.infoset.XmlElement; +// +//public class WorkflowInterpretorEventListener implements NotificationHandler, ConsumerNotificationHandler { +// +// private Workflow workflow; +// private boolean pullMode; +// private WseMsgBrokerClient wseClient; +// private URI brokerURL; +// private String topic; +// private URI messageBoxURL; +// private String subscriptionID; +// private MessagePuller messagePuller; +// private WorkflowStatusUpdater workflowStatusUpdater; +// private WorkflowNodeStatusUpdater workflowNodeStatusUpdater; +// private WorkflowInterpreterConfiguration workflowInterpreterConfiguration; +// private String lastSubscriptionId; +// +// private static Logger logger = LoggerFactory.getLogger(WorkflowInterpretorEventListener.class); +// +// public WorkflowInterpretorEventListener(Workflow workflow, XBayaConfiguration configuration) { +// this.workflow = workflow; +// this.brokerURL = configuration.getBrokerURL(); +// this.topic = configuration.getTopic(); +// this.pullMode = true; +// this.messageBoxURL = configuration.getMessageBoxURL(); +// this.wseClient = new WseMsgBrokerClient(); +// this.wseClient.init(this.brokerURL.toString()); +// this.workflowInterpreterConfiguration = WorkflowInterpreter.getWorkflowInterpreterConfiguration(); +// this.workflowNodeStatusUpdater = new WorkflowNodeStatusUpdater(this.workflowInterpreterConfiguration.getAiravataAPI()); +// this.workflowStatusUpdater = new WorkflowStatusUpdater(this.workflowInterpreterConfiguration.getAiravataAPI()); +// } +// +// public void start() throws MonitorException { +// +// subscribe(); +// } +// +// public void stop() throws MonitorException { +// unsubscribe(); +// } +// +// private synchronized void subscribe() throws MonitorException { +// if (this.subscriptionID != null) { +// throw new IllegalStateException(); +// } +// try { +// if (this.pullMode) { +// EndpointReference messageBoxEPR = this.wseClient.createPullMsgBox(this.messageBoxURL.toString(),20000L); +// this.subscriptionID = this.wseClient.subscribe(messageBoxEPR.getAddress(), this.topic, null); +// this.messagePuller = this.wseClient.startPullingEventsFromMsgBox(messageBoxEPR, this, 1000L, 20000L); // } else { -// this.wseClient.unSubscribe(this.subscriptionID); - } - this.wseClient.unSubscribe(this.subscriptionID); - - } catch (MsgBrokerClientException e) { - throw new MonitorException("Failed to unsubscribe.", e); - } - - } - - /** - * @see org.apache.airavata.wsmg.client.NotificationHandler#handleNotification(java.lang.String) - */ - public void handleNotification(String message) { - try { - // String soapBody = WorkFlowUtils.getSoapBodyContent(message); - XmlElement event = XMLUtil.stringToXmlElement(message); - handleEvent(new EventData(event), true, this.workflow.getGraph()); - - // } catch (XMLStreamException e) { - // // Just log them because they can be unrelated messages sent to - // // this topic by accident. - // logger.warn("Could not parse received notification: " + message, - // e); - // } - } catch (RuntimeException e) { - logger.warn("Failed to process notification: " + message, e); - } catch (AiravataAPIInvocationException e) { - logger.error("Error occured during Exception saving to the Registry"); - } - } - - private void handleEvent(EventData event, boolean forward, Graph graph) throws AiravataAPIInvocationException { - EventType type = event.getType(); - String nodeID = event.getNodeID(); - Node node = graph.getNode(nodeID); - - if (type == MonitorUtil.EventType.WORKFLOW_INVOKED) { - workflowStarted(graph, forward); - //todo ideally experimentID and workflowInstanceID has to be different - workflowStatusUpdater.saveWorkflowData(event.getExperimentID(), event.getExperimentID(), - this.workflowInterpreterConfiguration.getWorkflow().getName()); - workflowStatusUpdater.workflowStarted(event.getExperimentID()); - } else if (type == MonitorUtil.EventType.WORKFLOW_TERMINATED) { - workflowFinished(graph, forward); - workflowStatusUpdater.workflowFinished(event.getExperimentID()); - try { - this.unsubscribe(); - } catch (MonitorException e) { - e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates. - } - } else if (type == EventType.INVOKING_SERVICE || type == EventType.SERVICE_INVOKED) { - if (node == null) { - if (nodeID!=null && !nodeID.equals("")) { - logger.warn("There is no node that has ID, " + nodeID); - } - } else { - nodeStarted(node, forward); - workflowNodeStatusUpdater.workflowNodeStarted(event.getExperimentID(), event.getNodeID() - , event.getMessage(), event.getWorkflowID().toASCIIString()); - } - } else if (type == MonitorUtil.EventType.RECEIVED_RESULT - // TODO this should be removed when GPEL sends all notification - // correctly. - || type == EventType.SENDING_RESULT) { - if (node == null) { - if (nodeID!=null && !nodeID.equals("")) { - logger.warn("There is no node that has ID, " + nodeID); - } - } else { - nodeFinished(node, forward); - workflowNodeStatusUpdater.workflowNodeFinished(event.getExperimentID(), event.getNodeID(), event.getMessage(), - event.getWorkflowID().toASCIIString()); - } - } else if (type == EventType.RECEIVED_FAULT - || type == EventType.SENDING_FAULT || type == EventType.SENDING_RESPONSE_FAILED) { - //Constructing NodeExecutionError with required data... - logger.error(event.getMessage()); - NodeExecutionError nodeExecutionError = new NodeExecutionError(); - nodeExecutionError.setExperimentId(event.getExperimentID()); - nodeExecutionError.setNodeId(event.getNodeID()); - nodeExecutionError.setWorkflowInstanceId(event.getExperimentID()); - nodeExecutionError.setErrorMessage(event.getMessage()); - nodeExecutionError.setErrorDescription(event.getMessage()); - nodeExecutionError.setErrorTime(event.getTimestamp()); - this.workflowInterpreterConfiguration.getAiravataAPI().getExecutionManager().addNodeExecutionError(nodeExecutionError); - if (node == null) { - if (nodeID!=null && !nodeID.equals("")) { - logger.warn("There is no node that has ID, " + nodeID); - } - } else { - nodeFailed(node, forward); - workflowNodeStatusUpdater.workflowNodeFailed(event.getExperimentID(), event.getNodeID()); - } - try { - this.unsubscribe(); - } catch (MonitorException e) { - e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates. - } - } else if (type == MonitorUtil.EventType.RESOURCE_MAPPING) { - if (node == null) { - if (nodeID!=null && !nodeID.equals("")) { - logger.warn("There is no node that has ID, " + nodeID); - } - } else { - // nodeResourceMapped(node, event.getEvent(), forward); - workflowNodeStatusUpdater.workflowNodeRunning(event.getExperimentID(), event.getNodeID()); - } - } else if(type == MonitorUtil.EventType.LOG_INFO){ - // This is not very gram specific, if these data is required in other provider they have to send - // the notification in info mode with ending these text, DONE,PENDING and ACTIVE - if(event.getMessage().endsWith("DONE")) { - workflowNodeStatusUpdater.workflowNodeStatusDone(event.getExperimentID(), event.getNodeID()); - } else if(event.getMessage().endsWith("PENDING")){ - workflowNodeStatusUpdater.workflowNodeStatusPending(event.getExperimentID(), event.getNodeID()); - } else if(event.getMessage().endsWith("ACTIVE")){ - workflowNodeStatusUpdater.workflowNodeStatusActive(event.getExperimentID(), event.getNodeID()); - } - } else { - // Ignore the rest. - } - } - - private void workflowStarted(Graph graph, boolean forward) { - for (InputNode node : GraphUtil.getInputNodes(graph)) { - if (forward) { - finishNode(node); - } else { - resetNode(node); - } - } - } - - private void workflowFinished(Graph graph, boolean forward) { - for (OutputNode node : GraphUtil.getOutputNodes(graph)) { - if (forward) { - finishNode(node); - finishPredecessorNodes(node); - } else { - resetNode(node); - } - } - } - - private LinkedList getInputNodes(WSGraph graph) { - List nodes = graph.getNodes(); - LinkedList inputNodes = new LinkedList(); - for (NodeImpl nodeImpl : nodes) { - if (nodeImpl instanceof InputNode) { - inputNodes.add((InputNode) nodeImpl); - } - } - return inputNodes; - } - - private LinkedList getOutputNodes(WSGraph graph) { - List nodes = graph.getNodes(); - LinkedList outputNodes = new LinkedList(); - for (NodeImpl nodeImpl : nodes) { - if (nodeImpl instanceof OutputNode) { - outputNodes.add((OutputNode) nodeImpl); - } - } - return outputNodes; - } - - private void nodeStarted(Node node, boolean forward) { - if (forward) { - executeNode(node); - finishPredecessorNodes(node); - } else { - resetNode(node); - } - } - - private void nodeFinished(Node node, boolean forward) { - if (forward) { - finishNode(node); - finishPredecessorNodes(node); - } else { - executeNode(node); - } - } - - private void nodeFailed(Node node, boolean forward) { - if (forward) { - failNode(node); - finishPredecessorNodes(node); - } else { - executeNode(node); - } - } - - private void executeNode(Node node) { - node.setState(NodeExecutionState.EXECUTING); - } - - private void finishNode(Node node) { - node.setState(NodeExecutionState.FINISHED); - } - - private void failNode(Node node) { - node.setState(NodeExecutionState.FAILED); - } - - private void resetNode(Node node) { - node.setState(NodeExecutionState.WAITING); - NodeController.getGUI(node).resetTokens(); - } - - /** - * Make preceding nodes done. This helps the monitoring GUI when a user subscribes from the middle of the workflow - * execution. - * - * @param node - */ - private void finishPredecessorNodes(Node node) { - for (Port inputPort : node.getInputPorts()) { - for (Edge edge : inputPort.getEdges()) { - Port fromPort = edge.getFromPort(); - if (!(fromPort instanceof EPRPort)) { - Node fromNode = fromPort.getNode(); - finishNode(fromNode); - finishPredecessorNodes(fromNode); - } - } - } - Port controlInPort = node.getControlInPort(); - if (controlInPort != null) { - for (Node fromNode : controlInPort.getFromNodes()) { - finishNode(fromNode); - finishPredecessorNodes(fromNode); - } - } - } - - /** - * @see org.apache.airavata.wsmg.client.NotificationHandler#handleNotification(java.lang.String) - */ - public void handleNotification(SOAPEnvelope message) { - String soapBody = message.getBody().toString(); - this.handleNotification(soapBody); - } - -} \ No newline at end of file +// String[] endpoints = this.wseClient.startConsumerService(2222, this); +// this.subscriptionID = this.wseClient.subscribe(endpoints[0], this.topic, null); +// } +// } catch (IOException e) { +// throw new MonitorException("Failed to subscribe.", e); +// } catch (RuntimeException e) { +// throw new MonitorException("Failed to subscribe.", e); +// } +// } +// +// /** +// * Unsubscribes from the notification. +// * +// * @throws MonitorException +// */ +// private synchronized void unsubscribe() throws MonitorException { +// // This method needs to be synchronized along with subscribe() because +// // unsubscribe() might be called while subscribe() is being executed. +// if (this.subscriptionID == null) { +// throw new IllegalStateException(); +// } +// try { +// if (this.pullMode) { +// this.messagePuller.stopPulling(); +// try { +// Thread.sleep(100); +// } catch (InterruptedException e) { +// throw new MonitorException("Error during stop message puller", e); +// } +//// } else { +//// this.wseClient.unSubscribe(this.subscriptionID); +// } +// this.wseClient.unSubscribe(this.subscriptionID); +// +// } catch (MsgBrokerClientException e) { +// throw new MonitorException("Failed to unsubscribe.", e); +// } +// +// } +// +// /** +// * @see org.apache.airavata.wsmg.client.NotificationHandler#handleNotification(java.lang.String) +// */ +// public void handleNotification(String message) { +// try { +// // String soapBody = WorkFlowUtils.getSoapBodyContent(message); +// XmlElement event = XMLUtil.stringToXmlElement(message); +// handleEvent(new EventData(event), true, this.workflow.getGraph()); +// +// // } catch (XMLStreamException e) { +// // // Just log them because they can be unrelated messages sent to +// // // this topic by accident. +// // logger.warn("Could not parse received notification: " + message, +// // e); +// // } +// } catch (RuntimeException e) { +// logger.warn("Failed to process notification: " + message, e); +// } catch (AiravataAPIInvocationException e) { +// logger.error("Error occured during Exception saving to the Registry"); +// } +// } +// +// private void handleEvent(EventData event, boolean forward, Graph graph) throws AiravataAPIInvocationException { +// EventType type = event.getType(); +// String nodeID = event.getNodeID(); +// Node node = graph.getNode(nodeID); +// +// if (type == MonitorUtil.EventType.WORKFLOW_INVOKED) { +// workflowStarted(graph, forward); +// //todo ideally experimentID and workflowInstanceID has to be different +// workflowStatusUpdater.saveWorkflowData(event.getExperimentID(), event.getExperimentID(), +// this.workflowInterpreterConfiguration.getWorkflow().getName()); +// workflowStatusUpdater.workflowStarted(event.getExperimentID()); +// } else if (type == MonitorUtil.EventType.WORKFLOW_TERMINATED) { +// workflowFinished(graph, forward); +// workflowStatusUpdater.workflowFinished(event.getExperimentID()); +// try { +// this.unsubscribe(); +// } catch (MonitorException e) { +// e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates. +// } +// } else if (type == EventType.INVOKING_SERVICE || type == EventType.SERVICE_INVOKED) { +// if (node == null) { +// if (nodeID!=null && !nodeID.equals("")) { +// logger.warn("There is no node that has ID, " + nodeID); +// } +// } else { +// nodeStarted(node, forward); +// workflowNodeStatusUpdater.workflowNodeStarted(event.getExperimentID(), event.getNodeID() +// , event.getMessage(), event.getWorkflowID().toASCIIString()); +// } +// } else if (type == MonitorUtil.EventType.RECEIVED_RESULT +// // TODO this should be removed when GPEL sends all notification +// // correctly. +// || type == EventType.SENDING_RESULT) { +// if (node == null) { +// if (nodeID!=null && !nodeID.equals("")) { +// logger.warn("There is no node that has ID, " + nodeID); +// } +// } else { +// nodeFinished(node, forward); +// workflowNodeStatusUpdater.workflowNodeFinished(event.getExperimentID(), event.getNodeID(), event.getMessage(), +// event.getWorkflowID().toASCIIString()); +// } +// } else if (type == EventType.RECEIVED_FAULT +// || type == EventType.SENDING_FAULT || type == EventType.SENDING_RESPONSE_FAILED) { +// //Constructing NodeExecutionError with required data... +// logger.error(event.getMessage()); +// NodeExecutionError nodeExecutionError = new NodeExecutionError(); +// nodeExecutionError.setExperimentId(event.getExperimentID()); +// nodeExecutionError.setNodeId(event.getNodeID()); +// nodeExecutionError.setWorkflowInstanceId(event.getExperimentID()); +// nodeExecutionError.setErrorMessage(event.getMessage()); +// nodeExecutionError.setErrorDescription(event.getMessage()); +// nodeExecutionError.setErrorTime(event.getTimestamp()); +// this.workflowInterpreterConfiguration.getAiravataAPI().getExecutionManager().addNodeExecutionError(nodeExecutionError); +// if (node == null) { +// if (nodeID!=null && !nodeID.equals("")) { +// logger.warn("There is no node that has ID, " + nodeID); +// } +// } else { +// nodeFailed(node, forward); +// workflowNodeStatusUpdater.workflowNodeFailed(event.getExperimentID(), event.getNodeID()); +// } +// try { +// this.unsubscribe(); +// } catch (MonitorException e) { +// e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates. +// } +// } else if (type == MonitorUtil.EventType.RESOURCE_MAPPING) { +// if (node == null) { +// if (nodeID!=null && !nodeID.equals("")) { +// logger.warn("There is no node that has ID, " + nodeID); +// } +// } else { +// // nodeResourceMapped(node, event.getEvent(), forward); +// workflowNodeStatusUpdater.workflowNodeRunning(event.getExperimentID(), event.getNodeID()); +// } +// } else if(type == MonitorUtil.EventType.LOG_INFO){ +// // This is not very gram specific, if these data is required in other provider they have to send +// // the notification in info mode with ending these text, DONE,PENDING and ACTIVE +// if(event.getMessage().endsWith("DONE")) { +// workflowNodeStatusUpdater.workflowNodeStatusDone(event.getExperimentID(), event.getNodeID()); +// } else if(event.getMessage().endsWith("PENDING")){ +// workflowNodeStatusUpdater.workflowNodeStatusPending(event.getExperimentID(), event.getNodeID()); +// } else if(event.getMessage().endsWith("ACTIVE")){ +// workflowNodeStatusUpdater.workflowNodeStatusActive(event.getExperimentID(), event.getNodeID()); +// } +// } else { +// // Ignore the rest. +// } +// } +// +// private void workflowStarted(Graph graph, boolean forward) { +// for (InputNode node : GraphUtil.getInputNodes(graph)) { +// if (forward) { +// finishNode(node); +// } else { +// resetNode(node); +// } +// } +// } +// +// private void workflowFinished(Graph graph, boolean forward) { +// for (OutputNode node : GraphUtil.getOutputNodes(graph)) { +// if (forward) { +// finishNode(node); +// finishPredecessorNodes(node); +// } else { +// resetNode(node); +// } +// } +// } +// +// private LinkedList getInputNodes(WSGraph graph) { +// List nodes = graph.getNodes(); +// LinkedList inputNodes = new LinkedList(); +// for (NodeImpl nodeImpl : nodes) { +// if (nodeImpl instanceof InputNode) { +// inputNodes.add((InputNode) nodeImpl); +// } +// } +// return inputNodes; +// } +// +// private LinkedList getOutputNodes(WSGraph graph) { +// List nodes = graph.getNodes(); +// LinkedList outputNodes = new LinkedList(); +// for (NodeImpl nodeImpl : nodes) { +// if (nodeImpl instanceof OutputNode) { +// outputNodes.add((OutputNode) nodeImpl); +// } +// } +// return outputNodes; +// } +// +// private void nodeStarted(Node node, boolean forward) { +// if (forward) { +// executeNode(node); +// finishPredecessorNodes(node); +// } else { +// resetNode(node); +// } +// } +// +// private void nodeFinished(Node node, boolean forward) { +// if (forward) { +// finishNode(node); +// finishPredecessorNodes(node); +// } else { +// executeNode(node); +// } +// } +// +// private void nodeFailed(Node node, boolean forward) { +// if (forward) { +// failNode(node); +// finishPredecessorNodes(node); +// } else { +// executeNode(node); +// } +// } +// +// private void executeNode(Node node) { +// node.setState(NodeExecutionState.EXECUTING); +// } +// +// private void finishNode(Node node) { +// node.setState(NodeExecutionState.FINISHED); +// } +// +// private void failNode(Node node) { +// node.setState(NodeExecutionState.FAILED); +// } +// +// private void resetNode(Node node) { +// node.setState(NodeExecutionState.WAITING); +// NodeController.getGUI(node).resetTokens(); +// } +// +// /** +// * Make preceding nodes done. This helps the monitoring GUI when a user subscribes from the middle of the workflow +// * execution. +// * +// * @param node +// */ +// private void finishPredecessorNodes(Node node) { +// for (Port inputPort : node.getInputPorts()) { +// for (Edge edge : inputPort.getEdges()) { +// Port fromPort = edge.getFromPort(); +// if (!(fromPort instanceof EPRPort)) { +// Node fromNode = fromPort.getNode(); +// finishNode(fromNode); +// finishPredecessorNodes(fromNode); +// } +// } +// } +// Port controlInPort = node.getControlInPort(); +// if (controlInPort != null) { +// for (Node fromNode : controlInPort.getFromNodes()) { +// finishNode(fromNode); +// finishPredecessorNodes(fromNode); +// } +// } +// } +// +// /** +// * @see org.apache.airavata.wsmg.client.NotificationHandler#handleNotification(java.lang.String) +// */ +// public void handleNotification(SOAPEnvelope message) { +// String soapBody = message.getBody().toString(); +// this.handleNotification(soapBody); +// } +// +//} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/airavata/blob/3e6c815a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/interpretor/WorkflowInterpretorMessageReceiverInOut.java ---------------------------------------------------------------------- diff --git a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/interpretor/WorkflowInterpretorMessageReceiverInOut.java b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/interpretor/WorkflowInterpretorMessageReceiverInOut.java index b5623e9..d6a1e83 100644 --- a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/interpretor/WorkflowInterpretorMessageReceiverInOut.java +++ b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/interpretor/WorkflowInterpretorMessageReceiverInOut.java @@ -1,262 +1,262 @@ -/* - * - * 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.client.stub.interpretor.NameValue; -import org.apache.airavata.client.stub.interpretor.WorkflowInterpretorStub; - - -public class WorkflowInterpretorMessageReceiverInOut extends org.apache.axis2.receivers.AbstractInOutMessageReceiver{ - public static final String MYPROXY_USER = "myproxy.user"; - public static final String MYPROXY_PASS = "myproxy.password"; - public void invokeBusinessLogic(org.apache.axis2.context.MessageContext msgContext, org.apache.axis2.context.MessageContext newMsgContext) - throws org.apache.axis2.AxisFault{ - - try { - - // get the implementation class for the Web Service - Object obj = getTheImplementationObject(msgContext); - - WorkflowInterpretorSkeleton skel = (WorkflowInterpretorSkeleton)obj; - //Out Envelop - org.apache.axiom.soap.SOAPEnvelope envelope = null; - //Find the axisOperation that has been set by the Dispatch phase. - org.apache.axis2.description.AxisOperation op = msgContext.getOperationContext().getAxisOperation(); - if (op == null) { - throw new org.apache.axis2.AxisFault("Operation is not located, if this is doclit style the SOAP-ACTION should specified via the SOAP Action to use the RawXMLProvider"); - } - - java.lang.String methodName; - if((op.getName() != null) && ((methodName = org.apache.axis2.util.JavaUtils.xmlNameToJava(op.getName().getLocalPart())) != null)){ - - - - if("launchWorkflow".equals(methodName)){ - - WorkflowInterpretorStub.LaunchWorkflow wrappedParam = - (WorkflowInterpretorStub.LaunchWorkflow)fromOM( - msgContext.getEnvelope().getBody().getFirstElement(), - WorkflowInterpretorStub.LaunchWorkflow.class, - getEnvelopeNamespaces(msgContext.getEnvelope())); - - - WorkflowInterpretorStub.LaunchWorkflowResponse launchWorkflowResponse = wrapLaunchWorkflowResponse_return( - - - skel.launchWorkflow( - - getWorkflowAsString(wrappedParam) - , - getTopic(wrappedParam) - , - getInputs(wrappedParam) - ) - - ); - - envelope = toEnvelope(getSOAPFactory(msgContext), launchWorkflowResponse, false); - - } else { - throw new java.lang.RuntimeException("method not found"); - } - - - newMsgContext.setEnvelope(envelope); - } - } - catch (java.lang.Exception e) { - throw org.apache.axis2.AxisFault.makeFault(e); - } - } - - // - private org.apache.axiom.om.OMElement toOM(WorkflowInterpretorStub.LaunchWorkflow param, boolean optimizeContent) - throws org.apache.axis2.AxisFault { - - - try{ - return param.getOMElement(WorkflowInterpretorStub.LaunchWorkflow.MY_QNAME, - org.apache.axiom.om.OMAbstractFactory.getOMFactory()); - } catch(org.apache.axis2.databinding.ADBException e){ - throw org.apache.axis2.AxisFault.makeFault(e); - } - - - } - - private org.apache.axiom.om.OMElement toOM(WorkflowInterpretorStub.LaunchWorkflowResponse param, boolean optimizeContent) - throws org.apache.axis2.AxisFault { - - - try{ - return param.getOMElement(WorkflowInterpretorStub.LaunchWorkflowResponse.MY_QNAME, - org.apache.axiom.om.OMAbstractFactory.getOMFactory()); - } catch(org.apache.axis2.databinding.ADBException e){ - throw org.apache.axis2.AxisFault.makeFault(e); - } - - - } - - private org.apache.axiom.soap.SOAPEnvelope toEnvelope(org.apache.axiom.soap.SOAPFactory factory, WorkflowInterpretorStub.LaunchWorkflowResponse param, boolean optimizeContent) - throws org.apache.axis2.AxisFault{ - try{ - org.apache.axiom.soap.SOAPEnvelope emptyEnvelope = factory.getDefaultEnvelope(); - - emptyEnvelope.getBody().addChild(param.getOMElement(WorkflowInterpretorStub.LaunchWorkflowResponse.MY_QNAME,factory)); - - - return emptyEnvelope; - } catch(org.apache.axis2.databinding.ADBException e){ - throw org.apache.axis2.AxisFault.makeFault(e); - } - } - - - private java.lang.String getWorkflowAsString( - WorkflowInterpretorStub.LaunchWorkflow wrappedType){ - - return wrappedType.getWorkflowAsString(); - - } - - - private java.lang.String getTopic( - WorkflowInterpretorStub.LaunchWorkflow wrappedType){ - - return wrappedType.getTopic(); - - } - - - private java.lang.String getPassword( - WorkflowInterpretorStub.LaunchWorkflow wrappedType){ - - return wrappedType.getPassword(); - - } - - - private java.lang.String getUsername( - WorkflowInterpretorStub.LaunchWorkflow wrappedType){ - - return wrappedType.getUsername(); - - } - - - private NameValue[] getInputs( - WorkflowInterpretorStub.LaunchWorkflow wrappedType){ - - return wrappedType.getInputs(); - - } - - - private NameValue[] getConfigurations( - WorkflowInterpretorStub.LaunchWorkflow wrappedType){ - - return wrappedType.getConfigurations(); - - } - - - - private WorkflowInterpretorStub.LaunchWorkflowResponse wrapLaunchWorkflowResponse_return( - java.lang.String param){ - WorkflowInterpretorStub.LaunchWorkflowResponse wrappedElement = new WorkflowInterpretorStub.LaunchWorkflowResponse(); - - wrappedElement.set_return(param); - - return wrappedElement; - } - - private WorkflowInterpretorStub.LaunchWorkflowResponse wraplaunchWorkflow(){ - WorkflowInterpretorStub.LaunchWorkflowResponse wrappedElement = new WorkflowInterpretorStub.LaunchWorkflowResponse(); - return wrappedElement; - } - - - - /** - * get the default envelope - */ - private org.apache.axiom.soap.SOAPEnvelope toEnvelope(org.apache.axiom.soap.SOAPFactory factory){ - return factory.getDefaultEnvelope(); - } - - - private java.lang.Object fromOM( - org.apache.axiom.om.OMElement param, - java.lang.Class type, - java.util.Map extraNamespaces) throws org.apache.axis2.AxisFault{ - - try { - - if (WorkflowInterpretorStub.LaunchWorkflow.class.equals(type)){ - - return WorkflowInterpretorStub.LaunchWorkflow.Factory.parse(param.getXMLStreamReaderWithoutCaching()); - - - } - - if (WorkflowInterpretorStub.LaunchWorkflowResponse.class.equals(type)){ - - return WorkflowInterpretorStub.LaunchWorkflowResponse.Factory.parse(param.getXMLStreamReaderWithoutCaching()); - - - } - - } catch (java.lang.Exception e) { - throw org.apache.axis2.AxisFault.makeFault(e); - } - return null; - } - - - - - - /** - * A utility method that copies the namepaces from the SOAPEnvelope - */ - private java.util.Map getEnvelopeNamespaces(org.apache.axiom.soap.SOAPEnvelope env){ - java.util.Map returnMap = new java.util.HashMap(); - java.util.Iterator namespaceIterator = env.getAllDeclaredNamespaces(); - while (namespaceIterator.hasNext()) { - org.apache.axiom.om.OMNamespace ns = (org.apache.axiom.om.OMNamespace) namespaceIterator.next(); - returnMap.put(ns.getPrefix(),ns.getNamespaceURI()); - } - return returnMap; - } - - private org.apache.axis2.AxisFault createAxisFault(java.lang.Exception e) { - org.apache.axis2.AxisFault f; - Throwable cause = e.getCause(); - if (cause != null) { - f = new org.apache.axis2.AxisFault(e.getMessage(), cause); - } else { - f = new org.apache.axis2.AxisFault(e.getMessage()); - } - - return f; - } -} +///* +// * +// * 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.client.stub.interpretor.NameValue; +//import org.apache.airavata.client.stub.interpretor.WorkflowInterpretorStub; +// +// +//public class WorkflowInterpretorMessageReceiverInOut extends org.apache.axis2.receivers.AbstractInOutMessageReceiver{ +// public static final String MYPROXY_USER = "myproxy.user"; +// public static final String MYPROXY_PASS = "myproxy.password"; +// public void invokeBusinessLogic(org.apache.axis2.context.MessageContext msgContext, org.apache.axis2.context.MessageContext newMsgContext) +// throws org.apache.axis2.AxisFault{ +// +// try { +// +// // get the implementation class for the Web Service +// Object obj = getTheImplementationObject(msgContext); +// +// WorkflowInterpretorSkeleton skel = (WorkflowInterpretorSkeleton)obj; +// //Out Envelop +// org.apache.axiom.soap.SOAPEnvelope envelope = null; +// //Find the axisOperation that has been set by the Dispatch phase. +// org.apache.axis2.description.AxisOperation op = msgContext.getOperationContext().getAxisOperation(); +// if (op == null) { +// throw new org.apache.axis2.AxisFault("Operation is not located, if this is doclit style the SOAP-ACTION should specified via the SOAP Action to use the RawXMLProvider"); +// } +// +// java.lang.String methodName; +// if((op.getName() != null) && ((methodName = org.apache.axis2.util.JavaUtils.xmlNameToJava(op.getName().getLocalPart())) != null)){ +// +// +// +// if("launchWorkflow".equals(methodName)){ +// +// WorkflowInterpretorStub.LaunchWorkflow wrappedParam = +// (WorkflowInterpretorStub.LaunchWorkflow)fromOM( +// msgContext.getEnvelope().getBody().getFirstElement(), +// WorkflowInterpretorStub.LaunchWorkflow.class, +// getEnvelopeNamespaces(msgContext.getEnvelope())); +// +// +// WorkflowInterpretorStub.LaunchWorkflowResponse launchWorkflowResponse = wrapLaunchWorkflowResponse_return( +// +// +// skel.launchWorkflow( +// +// getWorkflowAsString(wrappedParam) +// , +// getTopic(wrappedParam) +// , +// getInputs(wrappedParam) +// ) +// +// ); +// +// envelope = toEnvelope(getSOAPFactory(msgContext), launchWorkflowResponse, false); +// +// } else { +// throw new java.lang.RuntimeException("method not found"); +// } +// +// +// newMsgContext.setEnvelope(envelope); +// } +// } +// catch (java.lang.Exception e) { +// throw org.apache.axis2.AxisFault.makeFault(e); +// } +// } +// +// // +// private org.apache.axiom.om.OMElement toOM(WorkflowInterpretorStub.LaunchWorkflow param, boolean optimizeContent) +// throws org.apache.axis2.AxisFault { +// +// +// try{ +// return param.getOMElement(WorkflowInterpretorStub.LaunchWorkflow.MY_QNAME, +// org.apache.axiom.om.OMAbstractFactory.getOMFactory()); +// } catch(org.apache.axis2.databinding.ADBException e){ +// throw org.apache.axis2.AxisFault.makeFault(e); +// } +// +// +// } +// +// private org.apache.axiom.om.OMElement toOM(WorkflowInterpretorStub.LaunchWorkflowResponse param, boolean optimizeContent) +// throws org.apache.axis2.AxisFault { +// +// +// try{ +// return param.getOMElement(WorkflowInterpretorStub.LaunchWorkflowResponse.MY_QNAME, +// org.apache.axiom.om.OMAbstractFactory.getOMFactory()); +// } catch(org.apache.axis2.databinding.ADBException e){ +// throw org.apache.axis2.AxisFault.makeFault(e); +// } +// +// +// } +// +// private org.apache.axiom.soap.SOAPEnvelope toEnvelope(org.apache.axiom.soap.SOAPFactory factory, WorkflowInterpretorStub.LaunchWorkflowResponse param, boolean optimizeContent) +// throws org.apache.axis2.AxisFault{ +// try{ +// org.apache.axiom.soap.SOAPEnvelope emptyEnvelope = factory.getDefaultEnvelope(); +// +// emptyEnvelope.getBody().addChild(param.getOMElement(WorkflowInterpretorStub.LaunchWorkflowResponse.MY_QNAME,factory)); +// +// +// return emptyEnvelope; +// } catch(org.apache.axis2.databinding.ADBException e){ +// throw org.apache.axis2.AxisFault.makeFault(e); +// } +// } +// +// +// private java.lang.String getWorkflowAsString( +// WorkflowInterpretorStub.LaunchWorkflow wrappedType){ +// +// return wrappedType.getWorkflowAsString(); +// +// } +// +// +// private java.lang.String getTopic( +// WorkflowInterpretorStub.LaunchWorkflow wrappedType){ +// +// return wrappedType.getTopic(); +// +// } +// +// +// private java.lang.String getPassword( +// WorkflowInterpretorStub.LaunchWorkflow wrappedType){ +// +// return wrappedType.getPassword(); +// +// } +// +// +// private java.lang.String getUsername( +// WorkflowInterpretorStub.LaunchWorkflow wrappedType){ +// +// return wrappedType.getUsername(); +// +// } +// +// +// private NameValue[] getInputs( +// WorkflowInterpretorStub.LaunchWorkflow wrappedType){ +// +// return wrappedType.getInputs(); +// +// } +// +// +// private NameValue[] getConfigurations( +// WorkflowInterpretorStub.LaunchWorkflow wrappedType){ +// +// return wrappedType.getConfigurations(); +// +// } +// +// +// +// private WorkflowInterpretorStub.LaunchWorkflowResponse wrapLaunchWorkflowResponse_return( +// java.lang.String param){ +// WorkflowInterpretorStub.LaunchWorkflowResponse wrappedElement = new WorkflowInterpretorStub.LaunchWorkflowResponse(); +// +// wrappedElement.set_return(param); +// +// return wrappedElement; +// } +// +// private WorkflowInterpretorStub.LaunchWorkflowResponse wraplaunchWorkflow(){ +// WorkflowInterpretorStub.LaunchWorkflowResponse wrappedElement = new WorkflowInterpretorStub.LaunchWorkflowResponse(); +// return wrappedElement; +// } +// +// +// +// /** +// * get the default envelope +// */ +// private org.apache.axiom.soap.SOAPEnvelope toEnvelope(org.apache.axiom.soap.SOAPFactory factory){ +// return factory.getDefaultEnvelope(); +// } +// +// +// private java.lang.Object fromOM( +// org.apache.axiom.om.OMElement param, +// java.lang.Class type, +// java.util.Map extraNamespaces) throws org.apache.axis2.AxisFault{ +// +// try { +// +// if (WorkflowInterpretorStub.LaunchWorkflow.class.equals(type)){ +// +// return WorkflowInterpretorStub.LaunchWorkflow.Factory.parse(param.getXMLStreamReaderWithoutCaching()); +// +// +// } +// +// if (WorkflowInterpretorStub.LaunchWorkflowResponse.class.equals(type)){ +// +// return WorkflowInterpretorStub.LaunchWorkflowResponse.Factory.parse(param.getXMLStreamReaderWithoutCaching()); +// +// +// } +// +// } catch (java.lang.Exception e) { +// throw org.apache.axis2.AxisFault.makeFault(e); +// } +// return null; +// } +// +// +// +// +// +// /** +// * A utility method that copies the namepaces from the SOAPEnvelope +// */ +// private java.util.Map getEnvelopeNamespaces(org.apache.axiom.soap.SOAPEnvelope env){ +// java.util.Map returnMap = new java.util.HashMap(); +// java.util.Iterator namespaceIterator = env.getAllDeclaredNamespaces(); +// while (namespaceIterator.hasNext()) { +// org.apache.axiom.om.OMNamespace ns = (org.apache.axiom.om.OMNamespace) namespaceIterator.next(); +// returnMap.put(ns.getPrefix(),ns.getNamespaceURI()); +// } +// return returnMap; +// } +// +// private org.apache.axis2.AxisFault createAxisFault(java.lang.Exception e) { +// org.apache.axis2.AxisFault f; +// Throwable cause = e.getCause(); +// if (cause != null) { +// f = new org.apache.axis2.AxisFault(e.getMessage(), cause); +// } else { +// f = new org.apache.axis2.AxisFault(e.getMessage()); +// } +// +// return f; +// } +//}