You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airavata.apache.org by la...@apache.org on 2011/12/29 18:16:55 UTC

svn commit: r1225594 - in /incubator/airavata/trunk/modules/xbaya-gui: ./ src/main/java/org/apache/airavata/xbaya/clients/ src/main/java/org/apache/airavata/xbaya/interpretor/ src/main/resources/ src/test/java/org/apache/airavata/xbaya/interpreter/ src...

Author: lahiru
Date: Thu Dec 29 17:16:55 2011
New Revision: 1225594

URL: http://svn.apache.org/viewvc?rev=1225594&view=rev
Log:
fixing issues in xbaya workflow Interpreter. Fixing https://issues.apache.org/jira/browse/AIRAVATA-254.

Added:
    incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/clients/
    incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/clients/XBayaClient.java
    incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/interpretor/WorkflowInterpretorMessageReceiverInOut.java
    incubator/airavata/trunk/modules/xbaya-gui/src/main/resources/WorkflowInterpretor.wsdl
    incubator/airavata/trunk/modules/xbaya-gui/src/test/java/org/apache/airavata/xbaya/interpreter/XBayaClientTest.java
    incubator/airavata/trunk/modules/xbaya-gui/src/test/resources/xbaya.properties
Modified:
    incubator/airavata/trunk/modules/xbaya-gui/pom.xml
    incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/interpretor/WorkflowInterpretorSkeleton.java
    incubator/airavata/trunk/modules/xbaya-gui/src/main/resources/services.xml
    incubator/airavata/trunk/modules/xbaya-gui/src/test/java/org/apache/airavata/xbaya/interpreter/utils/WorkflowTestUtils.java

Modified: incubator/airavata/trunk/modules/xbaya-gui/pom.xml
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/xbaya-gui/pom.xml?rev=1225594&r1=1225593&r2=1225594&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/xbaya-gui/pom.xml (original)
+++ incubator/airavata/trunk/modules/xbaya-gui/pom.xml Thu Dec 29 17:16:55 2011
@@ -158,6 +158,7 @@
 				<version>${axis2.version}</version>
 				<configuration>
 					<servicesXmlFile>src/main/resources/services.xml</servicesXmlFile>
+                    <wsdlFile>src/main/resources/WorkflowInterpretor.wsdl</wsdlFile>
 				</configuration>
 				<executions>
 					<execution>

