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/05/09 18:25:26 UTC
svn commit: r1336282 - in /incubator/airavata/trunk/modules:
airavata-client/src/main/java/org/apache/airavata/client/airavata/
commons/workflow-execution-context/src/main/java/org/apache/airavata/common/workflow/execution/context/
commons/workflow-exe...
Author: lahiru
Date: Wed May 9 16:25:25 2012
New Revision: 1336282
URL: http://svn.apache.org/viewvc?rev=1336282&view=rev
Log:
Doing more changes to use Worfklow-Context header in Airavata Client.
Modified:
incubator/airavata/trunk/modules/airavata-client/src/main/java/org/apache/airavata/client/airavata/AiravataClient.java
incubator/airavata/trunk/modules/commons/workflow-execution-context/src/main/java/org/apache/airavata/common/workflow/execution/context/WorkflowContextHeaderBuilder.java
incubator/airavata/trunk/modules/commons/workflow-execution-context/src/main/resources/workflow_execution_context.xsd
incubator/airavata/trunk/modules/commons/workflow-execution-context/src/test/java/org/apache/airavata/common/workflow/execution/context/WorkflowContextHeaderBuilderTest.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/invoker/GenericInvoker.java
Modified: incubator/airavata/trunk/modules/airavata-client/src/main/java/org/apache/airavata/client/airavata/AiravataClient.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/airavata-client/src/main/java/org/apache/airavata/client/airavata/AiravataClient.java?rev=1336282&r1=1336281&r2=1336282&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/airavata-client/src/main/java/org/apache/airavata/client/airavata/AiravataClient.java (original)
+++ incubator/airavata/trunk/modules/airavata-client/src/main/java/org/apache/airavata/client/airavata/AiravataClient.java Wed May 9 16:25:25 2012
@@ -45,8 +45,10 @@ import javax.jcr.Property;
import javax.jcr.RepositoryException;
import javax.jcr.ValueFormatException;
import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamException;
import org.apache.airavata.common.registry.api.exception.RegistryException;
+import org.apache.airavata.common.utils.XMLUtil;
import org.apache.airavata.common.workflow.execution.context.WorkflowContextHeaderBuilder;
import org.apache.airavata.registry.api.AiravataRegistry;
import org.apache.airavata.registry.api.WorkflowExecution;
@@ -64,10 +66,12 @@ import org.apache.airavata.xbaya.monitor
import org.apache.airavata.xbaya.monitor.MonitorException;
import org.apache.airavata.xbaya.wf.Workflow;
import org.apache.airavata.xbaya.workflow.WorkflowClient;
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.impl.llom.util.AXIOMUtil;
import org.apache.axis2.AxisFault;
public class AiravataClient {
- // private static final MLogger log = MLogger.getLogger();
+// private static final MLogger log = MLogger.getLogger();
public static final String GFAC = "gfac";
public static final String JCR = "jcr";
@@ -85,19 +89,19 @@ public class AiravataClient {
public static final String MYPROXYPASS = "myproxy.password";
public static final String WITHLISTENER = "with.Listener";
public static final String WORKFLOWSERVICEURL = "xbaya.service.url";
- public static final String TRUSTED_CERT_LOCATION = "trusted.cert.location";
- private AiravataClientConfiguration clientConfiguration;
- private MonitorConfiguration monitorConfiguration;
+ public static final String TRUSTED_CERT_LOCATION = "trusted.cert.location";
+ private AiravataClientConfiguration clientConfiguration;
+ private MonitorConfiguration monitorConfiguration;
private static String workflow = "";
- private static WorkflowContextHeaderBuilder builder;
+ private static WorkflowContextHeaderBuilder builder;
private AiravataRegistry registry;
- private Map<String, String> configuration = new HashMap<String, String>();
+ private Map<String, String> configuration = new HashMap<String, String>();
// private NameValue[] configurations = new NameValue[7];
- public AiravataClient(Map<String, String> configuration)
+ public AiravataClient(Map<String,String> configuration)
throws MalformedURLException {
this.configuration = configuration;
updateClientConfiguration(configuration);
@@ -105,75 +109,56 @@ public class AiravataClient {
public AiravataClient(String fileName) throws RegistryException,
MalformedURLException, IOException {
- URL url = this.getClass().getClassLoader().getResource(fileName);
+ URL url = this. getClass().getClassLoader().getResource(fileName);
if (url == null) {
url = (new File(fileName)).toURL();
}
Properties properties = new Properties();
properties.load(url.openStream());
- configuration.put(GFAC,
- validateAxisService(properties.getProperty(DEFAULT_GFAC_URL)));
- configuration.put(PROXYSERVER,
- properties.getProperty(DEFAULT_MYPROXY_SERVER));
- configuration.put(MSGBOX, validateAxisService(properties
+ configuration.put(GFAC,validateAxisService(properties
+ .getProperty(DEFAULT_GFAC_URL)));
+ configuration.put(MSGBOX,validateAxisService(properties
.getProperty(DEFAULT_MESSAGE_BOX_URL)));
- configuration
- .put(BROKER, validateAxisService(properties
- .getProperty(DEFAULT_BROKER_URL)));
- configuration.put(MYPROXYUSERNAME,
- properties.getProperty(MYPROXYUSERNAME));
- configuration.put(MYPROXYPASS, properties.getProperty(MYPROXYPASS));
- configuration
- .put(WORKFLOWSERVICEURL, validateAxisService(properties
- .getProperty(WORKFLOWSERVICEURL)));
- configuration.put(JCR,
- validateURL(properties.getProperty(DEFAULT_JCR_URL)));
- configuration.put(JCR_USERNAME, properties.getProperty(JCR_USERNAME));
-
- configuration.put(JCR_PASSWORD, properties.getProperty(JCR_PASSWORD));
-
- configuration.put(WITHLISTENER, properties.getProperty(WITHLISTENER));
-
- configuration.put(TRUSTED_CERT_LOCATION,
- properties.getProperty(TRUSTED_CERT_LOCATION));
- // At this point we do not know the workflowExperimentId
- // builder = new
- // WorkflowContextHeaderBuilder(properties.getProperty(DEFAULT_BROKER_URL),
- // properties.getProperty(DEFAULT_GFAC_URL),properties.getProperty(DEFAULT_JCR_URL),null,null);
+ configuration.put(BROKER,validateAxisService(properties
+ .getProperty(DEFAULT_BROKER_URL)));
+ configuration.put(WORKFLOWSERVICEURL,validateAxisService(properties
+ .getProperty(WORKFLOWSERVICEURL)));
+ configuration.put(JCR,validateURL(properties
+ .getProperty(DEFAULT_JCR_URL)));
+ configuration.put(JCR_USERNAME,properties.getProperty(JCR_USERNAME));
+
+ configuration.put(JCR_PASSWORD,properties.getProperty(JCR_PASSWORD));
+
+ configuration.put(WITHLISTENER,properties.getProperty(WITHLISTENER));
+
+ // At this point we do not know the workflowExperimentId
+ builder = new WorkflowContextHeaderBuilder(properties.getProperty(DEFAULT_BROKER_URL),
+ properties.getProperty(DEFAULT_GFAC_URL),properties.getProperty(DEFAULT_JCR_URL),null,null, null);
+
updateClientConfiguration(configuration);
}
- private void updateClientConfiguration(Map<String, String> configuration)
+ private void updateClientConfiguration(Map<String,String> configuration)
throws MalformedURLException {
AiravataClientConfiguration clientConfiguration = getClientConfiguration();
- if (configuration.get(GFAC) != null) {
- clientConfiguration.setGfacURL(new URL(configuration.get(GFAC)));
- }
- if (configuration.get(PROXYSERVER) != null) {
- clientConfiguration.setMyproxyHost(configuration.get(PROXYSERVER));
- }
- if (configuration.get(MSGBOX) != null) {
- clientConfiguration.setMessageboxURL(new URL(configuration
- .get(MSGBOX)));
- }
- if (configuration.get(BROKER) != null) {
- clientConfiguration.setMessagebrokerURL(new URL(configuration
- .get(BROKER)));
- }
- if (configuration.get(JCR) != null) {
- clientConfiguration.setJcrURL(new URL(configuration.get(JCR)));
- }
- if (configuration.get(JCR_USERNAME) != null) {
- clientConfiguration.setJcrUsername(configuration.get(JCR_USERNAME));
- }
- if (configuration.get(JCR_PASSWORD) != null) {
- clientConfiguration.setJcrPassword(configuration.get(JCR_PASSWORD));
- }
- if (configuration.get(WORKFLOWSERVICEURL) != null) {
- clientConfiguration.setXbayaServiceURL(new URL(configuration
- .get(WORKFLOWSERVICEURL)));
- }
+ if (configuration.get(GFAC) != null) {
+ clientConfiguration
+ .setGfacURL(new URL(configuration.get(GFAC)));
+ }
+ if (configuration.get(MSGBOX)!= null) {
+ clientConfiguration.setMessageboxURL(new URL(configuration.get(MSGBOX)));
+ }
+ if (configuration.get(BROKER)!= null) {
+ clientConfiguration.setMessagebrokerURL(new URL(configuration.get(BROKER)));
+ }
+ if (configuration.get(JCR)!= null) {
+ clientConfiguration
+ .setJcrURL(new URL(configuration.get(JCR)));
+ }
+ if (configuration.get(WORKFLOWSERVICEURL)!= null) {
+ clientConfiguration.setXbayaServiceURL(new URL(configuration.get(WORKFLOWSERVICEURL)));
+ }
}
public void loadWorkflowFromaFile(String workflowFile)
@@ -206,8 +191,7 @@ public class AiravataClient {
this.workflow = workflowAsaString;
}
- public static void updateWorkflowInputValuesFromProperties(
- List<WorkflowInput> inputs, String fileName) throws IOException {
+ public static void updateWorkflowInputValuesFromProperties(List<WorkflowInput> inputs, String fileName) throws IOException{
URL url = AiravataClient.class.getClassLoader().getResource(fileName);
if (url == null) {
url = (new File(fileName)).toURL();
@@ -215,12 +199,12 @@ public class AiravataClient {
Properties properties = new Properties();
properties.load(url.openStream());
for (WorkflowInput workflowInput : inputs) {
- if (properties.containsKey(workflowInput.getName())) {
+ if (properties.containsKey(workflowInput.getName())){
workflowInput.setValue(properties.get(workflowInput.getName()));
}
}
}
-
+
public NameValue[] setInputs(String fileName) throws IOException {
URL url = this.getClass().getClassLoader().getResource(fileName);
if (url == null) {
@@ -287,54 +271,58 @@ public class AiravataClient {
}
public String runWorkflow(String topic, String user, String metadata) {
- String worflowoutput = null;
- try {
- WorkflowInterpretorStub stub = new WorkflowInterpretorStub(
- getClientConfiguration().getXbayaServiceURL().toString());
- worflowoutput = stub.launchWorkflow(workflow, topic, null);
- runPostWorkflowExecutionTasks(worflowoutput, user, metadata);
+ String worflowoutput = null;
+ try {
+ WorkflowInterpretorStub stub = new WorkflowInterpretorStub(
+ getClientConfiguration().getXbayaServiceURL().toString());
+ OMElement omElement = AXIOMUtil.stringToOM(XMLUtil.xmlElementToString(builder.getXml()));
+ stub._getServiceClient().addHeader(omElement);
+ worflowoutput = stub.launchWorkflow(workflow, topic,null);
+ runPostWorkflowExecutionTasks(worflowoutput, user, metadata);
- } catch (AxisFault e) {
+ } catch (AxisFault e) {
} catch (RemoteException e) {
- // log.fine(e.getMessage(), e);
+// log.fine(e.getMessage(), e);
} catch (RegistryException e) {
- // log.fine(e.getMessage(), e);
- }
- // log.info("Workflow output : " + worflowoutput);
-
- return worflowoutput;
- }
-
- public Monitor getWorkflowExecutionMonitor(String topic) {
- return getWorkflowExecutionMonitor(topic, null);
- }
-
- public Monitor getWorkflowExecutionMonitor(String topic,
- MonitorEventListener listener) {
- final String fTopic = topic;
- try {
- monitorConfiguration = new MonitorConfiguration(new URI(
- configuration.get(BROKER)), fTopic, true, new URI(
- configuration.get(MSGBOX)));
- } catch (URISyntaxException e1) {
- e1.printStackTrace();
- }
- final Monitor monitor = new Monitor(monitorConfiguration);
- monitor.setPrint(true);
- monitor.getEventData().registerEventListener(listener);
- new Thread() {
- @Override
- public void run() {
- try {
- monitor.start();
- } catch (MonitorException e) {
- e.printStackTrace();
- }
- }
- }.start();
- return monitor;
- }
-
+// log.fine(e.getMessage(), e);
+ } catch (XMLStreamException e) {
+ e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
+ }
+// log.info("Workflow output : " + worflowoutput);
+
+ return worflowoutput;
+ }
+
+ public Monitor getWorkflowExecutionMonitor(String topic) {
+ return getWorkflowExecutionMonitor(topic, null);
+ }
+
+ public Monitor getWorkflowExecutionMonitor(String topic,
+ MonitorEventListener listener) {
+ final String fTopic = topic;
+ try {
+ monitorConfiguration = new MonitorConfiguration(new URI(
+ configuration.get(BROKER)), fTopic, true, new URI(
+ configuration.get(MSGBOX)));
+ } catch (URISyntaxException e1) {
+ e1.printStackTrace();
+ }
+ final Monitor monitor = new Monitor(monitorConfiguration);
+ monitor.setPrint(true);
+ monitor.getEventData().registerEventListener(listener);
+ new Thread() {
+ @Override
+ public void run() {
+ try {
+ monitor.start();
+ } catch (MonitorException e) {
+ e.printStackTrace();
+ }
+ }
+ }.start();
+ return monitor;
+ }
+
private void runPostWorkflowExecutionTasks(String topic, String user,
String metadata) throws RegistryException {
if (user != null) {
@@ -345,27 +333,26 @@ public class AiravataClient {
}
}
- public String runWorkflow(String topic, NameValue[] inputs)
- throws Exception {
+ public String runWorkflow(String topic, NameValue[] inputs) throws Exception {
return runWorkflow(topic, inputs, null);
}
- public String runWorkflow(String topic, NameValue[] inputs, String user)
- throws Exception {
+ public String runWorkflow(String topic, NameValue[] inputs, String user) throws Exception {
return runWorkflow(topic, inputs, user, null);
}
public String runWorkflow(String topic, NameValue[] inputs, String user,
- String metadata) throws Exception {
+ String metadata) throws Exception{
String worflowoutput = null;
try {
WorkflowInterpretorStub stub = new WorkflowInterpretorStub(
getClientConfiguration().getXbayaServiceURL().toString());
+ stub._getServiceClient().addHeader(AXIOMUtil.stringToOM(XMLUtil.xmlElementToString(builder.getXml())));
worflowoutput = stub.launchWorkflow(workflow, topic, inputs);
runPostWorkflowExecutionTasks(topic, user, metadata);
- // log.info("Workflow output : " + worflowoutput);
+// log.info("Workflow output : " + worflowoutput);
} catch (RegistryException e) {
- // log.fine(e.getMessage(), e);
+// log.fine(e.getMessage(), e);
}
return worflowoutput;
}
@@ -432,7 +419,7 @@ public class AiravataClient {
private String validateAxisService(String urlString)
throws RegistryException {
- String originalURL = urlString;
+ String originalURL=urlString;
if (!urlString.endsWith("?wsdl")) {
urlString = urlString + "?wsdl";
}
@@ -471,7 +458,6 @@ public class AiravataClient {
/**
* Retrieve the names of the workflow templates saved in the registry
- *
* @return
*/
public List<String> getWorkflowTemplateIds() {
@@ -491,23 +477,17 @@ public class AiravataClient {
}
/**
- * Execute the given workflow template with the given inputs and return the
- * topic id
- *
+ * Execute the given workflow template with the given inputs and return the topic id
* @param workflowTemplateId
* @param inputs
* @return
*/
- public String runWorkflow(String workflowTemplateId,
- List<WorkflowInput> inputs) throws Exception {
- return runWorkflow(workflowTemplateId, inputs, getRegistry()
- .getUsername(), null);
+ public String runWorkflow(String workflowTemplateId,List<WorkflowInput> inputs) throws Exception{
+ return runWorkflow(workflowTemplateId,inputs,getRegistry().getUsername(),null);
}
-
+
/**
- * Execute the given workflow template with the given inputs, user, metadata
- * and return the topic id
- *
+ * Execute the given workflow template with the given inputs, user, metadata and return the topic id
* @param workflowTemplateId
* @param inputs
* @param user
@@ -515,33 +495,29 @@ public class AiravataClient {
* @return
* @throws Exception
*/
- public String runWorkflow(String workflowTemplateId,
- List<WorkflowInput> inputs, String user, String metadata)
- throws Exception {
+ public String runWorkflow(String workflowTemplateId,List<WorkflowInput> inputs, String user, String metadata) throws Exception{
try {
List<WSComponentPort> ports = getWSComponentPortInputs(workflowTemplateId);
for (WorkflowInput input : inputs) {
- WSComponentPort port = getWSComponentPort(input.getName(),
- ports);
- if (port != null) {
+ WSComponentPort port = getWSComponentPort(input.getName(), ports);
+ if (port!=null){
port.setValue(input.getValue());
}
}
- List<NameValue> inputValues = new ArrayList<NameValue>();
+ List<NameValue> inputValues=new ArrayList<NameValue>();
for (WSComponentPort port : ports) {
NameValue nameValue = new NameValue();
nameValue.setName(port.getName());
- if (port.getValue() == null) {
+ if (port.getValue()==null){
nameValue.setValue(port.getDefaultValue());
- } else {
+ }else{
nameValue.setValue(port.getValue().toString());
}
inputValues.add(nameValue);
}
- workflow = getWorkflowAsString(workflowTemplateId).getString();
- String topic = workflowTemplateId + "_" + UUID.randomUUID();
- return runWorkflow(topic, inputValues.toArray(new NameValue[] {}),
- user, metadata);
+ workflow=getWorkflowAsString(workflowTemplateId).getString();
+ String topic=workflowTemplateId+"_"+UUID.randomUUID();
+ return runWorkflow(topic, inputValues.toArray(new NameValue[]{}), user, metadata);
} catch (PathNotFoundException e) {
e.printStackTrace();
} catch (RegistryException e) {
@@ -553,22 +529,18 @@ public class AiravataClient {
}
return null;
}
-
+
/**
* Retrieve the inputs for the given workflow template
- *
* @param workflowTemplateId
* @return
*/
- public List<WorkflowInput> getWorkflowInputs(String workflowTemplateId)
- throws Exception {
+ public List<WorkflowInput> getWorkflowInputs(String workflowTemplateId) throws Exception{
try {
List<WSComponentPort> inputs = getWSComponentPortInputs(workflowTemplateId);
- List<WorkflowInput> results = new ArrayList<WorkflowInput>();
+ List<WorkflowInput> results=new ArrayList<WorkflowInput>();
for (WSComponentPort port : inputs) {
- results.add(new WorkflowInput(port.getName(), port.getType()
- .getLocalPart(), port.getDefaultValue(), port
- .getValue()));
+ results.add(new WorkflowInput(port.getName(), port.getType().getLocalPart(), port.getDefaultValue(), port.getValue()));
}
return results;
} catch (RegistryException e) {
@@ -584,15 +556,15 @@ public class AiravataClient {
public Property getWorkflowAsString(String workflowTemplateId)
throws RegistryException, PathNotFoundException,
RepositoryException {
- Map<QName, Node> workflows = getRegistry().getWorkflows(
- getClientConfiguration().getJcrUsername());
+ Map<QName, Node> workflows = getRegistry().getWorkflows(getClientConfiguration().getJcrUsername());
for (QName qname : workflows.keySet()) {
- if (qname.getLocalPart().equals(workflowTemplateId)) {
+ if (qname.getLocalPart().equals(workflowTemplateId)){
return workflows.get(qname).getProperty("workflow");
}
}
return null;
}
+
private List<WSComponentPort> getWSComponentPortInputs(
String workflowTemplateId) throws RegistryException,
@@ -604,15 +576,15 @@ public class AiravataClient {
List<WSComponentPort> inputs = workflow.getInputs();
return inputs;
}
-
- private WSComponentPort getWSComponentPort(String name,
- List<WSComponentPort> ports) {
+
+ private WSComponentPort getWSComponentPort(String name,List<WSComponentPort> ports){
for (WSComponentPort port : ports) {
- if (port.getName().equals(name)) {
+ if (port.getName().equals(name)){
return port;
}
}
return null;
}
+
}
Modified: incubator/airavata/trunk/modules/commons/workflow-execution-context/src/main/java/org/apache/airavata/common/workflow/execution/context/WorkflowContextHeaderBuilder.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/commons/workflow-execution-context/src/main/java/org/apache/airavata/common/workflow/execution/context/WorkflowContextHeaderBuilder.java?rev=1336282&r1=1336281&r2=1336282&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/commons/workflow-execution-context/src/main/java/org/apache/airavata/common/workflow/execution/context/WorkflowContextHeaderBuilder.java (original)
+++ incubator/airavata/trunk/modules/commons/workflow-execution-context/src/main/java/org/apache/airavata/common/workflow/execution/context/WorkflowContextHeaderBuilder.java Wed May 9 16:25:25 2012
@@ -42,7 +42,7 @@ public class WorkflowContextHeaderBuilde
private WorkflowSchedulingContextDocument.WorkflowSchedulingContext workflowSchedulingContext = null;
public WorkflowContextHeaderBuilder(String brokerUrl, String gfacUrl, String registryUrl, String experimentId,
- String workflowId) {
+ String workflowId, String msgBoxUrl) {
this.contextHeader = ContextHeaderDocument.ContextHeader.Factory.newInstance();
this.soaServiceEprs = SoaServiceEprsDocument.SoaServiceEprs.Factory.newInstance();
@@ -54,7 +54,7 @@ public class WorkflowContextHeaderBuilde
this.workflowMonitoringContext.setEventPublishEpr(brokerUrl);
this.workflowMonitoringContext.setWorkflowInstanceId(workflowId);
this.workflowMonitoringContext.setExperimentId(experimentId);
-
+ this.workflowMonitoringContext.setMsgBoxEpr(msgBoxUrl);
this.contextHeader.setWorkflowMonitoringContext(this.workflowMonitoringContext);
this.contextHeader.setSoaServiceEprs(this.soaServiceEprs);
Modified: incubator/airavata/trunk/modules/commons/workflow-execution-context/src/main/resources/workflow_execution_context.xsd
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/commons/workflow-execution-context/src/main/resources/workflow_execution_context.xsd?rev=1336282&r1=1336281&r2=1336282&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/commons/workflow-execution-context/src/main/resources/workflow_execution_context.xsd (original)
+++ incubator/airavata/trunk/modules/commons/workflow-execution-context/src/main/resources/workflow_execution_context.xsd Wed May 9 16:25:25 2012
@@ -196,6 +196,17 @@
</documentation>
</annotation>
</element>
+ <element name="msg-box-epr" type="anyURI">
+ <annotation>
+ <documentation xml:lang="en"> EPR for WS-Eventing sink
+ where to send errors (optional)
+ NOTE: designed good
+ for debugging
+ and system level warnings, errors,
+ etc
+ </documentation>
+ </annotation>
+ </element>
</sequence>
</complexType>
</element>
Modified: incubator/airavata/trunk/modules/commons/workflow-execution-context/src/test/java/org/apache/airavata/common/workflow/execution/context/WorkflowContextHeaderBuilderTest.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/commons/workflow-execution-context/src/test/java/org/apache/airavata/common/workflow/execution/context/WorkflowContextHeaderBuilderTest.java?rev=1336282&r1=1336281&r2=1336282&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/commons/workflow-execution-context/src/test/java/org/apache/airavata/common/workflow/execution/context/WorkflowContextHeaderBuilderTest.java (original)
+++ incubator/airavata/trunk/modules/commons/workflow-execution-context/src/test/java/org/apache/airavata/common/workflow/execution/context/WorkflowContextHeaderBuilderTest.java Wed May 9 16:25:25 2012
@@ -21,7 +21,6 @@
package org.apache.airavata.common.workflow.execution.context;
import org.apache.airavata.common.utils.XMLUtil;
-import org.junit.Assert;
import org.junit.Test;
import java.io.File;
@@ -30,7 +29,7 @@ public class WorkflowContextHeaderBuilde
@Test
public void testExecute() {
WorkflowContextHeaderBuilder builder = new WorkflowContextHeaderBuilder("brokerurl", "gfacurl", "registryurl",
- "experimentid", "workflowid");
+ "experimentid", "workflowid", "msgBox");
try {
File testFile = new File(this.getClass().getClassLoader().getResource("result.xml").getPath());
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=1336282&r1=1336281&r2=1336282&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 May 9 16:25:25 2012
@@ -30,9 +30,11 @@ import java.util.*;
import org.apache.airavata.common.registry.api.exception.RegistryException;
import org.apache.airavata.common.registry.api.impl.JCRRegistry;
import org.apache.airavata.common.utils.XMLUtil;
+import org.apache.airavata.common.workflow.execution.context.WorkflowContextHeaderBuilder;
import org.apache.airavata.commons.gfac.type.HostDescription;
import org.apache.airavata.schemas.gfac.GlobusHostType;
import org.apache.airavata.schemas.gfac.HostDescriptionType;
+import org.apache.airavata.schemas.wec.ContextHeaderDocument;
import org.apache.airavata.xbaya.XBayaConfiguration;
import org.apache.airavata.xbaya.XBayaConstants;
import org.apache.airavata.xbaya.XBayaException;
@@ -47,10 +49,13 @@ import org.apache.airavata.xbaya.ode.ODE
import org.apache.airavata.xbaya.wf.Workflow;
import org.apache.axiom.om.OMElement;
import org.apache.axiom.om.impl.builder.StAXOMBuilder;
+import org.apache.axiom.om.impl.llom.util.AXIOMUtil;
+import org.apache.axiom.soap.SOAPHeader;
import org.apache.axis2.context.ConfigurationContext;
import org.apache.axis2.context.MessageContext;
import org.apache.axis2.description.AxisService;
import org.apache.axis2.engine.ServiceLifeCycle;
+import org.apache.xmlbeans.XmlException;
import org.apache.xmlbeans.XmlObject;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
@@ -182,13 +187,29 @@ public class WorkflowInterpretorSkeleton
* @param configurations
*/
- public java.lang.String launchWorkflow(java.lang.String workflowAsString, java.lang.String topic, NameValue[] inputs) {
+ public java.lang.String launchWorkflow(java.lang.String workflowAsString, java.lang.String topic, NameValue[] inputs) throws XMLStreamException {
MessageContext currentMessageContext = MessageContext.getCurrentMessageContext();
+ SOAPHeader header = currentMessageContext.getEnvelope().getHeader();
+ Iterator childrenWithName = header.getChildrenWithName(new QName("http://schemas.airavata.apache.org/workflow-execution-context", "context-header"));
+ OMElement workflowContext = (OMElement)childrenWithName.next();
Map<String, String> configuration = new HashMap<String, String>();
+ parseContextHeader(workflowContext, configuration);
return setupAndLaunch(workflowAsString, topic,
(String)configurationContext.getProperty(MYPROXY_USER),(String)configurationContext.getProperty(MYPROXY_PASS),inputs,configuration,runInThread);
}
+ private void parseContextHeader(OMElement workflowContext, Map<String, String> configuration) throws XMLStreamException {
+ try {
+ ContextHeaderDocument parse = ContextHeaderDocument.Factory.parse(workflowContext.toStringWithConsume());
+ configuration.put(GFAC,parse.getContextHeader().getWorkflowMonitoringContext().getEventPublishEpr());
+ configuration.put(BROKER, parse.getContextHeader().getWorkflowMonitoringContext().getEventPublishEpr());
+ configuration.put(GFAC, parse.getContextHeader().getSoaServiceEprs().getGfacUrl());
+ configuration.put(MSGBOX, parse.getContextHeader().getWorkflowMonitoringContext().getMsgBoxEpr());
+ } catch (XmlException e) {
+ e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
+ }
+ }
+
private String setupAndLaunch(String workflowAsString, String topic, String password, String username, NameValue[] inputs,Map<String,String>configurations,boolean inNewThread) {
System.err.println("Launch is called for topi:");
@@ -290,7 +311,6 @@ public class WorkflowInterpretorSkeleton
public XBayaConfiguration getConfiguration(Map<String,String> 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);
Modified: incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/invoker/GenericInvoker.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/invoker/GenericInvoker.java?rev=1336282&r1=1336281&r2=1336282&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/invoker/GenericInvoker.java (original)
+++ incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/invoker/GenericInvoker.java Wed May 9 16:25:25 2012
@@ -222,7 +222,8 @@ public class GenericInvoker implements I
// Set LEAD context header.
WorkflowContextHeaderBuilder builder = new WorkflowContextHeaderBuilder(this.notifier.getEventSink()
- .getAddress(), this.gfacURL, null, this.notifier.getWorkflowID().toASCIIString(), "xbaya-experiment");
+ .getAddress(), this.gfacURL, null, this.notifier.getWorkflowID().toASCIIString(),
+ "xbaya-experiment", this.messageBoxURL);
builder.getWorkflowMonitoringContext().setServiceInstanceId(this.nodeID);
builder.getWorkflowMonitoringContext().setWorkflowNodeId(this.nodeID);
builder.getWorkflowMonitoringContext().setWorkflowInstanceId(this.notifier.getWorkflowID().toASCIIString());