You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airavata.apache.org by sa...@apache.org on 2014/04/14 20:31:16 UTC
[74/90] [abbrv] AIRAVATA-1124
http://git-wip-us.apache.org/repos/asf/airavata/blob/9c47eec8/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
new file mode 100644
index 0000000..17e6620
--- /dev/null
+++ b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/jython/script/JythonScript.java
@@ -0,0 +1,671 @@
+/*
+ *
+ * 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.jython.script;
+
+import java.io.PrintWriter;
+import java.io.StringWriter;
+import java.net.URI;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.LinkedList;
+import java.util.List;
+
+import javax.xml.namespace.QName;
+
+import org.apache.airavata.common.utils.StringUtil;
+import org.apache.airavata.workflow.model.component.ws.WSComponent;
+import org.apache.airavata.workflow.model.graph.Graph;
+import org.apache.airavata.workflow.model.graph.GraphException;
+import org.apache.airavata.workflow.model.graph.Node;
+import org.apache.airavata.workflow.model.graph.Port;
+import org.apache.airavata.workflow.model.graph.system.ConstantNode;
+import org.apache.airavata.workflow.model.graph.system.EndifNode;
+import org.apache.airavata.workflow.model.graph.system.IfNode;
+import org.apache.airavata.workflow.model.graph.system.InputNode;
+import org.apache.airavata.workflow.model.graph.system.MemoNode;
+import org.apache.airavata.workflow.model.graph.system.OutputNode;
+import org.apache.airavata.workflow.model.graph.util.GraphUtil;
+import org.apache.airavata.workflow.model.graph.ws.WSNode;
+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;
+import org.apache.airavata.xbaya.jython.lib.NotificationSender;
+
+public class JythonScript {
+
+ /**
+ * GFAC_VARIABLE
+ */
+ public static final String GFAC_VARIABLE = "gfacURL";
+
+ /**
+ * BROKER_LOC_VARIABLE
+ */
+ public static final String BROKER_URL_VARIABLE = "brokerURL";
+
+ /**
+ * MESSAGE_BOX_URL_VARIABLE
+ */
+ public static final String MESSAGE_BOX_URL_VARIABLE = "msgBoxURL";
+
+ /**
+ * TOPIC_VARIABLE
+ */
+ 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";
+
+ private static final String WORKFLOW_COMPLETED_METHOD = "workflowFinished";
+
+ private static final String WORKFLOW_INCOMPLETED_METHOD = "workflowFailed";
+
+ private static final String SETUP_METHOD = "setup";
+
+ private static final String SET_OPERATION_METHOD = "setOperation";
+
+ private static final String SET_INPUT_METHOD = "setInput";
+
+ private static final String GET_OUTPUT_METHOD = "getOutput";
+
+ private static final String WAIT_METHOD = "waitToFinish";
+
+ private static final String INVOKE_METHOD = "invoke";
+
+ private static final String GET_PROPERTY_METHOD = "getProperty";
+
+ private static final String NOTIFICATION_VARIABLE = "notifier";
+
+ private static final String PROPERTIES_VARIABLE = "properties";
+
+ private static final String INVOKER_SUFFIX = "_invoker";
+
+ private static final String QNAME_SUFFIX = "_qname";
+
+ private static final String VALUE_SUFFIX = "_value";
+
+ private static final String TAB = " ";
+
+ /**
+ * Suffix to put after node ID to create WSDL ID.
+ */
+ private static final String WSDL_SUFFIX = "_wsdl";
+
+ private XBayaConfiguration configuration;
+
+ private Workflow workflow;
+
+ private Graph graph;
+
+ /**
+ * Collection of nodes that are not invoked yet
+ */
+ private Collection<Node> notYetInvokedNodes;
+
+ /**
+ * Collection of nodes that are executing now, and not finished yet.
+ */
+ private Collection<Node> executingNodes;
+
+ private Collection<InputNode> inputNodes;
+
+ private Collection<OutputNode> outputNodes;
+
+ /**
+ * List of command-line arguments
+ */
+ private List<String> arguments;
+
+ private String scriptString;
+
+ /**
+ * Constructs a JythonScript.
+ *
+ * @param workflow
+ * @param configuration
+ */
+ public JythonScript(Workflow workflow, XBayaConfiguration configuration) {
+ this.workflow = workflow;
+ this.configuration = configuration;
+ this.graph = this.workflow.getGraph();
+
+ this.arguments = new ArrayList<String>();
+
+ this.notYetInvokedNodes = new LinkedList<Node>();
+ for (Node node : this.graph.getNodes()) {
+ if (!(node instanceof MemoNode)) {
+ this.notYetInvokedNodes.add(node);
+ }
+ }
+ this.executingNodes = new LinkedList<Node>();
+ this.inputNodes = GraphUtil.getInputNodes(this.graph);
+ this.outputNodes = GraphUtil.getOutputNodes(this.graph);
+ }
+
+ /**
+ * Returns the WSDL ID.
+ *
+ * @param node
+ *
+ * @return the WSDL ID
+ */
+ public static String getWSDLID(Node node) {
+ return node.getID() + WSDL_SUFFIX;
+ }
+
+ /**
+ * @return The Jython script string
+ */
+ public String getJythonString() {
+ return this.scriptString;
+ }
+
+ /**
+ *
+ * @param parameters
+ * @return the jython script with prefilled argument
+ */
+ public String getJythonString(List<String> parameters) {
+ int index = this.scriptString.indexOf("# Process command-line arguments.");
+ StringBuilder builder = new StringBuilder(this.scriptString.substring(0, index));
+ builder.append("sys.argv = [");
+ for (String string : parameters) {
+ builder.append("'");
+ builder.append(string);
+ builder.append("',");
+ }
+ builder.deleteCharAt(builder.length() - 1);
+ builder.append("]");
+ builder.append("\n");
+ builder.append(this.scriptString.substring(index));
+ return builder.toString();
+ }
+
+ /**
+ * @param warnings
+ * returns the warning messages.
+ * @return true if the workflow is valid; false otherwise.
+ */
+ public boolean validate(List<String> warnings) {
+ // Empty
+ if (this.graph.getNodes().size() == 0) {
+ String message = "The workflow is empty.";
+ warnings.add(message);
+ }
+
+ // Input ports need to be connected.
+ Collection<Port> inputPorts = GraphUtil.getPorts(this.graph, Port.Kind.DATA_IN);
+ for (Port inputPort : inputPorts) {
+ Collection<Port> fromPorts = inputPort.getFromPorts();
+ if (fromPorts.size() == 0) {
+ Node node = inputPort.getNode();
+ String message = node.getID() + " has an unconnected input " + inputPort.getName();
+ warnings.add(message);
+ }
+ }
+
+ // Input nodes need to be connected.
+ for (InputNode inputNode : this.inputNodes) {
+ if (inputNode.getPort().getToPorts().size() == 0) {
+ String message = inputNode.getID() + " is not connected to any service.";
+ warnings.add(message);
+ }
+ }
+
+ // Cycle
+ if (GraphUtil.containsCycle(this.graph)) {
+ String message = "There is a cycle in the workflow, only acyclic workflows are supported";
+ warnings.add(message);
+ }
+
+ // Constants are not supported.
+ List<ConstantNode> constantNodes = GraphUtil.getNodes(this.graph, ConstantNode.class);
+ if (constantNodes.size() > 0) {
+ String message = "Constants are not supported for Jython scripts.";
+ warnings.add(message);
+ }
+
+ // If/endif are not supported.
+ List<IfNode> ifNodes = GraphUtil.getNodes(this.graph, IfNode.class);
+ List<EndifNode> endifNodes = GraphUtil.getNodes(this.graph, EndifNode.class);
+ if (ifNodes.size() > 0 || endifNodes.size() > 0) {
+ String message = "If/endif are not supported for Jython scripts.";
+ warnings.add(message);
+ }
+
+ if (warnings.size() > 0) {
+ return false;
+ } else {
+ // No error.
+ return true;
+ }
+ }
+
+ /**
+ * @throws GraphExceptionconcreteWSDL
+ */
+ public void create() throws GraphException {
+ StringWriter stringWriter = new StringWriter();
+ PrintWriter printWriter = new PrintWriter(stringWriter);
+
+ writeHeader(printWriter);
+ writeParameters(printWriter);
+ writeWSDLLocations(printWriter);
+ writeCommandLineArguments(printWriter);
+ writeSetup(printWriter);
+ writeInvocations(printWriter);
+ writeOutputs(printWriter);
+ writeWaitAll(printWriter);
+ writeFooter(printWriter);
+
+ printWriter.close();
+ this.scriptString = stringWriter.toString();
+ }
+
+ /**
+ * @param pw
+ */
+ private void writeCommandLineArguments(PrintWriter pw) {
+ pw.println("def usage():");
+ pw.println(TAB + "print '''");
+ pw.println("Options: -help");
+ pw.println(TAB + TAB + " -f properties_file");
+ for (String argument : this.arguments) {
+ pw.println(TAB + TAB + " -" + argument + " value");
+ }
+ pw.println("'''");
+ pw.println(TAB + "sys.exit(0)");
+ pw.println();
+
+ pw.println("# Process command-line arguments.");
+ pw.println("if sys.argv[0][0] != '-':");
+ pw.println(TAB + "sys.argv = sys.argv[1:]");
+ pw.println("while sys.argv:");
+ pw.println(TAB + "if sys.argv[0] == '-f':");
+ pw.println(TAB + TAB + "# Read parameters from a file.");
+ pw.println(TAB + TAB + "propertyFilename = sys.argv[1]");
+ pw.println(TAB + TAB + "inputStream = FileInputStream(propertyFilename)");
+ pw.println(TAB + TAB + PROPERTIES_VARIABLE + ".load(inputStream)");
+
+ for (String argument : this.arguments) {
+ pw.println(TAB + "elif sys.argv[0] == '-" + argument + "':");
+ pw.println(TAB + TAB + PROPERTIES_VARIABLE + ".put('" + argument + "', sys.argv[1])");
+ }
+
+ pw.println(TAB + "else:");
+ pw.println(TAB + TAB + "usage()");
+ pw.println(TAB + "sys.argv = sys.argv[2:]");
+ pw.println();
+ }
+
+ /**
+ * Writes import statements
+ *
+ * @param pw
+ */
+ private void writeHeader(PrintWriter pw) {
+ pw.println("#");
+ pw.println("# This script is automatically generated by " + XBayaConstants.APPLICATION_NAME + " "
+ + XBayaVersion.VERSION + ".");
+ pw.println("#");
+ pw.println();
+ pw.println("import sys, thread");
+ pw.println("from java.lang import Throwable");
+ 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();
+ }
+
+ /**
+ * Handles parameters
+ *
+ * @param pw
+ */
+ private void writeParameters(PrintWriter pw) {
+ pw.println(PROPERTIES_VARIABLE + " = Properties()");
+ pw.println();
+ pw.println("# Set up defaut parameter values.");
+
+ writeSetProperty(BROKER_URL_VARIABLE, XBayaConstants.DEFAULT_BROKER_URL, pw);
+ writeSetProperty(MESSAGE_BOX_URL_VARIABLE, this.configuration.getMessageBoxURL(), pw);
+ writeSetProperty(TOPIC_VARIABLE, XBayaConstants.DEFAULT_TOPIC, pw);
+ writeSetProperty(GFAC_VARIABLE, this.configuration.getGFacURL(), pw);
+
+ for (InputNode paramNode : this.inputNodes) {
+ writeParameter(paramNode, pw);
+ this.notYetInvokedNodes.remove(paramNode);
+ }
+
+ pw.println();
+ }
+
+ /**
+ * @param inputNode
+ * @param pw
+ */
+ private void writeParameter(InputNode inputNode, PrintWriter pw) {
+ String id = inputNode.getID();
+ Object value = inputNode.getDefaultValue();
+ String valueString = "";
+ if (value instanceof String) {
+ valueString = (String) value;
+ }
+ writeSetProperty(id, valueString, pw);
+ }
+
+ /**
+ * @param pw
+ */
+ private void writeWSDLLocations(PrintWriter pw) {
+ pw.println("# Set up default WSDL URLs.");
+ for (WSNode node : GraphUtil.getWSNodes(this.graph)) {
+ writeWSDLLocation(node, pw);
+ }
+ pw.println();
+
+ }
+
+ /**
+ * @param node
+ * @param pw
+ */
+ private void writeWSDLLocation(WSNode node, PrintWriter pw) {
+ String defaultWsdlLocation = ""; // TODO
+ writeSetProperty(getWSDLID(node), defaultWsdlLocation, pw);
+ }
+
+ private void writeSetProperty(String name, URI uri, PrintWriter pw) {
+ writeSetProperty(name, StringUtil.toString(uri), pw);
+ }
+
+ private void writeSetProperty(String name, String value, PrintWriter pw) {
+ if (value == null) {
+ value = "";
+ }
+ pw.println(PROPERTIES_VARIABLE + ".setProperty(");
+ pw.println(TAB + TAB + "'" + name + "',");
+ pw.println(TAB + TAB + "'" + value + "')");
+
+ // This will be used to read from command-line
+ this.arguments.add(name);
+ }
+
+ /**
+ * @param pw
+ */
+ private void writeSetup(PrintWriter pw) {
+ // Initialize some variables.
+ pw.println(GFAC_VARIABLE + " = " + PROPERTIES_VARIABLE + "." + GET_PROPERTY_METHOD + "('" + GFAC_VARIABLE
+ + "')");
+ pw.println(TOPIC_VARIABLE + " = " + PROPERTIES_VARIABLE + "." + GET_PROPERTY_METHOD + "('" + TOPIC_VARIABLE
+ + "')");
+ pw.println(BROKER_URL_VARIABLE + " = " + PROPERTIES_VARIABLE + "." + GET_PROPERTY_METHOD + "('"
+ + BROKER_URL_VARIABLE + "')");
+ pw.println(MESSAGE_BOX_URL_VARIABLE + " = " + PROPERTIES_VARIABLE + "." + GET_PROPERTY_METHOD + "('"
+ + MESSAGE_BOX_URL_VARIABLE + "')");
+
+ // Initialize a notification sender.
+ pw.println(NOTIFICATION_VARIABLE + " = " + NOTIFICATION_CLASS + "(" + BROKER_URL_VARIABLE + ", "
+ + TOPIC_VARIABLE + ")");
+
+ // Send a START_WORKFLOW notification.
+ pw.println(NOTIFICATION_VARIABLE + "." + WORKFLOW_STARTED_METHOD + "(");
+ boolean first = true;
+ for (InputNode inputNode : this.inputNodes) {
+ String id = inputNode.getID();
+ if (first) {
+ first = false;
+ } else {
+ pw.println(",");
+ }
+ pw.print(TAB + id + "=" + PROPERTIES_VARIABLE + "." + GET_PROPERTY_METHOD + "('" + id + "')");
+ }
+ pw.println(")");
+
+ pw.println();
+
+ // The biggining of try
+ pw.println("try:");
+ }
+
+ /**
+ * @param pw
+ * @throws GraphException
+ */
+ private void writeInvocations(PrintWriter pw) throws GraphException {
+ Collection<Node> nextNodes = getNextNodes();
+ while (nextNodes.size() > 0) {
+ // If there are more than one nodes to invoke, they can run
+ // concurrently using threads.
+ boolean thread = (nextNodes.size() > 1);
+ for (Node node : nextNodes) {
+ if (node instanceof WSNode) {
+ WSNode wsNode = (WSNode) node;
+ writeInvocation(wsNode, thread, pw);
+
+ } else {
+ // TODO conditions, loops might come here.
+ }
+ this.notYetInvokedNodes.remove(node);
+ }
+
+ nextNodes = getNextNodes();
+ }
+ }
+
+ /**
+ * @param node
+ * @param thread
+ * @param pw
+ */
+ private void writeInvocation(WSNode node, boolean thread, PrintWriter pw) {
+ String id = node.getID();
+ String wsdlID = getWSDLID(node);
+
+ WSComponent component = node.getComponent();
+ QName portTypeQName = component.getPortTypeQName();
+ String operation = component.getOperationName();
+
+ pw.println(TAB + "# Invoke " + id + ".");
+ 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 + ", '"
+ + id + "',");
+ pw.println(TAB + TAB + MESSAGE_BOX_URL_VARIABLE + ", " + GFAC_VARIABLE + ", " + NOTIFICATION_VARIABLE + ")");
+
+ pw.println(TAB + "def " + INVOKE_METHOD + id + "():");
+ pw.println(TAB + TAB + id + INVOKER_SUFFIX + "." + SETUP_METHOD + "()");
+ pw.println(TAB + TAB + id + INVOKER_SUFFIX + "." + SET_OPERATION_METHOD + "('" + operation + "')");
+
+ // Ports
+ for (Port port : node.getInputPorts()) {
+ String portName = port.getName();
+ String value;
+ Node fromNode = port.getFromNode();
+ if (fromNode instanceof InputNode) {
+ value = PROPERTIES_VARIABLE + "." + GET_PROPERTY_METHOD + "('" + fromNode.getID() + "')";
+ } else {
+ Port fromPort = port.getFromPort();
+ value = "" + fromNode.getID() + INVOKER_SUFFIX + "." + GET_OUTPUT_METHOD + "('" + fromPort.getName()
+ + "')";
+
+ // This might try to remove a node that has been removed
+ // already, but it's OK.
+ this.executingNodes.remove(fromNode);
+ }
+ pw.println(TAB + TAB + portName + VALUE_SUFFIX + " = " + value);
+ pw.println(TAB + TAB + id + INVOKER_SUFFIX + "." + SET_INPUT_METHOD + "('" + portName + "', " + portName
+ + VALUE_SUFFIX + ")");
+ }
+
+ pw.println(TAB + TAB + "print 'Invoking " + id + ".'");
+ pw.println(TAB + TAB + id + INVOKER_SUFFIX + "." + INVOKE_METHOD + "()");
+
+ if (thread) {
+ pw.println(TAB + "thread.start_new_thread(" + INVOKE_METHOD + id + ", ())");
+ } else {
+ pw.println(TAB + INVOKE_METHOD + id + "()");
+ }
+
+ pw.println();
+
+ this.executingNodes.add(node);
+ }
+
+ private void writeOutputs(PrintWriter pw) throws GraphException {
+ for (OutputNode outputNode : this.outputNodes) {
+ writeOutput(outputNode, pw);
+ }
+ }
+
+ private void writeOutput(OutputNode node, PrintWriter pw) throws GraphException {
+ String id = node.getID();
+ Port port = node.getPort();
+
+ Node fromNode = port.getFromNode();
+ if (fromNode == null) {
+ throw new GraphException("Output parameter has to be connected to some node.");
+ }
+ Port fromPort = port.getFromPort();
+ if (fromNode instanceof InputNode) {
+ // The OutputNode is directly connected to an InputNode.
+ pw.println(TAB + id + VALUE_SUFFIX + " = " + PROPERTIES_VARIABLE + "." + GET_PROPERTY_METHOD + "('"
+ + fromNode.getID() + "')");
+ } else {
+ pw.println(TAB + "# Wait output " + id);
+ pw.println(TAB + id + VALUE_SUFFIX + " = " + fromNode.getID() + INVOKER_SUFFIX + "." + GET_OUTPUT_METHOD
+ + "('" + fromPort.getName() + "')");
+ }
+ pw.println(TAB + "print '" + id + " = ', " + id + VALUE_SUFFIX);
+
+ // This might try to remove a node that has been removed
+ // already, but it's OK.
+ this.executingNodes.remove(fromNode);
+
+ pw.println();
+ }
+
+ /**
+ * @param pw
+ */
+ private void writeWaitAll(PrintWriter pw) {
+ pw.println(TAB + "# Wait all executing services.");
+ for (Node node : this.executingNodes) {
+ writeWait(node, pw);
+ }
+ pw.println();
+ }
+
+ /**
+ * @param node
+ * @param pw
+ */
+ private void writeWait(Node node, PrintWriter pw) {
+ String id = node.getID();
+ pw.println(TAB + "print 'Waiting " + id + " to be done.'");
+ pw.println(TAB + id + INVOKER_SUFFIX + "." + WAIT_METHOD + "()");
+ }
+
+ /**
+ * @param pw
+ */
+ private void writeFooter(PrintWriter pw) {
+ // Send a COMPLETE_WORKFLOW notification.
+ pw.println(TAB + NOTIFICATION_VARIABLE + "." + WORKFLOW_COMPLETED_METHOD + "(");
+ boolean first = true;
+ for (OutputNode node : this.outputNodes) {
+ if (first) {
+ first = false;
+ } else {
+ pw.println(",");
+ }
+ String id = node.getID();
+ pw.print(TAB + TAB + id + "=" + id + VALUE_SUFFIX);
+ }
+ pw.println(")");
+
+ pw.println(TAB + "print 'Everything is done successfully.'");
+
+ pw.println();
+ pw.println("except Throwable, e:");
+ pw.println(TAB + "print 'Error: ', e");
+ pw.println(TAB + NOTIFICATION_VARIABLE + "." + WORKFLOW_INCOMPLETED_METHOD + "(e)");
+ }
+
+ private Collection<Node> getNextNodes() throws GraphException {
+ Collection<Node> nextNodes = new ArrayList<Node>();
+ for (Node node : this.notYetInvokedNodes) {
+ if (isNextNode(node)) {
+ nextNodes.add(node);
+ }
+ }
+ return nextNodes;
+ }
+
+ /**
+ * Checks is a specified node can be executed next. A node can be executed if all the previous node are done or
+ * there is no input ports.
+ *
+ * @param node
+ * the specified node
+ * @return true if the specified node can be executed next; false otherwise
+ * @throws GraphException
+ */
+ private boolean isNextNode(Node node) throws GraphException {
+ if (node instanceof OutputNode) {
+ return false;
+ }
+ for (Port port : node.getInputPorts()) {
+ Collection<Node> fromNodes = port.getFromNodes();
+ if (fromNodes.isEmpty()) {
+ throw new GraphException("There is a port that is not connected to any.");
+ } else {
+ for (Node fromNode : fromNodes) {
+ if (this.notYetInvokedNodes.contains(fromNode)) {
+ // There is a node that should be executed before this
+ // node.
+ return false;
+ }
+ }
+ }
+ }
+ Port port = node.getControlInPort();
+ if (port != null) {
+ Collection<Node> fromNodes = port.getFromNodes();
+ for (Node fromNode : fromNodes) {
+ if (this.notYetInvokedNodes.contains(fromNode)) {
+ return false;
+ }
+ }
+ }
+ return true;
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/airavata/blob/9c47eec8/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
new file mode 100644
index 0000000..dc0b8bc
--- /dev/null
+++ b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/lead/LEADTypes.java
@@ -0,0 +1,225 @@
+/*
+ *
+ * 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/9c47eec8/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
new file mode 100644
index 0000000..c8db9fd
--- /dev/null
+++ b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/lead/LeadContextHeaderHelper.java
@@ -0,0 +1,155 @@
+/*
+ *
+ * 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 java.net.URI;
+
+import org.apache.airavata.common.utils.WSDLUtil;
+import org.apache.airavata.workflow.model.wf.Workflow;
+import org.apache.airavata.ws.monitor.MonitorConfiguration;
+import org.apache.airavata.wsmg.client.WseMsgBrokerClient;
+import org.apache.airavata.xbaya.XBayaConfiguration;
+import org.apache.airavata.xbaya.XBayaConstants;
+
+import org.apache.axis2.addressing.EndpointReference;
+import xsul.lead.LeadContextHeader;
+import xsul.ws_addressing.WsaEndpointReference;
+
+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) {
+ setGFacURL(xbayaConfiguration.getGFacURL());
+
+ // 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/9c47eec8/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
new file mode 100644
index 0000000..982cdf3
--- /dev/null
+++ b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/lead/NotificationHandler.java
@@ -0,0 +1,190 @@
+/*
+ *
+ * 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 java.net.URI;
+import java.net.URISyntaxException;
+import java.util.Properties;
+
+import org.apache.airavata.common.utils.XMLUtil;
+import org.apache.airavata.common.workflow.execution.context.WorkflowContextHeaderBuilder;
+import org.apache.airavata.workflow.tracking.NotifierFactory;
+import org.apache.airavata.workflow.tracking.WorkflowNotifier;
+import org.apache.airavata.workflow.tracking.common.InvocationContext;
+import org.apache.airavata.workflow.tracking.common.InvocationEntity;
+import org.apache.airavata.workflow.tracking.common.WorkflowTrackingContext;
+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;
+
+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
http://git-wip-us.apache.org/repos/asf/airavata/blob/9c47eec8/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/menues/tools/ToolsMenuItem.java
----------------------------------------------------------------------
diff --git a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/menues/tools/ToolsMenuItem.java b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/menues/tools/ToolsMenuItem.java
new file mode 100644
index 0000000..972088d
--- /dev/null
+++ b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/menues/tools/ToolsMenuItem.java
@@ -0,0 +1,100 @@
+/*
+ *
+ * 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.menues.tools;
+
+import org.apache.airavata.xbaya.XBayaEngine;
+//import org.apache.airavata.xbaya.ui.dialogs.GlobusFileTransferWindow;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import javax.swing.*;
+import java.awt.event.ActionEvent;
+import java.awt.event.KeyEvent;
+
+public class ToolsMenuItem {
+
+ private XBayaEngine engine;
+
+ private JMenu toolsMenu;
+
+ private static final Logger logger = LoggerFactory.getLogger(ToolsMenuItem.class);
+
+ /**
+ * Constructs a WorkflowMenu.
+ *
+ * @param engine
+ */
+ public ToolsMenuItem(XBayaEngine engine) {
+ this.engine = engine;
+ createWorkflowMenu();
+ }
+
+ /**
+ * @return The workflow menu.
+ */
+ public JMenu getMenu() {
+ return this.toolsMenu;
+ }
+
+ /**
+ * Creates workflow menu.
+ */
+ private void createWorkflowMenu() {
+// JMenuItem globusFileTransferItem = createGlobusFileTransferItem();
+// toolsMenu = new JMenu("Tools");
+// toolsMenu.setMnemonic(KeyEvent.VK_T);
+// toolsMenu.add(globusFileTransferItem);
+
+ }
+
+// private JMenuItem createGlobusFileTransferItem() {
+// JMenuItem item = new JMenuItem("Globus File Transfer...");
+// item.setMnemonic(KeyEvent.VK_J);
+// item.addActionListener(new AbstractAction() {
+// private GlobusFileTransferWindow window;
+//
+// public void actionPerformed(ActionEvent e) {
+// if (this.window == null) {
+// this.window = new GlobusFileTransferWindow(engine);
+// }
+// this.window.show();
+// }
+// });
+// return item;
+// }
+
+// private JMenuItem createAmberRunItem() {
+// JMenuItem item = new JMenuItem("Amber Run...");
+// item.setMnemonic(KeyEvent.VK_J);
+// item.addActionListener(new AbstractAction() {
+// private AmberRunWindow window;
+//
+// public void actionPerformed(ActionEvent e) {
+// if (this.window == null) {
+// this.window = new AmberRunWindow(engine);
+// }
+// this.window.show();
+// }
+// });
+// return item;
+// }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/airavata/blob/9c47eec8/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/model/registrybrowser/AiravataConfigurations.java
----------------------------------------------------------------------
diff --git a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/model/registrybrowser/AiravataConfigurations.java b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/model/registrybrowser/AiravataConfigurations.java
new file mode 100644
index 0000000..6702f1c
--- /dev/null
+++ b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/model/registrybrowser/AiravataConfigurations.java
@@ -0,0 +1,54 @@
+/*
+ *
+ * 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.model.registrybrowser;
+
+import org.apache.airavata.client.api.AiravataAPI;
+import org.apache.airavata.registry.api.AiravataRegistry2;
+
+public class AiravataConfigurations {
+// private AiravataRegistry2 registry;
+ private AiravataAPI airavataAPI;
+
+// public AiravataConfigurations(AiravataRegistry2 registry) {
+// setRegistry(registry);
+// }
+ public AiravataConfigurations(AiravataAPI airavataAPI) {
+ setAiravataAPI(airavataAPI);
+ }
+
+// public AiravataRegistry2 getRegistry() {
+// return registry;
+// }
+//
+// public void setRegistry(AiravataRegistry2 registry) {
+// this.registry = registry;
+// }
+
+
+ public AiravataAPI getAiravataAPI() {
+ return airavataAPI;
+ }
+
+ public void setAiravataAPI(AiravataAPI airavataAPI) {
+ this.airavataAPI = airavataAPI;
+ }
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/9c47eec8/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/model/registrybrowser/ApplicationDeploymentDescriptionWrap.java
----------------------------------------------------------------------
diff --git a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/model/registrybrowser/ApplicationDeploymentDescriptionWrap.java b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/model/registrybrowser/ApplicationDeploymentDescriptionWrap.java
new file mode 100644
index 0000000..3c66c43
--- /dev/null
+++ b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/model/registrybrowser/ApplicationDeploymentDescriptionWrap.java
@@ -0,0 +1,98 @@
+/*
+ *
+ * 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.model.registrybrowser;
+
+import org.apache.airavata.client.api.AiravataAPI;
+import org.apache.airavata.client.api.exception.AiravataAPIInvocationException;
+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.registry.api.AiravataRegistry2;
+
+public class ApplicationDeploymentDescriptionWrap {
+ private ApplicationDescription applicationDescription;
+ private String service;
+ private String host;
+// private AiravataRegistry2 registry;
+ private AiravataAPI airavataAPI;
+
+ public ApplicationDeploymentDescriptionWrap(AiravataAPI airavataAPI,
+ ApplicationDescription applicationDescription, String service, String host) {
+ setApplicationDescription(applicationDescription);
+ setService(service);
+ setHost(host);
+ setAiravataAPI(airavataAPI);
+ }
+
+ public ApplicationDescription getDescription() {
+ return applicationDescription;
+ }
+
+ public void setApplicationDescription(ApplicationDescription applicationDescription) {
+ this.applicationDescription = applicationDescription;
+ }
+
+ public String getService() {
+ return service;
+ }
+
+ public ServiceDescription getServiceDescription() throws AiravataAPIInvocationException {
+ ServiceDescription desc = getAiravataAPI().getApplicationManager().getServiceDescription(getService());
+ if(desc!=null){
+ return desc;
+ }
+ throw new AiravataAPIInvocationException(new Exception("Service Description not found in registry."));
+ }
+
+ public void setService(String service) {
+ this.service = service;
+ }
+
+ public String getHost() {
+ return host;
+ }
+
+ public HostDescription getHostDescription() throws AiravataAPIInvocationException {
+ return getAiravataAPI().getApplicationManager().getHostDescription(getHost());
+ }
+
+ public void setHost(String host) {
+ this.host = host;
+ }
+
+// public AiravataRegistry2 getRegistry() {
+// return registry;
+// }
+//
+// public void setRegistry(AiravataRegistry2 registry) {
+// this.registry = registry;
+// }
+
+
+ public AiravataAPI getAiravataAPI() {
+ return airavataAPI;
+ }
+
+ public void setAiravataAPI(AiravataAPI airavataAPI) {
+ this.airavataAPI = airavataAPI;
+ }
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/9c47eec8/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/model/registrybrowser/ApplicationDeploymentDescriptions.java
----------------------------------------------------------------------
diff --git a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/model/registrybrowser/ApplicationDeploymentDescriptions.java b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/model/registrybrowser/ApplicationDeploymentDescriptions.java
new file mode 100644
index 0000000..247a7e8
--- /dev/null
+++ b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/model/registrybrowser/ApplicationDeploymentDescriptions.java
@@ -0,0 +1,107 @@
+/*
+ *
+ * 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.model.registrybrowser;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.airavata.client.api.AiravataAPI;
+import org.apache.airavata.client.api.ApplicationManager;
+import org.apache.airavata.client.api.exception.AiravataAPIInvocationException;
+import org.apache.airavata.commons.gfac.type.ApplicationDescription;
+import org.apache.airavata.registry.api.exception.RegistryException;
+import org.apache.airavata.commons.gfac.type.ServiceDescription;
+//import org.apache.airavata.registry.api.AiravataRegistry2;
+
+public class ApplicationDeploymentDescriptions {
+// private AiravataRegistry2 registry;
+ private AiravataAPI airavataAPI;
+ private String serviceName;
+
+// public ApplicationDeploymentDescriptions(AiravataRegistry2 registry, String serviceName) {
+// setRegistry(registry);
+// setServiceName(serviceName);
+// }
+
+
+ public AiravataAPI getAiravataAPI() {
+ return airavataAPI;
+ }
+
+ public void setAiravataAPI(AiravataAPI airavataAPI) {
+ this.airavataAPI = airavataAPI;
+ }
+
+ public ApplicationDeploymentDescriptions(AiravataAPI airavataAPI, String serviceName) {
+ setAiravataAPI(airavataAPI);
+ setServiceName(serviceName);
+ }
+
+// public ApplicationDeploymentDescriptions(AiravataRegistry2 registry) {
+// this(registry,null);
+// }
+
+ public ApplicationDeploymentDescriptions(AiravataAPI airavataAPI) {
+ this(airavataAPI,null);
+ }
+
+// public AiravataRegistry2 getRegistry() {
+// return registry;
+// }
+//
+// public void setRegistry(AiravataRegistry2 registry) {
+// this.registry = registry;
+// }
+
+ public List<ApplicationDeploymentDescriptionWrap> getDescriptions() throws RegistryException, AiravataAPIInvocationException {
+ List<ApplicationDeploymentDescriptionWrap> list = new ArrayList<ApplicationDeploymentDescriptionWrap>();
+ if (getServiceName()==null) {
+ ApplicationManager applicationManager = getAiravataAPI().getApplicationManager();
+ List<ServiceDescription> serviceDescriptors = applicationManager.getAllServiceDescriptions();
+ for (ServiceDescription serviceDescription : serviceDescriptors) {
+ String serviceName = serviceDescription.getType().getName();
+ Map<String,ApplicationDescription> deploymentDescriptions = applicationManager.getApplicationDescriptors(serviceName);
+ for (String hostName : deploymentDescriptions.keySet()) {
+ ApplicationDescription descriptionWrap=deploymentDescriptions.get(hostName);
+ list.add(new ApplicationDeploymentDescriptionWrap(getAiravataAPI(), descriptionWrap, serviceName,hostName));
+ }
+ }
+
+ }else{
+ Map<String,ApplicationDescription> deploymentDescriptions = getAiravataAPI().getApplicationManager().getApplicationDescriptors(serviceName);
+ for (String hostName : deploymentDescriptions.keySet()) {
+ ApplicationDescription descriptionWrap=deploymentDescriptions.get(hostName);
+ list.add(new ApplicationDeploymentDescriptionWrap(getAiravataAPI(), descriptionWrap, getServiceName(),hostName));
+ }
+ }
+ return list;
+ }
+
+ public String getServiceName() {
+ return serviceName;
+ }
+
+ public void setServiceName(String serviceName) {
+ this.serviceName = serviceName;
+ }
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/9c47eec8/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/model/registrybrowser/EventingServiceURL.java
----------------------------------------------------------------------
diff --git a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/model/registrybrowser/EventingServiceURL.java b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/model/registrybrowser/EventingServiceURL.java
new file mode 100644
index 0000000..480848b
--- /dev/null
+++ b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/model/registrybrowser/EventingServiceURL.java
@@ -0,0 +1,54 @@
+/*
+ *
+ * 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.model.registrybrowser;
+
+import org.apache.airavata.client.api.AiravataAPI;
+
+import java.net.URI;
+
+//import org.apache.airavata.registry.api.AiravataRegistry2;
+
+public class EventingServiceURL {
+ private AiravataAPI airavataAPI;
+ private URI eventingServiceURL;
+
+ public EventingServiceURL(AiravataAPI airavataAPI, URI eventingServiceURL) {
+ setAiravataAPI(airavataAPI);
+ setEventingServiceURL(eventingServiceURL);
+ }
+
+ public URI getEventingServiceURL() {
+ return eventingServiceURL;
+ }
+
+ public void setEventingServiceURL(URI eventingServiceURL) {
+ this.eventingServiceURL = eventingServiceURL;
+ }
+
+ public AiravataAPI getAiravataAPI() {
+ return airavataAPI;
+ }
+
+ public void setAiravataAPI(AiravataAPI airavataAPI) {
+ this.airavataAPI = airavataAPI;
+ }
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/9c47eec8/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/model/registrybrowser/EventingServiceURLs.java
----------------------------------------------------------------------
diff --git a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/model/registrybrowser/EventingServiceURLs.java b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/model/registrybrowser/EventingServiceURLs.java
new file mode 100644
index 0000000..8669821
--- /dev/null
+++ b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/model/registrybrowser/EventingServiceURLs.java
@@ -0,0 +1,54 @@
+/*
+ *
+ * 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.model.registrybrowser;
+
+import org.apache.airavata.client.api.AiravataAPI;
+import org.apache.airavata.client.api.exception.AiravataAPIInvocationException;
+
+import java.net.URI;
+import java.util.ArrayList;
+import java.util.List;
+
+//import org.apache.airavata.registry.api.AiravataRegistry2;
+
+public class EventingServiceURLs {
+ private AiravataAPI airavataAPI;
+
+ public EventingServiceURLs(AiravataAPI airavataAPI) {
+ setAiravataAPI(airavataAPI);
+ }
+
+ public AiravataAPI getAiravataAPI() {
+ return airavataAPI;
+ }
+
+ public void setAiravataAPI(AiravataAPI airavataAPI) {
+ this.airavataAPI = airavataAPI;
+ }
+
+ public List<EventingServiceURL> getURLS() throws AiravataAPIInvocationException {
+ List<EventingServiceURL> urls = new ArrayList<EventingServiceURL>();
+ URI gfacDescriptor = getAiravataAPI().getAiravataManager().getEventingServiceURL();
+ urls.add(new EventingServiceURL(getAiravataAPI(), gfacDescriptor));
+ return urls;
+ }
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/9c47eec8/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/model/registrybrowser/GFacURL.java
----------------------------------------------------------------------
diff --git a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/model/registrybrowser/GFacURL.java b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/model/registrybrowser/GFacURL.java
new file mode 100644
index 0000000..3f45bdd
--- /dev/null
+++ b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/model/registrybrowser/GFacURL.java
@@ -0,0 +1,54 @@
+/*
+ *
+ * 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.model.registrybrowser;
+
+import org.apache.airavata.client.api.AiravataAPI;
+
+import java.net.URI;
+
+//import org.apache.airavata.registry.api.AiravataRegistry2;
+
+public class GFacURL {
+ private AiravataAPI airavataAPI;
+ private URI gfacURL;
+
+ public GFacURL(AiravataAPI airavataAPI, URI url) {
+ setAiravataAPI(airavataAPI);
+ setGfacURL(url);
+ }
+
+ public AiravataAPI getAiravataAPI() {
+ return airavataAPI;
+ }
+
+ public void setAiravataAPI(AiravataAPI airavataAPI) {
+ this.airavataAPI = airavataAPI;
+ }
+
+ public URI getGfacURL() {
+ return gfacURL;
+ }
+
+ public void setGfacURL(URI url) {
+ this.gfacURL = url;
+ }
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/9c47eec8/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/model/registrybrowser/GFacURLs.java
----------------------------------------------------------------------
diff --git a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/model/registrybrowser/GFacURLs.java b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/model/registrybrowser/GFacURLs.java
new file mode 100644
index 0000000..2c2b89c
--- /dev/null
+++ b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/model/registrybrowser/GFacURLs.java
@@ -0,0 +1,56 @@
+/*
+ *
+ * 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.model.registrybrowser;
+
+import org.apache.airavata.client.api.AiravataAPI;
+import org.apache.airavata.client.api.exception.AiravataAPIInvocationException;
+
+import java.net.URI;
+import java.util.ArrayList;
+import java.util.List;
+
+//import org.apache.airavata.registry.api.AiravataRegistry2;
+
+public class GFacURLs {
+ private AiravataAPI airavataAPI;
+
+ public GFacURLs(AiravataAPI airavataAPI) {
+ setAiravataAPI(airavataAPI);
+ }
+
+ public AiravataAPI getAiravataAPI() {
+ return airavataAPI;
+ }
+
+ public void setAiravataAPI(AiravataAPI airavataAPI) {
+ this.airavataAPI = airavataAPI;
+ }
+
+// public List<GFacURL> getURLS() throws AiravataAPIInvocationException {
+// List<GFacURL> urls = new ArrayList<GFacURL>();
+// List<URI> gfacDescriptorList = getAiravataAPI().getAiravataManager().getGFaCURLs();
+// for (URI url : gfacDescriptorList) {
+// urls.add(new GFacURL(getAiravataAPI(), url));
+// }
+// return urls;
+// }
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/9c47eec8/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/model/registrybrowser/HostDescriptions.java
----------------------------------------------------------------------
diff --git a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/model/registrybrowser/HostDescriptions.java b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/model/registrybrowser/HostDescriptions.java
new file mode 100644
index 0000000..aba3fc2
--- /dev/null
+++ b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/model/registrybrowser/HostDescriptions.java
@@ -0,0 +1,50 @@
+/*
+ *
+ * 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.model.registrybrowser;
+
+import java.util.List;
+
+import org.apache.airavata.client.api.AiravataAPI;
+import org.apache.airavata.client.api.exception.AiravataAPIInvocationException;
+import org.apache.airavata.registry.api.exception.RegistryException;
+import org.apache.airavata.commons.gfac.type.HostDescription;
+//import org.apache.airavata.registry.api.AiravataRegistry2;
+
+public class HostDescriptions {
+ private AiravataAPI airavataAPI;
+
+ public HostDescriptions(AiravataAPI airavataAPI) {
+ setAiravataAPI(airavataAPI);
+ }
+
+ public AiravataAPI getAiravataAPI() {
+ return airavataAPI;
+ }
+
+ public void setAiravataAPI(AiravataAPI airavataAPI) {
+ this.airavataAPI = airavataAPI;
+ }
+
+ public List<HostDescription> getDescriptions() throws AiravataAPIInvocationException {
+ return getAiravataAPI().getApplicationManager().getAllHostDescriptions();
+ }
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/9c47eec8/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/model/registrybrowser/InputParameters.java
----------------------------------------------------------------------
diff --git a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/model/registrybrowser/InputParameters.java b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/model/registrybrowser/InputParameters.java
new file mode 100644
index 0000000..41bf8b0
--- /dev/null
+++ b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/model/registrybrowser/InputParameters.java
@@ -0,0 +1,36 @@
+/*
+ *
+ * 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.model.registrybrowser;
+
+import org.apache.airavata.schemas.gfac.Parameter;
+
+public class InputParameters extends ServiceParameters {
+
+ public InputParameters(NodeParameter[] parameters) {
+ super(parameters);
+ }
+
+ public InputParameters(Parameter[] parameters) {
+ super(parameters);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/9c47eec8/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/model/registrybrowser/InterpreterServiceURL.java
----------------------------------------------------------------------
diff --git a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/model/registrybrowser/InterpreterServiceURL.java b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/model/registrybrowser/InterpreterServiceURL.java
new file mode 100644
index 0000000..d648af3
--- /dev/null
+++ b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/model/registrybrowser/InterpreterServiceURL.java
@@ -0,0 +1,54 @@
+/*
+ *
+ * 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.model.registrybrowser;
+
+import org.apache.airavata.client.api.AiravataAPI;
+
+import java.net.URI;
+
+//import org.apache.airavata.registry.api.AiravataRegistry2;
+
+public class InterpreterServiceURL {
+ private AiravataAPI airavataAPI;
+ private URI interpreterServiceURL;
+
+ public InterpreterServiceURL(AiravataAPI airavataAPI, URI interpreterServiceURI) {
+ setAiravataAPI(airavataAPI);
+ setInterpreterServiceURI(interpreterServiceURI);
+ }
+
+ public AiravataAPI getAiravataAPI() {
+ return airavataAPI;
+ }
+
+ public void setAiravataAPI(AiravataAPI airavataAPI) {
+ this.airavataAPI = airavataAPI;
+ }
+
+ public URI getInterpreterServiceURL() {
+ return interpreterServiceURL;
+ }
+
+ public void setInterpreterServiceURI(URI interpreterServiceURI) {
+ this.interpreterServiceURL = interpreterServiceURI;
+ }
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/9c47eec8/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/model/registrybrowser/InterpreterServiceURLs.java
----------------------------------------------------------------------
diff --git a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/model/registrybrowser/InterpreterServiceURLs.java b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/model/registrybrowser/InterpreterServiceURLs.java
new file mode 100644
index 0000000..71ae486
--- /dev/null
+++ b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/model/registrybrowser/InterpreterServiceURLs.java
@@ -0,0 +1,56 @@
+/*
+ *
+ * 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.model.registrybrowser;
+
+import org.apache.airavata.client.api.AiravataAPI;
+import org.apache.airavata.client.api.exception.AiravataAPIInvocationException;
+
+import java.net.URI;
+import java.util.ArrayList;
+import java.util.List;
+
+//import org.apache.airavata.registry.api.AiravataRegistry2;
+
+public class InterpreterServiceURLs {
+ private AiravataAPI airavataAPI;
+
+ public InterpreterServiceURLs(AiravataAPI airavataAPI) {
+ setAiravataAPI(airavataAPI);
+ }
+
+ public AiravataAPI getAiravataAPI() {
+ return airavataAPI;
+ }
+
+ public void setAiravataAPI(AiravataAPI airavataAPI) {
+ this.airavataAPI = airavataAPI;
+ }
+
+ public List<InterpreterServiceURL> getURLS() throws AiravataAPIInvocationException {
+ List<InterpreterServiceURL> urls = new ArrayList<InterpreterServiceURL>();
+ List<URI> gfacDescriptorList = getAiravataAPI().getAiravataManager().getWorkflowInterpreterServiceURLs();
+ for (URI uri : gfacDescriptorList) {
+ urls.add(new InterpreterServiceURL(getAiravataAPI(), uri));
+ }
+ return urls;
+ }
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/9c47eec8/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/model/registrybrowser/MessageBoxURL.java
----------------------------------------------------------------------
diff --git a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/model/registrybrowser/MessageBoxURL.java b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/model/registrybrowser/MessageBoxURL.java
new file mode 100644
index 0000000..3754f16
--- /dev/null
+++ b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/model/registrybrowser/MessageBoxURL.java
@@ -0,0 +1,54 @@
+/*
+ *
+ * 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.model.registrybrowser;
+
+import org.apache.airavata.client.api.AiravataAPI;
+
+import java.net.URI;
+
+//import org.apache.airavata.registry.api.AiravataRegistry2;
+
+public class MessageBoxURL {
+ private AiravataAPI airavataAPI;
+ private URI messageBoxURL;
+
+ public MessageBoxURL(AiravataAPI airavataAPI, URI messageBoxURL) {
+ setAiravataAPI(airavataAPI);
+ setMessageBoxURL(messageBoxURL);
+ }
+
+ public AiravataAPI getAiravataAPI() {
+ return airavataAPI;
+ }
+
+ public void setAiravataAPI(AiravataAPI airavataAPI) {
+ this.airavataAPI = airavataAPI;
+ }
+
+ public URI getMessageBoxURL() {
+ return messageBoxURL;
+ }
+
+ public void setMessageBoxURL(URI messageBoxURL) {
+ this.messageBoxURL = messageBoxURL;
+ }
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/9c47eec8/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/model/registrybrowser/MessageBoxURLs.java
----------------------------------------------------------------------
diff --git a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/model/registrybrowser/MessageBoxURLs.java b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/model/registrybrowser/MessageBoxURLs.java
new file mode 100644
index 0000000..600af77
--- /dev/null
+++ b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/model/registrybrowser/MessageBoxURLs.java
@@ -0,0 +1,54 @@
+/*
+ *
+ * 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.model.registrybrowser;
+
+import org.apache.airavata.client.api.AiravataAPI;
+import org.apache.airavata.client.api.exception.AiravataAPIInvocationException;
+
+import java.net.URI;
+import java.util.ArrayList;
+import java.util.List;
+
+//import org.apache.airavata.registry.api.AiravataRegistry2;
+
+public class MessageBoxURLs {
+ private AiravataAPI airavataAPI;
+
+ public MessageBoxURLs(AiravataAPI airavataAPI) {
+ setAiravataAPI(airavataAPI);
+ }
+
+ public AiravataAPI getAiravataAPI() {
+ return airavataAPI;
+ }
+
+ public void setAiravataAPI(AiravataAPI airavataAPI) {
+ this.airavataAPI = airavataAPI;
+ }
+
+ public List<MessageBoxURL> getURLS() throws AiravataAPIInvocationException {
+ List<MessageBoxURL> urls = new ArrayList<MessageBoxURL>();
+ URI gfacDescriptor = getAiravataAPI().getAiravataManager().getMessageBoxServiceURL();
+ urls.add(new MessageBoxURL(getAiravataAPI(), gfacDescriptor));
+ return urls;
+ }
+}