Added: incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/clients/XBayaClient.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/clients/XBayaClient.java?rev=1225594&view=auto
==============================================================================
--- incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/clients/XBayaClient.java (added)
+++ incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/clients/XBayaClient.java Thu Dec 29 17:16:55 2011
@@ -0,0 +1,220 @@
+/*
+ *
+ * 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.clients;
+
+import org.apache.airavata.xbaya.component.ComponentException;
+import org.apache.airavata.xbaya.component.ws.WSComponentPort;
+import org.apache.airavata.xbaya.graph.GraphException;
+import org.apache.airavata.xbaya.graph.impl.NodeImpl;
+import org.apache.airavata.xbaya.graph.system.InputNode;
+import org.apache.airavata.xbaya.interpretor.NameValue;
+import org.apache.airavata.xbaya.interpretor.WorkflowInterpretorStub;
+import org.apache.airavata.xbaya.wf.Workflow;
+import org.apache.axis2.AxisFault;
+import xsul5.MLogger;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.net.URISyntaxException;
+import java.net.URL;
+import java.nio.MappedByteBuffer;
+import java.nio.channels.FileChannel;
+import java.nio.charset.Charset;
+import java.rmi.RemoteException;
+import java.util.List;
+import java.util.Properties;
+
+
+public class XBayaClient {
+    private static final MLogger log = MLogger.getLogger();
+
+    public static final String GFAC = "gfac";
+    public static final String XREGISTRY = "xregistry";
+    public static final String PROXYSERVER = "proxyserver";
+    public static final String MSGBOX = "msgbox";
+    public static final String BROKER = "broker";
+    public static final String DEFAULT_GFAC_URL = "gfac.url";
+    public static final String DEFAULT_XREGISTRY_URL = "xregistry.url";
+    public static final String DEFAULT_MYPROXY_SERVER = "myproxy.url";
+    public static final String DEFAULT_MESSAGE_BOX_URL = "messagebox.url";
+    public static final String DEFAULT_BROKER_URL = "messagebroker.url";
+    public static final String MYPROXYUSERNAME = "myproxy.username";
+    public static final String MYPROXYPASS = "myproxy.password";
+    public static final String WORKFLOWSERVICEURL = "xbaya.service.url";
+    private static String workflow = "";
+
+    private NameValue[] configurations = new NameValue[8];
+
+    public XBayaClient(NameValue[] configuration) {
+        configurations = configuration;
+    }
+
+    public XBayaClient(String fileName) throws IOException {
+        URL url = this.getClass().getClassLoader().getResource(fileName);
+        Properties properties = new Properties();
+        properties.load(url.openStream());
+
+        configurations[0] = new NameValue();
+        configurations[0].setName(GFAC);
+        configurations[0].setValue(properties.getProperty(DEFAULT_GFAC_URL));
+
+        configurations[1] = new NameValue();
+        configurations[1].setName(XREGISTRY);
+        configurations[1].setValue(properties.getProperty(DEFAULT_XREGISTRY_URL));
+
+        configurations[2] = new NameValue();
+        configurations[2].setName(PROXYSERVER);
+        configurations[2].setValue(properties.getProperty(DEFAULT_MYPROXY_SERVER));
+
+        configurations[3] = new NameValue();
+        configurations[3].setName(MSGBOX);
+        configurations[3].setValue(properties.getProperty(DEFAULT_MESSAGE_BOX_URL));
+
+        configurations[4] = new NameValue();
+        configurations[4].setName(BROKER);
+        configurations[4].setValue(properties.getProperty(DEFAULT_BROKER_URL));
+
+        configurations[5] = new NameValue();
+        configurations[5].setName(MYPROXYUSERNAME);
+        configurations[5].setValue(properties.getProperty(MYPROXYUSERNAME));
+
+        configurations[6] = new NameValue();
+        configurations[6].setName(MYPROXYPASS);
+        configurations[6].setValue(properties.getProperty(MYPROXYPASS));
+
+        configurations[7] = new NameValue();
+        configurations[7].setName(WORKFLOWSERVICEURL);
+        configurations[7].setValue(properties.getProperty(WORKFLOWSERVICEURL));
+
+    }
+
+    public void loadWorkflowFromaFile(String workflowFile)throws URISyntaxException,IOException {
+
+        URL url = XBayaClient.class.getClassLoader().getResource(workflowFile);
+        FileInputStream stream = new FileInputStream(new File(url.toURI()));
+        try {
+            FileChannel fc = stream.getChannel();
+            MappedByteBuffer bb = fc.map(FileChannel.MapMode.READ_ONLY, 0, fc.size());
+            /* Instead of using default, pass in a decoder. */
+            this.workflow = Charset.defaultCharset().decode(bb).toString();
+        } finally {
+            stream.close();
+        }
+    }
+
+    public void loadWorkflowasaString(String workflowAsaString) {
+        this.workflow = workflowAsaString;
+    }
+
+
+    public NameValue[] setInputs(String fileName) throws IOException {
+        URL url = this.getClass().getClassLoader().getResource(fileName);
+        Properties properties = new Properties();
+        properties.load(url.openStream());
+        try {
+            Workflow workflow = new Workflow(this.workflow);
+            List<NodeImpl> inputs = workflow.getGraph().getNodes();
+            int inputSize = 0;
+            for (NodeImpl input : inputs) {
+                if(input instanceof InputNode){
+                    inputSize++;
+                }
+            }
+            NameValue[] inputNameVals = new NameValue[inputSize];
+            int index =0;
+            for (NodeImpl input : inputs) {
+                if(input instanceof InputNode){
+                    inputNameVals[index] = new NameValue();
+                    String name = input.getName();
+                    inputNameVals[index].setName(name);
+                    inputNameVals[index].setValue(properties.getProperty(name));
+                    ((InputNode) input).setDefaultValue(properties.getProperty(name));
+                    index++;
+                }
+            }
+//            setWorkflow(XMLUtil.xmlElementToString((workflow.toXML()));
+            return inputNameVals;
+        } catch (GraphException e) {
+            e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
+        } catch (ComponentException e) {
+            e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
+        }
+        return null;
+    }
+
+    public void setInputs(Properties inputList){
+       try {
+            Workflow workflow = new Workflow(this.workflow);
+            List<WSComponentPort> inputs = workflow.getInputs();
+            for (WSComponentPort input : inputs) {
+                input.setValue(inputList.getProperty(input.getName()));
+            }
+        } catch (GraphException e) {
+            e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
+        } catch (ComponentException e) {
+            e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
+        }
+    }
+
+    public String runWorkflow(String topic){
+		String worflowoutput= null;
+		try {
+			WorkflowInterpretorStub stub = new WorkflowInterpretorStub(configurations[5].getValue());
+		    worflowoutput = stub.launchWorkflow(workflow, topic, configurations[6].getValue(), configurations[7].getValue(), null,
+					configurations);
+		    log.info("Workflow output : " + worflowoutput);
+		} catch (AxisFault e) {
+			log.fine(e.getMessage(), e);
+		} catch (RemoteException e) {
+			log.fine(e.getMessage(), e);
+		} catch (IOException e) {
+			log.fine(e.getMessage(), e);
+		}
+		return worflowoutput;
+	}
+
+        public String runWorkflow(String topic, NameValue[] inputs){
+		String worflowoutput= null;
+		try {
+			WorkflowInterpretorStub stub = new WorkflowInterpretorStub(configurations[7].getValue());
+		    worflowoutput = stub.launchWorkflow(workflow, topic, configurations[6].getValue(), configurations[5].getValue(), inputs,
+					configurations);
+		    log.info("Workflow output : " + worflowoutput);
+		} catch (AxisFault e) {
+			log.fine(e.getMessage(), e);
+		} catch (RemoteException e) {
+			log.fine(e.getMessage(), e);
+		} catch (IOException e) {
+			log.fine(e.getMessage(), e);
+		}
+		return worflowoutput;
+	}
+
+    public static String getWorkflow() {
+        return workflow;
+    }
+
+    public static void setWorkflow(String workflow) {
+        XBayaClient.workflow = workflow;
+    }
+}
+

