You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airavata.apache.org by sm...@apache.org on 2015/05/13 03:19:33 UTC
[1/3] airavata git commit: Cleaning up Xbaya use of legacy LEAD code
- AIRAVATA-1700
Repository: airavata
Updated Branches:
refs/heads/master 34cd927c3 -> 382b6c0e6
http://git-wip-us.apache.org/repos/asf/airavata/blob/382b6c0e/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/dialogs/graph/dynamic/DynamicNodeWindow.java
----------------------------------------------------------------------
diff --git a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/dialogs/graph/dynamic/DynamicNodeWindow.java b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/dialogs/graph/dynamic/DynamicNodeWindow.java
deleted file mode 100644
index c4d9790..0000000
--- a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/dialogs/graph/dynamic/DynamicNodeWindow.java
+++ /dev/null
@@ -1,475 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.airavata.xbaya.ui.dialogs.graph.dynamic;
-
-import java.awt.event.ActionEvent;
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.net.URI;
-import java.util.Iterator;
-import java.util.List;
-
-import javax.swing.AbstractAction;
-import javax.swing.JButton;
-import javax.swing.JCheckBox;
-import javax.swing.JFileChooser;
-import javax.swing.JPanel;
-import javax.xml.namespace.QName;
-
-import org.apache.airavata.model.appcatalog.appinterface.DataType;
-import org.apache.airavata.workflow.model.component.url.URLComponentRegistry;
-import org.apache.airavata.workflow.model.exceptions.WorkflowRuntimeException;
-import org.apache.airavata.workflow.model.graph.DataPort;
-import org.apache.airavata.workflow.model.graph.Graph;
-import org.apache.airavata.workflow.model.graph.Node;
-import org.apache.airavata.workflow.model.graph.Port;
-import org.apache.airavata.workflow.model.graph.dynamic.BasicTypeMapping;
-import org.apache.airavata.workflow.model.graph.dynamic.DynamicNode;
-import org.apache.airavata.workflow.model.graph.dynamic.SchemaCompilerUtil;
-import org.apache.airavata.workflow.model.graph.ws.WSNode;
-import org.apache.airavata.workflow.model.graph.ws.WSPort;
-import org.apache.airavata.xbaya.XBayaEngine;
-import org.apache.airavata.xbaya.component.registry.ComponentController;
-import org.apache.airavata.xbaya.component.registry.ComponentRegistryLoader;
-import org.apache.airavata.xbaya.invoker.DynamicServiceCreator;
-import org.apache.airavata.xbaya.ui.dialogs.XBayaDialog;
-import org.apache.airavata.xbaya.ui.widgets.GridPanel;
-import org.apache.airavata.xbaya.ui.widgets.XBayaLabel;
-import org.apache.airavata.xbaya.ui.widgets.XBayaTextArea;
-import org.apache.airavata.xbaya.ui.widgets.component.ComponentTreeNode;
-import org.apache.airavata.xbaya.util.RegistryConstants;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.xmlpull.infoset.XmlElement;
-import org.xmlpull.infoset.XmlNamespace;
-import org.xmlpull.v1.builder.XmlBuilderException;
-
-import xsul5.wsdl.WsdlDefinitions;
-
-public class DynamicNodeWindow {
-
- private static final Logger log = LoggerFactory.getLogger(DynamicNodeWindow.class);
-
- /**
- * CLASSES_DIR
- */
- private static final String CLASSES_DIR = "classes";
-
- /**
- * SRC_DIR
- */
- private static final String SRC_DIR = "src";
-
-
- /**
- * CLASS
- */
- private static final String CLASS = "class";
-
- /**
- * PACKAGE
- */
- private static final String PACKAGE = "package";
-
- /**
- * LINE
- */
- private static final String LINE = "\n";
-
- /**
- * TAB
- */
- private static final String TAB = "\t";
-
- /**
- * SPACE
- */
- private static final String SPACE = " ";
-
- private XBayaEngine engine;
-
- private DynamicNode node;
-
- private XBayaDialog dialog;
-
- private XBayaTextArea javaCodeTxtArea;
-
- private String typesPath;
-
- private String functionStr;
-
- private JCheckBox checkBox;
-
- /**
- * Constructs a WSNodeWindow.
- *
- * @param engine
- * The XBayaEngine
- * @param node
- */
- public DynamicNodeWindow(XBayaEngine engine, DynamicNode node) {
- this.engine = engine;
- this.node = node;
- initGUI();
-
- }
-
- /**
- * Shows the notification.
- *
- * @param event
- * The notification to show
- */
- public void show() {
-
- JFileChooser fileChooser = new JFileChooser();
- fileChooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
- int ret = fileChooser.showOpenDialog(this.engine.getGUI().getFrame());
- if (JFileChooser.APPROVE_OPTION != ret) {
- throw new WorkflowRuntimeException("Cannot proceed without valid directory");
- }
- File selectedDir = fileChooser.getSelectedFile();
- File rootDir = new File(selectedDir, "xbaya");
- deleteDir(rootDir);
- rootDir.mkdir();
- File srcDir = new File(rootDir, SRC_DIR);
- srcDir.mkdir();
- File classesDir = new File(rootDir, CLASSES_DIR);
- classesDir.mkdir();
- initSchema(rootDir, srcDir, srcDir);
-
- this.javaCodeTxtArea.setText(generateClass());
-
- this.dialog.show();
- if (this.checkBox.isSelected()) {
- deployWebservice();
- } else {
- this.compileAndRegisterJar(rootDir, srcDir, srcDir);
- }
-
- }
-
- private void deployWebservice() {
- try {
- DynamicServiceCreator factory = new DynamicServiceCreator(
- "http://129.79.246.108:8080/axis2/services/ServiceCreator?wsdl");
- String code = this.javaCodeTxtArea.getText();
- factory.createService(code);
- URLComponentRegistry registry = null;
- Thread.sleep(10000);
- registry = new URLComponentRegistry(new URI("http://129.79.246.108:8080/axis2/services/"
- + getClassName(code) + "?wsdl"));
- ComponentRegistryLoader.getLoader(this.engine, RegistryConstants.REGISTRY_TYPE_URL).load(registry);
-
- Node newNode = this.engine
- .getGUI()
- .getGraphCanvas()
- .addNode(
- ((ComponentTreeNode) ComponentController.getComponentTree(registry).getFirstLeaf()).getComponentReference()
- .getComponent(), this.node.getPosition());
- List<DataPort> inputPorts = newNode.getInputPorts();
- Graph graph = this.engine.getGUI().getGraphCanvas().getGraph();
- for (int i = 0; i < inputPorts.size(); ++i) {
- graph.addEdge(this.node.getInputPort(i).getFromPort(), inputPorts.get(i));
- }
- List<DataPort> outputPorts = newNode.getOutputPorts();
-
- for (int i = 0; i < outputPorts.size(); ++i) {
- List<Port> toPorts = this.node.getOutputPort(i).getToPorts();
- for (Port port : toPorts) {
- graph.removeEdge(this.node.getOutputPort(i), port);
- graph.addEdge(outputPorts.get(i), port);
- }
-
- }
-
- this.engine.getGUI().getWorkflow().removeNode(this.node);
-
- } catch (Exception e) {
- this.engine.getGUI().getErrorWindow().error(e);
- }
-
- }
-
- private void hide() {
- this.dialog.hide();
- }
-
- private void initGUI() {
- BasicTypeMapping.reset();
-
- this.javaCodeTxtArea = new XBayaTextArea();
- XBayaLabel operationLabel = new XBayaLabel("Operation", this.javaCodeTxtArea);
-
- GridPanel infoPanel = new GridPanel();
- infoPanel.add(operationLabel);
- infoPanel.add(this.javaCodeTxtArea);
- checkBox = new JCheckBox("Export as webservice");
- infoPanel.add(new XBayaLabel("", checkBox));
-
- infoPanel.add(checkBox);
- infoPanel.layout(2, 2, 0, 0);
-
- JButton okButton = new JButton("OK");
- okButton.addActionListener(new AbstractAction() {
- public void actionPerformed(ActionEvent e) {
-
- hide();
- }
- });
- JPanel buttonPanel = new JPanel();
- buttonPanel.add(okButton);
-
- this.dialog = new XBayaDialog(this.engine.getGUI(), this.node.getName(), infoPanel, buttonPanel);
- this.dialog.setDefaultButton(okButton);
- }
-
- private String generateClass() {
-
- String ret = "package org.apache.airavata.xbaya;";
- ret += LINE + LINE;
- ret += "public class DefaultClassName{";
- ret += LINE + LINE + TAB + "public";
- String function = "";
- List<Port> toNodes = this.node.getOutputPort(0).getToPorts();
- XmlElement returnElement = null;
- DataType returnType = null;
- if (toNodes.size() == 0) {
- function += SPACE + "void";
- } else {
-
- if (toNodes.size() == 1 && toNodes.get(0) instanceof WSPort) {
- WSPort outPort = (WSPort) toNodes.get(0);
- returnElement = outPort.getComponentPort().getElement();
- returnType = outPort.getType();
- } else {
- throw new WorkflowRuntimeException("Unhandled port type for Dynamic component or to many outputs");
- }
- for (Port port : toNodes) {
- if (toNodes.get(0) instanceof DataPort) {
- if (!returnType.equals(((DataPort) toNodes.get(0)).getType())) {
- throw new WorkflowRuntimeException(
- "Dynamic output port connected to input ports of different types.");
- }
- } else {
- throw new WorkflowRuntimeException("Unhandled port type for Dynamic component");
- }
- }
- int index = BasicTypeMapping.getSimpleTypeIndex(returnElement);
- if (-1 != index) {
- function += SPACE + BasicTypeMapping.getTypeName(index);
- } else {
- throw new WorkflowRuntimeException("WIll be fixed with complex type mappign");
- }
- }
-
- function += SPACE + "operationName(";
- List<DataPort> inputPorts = this.node.getInputPorts();
- boolean first = true;
-
- // variable list in function prototype
- for (DataPort inPort : inputPorts) {
- Port fromPort = inPort.getFromPort();
- if (fromPort instanceof WSPort) {
- WSPort wsPort = (WSPort) fromPort;
- XmlElement element = wsPort.getComponentPort().getElement();
-
- // QName inType = ((DataPort) fromPort).getType();
- int typeIndex = BasicTypeMapping.getSimpleTypeIndex(element);
- if (-1 != typeIndex) {
- if (first) {
- first = false;
- } else {
- function += SPACE + ",";
- }
- function += BasicTypeMapping.getTypeName(typeIndex) + SPACE
- + BasicTypeMapping.getTypeVariableName(typeIndex);
- } else {
- throw new WorkflowRuntimeException("Complex Type occured:This will be fixed!!!!!");
- }
- } else {
- throw new WorkflowRuntimeException("Dynamic Node connected to non data port");
- }
- }
-
- function += ")";
- ret += function;
- this.functionStr = function;
- // body
- ret += "{" + LINE + LINE;
- if (null != returnElement) {
- ret += TAB + TAB + "return" + SPACE
- + BasicTypeMapping.getTypeDefault(BasicTypeMapping.getSimpleTypeIndex(returnElement)) + ";";
- }
- ret += LINE;
- ret += TAB + "}";
- ret += LINE + "}";
- return ret;
-
- }
-
- private void initSchema(File rootDir, File srcDir, File classesDir) {
-
- List<DataPort> inputPorts = node.getInputPorts();
- for (DataPort inPort : inputPorts) {
- Port fromPort = inPort.getFromPort();
- Node fromNode = inPort.getFromNode();
- if (fromNode instanceof WSNode) {
- WSNode fromWsNode = (WSNode) fromNode;
- if (null != fromPort && fromPort instanceof DataPort) {
- DataPort fromDataPort = (DataPort) fromPort;
-// WsdlDefinitions wsdl = engine.getGUI().getWorkflow().getWSDLs().get(fromWsNode.getWSDLID());
-// Iterator<XmlNamespace> itr = wsdl.xml().namespaces().iterator();
-// try {
-// XmlElement schema = wsdl.getTypes().element("schema").clone();
-// // do not change the following ordering of setting
-// // namespaces.
-// schema.setNamespace(xsul5.XmlConstants.BUILDER.newNamespace("http://www.w3.org/2001/XMLSchema"));
-// while (itr.hasNext()) {
-// XmlNamespace next = itr.next();
-// if (!"".equals(next.getPrefix()) && null != next.getPrefix()) {
-// schema.setAttributeValue("xmlns:" + next.getPrefix(), next.getName());
-// }
-//
-// }
-//
-// try {
-// xsul5.XmlConstants.BUILDER
-// .serializeToOutputStream(schema, new FileOutputStream(rootDir.getCanonicalPath()
-// + File.separatorChar + "types.xsd"));
-// } catch (Exception e) {
-// log.error(e.getMessage(), e);
-// }
-//
-// typesPath = rootDir.getCanonicalPath() + File.separatorChar + "mytype.jar";
-// String[] args = new String[] { "-d", classesDir.getCanonicalPath(), "-src",
-// srcDir.getCanonicalPath(), "-out", typesPath,
-// rootDir.getCanonicalPath() + File.separatorChar + "types.xsd" };
-// SchemaCompilerUtil.compile(args);
-//
-// } catch (XmlBuilderException e) {
-// this.engine.getGUI().getErrorWindow().error(e);
-// } catch (CloneNotSupportedException e) {
-// this.engine.getGUI().getErrorWindow().error(e);
-// } catch (IOException e) {
-// log.error(e.getMessage(), e);
-// }
-
- } else {
- throw new WorkflowRuntimeException("Unknown port for code generation" + fromPort);
- }
- } else {
- throw new WorkflowRuntimeException("Unknown from node for code generation" + fromNode);
- }
- }
- }
-
- private void compileAndRegisterJar(File rootDir, File srcDir, File classesDir) {
- // String code = this.javaCodeTxtArea.getText();
- // String packageName = getPackageName(code);
- // String className = getClassName(code);
- // try {
- // File classFile = new File(srcDir.getCanonicalPath()+ File.separator
- // + packageName.replace('.', File.separatorChar)
- // + File.separator + className+".java");
- // classFile.getParentFile().mkdirs();
- //
- // FileWriter out = new FileWriter(classFile);
- // out.write(code);
- // out.flush();
- // out.close();
- //
- // JarHelper jarHelper = new JarHelper();
- // jarHelper.unjarDir(new File(this.typesPath), classesDir);
- //
- // Main.compile(new String[]{classFile.getCanonicalPath(), "-d", classesDir.getCanonicalPath()});
- // File implJar = new File(rootDir, "impl.jar");
- // jarHelper.jarDir( classesDir, implJar);
- // node.setImplURL(implJar.toURL());
- // node.setOperationName(getOperationName(code));
- // node.setClassName(getPackageName(code)+"."+getClassName(code));
- // } catch (IOException e) {
- // this.engine.getGUI().getErrorWindow().error(e);
- // }
-
- }
-
- private String getOperationName(String code) {
- String[] publicSplit = code.split("public");
- String searchStr = this.functionStr.substring(this.functionStr.indexOf("("), this.functionStr.indexOf(")"));
- int index = -1;
- for (int i = 0; i < publicSplit.length; ++i) {
- if (publicSplit[i].indexOf(searchStr) != -1) {
- index = i;
- break;
- }
- }
- if (index == -1) {
- throw new WorkflowRuntimeException("Operation name not found");
- }
- return publicSplit[index].substring(0, publicSplit[index].indexOf(searchStr)).trim().split(" ")[1];
- }
-
- private String getPackageName(String code) {
- return code.substring(code.indexOf(PACKAGE) + PACKAGE.length(), code.indexOf(";")).trim();
- }
-
- private String getClassName(String code) {
- return code.substring(code.indexOf(CLASS) + CLASS.length(), code.indexOf("{")).trim().split(" ")[0].trim();
-
- }
-
- private boolean hasComplexTypes() {
- List<DataPort> inputPorts = node.getInputPorts();
- for (DataPort inPort : inputPorts) {
- Port fromPort = inPort.getFromPort();
- Node fromNode = inPort.getFromNode();
- if (fromNode instanceof WSNode) {
- if (null != fromPort && fromPort instanceof DataPort) {
-
- } else {
- return false;
- }
- } else {
- return false;
- }
- }
- return false;
- }
-
- public static boolean deleteDir(File dir) {
- if (dir.isDirectory()) {
- String[] children = dir.list();
- for (int i = 0; i < children.length; i++) {
- boolean success = deleteDir(new File(dir, children[i]));
- if (!success) {
- return false;
- }
- }
- }
-
- // The directory is now empty so delete it
- return dir.delete();
- }
-
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/airavata/blob/382b6c0e/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/dialogs/graph/dynamic/DynamicWorkflowRunnerWindow.java
----------------------------------------------------------------------
diff --git a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/dialogs/graph/dynamic/DynamicWorkflowRunnerWindow.java b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/dialogs/graph/dynamic/DynamicWorkflowRunnerWindow.java
deleted file mode 100644
index 0de972a..0000000
--- a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/dialogs/graph/dynamic/DynamicWorkflowRunnerWindow.java
+++ /dev/null
@@ -1,394 +0,0 @@
-///*
-// *
-// * Licensed to the Apache Software Foundation (ASF) under one
-// * or more contributor license agreements. See the NOTICE file
-// * distributed with this work for additional information
-// * regarding copyright ownership. The ASF licenses this file
-// * to you under the Apache License, Version 2.0 (the
-// * "License"); you may not use this file except in compliance
-// * with the License. You may obtain a copy of the License at
-// *
-// * http://www.apache.org/licenses/LICENSE-2.0
-// *
-// * Unless required by applicable law or agreed to in writing,
-// * software distributed under the License is distributed on an
-// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// * KIND, either express or implied. See the License for the
-// * specific language governing permissions and limitations
-// * under the License.
-// *
-// */
-//
-//package org.apache.airavata.xbaya.ui.dialogs.graph.dynamic;
-//
-//import java.awt.event.ActionEvent;
-//import java.net.URI;
-//import java.net.URISyntaxException;
-//import java.util.ArrayList;
-//import java.util.Collection;
-//import java.util.Iterator;
-//import java.util.LinkedList;
-//import java.util.List;
-//import java.util.UUID;
-//
-//import javax.swing.AbstractAction;
-//import javax.swing.JButton;
-//import javax.swing.JCheckBox;
-//import javax.swing.JComboBox;
-//import javax.swing.JLabel;
-//import javax.swing.JOptionPane;
-//import javax.swing.JPanel;
-//import javax.xml.namespace.QName;
-//
-//import org.apache.airavata.client.api.exception.AiravataAPIInvocationException;
-//import org.apache.airavata.common.utils.StringUtil;
-//import org.apache.airavata.common.utils.XMLUtil;
-//import org.apache.airavata.workflow.model.exceptions.WorkflowException;
-//import org.apache.airavata.workflow.model.graph.system.InputNode;
-//import org.apache.airavata.workflow.model.graph.util.GraphUtil;
-//import org.apache.airavata.workflow.model.graph.ws.WSNode;
-//import org.apache.airavata.workflow.model.ode.ODEClient;
-//import org.apache.airavata.workflow.model.wf.Workflow;
-//import org.apache.airavata.ws.monitor.MonitorConfiguration;
-//import org.apache.airavata.ws.monitor.MonitorException;
-//import org.apache.airavata.xbaya.XBayaConfiguration;
-//import org.apache.airavata.xbaya.XBayaEngine;
-//import org.apache.airavata.xbaya.graph.controller.NodeController;
-//import org.apache.airavata.xbaya.interpretor.GUIWorkflowInterpreterInteractorImpl;
-//import org.apache.airavata.xbaya.interpretor.WorkflowInterpreter;
-//import org.apache.airavata.xbaya.interpretor.WorkflowInterpreterConfiguration;
-//import org.apache.airavata.xbaya.jython.script.JythonScript;
-//import org.apache.airavata.xbaya.ui.dialogs.XBayaDialog;
-//import org.apache.airavata.xbaya.ui.graph.ws.WSNodeGUI;
-//import org.apache.airavata.xbaya.ui.utils.ErrorMessages;
-//import org.apache.airavata.xbaya.ui.widgets.GridPanel;
-//import org.apache.airavata.xbaya.ui.widgets.XBayaLabel;
-//import org.apache.airavata.xbaya.ui.widgets.XBayaTextField;
-//import org.apache.airavata.xbaya.util.XBayaUtil;
-//import org.slf4j.Logger;
-//import org.slf4j.LoggerFactory;
-//import org.xmlpull.infoset.XmlElement;
-//import org.xmlpull.v1.builder.XmlInfosetBuilder;
-//
-//import xsul.XmlConstants;
-//import xsul.lead.LeadResourceMapping;
-//
-//public class DynamicWorkflowRunnerWindow {
-//
-// private static final Logger logger = LoggerFactory.getLogger(DynamicWorkflowRunnerWindow.class);
-//
-// private XBayaEngine engine;
-//
-// private Workflow workflow;
-//
-// private XBayaDialog dialog;
-//
-// private GridPanel parameterPanel;
-//
-// private XBayaTextField topicTextField;
-//
-// private List<XBayaTextField> parameterTextFields = new ArrayList<XBayaTextField>();
-//
-// private XBayaLabel resourceSelectionLabel;
-//
-// // private XBayaComboBox resourceSelectionComboBox;
-//
-//// private JComboBox gfacUrlListField;
-//
-// private JCheckBox interactChkBox;
-//
-// private JCheckBox chkRunWithCrossProduct;
-//
-// private XBayaTextField instanceNameTextField;
-//
-// protected final static XmlInfosetBuilder builder = XmlConstants.BUILDER;
-//
-// /**
-// * Constructs a TavernaRunnerWindow.
-// *
-// * @param engine
-// *
-// */
-// public DynamicWorkflowRunnerWindow(XBayaEngine engine) {
-// this.engine = engine;
-// if (XBayaUtil.acquireJCRRegistry(this.engine)) {
-// initGUI();
-// }
-// }
-//
-// /**
-// * Shows the dialog.
-// */
-// public void show() {
-// this.workflow = this.engine.getGUI().getWorkflow();
-//// List<URI> urlList=null;
-//// try {
-//// urlList = this.engine.getConfiguration().getAiravataAPI().getAiravataManager().getGFaCURLs();
-//// } catch (AiravataAPIInvocationException e) {
-//// e.printStackTrace();
-//// }
-// // When run xbaya continously urls can be repeating, so first remove everything and then add
-//// this.gfacUrlListField.removeAllItems();
-//// for (URI gfacUrl : urlList) {
-//// if (XBayaUtil.isURLExists(gfacUrl + "?wsdl")) {
-//// this.gfacUrlListField.addItem(gfacUrl);
-//// }
-//// }
-//// this.gfacUrlListField.setEditable(true);
-// MonitorConfiguration notifConfig = this.engine.getMonitor().getConfiguration();
-// if (notifConfig.getBrokerURL() == null) {
-// this.engine.getGUI().getErrorWindow().error(ErrorMessages.BROKER_URL_NOT_SET_ERROR);
-// return;
-// }
-//
-// // Create input fields
-// List<InputNode> inputNodes = GraphUtil.getInputNodes(this.workflow.getGraph());
-// for (Iterator<InputNode> iterator = inputNodes.iterator(); iterator.hasNext();) {
-// InputNode node = iterator.next();
-// String id = node.getID();
-// QName parameterType = node.getParameterType();
-//
-// /*
-// * If input node has no connection, skip it
-// */
-// if (parameterType == null) {
-// iterator.remove();
-// continue;
-// }
-//
-// JLabel nameLabel = new JLabel(id);
-// JLabel typeField = new JLabel(parameterType.getLocalPart());
-// XBayaTextField paramField = new XBayaTextField();
-// Object value = node.getDefaultValue();
-//
-// String valueString;
-// if (value == null) {
-// valueString = "";
-// } else {
-// if (value instanceof XmlElement) {
-// XmlElement valueElement = (XmlElement) value;
-// valueString = XMLUtil.xmlElementToString(valueElement);
-// } else {
-// // Only string comes here for now.
-// valueString = value.toString();
-// }
-// }
-//
-// if (!node.isVisibility()) {
-// paramField.setEditable(false);
-// }
-// paramField.setText(valueString);
-// this.parameterPanel.add(nameLabel);
-// this.parameterPanel.add(typeField);
-// this.parameterPanel.add(paramField);
-// this.parameterTextFields.add(paramField);
-// }
-// this.parameterPanel.layout(inputNodes.size(), 3, GridPanel.WEIGHT_NONE, 2);
-//
-//// this.instanceNameTextField.setText(workflow.getName()+"_"+Calendar.getInstance().getTime().toString());
-//
-// this.topicTextField.setText(UUID.randomUUID().toString());
-//
-// this.dialog.show();
-// }
-//
-// /**
-// * Hides the dialog.
-// */
-// public void hide() {
-// this.dialog.hide();
-//
-// this.parameterPanel.resetPanel();
-// this.parameterTextFields.clear();
-// }
-//
-// /**
-// * ReInit Host Name ComboBox
-// */
-// // public void reinitHostComboBox() {
-// // if (this.resourceSelectionComboBox == null)
-// // this.resourceSelectionComboBox = new XBayaComboBox(new DefaultComboBoxModel(initHostNameList()));
-// // else
-// // this.resourceSelectionComboBox.setModel(new DefaultComboBoxModel(initHostNameList()));
-// // }
-//
-// private void initGUI() {
-// this.parameterPanel = new GridPanel(true);
-//
-// // reinitHostComboBox();
-// // this.resourceSelectionLabel = new XBayaLabel("Select a Compute Resource", this.resourceSelectionComboBox);
-// this.instanceNameTextField = new XBayaTextField();
-// XBayaLabel instanceNameLabel = new XBayaLabel("Experiment name", this.instanceNameTextField);
-//
-// this.topicTextField = new XBayaTextField();
-// XBayaLabel topicLabel = new XBayaLabel("Notification topic", this.topicTextField);
-//// this.gfacUrlListField = new JComboBox();
-//// XBayaLabel gfacURLLabel = new XBayaLabel("GFac URL", this.gfacUrlListField);
-// this.interactChkBox = new JCheckBox();
-// this.interactChkBox.setSelected(false);
-// XBayaLabel interactLabel = new XBayaLabel("Enable Service Interactions", this.interactChkBox);
-//
-// chkRunWithCrossProduct=new JCheckBox();
-// XBayaLabel crossProductLabel = new XBayaLabel("Execute in cross product", chkRunWithCrossProduct);
-//
-// GridPanel infoPanel = new GridPanel();
-// // infoPanel.add(this.resourceSelectionLabel);
-// // infoPanel.add(this.resourceSelectionComboBox);
-// infoPanel.add(instanceNameLabel);
-// infoPanel.add(this.instanceNameTextField);
-// infoPanel.add(topicLabel);
-// infoPanel.add(this.topicTextField);
-//// infoPanel.add(gfacURLLabel);
-//// infoPanel.add(this.gfacUrlListField);
-// infoPanel.add(interactLabel);
-// infoPanel.add(this.interactChkBox);
-// infoPanel.add(crossProductLabel);
-// infoPanel.add(chkRunWithCrossProduct);
-//
-// infoPanel.layout(5, 2, GridPanel.WEIGHT_NONE, 1);
-//
-// GridPanel mainPanel = new GridPanel();
-// mainPanel.add(this.parameterPanel);
-// mainPanel.add(infoPanel);
-// mainPanel.layout(2, 1, 0, 0);
-//
-// JButton okButton = new JButton("Run");
-// okButton.addActionListener(new AbstractAction() {
-// public void actionPerformed(ActionEvent e) {
-// execute();
-// }
-// });
-//
-// JButton cancelButton = new JButton("Cancel");
-// cancelButton.addActionListener(new AbstractAction() {
-// public void actionPerformed(ActionEvent e) {
-// hide();
-// }
-// });
-//
-// JPanel buttonPanel = new JPanel();
-// buttonPanel.add(okButton);
-// buttonPanel.add(cancelButton);
-//
-// this.dialog = new XBayaDialog(this.engine.getGUI(), "Invoke workflow", mainPanel, buttonPanel);
-// this.dialog.setDefaultButton(okButton);
-// }
-//
-// private void execute() {
-// final List<String> arguments = new ArrayList<String>();
-// String instanceName = this.instanceNameTextField.getText();
-// if (instanceName.trim().equals("")){
-// JOptionPane.showMessageDialog(engine.getGUI().getFrame(),
-// "Experiment name cannot be empty",
-// "Experiment Name",
-// JOptionPane.ERROR_MESSAGE);
-// return;
-// }
-//// if (instanceName.equals("")){
-//// instanceName=workflow.getName();
-//// }
-// final String instanceNameFinal=instanceName;
-// String topic = this.topicTextField.getText();
-// if (topic.length() == 0) {
-// this.engine.getGUI().getErrorWindow().error(ErrorMessages.TOPIC_EMPTY_ERROR);
-// return;
-// }
-//
-// // Use topic as a base of workflow instance ID so that the monitor can
-// // find it.
-// URI workfowInstanceID = URI.create(StringUtil.convertToJavaIdentifier(topic));
-// this.workflow.setGPELInstanceID(workfowInstanceID);
-//
-// MonitorConfiguration notifConfig = this.engine.getMonitor().getConfiguration();
-// notifConfig.setTopic(topic);
-// arguments.add("-" + JythonScript.TOPIC_VARIABLE);
-// arguments.add(topic);
-// Collection<WSNode> wsNodes = GraphUtil.getWSNodes(this.engine.getGUI().getWorkflow().getGraph());
-// // This is to enable service interaction with the back end
-// if (this.interactChkBox.isSelected()) {
-// LinkedList<String> nodeIDs = new LinkedList<String>();
-// for (WSNode node : wsNodes) {
-// nodeIDs.add(node.getID());
-// ((WSNodeGUI) NodeController.getGUI(node)).setInteractiveMode(true);
-// }
-// notifConfig.setInteractiveNodeIDs(nodeIDs);
-// } else {
-// for (WSNode node : wsNodes) {
-// ((WSNodeGUI) NodeController.getGUI(node)).setInteractiveMode(false);
-// }
-// }
-//
-// final boolean isRunCrossProduct=chkRunWithCrossProduct.isSelected();
-// // TODO error check for user inputs
-//
-// final List<InputNode> inputNodes = GraphUtil.getInputNodes(this.workflow.getGraph());
-// builder.newFragment("inputs");
-// new ODEClient();
-// for (int i = 0; i < inputNodes.size(); i++) {
-// InputNode inputNode = inputNodes.get(i);
-// XBayaTextField parameterTextField = this.parameterTextFields.get(i);
-// inputNode.getID();
-// String value = parameterTextField.getText();
-// inputNode.setDefaultValue(value);
-// }
-//
-//// final String gFacUrl = ((URI) this.gfacUrlListField.getSelectedItem()).toASCIIString();
-//// if (null != gFacUrl && !"".equals(gFacUrl)) {
-//// try {
-//// this.engine.getConfiguration().setGFacURL(new URI(gFacUrl));
-//// } catch (URISyntaxException e) {
-//// this.engine.getGUI().getErrorWindow().error(e);
-//// }
-//// }
-// this.engine.getConfiguration().setTopic(topic);
-//
-// /*
-// * Load host description from xregistry and add to interpreter
-// */
-// LeadResourceMapping mapping = null;
-//
-// final LeadResourceMapping resourceMapping = mapping;
-// final String topicString = topic;
-// new Thread() {
-// /**
-// * @see java.lang.Thread#run()
-// */
-// @Override
-// public void run() {
-// XBayaConfiguration conf = DynamicWorkflowRunnerWindow.this.engine.getConfiguration();
-// WorkflowInterpreterConfiguration workflowInterpreterConfiguration = new WorkflowInterpreterConfiguration(engine.getGUI().getWorkflow(),topicString,conf.getMessageBoxURL(), conf.getBrokerURL(), conf.getAiravataAPI(), conf, DynamicWorkflowRunnerWindow.this.engine.getGUI(), DynamicWorkflowRunnerWindow.this.engine.getMonitor());
-// workflowInterpreterConfiguration.setRunWithCrossProduct(isRunCrossProduct);
-//
-// WorkflowInterpreter workflowInterpreter = new WorkflowInterpreter(
-// workflowInterpreterConfiguration, new GUIWorkflowInterpreterInteractorImpl(engine, engine.getGUI().getWorkflow()));
-// DynamicWorkflowRunnerWindow.this.engine.registerWorkflowInterpreter(workflowInterpreter);
-// try {
-// MonitorConfiguration notifConfig = DynamicWorkflowRunnerWindow.this.engine.getMonitor()
-// .getConfiguration();
-// notifConfig.setTopic(topicString);
-// DynamicWorkflowRunnerWindow.this.engine.getMonitor().start();
-//
-// if (resourceMapping != null)
-// workflowInterpreter.setResourceMapping(resourceMapping);
-//
-// workflowInterpreter.scheduleDynamically();
-//// try {
-//// engine.getConfiguration().getJcrComponentRegistry().getRegistry().saveWorkflowExecutionName(topicString, instanceNameFinal);
-//// } catch (RegistryException e) {
-//// e.printStackTrace();
-//// }
-// } catch (WorkflowException e) {
-// try {
-// workflowInterpreter.cleanup();
-// } catch (MonitorException e1) {
-// DynamicWorkflowRunnerWindow.this.engine.getGUI().getErrorWindow().error(e1);
-// }
-// DynamicWorkflowRunnerWindow.this.engine.getGUI().getErrorWindow().error(e);
-// }
-//
-// }
-// }.start();
-//
-// hide();
-// }
-//}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/airavata/blob/382b6c0e/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/dialogs/graph/system/ConstantConfigurationDialog.java
----------------------------------------------------------------------
diff --git a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/dialogs/graph/system/ConstantConfigurationDialog.java b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/dialogs/graph/system/ConstantConfigurationDialog.java
index 13762ed..63b7850 100644
--- a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/dialogs/graph/system/ConstantConfigurationDialog.java
+++ b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/dialogs/graph/system/ConstantConfigurationDialog.java
@@ -31,7 +31,6 @@ import javax.xml.namespace.QName;
import org.apache.airavata.common.utils.XMLUtil;
import org.apache.airavata.model.appcatalog.appinterface.DataType;
import org.apache.airavata.workflow.model.graph.system.ConstantNode;
-import org.apache.airavata.xbaya.lead.LEADTypes;
import org.apache.airavata.xbaya.ui.XBayaGUI;
import org.apache.airavata.xbaya.ui.dialogs.XBayaDialog;
import org.apache.airavata.xbaya.ui.widgets.GridPanel;
http://git-wip-us.apache.org/repos/asf/airavata/blob/382b6c0e/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/dialogs/graph/system/DifferedInputConfigurationDialog.java
----------------------------------------------------------------------
diff --git a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/dialogs/graph/system/DifferedInputConfigurationDialog.java b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/dialogs/graph/system/DifferedInputConfigurationDialog.java
index 665f1da..e81a033 100644
--- a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/dialogs/graph/system/DifferedInputConfigurationDialog.java
+++ b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/dialogs/graph/system/DifferedInputConfigurationDialog.java
@@ -34,7 +34,6 @@ import org.apache.airavata.model.appcatalog.appinterface.DataType;
import org.apache.airavata.workflow.model.graph.Node.NodeExecutionState;
import org.apache.airavata.workflow.model.graph.system.DifferedInputNode;
import org.apache.airavata.xbaya.graph.controller.NodeController;
-import org.apache.airavata.xbaya.lead.LEADTypes;
import org.apache.airavata.xbaya.ui.XBayaGUI;
import org.apache.airavata.xbaya.ui.dialogs.XBayaDialog;
import org.apache.airavata.xbaya.ui.graph.system.DifferedInputNodeGUI;
http://git-wip-us.apache.org/repos/asf/airavata/blob/382b6c0e/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/dialogs/graph/system/InputConfigurationDialog.java
----------------------------------------------------------------------
diff --git a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/dialogs/graph/system/InputConfigurationDialog.java b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/dialogs/graph/system/InputConfigurationDialog.java
index 449c51d..b0c5f57 100644
--- a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/dialogs/graph/system/InputConfigurationDialog.java
+++ b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/dialogs/graph/system/InputConfigurationDialog.java
@@ -31,7 +31,6 @@ import javax.xml.namespace.QName;
import org.apache.airavata.common.utils.XMLUtil;
import org.apache.airavata.model.appcatalog.appinterface.DataType;
import org.apache.airavata.workflow.model.graph.system.InputNode;
-import org.apache.airavata.xbaya.lead.LEADTypes;
import org.apache.airavata.xbaya.ui.XBayaGUI;
import org.apache.airavata.xbaya.ui.dialogs.XBayaDialog;
import org.apache.airavata.xbaya.ui.widgets.GridPanel;
http://git-wip-us.apache.org/repos/asf/airavata/blob/382b6c0e/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/graph/dynamic/DynamicNodeGUI.java
----------------------------------------------------------------------
diff --git a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/graph/dynamic/DynamicNodeGUI.java b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/graph/dynamic/DynamicNodeGUI.java
deleted file mode 100644
index 4229ba7..0000000
--- a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/graph/dynamic/DynamicNodeGUI.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.airavata.xbaya.ui.graph.dynamic;
-
-import java.awt.event.MouseEvent;
-
-import org.apache.airavata.workflow.model.graph.dynamic.DynamicNode;
-import org.apache.airavata.xbaya.XBayaEngine;
-import org.apache.airavata.xbaya.ui.dialogs.graph.dynamic.DynamicNodeWindow;
-import org.apache.airavata.xbaya.ui.graph.NodeGUI;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class DynamicNodeGUI extends NodeGUI {
-
- private final static Logger logger = LoggerFactory.getLogger(DynamicNodeGUI.class);
-
- private DynamicNode node;
-
- private DynamicNodeWindow window;
-
- /**
- * Creates a WsNodeGui
- *
- * @param node
- */
- public DynamicNodeGUI(DynamicNode node) {
- super(node);
- this.node = node;
- }
-
- /**
- * @see org.apache.airavata.xbaya.ui.graph.GraphPieceGUI#mouseClicked(java.awt.event.MouseEvent,
- * org.apache.airavata.xbaya.XBayaEngine)
- */
- @Override
- public void mouseClicked(MouseEvent event, XBayaEngine engine) {
- logger.debug(event.toString());
- if (event.getClickCount() >= 2) {
- showWindow(engine);
- }
- }
-
- private void showWindow(XBayaEngine engine) {
- if (this.window == null) {
- this.window = new DynamicNodeWindow(engine, this.node);
- }
- try {
- this.window.show();
- } catch (Throwable e) {
- engine.getGUI().getErrorWindow().error(e);
- }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/airavata/blob/382b6c0e/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/menues/RunMenuItem.java
----------------------------------------------------------------------
diff --git a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/menues/RunMenuItem.java b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/menues/RunMenuItem.java
index db5628a..f468972 100644
--- a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/menues/RunMenuItem.java
+++ b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/menues/RunMenuItem.java
@@ -114,10 +114,10 @@ public class RunMenuItem implements EventListener, XBayaExecutionModeListener{
runMenu.add(launchXBayaInterpreterItem);
// runMenu.add(launchDynamicWorkflowItem);
- runMenu.addSeparator();
+// runMenu.addSeparator();
// runMenu.add(stopWorkflowItem);
- runMenu.addSeparator();
+// runMenu.addSeparator();
// runMenu.add(this.resumeMonitoringItem);
// runMenu.add(this.pauseMonitoringItem);
@@ -249,7 +249,7 @@ public class RunMenuItem implements EventListener, XBayaExecutionModeListener{
}
private void createLaunchXBayaInterpreterItem() {
- this.launchXBayaInterpreterItem = new JMenuItem("Run on Interpreter Server...", MenuIcons.RUN_ICON);
+ this.launchXBayaInterpreterItem = new JMenuItem("Launch Workflow to Airavata Server...", MenuIcons.RUN_ICON);
AbstractAction action = new AbstractAction() {
private WorkflowInterpreterLaunchWindow window;
public void actionPerformed(ActionEvent e) {
http://git-wip-us.apache.org/repos/asf/airavata/blob/382b6c0e/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/util/InterpreterUtil.java
----------------------------------------------------------------------
diff --git a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/util/InterpreterUtil.java b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/util/InterpreterUtil.java
deleted file mode 100644
index 725a20f..0000000
--- a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/util/InterpreterUtil.java
+++ /dev/null
@@ -1,391 +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.util;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Iterator;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-
-import org.apache.airavata.common.utils.StringUtil;
-import org.apache.airavata.workflow.model.exceptions.WorkflowException;
-import org.apache.airavata.workflow.model.exceptions.WorkflowRuntimeException;
-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.amazon.InstanceNode;
-import org.apache.airavata.workflow.model.graph.impl.NodeImpl;
-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.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.ForEachNode;
-import org.apache.airavata.workflow.model.graph.system.InputNode;
-import org.apache.airavata.workflow.model.graph.system.SystemDataPort;
-import org.apache.airavata.workflow.model.graph.ws.WSGraph;
-import org.apache.airavata.workflow.model.graph.ws.WSNode;
-import org.apache.airavata.workflow.model.graph.ws.WSPort;
-import org.apache.airavata.xbaya.interpretor.SystemComponentInvoker;
-import org.apache.airavata.xbaya.interpretor.WorkFlowInterpreterException;
-import org.apache.airavata.xbaya.invoker.GenericInvoker;
-import org.apache.airavata.xbaya.invoker.Invoker;
-import org.apache.airavata.xbaya.invoker.WorkflowInvokerWrapperForGFacInvoker;
-import org.xmlpull.infoset.XmlElement;
-import org.xmlpull.infoset.impl.XmlElementWithViewsImpl;
-
-import xsul5.XmlConstants;
-import xsul5.wsdl.WsdlPort;
-import xsul5.wsdl.WsdlService;
-//import org.apache.airavata.xbaya.ui.monitor.MonitorEventHandler;
-//import org.apache.airavata.xbaya.ui.monitor.MonitorEventHandler.NodeState;
-
-public class InterpreterUtil {
- /**
- * This method returns the input values for given foreach node
- *
- * @param forEachNode
- * @param listOfValues
- * @param invokerMap
- * @return
- * @throws WorkflowException
- */
- public static Object getInputsForForEachNode(final ForEachNode forEachNode, final LinkedList<String> listOfValues, Map<Node, Invoker> invokerMap)
- throws WorkflowException {
- List<DataPort> inputPorts = forEachNode.getInputPorts();
-
- Object returnValForProvenance = null;
- for (DataPort inputPort : inputPorts) {
-
- Node inputNode = inputPort.getFromNode();
- // if input node for for-each is WSNode
- if (inputNode instanceof InputNode) {
-// for (DataPort dataPort : forEachNode.getInputPorts()) {
- returnValForProvenance = InterpreterUtil.findInputFromPort(inputPort, invokerMap);
- if (null == returnValForProvenance) {
- throw new WorkFlowInterpreterException("Unable to find input for the node:" + forEachNode.getID());
- }
- String[] vals = StringUtil.getElementsFromString(returnValForProvenance.toString());
- listOfValues.addAll(Arrays.asList(vals));
-// }
- } else {
- Invoker workflowInvoker = invokerMap.get(inputNode);
- if (workflowInvoker != null) {
- if (workflowInvoker instanceof GenericInvoker) {
-
- String outputName = inputNode.getOutputPort(0).getName();
- returnValForProvenance = workflowInvoker.getOutput(outputName);
- Iterator children = null;
- if (returnValForProvenance instanceof org.xmlpull.v1.builder.XmlElement) {
- org.xmlpull.v1.builder.XmlElement msgElmt = (org.xmlpull.v1.builder.XmlElement) returnValForProvenance;
- children = msgElmt.children();
- } else {
- XmlElement msgElmt = XmlConstants.BUILDER.parseFragmentFromString("<temp>" + returnValForProvenance + "</temp>");
- children = msgElmt.children().iterator();
- }
- while (children.hasNext()) {
- Object object = children.next();
- if (object instanceof org.xmlpull.v1.builder.XmlElement) {
- org.xmlpull.v1.builder.XmlElement child = (org.xmlpull.v1.builder.XmlElement) object;
- Iterator valItr = child.children();
- if (valItr.hasNext()) {
- Object object2 = valItr.next();
- if (object2 instanceof String) {
- listOfValues.add(object2.toString());
- }
- }
- }
- if (object instanceof XmlElement) {
- listOfValues.add(((XmlElement) object).children().iterator().next().toString());
- }if (object instanceof String){
- listOfValues.add(object.toString());
- }
- }
- } else if (workflowInvoker instanceof SystemComponentInvoker) {
- int index = inputNode.getOutputPorts().indexOf(inputPort.getEdge(0).getFromPort());
- String outputName = "";
- if (inputNode.getInputPort(index) instanceof SystemDataPort) {
- outputName = ((SystemDataPort) inputNode.getInputPort(index)).getWSComponentPort().getName();
- } else if (inputNode.getInputPort(index) instanceof WSPort) {
- outputName = ((SystemDataPort) inputNode.getInputPort(inputNode.getOutputPorts().indexOf(
- inputPort.getEdge(0).getFromPort()))).getWSComponentPort().getName();
- }
- returnValForProvenance = workflowInvoker.getOutput(outputName);
- XmlElement msgElmt = XmlConstants.BUILDER.parseFragmentFromString("<temp>" + returnValForProvenance + "</temp>");
- Iterator valItr = msgElmt.children().iterator();
- while (valItr.hasNext()) {
- Object object2 = valItr.next();
- if (object2 instanceof XmlElement) {
- listOfValues.add(((XmlElement) object2).children().iterator().next().toString());
- }
- }
- }
- } else {
- throw new WorkFlowInterpreterException("Did not find inputs from WS to foreach");
- }
- }
- }
- return returnValForProvenance;
- }
-
- /**
- *
- * @param inputPort
- * @param invokerMap
- * @return
- * @throws WorkflowException
- */
- public static Object findInputFromPort(DataPort inputPort, Map<Node, Invoker> invokerMap) throws WorkflowException {
- Object outputVal = null;
- Node fromNode = inputPort.getFromNode();
- if (fromNode instanceof InputNode) {
- outputVal = ((InputNode) fromNode).getDefaultValue();
- } else if (fromNode instanceof ConstantNode) {
- outputVal = ((ConstantNode) fromNode).getValue();
- } else if (fromNode instanceof DifferedInputNode && ((DifferedInputNode) fromNode).isConfigured()) {
- outputVal = ((DifferedInputNode) fromNode).getDefaultValue();
- } else if (fromNode instanceof EndifNode || fromNode instanceof DoWhileNode || fromNode instanceof EndDoWhileNode) {
- Invoker fromInvoker = invokerMap.get(fromNode);
- outputVal = fromInvoker.getOutput(inputPort.getFromPort().getID());
- } else if (fromNode instanceof InstanceNode) {
- return ((InstanceNode) fromNode).getOutputInstanceId();
- } else if (fromNode instanceof EndForEachNode) {
- outputVal = "";
- Invoker workflowInvoker = invokerMap.get(fromNode);
- String outputName = "";
- if (inputPort instanceof SystemDataPort) {
- outputName = ((SystemDataPort) inputPort).getWSComponentPort().getName();
-
- } else if (inputPort instanceof WSPort) {
- outputName = ((SystemDataPort) fromNode.getInputPort(fromNode.getOutputPorts().indexOf(inputPort.getEdge(0).getFromPort())))
- .getWSComponentPort().getName();
- }
- XmlElement msgElmt = XmlConstants.BUILDER.parseFragmentFromString("<temp>" + workflowInvoker.getOutput(outputName) + "</temp>");
- Iterator valItr = msgElmt.children().iterator();
- while (valItr.hasNext()) {
- Object object2 = valItr.next();
- if (object2 instanceof XmlElement) {
-
- if (((XmlElement) object2).children().iterator().hasNext()) {
- outputVal = outputVal + StringUtil.DELIMETER + StringUtil.quoteString(((XmlElement) object2).children().iterator().next().toString());
- }
- }
- }
-
- if (((String) outputVal).length() == 0) {
- throw new WorkflowException("Empty Output Generated");
- }
- outputVal = ((String) outputVal).substring(1, ((String) outputVal).length());
- } else {
- Invoker fromInvoker = invokerMap.get(fromNode);
- try {
- if (fromInvoker != null)
- outputVal = fromInvoker.getOutput(inputPort.getFromPort().getName());
-
- } catch (Exception e) {
- // if the value is still null look it up from the inputport name
- // because the value is set to the input port name at some point
- // there is no harm in doing this
- if (null == outputVal) {
- outputVal = fromInvoker.getOutput(inputPort.getName());
- }
- }
-
- }
- return outputVal;
-
- }
-
- /**
- * @param node
- * @return
- */
- public static Node findEndForEachFor(ForEachNode node) {
-
- Collection<Node> toNodes = node.getOutputPort(0).getToNodes();
- if (toNodes.size() != 1) {
- throw new WorkflowRuntimeException("ForEach output does not contain single out-edge");
- }
- Node middleNode = toNodes.iterator().next();
- List<DataPort> outputPorts = middleNode.getOutputPorts();
- for (DataPort dataPort : outputPorts) {
- if (dataPort.getToNodes().size() == 1) {
- Node possibleEndForEachNode = dataPort.getToNodes().get(0);
- if (possibleEndForEachNode instanceof EndForEachNode) {
- return possibleEndForEachNode;
- }
- }
- }
- throw new WorkflowRuntimeException("EndForEachNode not found");
- }
-
- public static Integer[] getNumberOfInputsForForEachNode(final ForEachNode forEachNode, Map<Node, Invoker> invokerMap) throws WorkflowException {
- List<DataPort> inputPorts = forEachNode.getInputPorts();
- Integer[] inputNumbers = new Integer[inputPorts.size()];
- for (DataPort forEachInputPort : inputPorts) {
- // if input node for for-each is WSNode
- Node forEachInputNode = forEachInputPort.getFromNode();
- int index = 0;
- Object returnValForProvenance = null;
- if (forEachInputNode instanceof InputNode) {
- returnValForProvenance = InterpreterUtil.findInputFromPort(forEachInputPort, invokerMap);
- if (null == returnValForProvenance) {
- throw new WorkFlowInterpreterException("Unable to find input for the node:" + forEachNode.getID());
- }
- String[] vals = StringUtil.getElementsFromString(returnValForProvenance.toString());
- inputNumbers[inputPorts.indexOf(forEachInputPort)] = vals.length;
- } else {
- Invoker workflowInvoker = invokerMap.get(forEachInputNode);
- if (workflowInvoker != null) {
- if (workflowInvoker instanceof GenericInvoker) {
-
- returnValForProvenance = ((GenericInvoker) workflowInvoker).getOutputs();
- String message = returnValForProvenance.toString();
-
- XmlElement msgElmt = XmlConstants.BUILDER.parseFragmentFromString(message);
- Iterator children = msgElmt.children().iterator();
- while (children.hasNext()) {
- Object object = children.next();
- // foreachWSNode.getInputPort(0).getType()
- if (object instanceof XmlElement) {
- index++;
- }
- }
- } else if (workflowInvoker instanceof WorkflowInvokerWrapperForGFacInvoker) {
- String outputName = forEachInputNode.getOutputPort(0).getName();
- returnValForProvenance = workflowInvoker.getOutput(outputName);
- org.xmlpull.v1.builder.XmlElement msgElmt = (org.xmlpull.v1.builder.XmlElement) returnValForProvenance;
- Iterator children = msgElmt.children();
- while (children.hasNext()) {
- Object object = children.next();
- if (object instanceof org.xmlpull.v1.builder.XmlElement) {
- org.xmlpull.v1.builder.XmlElement child = (org.xmlpull.v1.builder.XmlElement) object;
- Iterator valItr = child.children();
- if (valItr.hasNext()) {
- Object object2 = valItr.next();
- if (object2 instanceof String) {
- index++;
- }
- }
- }
- }
- inputNumbers[inputPorts.indexOf(forEachInputPort)] = index;
- } else if (workflowInvoker instanceof SystemComponentInvoker) {
- int portIndex = forEachInputNode.getOutputPorts().indexOf(forEachInputPort.getEdge(0).getFromPort());
- String outputName = "";
- if (forEachInputNode.getInputPort(portIndex) instanceof SystemDataPort) {
- outputName = ((SystemDataPort) forEachInputNode.getInputPort(portIndex)).getWSComponentPort().getName();
- } else if (forEachInputNode.getInputPort(portIndex) instanceof WSPort) {
- outputName = ((WSPort) forEachInputNode.getInputPort(portIndex)).getComponentPort().getName();
- }
- returnValForProvenance = workflowInvoker.getOutput(outputName);
- XmlElement msgElmt = XmlConstants.BUILDER.parseFragmentFromString("<temp>" + returnValForProvenance + "</temp>");
- Iterator valItr = msgElmt.children().iterator();
- while (valItr.hasNext()) {
- Object object2 = valItr.next();
- if (object2 instanceof XmlElement) {
- index++;
- }
- }
- inputNumbers[inputPorts.indexOf(forEachInputPort)] = index;
- }
-
- } else {
- throw new WorkFlowInterpreterException("Did not find inputs from WS to foreach");
- }
- }
- }
- return inputNumbers;
- }
-
- public static ArrayList<Node> getFinishedNodesDynamically(WSGraph graph) {
- return getNodesWithBodyColor(NodeExecutionState.FINISHED, graph);
- }
-
- public static ArrayList<Node> getFailedNodesDynamically(WSGraph graph) {
- return getNodesWithBodyColor(NodeExecutionState.FAILED, graph);
- }
-
- public static ArrayList<Node> getWaitingNodesDynamically(WSGraph graph) {
- return getNodesWithBodyColor(NodeExecutionState.WAITING, graph);
- }
-
- public static ArrayList<Node> getNodesWithBodyColor(NodeExecutionState state, WSGraph graph) {
- ArrayList<Node> list = new ArrayList<Node>();
- List<NodeImpl> nodes = graph.getNodes();
- for (Node node : nodes) {
- if (node.getState()==state) {
- list.add(node);
- }
- }
- return list;
- }
-
- public static int getRunningNodeCountDynamically(WSGraph graph) {
- return getNodeCountWithBodyColor(NodeExecutionState.EXECUTING, graph);
- }
-
- public static int getFailedNodeCountDynamically(WSGraph graph) {
- return getFailedNodesDynamically(graph).size();
- }
-
- public static int getWaitingNodeCountDynamically(WSGraph graph) {
- return getNodeCountWithBodyColor(NodeExecutionState.WAITING, graph);
- }
-
- public static int getNodeCountWithBodyColor(NodeExecutionState state, WSGraph graph) {
- int sum = 0;
- List<NodeImpl> nodes = graph.getNodes();
- for (Node node : nodes) {
- if (node.getState()==state) {
- ++sum;
- }
- }
- return sum;
- }
-
-// public static String getEPR(WSNode wsNode) {
-// Iterable<WsdlService> services = wsNode.getComponent().getWSDL().services();
-// Iterator<WsdlService> iterator = services.iterator();
-// if (iterator.hasNext()) {
-// Iterable<WsdlPort> ports = iterator.next().ports();
-// Iterator<WsdlPort> portIterator = ports.iterator();
-// if (portIterator.hasNext()) {
-// WsdlPort port = portIterator.next();
-// Iterable children = port.xml().children();
-// Iterator childIterator = children.iterator();
-// while (childIterator.hasNext()) {
-// Object next = childIterator.next();
-// if (next instanceof XmlElementWithViewsImpl) {
-// org.xmlpull.infoset.XmlAttribute epr = ((XmlElementWithViewsImpl) next).attribute("location");
-// return epr.getValue();
-// }
-// }
-// }
-// }
-// return null;
-// }
-
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/382b6c0e/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/util/XBayaUtil.java
----------------------------------------------------------------------
diff --git a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/util/XBayaUtil.java b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/util/XBayaUtil.java
index db25a1a..abb0b86 100644
--- a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/util/XBayaUtil.java
+++ b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/util/XBayaUtil.java
@@ -50,8 +50,6 @@ import org.apache.airavata.xbaya.ThriftClientData;
import org.apache.airavata.xbaya.ThriftServiceType;
import org.apache.airavata.xbaya.XBayaConfiguration;
import org.apache.airavata.xbaya.XBayaEngine;
-import org.apache.airavata.xbaya.invoker.Invoker;
-import org.apache.airavata.xbaya.lead.LeadContextHeaderHelper;
import org.apache.airavata.xbaya.ui.dialogs.registry.RegistryWindow;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -68,52 +66,6 @@ public class XBayaUtil {
public static final String JCR_PASS = "jcr.password";
public static final String JCR_URL = "jcr.url";
- public static LeadContextHeader buildLeadContextHeader(final XBayaEngine engine,
- String nodeId, LeadResourceMapping resourceMapping)
- throws URISyntaxException {
-
- XBayaConfiguration configuration = engine.getConfiguration();
- Workflow workflow = engine.getGUI().getWorkflow();
-
- LeadContextHeader leadContext = buildLeadContextHeader(workflow, configuration, nodeId,
- resourceMapping);
-
- return leadContext;
-
- }
-
- /**
- *
- * @param workflow
- * @param configuration
- * @param nodeId
- * @param resourceMapping
- * @return
- * @throws URISyntaxException
- */
- public static LeadContextHeader buildLeadContextHeader(Workflow workflow, XBayaConfiguration configuration,
- String nodeId, LeadResourceMapping resourceMapping)
- throws URISyntaxException {
- LeadContextHeaderHelper leadContextHelper = new LeadContextHeaderHelper();
- leadContextHelper.setXBayaConfiguration(configuration);
-
- leadContextHelper.setWorkflowInstanceID(workflow.getGPELInstanceID());
- leadContextHelper.setWorkflowTemplateID(workflow.getUniqueWorkflowName());
-
-// leadContextHelper.setMonitorConfiguration(monitorConfiguration);
-
- LeadContextHeader leadContext = leadContextHelper.getLeadContextHeader();
-
- leadContext.setNodeId(nodeId);
-
- leadContext.setTimeStep("1");
-
- if (resourceMapping != null) {
- leadContext.setResourceMapping(resourceMapping);
- }
- return leadContext;
-
- }
public static boolean isURLExists(String URLName) {
try {
@@ -149,65 +101,6 @@ public class XBayaUtil {
RegistryWindow window = new RegistryWindow(xbayaEngine, ThriftServiceType.API_SERVICE);
window.show();
}
-
- /**
- *
- * @param inputPort
- * @param invokerMap
- * @return
- * @throws WorkflowException
- */
- public static Object findInputFromPort(DataPort inputPort, Map<Node, Invoker> invokerMap) throws WorkflowException {
- Object outputVal = null;
- Node fromNode = inputPort.getFromNode();
- if (fromNode instanceof InputNode) {
- outputVal = ((InputNode) fromNode).getDefaultValue();
- } else if (fromNode instanceof ConstantNode) {
- outputVal = ((ConstantNode) fromNode).getValue();
- } else if (fromNode instanceof EndifNode) {
- Invoker fromInvoker = invokerMap.get(fromNode);
- outputVal = fromInvoker.getOutput(inputPort.getFromPort().getID());
- } else if (fromNode instanceof InstanceNode) {
- return ((InstanceNode) fromNode).getOutputInstanceId();
- } else if (fromNode instanceof EndForEachNode) {
- outputVal = "";
- Invoker workflowInvoker = invokerMap.get(fromNode);
- String outputName = fromNode.getOutputPort(0).getName();
- XmlElement msgElmt = XmlConstants.BUILDER
- .parseFragmentFromString("<temp>"
- + workflowInvoker.getOutput(outputName) + "</temp>");
- Iterator valItr = msgElmt.children().iterator();
- while (valItr.hasNext()) {
- Object object2 = valItr.next();
- if (object2 instanceof XmlElement) {
- outputVal = outputVal
- + StringUtil.DELIMETER
- + StringUtil.quoteString(((XmlElement) object2).children().iterator()
- .next().toString());
- }
- }
- outputVal = ((String) outputVal).substring(1,
- ((String) outputVal).length());
- } else {
- Invoker fromInvoker = invokerMap.get(fromNode);
- try {
- if (fromInvoker != null)
- outputVal = fromInvoker.getOutput(inputPort.getFromPort()
- .getName());
-
- } catch (Exception e) {
- // if the value is still null look it up from the inputport name
- // because the value is set to the input port name at some point
- // there is no harm in doing this
- if (null == outputVal) {
- outputVal = fromInvoker.getOutput(inputPort.getName());
- }
- }
-
- }
- return outputVal;
-
- }
/**
* @param node
[2/3] airavata git commit: Cleaning up Xbaya use of legacy LEAD code
- AIRAVATA-1700
Posted by sm...@apache.org.
http://git-wip-us.apache.org/repos/asf/airavata/blob/382b6c0e/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/invoker/GenericInvoker.java
----------------------------------------------------------------------
diff --git a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/invoker/GenericInvoker.java b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/invoker/GenericInvoker.java
deleted file mode 100644
index e59c150..0000000
--- a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/invoker/GenericInvoker.java
+++ /dev/null
@@ -1,529 +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.invoker;
-
-import java.io.File;
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.concurrent.Callable;
-import java.util.concurrent.ExecutionException;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
-import java.util.concurrent.Future;
-import java.util.concurrent.TimeUnit;
-import java.util.concurrent.TimeoutException;
-
-import javax.xml.namespace.QName;
-
-import org.apache.airavata.common.workflow.execution.context.WorkflowContextHeaderBuilder;
-import org.apache.airavata.common.utils.XMLUtil;
-import org.apache.airavata.schemas.wec.ContextHeaderDocument;
-import org.apache.airavata.workflow.model.exceptions.WorkflowException;
-import org.apache.airavata.workflow.model.exceptions.WorkflowRuntimeException;
-import org.apache.airavata.xbaya.invoker.factory.InvokerFactory;
-import org.apache.airavata.xbaya.jython.lib.ServiceNotifiable;
-import org.apache.airavata.xbaya.jython.lib.WorkflowNotifiable;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.xmlpull.v1.builder.XmlElement;
-
-import xsul.wsdl.WsdlDefinitions;
-import xsul.wsdl.WsdlException;
-import xsul.wsdl.WsdlResolver;
-import xsul.wsif.WSIFMessage;
-import xsul.xhandler_soap_sticky_header.StickySoapHeaderHandler;
-import xsul.xwsif_runtime.WSIFClient;
-
-public class GenericInvoker implements Invoker {
-
- private static final Logger logger = LoggerFactory.getLogger(GenericInvoker.class);
-
- private String nodeID;
-
- private QName portTypeQName;
-
- private String wsdlLocation;
-
- private String serviceInformation;
-
- private String messageBoxURL;
-
- private String gfacURL;
-
- private Invoker invoker;
-
- private Future<Boolean> result;
-
- private ServiceNotifiable notifier;
-
- private ContextHeaderDocument.ContextHeader contextHeader;
-
- private String topic;
-
- /**
- * used for notification
- */
- private List<Object> inputValues = new ArrayList<Object>();
-
- /**
- * used for notification
- */
- private List<String> inputNames = new ArrayList<String>();
-
- boolean failerSent;
-
- private WsdlDefinitions wsdlDefinitionObject;
-
- /**
- * Creates an InvokerWithNotification.
- *
- * @param portTypeQName
- *
- * @param wsdlLocation
- * The URL of WSDL of the service to invoke
- * @param nodeID
- * The ID of the service
- * @param notifier
- * The notification sender
- */
- public GenericInvoker(QName portTypeQName, String wsdlLocation, String nodeID, WorkflowNotifiable notifier) {
- this(portTypeQName, wsdlLocation, nodeID, null, notifier);
- }
-
- /**
- * Creates an InvokerWithNotification.
- *
- * @param portTypeQName
- *
- * @param wsdlLocation
- * The URL of WSDL of the service to invoke
- * @param nodeID
- * The ID of the service
- * @param gfacURL
- * The URL of GFac service.
- * @param notifier
- * The notification sender
- */
- public GenericInvoker(QName portTypeQName, String wsdlLocation, String nodeID, String gfacURL,
- WorkflowNotifiable notifier) {
- this(portTypeQName, wsdlLocation, nodeID, null, gfacURL, notifier);
- }
-
- /**
- * Creates an InvokerWithNotification.
- *
- * @param portTypeQName
- *
- * @param wsdlLocation
- * The URL of WSDL of the service to invoke
- * @param nodeID
- * The ID of the service
- * @param messageBoxURL
- * @param gfacURL
- * The URL of GFac service.
- * @param notifier
- * The notification sender
- */
- public GenericInvoker(QName portTypeQName, String wsdlLocation, String nodeID, String messageBoxURL,
- String gfacURL, WorkflowNotifiable notifier) {
- this.nodeID = nodeID;
- this.portTypeQName = portTypeQName;
- this.wsdlLocation = wsdlLocation;
- this.serviceInformation = wsdlLocation;
- this.messageBoxURL = messageBoxURL;
- this.gfacURL = gfacURL;
- this.notifier = notifier.createServiceNotificationSender(nodeID);
- this.failerSent = false;
- this.contextHeader = WorkflowContextHeaderBuilder.removeOtherSchedulingConfig(nodeID,WorkflowContextHeaderBuilder.getCurrentContextHeader());
- this.topic = notifier.getTopic();
- }
-
- /**
- *
- * @param portTypeQName
- * @param wsdl
- * @param nodeID
- * @param messageBoxURL
- * @param gfacURL
- * @param notifier
- */
- public GenericInvoker(QName portTypeQName, WsdlDefinitions wsdl, String nodeID, String messageBoxURL,
- String gfacURL, WorkflowNotifiable notifier) {
- final String wsdlStr = xsul.XmlConstants.BUILDER.serializeToString(wsdl);
- this.nodeID = nodeID;
- this.portTypeQName = portTypeQName;
- this.wsdlDefinitionObject = wsdl;
- this.messageBoxURL = messageBoxURL;
- this.serviceInformation = wsdlStr;
- this.gfacURL = gfacURL;
- this.notifier = notifier.createServiceNotificationSender(nodeID);
- this.failerSent = false;
- this.contextHeader = WorkflowContextHeaderBuilder.removeOtherSchedulingConfig(nodeID,WorkflowContextHeaderBuilder.getCurrentContextHeader());
- this.topic = notifier.getTopic();
- }
-
- /**
- *
- * @throws WorkflowException
- */
- public void setup() throws WorkflowException {
- try {
- WsdlDefinitions definitions = null;
- if (this.wsdlLocation != null && !this.wsdlLocation.equals("")) {
- WsdlResolver resolver = WsdlResolver.getInstance();
- definitions = resolver.loadWsdl(new File(".").toURI(), new URI(this.wsdlLocation));
- } else {
- definitions = this.wsdlDefinitionObject;
- }
-
- setup(definitions);
-
- } catch (WorkflowException e) {
- logger.error(e.getMessage(), e);
- // An appropriate message has been set in the exception.
- this.notifier.invocationFailed(e.getMessage(), e);
- throw e;
- } catch (URISyntaxException e) {
- logger.error(e.getMessage(), e);
- String message = "The location of the WSDL has to be a valid URL or file path: " + this.serviceInformation;
- this.notifier.invocationFailed(message, e);
- throw new WorkflowException(message, e);
- } catch (WsdlException e) {
- logger.error(e.getMessage(), e);
- String message = "Error in processing the WSDL: " + this.serviceInformation;
- this.notifier.invocationFailed(message, e);
- throw new WorkflowException(message, e);
- } catch (RuntimeException e) {
- logger.error(e.getMessage(), e);
- String message = "Error in processing the WSDL: " + this.serviceInformation;
- this.notifier.invocationFailed(message, e);
- throw new WorkflowException(message, e);
- }catch (Error e) {
- logger.error(e.getMessage(), e);
- String message = "Unexpected error: " + this.serviceInformation;
- this.notifier.invocationFailed(message, e);
- throw new WorkflowException(message, e);
- }
- }
-
- private void setup(WsdlDefinitions definitions) throws WorkflowException {
-
- // Set LEAD context header.
- WorkflowContextHeaderBuilder builder;
- if(contextHeader == null){
- builder = new WorkflowContextHeaderBuilder(this.notifier.getEventSink()
- .getAddress(), this.gfacURL, null, this.topic,
- "xbaya-experiment", this.messageBoxURL);
- }else{
- builder = new WorkflowContextHeaderBuilder(contextHeader);
- }
- if(builder.getWorkflowMonitoringContext() == null){
- builder.addWorkflowMonitoringContext(this.notifier.getEventSink().getAddress(),
- this.topic,this.nodeID,this.messageBoxURL);
- } else {
- builder.getWorkflowMonitoringContext().setWorkflowInstanceId(this.notifier.getWorkflowID().toASCIIString());
- }
- builder.getWorkflowMonitoringContext().setWorkflowNodeId(this.nodeID);
- builder.getWorkflowMonitoringContext().setServiceInstanceId(this.nodeID);
- builder.getWorkflowMonitoringContext().setWorkflowTimeStep(1);
- builder.setUserIdentifier("xbaya-user");
- //todo write a UI component to collect this information and pass it through Header
-// builder.setGridMyProxyRepository("myproxy.nersc.gov","$user","$passwd",14000);
- StickySoapHeaderHandler handler = new StickySoapHeaderHandler("use-workflowcontext-header", builder.getXml());
- // Create Invoker
- this.invoker = InvokerFactory.createInvoker(this.portTypeQName, definitions, this.gfacURL, this.messageBoxURL,
- builder, true);
- this.invoker.setup();
-
- WSIFClient client = this.invoker.getClient();
- client.addHandler(handler);
-
- WsdlResolver resolver = WsdlResolver.getInstance();
- // Get the concrete WSDL from invoker.setup() and set it to the
- // notifier.
-
- this.notifier.setServiceID(this.nodeID);
- // if (this.wsdlLocation != null) {
- // this.notifier.setServiceID(this.nodeID);
- // } else {
- // String name = this.portTypeQName.getLocalPart();
- // this.notifier.setServiceID(name);
- // }
- }
-
- /**
- *
- * @param operationName
- * The name of the operation
- * @throws WorkflowException
- */
- public void setOperation(String operationName) throws WorkflowException {
- try {
- this.invoker.setOperation(operationName);
- } catch (WorkflowException e) {
- logger.error(e.getMessage(), e);
- // An appropriate message has been set in the exception.
- this.notifier.invocationFailed(e.getMessage(), e);
- throw e;
- } catch (RuntimeException e) {
- logger.error(e.getMessage(), e);
- String message = "The WSDL does not conform to the invoking service: " + this.serviceInformation;
- this.notifier.invocationFailed(message, e);
- throw new WorkflowException(message, e);
- } catch (Error e) {
- logger.error(e.getMessage(), e);
- String message = "Unexpected error: " + this.serviceInformation;
- this.notifier.invocationFailed(message, e);
- throw new WorkflowException(message, e);
- }
- }
-
- /**
- *
- * @param name
- * The name of the input parameter
- * @param value
- * The value of the input parameter
- * @throws WorkflowException
- */
- public void setInput(String name, Object value) throws WorkflowException {
- try {
- if (value instanceof XmlElement) {
- logger.debug("value: " + XMLUtil.xmlElementToString((XmlElement) value));
- }
- this.inputNames.add(name);
- this.inputValues.add(value);
- this.invoker.setInput(name, value);
- } catch (WorkflowException e) {
- logger.error(e.getMessage(), e);
- // An appropriate message has been set in the exception.
- this.notifier.invocationFailed(e.getMessage(), e);
- throw e;
- } catch (RuntimeException e) {
- logger.error(e.getMessage(), e);
- String message = "Error in setting an input. name: " + name + " value: " + value;
- this.notifier.invocationFailed(message, e);
- throw new WorkflowException(message, e);
- } catch (Error e) {
- logger.error(e.getMessage(), e);
- String message = "Unexpected error: " + this.serviceInformation;
- this.notifier.invocationFailed(message, e);
- throw new WorkflowException(message, e);
- }
- }
-
- /**
- *
- * @return
- * @throws WorkflowException
- */
- public synchronized boolean invoke() throws WorkflowException {
- try {
- WSIFMessage inputMessage = this.invoker.getInputs();
- logger.debug("inputMessage: " + XMLUtil.xmlElementToString((XmlElement) inputMessage));
- this.notifier.invokingService(inputMessage);
-
- ExecutorService executor = Executors.newSingleThreadExecutor();
- this.result = executor.submit(new Callable<Boolean>() {
- @SuppressWarnings("boxing")
- public Boolean call() {
- try {
- boolean success = GenericInvoker.this.invoker.invoke();
- if (success) {
- // Send notification
- WSIFMessage outputMessage = GenericInvoker.this.invoker.getOutputs();
- // An implementation of WSIFMessage,
- // WSIFMessageElement, implements toString(), which
- // serialize the message XML.
- logger.debug("outputMessage: " + outputMessage);
- GenericInvoker.this.notifier.serviceFinished(outputMessage);
- } else {
- //if error occurse gfac-axis2 write the error in to output not to the fault
- WSIFMessage faultMessage = GenericInvoker.this.invoker.getOutputs();
- // An implementation of WSIFMessage,
- // WSIFMessageElement, implements toString(), which
- // serialize the message XML.
- logger.debug("received fault: " + faultMessage);
- GenericInvoker.this.notifier.receivedFault(faultMessage);
- GenericInvoker.this.failerSent = true;
- }
- return success;
- } catch (WorkflowException e) {
- logger.error(e.getMessage(), e);
- // An appropriate message has been set in the exception.
- GenericInvoker.this.notifier.invocationFailed(e.getMessage(), e);
- GenericInvoker.this.failerSent = true;
- throw new WorkflowRuntimeException(e);
- } catch (RuntimeException e) {
- logger.error(e.getMessage(), e);
- String message = "Error in invoking a service: " + GenericInvoker.this.serviceInformation;
- GenericInvoker.this.notifier.invocationFailed(message, e);
- GenericInvoker.this.failerSent = true;
- throw e;
- }
- }
- });
-
- // Kill the thread inside of executor. This is necessary for Jython
- // script to finish.
- executor.shutdown();
-
- // Let other threads know that job has been submitted.
- notifyAll();
-
- // Check if the invocation itself fails. This happens immediately.
- try {
- this.result.get(100, TimeUnit.MILLISECONDS);
- } catch (InterruptedException e) {
- logger.error(e.getMessage(), e);
- } catch (TimeoutException e) {
- // The job is probably running fine.
- // The normal case.
- return true;
- } catch (ExecutionException e) {
- // The service-failed notification should have been sent
- // already.
- logger.error(e.getMessage(), e);
- String message = "Error in invoking a service: " + this.serviceInformation;
- throw new WorkflowException(message, e);
- }
- } catch (RuntimeException e) {
- logger.error(e.getMessage(), e);
- String message = "Error in invoking a service: " + this.serviceInformation;
- this.notifier.invocationFailed(message, e);
- throw new WorkflowException(message, e);
- } catch (Error e) {
- logger.error(e.getMessage(), e);
- String message = "Unexpected error: " + this.serviceInformation;
- this.notifier.invocationFailed(message, e);
- throw new WorkflowException(message, e);
- }
- return true;
- }
-
- /**
- *
- * @throws WorkflowException
- */
- @SuppressWarnings("boxing")
- public synchronized void waitToFinish() throws WorkflowException {
- try {
- while (this.result == null) {
- // The job is not submitted yet.
- try {
- wait();
- } catch (InterruptedException e) {
- logger.error(e.getMessage(), e);
- }
- }
- // Wait for the job to finish.
- Boolean success = this.result.get();
- if (success == false) {
- WSIFMessage faultMessage = this.invoker.getFault();
- String message = "Error in a service: ";
- // An implementation of WSIFMessage,
- // WSIFMessageElement, implements toString(), which
- // serialize the message XML.
- message += faultMessage.toString();
- throw new WorkflowException(message);
- }
- } catch (InterruptedException e) {
- logger.error(e.getMessage(), e);
- } catch (ExecutionException e) {
- // The service-failed notification should have been sent already.
- logger.error(e.getMessage(), e);
- String message = "Error in invoking a service: " + this.serviceInformation;
- throw new WorkflowException(message, e);
- } catch (RuntimeException e) {
- logger.error(e.getMessage(), e);
- String message = "Error while waiting for a service to finish: " + this.serviceInformation;
- this.notifier.invocationFailed(message, e);
- throw new WorkflowException(message, e);
- } catch (Error e) {
- logger.error(e.getMessage(), e);
- String message = "Unexpected error: " + this.serviceInformation;
- this.notifier.invocationFailed(message, e);
- throw new WorkflowException(message, e);
- }
- }
-
- /**
- *
- * @param name
- * The name of the output parameter
- * @return
- * @throws WorkflowException
- */
- public Object getOutput(String name) throws WorkflowException {
- try {
- waitToFinish();
- Object output = this.invoker.getOutput(name);
- if (output instanceof XmlElement) {
- logger.debug("output: " + XMLUtil.xmlElementToString((XmlElement) output));
- }
- return output;
- } catch (WorkflowException e) {
- logger.error(e.getMessage(), e);
- // An appropriate message has been set in the exception.
- if (!this.failerSent) {
- this.notifier.invocationFailed(e.getMessage(), e);
- }
- throw e;
- } catch (RuntimeException e) {
- logger.error(e.getMessage(), e);
- String message = "Error while waiting for a output: " + name;
- this.notifier.invocationFailed(message, e);
- throw new WorkflowException(message, e);
- } catch (Error e) {
- logger.error(e.getMessage(), e);
- String message = "Unexpected error: " + this.serviceInformation;
- this.notifier.invocationFailed(message, e);
- throw new WorkflowException(message, e);
- }
- }
-
- /**
- *
- * @return
- * @throws WorkflowException
- */
- public WSIFMessage getOutputs() throws WorkflowException {
- return this.invoker.getOutputs();
- }
-
- @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/382b6c0e/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/invoker/Invoker.java
----------------------------------------------------------------------
diff --git a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/invoker/Invoker.java b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/invoker/Invoker.java
deleted file mode 100644
index 4580587..0000000
--- a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/invoker/Invoker.java
+++ /dev/null
@@ -1,105 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.airavata.xbaya.invoker;
-
-import org.apache.airavata.workflow.model.exceptions.WorkflowException;
-
-import xsul.wsif.WSIFMessage;
-import xsul.xwsif_runtime.WSIFClient;
-
-public interface Invoker {
-
- /**
- * Sets up the service.
- *
- * @throws WorkflowException
- */
- public void setup() throws WorkflowException;
-
- /**
- * @return The WSIFClient.
- */
- public WSIFClient getClient();
-
- /**
- * Sets the operation name to invoke.
- *
- * @param operationName
- * The name of the operation
- * @throws WorkflowException
- */
- public void setOperation(String operationName) throws WorkflowException;
-
- /**
- * Sets an input parameter
- *
- * @param name
- * The name of the input parameter
- * @param value
- * The value of the input parameter
- * @throws WorkflowException
- */
- public void setInput(String name, Object value) throws WorkflowException;
-
- /**
- * Returns the all input parameters
- *
- * @return The input parameters
- * @throws WorkflowException
- */
- public WSIFMessage getInputs() throws WorkflowException;
-
- /**
- * Invokes the service.
- *
- * @return true if the invocation succeeds; fase otherwise
- * @throws WorkflowException
- */
- public boolean invoke() throws WorkflowException;
-
- /**
- * Returns the all output parameters
- *
- * @return The output parameters
- * @throws WorkflowException
- */
- public WSIFMessage getOutputs() throws WorkflowException;
-
- /**
- * Returns the output of a specified name.
- *
- * @param name
- * The name of the output parameter
- * @return The value of the output
- * @throws WorkflowException
- */
- public Object getOutput(String name) throws WorkflowException;
-
- /**
- * Returns the fault message.
- *
- * @return The fault message
- * @throws WorkflowException
- */
- public WSIFMessage getFault() throws WorkflowException;
-
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/airavata/blob/382b6c0e/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/invoker/MsgBoxWsaResponsesCorrelator.java
----------------------------------------------------------------------
diff --git a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/invoker/MsgBoxWsaResponsesCorrelator.java b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/invoker/MsgBoxWsaResponsesCorrelator.java
deleted file mode 100644
index a5baa2d..0000000
--- a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/invoker/MsgBoxWsaResponsesCorrelator.java
+++ /dev/null
@@ -1,139 +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.invoker;
-
-import org.apache.airavata.common.utils.XMLUtil;
-import org.apache.axiom.om.OMElement;
-import org.apache.axis2.addressing.EndpointReference;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.xmlpull.v1.builder.XmlDocument;
-import org.xmlpull.v1.builder.XmlElement;
-import org.xmlpull.v1.builder.XmlInfosetBuilder;
-import xsul.MLogger;
-import xsul.XmlConstants;
-import xsul.XsulException;
-import xsul.processor.DynamicInfosetProcessorException;
-import xsul.ws_addressing.WsaEndpointReference;
-import xsul.ws_addressing.WsaMessageInformationHeaders;
-import xsul.wsif.WSIFMessage;
-import xsul.wsif.impl.WSIFMessageElement;
-import xsul.xwsif_runtime_async.WSIFAsyncResponseListener;
-import xsul.xwsif_runtime_async.WSIFAsyncResponsesCorrelator;
-import xsul.xwsif_runtime_async.WSIFAsyncWsaResponsesCorrelatorBase;
-
-import javax.xml.stream.XMLStreamException;
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.rmi.RemoteException;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-public class MsgBoxWsaResponsesCorrelator extends WSIFAsyncWsaResponsesCorrelatorBase
- implements WSIFAsyncResponsesCorrelator, Runnable
-{
- private static final Logger logger = LoggerFactory.getLogger(MsgBoxWsaResponsesCorrelator.class);
- private final static XmlInfosetBuilder builder = XmlConstants.BUILDER;
-
- private String msgBoxServiceLoc;
-// private MsgBoxClient msgBoxClient;
- EndpointReference msgBoxAddr;
- private Thread messageBoxDonwloader;
-
- private AsynchronousInvoker invoker;
-
- public MsgBoxWsaResponsesCorrelator(String msgBoxServiceLoc,AsynchronousInvoker output)
- throws DynamicInfosetProcessorException
- {
- this.invoker = output;
- this.msgBoxServiceLoc = msgBoxServiceLoc;
-// msgBoxClient = new MsgBoxClient();
- try {
-// msgBoxAddr = msgBoxClient.createMessageBox(msgBoxServiceLoc,5000L);
- try {
- setReplyTo(new WsaEndpointReference(new URI(msgBoxAddr.getAddress())));
- } catch (URISyntaxException e) {
- logger.error(e.getLocalizedMessage(),e); //To change body of catch statement use File | Settings | File Templates.
- }
- messageBoxDonwloader = new Thread(this, Thread.currentThread().getName()+"-async-msgbox-correlator");
- messageBoxDonwloader.setDaemon(true);
- messageBoxDonwloader.start();
- } catch (Exception e) {
- logger.error(e.getLocalizedMessage(),e); //To change body of catch statement use File | Settings | File Templates.
- }
- }
-
-// public void setMsgBoxAddr(WsaEndpointReference msgBoxAddr) {
-// this.msgBoxAddr = msgBoxAddr;
-// }
-
-
-
- public void run() {
-// while(true) {
-// try {
-// Iterator<OMElement> omElementIterator = msgBoxClient.takeMessagesFromMsgBox(msgBoxAddr, 5000L);
-// List<XmlElement> xmlArrayList = new ArrayList<XmlElement>();
-// while (omElementIterator.hasNext()){
-// OMElement next = omElementIterator.next();
-// String message = next.toStringWithConsume();
-// xmlArrayList.add(XMLUtil.stringToXmlElement3(message));
-// }
-// // now hard work: find callbacks
-// for (int i = 0; i < xmlArrayList.size(); i++) {
-// XmlElement m = xmlArrayList.get(i);
-// try {
-// logger.debug(Thread.currentThread().getName());
-// WSIFMessageElement e = new WSIFMessageElement(m);
-// this.invoker.setOutputMessage(e);
-// //ideally there are no multiple messages, so we can return from this thread at this point
-// //otherwise this thread will keep running forever for each worfklow node, so there can be large
-// // number of waiting threads in an airavata deployment
-// return;
-// } catch (Throwable e) {
-// logger.error(e.getLocalizedMessage(),e); //To change body of catch statement use File | Settings | File Templates.
-// }
-// }
-// try {
-// Thread.currentThread().sleep(1000L); //do not overload msg box service ...
-// } catch (InterruptedException e) {
-// break;
-// }
-// } catch (XsulException e) {
-// logger.error("could not retrieve messages");
-// break;
-// } catch (RemoteException e) {
-// logger.error("could not retrieve messages");
-// break;
-// } catch (XMLStreamException e) {
-// logger.error("could not retrieve messages");
-// break;
-// } catch (Exception e){
-// logger.error("could not retrieve messages");
-// break;
-// }
-// }
- }
-
-
-
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/382b6c0e/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/invoker/SimpleInvoker.java
----------------------------------------------------------------------
diff --git a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/invoker/SimpleInvoker.java b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/invoker/SimpleInvoker.java
deleted file mode 100644
index e615dc5..0000000
--- a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/invoker/SimpleInvoker.java
+++ /dev/null
@@ -1,260 +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.invoker;
-
-import java.util.Iterator;
-
-import org.apache.airavata.common.utils.XMLUtil;
-import org.apache.airavata.workflow.model.exceptions.WorkflowException;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.xmlpull.v1.builder.XmlElement;
-
-import xsul.wsdl.WsdlDefinitions;
-import xsul.wsif.WSIFMessage;
-import xsul.wsif.WSIFOperation;
-import xsul.wsif.WSIFPort;
-import xsul.wsif.WSIFService;
-import xsul.wsif.WSIFServiceFactory;
-import xsul.wsif.spi.WSIFProviderManager;
-import xsul.xwsif_runtime.WSIFClient;
-import xsul.xwsif_runtime.WSIFRuntime;
-
-public class SimpleInvoker implements Invoker {
-
- private static final Logger log = LoggerFactory.getLogger(GenericInvoker.class);
-
- protected WSIFClient client;
-
- private WsdlDefinitions definitions;
-
- private WSIFOperation operation;
-
- private WSIFMessage inputMessage;
-
- private volatile WSIFMessage outputMessage;
-
- private WSIFMessage faultMessage;
-
- private boolean lock = false;
-
- static {
- WSIFProviderManager.getInstance().addProvider(new xsul.wsif_xsul_soap_http.Provider());
- }
-
- /**
- * Constructs a SimpleInvoker.
- *
- * @param definitions
- */
- public SimpleInvoker(WsdlDefinitions definitions) {
- this.definitions = definitions;
- }
-
- /**
- * @see org.apache.airavata.xbaya.invoker.Invoker#setup()
- */
- public void setup() throws WorkflowException {
- try {
- WSIFService service = WSIFServiceFactory.newInstance().getService(this.definitions);
- WSIFPort port = service.getPort();
- this.client = WSIFRuntime.getDefault().newClientFor(port);
- this.client.setAsyncResponseTimeoutInMs(999999999);
- } catch (RuntimeException e) {
- String message = "The WSDL is in the wrong format";
- throw new WorkflowException(message, e);
- }
- }
-
- /**
- * @see org.apache.airavata.xbaya.invoker.Invoker#getClient()
- */
- public WSIFClient getClient() {
- return this.client;
- }
-
- /**
- * @see org.apache.airavata.xbaya.invoker.Invoker#setOperation(java.lang.String)
- */
- public void setOperation(String operationName) throws WorkflowException {
- try {
- WSIFPort port = this.client.getPort();
- this.operation = port.createOperation(operationName);
- this.inputMessage = this.operation.createInputMessage();
- this.outputMessage = this.operation.createOutputMessage();
- this.faultMessage = this.operation.createFaultMessage();
- } catch (RuntimeException e) {
- String message = "The WSDL does not conform to the invoking service.";
- throw new WorkflowException(message, e);
- }
- }
-
- /**
- * @see org.apache.airavata.xbaya.invoker.Invoker#setInput(java.lang.String, java.lang.Object)
- */
- public void setInput(String name, Object value) throws WorkflowException {
- try {
- if (value instanceof XmlElement) {
- // If the value is a complex type, change the name of the
- // element to the correct one.
- XmlElement valueElement = (XmlElement) value;
- valueElement.setName(name);
- } else if (value instanceof String) {
- if(XMLUtil.isXML((String)value)){
- XmlElement valueElement = XMLUtil.stringToXmlElement3((String) value);
- valueElement.setName(name);
- value = valueElement;
- }
- // Simple case.
- } else {
- // convert int, doule to string.
- value = "" + value;
- }
- this.inputMessage.setObjectPart(name, value);
- } catch (RuntimeException e) {
- String message = "Error in setting an input. name: " + name + " value: " + value;
- throw new WorkflowException(message, e);
- }
- }
-
- /**
- * @see org.apache.airavata.xbaya.invoker.Invoker#getInputs()
- */
- public WSIFMessage getInputs() {
- return this.inputMessage;
- }
-
- /**
- * @see org.apache.airavata.xbaya.invoker.Invoker#invoke()
- */
- public boolean invoke() throws WorkflowException {
- try {
- boolean success = this.operation.executeRequestResponseOperation(this.inputMessage, this.outputMessage,
- this.faultMessage);
- while(this.outputMessage == null){
-
- }
- return success;
- } catch (RuntimeException e) {
- String message = "Error in invoking a service.";
- throw new WorkflowException(message, e);
- }
- }
-
- /**
- * @see org.apache.airavata.xbaya.invoker.Invoker#getOutputs()
- */
- public WSIFMessage getOutputs() {
- if (lock) {
- try {
- wait();
- } catch (InterruptedException e) {
- log.error(e.getMessage(), e);
- }
- }
- return this.outputMessage;
- }
-
-
- /**
- * @see org.apache.airavata.xbaya.invoker.Invoker#getOutput(java.lang.String)
- */
- public Object getOutput(String name) throws WorkflowException {
- try {
- // This code doesn't work when the output is a complex type.
- // Object output = this.outputMessage.getObjectPart(name);
- // return output;
-
- XmlElement outputElement = (XmlElement) this.outputMessage;
- XmlElement valueElement = outputElement.element(null, name);
- Iterator childIt = valueElement.children();
- int numberOfChildren = 0;
- while (childIt.hasNext()) {
- childIt.next();
- numberOfChildren++;
- }
- if (numberOfChildren == 1) {
- Object child = valueElement.children().next();
- if (child instanceof String) {
- // Value is a simple type. Return the string.
- String value = (String) child;
- return value;
- }
- if (child instanceof XmlElement) {
- log.debug("output: " + XMLUtil.xmlElementToString((XmlElement) child));
- Object child1 = ((XmlElement) child).children().next();
- if (child1 instanceof String) {
- // Value is a simple type. Return the string.
- String value = (String) child1;
- return value;
- }
- }
- }
- // Value is a complex type. Return the whole XmlElement so that we
- // can set it to the next service as it is.
- return valueElement;
- } catch (RuntimeException e) {
- String message = "Error in getting output. name: " + name;
- throw new WorkflowException(message, e);
- }
- }
-
- /**
- * @see org.apache.airavata.xbaya.invoker.Invoker#getFault()
- */
- public WSIFMessage getFault() {
- return this.faultMessage;
- }
-
- public WsdlDefinitions getDefinitions() {
- return definitions;
- }
-
- public WSIFOperation getOperation() {
- return operation;
- }
-
- public WSIFMessage getInputMessage() {
- return inputMessage;
- }
-
- public synchronized WSIFMessage getOutputMessage() {
- return outputMessage;
- }
-
- public WSIFMessage getFaultMessage() {
- return faultMessage;
- }
-
- public synchronized void setOutputMessage(WSIFMessage outputMessage) {
- log.debug("Setting output message");
- this.outputMessage = outputMessage;
- }
-
- public void setLock(boolean lock) {
- this.lock = lock;
- }
-
- public boolean isLock() {
- return lock;
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/airavata/blob/382b6c0e/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/invoker/WorkflowInputUtil.java
----------------------------------------------------------------------
diff --git a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/invoker/WorkflowInputUtil.java b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/invoker/WorkflowInputUtil.java
deleted file mode 100644
index 1295c07..0000000
--- a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/invoker/WorkflowInputUtil.java
+++ /dev/null
@@ -1,72 +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.invoker;
-
-import org.apache.airavata.common.utils.StringUtil;
-import org.apache.airavata.common.utils.XMLUtil;
-import org.apache.airavata.model.appcatalog.appinterface.DataType;
-import org.apache.airavata.workflow.model.component.ws.WSComponentPort;
-import org.apache.airavata.workflow.model.exceptions.WorkflowRuntimeException;
-import org.apache.airavata.xbaya.XBayaConstants;
-import org.apache.airavata.xbaya.lead.LEADTypes;
-
-import javax.xml.namespace.QName;
-
-public class WorkflowInputUtil {
-
- public static String createInputForGFacService(WSComponentPort port,String input){
- DataType paramType = port.getType();
- StringBuffer inputString = new StringBuffer("<");
- if("StringParameterType".equals(paramType) || "URIParameterType".equals(paramType) ||
- "DoubleParameterType".equals(paramType) || "IntegerParameterType".equals(paramType)
- || "FloatParameterType".equals(paramType)|| "BooleanParameterType".equals(paramType)
- || "FileParameterType".equals(paramType)){
- inputString.append(port.getName()).append(">").
- append(getValueElement(input)).append("</").append(port.getName()).append(">");
- }else if(paramType.toString().endsWith("ArrayType")){
- inputString.append(port.getName()).append(">");
- String[] valueList = StringUtil.getElementsFromString(input);
- for(String inputValue:valueList){
- inputString.append(getValueElement(inputValue));
- }
- inputString.append(getValueElement(port.getName()));
- }
- inputString.append(">");
- return inputString.toString();
- }
-
- private static String getValueElement(String value){
- return "<value>" + value + "</value>";
- }
- public static Object parseValue(WSComponentPort input, String valueString) {
- String name = input.getName();
- if (false) {
- // Some user wants to pass empty strings, so this check is disabled.
- if (valueString.length() == 0) {
- throw new WorkflowRuntimeException("Input parameter, " + name + ", cannot be empty");
- }
- }
- DataType type = input.getType();
- Object value;
- value = valueString;
- return value;
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/382b6c0e/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/invoker/WorkflowInvokerWrapperForGFacInvoker.java
----------------------------------------------------------------------
diff --git a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/invoker/WorkflowInvokerWrapperForGFacInvoker.java b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/invoker/WorkflowInvokerWrapperForGFacInvoker.java
deleted file mode 100644
index 9ca5669..0000000
--- a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/invoker/WorkflowInvokerWrapperForGFacInvoker.java
+++ /dev/null
@@ -1,233 +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.invoker;
-
-import java.util.concurrent.Callable;
-import java.util.concurrent.ExecutionException;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
-import java.util.concurrent.Future;
-import java.util.concurrent.TimeUnit;
-import java.util.concurrent.TimeoutException;
-
-import javax.xml.namespace.QName;
-
-import org.apache.airavata.common.utils.XMLUtil;
-import org.apache.airavata.workflow.model.exceptions.WorkflowException;
-import org.apache.airavata.workflow.model.exceptions.WorkflowRuntimeException;
-import org.apache.airavata.xbaya.jython.lib.ServiceNotifiable;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.xmlpull.v1.builder.XmlElement;
-
-import xsul.lead.LeadContextHeader;
-import xsul.wsif.WSIFMessage;
-
-public class WorkflowInvokerWrapperForGFacInvoker extends GFacInvoker {
-
- private static final Logger logger = LoggerFactory.getLogger(WorkflowInvokerWrapperForGFacInvoker.class);
-
- private ServiceNotifiable notifier;
-
- private String serviceInformation;
-
- private Future<Boolean> result;
-
- protected boolean failerSent = false;
-
- public WorkflowInvokerWrapperForGFacInvoker(QName portTypeQName, String gfacURL, String messageBoxURL,
- LeadContextHeader leadcontext, ServiceNotifiable serviceNotificationSender) {
- super(portTypeQName, gfacURL, messageBoxURL, leadcontext);
- this.notifier = serviceNotificationSender;
- this.serviceInformation = portTypeQName.toString();
- }
-
- /**
- * @see org.apache.airavata.xbaya.invoker.WorkflowInvoker#invoke()
- */
- public synchronized boolean invoke() throws WorkflowException {
-
- try {
- WSIFMessage inputMessage = super.getInputs();
- logger.debug("inputMessage: " + XMLUtil.xmlElementToString((XmlElement) inputMessage));
- this.notifier.invokingService(inputMessage);
-
- ExecutorService executor = Executors.newSingleThreadExecutor();
- this.result = executor.submit(new Callable<Boolean>() {
- @SuppressWarnings("boxing")
- public Boolean call() {
- try {
- boolean success = WorkflowInvokerWrapperForGFacInvoker.super.invoke();
- if (success) {
- // Send notification
- WSIFMessage outputMessage = WorkflowInvokerWrapperForGFacInvoker.super.getOutputs();
- // An implementation of WSIFMessage,
- // WSIFMessageElement, implements toString(), which
- // serialize the message XML.
- logger.debug("outputMessage: " + outputMessage);
- WorkflowInvokerWrapperForGFacInvoker.this.notifier.serviceFinished(outputMessage);
- } else {
- WSIFMessage faultMessage = WorkflowInvokerWrapperForGFacInvoker.super.getFault();
- // An implementation of WSIFMessage,
- // WSIFMessageElement, implements toString(), which
- // serialize the message XML.
- logger.debug("received fault: " + faultMessage);
- WorkflowInvokerWrapperForGFacInvoker.this.notifier.receivedFault(faultMessage);
- WorkflowInvokerWrapperForGFacInvoker.this.failerSent = true;
- }
- return success;
- } catch (WorkflowException e) {
- logger.error(e.getMessage(), e);
- // An appropriate message has been set in the exception.
- WorkflowInvokerWrapperForGFacInvoker.this.notifier.invocationFailed(e.getMessage(), e);
- WorkflowInvokerWrapperForGFacInvoker.this.failerSent = true;
- throw new WorkflowRuntimeException(e);
- } catch (RuntimeException e) {
- logger.error(e.getMessage(), e);
- String message = "Error in invoking a service: "
- + WorkflowInvokerWrapperForGFacInvoker.this.serviceInformation;
- WorkflowInvokerWrapperForGFacInvoker.this.notifier.invocationFailed(message, e);
- WorkflowInvokerWrapperForGFacInvoker.this.failerSent = true;
- throw e;
- }
- }
- });
-
- // Kill the thread inside of executor. This is necessary for Jython
- // script to finish.
- executor.shutdown();
-
- // Let other threads know that job has been submitted.
- notifyAll();
-
- // Check if the invocation itself fails. This happens immediately.
- try {
- this.result.get(100, TimeUnit.MILLISECONDS);
- } catch (InterruptedException e) {
- logger.error(e.getMessage(), e);
- } catch (TimeoutException e) {
- // The job is probably running fine.
- // The normal case.
- return true;
- } catch (ExecutionException e) {
- // The service-failed notification should have been sent
- // already.
- logger.error(e.getMessage(), e);
- String message = "Error in invoking a service: " + this.serviceInformation;
- throw new WorkflowException(message, e);
- }
- } catch (RuntimeException e) {
- logger.error(e.getMessage(), e);
- String message = "Error in invoking a service: " + this.serviceInformation;
- this.notifier.invocationFailed(message, e);
- throw new WorkflowException(message, e);
- } catch (Error e) {
- logger.error(e.getMessage(), e);
- String message = "Unexpected error: " + this.serviceInformation;
- this.notifier.invocationFailed(message, e);
- throw new WorkflowException(message, e);
- }
-
- boolean success = super.invoke();
- if (!success) {
- try {
- throw new Exception("Failed invoking GFac");
- } catch (Exception e) {
- notifier.invocationFailed(super.getFault().toString(), e);
- }
-
- } else {
- notifier.serviceFinished(super.getOutputs());
- }
- return success;
- }
-
- public synchronized void waitToFinish() throws WorkflowException {
- try {
- while (this.result == null) {
- // The job is not submitted yet.
- try {
- wait();
- } catch (InterruptedException e) {
- logger.error(e.getMessage(), e);
- }
- }
- // Wait for the job to finish.
- Boolean success = this.result.get();
- if (success == false) {
- WSIFMessage faultMessage = super.getFault();
- String message = "Error in a service: ";
- // An implementation of WSIFMessage,
- // WSIFMessageElement, implements toString(), which
- // serialize the message XML.
- message += faultMessage.toString();
- throw new WorkflowException(message);
- }
- } catch (InterruptedException e) {
- logger.error(e.getMessage(), e);
- } catch (ExecutionException e) {
- // The service-failed notification should have been sent already.
- logger.error(e.getMessage(), e);
- String message = "Error in invoking a service: " + this.serviceInformation;
- throw new WorkflowException(message, e);
- } catch (RuntimeException e) {
- logger.error(e.getMessage(), e);
- String message = "Error while waiting for a service to finish: " + this.serviceInformation;
- this.notifier.invocationFailed(message, e);
- throw new WorkflowException(message, e);
- } catch (Error e) {
- logger.error(e.getMessage(), e);
- String message = "Unexpected error: " + this.serviceInformation;
- this.notifier.invocationFailed(message, e);
- throw new WorkflowException(message, e);
- }
- }
-
- public Object getOutput(String name) throws WorkflowException {
- try {
- waitToFinish();
- Object output = super.getOutput(name);
- if (output instanceof XmlElement) {
- logger.debug("output: " + XMLUtil.xmlElementToString((XmlElement) output));
- }
- return output;
- } catch (WorkflowException e) {
- logger.error(e.getMessage(), e);
- // An appropriate message has been set in the exception.
- if (!this.failerSent) {
- this.notifier.invocationFailed(e.getMessage(), e);
- }
- throw e;
- } catch (RuntimeException e) {
- logger.error(e.getMessage(), e);
- String message = "Error while waiting for a output: " + name;
- this.notifier.invocationFailed(message, e);
- throw new WorkflowException(message, e);
- } catch (Error e) {
- logger.error(e.getMessage(), e);
- String message = "Unexpected error: " + this.serviceInformation;
- this.notifier.invocationFailed(message, e);
- throw new WorkflowException(message, e);
- }
- }
-
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/airavata/blob/382b6c0e/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/invoker/factory/InvokerFactory.java
----------------------------------------------------------------------
diff --git a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/invoker/factory/InvokerFactory.java b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/invoker/factory/InvokerFactory.java
deleted file mode 100644
index c03c756..0000000
--- a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/invoker/factory/InvokerFactory.java
+++ /dev/null
@@ -1,90 +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.invoker.factory;
-
-import javax.xml.namespace.QName;
-
-import org.apache.airavata.common.workflow.execution.context.WorkflowContextHeaderBuilder;
-import org.apache.airavata.common.utils.WSDLUtil;
-import org.apache.airavata.workflow.model.exceptions.WorkflowException;
-import org.apache.airavata.xbaya.invoker.AsynchronousInvoker;
-import org.apache.airavata.xbaya.invoker.GFacInvoker;
-import org.apache.airavata.xbaya.invoker.Invoker;
-import org.apache.airavata.xbaya.invoker.SimpleInvoker;
-
-import xsul.lead.LeadContextHeader;
-import xsul.wsdl.WsdlDefinitions;
-
-public class InvokerFactory {
-
- /**
- * @param portTypeQName
- * @param definitions
- * @param gfacURL
- * @param messageBoxURL
- * @return The invoker
- * @throws WorkflowException
- */
- public static Invoker createInvoker(QName portTypeQName, WsdlDefinitions definitions, String gfacURL,
- String messageBoxURL, LeadContextHeader leadContext) throws WorkflowException {
- Invoker invoker = null;
-
- if (definitions != null && definitions.getServices().iterator().hasNext()) {
- // check if this web service supports asynchronous invocation
-// if (WSDLUtil.isAsynchronousSupported(WSDLUtil.wsdlDefinitions3ToWsdlDefintions5(definitions))) {
-// invoker = new AsynchronousInvoker(definitions, messageBoxURL);
-// } else {
- invoker = new SimpleInvoker(definitions);
-// }
- } else if (gfacURL != null && gfacURL.length() != 0) {
- invoker = new GFacInvoker(portTypeQName, gfacURL, messageBoxURL, leadContext);
- }
-
- if (invoker == null) {
- String message = "Cannot find an appropriate way to invoke the service";
- throw new WorkflowException(message);
- }
- return invoker;
- }
-
- public static Invoker createInvoker(QName portTypeQName, WsdlDefinitions definitions, String gfacURL,
- String messageBoxURL, WorkflowContextHeaderBuilder builder, boolean differ) throws WorkflowException {
- Invoker invoker = null;
-
- if (definitions != null && definitions.getServices().iterator().hasNext()) {
- // check if this web service supports asynchronous invocation
-// if (WSDLUtil.isAsynchronousSupported(WSDLUtil.wsdlDefinitions3ToWsdlDefintions5(definitions))) {
-// invoker = new AsynchronousInvoker(definitions, messageBoxURL);
-// } else {
- invoker = new SimpleInvoker(definitions);
-// }
- } else if (gfacURL != null && gfacURL.length() != 0) {
- invoker = new GFacInvoker(portTypeQName, gfacURL, messageBoxURL, builder);
- }
-
- if (invoker == null) {
- String message = "Cannot find an appropriate way to invoke the service";
- throw new WorkflowException(message);
- }
- return invoker;
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/airavata/blob/382b6c0e/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/jython/script/JythonScript.java
----------------------------------------------------------------------
diff --git a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/jython/script/JythonScript.java b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/jython/script/JythonScript.java
index 41b4389..e2362e8 100644
--- a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/jython/script/JythonScript.java
+++ b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/jython/script/JythonScript.java
@@ -49,7 +49,6 @@ import org.apache.airavata.workflow.model.wf.Workflow;
import org.apache.airavata.xbaya.XBayaConfiguration;
import org.apache.airavata.xbaya.XBayaConstants;
import org.apache.airavata.xbaya.XBayaVersion;
-import org.apache.airavata.xbaya.invoker.GenericInvoker;
public class JythonScript {
@@ -73,8 +72,6 @@ public class JythonScript {
*/
public static final String TOPIC_VARIABLE = "topic";
- private static final String INVOKER_CLASS = StringUtil.getClassName(GenericInvoker.class);
-
// private static final String NOTIFICATION_CLASS = StringUtil.getClassName(NotificationSender.class);
private static final String WORKFLOW_STARTED_METHOD = "workflowStarted";
@@ -337,8 +334,6 @@ public class JythonScript {
pw.println("from java.util import Properties");
pw.println("from java.io import FileInputStream");
pw.println("from javax.xml.namespace import QName");
- pw.println("from " + GenericInvoker.class.getPackage().getName() + " import " + INVOKER_CLASS);
-// pw.println("from " + NotificationSender.class.getPackage().getName() + " import " + NOTIFICATION_CLASS);
pw.println();
}
@@ -495,7 +490,7 @@ public class JythonScript {
pw.println(TAB + id + QNAME_SUFFIX + " = QName('" + portTypeQName.getNamespaceURI() + "', '"
+ portTypeQName.getLocalPart() + "')");
pw.println(TAB + wsdlID + " = " + PROPERTIES_VARIABLE + "." + GET_PROPERTY_METHOD + "('" + wsdlID + "')");
- pw.println(TAB + id + INVOKER_SUFFIX + " = " + INVOKER_CLASS + "(" + id + QNAME_SUFFIX + ", " + wsdlID + ", '"
+ pw.println(TAB + id + INVOKER_SUFFIX + " = " + "(" + id + QNAME_SUFFIX + ", " + wsdlID + ", '"
+ id + "',");
pw.println(TAB + TAB + MESSAGE_BOX_URL_VARIABLE + ", " + GFAC_VARIABLE + ", " + NOTIFICATION_VARIABLE + ")");
http://git-wip-us.apache.org/repos/asf/airavata/blob/382b6c0e/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/lead/LEADTypes.java
----------------------------------------------------------------------
diff --git a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/lead/LEADTypes.java b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/lead/LEADTypes.java
deleted file mode 100644
index dc0b8bc..0000000
--- a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/lead/LEADTypes.java
+++ /dev/null
@@ -1,225 +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.lead;
-
-import javax.xml.namespace.QName;
-
-import org.apache.airavata.common.utils.WSConstants;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class LEADTypes {
-
- private static final Logger logger = LoggerFactory.getLogger(LEADTypes.class);
-
- /**
- * http://www.extreme.indiana.edu/lead/xsd
- */
- public static final String LEAD_XSD_NS_URI = "http://airavata.apache.org/schemas/gfac/2012/12";
-
- // Simple types
-
- /**
- * LEADFileIDType
- */
- public static final QName LEAD_FILE_ID_TYPE = new QName(LEAD_XSD_NS_URI, "LEADFileIDType");
-
- /**
- * DATA_ID_TYPE
- */
- public static final QName DATA_ID_TYPE = new QName(LEAD_XSD_NS_URI, "DataIDType");
-
- /**
- * LEADWorkflowIDType
- */
- public static final QName LEAD_WORKFLOW_ID_TYPE = new QName(LEAD_XSD_NS_URI, "LEADWorkflowIDType");
-
- /**
- * LEADNameListFileType
- */
- public static final QName LEAD_NAME_LIST_FILE_TYPE = new QName(LEAD_XSD_NS_URI, "LEADNameListFileType");
-
- /**
- * LEADNameListPropertiesFileType
- */
- public static final QName LEAD_NAME_LIST_PROPERTIES_FILE_TYPE = new QName(LEAD_XSD_NS_URI,
- "LEADNameListPropertiesFileType");
-
- /**
- * HostNameType
- */
- public static final QName HOST_NAME_TYPE = new QName(LEAD_XSD_NS_URI, "HostNameType");
-
- // Array types
-
- /**
- * StringArrayType
- */
- public static final QName STRING_ARRAY_TYPE = new QName(LEAD_XSD_NS_URI, "StringArrayType");
-
- /**
- * IntegerArrayType
- */
- public static final QName INTEGER_ARRAY_TYPE = new QName(LEAD_XSD_NS_URI, "IntegerArrayType");
-
- /**
- * FloatArrayType
- */
- public static final QName FLOAT_ARRAY_TYPE = new QName(LEAD_XSD_NS_URI, "FloatArrayType");
-
- /**
- * DoubleArrayType
- */
- public static final QName DOUBLE_ARRAY_TYPE = new QName(LEAD_XSD_NS_URI, "DoubleArrayType");
-
- /**
- * BooleanArrayType
- */
- public static final QName BOOLEAN_ARRAY_TYPE = new QName(LEAD_XSD_NS_URI, "BooleanArrayType");
-
- /**
- * QNameArrayType
- */
- public static final QName QNAME_ARRAY_TYPE = new QName(LEAD_XSD_NS_URI, "QNameArrayType");
-
- /**
- * URIArrayType
- */
- public static final QName URI_ARRAY_TYPE = new QName(LEAD_XSD_NS_URI, "URIArrayType");
-
- /**
- * LEADFileIDArrayType
- */
- public static final QName LEAD_FILE_ID_ARRAY_TYPE = new QName(LEAD_XSD_NS_URI, "LEADFileIDArrayType");
-
- /**
- * DATA_ID_ARRAY_TYPE
- */
- public static final QName DATA_ID_ARRAY_TYPE = new QName(LEAD_XSD_NS_URI, "DataIDArrayType");
-
- public static final QName STRING_TYPE = new QName(LEAD_XSD_NS_URI, "StringParameterType");
-
- /**
- * IntegerArrayType
- */
- public static final QName INTEGER_TYPE = new QName(LEAD_XSD_NS_URI, "IntegerParameterType");
-
- /**
- * FloatArrayType
- */
- public static final QName FLOAT_TYPE = new QName(LEAD_XSD_NS_URI, "FloatParameterType");
-
- /**
- * DoubleArrayType
- */
- public static final QName DOUBLE_TYPE = new QName(LEAD_XSD_NS_URI, "DoubleParameterType");
-
- /**
- * BooleanArrayType
- */
- public static final QName BOOLEAN_TYPE = new QName(LEAD_XSD_NS_URI, "BooleanParameterType");
-
- /**
- * URIArrayType
- */
- public static final QName URI_TYPE = new QName(LEAD_XSD_NS_URI, "URIParameterType");
-
-
- /**
- * Checks if a specified type is known. If the type is known, the GUI accepts string as a user's input. If not
- * known, the GUI accepts XML as the input.
- *
- * @param type
- * @return true if the type is known; otherwise false;
- */
- public static boolean isKnownType(QName type) {
- if (WSConstants.XSD_ANY_TYPE.equals(type)) {
- // we need to input XML directly for xsd:any
- return false;
- } else if (WSConstants.XSD_NS_URI.equals(type.getNamespaceURI())) {
- return true;
- } else if (LEAD_FILE_ID_TYPE.equals(type) || DATA_ID_TYPE.equals(type) || LEAD_WORKFLOW_ID_TYPE.equals(type)
- || LEAD_NAME_LIST_FILE_TYPE.equals(type) || LEAD_NAME_LIST_PROPERTIES_FILE_TYPE.equals(type)
- || HOST_NAME_TYPE.equals(type) || STRING_ARRAY_TYPE.equals(type) || INTEGER_ARRAY_TYPE.equals(type)
- || FLOAT_ARRAY_TYPE.equals(type) || DOUBLE_ARRAY_TYPE.equals(type) || BOOLEAN_ARRAY_TYPE.equals(type)
- || QNAME_ARRAY_TYPE.equals(type) || URI_ARRAY_TYPE.equals(type) || LEAD_FILE_ID_ARRAY_TYPE.equals(type)
- || DATA_ID_ARRAY_TYPE.equals(type) || STRING_TYPE.equals(type) || URI_TYPE.equals(type)
- || INTEGER_TYPE.equals(type) || FLOAT_TYPE.equals(type) || DOUBLE_TYPE.equals(type)
- || BOOLEAN_TYPE.equals(type)) {
- return true;
- } else if (DATA_ID_TYPE.getLocalPart().equals(type.getLocalPart())) {
- // XXX temporary hack.
- logger.warn("The name space of " + type.getLocalPart() + " should be " + DATA_ID_TYPE.getNamespaceURI()
- + ", not " + type.getNamespaceURI() + ".");
- return true;
- } else {
- return false;
- }
- }
-
- /**
- * @param type
- * @return true if type is an uri type; false otherwise.
- */
- public static boolean isURIType(QName type) {
- if (WSConstants.XSD_ANY_URI.equals(type) || LEAD_NAME_LIST_PROPERTIES_FILE_TYPE.equals(type)
- || LEAD_FILE_ID_TYPE.equals(type) || LEAD_NAME_LIST_FILE_TYPE.equals(type)
- || LEAD_WORKFLOW_ID_TYPE.equals(type) || URI_TYPE.equals(type)) {
- return true;
- } else {
- return false;
- }
- }
-
- /**
- * @param type
- * @return true if type is an array type; false otherwise.
- */
- public static boolean isArrayType(QName type) {
- if (STRING_ARRAY_TYPE.equals(type) || INTEGER_ARRAY_TYPE.equals(type) || FLOAT_ARRAY_TYPE.equals(type)
- || DOUBLE_ARRAY_TYPE.equals(type) || BOOLEAN_ARRAY_TYPE.equals(type) || QNAME_ARRAY_TYPE.equals(type)
- || URI_ARRAY_TYPE.equals(type) || LEAD_FILE_ID_ARRAY_TYPE.equals(type)
- || DATA_ID_ARRAY_TYPE.equals(type)) {
- return true;
- } else if (LEAD_FILE_ID_ARRAY_TYPE.getLocalPart().equals(type.getLocalPart())) {
- // TODO remove this.
- // for workflow input message created from workflow template
- logger.warn("The name space of " + type.getLocalPart() + " should be "
- + LEAD_FILE_ID_ARRAY_TYPE.getNamespaceURI() + ", not " + type.getNamespaceURI() + ".");
- return true;
- } else {
- return false;
- }
- }
-
- /**
- * @param type
- * @return true if type is an uri array type; false otherwise.
- */
- public static boolean isURIArrayType(QName type) {
- if (URI_ARRAY_TYPE.equals(type) || LEAD_FILE_ID_ARRAY_TYPE.equals(type)) {
- return true;
- } else {
- return false;
- }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/airavata/blob/382b6c0e/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/lead/LeadContextHeaderHelper.java
----------------------------------------------------------------------
diff --git a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/lead/LeadContextHeaderHelper.java b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/lead/LeadContextHeaderHelper.java
deleted file mode 100644
index d73e00a..0000000
--- a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/lead/LeadContextHeaderHelper.java
+++ /dev/null
@@ -1,149 +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.lead;
-
-import org.apache.airavata.common.utils.WSDLUtil;
-import org.apache.airavata.workflow.model.wf.Workflow;
-import org.apache.airavata.xbaya.XBayaConfiguration;
-import org.apache.airavata.xbaya.XBayaConstants;
-import xsul.lead.LeadContextHeader;
-
-import java.net.URI;
-
-public class LeadContextHeaderHelper {
-
- /**
- * DEFAULT_USER
- */
- private static final String DEFAULT_USER = "xbaya-user";
-
- /**
- * DEFAULT_EXPERIMENT
- */
- private static final String DEFAULT_EXPERIMENT = "xbaya-experiment";
-
- private LeadContextHeader leadContextHeader;
-
- /**
- * Constructs a LeadContextHeaderHelper.
- *
- */
- public LeadContextHeaderHelper() {
- // The default experiment and user will be will be overwritten.
- this.leadContextHeader = new LeadContextHeader(DEFAULT_EXPERIMENT, DEFAULT_USER);
- }
-
- /**
- * @return The leadContextHeader.
- */
- public LeadContextHeader getLeadContextHeader() {
- return this.leadContextHeader;
- }
-
- /**
- * @param user
- */
- public void setUser(String user) {
- if (user == null || user.length() == 0) {
- user = DEFAULT_USER;
- }
- this.leadContextHeader.setUserDn(user);
- }
-
- /**
- * @param workflowTemplateID
- */
- public void setWorkflowTemplateID(URI workflowTemplateID) {
- if (workflowTemplateID != null) {
- this.leadContextHeader.setWorkflowTemplateId(workflowTemplateID);
- }
- }
-
- /**
- * @param workflowInstanceID
- */
- public void setWorkflowInstanceID(URI workflowInstanceID) {
- if (workflowInstanceID != null) {
- this.leadContextHeader.setWorkflowInstanceId(workflowInstanceID);
- }
- }
-
- /**
- * @param brokerURL
- * @param topic
- */
- public void setEventSink(URI brokerURL, String topic) {
- if (brokerURL != null) {
- if (topic == null || topic.length() == 0) {
- topic = XBayaConstants.DEFAULT_TOPIC;
- }
- // TODO remove the xsul dependency here to WsaEndpointReference object
-// EndpointReference eventSink = WseMsgBrokerClient.createEndpointReference(brokerURL.toString(), topic);
-// WsaEndpointReference eprReference = new WsaEndpointReference(URI.create(eventSink.getAddress()));
-// this.leadContextHeader.setEventSink(eprReference);
- }
- }
-
- /**
- * @param gFacURL
- */
- public void setGFacURL(URI gFacURL) {
- if (gFacURL != null) {
- this.leadContextHeader.setGfacUrl(WSDLUtil.appendWSDLQuary(gFacURL));
- }
- }
-
- //
- // The followings are higer-level APIs.
- //
-
- /**
- * @param workflow
- */
- public void setWorkflow(Workflow workflow) {
- if (workflow != null) {
- setWorkflowTemplateID(workflow.getGPELTemplateID());
- setWorkflowInstanceID(workflow.getGPELInstanceID());
- }
- }
-
- /**
- * @param monitorConfiguration
- */
-// public void setMonitorConfiguration(MonitorConfiguration monitorConfiguration) {
-// setEventSink(monitorConfiguration.getBrokerURL(), monitorConfiguration.getTopic());
-// }
-
- /**
- * This method has to be called before setMonitorConfiguration because this will overwrite some variables.
- *
- * @param xbayaConfiguration
- */
- public void setXBayaConfiguration(XBayaConfiguration xbayaConfiguration) {
-
- // The followings might overwrite some variables.
- setWorkflowTemplateID(xbayaConfiguration.getGPELTemplateID());
- setWorkflowInstanceID(xbayaConfiguration.getGPELInstanceID());
- setEventSink(xbayaConfiguration.getBrokerURL(), xbayaConfiguration.getTopic());
- }
-
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/airavata/blob/382b6c0e/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/lead/NotificationHandler.java
----------------------------------------------------------------------
diff --git a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/lead/NotificationHandler.java b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/lead/NotificationHandler.java
deleted file mode 100644
index c1c9da0..0000000
--- a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/lead/NotificationHandler.java
+++ /dev/null
@@ -1,183 +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.lead;
-
-import org.apache.airavata.common.utils.XMLUtil;
-import org.apache.airavata.common.workflow.execution.context.WorkflowContextHeaderBuilder;
-import org.apache.airavata.xbaya.XBayaConstants;
-import org.apache.axis2.addressing.EndpointReference;
-import org.apache.xmlbeans.XmlObject;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.xmlpull.v1.builder.XmlElement;
-import xsul.XmlConstants;
-import xsul.invoker.DynamicInfosetInvokerException;
-import xsul.lead.LeadContextHeader;
-import xsul.message_router.MessageContext;
-import xsul.xbeans_util.XBeansUtil;
-import xsul.xhandler.BaseHandler;
-
-import java.net.URI;
-import java.net.URISyntaxException;
-
-public class NotificationHandler extends BaseHandler {
-
- private static final Logger logger = LoggerFactory.getLogger(NotificationHandler.class);
-
- private static final String INVOKING_MESSAGE = "Invoking a workflow";
-
- private static final String RECEIVE_RESULT_MESSAGE = "A workflow finished successfully.";
-
- private static final String RECEIVE_FAULT_MESSAGE = "A workflow failed.";
-
- private LeadContextHeader leadContext;
-
-// private WorkflowNotifier notifier;
-
-// private WorkflowTrackingContext context;
-
-// private InvocationContext invocationContext;
-
-// private InvocationEntity invocationEntity;
-
- private WorkflowContextHeaderBuilder builder;
-
- /**
- * Constructs a NotificationHandler.
- *
- * @param leadContext
- */
- public NotificationHandler(LeadContextHeader leadContext) {
- super(NotificationHandler.class.getName());
- this.leadContext = leadContext;
-// this.notifier = NotifierFactory.createNotifier();
- URI myWorkflowID = null;
- URI myServiceID = URI.create(XBayaConstants.APPLICATION_SHORT_NAME);
- String userDN = this.leadContext.getUserDn();
- if (userDN != null ){
- if(userDN.trim().length() == 0) {
- String serviceIDAsString = XBayaConstants.APPLICATION_SHORT_NAME + ":" + userDN.trim();
- try {
- myServiceID = new URI(null, null, serviceIDAsString, null);
- } catch (URISyntaxException e) {
- logger.error(e.getMessage(), e);
- }
- }
- }
- String myNodeID = null;
- Integer myTimestep = null;
- EndpointReference epr = new EndpointReference(leadContext.getEventSink().getAddress().toString());
-// this.invocationEntity = this.notifier.createEntity(myWorkflowID, myServiceID, myNodeID, myTimestep);
-// this.context = this.notifier.createTrackingContext(new Properties(), epr.getAddress().toString(), myWorkflowID,
-// myServiceID, myNodeID, myTimestep);
- }
-
- public NotificationHandler(WorkflowContextHeaderBuilder builder) {
- super(NotificationHandler.class.getName());
- this.builder = builder;
-// this.notifier = NotifierFactory.createNotifier();
- URI myWorkflowID = null;
- URI myServiceID = URI.create(XBayaConstants.APPLICATION_SHORT_NAME);
- String userDN = this.builder.getUserIdentifier();
- if (userDN != null) {
- if (userDN.trim().length() == 0) {
- String serviceIDAsString = XBayaConstants.APPLICATION_SHORT_NAME + ":" + userDN.trim();
- try {
- myServiceID = new URI(null, null, serviceIDAsString, null);
- } catch (URISyntaxException e) {
- logger.error(e.getMessage(), e);
- }
- }
- }
- String myNodeID = null;
- Integer myTimestep = null;
- EndpointReference epr = new EndpointReference(builder.getWorkflowMonitoringContext().getEventPublishEpr());
-// this.invocationEntity = this.notifier.createEntity(myWorkflowID, myServiceID, myNodeID, myTimestep);
-// this.context = this.notifier.createTrackingContext(new Properties(), epr.getAddress().toString(), myWorkflowID,
-// myServiceID, myNodeID, myTimestep);
- }
-
- /**
- * @see xsul.xhandler.BaseHandler#processOutgoingXml(org.xmlpull.v1.builder.XmlElement,
- * xsul.message_router.MessageContext)
- */
- @Override
- public boolean processOutgoingXml(XmlElement soapEnvelope, MessageContext context)
- throws DynamicInfosetInvokerException {
- logger.debug("soapEnvelope: " + XMLUtil.xmlElementToString(soapEnvelope));
-
- URI serviceWorkflowID = null;
- URI serviceServiceID = URI.create(this.builder.getWorkflowMonitoringContext().getServiceInstanceId());
- if (serviceServiceID == null) {
- serviceServiceID = URI.create("NoWorkflowIDSet");
- }
-// Integer serviceTimestep = null;
-/* String timeStep = Integer.toString(this.builder.getWorkflowMonitoringContext().getWorkflowTimeStep());
- if (timeStep != null) {
- try {
- serviceTimestep = new Integer(this.builder.getWorkflowMonitoringContext().getWorkflowTimeStep());
- } catch (NumberFormatException e) {
- logger.error(e.getMessage(), e);
- }
- }*/
- XmlElement soapHeader = soapEnvelope.element(null, XmlConstants.S_HEADER);
- XmlElement soapBody = soapEnvelope.element(null, XmlConstants.S_BODY);
- XmlObject headerObject = null;
- if (soapHeader != null) {
- headerObject = XBeansUtil.xmlElementToXmlObject(soapHeader);
- }
- XmlObject bodyObject = XBeansUtil.xmlElementToXmlObject(soapBody);
-
-// this.invocationContext = this.notifier.invokingService(this.context, this.invocationEntity, headerObject,
-// bodyObject, INVOKING_MESSAGE);
- return super.processOutgoingXml(soapEnvelope, context);
- }
-
- /**
- * @see xsul.xhandler.BaseHandler#processIncomingXml(org.xmlpull.v1.builder.XmlElement,
- * xsul.message_router.MessageContext)
- */
- @Override
- public boolean processIncomingXml(XmlElement soapEnvelope, MessageContext context)
- throws DynamicInfosetInvokerException {
- logger.info("soapEnvelope: " + XMLUtil.xmlElementToString(soapEnvelope));
-
- XmlElement soapHeader = soapEnvelope.element(null, XmlConstants.S_HEADER);
- XmlObject headerObject = null;
- if (soapHeader != null) {
- headerObject = XBeansUtil.xmlElementToXmlObject(soapHeader);
- }
-
- XmlElement soapBody = soapEnvelope.element(null, XmlConstants.S_BODY);
- XmlObject bodyObject = XBeansUtil.xmlElementToXmlObject(soapBody);
- XmlElement faultElement = soapBody.element(null, "Fault");
- if (faultElement == null) {
-// this.notifier.receivedResult(this.context, this.invocationContext, headerObject, bodyObject,
-// RECEIVE_RESULT_MESSAGE);
- } else {
-// this.notifier.receivedFault(this.context, this.invocationContext, headerObject, bodyObject,
-// RECEIVE_FAULT_MESSAGE);
- }
-
- return super.processIncomingXml(soapEnvelope, context);
- }
-}
\ No newline at end of file
[3/3] airavata git commit: Cleaning up Xbaya use of legacy LEAD code
- AIRAVATA-1700
Posted by sm...@apache.org.
Cleaning up Xbaya use of legacy LEAD code - AIRAVATA-1700
Project: http://git-wip-us.apache.org/repos/asf/airavata/repo
Commit: http://git-wip-us.apache.org/repos/asf/airavata/commit/382b6c0e
Tree: http://git-wip-us.apache.org/repos/asf/airavata/tree/382b6c0e
Diff: http://git-wip-us.apache.org/repos/asf/airavata/diff/382b6c0e
Branch: refs/heads/master
Commit: 382b6c0e6bf64d968bf0f39f3c5776dbc73c51d8
Parents: 34cd927
Author: Suresh Marru <sm...@apache.org>
Authored: Tue May 12 21:19:28 2015 -0400
Committer: Suresh Marru <sm...@apache.org>
Committed: Tue May 12 21:19:28 2015 -0400
----------------------------------------------------------------------
modules/workflow-model/workflow-engine/pom.xml | 7 -
modules/xbaya-gui/pom.xml | 5 -
.../airavata/xbaya/XBayaConfiguration.java | 12 -
.../org/apache/airavata/xbaya/XBayaVersion.java | 2 +-
.../xbaya/graph/controller/NodeController.java | 4 -
.../xbaya/interpretor/DoWhileHandler.java | 248 -------
.../interpretor/SystemComponentInvoker.java | 116 ----
.../xbaya/invoker/AsynchronousInvoker.java | 118 ----
.../airavata/xbaya/invoker/DynamicInvoker.java | 168 -----
.../xbaya/invoker/DynamicServiceCreator.java | 86 ---
.../xbaya/invoker/EmbeddedGFacInvoker.java | 686 -------------------
.../airavata/xbaya/invoker/GFacInvoker.java | 199 ------
.../airavata/xbaya/invoker/GenericInvoker.java | 529 --------------
.../apache/airavata/xbaya/invoker/Invoker.java | 105 ---
.../invoker/MsgBoxWsaResponsesCorrelator.java | 139 ----
.../airavata/xbaya/invoker/SimpleInvoker.java | 260 -------
.../xbaya/invoker/WorkflowInputUtil.java | 72 --
.../WorkflowInvokerWrapperForGFacInvoker.java | 233 -------
.../xbaya/invoker/factory/InvokerFactory.java | 90 ---
.../xbaya/jython/script/JythonScript.java | 7 +-
.../apache/airavata/xbaya/lead/LEADTypes.java | 225 ------
.../xbaya/lead/LeadContextHeaderHelper.java | 149 ----
.../xbaya/lead/NotificationHandler.java | 183 -----
.../graph/dynamic/DynamicNodeWindow.java | 475 -------------
.../dynamic/DynamicWorkflowRunnerWindow.java | 394 -----------
.../system/ConstantConfigurationDialog.java | 1 -
.../DifferedInputConfigurationDialog.java | 1 -
.../graph/system/InputConfigurationDialog.java | 1 -
.../xbaya/ui/graph/dynamic/DynamicNodeGUI.java | 73 --
.../airavata/xbaya/ui/menues/RunMenuItem.java | 6 +-
.../airavata/xbaya/util/InterpreterUtil.java | 391 -----------
.../apache/airavata/xbaya/util/XBayaUtil.java | 107 ---
32 files changed, 5 insertions(+), 5087 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/airavata/blob/382b6c0e/modules/workflow-model/workflow-engine/pom.xml
----------------------------------------------------------------------
diff --git a/modules/workflow-model/workflow-engine/pom.xml b/modules/workflow-model/workflow-engine/pom.xml
index f5afb3d..4ffa4bf 100644
--- a/modules/workflow-model/workflow-engine/pom.xml
+++ b/modules/workflow-model/workflow-engine/pom.xml
@@ -282,13 +282,6 @@
<scope>runtime</scope>
</dependency>
<dependency>
- <groupId>org.apache.airavata</groupId>
- <artifactId>airavata-workflow-execution-context</artifactId>
- <version>${project.version}</version>
- </dependency>
- <!--dependency> <groupId>org.apache.airavata</groupId> <artifactId>airavata-jpa-registry</artifactId> <version>${project.version}</version>
- </dependency -->
- <dependency>
<groupId>org.apache.derby</groupId>
<artifactId>derbyclient</artifactId>
<version>${derby.version}</version>
http://git-wip-us.apache.org/repos/asf/airavata/blob/382b6c0e/modules/xbaya-gui/pom.xml
----------------------------------------------------------------------
diff --git a/modules/xbaya-gui/pom.xml b/modules/xbaya-gui/pom.xml
index 1a39990..acf695f 100644
--- a/modules/xbaya-gui/pom.xml
+++ b/modules/xbaya-gui/pom.xml
@@ -252,11 +252,6 @@
<scope>runtime</scope>
</dependency>
<dependency>
- <groupId>org.apache.airavata</groupId>
- <artifactId>airavata-workflow-execution-context</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
<groupId>org.apache.derby</groupId>
<artifactId>derbyclient</artifactId>
<version>${derby.version}</version>
http://git-wip-us.apache.org/repos/asf/airavata/blob/382b6c0e/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/XBayaConfiguration.java
----------------------------------------------------------------------
diff --git a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/XBayaConfiguration.java b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/XBayaConfiguration.java
index 33012c5..06d3216 100644
--- a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/XBayaConfiguration.java
+++ b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/XBayaConfiguration.java
@@ -32,7 +32,6 @@ import java.util.Observer;
import org.apache.airavata.api.Airavata.Client;
import org.apache.airavata.model.error.AiravataClientConnectException;
-import org.apache.airavata.schemas.wec.ContextHeaderDocument;
import org.apache.airavata.workflow.model.component.registry.JCRComponentRegistry;
import org.apache.airavata.xbaya.core.ide.XBayaExecutionModeListener;
import org.apache.airavata.xbaya.file.XBayaPathConstants;
@@ -140,9 +139,6 @@ public class XBayaConfiguration extends Observable implements Observer {
private boolean regURLSetByCMD = false;
-
- private ContextHeaderDocument.ContextHeader contextHeader;
-
private Map<ThriftServiceType, ThriftClientData> thriftClientDataList = new HashMap<ThriftServiceType, ThriftClientData>();
public enum XBayaExecutionMode{
@@ -861,14 +857,6 @@ public class XBayaConfiguration extends Observable implements Observer {
this.regURLSetByCMD = regURLSetByCMD;
}
- public ContextHeaderDocument.ContextHeader getContextHeader() {
- return contextHeader;
- }
-
- public void setContextHeader(ContextHeaderDocument.ContextHeader contextHeader) {
- this.contextHeader = contextHeader;
- }
-
public Map<ThriftServiceType, ThriftClientData> getThriftClientDataList() {
return thriftClientDataList;
}
http://git-wip-us.apache.org/repos/asf/airavata/blob/382b6c0e/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/XBayaVersion.java
----------------------------------------------------------------------
diff --git a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/XBayaVersion.java b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/XBayaVersion.java
index 5e34672..0c95785 100644
--- a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/XBayaVersion.java
+++ b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/XBayaVersion.java
@@ -28,7 +28,7 @@ public class XBayaVersion {
/**
* Version number
*/
- public final static Version VERSION = new Version("Airavata XBaya", 0, 11,
+ public final static Version VERSION = new Version("Airavata XBaya", 0, 15,
null, null, null);;
/**
http://git-wip-us.apache.org/repos/asf/airavata/blob/382b6c0e/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
index 3ecf54c..56f8bea 100644
--- 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
@@ -32,7 +32,6 @@ 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;
@@ -60,7 +59,6 @@ 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;
@@ -125,8 +123,6 @@ public class NodeController {
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){
http://git-wip-us.apache.org/repos/asf/airavata/blob/382b6c0e/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 a5c6366..0000000
--- a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/interpretor/DoWhileHandler.java
+++ /dev/null
@@ -1,248 +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 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, ExecutorService threadExecutor) {
- this.dowhilenode = node;
- this.invokerMap = invokerMap;
- this.waitingNode = waitingNode;
- this.finishedNodes = finishedNodes;
- 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/382b6c0e/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 a4706af..0000000
--- a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/interpretor/SystemComponentInvoker.java
+++ /dev/null
@@ -1,116 +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 org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import xsul.wsif.WSIFMessage;
-import xsul.xwsif_runtime.WSIFClient;
-
-public class SystemComponentInvoker implements Invoker {
-
- private Map<String, Object> outputs = new Hashtable<String, Object>();
- private static final Logger log = LoggerFactory.getLogger(SystemComponentInvoker.class);
- /**
- *
- * @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) {
- log.error(e.getMessage(), e);
- }
- }
- 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/382b6c0e/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/invoker/AsynchronousInvoker.java
----------------------------------------------------------------------
diff --git a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/invoker/AsynchronousInvoker.java b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/invoker/AsynchronousInvoker.java
deleted file mode 100644
index defd8c2..0000000
--- a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/invoker/AsynchronousInvoker.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.invoker;
-
-import org.apache.airavata.common.utils.XMLUtil;
-import org.apache.airavata.workflow.model.exceptions.WorkflowException;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import xsul.wsdl.WsdlDefinitions;
-import xsul.wsif.WSIFMessage;
-import xsul.wsif.WSIFOperation;
-import xsul.xwsif_runtime_async.WSIFAsyncResponsesCorrelator;
-import xsul.xwsif_runtime_async_http.XsulSoapHttpWsaResponsesCorrelator;
-
-public class AsynchronousInvoker extends SimpleInvoker {
-
- private static final Logger logger = LoggerFactory.getLogger(AsynchronousInvoker.class);
-
- private String messageBoxURL;
-
- /**
- * Constructs an AsynchronousInvoker.
- *
- * @param definitions
- */
- public AsynchronousInvoker(WsdlDefinitions definitions) {
- this(definitions, null);
- }
-
- /**
- * Constructs an AsynchronousInvoker.
- *
- * @param definitions
- * @param messageBoxURL
- */
- public AsynchronousInvoker(WsdlDefinitions definitions, String messageBoxURL) {
- super(definitions);
- this.messageBoxURL = messageBoxURL;
- }
-
- /**
- * @see org.apache.airavata.xbaya.invoker.SimpleInvoker#setup()
- */
- @Override
- public void setup() throws WorkflowException {
- super.setup();
- /* Set the output message to null to set teh output from async Listener */
- WSIFAsyncResponsesCorrelator correlator;
- if (this.messageBoxURL == null || this.messageBoxURL.length() == 0) {
- correlator = new XsulSoapHttpWsaResponsesCorrelator();
- String serverLoc = ((XsulSoapHttpWsaResponsesCorrelator) correlator).getServerLocation();
- logger.debug("using async correlator at " + serverLoc);
- } else {
- correlator = new MsgBoxWsaResponsesCorrelator(this.messageBoxURL,this);
- logger.debug("using message box at " + this.messageBoxURL);
- }
- this.client.useAsyncMessaging(correlator);
- }
-
- public boolean invoke() throws WorkflowException {
- final WSIFOperation operation = this.getOperation();
- final WSIFMessage inputMessage = this.getInputMessage();
- this.setOutputMessage(null);
- try {
- new Thread() {
- @Override
- public void run() {
- try {
- operation.executeInputOnlyOperation(inputMessage);
- } catch (Exception e) {
- // Ignore the error.
- logger.error("Error invoking GFac Service",e);
- }
- }
- }.start();
-
- while(this.getOutputMessage() == null){
- try {
- Thread.sleep(1000);
- } catch (InterruptedException e) {
- logger.error("Error Waiting for the response from backend");
- }
- }
- // Gfac operation failed, so xbaya side throws this exception
- if("ErrorResponse".equals(XMLUtil.stringToXmlElement3(this.getOutputMessage().toString()).getName())){
- // Here we do not throw an exception, because if we throw an exception Interpreter will catch it and do the unsubscription,
- // which is not needed because if there's an gfac side error gfac will send a failure and unsubscription will be done in monitoring
- // so if we send an exception we are attempting to do two unsubscriptions which will cause a one unsubscription to fail.
- return false;
- }
-
- return true;
- } catch (RuntimeException e) {
- String message = "Error in invoking a service.";
- throw new WorkflowException(message, e);
- }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/airavata/blob/382b6c0e/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/invoker/DynamicInvoker.java
----------------------------------------------------------------------
diff --git a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/invoker/DynamicInvoker.java b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/invoker/DynamicInvoker.java
deleted file mode 100644
index d293fe4..0000000
--- a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/invoker/DynamicInvoker.java
+++ /dev/null
@@ -1,168 +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.invoker;
-
-import java.lang.reflect.Method;
-import java.net.URL;
-import java.net.URLClassLoader;
-
-import org.apache.airavata.workflow.model.exceptions.WorkflowException;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import xsul.wsif.WSIFMessage;
-import xsul.xwsif_runtime.WSIFClient;
-
-public class DynamicInvoker implements Invoker {
-
- private URL jarUrl;
-
- private String className;
-
- private String operationName;
-
- private Object[] inputs;
-
- private Object result;
-
- private static final Logger log = LoggerFactory.getLogger(DynamicInvoker.class);
- /**
- * Constructs a DynamicInvoker.
- *
- * @param className
- * @param jarUrl
- * @param operationName
- */
- public DynamicInvoker(String className, URL jarUrl, String operationName, Object[] inputs) {
- this.className = className;
- this.jarUrl = jarUrl;
- this.operationName = operationName;
- this.inputs = inputs;
- }
-
- /**
- * @see org.apache.airavata.xbaya.invoker.WorkflowInvoker#getOutput(java.lang.String)
- */
- public Object getOutput(String name) throws WorkflowException {
- waitToFinish();
- return result;
- }
-
- /**
- * @see org.apache.airavata.xbaya.invoker.WorkflowInvoker#invoke()
- */
- public boolean invoke() throws WorkflowException {
- try {
- Class<?> targetClass = Class.forName(this.className);
- Object obj = targetClass.newInstance();
-
- Method[] methods = targetClass.getDeclaredMethods();
- Method targetMethod = null;
- for (Method method : methods) {
- if (this.operationName.equals(method.getName())) {
- targetMethod = method;
- break;
- }
- }
- if (targetMethod == null) {
- throw new WorkflowException("Could not find the method using reflection: " + this.operationName);
- }
-
- targetMethod.setAccessible(true);
- this.result = targetMethod.invoke(obj, inputs);
-
- } catch (Exception e) {
- throw new WorkflowException(e);
- }
- return true;
- }
-
- /**
- * @see org.apache.airavata.xbaya.invoker.WorkflowInvoker#setInput(java.lang.String, java.lang.Object)
- */
- public void setInput(String name, Object value) throws WorkflowException {
-
- }
-
- /**
- * @see org.apache.airavata.xbaya.invoker.WorkflowInvoker#setOperation(java.lang.String)
- */
- public void setOperation(String operationName) throws WorkflowException {
- this.operationName = operationName;
- }
-
- /**
- * @see org.apache.airavata.xbaya.invoker.WorkflowInvoker#setup()
- */
- public void setup() throws WorkflowException {
- Class[] parameters = new Class[] { URL.class };
- URLClassLoader sysloader = (URLClassLoader) ClassLoader.getSystemClassLoader();
- Class sysclass = URLClassLoader.class;
-
- try {
- Method method = sysclass.getDeclaredMethod("addURL", parameters);
- method.setAccessible(true);
- method.invoke(sysloader, new Object[] { this.jarUrl });
- } catch (Throwable t) {
- throw new WorkflowException("Error, could not add URL to system classloader", t);
- }
- }
-
- /**
- * @see org.apache.airavata.xbaya.invoker.WorkflowInvoker#waitToFinish()
- */
- public void waitToFinish() throws WorkflowException {
- while (this.result == null) {
- try {
- Thread.sleep(200);
- } catch (InterruptedException e) {
- log.error(e.getMessage(), e);
- }
- }
-
- }
-
- /**
- * @see org.apache.airavata.xbaya.invoker.WorkflowInvoker#getOutputs()
- */
- public WSIFMessage getOutputs() throws WorkflowException {
- waitToFinish();
- return (WSIFMessage) this.result;
-
- }
-
- @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/382b6c0e/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/invoker/DynamicServiceCreator.java
----------------------------------------------------------------------
diff --git a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/invoker/DynamicServiceCreator.java b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/invoker/DynamicServiceCreator.java
deleted file mode 100644
index cc7fc2c..0000000
--- a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/invoker/DynamicServiceCreator.java
+++ /dev/null
@@ -1,86 +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.invoker;
-
-import java.io.File;
-import java.net.URI;
-
-import javax.xml.namespace.QName;
-
-import org.apache.airavata.workflow.model.exceptions.WorkflowException;
-import org.apache.airavata.xbaya.invoker.factory.InvokerFactory;
-
-import xsul.wsdl.WsdlDefinitions;
-import xsul.wsdl.WsdlResolver;
-
-public class DynamicServiceCreator {
-
- private String dynamicFactoryWSDLLocation;
-
- private static String classStr = "package org.apache.airavata.xbaya;" +
-
- "public class DefaultClassName{" +
-
- "public int operationName(String[] stringArray0){" +
-
- "return 8;" + "}" + "}";
-
- /**
- * Constructs a DynamicServiceCreator.
- *
- * @param dynamicFactoryWSDLLocation
- */
- public DynamicServiceCreator(String dynamicFactoryWSDLLocation) {
- this.dynamicFactoryWSDLLocation = dynamicFactoryWSDLLocation;
- }
-
- public void createService(String code) throws WorkflowException {
- try {
- WsdlDefinitions definitions = null;
- if (this.dynamicFactoryWSDLLocation != null && !this.dynamicFactoryWSDLLocation.equals("")) {
- definitions = WsdlResolver.getInstance().loadWsdl(new File(".").toURI(),
- new URI(this.dynamicFactoryWSDLLocation));
- }
-
- // Create Invoker
- // FIXME: Should pass the right leadcontext header for last argument
- Invoker invoker = InvokerFactory.createInvoker(new QName("http://extreme.indiana.edu",
- "ServiceCreatorPortType"), definitions, null, null, null);
-
- invoker.setup();
-
- invoker.setOperation("deployServiceFromClass");
- invoker.setInput("classAsString", code);
- invoker.invoke();
- invoker.getOutput("return");
- } catch (Exception e) {
- throw new WorkflowException(e);
- }
-
- }
-
- public static void main(String[] args) throws WorkflowException {
- DynamicServiceCreator c = new DynamicServiceCreator("http://127.0.0.1:8080/axis2/services/ServiceCreator?wsdl");
- c.createService(classStr);
- }
-
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/airavata/blob/382b6c0e/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/invoker/EmbeddedGFacInvoker.java
----------------------------------------------------------------------
diff --git a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/invoker/EmbeddedGFacInvoker.java b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/invoker/EmbeddedGFacInvoker.java
deleted file mode 100644
index 204427b..0000000
--- a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/invoker/EmbeddedGFacInvoker.java
+++ /dev/null
@@ -1,686 +0,0 @@
-///*
-// *
-// * Licensed to the Apache Software Foundation (ASF) und= nuer 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.invoker;
-//
-//import java.io.File;
-//import java.io.StringReader;
-//import java.net.URL;
-//import java.util.*;
-//
-//import javax.xml.namespace.QName;
-//import javax.xml.stream.XMLInputFactory;
-//import javax.xml.stream.XMLStreamException;
-//import javax.xml.stream.XMLStreamReader;
-//
-//import org.apache.airavata.client.api.AiravataAPI;
-//import org.apache.airavata.client.api.exception.AiravataAPIInvocationException;
-//import org.apache.airavata.common.utils.ServerSettings;
-//import org.apache.airavata.common.utils.XMLUtil;
-//import org.apache.airavata.common.workflow.execution.context.WorkflowContextHeaderBuilder;
-//import org.apache.airavata.commons.gfac.type.ActualParameter;
-//import org.apache.airavata.commons.gfac.type.ApplicationDescription;
-//import org.apache.airavata.commons.gfac.type.HostDescription;
-//import org.apache.airavata.commons.gfac.type.ServiceDescription;
-//import org.apache.airavata.credential.store.store.CredentialReaderFactory;
-//import org.apache.airavata.gfac.Constants;
-//import org.apache.airavata.gfac.GFacConfiguration;
-//import org.apache.airavata.gfac.RequestData;
-//import org.apache.airavata.gfac.context.ApplicationContext;
-//import org.apache.airavata.gfac.context.JobExecutionContext;
-//import org.apache.airavata.gfac.context.MessageContext;
-//import org.apache.airavata.gfac.context.security.GSISecurityContext;
-//import org.apache.airavata.gfac.context.security.SSHSecurityContext;
-//import org.apache.airavata.gfac.cpi.GFacImpl;
-//import org.apache.airavata.gfac.ec2.AmazonSecurityContext;
-//import org.apache.airavata.gfac.scheduler.HostScheduler;
-//import org.apache.airavata.gfac.utils.GFacUtils;
-//import org.apache.airavata.gsi.ssh.api.Cluster;
-//import org.apache.airavata.gsi.ssh.api.SSHApiException;
-//import org.apache.airavata.gsi.ssh.api.ServerInfo;
-//import org.apache.airavata.gsi.ssh.api.authentication.AuthenticationInfo;
-//import org.apache.airavata.gsi.ssh.api.authentication.GSIAuthenticationInfo;
-//import org.apache.airavata.gsi.ssh.impl.PBSCluster;
-//import org.apache.airavata.gsi.ssh.impl.authentication.DefaultPasswordAuthenticationInfo;
-//import org.apache.airavata.gsi.ssh.impl.authentication.DefaultPublicKeyFileAuthentication;
-//import org.apache.airavata.gsi.ssh.impl.authentication.MyProxyAuthenticationInfo;
-//import org.apache.airavata.gsi.ssh.util.CommonUtils;
-//import org.apache.airavata.registry.api.exception.RegistryException;
-//import org.apache.airavata.schemas.gfac.*;
-//import org.apache.airavata.schemas.wec.ContextHeaderDocument;
-//import org.apache.airavata.schemas.wec.SecurityContextDocument;
-//import org.apache.airavata.workflow.model.exceptions.WorkflowException;
-//import org.apache.airavata.xbaya.XBayaConfiguration;
-//import org.apache.airavata.xbaya.jython.lib.ServiceNotifiable;
-//import org.apache.airavata.xbaya.jython.lib.WorkflowNotifiable;
-//import org.apache.axiom.om.OMAbstractFactory;
-//import org.apache.axiom.om.OMElement;
-//import org.apache.axiom.om.OMFactory;
-//import org.apache.axiom.om.OMNamespace;
-//import org.apache.axiom.om.impl.builder.StAXOMBuilder;
-//import org.apache.axiom.om.impl.llom.util.AXIOMUtil;
-//import org.slf4j.Logger;
-//import org.slf4j.LoggerFactory;
-//import org.xmlpull.v1.builder.XmlElement;
-//
-//import xsul.wsdl.WsdlDefinitions;
-//import xsul.wsif.WSIFMessage;
-//import xsul.wsif.impl.WSIFMessageElement;
-//import xsul.xwsif_runtime.WSIFClient;
-//
-//public class EmbeddedGFacInvoker implements Invoker {
-//
-// private static final Logger logger = LoggerFactory.getLogger(EmbeddedGFacInvoker.class);
-//
-// private String nodeID;
-//
-// private QName portTypeQName;
-//
-// private String wsdlLocation;
-//
-// private String serviceInformation;
-//
-// private String messageBoxURL;
-//
-// private String gfacURL;
-//
-// private Invoker invoker;
-//
-// private XBayaConfiguration configuration;
-//
-//
-// private Boolean result;
-//
-// private ServiceNotifiable notifier;
-//
-//// private AiravataRegistry2 registry;
-//
-// private String topic;
-//
-// private String serviceName;
-//
-// private AiravataAPI airavataAPI;
-// /**
-// * used for notification
-// */
-// private List<Object> inputValues = new ArrayList<Object>();
-//
-// /**
-// * used for notification
-// */
-// private List<String> inputNames = new ArrayList<String>();
-//
-// boolean failerSent;
-//
-// private WsdlDefinitions wsdlDefinitionObject;
-//
-// private Object outPut;
-//
-// Map<String, Object> actualParameters = new LinkedHashMap<String, Object>();
-//
-// /**
-// * Creates an InvokerWithNotification.
-// *
-// * @param portTypeQName
-// * @param wsdlLocation The URL of WSDL of the service to invoke
-// * @param nodeID The ID of the service
-// * @param notifier The notification sender
-// */
-// public EmbeddedGFacInvoker(QName portTypeQName, String wsdlLocation, String nodeID, WorkflowNotifiable notifier) {
-// this(portTypeQName, wsdlLocation, nodeID, null, notifier);
-// }
-//
-// /**
-// * Creates an InvokerWithNotification.
-// *
-// * @param portTypeQName
-// * @param wsdlLocation The URL of WSDL of the service to invoke
-// * @param nodeID The ID of the service
-// * @param gfacURL The URL of GFac service.
-// * @param notifier The notification sender
-// */
-// public EmbeddedGFacInvoker(QName portTypeQName, String wsdlLocation, String nodeID, String gfacURL,
-// WorkflowNotifiable notifier) {
-// this(portTypeQName, wsdlLocation, nodeID, null, gfacURL, notifier);
-// }
-//
-// /**
-// * Creates an InvokerWithNotification.
-// *
-// * @param portTypeQName
-// * @param wsdlLocation The URL of WSDL of the service to invoke
-// * @param nodeID The ID of the service
-// * @param messageBoxURL
-// * @param gfacURL The URL of GFac service.
-// * @param notifier The notification sender
-// */
-// public EmbeddedGFacInvoker(QName portTypeQName, String wsdlLocation, String nodeID, String messageBoxURL,
-// String gfacURL, WorkflowNotifiable notifier) {
-// this.nodeID = nodeID;
-// this.portTypeQName = portTypeQName;
-// this.wsdlLocation = wsdlLocation;
-// this.serviceInformation = wsdlLocation;
-// this.messageBoxURL = messageBoxURL;
-// this.gfacURL = gfacURL;
-// this.notifier = notifier.createServiceNotificationSender(nodeID);
-//
-// this.failerSent = false;
-// }
-//
-// /**
-// * @param portTypeQName
-// * @param wsdl
-// * @param nodeID
-// * @param messageBoxURL
-// * @param gfacURL
-// * @param notifier
-// */
-// public EmbeddedGFacInvoker(QName portTypeQName,
-// WsdlDefinitions wsdl,
-// String nodeID,
-// String messageBoxURL,
-// String gfacURL,
-// WorkflowNotifiable notifier,
-// String topic,
-// AiravataAPI airavataAPI,
-// String serviceName,
-// XBayaConfiguration config) {
-// final String wsdlStr = xsul.XmlConstants.BUILDER.serializeToString(wsdl);
-// this.nodeID = nodeID;
-// this.portTypeQName = portTypeQName;
-// this.wsdlDefinitionObject = wsdl;
-// this.messageBoxURL = messageBoxURL;
-// this.serviceInformation = wsdlStr;
-// this.gfacURL = gfacURL;
-// this.notifier = notifier.createServiceNotificationSender(nodeID);
-// this.airavataAPI = airavataAPI;
-// this.topic = topic;
-// this.serviceName = serviceName;
-// this.failerSent = false;
-// this.configuration = config;
-// }
-//
-// /**
-// * @throws WorkflowException
-// */
-// public void setup() throws WorkflowException {
-// this.notifier.setServiceID(this.nodeID);
-// }
-//
-// private void setup(WsdlDefinitions definitions) throws WorkflowException {
-// }
-//
-// /**
-// * @param operationName The name of the operation
-// * @throws WorkflowException
-// */
-// public void setOperation(String operationName) throws WorkflowException {
-// }
-//
-// /**
-// * @param name The name of the input parameter
-// * @param value The value of the input parameter
-// * @throws WorkflowException
-// */
-// public void setInput(String name, Object value) throws WorkflowException {
-// try {
-// if (value instanceof XmlElement) {
-// logger.debug("value: " + XMLUtil.xmlElementToString((XmlElement) value));
-// }
-// this.inputNames.add(name);
-// this.inputValues.add(value);
-// } catch (RuntimeException e) {
-// logger.error(e.getMessage(), e);
-// String message = "Error in setting an input. name: " + name + " value: " + value;
-// this.notifier.invocationFailed(message, e);
-// throw new WorkflowException(message, e);
-// } catch (Error e) {
-// logger.error(e.getMessage(), e);
-// String message = "Unexpected error: " + this.serviceInformation;
-// this.notifier.invocationFailed(message, e);
-// throw new WorkflowException(message, e);
-// } catch (Exception e) {
-// e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
-// }
-// }
-//
-// /**
-// * @return
-// * @throws WorkflowException
-// */
-// public synchronized boolean invoke() throws WorkflowException {
-// try {
-// ContextHeaderDocument.ContextHeader contextHeader =
-// WorkflowContextHeaderBuilder.removeOtherSchedulingConfig(nodeID, this.configuration.getContextHeader());
-// String hostName = null;
-// HostDescription registeredHost;
-// if (contextHeader != null) {
-// if (contextHeader.getWorkflowSchedulingContext() != null &&
-// contextHeader.getWorkflowSchedulingContext().getApplicationSchedulingContextArray().length > 0 &&
-// contextHeader.getWorkflowSchedulingContext().getApplicationSchedulingContextArray(0).getHostName() != null) {
-// hostName = contextHeader.getWorkflowSchedulingContext().getApplicationSchedulingContextArray(0).getHostName();
-// }
-// }
-// //todo This is the basic scheduling, have to do proper scheduling implementation by implementing HostScheduler interface
-// ServiceDescription serviceDescription = airavataAPI.getApplicationManager().getServiceDescription(serviceName);
-// if (hostName == null) {
-// List<HostDescription> registeredHosts = new ArrayList<HostDescription>();
-// Map<String, ApplicationDescription> applicationDescriptors = airavataAPI.getApplicationManager().getApplicationDescriptors(serviceName);
-// for (String hostDescName : applicationDescriptors.keySet()) {
-// registeredHosts.add(airavataAPI.getApplicationManager().getHostDescription(hostDescName));
-// }
-// Class<? extends HostScheduler> aClass = Class.forName(ServerSettings.getHostScheduler()).asSubclass(HostScheduler.class);
-// HostScheduler hostScheduler = aClass.newInstance();
-// registeredHost = hostScheduler.schedule(registeredHosts);
-// } else {
-// // if user specify a host, no matter what we pick that host for all the nodes, todo: allow users to specify node specific host
-// registeredHost = airavataAPI.getApplicationManager().getHostDescription(hostName);
-// }
-// ApplicationDescription applicationDescription =
-// airavataAPI.getApplicationManager().getApplicationDescription(serviceName, registeredHost.getType().getHostName());
-//
-// // When we run getInParameters we set the actualParameter object, this has to be fixed
-// URL resource = EmbeddedGFacInvoker.class.getClassLoader().getResource(org.apache.airavata.common.utils.Constants.GFAC_CONFIG_XML);
-// OMElement inputMessage = getInParameters();
-// Object wsifMessageElement = new WSIFMessageElement(XMLUtil.stringToXmlElement3(inputMessage.toStringWithConsume()));
-// this.notifier.invokingService(new WSIFMessageElement((XmlElement) wsifMessageElement));
-// Properties configurationProperties = ServerSettings.getProperties();
-// GFacConfiguration gFacConfiguration = GFacConfiguration.create(new File(resource.getPath()), airavataAPI, configurationProperties);
-//
-// JobExecutionContext jobExecutionContext = new JobExecutionContext(gFacConfiguration, serviceName);
-// //Here we get only the contextheader information sent specific for this node
-// //Add security context
-//
-// //FIXME - We no longer using job execution context
-//// jobExecutionContext.setContextHeader(WorkflowContextHeaderBuilder.removeOtherSchedulingConfig(nodeID, configuration.getContextHeader()));
-//
-//
-// jobExecutionContext.setProperty(Constants.PROP_WORKFLOW_NODE_ID, this.nodeID);
-// jobExecutionContext.setProperty(Constants.PROP_TOPIC, this.configuration.getTopic());
-// jobExecutionContext.setProperty(Constants.PROP_BROKER_URL, this.configuration.getBrokerURL().toASCIIString());
-// jobExecutionContext.setProperty(Constants.PROP_WORKFLOW_INSTANCE_ID, this.configuration.getTopic());
-//
-//
-// ApplicationContext applicationContext = new ApplicationContext();
-// applicationContext.setApplicationDeploymentDescription(applicationDescription);
-// applicationContext.setHostDescription(registeredHost);
-// applicationContext.setServiceDescription(serviceDescription);
-//
-// jobExecutionContext.setApplicationContext(applicationContext);
-//
-// jobExecutionContext.setOutMessageContext(getOutParameters(serviceDescription));
-// jobExecutionContext.setInMessageContext(new MessageContext(actualParameters));
-//
-// addSecurityContext(registeredHost, configurationProperties, jobExecutionContext,
-// configuration.getContextHeader());
-// GFacImpl gfacAPI1 = new GFacImpl();
-// gfacAPI1.submitJob(jobExecutionContext);
-//
-// OMFactory fac = OMAbstractFactory.getOMFactory();
-// OMNamespace omNs = fac.createOMNamespace("http://ws.apache.org/axis2/xsd", "ns1");
-// OMElement outputElement = fac.createOMElement("invokeResponse", omNs);
-// MessageContext outMessageContext = jobExecutionContext.getOutMessageContext();
-// Set<String> paramNames = outMessageContext.getParameters().keySet();
-// for (String paramName : paramNames) {
-// /*
-// * Process Output
-// */
-// String outputString = ((ActualParameter) outMessageContext.getParameter(paramName)).toXML().replaceAll("GFacParameter", paramName);
-// XMLStreamReader reader = XMLInputFactory.newInstance().createXMLStreamReader(new StringReader(outputString));
-// StAXOMBuilder builder = new StAXOMBuilder(reader);
-// outputElement.addChild(builder.getDocumentElement());
-// }
-// // Send notification
-// logger.debug("outputMessage: " + outputElement.toString());
-// outPut = new WSIFMessageElement(XMLUtil.stringToXmlElement3(outputElement.toStringWithConsume()));
-// this.result = true;
-// EmbeddedGFacInvoker.this.notifier.serviceFinished(new WSIFMessageElement((XmlElement) outPut));
-// //todo check whether ActualParameter values are set or not, if they are null have to through an error or handle this in gfac level.
-//// {
-//// // An implementation of WSIFMessage,
-//// // WSIFMessageElement, implements toString(), which
-//// // serialize the message XML.
-//// EmbeddedGFacInvoker.this.notifier.receivedFault(new WSIFMessageElement(XMLUtil.stringToXmlElement3("<Message>Invocation Failed</Message>")));
-//// EmbeddedGFacInvoker.this.failerSent = true;
-//// }
-//
-// } catch (RuntimeException e) {
-// logger.error(e.getMessage(), e);
-// String message = "Error in invoking a service: " + this.serviceInformation;
-// this.notifier.invocationFailed(message, e);
-// throw new WorkflowException(message, e);
-// } catch (Error e) {
-// logger.error(e.getMessage(), e);
-// String message = "Unexpected error: " + this.serviceInformation;
-// this.notifier.invocationFailed(message, e);
-// throw new WorkflowException(message, e);
-// } catch (Exception e) {
-// this.notifier.invocationFailed(e.getMessage(), e);
-// throw new WorkflowException(e.getMessage(), e);
-// }
-// return true;
-// }
-//
-// private SecurityContextDocument.SecurityContext.CredentialManagementService getCredentialManagementService(
-// ContextHeaderDocument.ContextHeader contextHeader) {
-//
-// if (contextHeader != null) {
-//
-// SecurityContextDocument.SecurityContext.CredentialManagementService credentialManagementService
-// = contextHeader.getSecurityContext().getCredentialManagementService();
-//
-// if (credentialManagementService != null) {
-// // Make sure token id and portal user id is properly populated
-// if (credentialManagementService.getTokenId() != null &&
-// credentialManagementService.getPortalUser() != null) {
-//
-// return credentialManagementService;
-// } else {
-// return null;
-// }
-// } else {
-// return null;
-// }
-// }
-//
-// return null;
-// }
-//
-// private void addSecurityContext(HostDescription registeredHost, Properties configurationProperties,
-// JobExecutionContext jobExecutionContext, ContextHeaderDocument.ContextHeader contextHeader) throws WorkflowException {
-// RequestData requestData;
-// /* todo fix the credential store and uncomment following code block
-// SecurityContextDocument.SecurityContext.CredentialManagementService credentialManagementService
-// = getCredentialManagementService(contextHeader);
-//
-// GSISecurityContext context;
-//
-//
-// if (credentialManagementService != null) {
-// String gatewayId = credentialManagementService.getGatewayId();
-// String tokenId
-// = credentialManagementService.getTokenId();
-// String portalUser = credentialManagementService.getPortalUser();
-//
-// requestData = new RequestData(tokenId, portalUser, gatewayId);
-// } else {
-// requestData = new RequestData("default");
-// }
-//
-// try {
-// context = new GSISecurityContext(CredentialReaderFactory.createCredentialStoreReader(), requestData);
-// } catch (Exception e) {
-// throw new WorkflowException("An error occurred while creating GSI security context", e);
-// }
-// if (registeredHost.getType() instanceof GsisshHostType) {
-// GSIAuthenticationInfo authenticationInfo
-// = new MyProxyAuthenticationInfo(requestData.getMyProxyUserName(), requestData.getMyProxyPassword(), requestData.getMyProxyServerUrl(),
-// requestData.getMyProxyPort(), requestData.getMyProxyLifeTime(), System.getProperty(Constants.TRUSTED_CERTIFICATE_SYSTEM_PROPERTY));
-// ServerInfo serverInfo = new ServerInfo(requestData.getMyProxyUserName(), registeredHost.getType().getHostAddress());
-//
-// Cluster pbsCluster = null;
-// try {
-// pbsCluster = new PBSCluster(serverInfo, authenticationInfo,
-// (((HpcApplicationDeploymentType) jobExecutionContext.getApplicationContext().getApplicationDeploymentDescription().getType()).getInstalledParentPath()));
-// } catch (SSHApiException e) {
-// e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
-// }
-//
-// context.setPbsCluster(pbsCluster);
-// }
-// */
-// requestData = new RequestData("default");
-// GSISecurityContext context;
-// try {
-// context = new GSISecurityContext(CredentialReaderFactory.createCredentialStoreReader(), requestData);
-// } catch (Exception e) {
-// throw new WorkflowException("An error occurred while creating GSI security context", e);
-// }
-//
-// if (registeredHost.getType() instanceof GsisshHostType) {
-// GSIAuthenticationInfo authenticationInfo
-// = new MyProxyAuthenticationInfo(requestData.getMyProxyUserName(), requestData.getMyProxyPassword(), requestData.getMyProxyServerUrl(),
-// requestData.getMyProxyPort(), requestData.getMyProxyLifeTime(), System.getProperty(Constants.TRUSTED_CERTIFICATE_SYSTEM_PROPERTY));
-// ServerInfo serverInfo = new ServerInfo(requestData.getMyProxyUserName(), registeredHost.getType().getHostAddress());
-//
-// Cluster pbsCluster = null;
-// try {
-// String installedParentPath = ((HpcApplicationDeploymentType)
-// jobExecutionContext.getApplicationContext().getApplicationDeploymentDescription().getType()).getInstalledParentPath();
-// pbsCluster = new PBSCluster(serverInfo, authenticationInfo,
-// (CommonUtils.getPBSJobManager(installedParentPath)));
-// } catch (SSHApiException e) {
-// e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
-// }
-//
-// context.setPbsCluster(pbsCluster);
-// }
-//
-// jobExecutionContext.addSecurityContext(GSISecurityContext.GSI_SECURITY_CONTEXT, context);
-// //Adding Amanzon Keys
-// if (this.configuration.getAmazonSecurityContext() != null) {
-// jobExecutionContext.addSecurityContext(AmazonSecurityContext.AMAZON_SECURITY_CONTEXT,
-// this.configuration.getAmazonSecurityContext());
-// }
-// //Adding SSH security
-// String sshUserName = configurationProperties.getProperty(Constants.SSH_USER_NAME);
-// String sshPrivateKey = configurationProperties.getProperty(Constants.SSH_PRIVATE_KEY);
-// String sshPrivateKeyPass = configurationProperties.getProperty(Constants.SSH_PRIVATE_KEY_PASS);
-// String sshPassword = configurationProperties.getProperty(Constants.SSH_PASSWORD);
-// String sshPublicKey = configurationProperties.getProperty(Constants.SSH_PUBLIC_KEY);
-// SSHSecurityContext sshSecurityContext = new SSHSecurityContext();
-// if (((SSHHostType) registeredHost.getType()).getHpcResource()) {
-// AuthenticationInfo authenticationInfo = null;
-// // we give higher preference to the password over keypair ssh authentication
-// if (sshPassword != null) {
-// authenticationInfo = new DefaultPasswordAuthenticationInfo(sshPassword);
-// } else {
-// authenticationInfo = new DefaultPublicKeyFileAuthentication(sshPublicKey, sshPrivateKey, sshPrivateKeyPass);
-// }
-// ServerInfo serverInfo = new ServerInfo(sshUserName, registeredHost.getType().getHostAddress());
-//
-// Cluster pbsCluster = null;
-// try {
-// String installedParentPath = ((HpcApplicationDeploymentType)
-// jobExecutionContext.getApplicationContext().getApplicationDeploymentDescription().getType()).getInstalledParentPath();
-// pbsCluster = new PBSCluster(serverInfo, authenticationInfo,
-// (CommonUtils.getPBSJobManager(installedParentPath)));
-// } catch (SSHApiException e) {
-// e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
-// }
-// sshSecurityContext.setPbsCluster(pbsCluster);
-// sshSecurityContext.setUsername(sshUserName);
-// } else {
-// sshSecurityContext = new SSHSecurityContext();
-// sshSecurityContext.setUsername(sshUserName);
-// sshSecurityContext.setPrivateKeyLoc(sshPrivateKey);
-// sshSecurityContext.setKeyPass(sshPrivateKeyPass);
-// }
-// jobExecutionContext.addSecurityContext(SSHSecurityContext.SSH_SECURITY_CONTEXT, sshSecurityContext);
-// }
-//
-// /**
-// * @throws WorkflowException
-// */
-// @SuppressWarnings("boxing")
-// public synchronized void waitToFinish() throws WorkflowException {
-// try {
-// while (this.result == null) {
-// // The job is not submitted yet.
-// try {
-// wait();
-// } catch (InterruptedException e) {
-// logger.error(e.getMessage(), e);
-// }
-// }
-// // Wait for the job to finish.
-// Boolean success = this.result;
-// if (success == false) {
-// WSIFMessage faultMessage = this.invoker.getFault();
-// String message = "Error in a service: ";
-// // An implementation of WSIFMessage,
-// // WSIFMessageElement, implements toString(), which
-// // serialize the message XML.
-// message += faultMessage.toString();
-// throw new WorkflowException(message);
-// }
-// } catch (RuntimeException e) {
-// logger.error(e.getMessage(), e);
-// String message = "Error while waiting for a service to finish: " + this.serviceInformation;
-// this.notifier.invocationFailed(message, e);
-// throw new WorkflowException(message, e);
-// } catch (Error e) {
-// logger.error(e.getMessage(), e);
-// String message = "Unexpected error: " + this.serviceInformation;
-// this.notifier.invocationFailed(message, e);
-// throw new WorkflowException(message, e);
-// }
-// }
-//
-// /**
-// * @param name The name of the output parameter
-// * @return
-// * @throws WorkflowException
-// */
-// public Object getOutput(String name) throws WorkflowException {
-// try {
-// waitToFinish();
-// if (outPut instanceof XmlElement) {
-// Iterator children = ((XmlElement) outPut).children();
-// while (children.hasNext()) {
-// Object next = children.next();
-// if (((XmlElement) next).getName().equals(name)) {
-// return ((XmlElement) ((XmlElement) next).children().next()).children().next();
-// }
-// }
-// } else {
-// return outPut;
-// }
-// } catch (WorkflowException e) {
-// logger.error(e.getMessage(), e);
-// // An appropriate message has been set in the exception.
-// if (!this.failerSent) {
-// this.notifier.invocationFailed(e.getMessage(), e);
-// }
-// throw e;
-// } catch (RuntimeException e) {
-// logger.error(e.getMessage(), e);
-// String message = "Error while waiting for a output: " + name;
-// this.notifier.invocationFailed(message, e);
-// throw new WorkflowException(message, e);
-// } catch (Error e) {
-// logger.error(e.getMessage(), e);
-// String message = "Unexpected error: " + this.serviceInformation;
-// this.notifier.invocationFailed(message, e);
-// throw new WorkflowException(message, e);
-// }
-// throw new WorkflowException("Output could not be found");
-// }
-//
-// /**
-// * @return
-// * @throws WorkflowException
-// */
-// public WSIFMessage getOutputs() throws WorkflowException {
-// return this.invoker.getOutputs();
-// }
-//
-// public WSIFClient getClient() {
-// return null;
-// }
-//
-// public WSIFMessage getInputs() throws WorkflowException {
-// return null;
-// }
-//
-// public WSIFMessage getFault() throws WorkflowException {
-// return null;
-// }
-//
-// private OMElement getInParameters() throws AiravataAPIInvocationException, RegistryException, XMLStreamException {
-// OMFactory omFactory = OMAbstractFactory.getOMFactory();
-// OMElement invoke_inputParams = omFactory.createOMElement(new QName("invoke_InputParams"));
-// ServiceDescription serviceDescription = airavataAPI.getApplicationManager().getServiceDescription(this.serviceName);
-// if (serviceDescription == null) {
-// throw new RegistryException(new Exception("Service Description not found in registry."));
-// }
-// ServiceDescriptionType serviceDescriptionType = serviceDescription.getType();
-// for (String inputName : this.inputNames) {
-// OMElement omElement = omFactory.createOMElement(new QName(inputName));
-// int index = this.inputNames.indexOf(inputName);
-// Object value = this.inputValues.get(index);
-// InputParameterType parameter = serviceDescriptionType.getInputParametersArray(index);
-// if (value instanceof XmlElement) {
-// omElement.setText((String) ((XmlElement) ((XmlElement) ((XmlElement) value).children().next()).children().next()).children().next());
-// XMLStreamReader reader = XMLInputFactory.newInstance().createXMLStreamReader(new StringReader(XMLUtil.xmlElementToString((XmlElement) value)));
-// StAXOMBuilder builder = new StAXOMBuilder(reader);
-// OMElement input = builder.getDocumentElement();
-//// actualParameters.put(parameter.getParameterName(), GFacUtils.getInputActualParameter(parameter, input));
-// } else if (value instanceof String) {
-// omElement.setText((String) value);
-//// actualParameters.put(parameter.getParameterName(), GFacUtils.getInputActualParameter(parameter, AXIOMUtil.stringToOM("<value>" + value + "</value>")));
-// }
-// invoke_inputParams.addChild(omElement);
-// }
-// return invoke_inputParams;
-// }
-//
-// private MessageContext getOutParameters(ServiceDescription serviceDescription) {
-// MessageContext outContext = new MessageContext();
-// for (OutputParameterType parameter : serviceDescription.getType().getOutputParametersArray()) {
-// ActualParameter actualParameter = new ActualParameter();
-// if ("String".equals(parameter.getParameterType().getName())) {
-// actualParameter.getType().changeType(StringParameterType.type);
-// } else if ("Double".equals(parameter.getParameterType().getName())) {
-// actualParameter.getType().changeType(DoubleParameterType.type);
-// } else if ("Integer".equals(parameter.getParameterType().getName())) {
-// actualParameter.getType().changeType(IntegerParameterType.type);
-// } else if ("Float".equals(parameter.getParameterType().getName())) {
-// actualParameter.getType().changeType(FloatParameterType.type);
-// } else if ("Boolean".equals(parameter.getParameterType().getName())) {
-// actualParameter.getType().changeType(BooleanParameterType.type);
-// } else if ("File".equals(parameter.getParameterType().getName())) {
-// actualParameter.getType().changeType(FileParameterType.type);
-// } else if ("URI".equals(parameter.getParameterType().getName())) {
-// actualParameter.getType().changeType(URIParameterType.type);
-// } else if ("StringArray".equals(parameter.getParameterType().getName())) {
-// actualParameter.getType().changeType(StringArrayType.type);
-// } else if ("DoubleArray".equals(parameter.getParameterType().getName())) {
-// actualParameter.getType().changeType(DoubleArrayType.type);
-// } else if ("IntegerArray".equals(parameter.getParameterType().getName())) {
-// actualParameter.getType().changeType(IntegerArrayType.type);
-// } else if ("FloatArray".equals(parameter.getParameterType().getName())) {
-// actualParameter.getType().changeType(FloatArrayType.type);
-// } else if ("BooleanArray".equals(parameter.getParameterType().getName())) {
-// actualParameter.getType().changeType(BooleanArrayType.type);
-// } else if ("FileArray".equals(parameter.getParameterType().getName())) {
-// actualParameter.getType().changeType(FileArrayType.type);
-// } else if ("URIArray".equals(parameter.getParameterType().getName())) {
-// actualParameter.getType().changeType(URIArrayType.type);
-// } else if ("StdOut".equals(parameter.getParameterType().getName())) {
-// actualParameter.getType().changeType(StdOutParameterType.type);
-// } else if ("StdErr".equals(parameter.getParameterType().getName())) {
-// actualParameter.getType().changeType(StdErrParameterType.type);
-// }
-// outContext.addParameter(parameter.getParameterName(), actualParameter);
-// }
-// return outContext;
-// }
-//}
http://git-wip-us.apache.org/repos/asf/airavata/blob/382b6c0e/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/invoker/GFacInvoker.java
----------------------------------------------------------------------
diff --git a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/invoker/GFacInvoker.java b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/invoker/GFacInvoker.java
deleted file mode 100644
index 10edbd9..0000000
--- a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/invoker/GFacInvoker.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.invoker;
-
-import java.net.URI;
-import java.util.UUID;
-
-import javax.xml.namespace.QName;
-
-import org.apache.airavata.common.workflow.execution.context.WorkflowContextHeaderBuilder;
-import org.apache.airavata.workflow.model.exceptions.WorkflowException;
-import org.apache.airavata.xbaya.invoker.factory.InvokerFactory;
-import org.apache.airavata.xbaya.lead.NotificationHandler;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import xsul.lead.LeadContextHeader;
-import xsul.wsdl.WsdlDefinitions;
-import xsul.wsdl.WsdlResolver;
-import xsul.wsif.WSIFMessage;
-import xsul.xhandler_soap_sticky_header.StickySoapHeaderHandler;
-import xsul.xwsif_runtime.WSIFClient;
-
-public class GFacInvoker implements Invoker {
-
- private final static Logger logger = LoggerFactory.getLogger(GFacInvoker.class);
-
- private String gfacURL;
-
- private String messageBoxURL;
-
- private QName portTypeQName;
-
- private Invoker invoker;
-
- private LeadContextHeader leadContext;
-
- private WorkflowContextHeaderBuilder builder;
-
- /**
- * Constructs a GFacInvoker.
- *
- * @param portTypeQName
- * @param gfacURL
- * @param messageBoxURL
- * @param context
- */
- public GFacInvoker(QName portTypeQName, String gfacURL, String messageBoxURL, LeadContextHeader context) {
- this.portTypeQName = portTypeQName;
- this.gfacURL = gfacURL;
- this.messageBoxURL = messageBoxURL;
- this.leadContext = context;
- }
-
- public GFacInvoker(QName portTypeQName, String gfacURL, String messageBoxURL, WorkflowContextHeaderBuilder context) {
- this.portTypeQName = portTypeQName;
- this.gfacURL = gfacURL;
- this.messageBoxURL = messageBoxURL;
- this.builder = context;
- }
-
- /**
- * @see org.apache.airavata.xbaya.invoker.Invoker#setup()
- */
- public void setup() throws WorkflowException {
-
- if (this.gfacURL == null) {
- String message = "The location of the Generic Factory is not specified.";
- throw new WorkflowException(message);
- }
-
- if (this.portTypeQName == null) {
- String message = "Error in finding the service name";
- throw new WorkflowException(message);
- }
-
- try {
-
- URI uri = new URI(this.gfacURL);
-
- /*
- * Substring to remove GfacService
- */
- String gfacPath = uri.getPath();
- if (gfacPath != null && gfacPath.contains("/")) {
- gfacPath = gfacPath.substring(0, gfacPath.lastIndexOf('/') + 1) + portTypeQName.getLocalPart();
- }
- URI getWsdlURI = new URI(uri.getScheme(), uri.getUserInfo(), uri.getHost(), uri.getPort(), gfacPath
- + "/getWSDL", uri.getQuery(), uri.getFragment());
-
- logger.debug("getWSDL service:" + getWsdlURI.toString());
-
- WsdlDefinitions concreteWSDL = WsdlResolver.getInstance().loadWsdl(getWsdlURI);
-
- this.invoker = InvokerFactory.createInvoker(this.portTypeQName, concreteWSDL, null, this.messageBoxURL,
- null, true);
- this.invoker.setup();
- } catch (WorkflowException xe) {
- throw xe;
- } catch (Exception e) {
- throw new WorkflowException(e.getMessage(), e);
- }
-
- }
-
- /**
- * @see org.apache.airavata.xbaya.invoker.Invoker#getClient()
- */
- public WSIFClient getClient() {
- return this.invoker.getClient();
- }
-
- /**
- * @throws WorkflowException
- * @see org.apache.airavata.xbaya.invoker.Invoker#setOperation(java.lang.String)
- */
- public void setOperation(String operationName) throws WorkflowException {
- this.invoker.setOperation(operationName);
- }
-
- /**
- * @throws WorkflowException
- * @see org.apache.airavata.xbaya.invoker.Invoker#setInput(java.lang.String, java.lang.Object)
- */
- public void setInput(String name, Object value) throws WorkflowException {
- this.invoker.setInput(name, value);
- }
-
- /**
- * @see org.apache.airavata.xbaya.invoker.Invoker#getInputs()
- */
- public WSIFMessage getInputs() throws WorkflowException {
- return this.invoker.getInputs();
- }
-
- /**
- * @throws WorkflowException
- * @see org.apache.airavata.xbaya.invoker.Invoker#invoke()
- */
- public boolean invoke() throws WorkflowException {
-
- WSIFClient client = invoker.getClient();
- // FIXME: Temporary fix
- // if (this.leadContext == null) {
- // LeadContextHeader lh = new LeadContextHeader(UUID.randomUUID().toString(), "XBaya-User");
- // this.leadContext = lh;
- // }
- // StickySoapHeaderHandler handler = new StickySoapHeaderHandler("use-lead-header", this.leadContext);
- // client.addHandler(handler);
-
- // This handler has to be end to get the entire soap message.
- NotificationHandler notificationHandler = new NotificationHandler(this.builder);
- client.addHandler(notificationHandler);
- return this.invoker.invoke();
- }
-
- /**
- * @see org.apache.airavata.xbaya.invoker.Invoker#getOutputs()
- */
- public WSIFMessage getOutputs() throws WorkflowException {
- return this.invoker.getOutputs();
- }
-
- /**
- * @throws WorkflowException
- * @see org.apache.airavata.xbaya.invoker.Invoker#getOutput(java.lang.String)
- */
- public Object getOutput(String name) throws WorkflowException {
- return this.invoker.getOutput(name);
- }
-
- /**
- * @throws WorkflowException
- * @see org.apache.airavata.xbaya.invoker.Invoker#getFault()
- */
- public WSIFMessage getFault() throws WorkflowException {
- return this.invoker.getFault();
- }
-
-}
\ No newline at end of file