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 2012/02/08 21:18:46 UTC
svn commit: r1242074 - in /incubator/airavata/trunk/modules/xbaya-gui/src:
main/java/org/apache/airavata/xbaya/clients/
main/java/org/apache/airavata/xbaya/interpretor/ main/resources/
test/resources/
Author: lahiru
Date: Wed Feb 8 20:18:45 2012
New Revision: 1242074
URL: http://svn.apache.org/viewvc?rev=1242074&view=rev
Log:
fixing issues with running interpreterservice without a listener.
Modified:
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/WorkflowInterpretorSkeleton.java
incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/interpretor/WorkflowInterpretorStub.java
incubator/airavata/trunk/modules/xbaya-gui/src/main/resources/WorkflowInterpretor.wsdl
incubator/airavata/trunk/modules/xbaya-gui/src/test/resources/xbaya.properties
Modified: 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=1242074&r1=1242073&r2=1242074&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/clients/XBayaClient.java (original)
+++ incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/clients/XBayaClient.java Wed Feb 8 20:18:45 2012
@@ -71,13 +71,14 @@ public class XBayaClient {
public static final String JCR_PASSWORD= "jcr.password";
public static final String MYPROXYUSERNAME = "myproxy.username";
public static final String MYPROXYPASS = "myproxy.password";
+ public static final String WITHLISTENER = "with.Listener";
public static final String WORKFLOWSERVICEURL = "xbaya.service.url";
private XBayaClientConfiguration clientConfiguration;
private static String workflow = "";
private AiravataRegistry registry;
- private NameValue[] configurations=new NameValue[10];
+ private NameValue[] configurations=new NameValue[11];
// private NameValue[] configurations = new NameValue[7];
@@ -130,7 +131,11 @@ public class XBayaClient {
configurations[9] = new NameValue();
configurations[9].setName(JCR_PASSWORD);
configurations[9].setValue(properties.getProperty(JCR_PASSWORD));
-
+
+ configurations[10] = new NameValue();
+ configurations[10].setName(WITHLISTENER);
+ configurations[10].setValue(properties.getProperty(WITHLISTENER));
+
updateClientConfiguration(configurations);
}
@@ -302,23 +307,6 @@ public class XBayaClient {
return worflowoutput;
}
- public String runWorkflowWithoutListener(String topic, NameValue[] inputs, String user, String metadata){
- String worflowoutput= null;
- try {
- WorkflowInterpretorStub stub = new WorkflowInterpretorStub(getClientConfiguration().getXbayaServiceURL().toString());
- worflowoutput = stub.launchWorkflowWithoutListener(workflow, topic, getClientConfiguration().getMyproxyPassword(),getClientConfiguration().getMyproxyUsername(), inputs,
- configurations);
- runPostWorkflowExecutionTasks(topic, user, metadata);
- log.info("Workflow output : " + worflowoutput);
- } catch (AxisFault e) {
- log.fine(e.getMessage(), e);
- } catch (RemoteException e) {
- log.fine(e.getMessage(), e);
- } catch (RegistryException e) {
- log.fine(e.getMessage(), e);
- }
- return worflowoutput;
- }
public List<WorkflowExecution> getWorkflowExecutionDataByUser(String user) throws RegistryException{
return getRegistry().getWorkflowExecutionByUser(user);
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=1242074&r1=1242073&r2=1242074&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 Wed Feb 8 20:18:45 2012
@@ -109,14 +109,10 @@ public class WorkflowInterpretorSkeleton
*/
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,runInThread, true);
+ return setupAndLaunch(workflowAsString, topic, password, username, inputs, configurations,runInThread);
}
- public java.lang.String launchWorkflowWithoutListener(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,runInThread, false);
- }
-
- private String setupAndLaunch(String workflowAsString, String topic, String password, String username, NameValue[] inputs, NameValue[] configurations, boolean inNewThread, boolean withListener) {
+ 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;
@@ -152,20 +148,21 @@ public class WorkflowInterpretorSkeleton
} catch (URISyntaxException e1) {
throw new XBayaRuntimeException(e1);
}
-
- final WorkflowInterpretorEventListener listener;
- if(withListener){
- try {
- listener = new WorkflowInterpretorEventListener(workflow, conf);
- System.err.println("start listener set");
+ WorkflowInterpretorEventListener listener = null;
+ WorkflowInterpreter interpreter = null;
+ if("true".equals(configurations[10].getValue())){
+ listener = new WorkflowInterpretorEventListener(workflow, conf);
+ interpreter = new WorkflowInterpreter(conf, topic, workflow, username, password);
+ try {
+ System.err.println("start listener set");
listener.start();
- } catch (MonitorException e1) {
- e1.printStackTrace();
- }
- }else{
- listener = null;
+ } catch (MonitorException e1) {
+ e1.printStackTrace();
}
-
+ }else{
+ interpreter = new WorkflowInterpreter(conf, topic, workflow, username, password,true);
+ }
+ final WorkflowInterpretorEventListener finalListener = listener;
try {
conf.setJcrComponentRegistry(new JCRComponentRegistry(new URI(jcrURL),jcrUserName,jcrPassword));
} catch (RepositoryException e) {
@@ -173,14 +170,15 @@ public class WorkflowInterpretorSkeleton
} catch (URISyntaxException e) {
e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
}
- final WorkflowInterpreter interpreter = new WorkflowInterpreter(conf, topic, workflow, username, password,true);
+
+ final WorkflowInterpreter finalInterpreter = interpreter;
interpreter.setActOnProvenance(provenance);
interpreter.setProvenanceWriter(runner);
System.err.println("Created the interpreter");
if(inNewThread){
- runInThread(interpreter,null);
+ runInThread(finalInterpreter,finalListener);
}else{
- executeWorkflow(interpreter,null);
+ executeWorkflow(finalInterpreter,finalListener);
}
System.err.println("topic return:" + topic);
@@ -203,16 +201,15 @@ public class WorkflowInterpretorSkeleton
} catch (XBayaException e) {
throw new XBayaRuntimeException(e);
} finally {
-// /*
-// * stop listener no matter what happens
-// */
- if(listener != null){
+ /*
+ * stop listener no matter what happens
+ */
try {
+ if(listener != null)
listener.stop();
} catch (MonitorException e) {
e.printStackTrace();
}
- }
}
}
Modified: incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/interpretor/WorkflowInterpretorStub.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/interpretor/WorkflowInterpretorStub.java?rev=1242074&r1=1242073&r2=1242074&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/interpretor/WorkflowInterpretorStub.java (original)
+++ incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/interpretor/WorkflowInterpretorStub.java Wed Feb 8 20:18:45 2012
@@ -248,113 +248,6 @@ public class WorkflowInterpretorStub ext
}
}
-
- public java.lang.String launchWorkflowWithoutListener(
-
- java.lang.String workflowAsString1, java.lang.String topic2, java.lang.String password3,
- java.lang.String username4, NameValue[] inputs5, NameValue[] configurations6)
-
- throws java.rmi.RemoteException
-
- {
- org.apache.axis2.context.MessageContext _messageContext = null;
- try {
- org.apache.axis2.client.OperationClient _operationClient = _serviceClient.createClient(_operations[0]
- .getName());
- _operationClient.getOptions().setAction("urn:launchWorkflowWithoutListener");
- _operationClient.getOptions().setExceptionToBeThrownOnSOAPFault(true);
-
- addPropertyToOperationClient(_operationClient,
- org.apache.axis2.description.WSDL2Constants.ATTR_WHTTP_QUERY_PARAMETER_SEPARATOR, "&");
-
- // create a message context
- _messageContext = new org.apache.axis2.context.MessageContext();
-
- // create SOAP envelope with that payload
- org.apache.axiom.soap.SOAPEnvelope env = null;
- WorkflowInterpretorStub.LaunchWorkflow dummyWrappedType = null;
- env = toEnvelope(getFactory(_operationClient.getOptions().getSoapVersionURI()), workflowAsString1, topic2,
- password3, username4, inputs5, configurations6, dummyWrappedType,
- optimizeContent(new javax.xml.namespace.QName("http://interpretor.xbaya.airavata.apache.org",
- "launchWorkflowWithoutListener")));
-
- // adding SOAP soap_headers
- _serviceClient.addHeadersToEnvelope(env);
- _serviceClient.getOptions().setTimeOutInMilliSeconds(90000000);
- // set the message context with that soap envelope
- _messageContext.setEnvelope(env);
-
- // add the message contxt to the operation client
- _operationClient.addMessageContext(_messageContext);
-
- // execute the operation client
- _operationClient.execute(true);
-
- org.apache.axis2.context.MessageContext _returnMessageContext = _operationClient
- .getMessageContext(org.apache.axis2.wsdl.WSDLConstants.MESSAGE_LABEL_IN_VALUE);
- org.apache.axiom.soap.SOAPEnvelope _returnEnv = _returnMessageContext.getEnvelope();
-
- java.lang.Object object = fromOM(_returnEnv.getBody().getFirstElement(),
- WorkflowInterpretorStub.LaunchWorkflowResponse.class, getEnvelopeNamespaces(_returnEnv));
-
- return getLaunchWorkflowResponse_return((WorkflowInterpretorStub.LaunchWorkflowResponse) object);
-
- } catch (AxisFault f) {
- org.apache.axiom.om.OMElement faultElt = f.getDetail();
- if (faultElt != null) {
- if (faultExceptionNameMap.containsKey(faultElt.getQName())) {
- // make the fault by reflection
- try {
- java.lang.String exceptionClassName = (java.lang.String) faultExceptionClassNameMap
- .get(faultElt.getQName());
- java.lang.Class exceptionClass = java.lang.Class.forName(exceptionClassName);
- java.lang.Exception ex = (java.lang.Exception) exceptionClass.newInstance();
- // message class
- java.lang.String messageClassName = (java.lang.String) faultMessageMap.get(faultElt.getQName());
- java.lang.Class messageClass = java.lang.Class.forName(messageClassName);
- java.lang.Object messageObject = fromOM(faultElt, messageClass, null);
- java.lang.reflect.Method m = exceptionClass.getMethod("setFaultMessage",
- new java.lang.Class[]{messageClass});
- m.invoke(ex, new java.lang.Object[]{messageObject});
-
- throw new java.rmi.RemoteException(ex.getMessage(), ex);
- } catch (java.lang.ClassCastException e) {
- // we cannot intantiate the class - throw the original
- // Axis fault
- throw f;
- } catch (java.lang.ClassNotFoundException e) {
- // we cannot intantiate the class - throw the original
- // Axis fault
- throw f;
- } catch (java.lang.NoSuchMethodException e) {
- // we cannot intantiate the class - throw the original
- // Axis fault
- throw f;
- } catch (java.lang.reflect.InvocationTargetException e) {
- // we cannot intantiate the class - throw the original
- // Axis fault
- throw f;
- } catch (java.lang.IllegalAccessException e) {
- // we cannot intantiate the class - throw the original
- // Axis fault
- throw f;
- } catch (java.lang.InstantiationException e) {
- // we cannot intantiate the class - throw the original
- // Axis fault
- throw f;
- }
- } else {
- throw f;
- }
- } else {
- throw f;
- }
- } finally {
- _serviceClient.cleanup();
- _messageContext.getTransportOut().getSender().cleanup(_messageContext);
- }
- }
-
/**
* Auto generated method signature for Asynchronous Invocations
*
Modified: 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=1242074&r1=1242073&r2=1242074&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/xbaya-gui/src/main/resources/WorkflowInterpretor.wsdl (original)
+++ incubator/airavata/trunk/modules/xbaya-gui/src/main/resources/WorkflowInterpretor.wsdl Wed Feb 8 20:18:45 2012
@@ -45,12 +45,6 @@
<wsdl:output message="ns:launchWorkflowResponse" wsaw:Action="urn:launchWorkflowResponse">
</wsdl:output>
</wsdl:operation>
- <wsdl:operation name="launchWorkflowWithoutListener">
- <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"/>
Modified: 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=1242074&r1=1242073&r2=1242074&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/xbaya-gui/src/test/resources/xbaya.properties (original)
+++ incubator/airavata/trunk/modules/xbaya-gui/src/test/resources/xbaya.properties Wed Feb 8 20:18:45 2012
@@ -5,7 +5,8 @@ messagebroker.url=http://156.56.179.104:
myproxy.username=ogce
myproxy.password=j;k
xbaya.service.url=http://156.56.179.104:8080/axis2/services/WorkflowInterpretor?wsdl
-jcr.url=http://156.56.179.104:8081/rmi
+jcr.url=http://156.56.179.104:8081/jackrabbit-webapp-2.3.7/rmi
jcr.username=admin
jcr.password=admin
-echo=Hi
\ No newline at end of file
+with.Listener=false
+Input=Hi1,Hi2,Hi3
\ No newline at end of file