Added: incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/interpretor/WorkflowInterpretorMessageReceiverInOut.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/interpretor/WorkflowInterpretorMessageReceiverInOut.java?rev=1225594&view=auto
==============================================================================
--- incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/interpretor/WorkflowInterpretorMessageReceiverInOut.java (added)
+++ incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/interpretor/WorkflowInterpretorMessageReceiverInOut.java Thu Dec 29 17:16:55 2011
@@ -0,0 +1,263 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+*/
+package org.apache.airavata.xbaya.interpretor;
+
+
+public class WorkflowInterpretorMessageReceiverInOut extends org.apache.axis2.receivers.AbstractInOutMessageReceiver{
+     public void invokeBusinessLogic(org.apache.axis2.context.MessageContext msgContext, org.apache.axis2.context.MessageContext newMsgContext)
+        throws org.apache.axis2.AxisFault{
+
+        try {
+
+        // get the implementation class for the Web Service
+        Object obj = getTheImplementationObject(msgContext);
+
+        WorkflowInterpretorSkeleton skel = (WorkflowInterpretorSkeleton)obj;
+        //Out Envelop
+        org.apache.axiom.soap.SOAPEnvelope envelope = null;
+        //Find the axisOperation that has been set by the Dispatch phase.
+        org.apache.axis2.description.AxisOperation op = msgContext.getOperationContext().getAxisOperation();
+        if (op == null) {
+        throw new org.apache.axis2.AxisFault("Operation is not located, if this is doclit style the SOAP-ACTION should specified via the SOAP Action to use the RawXMLProvider");
+        }
+
+        java.lang.String methodName;
+        if((op.getName() != null) && ((methodName = org.apache.axis2.util.JavaUtils.xmlNameToJava(op.getName().getLocalPart())) != null)){
+
+
+
+            if("launchWorkflow".equals(methodName)){
+
+	                        WorkflowInterpretorStub.LaunchWorkflow wrappedParam =
+                                                             (WorkflowInterpretorStub.LaunchWorkflow)fromOM(
+                                    msgContext.getEnvelope().getBody().getFirstElement(),
+                                    WorkflowInterpretorStub.LaunchWorkflow.class,
+                                    getEnvelopeNamespaces(msgContext.getEnvelope()));
+
+
+                WorkflowInterpretorStub.LaunchWorkflowResponse launchWorkflowResponse = wrapLaunchWorkflowResponse_return(
+
+
+                        skel.launchWorkflow(
+
+                                getWorkflowAsString(wrappedParam)
+                                ,
+                                getTopic(wrappedParam)
+                                ,
+                                getPassword(wrappedParam)
+                                ,
+                                getUsername(wrappedParam)
+                                ,
+                                getInputs(wrappedParam)
+                                ,
+                                getConfigurations(wrappedParam)
+                        )
+
+                );
+
+                envelope = toEnvelope(getSOAPFactory(msgContext), launchWorkflowResponse, false);
+
+            } else {
+              throw new java.lang.RuntimeException("method not found");
+            }
+
+
+        newMsgContext.setEnvelope(envelope);
+        }
+        }
+        catch (java.lang.Exception e) {
+        throw org.apache.axis2.AxisFault.makeFault(e);
+        }
+        }
+
+        //
+            private  org.apache.axiom.om.OMElement  toOM(WorkflowInterpretorStub.LaunchWorkflow param, boolean optimizeContent)
+            throws org.apache.axis2.AxisFault {
+
+
+                        try{
+                             return param.getOMElement(WorkflowInterpretorStub.LaunchWorkflow.MY_QNAME,
+                                          org.apache.axiom.om.OMAbstractFactory.getOMFactory());
+                        } catch(org.apache.axis2.databinding.ADBException e){
+                            throw org.apache.axis2.AxisFault.makeFault(e);
+                        }
+
+
+            }
+
+            private  org.apache.axiom.om.OMElement  toOM(WorkflowInterpretorStub.LaunchWorkflowResponse param, boolean optimizeContent)
+            throws org.apache.axis2.AxisFault {
+
+
+                        try{
+                             return param.getOMElement(WorkflowInterpretorStub.LaunchWorkflowResponse.MY_QNAME,
+                                          org.apache.axiom.om.OMAbstractFactory.getOMFactory());
+                        } catch(org.apache.axis2.databinding.ADBException e){
+                            throw org.apache.axis2.AxisFault.makeFault(e);
+                        }
+
+
+            }
+
+                    private  org.apache.axiom.soap.SOAPEnvelope toEnvelope(org.apache.axiom.soap.SOAPFactory factory, WorkflowInterpretorStub.LaunchWorkflowResponse param, boolean optimizeContent)
+                        throws org.apache.axis2.AxisFault{
+                      try{
+                          org.apache.axiom.soap.SOAPEnvelope emptyEnvelope = factory.getDefaultEnvelope();
+
+                                    emptyEnvelope.getBody().addChild(param.getOMElement(WorkflowInterpretorStub.LaunchWorkflowResponse.MY_QNAME,factory));
+
+
+                         return emptyEnvelope;
+                    } catch(org.apache.axis2.databinding.ADBException e){
+                        throw org.apache.axis2.AxisFault.makeFault(e);
+                    }
+                    }
+
+
+                        private java.lang.String getWorkflowAsString(
+                        WorkflowInterpretorStub.LaunchWorkflow wrappedType){
+
+                                return wrappedType.getWorkflowAsString();
+
+                        }
+
+
+                        private java.lang.String getTopic(
+                       WorkflowInterpretorStub.LaunchWorkflow wrappedType){
+
+                                return wrappedType.getTopic();
+
+                        }
+
+
+                        private java.lang.String getPassword(
+                        WorkflowInterpretorStub.LaunchWorkflow wrappedType){
+
+                                return wrappedType.getPassword();
+
+                        }
+
+
+                        private java.lang.String getUsername(
+                        WorkflowInterpretorStub.LaunchWorkflow wrappedType){
+
+                                return wrappedType.getUsername();
+
+                        }
+
+
+                        private NameValue[] getInputs(
+                        WorkflowInterpretorStub.LaunchWorkflow wrappedType){
+
+                                return wrappedType.getInputs();
+
+                        }
+
+
+                        private NameValue[] getConfigurations(
+                        WorkflowInterpretorStub.LaunchWorkflow wrappedType){
+
+                                return wrappedType.getConfigurations();
+
+                        }
+
+
+
+                        private WorkflowInterpretorStub.LaunchWorkflowResponse wrapLaunchWorkflowResponse_return(
+                        java.lang.String param){
+                            WorkflowInterpretorStub.LaunchWorkflowResponse wrappedElement = new WorkflowInterpretorStub.LaunchWorkflowResponse();
+
+                            wrappedElement.set_return(param);
+
+                            return wrappedElement;
+                        }
+
+                         private WorkflowInterpretorStub.LaunchWorkflowResponse wraplaunchWorkflow(){
+                                WorkflowInterpretorStub.LaunchWorkflowResponse wrappedElement = new WorkflowInterpretorStub.LaunchWorkflowResponse();
+                                return wrappedElement;
+                         }
+
+
+
+        /**
+        *  get the default envelope
+        */
+        private org.apache.axiom.soap.SOAPEnvelope toEnvelope(org.apache.axiom.soap.SOAPFactory factory){
+        return factory.getDefaultEnvelope();
+        }
+
+
+        private  java.lang.Object fromOM(
+        org.apache.axiom.om.OMElement param,
+        java.lang.Class type,
+        java.util.Map extraNamespaces) throws org.apache.axis2.AxisFault{
+
+        try {
+
+                if (WorkflowInterpretorStub.LaunchWorkflow.class.equals(type)){
+
+                           return WorkflowInterpretorStub.LaunchWorkflow.Factory.parse(param.getXMLStreamReaderWithoutCaching());
+
+
+                }
+
+                if (WorkflowInterpretorStub.LaunchWorkflowResponse.class.equals(type)){
+
+                           return WorkflowInterpretorStub.LaunchWorkflowResponse.Factory.parse(param.getXMLStreamReaderWithoutCaching());
+
+
+                }
+
+        } catch (java.lang.Exception e) {
+        throw org.apache.axis2.AxisFault.makeFault(e);
+        }
+           return null;
+        }
+
+
+
+
+
+        /**
+        *  A utility method that copies the namepaces from the SOAPEnvelope
+        */
+        private java.util.Map getEnvelopeNamespaces(org.apache.axiom.soap.SOAPEnvelope env){
+        java.util.Map returnMap = new java.util.HashMap();
+        java.util.Iterator namespaceIterator = env.getAllDeclaredNamespaces();
+        while (namespaceIterator.hasNext()) {
+        org.apache.axiom.om.OMNamespace ns = (org.apache.axiom.om.OMNamespace) namespaceIterator.next();
+        returnMap.put(ns.getPrefix(),ns.getNamespaceURI());
+        }
+        return returnMap;
+        }
+
+        private org.apache.axis2.AxisFault createAxisFault(java.lang.Exception e) {
+        org.apache.axis2.AxisFault f;
+        Throwable cause = e.getCause();
+        if (cause != null) {
+            f = new org.apache.axis2.AxisFault(e.getMessage(), cause);
+        } else {
+            f = new org.apache.axis2.AxisFault(e.getMessage());
+        }
+
+        return f;
+    }
+}

