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/14 22:50:06 UTC
svn commit: r1338395 -
/incubator/airavata/trunk/modules/commons/workflow-execution-context/src/main/java/org/apache/airavata/common/workflow/execution/context/WorkflowContextHeaderBuilder.java
Author: lahiru
Date: Mon May 14 20:50:05 2012
New Revision: 1338395
URL: http://svn.apache.org/viewvc?rev=1338395&view=rev
Log:
Fixing Context header.
Modified:
incubator/airavata/trunk/modules/commons/workflow-execution-context/src/main/java/org/apache/airavata/common/workflow/execution/context/WorkflowContextHeaderBuilder.java
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=1338395&r1=1338394&r2=1338395&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 Mon May 14 20:50:05 2012
@@ -37,10 +37,18 @@ public class WorkflowContextHeaderBuilde
private WorkflowOutputDataHandlingDocument.WorkflowOutputDataHandling workflowOutputDataHandling = null;
- private ContextHeaderDocument.ContextHeader contextHeader = null;
+ private ContextHeaderDocument.ContextHeader contextHeader = null;
private WorkflowSchedulingContextDocument.WorkflowSchedulingContext workflowSchedulingContext = null;
+ private ThreadLocal threadLocal = null;
+
+ public static ThreadLocal<ContextHeaderDocument.ContextHeader> currentContextHeader = new ThreadLocal<ContextHeaderDocument.ContextHeader>();
+
+
+ public WorkflowContextHeaderBuilder(ContextHeaderDocument.ContextHeader document){
+ this.contextHeader = document;
+ }
public WorkflowContextHeaderBuilder(String brokerUrl, String gfacUrl, String registryUrl, String experimentId,
String workflowId, String msgBoxUrl) {
this.contextHeader = ContextHeaderDocument.ContextHeader.Factory.newInstance();
@@ -49,6 +57,25 @@ public class WorkflowContextHeaderBuilde
this.soaServiceEprs.setGfacUrl(gfacUrl);
this.soaServiceEprs.setRegistryUrl(registryUrl);
+ addWorkflowMonitoringContext(brokerUrl, experimentId, workflowId, msgBoxUrl);
+ this.contextHeader.setSoaServiceEprs(this.soaServiceEprs);
+
+ this.contextHeader.setSecurityContext(SecurityContextDocument.SecurityContext.Factory.newInstance());
+ this.contextHeader
+ .setWorkflowSchedulingContext(WorkflowSchedulingContextDocument.WorkflowSchedulingContext.Factory
+ .newInstance());
+ threadLocal = new ThreadLocal();
+ threadLocal.set(contextHeader);
+ }
+
+ public static void setCurrentContextHeader(ContextHeaderDocument.ContextHeader contextHeader){
+ currentContextHeader.set(contextHeader);
+ }
+
+ public static ContextHeaderDocument.ContextHeader getCurrentContextHeader(){
+ return currentContextHeader.get();
+ }
+ public void addWorkflowMonitoringContext(String brokerUrl, String experimentId, String workflowId, String msgBoxUrl) {
this.workflowMonitoringContext = WorkflowMonitoringContextDocument.WorkflowMonitoringContext.Factory
.newInstance();
this.workflowMonitoringContext.setEventPublishEpr(brokerUrl);
@@ -56,12 +83,6 @@ public class WorkflowContextHeaderBuilde
this.workflowMonitoringContext.setExperimentId(experimentId);
this.workflowMonitoringContext.setMsgBoxEpr(msgBoxUrl);
this.contextHeader.setWorkflowMonitoringContext(this.workflowMonitoringContext);
- this.contextHeader.setSoaServiceEprs(this.soaServiceEprs);
-
- this.contextHeader.setSecurityContext(SecurityContextDocument.SecurityContext.Factory.newInstance());
- this.contextHeader
- .setWorkflowSchedulingContext(WorkflowSchedulingContextDocument.WorkflowSchedulingContext.Factory
- .newInstance());
}
public WorkflowContextHeaderBuilder setWorkflowMonitoringContext(
@@ -127,12 +148,24 @@ public class WorkflowContextHeaderBuilde
public XmlElement getXml() {
ContextHeaderDocument document = ContextHeaderDocument.Factory.newInstance();
- this.contextHeader.setWorkflowMonitoringContext(this.workflowMonitoringContext);
- this.contextHeader.setSoaServiceEprs(this.soaServiceEprs);
- this.contextHeader.setSecurityContext(this.securityContext);
- this.contextHeader.setWorkflowSchedulingContext(this.workflowSchedulingContext);
- this.contextHeader.setUserIdentifier(this.userIdentifier);
- this.contextHeader.setWorkflowOutputDataHandling(this.workflowOutputDataHandling);
+ if (this.workflowMonitoringContext != null) {
+ this.contextHeader.setWorkflowMonitoringContext(this.workflowMonitoringContext);
+ }
+ if (this.soaServiceEprs != null) {
+ this.contextHeader.setSoaServiceEprs(this.soaServiceEprs);
+ }
+ if (this.securityContext != null) {
+ this.contextHeader.setSecurityContext(this.securityContext);
+ }
+ if (this.workflowSchedulingContext != null) {
+ this.contextHeader.setWorkflowSchedulingContext(this.workflowSchedulingContext);
+ }
+ if (this.userIdentifier != null) {
+ this.contextHeader.setUserIdentifier(this.userIdentifier);
+ }
+ if (this.workflowOutputDataHandling != null) {
+ this.contextHeader.setWorkflowOutputDataHandling(this.workflowOutputDataHandling);
+ }
document.setContextHeader(this.contextHeader);
return XMLUtil.stringToXmlElement3(document.xmlText());
}