airavata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From samin...@apache.org
Subject svn commit: r1353765 - in /incubator/airavata/branches/0.3-incubating-snapshot/modules: airavata-client/src/main/java/org/apache/airavata/client/airavata/ commons/registry-api/src/main/java/org/apache/airavata/registry/api/ commons/registry-api/src/mai...
Date Mon, 25 Jun 2012 22:30:51 GMT
Author: samindaw
Date: Mon Jun 25 22:30:50 2012
New Revision: 1353765

URL: http://svn.apache.org/viewvc?rev=1353765&view=rev
Log:
introducing workflow execution name for workflow execution

Modified:
    incubator/airavata/branches/0.3-incubating-snapshot/modules/airavata-client/src/main/java/org/apache/airavata/client/airavata/AiravataClient.java
    incubator/airavata/branches/0.3-incubating-snapshot/modules/commons/registry-api/src/main/java/org/apache/airavata/registry/api/AiravataRegistry.java
    incubator/airavata/branches/0.3-incubating-snapshot/modules/commons/registry-api/src/main/java/org/apache/airavata/registry/api/WorkflowExecution.java
    incubator/airavata/branches/0.3-incubating-snapshot/modules/commons/registry-api/src/main/java/org/apache/airavata/registry/api/impl/AiravataJCRRegistry.java
    incubator/airavata/branches/0.3-incubating-snapshot/modules/commons/registry-api/src/main/java/org/apache/airavata/registry/api/impl/WorkflowExecutionImpl.java

Modified: incubator/airavata/branches/0.3-incubating-snapshot/modules/airavata-client/src/main/java/org/apache/airavata/client/airavata/AiravataClient.java
URL: http://svn.apache.org/viewvc/incubator/airavata/branches/0.3-incubating-snapshot/modules/airavata-client/src/main/java/org/apache/airavata/client/airavata/AiravataClient.java?rev=1353765&r1=1353764&r2=1353765&view=diff
==============================================================================
--- incubator/airavata/branches/0.3-incubating-snapshot/modules/airavata-client/src/main/java/org/apache/airavata/client/airavata/AiravataClient.java
(original)
+++ incubator/airavata/branches/0.3-incubating-snapshot/modules/airavata-client/src/main/java/org/apache/airavata/client/airavata/AiravataClient.java
Mon Jun 25 22:30:50 2012
@@ -285,10 +285,10 @@ public class AiravataClient {
 	}
 
 	public String runWorkflow(String topic, String user) {
-		return runWorkflow(topic, user, null);
+		return runWorkflow(topic, user, null, topic);
 	}
 