Modified: incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/interpretor/WorkflowInterpretorSkeleton.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/interpretor/WorkflowInterpretorSkeleton.java?rev=1225594&r1=1225593&r2=1225594&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/interpretor/WorkflowInterpretorSkeleton.java (original)
+++ incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/interpretor/WorkflowInterpretorSkeleton.java Thu Dec 29 17:16:55 2011
@@ -41,36 +41,38 @@ import org.apache.airavata.xbaya.wf.Work
  */
 public class WorkflowInterpretorSkeleton {
 
-    public static final String PROXYSERVER = "proxyserver";
-    public static final String MSGBOX = "msgbox";
-    public static final String GFAC = "gfac";
-    public static final String DSC = "dsc";
-    public static final String BROKER = "broker";
-
-    /**
-     * Auto generated method signature
-     * 
-     * @param workflowAsString
-     * @param topic
-     * @param password
-     * @param username
-     * @param inputs
-     * @param configurations
-     */
+	public static final String PROXYSERVER = "proxyserver";
+	public static final String MSGBOX = "msgbox";
+	public static final String GFAC = "gfac";
+	public static final String DSC = "dsc";
+	public static final String BROKER = "broker";
+
+	/**
+	 * Auto generated method signature
+	 *
+	 * @param workflowAsString
+	 * @param topic
+	 * @param password
+	 * @param username
+	 * @param inputs
+	 * @param configurations
+	 */
+
+	public java.lang.String launchWorkflow(java.lang.String workflowAsString, java.lang.String topic, java.lang.String password, java.lang.String username, NameValue[] inputs, NameValue[] configurations) {
+        return setupAndLaunch(workflowAsString, topic, password, username, inputs, configurations,true);
+	}
 
-    public java.lang.String launchWorkflow(java.lang.String workflowAsString, java.lang.String topic,
-            java.lang.String password, java.lang.String username, NameValue[] inputs, NameValue[] configurations) {
+    private String setupAndLaunch(String workflowAsString, String topic, String password, String username, NameValue[] inputs, NameValue[] configurations,boolean inNewThread) {
         System.err.println("Launch is called for topi:");
 
         Workflow workflow = null;
         try {
             workflow = new Workflow(workflowAsString);
             System.err.println("Workflow Object created");
-
         } catch (GraphException e1) {
-            throw new XBayaRuntimeException(e1);
+            e1.printStackTrace();
         } catch (ComponentException e1) {
-            throw new XBayaRuntimeException(e1);
+            e1.printStackTrace();
         }
         System.err.println("Setting Input values");
         List<InputNode> inputNodes = new ODEClient().getInputNodes(workflow);
@@ -82,8 +84,7 @@ public class WorkflowInterpretorSkeleton
                 }
             }
             if (inputNode.getDefaultValue() == null) {
-                throw new XBayaRuntimeException("Could not find a input value for component with name :"
-                        + inputNode.getName());
+                throw new XBayaRuntimeException("Could not find a input value for component with name :" + inputNode.getName());
             }
 
         }
