You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airavata.apache.org by sa...@apache.org on 2012/01/21 00:14:51 UTC

svn commit: r1234199 - in /incubator/airavata/trunk/modules: commons/registry-api/src/main/java/org/apache/airavata/registry/api/ commons/registry-api/src/main/java/org/apache/airavata/registry/api/impl/ xbaya-gui/src/main/java/org/apache/airavata/xbay...

Author: samindaw
Date: Fri Jan 20 23:14:50 2012
New Revision: 1234199

URL: http://svn.apache.org/viewvc?rev=1234199&view=rev
Log:
updating airavata registry api to save status through the enum

Modified:
    incubator/airavata/trunk/modules/commons/registry-api/src/main/java/org/apache/airavata/registry/api/AiravataRegistry.java
    incubator/airavata/trunk/modules/commons/registry-api/src/main/java/org/apache/airavata/registry/api/WorkflowExecutionStatus.java
    incubator/airavata/trunk/modules/commons/registry-api/src/main/java/org/apache/airavata/registry/api/impl/AiravataJCRRegistry.java
    incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/interpretor/WorkflowInterpreter.java

Modified: incubator/airavata/trunk/modules/commons/registry-api/src/main/java/org/apache/airavata/registry/api/AiravataRegistry.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/commons/registry-api/src/main/java/org/apache/airavata/registry/api/AiravataRegistry.java?rev=1234199&r1=1234198&r2=1234199&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/commons/registry-api/src/main/java/org/apache/airavata/registry/api/AiravataRegistry.java (original)
+++ incubator/airavata/trunk/modules/commons/registry-api/src/main/java/org/apache/airavata/registry/api/AiravataRegistry.java Fri Jan 20 23:14:50 2012
@@ -33,6 +33,7 @@ import org.apache.airavata.common.regist
 import org.apache.airavata.commons.gfac.type.ApplicationDeploymentDescription;
 import org.apache.airavata.commons.gfac.type.HostDescription;
 import org.apache.airavata.commons.gfac.type.ServiceDescription;
+import org.apache.airavata.registry.api.WorkflowExecutionStatus.ExecutionStatus;
 import org.apache.airavata.registry.api.exception.DeploymentDescriptionRetrieveException;
 import org.apache.airavata.registry.api.exception.HostDescriptionRetrieveException;
 import org.apache.airavata.registry.api.exception.ServiceDescriptionRetrieveException;
@@ -222,7 +223,9 @@ public interface AiravataRegistry extend
 
     public List<WorkflowServiceIOData> searchWorkflowExecutionServiceOutput(String experimentIdRegEx, String workflowNameRegEx, String nodeNameRegEx)throws RegistryException;
 
-    public boolean saveWorkflowExecutionStatus(String experimentId,String status)throws RegistryException;
+    public boolean saveWorkflowExecutionStatus(String experimentId,WorkflowExecutionStatus status)throws RegistryException;
+    
+    public boolean saveWorkflowExecutionStatus(String experimentId,ExecutionStatus status)throws RegistryException;
 
     public WorkflowExecutionStatus getWorkflowExecutionStatus(String experimentId)throws RegistryException;
 

Modified: incubator/airavata/trunk/modules/commons/registry-api/src/main/java/org/apache/airavata/registry/api/WorkflowExecutionStatus.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/commons/registry-api/src/main/java/org/apache/airavata/registry/api/WorkflowExecutionStatus.java?rev=1234199&r1=1234198&r2=1234199&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/commons/registry-api/src/main/java/org/apache/airavata/registry/api/WorkflowExecutionStatus.java (original)
+++ incubator/airavata/trunk/modules/commons/registry-api/src/main/java/org/apache/airavata/registry/api/WorkflowExecutionStatus.java Fri Jan 20 23:14:50 2012
@@ -28,7 +28,8 @@ public class WorkflowExecutionStatus {
 		STARTED,
 		RUNNING,
 		ERROR,
-		STOPPED,
+		PAUSED,
+		FINISHED,
 		UNKNOWN
 	}
 

Modified: incubator/airavata/trunk/modules/commons/registry-api/src/main/java/org/apache/airavata/registry/api/impl/AiravataJCRRegistry.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/commons/registry-api/src/main/java/org/apache/airavata/registry/api/impl/AiravataJCRRegistry.java?rev=1234199&r1=1234198&r2=1234199&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/commons/registry-api/src/main/java/org/apache/airavata/registry/api/impl/AiravataJCRRegistry.java (original)
+++ incubator/airavata/trunk/modules/commons/registry-api/src/main/java/org/apache/airavata/registry/api/impl/AiravataJCRRegistry.java Fri Jan 20 23:14:50 2012
@@ -890,13 +890,19 @@ public class AiravataJCRRegistry extends
         return workflowIODataList;
     }
 