-	public String runWorkflow(String topic, String user, String metadata) {
+	public String runWorkflow(String topic, String user, String metadata, String workflowInstanceName)
{
         String worflowoutput = null;
                 try {
                     WorkflowInterpretorStub stub = new WorkflowInterpretorStub(
@@ -296,7 +296,7 @@ public class AiravataClient {
                     OMElement omElement = AXIOMUtil.stringToOM(XMLUtil.xmlElementToString(builder.getXml()));
                     stub._getServiceClient().addHeader(omElement);
                     worflowoutput = stub.launchWorkflow(workflow, topic,null);
-                    runPreWorkflowExecutionTasks(worflowoutput, user, metadata);
+                    runPreWorkflowExecutionTasks(worflowoutput, user, metadata, workflowInstanceName);
 
                 } catch (AxisFault e) {
 		} catch (RemoteException e) {
@@ -342,13 +342,18 @@ public class AiravataClient {
     }
     
 	private void runPreWorkflowExecutionTasks(String topic, String user,
-			String metadata) throws RegistryException {
+			String metadata,String workflowInstanceName) throws RegistryException {
 		if (user != null) {
 			getRegistry().saveWorkflowExecutionUser(topic, user);
 		}
 		if (metadata != null) {
 			getRegistry().saveWorkflowExecutionMetadata(topic, metadata);
 		}
+		
+		if (workflowInstanceName!=null) {
+			getRegistry().saveWorkflowExecutionName(topic, workflowInstanceName);
+		}
+	
 	}
 
 	public String runWorkflow(String topic, NameValue[] inputs) throws Exception {
@@ -356,17 +361,17 @@ public class AiravataClient {
 	}
 
 	public String runWorkflow(String topic, NameValue[] inputs, String user) throws Exception
{
-		return runWorkflow(topic, inputs, user, null);
+		return runWorkflow(topic, inputs, user, null,topic);
 	}
 
 	public String runWorkflow(String topic, NameValue[] inputs, String user,
-			String metadata) throws Exception{
+			String metadata,String workflowInstanceName) throws Exception{
 		String worflowoutput = null;
 		try {
 			WorkflowInterpretorStub stub = new WorkflowInterpretorStub(
 					getClientConfiguration().getXbayaServiceURL().toString());
             stub._getServiceClient().addHeader(AXIOMUtil.stringToOM(XMLUtil.xmlElementToString(builder.getXml())));
-			runPreWorkflowExecutionTasks(topic, user, metadata);
+			runPreWorkflowExecutionTasks(topic, user, metadata,workflowInstanceName);
 			worflowoutput = stub.launchWorkflow(workflow, topic, inputs);
 //			log.info("Workflow output : " + worflowoutput);
 		} catch (RegistryException e) {
@@ -500,8 +505,8 @@ public class AiravataClient {
 	 * @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,String
workflowInstanceName) throws Exception{
+		return runWorkflow(workflowTemplateId,inputs,getRegistry().getUsername(),null,workflowInstanceName);
 	}
 	
 	/**
@@ -513,7 +518,7 @@ 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, String workflowInstanceName) throws Exception{
 		try {
 			List<WSComponentPort> ports = getWSComponentPortInputs(workflowTemplateId);
 			for (WorkflowInput input : inputs) {
@@ -535,7 +540,7 @@ public class AiravataClient {
 			}
 			workflow=getWorkflowAsString(workflowTemplateId).getString();
 			String topic=workflowTemplateId+"_"+UUID.randomUUID();
-			return runWorkflow(topic, inputValues.toArray(new NameValue[]{}), user, metadata);
+			return runWorkflow(topic, inputValues.toArray(new NameValue[]{}), user, metadata, workflowInstanceName);
 		} catch (PathNotFoundException e) {
 			e.printStackTrace();
 		} catch (RegistryException e) {

Modified: incubator/airavata/branches/0.3-incubating-snapshot/modules/commons/registry-api/src/main/java/org/apache/airavata/registry/api/AiravataRegistry.java
URL: http://svn.apache.org/viewvc/incubator/airavata/branches/0.3-incubating-snapshot/modules/commons/registry-api/src/main/java/org/apache/airavata/registry/api/AiravataRegistry.java?rev=1353765&r1=1353764&r2=1353765&view=diff
==============================================================================
--- incubator/airavata/branches/0.3-incubating-snapshot/modules/commons/registry-api/src/main/java/org/apache/airavata/registry/api/AiravataRegistry.java
(original)
+++ incubator/airavata/branches/0.3-incubating-snapshot/modules/commons/registry-api/src/main/java/org/apache/airavata/registry/api/AiravataRegistry.java
Mon Jun 25 22:30:50 2012
@@ -225,6 +225,8 @@ public interface AiravataRegistry extend
 
     public boolean saveWorkflowExecutionStatus(String experimentId,WorkflowExecutionStatus
status)throws RegistryException;
     
+    public boolean saveWorkflowExecutionName(String experimentId,String workflowIntanceName)throws
RegistryException;
+    
     public boolean saveWorkflowExecutionStatus(String experimentId,ExecutionStatus status)throws
RegistryException;
 
     public WorkflowExecutionStatus getWorkflowExecutionStatus(String experimentId)throws
RegistryException;
@@ -243,6 +245,8 @@ public interface AiravataRegistry extend
     
     public String getWorkflowExecutionUser(String experimentId) throws RegistryException;
     
+    public String getWorkflowExecutionName(String experimentId) throws RegistryException;
+    
     public WorkflowExecution getWorkflowExecution(String experimentId) throws RegistryException;
     
     public List<String> getWorkflowExecutionIdByUser(String user) throws RegistryException;

Modified: incubator/airavata/branches/0.3-incubating-snapshot/modules/commons/registry-api/src/main/java/org/apache/airavata/registry/api/WorkflowExecution.java
URL: http://svn.apache.org/viewvc/incubator/airavata/branches/0.3-incubating-snapshot/modules/commons/registry-api/src/main/java/org/apache/airavata/registry/api/WorkflowExecution.java?rev=1353765&r1=1353764&r2=1353765&view=diff
==============================================================================
--- incubator/airavata/branches/0.3-incubating-snapshot/modules/commons/registry-api/src/main/java/org/apache/airavata/registry/api/WorkflowExecution.java
(original)
+++ incubator/airavata/branches/0.3-incubating-snapshot/modules/commons/registry-api/src/main/java/org/apache/airavata/registry/api/WorkflowExecution.java
Mon Jun 25 22:30:50 2012
@@ -38,6 +38,7 @@ public interface WorkflowExecution {
 	public WorkflowServiceIOData getServiceOutput(String nodeId);
 	public WorkflowIOData getOutput(String nodeId);
 	public String getMetadata();
+	public String getWorkflowInstanceName();
 
 	public void setExperimentId(String experimentId);
 	public void setTopic(String topic);
@@ -50,4 +51,5 @@ public interface WorkflowExecution {
 	public void addServiceOutput(WorkflowServiceIOData serviceOutput);
 	public void addOutput(WorkflowIOData output);
 	public void setMetadata(String metadata);
+	public void setWorkflowInstanceName(String workflowInstanceName);
 }

Modified: incubator/airavata/branches/0.3-incubating-snapshot/modules/commons/registry-api/src/main/java/org/apache/airavata/registry/api/impl/AiravataJCRRegistry.java
URL: http://svn.apache.org/viewvc/incubator/airavata/branches/0.3-incubating-snapshot/modules/commons/registry-api/src/main/java/org/apache/airavata/registry/api/impl/AiravataJCRRegistry.java?rev=1353765&r1=1353764&r2=1353765&view=diff
==============================================================================
--- incubator/airavata/branches/0.3-incubating-snapshot/modules/commons/registry-api/src/main/java/org/apache/airavata/registry/api/impl/AiravataJCRRegistry.java
(original)
+++ incubator/airavata/branches/0.3-incubating-snapshot/modules/commons/registry-api/src/main/java/org/apache/airavata/registry/api/impl/AiravataJCRRegistry.java
Mon Jun 25 22:30:50 2012
@@ -78,6 +78,7 @@ public class AiravataJCRRegistry extends
     public static final String WORKFLOW_STATUS_PROPERTY = "Status";
     public static final String WORKFLOW_STATUS_TIME_PROPERTY = "Status_Time";
     public static final String WORKFLOW_METADATA_PROPERTY = "Metadata";
+    public static final String WORKFLOW_INSTANCE_NAME_PROPERTY = "Worflow_instace_name";
     public static final String WORKFLOW_USER_PROPERTY = "User";
 
     private static Logger log = LoggerFactory.getLogger(AiravataJCRRegistry.class);
@@ -1132,6 +1133,7 @@ public class AiravataJCRRegistry extends
 		workflowExecution.setExecutionStatus(getWorkflowExecutionStatus(experimentId));
 		workflowExecution.setUser(getWorkflowExecutionUser(experimentId));
 		workflowExecution.setMetadata(getWorkflowExecutionMetadata(experimentId));
+		workflowExecution.setWorkflowInstanceName(getWorkflowExecutionName(experimentId));
 		workflowExecution.setOutput(getWorkflowExecutionOutput(experimentId));
 		workflowExecution.setServiceInput(searchWorkflowExecutionServiceInput(experimentId,".*",".*"));
 		workflowExecution.setServiceOutput(searchWorkflowExecutionServiceOutput(experimentId,".*",".*"));
@@ -1240,4 +1242,44 @@ public class AiravataJCRRegistry extends
 			ExecutionStatus status) throws RegistryException {
 		return saveWorkflowExecutionStatus(experimentId,new WorkflowExecutionStatus(status));
 	}
+
+	@Override
+	public boolean saveWorkflowExecutionName(String experimentId,
+			String workflowIntanceName) throws RegistryException {
+		Session session = null;
+        boolean isSaved = true;
+        try {
+            session = getSession();
+            Node workflowDataNode = getWorkflowExperimentDataNode(experimentId, session);
+            workflowDataNode.setProperty(WORKFLOW_INSTANCE_NAME_PROPERTY,workflowIntanceName);
+            session.save();
+        } catch (Exception e) {
+            isSaved = false;
+            e.printStackTrace();
+        } finally {
+            closeSession(session);
+        }
+        return isSaved;
+	}
+
+	@Override
+	public String getWorkflowExecutionName(String experimentId)
+			throws RegistryException {
+		Session session = null;
+    	String property = null;
+        try {
+            session = getSession();
+            Node workflowDataNode = getWorkflowExperimentDataNode(experimentId, session);
+            if (workflowDataNode.hasProperty(WORKFLOW_INSTANCE_NAME_PROPERTY)) {
+				property = workflowDataNode.getProperty(
+						WORKFLOW_INSTANCE_NAME_PROPERTY).getString();
+			}
+			session.save();
+        } catch (Exception e) {
+            throw new RegistryException("Error while retrieving workflow metadata!!!", e);
+        } finally {
+            closeSession(session);
+        }
+        return property;
+	}
 }

Modified: incubator/airavata/branches/0.3-incubating-snapshot/modules/commons/registry-api/src/main/java/org/apache/airavata/registry/api/impl/WorkflowExecutionImpl.java
URL: http://svn.apache.org/viewvc/incubator/airavata/branches/0.3-incubating-snapshot/modules/commons/registry-api/src/main/java/org/apache/airavata/registry/api/impl/WorkflowExecutionImpl.java?rev=1353765&r1=1353764&r2=1353765&view=diff
==============================================================================
--- incubator/airavata/branches/0.3-incubating-snapshot/modules/commons/registry-api/src/main/java/org/apache/airavata/registry/api/impl/WorkflowExecutionImpl.java
(original)
+++ incubator/airavata/branches/0.3-incubating-snapshot/modules/commons/registry-api/src/main/java/org/apache/airavata/registry/api/impl/WorkflowExecutionImpl.java
Mon Jun 25 22:30:50 2012
@@ -37,6 +37,7 @@ public class WorkflowExecutionImpl imple
 	private List<WorkflowIOData> output;
 	private String experimentId;
 	private String metadata;
+	private String workflowInstanceName;
 	
 	public String getMetadata() {
 		return metadata;
@@ -125,4 +126,13 @@ public class WorkflowExecutionImpl imple
 		}
 		return null;
 	}
+	@Override
+	public String getWorkflowInstanceName() {
+		return workflowInstanceName;
+	}
+	@Override
+	public void setWorkflowInstanceName(String workflowInstanceName) {
+		this.workflowInstanceName=workflowInstanceName;
+		
+	}
 }



Mime
View raw message