@@ -92,59 +93,77 @@ public class WorkflowInterpretorSkeleton
         XBayaConfiguration conf = null;
         try {
             conf = getConfiguration(configurations);
+            conf.setTopic(topic);
         } catch (URISyntaxException e1) {
             throw new XBayaRuntimeException(e1);
         }
-        conf.setTopic(topic);
-        WorkflowInterpretorEventListener listener = new WorkflowInterpretorEventListener(workflow, conf);
+
+        final WorkflowInterpretorEventListener listener = new WorkflowInterpretorEventListener(workflow, conf);
         try {
+            System.err.println("start listener set");
             listener.start();
         } catch (MonitorException e1) {
-            // TODO Auto-generated catch block
             e1.printStackTrace();
         }
-        WorkflowInterpreter interpreter = new WorkflowInterpreter(conf, topic, workflow, username, password);
-        System.err.println("Created the interpreter");
-        try {
-            interpreter.scheduleDynamically();
-            System.err.println("Called the interpreter");
 
-        } catch (XBayaException e) {
-            throw new XBayaRuntimeException(e);
-        }
-        try {
-            listener.stop();
-        } catch (MonitorException e) {
-            // TODO Auto-generated catch block
-            e.printStackTrace();
+        final WorkflowInterpreter interpreter = new WorkflowInterpreter(conf, topic, workflow, username, password);
+        System.err.println("Created the interpreter");
+        if(inNewThread){
+            runInThread(interpreter,listener);
+        }else{
+            executeWorkflow(interpreter,listener);
         }
+        System.err.println("topic return:" + topic);
 
         return topic;
     }
 