-    public boolean saveWorkflowExecutionStatus(String experimentId,String status)throws RegistryException{
+    public boolean saveWorkflowExecutionStatus(String experimentId,WorkflowExecutionStatus status)throws RegistryException{
         Session session = null;
         boolean isSaved = true;
         try {
             session = getSession();
             Node workflowDataNode = getWorkflowExperimentDataNode(experimentId, session);
-            workflowDataNode.setProperty(WORKFLOW_STATUS_PROPERTY,status);
+            workflowDataNode.setProperty(WORKFLOW_STATUS_PROPERTY,status.getExecutionStatus().name());
+            Date time = status.getStatusUpdateTime();
+            if (time==null){
+            	time=Calendar.getInstance(TimeZone.getTimeZone("UTC")).getTime();
+            }
+            //TODO is saving the datetime following format ok?
+			workflowDataNode.setProperty(WORKFLOW_STATUS_TIME_PROPERTY,time.getTime());
             session.save();
         } catch (Exception e) {
             isSaved = false;
@@ -914,10 +920,13 @@ public class AiravataJCRRegistry extends
             session = getSession();
             Node workflowDataNode = getWorkflowExperimentDataNode(experimentId, session);
             ExecutionStatus status = ExecutionStatus.valueOf(workflowDataNode.getProperty(WORKFLOW_STATUS_PROPERTY).getString());
-            String dateString = workflowDataNode.getProperty(WORKFLOW_STATUS_TIME_PROPERTY).getString();
+            Property prop = workflowDataNode.getProperty(WORKFLOW_STATUS_TIME_PROPERTY);
 			Date date=null;
-			if (dateString!=null) {
-				date = DateFormat.getInstance().parse(dateString);
+			if (prop!=null) {
+				Long dateMiliseconds = prop.getLong();
+				Calendar cal = Calendar.getInstance();
+				cal.setTimeInMillis(dateMiliseconds);
+				date = cal.getTime();
 			}
 			property=new WorkflowExecutionStatus(status, date);
             session.save();
@@ -1221,4 +1230,9 @@ public class AiravataJCRRegistry extends
         return isSaved;
 		
 	}
+
+	public boolean saveWorkflowExecutionStatus(String experimentId,
+			ExecutionStatus status) throws RegistryException {
+		return saveWorkflowExecutionStatus(experimentId,new WorkflowExecutionStatus(status));
+	}
 }

Modified: incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/interpretor/WorkflowInterpreter.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/interpretor/WorkflowInterpreter.java?rev=1234199&r1=1234198&r2=1234199&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/interpretor/WorkflowInterpreter.java (original)
+++ incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/interpretor/WorkflowInterpreter.java Fri Jan 20 23:14:50 2012
@@ -44,6 +44,7 @@ import org.apache.airavata.common.regist
 import org.apache.airavata.common.utils.Pair;
 import org.apache.airavata.common.utils.WSDLUtil;
 import org.apache.airavata.common.utils.XMLUtil;
+import org.apache.airavata.registry.api.WorkflowExecutionStatus.ExecutionStatus;
 import org.apache.airavata.xbaya.XBayaConfiguration;
 import org.apache.airavata.xbaya.XBayaEngine;
 import org.apache.airavata.xbaya.XBayaException;
@@ -274,7 +275,7 @@ public class WorkflowInterpreter {
 			this.getWorkflow().setExecutionState(XBayaExecutionState.RUNNING);
             if(actOnProvenance){
                 try {
-					this.configuration.getJcrComponentRegistry().getRegistry().saveWorkflowExecutionStatus(this.topic, WORKFLOW_STARTED);
+					this.configuration.getJcrComponentRegistry().getRegistry().saveWorkflowExecutionStatus(this.topic, ExecutionStatus.STARTED);
 				} catch (RegistryException e) {
 					throw new XBayaException(e);
 				}
@@ -365,7 +366,7 @@ public class WorkflowInterpreter {
                 if (actOnProvenance) {
                     try {
 						try {
-							this.configuration.getJcrComponentRegistry().getRegistry().saveWorkflowExecutionStatus(this.topic, WORKFLOW_FINISHED);
+							this.configuration.getJcrComponentRegistry().getRegistry().saveWorkflowExecutionStatus(this.topic, ExecutionStatus.FINISHED);
 						} catch (Exception e) {
 							throw new XBayaException(e);
 						}