-    public static XBayaConfiguration getConfiguration(NameValue[] vals) throws URISyntaxException {
-        XBayaConfiguration configuration = new XBayaConfiguration();
-        configuration.setBrokerURL(new URI(findValue(vals, BROKER, XBayaConstants.DEFAULT_BROKER_URL.toString())));
-        configuration.setDSCURL(new URI(findValue(vals, DSC, XBayaConstants.DEFAULT_DSC_URL.toString())));
-        configuration.setGFacURL(new URI(findValue(vals, GFAC, XBayaConstants.DEFAULT_GFAC_URL.toString())));
-        configuration.setMessageBoxURL(new URI(findValue(vals, MSGBOX,
-                XBayaConstants.DEFAULT_MESSAGE_BOX_URL.toString())));
-        configuration.setMyProxyLifetime(XBayaConstants.DEFAULT_MYPROXY_LIFTTIME);
-        configuration.setMyProxyPort(XBayaConstants.DEFAULT_MYPROXY_PORT);
-        configuration.setMyProxyServer(findValue(vals, PROXYSERVER, XBayaConstants.DEFAULT_MYPROXY_SERVER));
-        // configuration.setXRegistryURL(new URI(findValue(vals, XREGISTRY,
-        // XBayaConstants.DEFAULT_XREGISTRY_URL.toString())));
-        return configuration;
+    private void runInThread(final WorkflowInterpreter interpreter,final WorkflowInterpretorEventListener listener) {
+        new Thread(new Runnable() {
+
+            public void run() {
+                executeWorkflow(interpreter, listener);
+            }
+        }).start();
     }
 
-    public static String findValue(NameValue[] vals, String key, String defaultVal) {
-        for (int i = 0; i < vals.length; i++) {
-            if (key.equals(vals[i].getName()) && !"".equals(vals[i].getValue())) {
-                return vals[i].getValue();
+    private void executeWorkflow(WorkflowInterpreter interpreter, WorkflowInterpretorEventListener listener) {
+        try {
+            interpreter.scheduleDynamically();
+            System.err.println("Called the interpreter");
+        } catch (XBayaException e) {
+            throw new XBayaRuntimeException(e);
+        } finally {
+            /*
+             * stop listener no matter what happens
+             */
+            try {
+                listener.stop();
+            } catch (MonitorException e) {
+                e.printStackTrace();
             }
         }
-
-        return defaultVal;
     }
 
+    public  XBayaConfiguration getConfiguration(NameValue[] vals) throws URISyntaxException {
+		XBayaConfiguration configuration = new XBayaConfiguration();
+		configuration.setBrokerURL(new URI(findValue(vals, BROKER, XBayaConstants.DEFAULT_BROKER_URL.toString())));
+		configuration.setDSCURL(new URI(findValue(vals, DSC, XBayaConstants.DEFAULT_DSC_URL.toString())));
+		configuration.setGFacURL(new URI(findValue(vals, GFAC, XBayaConstants.DEFAULT_GFAC_URL.toString())));
+		configuration.setMessageBoxURL(new URI(findValue(vals, MSGBOX, XBayaConstants.DEFAULT_MESSAGE_BOX_URL.toString())));
+		configuration.setMyProxyLifetime(XBayaConstants.DEFAULT_MYPROXY_LIFTTIME);
+		configuration.setMyProxyPort(XBayaConstants.DEFAULT_MYPROXY_PORT);
+		configuration.setMyProxyServer(findValue(vals, PROXYSERVER, XBayaConstants.DEFAULT_MYPROXY_SERVER));
+		return configuration;
+	}
+
+	public String findValue(NameValue[] vals, String key, String defaultVal) {
+		for (int i = 0; i < vals.length; i++) {
+			if (key.equals(vals[i].getName()) && !"".equals(vals[i].getValue())) {
+				return vals[i].getValue();
+			}
+		}
+
+		return defaultVal;
+	}
 }

Added: incubator/airavata/trunk/modules/xbaya-gui/src/main/resources/WorkflowInterpretor.wsdl
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/xbaya-gui/src/main/resources/WorkflowInterpretor.wsdl?rev=1225594&view=auto
==============================================================================
--- incubator/airavata/trunk/modules/xbaya-gui/src/main/resources/WorkflowInterpretor.wsdl (added)
+++ incubator/airavata/trunk/modules/xbaya-gui/src/main/resources/WorkflowInterpretor.wsdl Thu Dec 29 17:16:55 2011
@@ -0,0 +1,66 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<wsdl:definitions targetNamespace="http://xbaya.extreme.indiana.edu" xmlns:ns1="http://org.apache.axis2/xsd" xmlns:ns="http://xbaya.extreme.indiana.edu" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" xmlns:ax21="http://xbaya.extreme.indiana.edu/xsd" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/">
+  <wsdl:types>
+    <xs:schema targetNamespace="http://gui.component.xbaya.airavata.apache.org/xsd">
+            <xs:import namespace="http://registry.component.xbaya.airavata.apache.org/xsd"/>
+            <xs:element name="launchWorkflow">
+                <xs:complexType>
+                    <xs:sequence>
+                        <xs:element minOccurs="0" name="workflowAsString" nillable="true" type="xs:string"/>
+                        <xs:element minOccurs="0" name="topic" nillable="true" type="xs:string"/>
+                        <xs:element minOccurs="0" name="password" nillable="true" type="xs:string"/>
+                        <xs:element minOccurs="0" name="username" nillable="true" type="xs:string"/>
+                        <xs:element maxOccurs="unbounded" minOccurs="0" name="inputs" nillable="true" type="ns:NameValue"/>
+                        <xs:element maxOccurs="unbounded" minOccurs="0" name="configurations" nillable="true" type="ns:NameValue"/>
+                    </xs:sequence>
+                </xs:complexType>
+            </xs:element>
+            <xs:element name="launchWorkflowResponse">
+                <xs:complexType>
+                    <xs:sequence>
+                        <xs:element minOccurs="0" name="return" nillable="true" type="xs:string"/>
+                    </xs:sequence>
+                </xs:complexType>
+            </xs:element>
+            <xs:complexType name="NameValue">
+                <xs:sequence>
+                    <xs:element minOccurs="0" name="name" nillable="true" type="xs:string"/>
+                    <xs:element minOccurs="0" name="value" nillable="true" type="xs:string"/>
+                </xs:sequence>
+            </xs:complexType>
+        </xs:schema>
+  </wsdl:types>
+  <wsdl:message name="launchWorkflowRequest">
+    <wsdl:part name="parameters" element="ns:launchWorkflow">
+    </wsdl:part>
+  </wsdl:message>
+  <wsdl:message name="launchWorkflowResponse">
+    <wsdl:part name="parameters" element="ns:launchWorkflowResponse">
+    </wsdl:part>
+  </wsdl:message>
+  <wsdl:portType name="WorkflowInterpretorPortType">
+    <wsdl:operation name="launchWorkflow">
+      <wsdl:input message="ns:launchWorkflowRequest" wsaw:Action="urn:launchWorkflow">
+    </wsdl:input>
+      <wsdl:output message="ns:launchWorkflowResponse" wsaw:Action="urn:launchWorkflowResponse">
+    </wsdl:output>
+    </wsdl:operation>
+  </wsdl:portType>
+  <wsdl:binding name="WorkflowInterpretorSoap11Binding" type="ns:WorkflowInterpretorPortType">
+    <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
+    <wsdl:operation name="launchWorkflow">
+      <soap:operation soapAction="urn:launchWorkflow" style="document"/>
+      <wsdl:input>
+        <soap:body use="literal"/>
+      </wsdl:input>
+      <wsdl:output>
+        <soap:body use="literal"/>
+      </wsdl:output>
+    </wsdl:operation>
+  </wsdl:binding>
+  <wsdl:service name="WorkflowInterpretor">
+    <wsdl:port name="WorkflowInterpretorHttpSoap11Endpoint" binding="ns:WorkflowInterpretorSoap11Binding">
+      <soap:address location="http://ogceportal.iu.teragrid.org:19444/axis2/services/WorkflowInterpretor"/>
+    </wsdl:port>
+  </wsdl:service>
+</wsdl:definitions>

Modified: incubator/airavata/trunk/modules/xbaya-gui/src/main/resources/services.xml
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/xbaya-gui/src/main/resources/services.xml?rev=1225594&r1=1225593&r2=1225594&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/xbaya-gui/src/main/resources/services.xml (original)
+++ incubator/airavata/trunk/modules/xbaya-gui/src/main/resources/services.xml Thu Dec 29 17:16:55 2011
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 
-<!--Licensed to the Apache Software Foundation (ASF) under one or more contributor 
+<!--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 
@@ -12,13 +12,19 @@
 	language governing permissions and limitations under the License. -->
 
 
+<!-- This file was auto-generated from WSDL -->
+<!-- by the Apache Axis2 version: 1.4  Built on : Apr 26, 2008 (06:24:30 EDT) -->
 <serviceGroup>
-    <service name="XBayaService">
-        <Description>XBaya Service</Description>
+    <service name="WorkflowInterpretor">
         <messageReceivers>
-		<messageReceiver mep="http://www.w3.org/2004/08/wsdl/in-only" class="org.apache.axis2.rpc.receivers.RPCInOnlyMessageReceiver" />
-		<messageReceiver  mep="http://www.w3.org/2004/08/wsdl/in-out"  class="org.apache.axis2.rpc.receivers.RPCMessageReceiver"/>
-	</messageReceivers>
-	<parameter locked="true" name="ServiceClass">org.apache.airavata.xbaya.interpretor.WorkflowInterpretorSkeleton</parameter>
+            <messageReceiver mep="http://www.w3.org/ns/wsdl/in-out" class="org.apache.airavata.xbaya.interpretor.WorkflowInterpretorMessageReceiverInOut"/>
+        </messageReceivers>
+        <parameter name="ServiceClass">org.apache.airavata.xbaya.interpretor.WorkflowInterpretorSkeleton</parameter>
+        <parameter name="useOriginalwsdl">true</parameter>
+        <parameter name="modifyUserWSDLPortAddress">true</parameter>
+        <operation name="launchWorkflow" mep="http://www.w3.org/ns/wsdl/in-out" namespace="http://xbaya.extreme.indiana.edu">
+            <actionMapping>urn:launchWorkflow</actionMapping>
+            <outputActionMapping>urn:launchWorkflowResponse</outputActionMapping>
+        </operation>
     </service>
 </serviceGroup>

Added: incubator/airavata/trunk/modules/xbaya-gui/src/test/java/org/apache/airavata/xbaya/interpreter/XBayaClientTest.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/xbaya-gui/src/test/java/org/apache/airavata/xbaya/interpreter/XBayaClientTest.java?rev=1225594&view=auto
==============================================================================
--- incubator/airavata/trunk/modules/xbaya-gui/src/test/java/org/apache/airavata/xbaya/interpreter/XBayaClientTest.java (added)
+++ incubator/airavata/trunk/modules/xbaya-gui/src/test/java/org/apache/airavata/xbaya/interpreter/XBayaClientTest.java Thu Dec 29 17:16:55 2011
@@ -0,0 +1,70 @@
+/*
+ *
+ * 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.interpreter;
+
+import org.apache.airavata.xbaya.clients.XBayaClient;
+import org.apache.airavata.xbaya.interpretor.NameValue;
+import org.apache.airavata.xbaya.interpretor.WorkflowInterpretorStub;
+import org.apache.axis2.AxisFault;
+import org.apache.axis2.context.ConfigurationContext;
+import org.apache.axis2.context.ConfigurationContextFactory;
+import org.apache.axis2.description.AxisService;
+import org.apache.axis2.engine.ListenerManager;
+import org.junit.Test;
+
+import java.io.IOException;
+import java.net.URISyntaxException;
+
+public class XBayaClientTest {
+    @Test
+	public void testInvokeWorkflowString() {
+//		  try {
+//               ListenerManager manager = axis2ServiceStarter();
+//              XBayaClient xBayaClient = new XBayaClient("xbaya.properties");
+//              xBayaClient.loadWorkflowFromaFile("Mysimplemath.xwf");
+//              NameValue[] nameValues = xBayaClient.setInputs("xbaya.properties");
+//              String s = xBayaClient.runWorkflow("test",nameValues);
+//              org.junit.Assert.assertEquals("test",s);
+//              manager.stop();
+//          }  catch (URISyntaxException e) {
+//			TODO Auto-generated catch block
+//			e.printStackTrace();
+//		} catch (IOException e) {
+//			TODO Auto-generated catch block
+//			e.printStackTrace();
+//		}
+	}
+
+    private ListenerManager axis2ServiceStarter() throws AxisFault {
+        try {
+            ConfigurationContext configContext = ConfigurationContextFactory.createBasicConfigurationContext
+                    ("axis2_default.xml");
+            AxisService service = AxisService.createService(EchoService.class.getName(), configContext.getAxisConfiguration());
+            configContext.deployService(service);
+            ListenerManager manager = new ListenerManager();
+            manager.init(configContext);
+            manager.start();
+            return manager;
+        } catch (Exception e) {
+            throw AxisFault.makeFault(e);
+        }
+    }
+}

Modified: incubator/airavata/trunk/modules/xbaya-gui/src/test/java/org/apache/airavata/xbaya/interpreter/utils/WorkflowTestUtils.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/xbaya-gui/src/test/java/org/apache/airavata/xbaya/interpreter/utils/WorkflowTestUtils.java?rev=1225594&r1=1225593&r2=1225594&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/xbaya-gui/src/test/java/org/apache/airavata/xbaya/interpreter/utils/WorkflowTestUtils.java (original)
+++ incubator/airavata/trunk/modules/xbaya-gui/src/test/java/org/apache/airavata/xbaya/interpreter/utils/WorkflowTestUtils.java Thu Dec 29 17:16:55 2011
@@ -69,7 +69,7 @@ public class WorkflowTestUtils implement
         configurations[5] = new NameValue();
         configurations[5].setName(HEADER_ELEMENT_BROKER);
         configurations[5].setValue(XBayaConstants.DEFAULT_BROKER_URL.toString());
-        return WorkflowInterpretorSkeleton.getConfiguration(configurations);
+        return (new WorkflowInterpretorSkeleton()).getConfiguration(configurations);
     }
 
     public static String readWorkflow(URL url) throws IOException, URISyntaxException {

Added: incubator/airavata/trunk/modules/xbaya-gui/src/test/resources/xbaya.properties
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/xbaya-gui/src/test/resources/xbaya.properties?rev=1225594&view=auto
==============================================================================
--- incubator/airavata/trunk/modules/xbaya-gui/src/test/resources/xbaya.properties (added)
+++ incubator/airavata/trunk/modules/xbaya-gui/src/test/resources/xbaya.properties Thu Dec 29 17:16:55 2011
@@ -0,0 +1,9 @@
+gfac.url=https://gw39.quarry.iu.teragrid.org:19442/?wsdl
+xregistry.url=https://gw39.quarry.iu.teragrid.org:19443/xregistry?wsdl
+myproxy.url=myproxy.teragrid.org
+messagebox.url=http://localhost:8080/axis2/services/MsgBoxService
+messagebroker.url=http://localhost:8080/axis2/services/EventingService
+myproxy.username=ogce
+myproxy.password=testpassword
+xbaya.service.url=http://gw39.quarry.iu.teragrid.org:19080/axis2/services/XBayaService?wsdl
+echo=Hello World
\ No newline at end of file