airavata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lah...@apache.org
Subject svn commit: r1377131 - in /incubator/airavata/trunk/modules/commons/provenance-registry/src/main: java/org/apache/airavata/provenance/impl/jpa/AiravataJPAProvenanceRegistry.java resources/provenance.sql
Date Fri, 24 Aug 2012 21:56:57 GMT
Author: lahiru
Date: Fri Aug 24 21:56:56 2012
New Revision: 1377131

URL: http://svn.apache.org/viewvc?rev=1377131&view=rev
Log:
Committing teh patch added by Ye for AIRAVATA-456.

Added:
    incubator/airavata/trunk/modules/commons/provenance-registry/src/main/resources/provenance.sql
Modified:
    incubator/airavata/trunk/modules/commons/provenance-registry/src/main/java/org/apache/airavata/provenance/impl/jpa/AiravataJPAProvenanceRegistry.java

Modified: incubator/airavata/trunk/modules/commons/provenance-registry/src/main/java/org/apache/airavata/provenance/impl/jpa/AiravataJPAProvenanceRegistry.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/commons/provenance-registry/src/main/java/org/apache/airavata/provenance/impl/jpa/AiravataJPAProvenanceRegistry.java?rev=1377131&r1=1377130&r2=1377131&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/commons/provenance-registry/src/main/java/org/apache/airavata/provenance/impl/jpa/AiravataJPAProvenanceRegistry.java
(original)
+++ incubator/airavata/trunk/modules/commons/provenance-registry/src/main/java/org/apache/airavata/provenance/impl/jpa/AiravataJPAProvenanceRegistry.java
Fri Aug 24 21:56:56 2012
@@ -26,10 +26,13 @@ import java.util.List;
 import javax.persistence.EntityManager;
 import javax.persistence.EntityManagerFactory;
 import javax.persistence.Persistence;
+import javax.persistence.Query;
 
 import org.apache.airavata.common.registry.api.exception.RegistryException;
 import org.apache.airavata.commons.gfac.type.ActualParameter;
 import org.apache.airavata.provenance.model.Experiment_Data;
+import org.apache.airavata.provenance.model.Node_Data;
+import org.apache.airavata.provenance.model.Workflow_Data;
 import org.apache.airavata.registry.api.AiravataProvenanceRegistry;
 import org.apache.airavata.registry.api.workflow.WorkflowExecution;
 import org.apache.airavata.registry.api.workflow.WorkflowIOData;
@@ -145,7 +148,26 @@ public class AiravataJPAProvenanceRegist
 	public boolean saveWorkflowData(WorkflowRunTimeData arg0)
 			throws RegistryException {
 		// TODO Auto-generated method stub
-		return false;
+		EntityManager em = factory.createEntityManager();
+		em.getTransaction().begin();
+		Query q = em.createQuery("SELECT p FROM Experiment_Data p WHERE p.experiment_ID = :exp_ID");
+		q.setParameter("exp_ID", arg0.getExperimentID());
+		Experiment_Data eData = (Experiment_Data) q.getSingleResult();
+		
+		Workflow_Data wData = new Workflow_Data();
+		wData.setExperiment_Data(eData);
+		wData.setExperiment_Data(eData);
+		wData.setTemplate_name(arg0.getTemplateID());
+		wData.setWorkflow_instanceID(arg0.getWorkflowInstanceID());
+		wData.setStatus(arg0.getWorkflowStatus().toString());
+		wData.setStart_time(arg0.getStartTime());
+		
+		em.persist(wData);
+		
+		em.getTransaction().commit();
+		em.close();
+		
+		return true;
 	}
 
 	@Override
@@ -161,15 +183,18 @@ public class AiravataJPAProvenanceRegist
 		// TODO Auto-generated method stub
 		
 		EntityManager em = factory.createEntityManager();
+		em.getTransaction().begin();
+		
 		Experiment_Data expData = new Experiment_Data();
 		expData.setExperiment_ID(arg0);
 		expData.setName(arg1);
-		em.getTransaction().begin();
+		
 		em.persist(expData);
+		
 		em.getTransaction().commit();
 		em.close();
 		
-		return false;
+		return true;
 	}
 
 	@Override
@@ -190,7 +215,26 @@ public class AiravataJPAProvenanceRegist
 	public boolean saveWorkflowExecutionServiceInput(WorkflowServiceIOData arg0)
 			throws RegistryException {
 		// TODO Auto-generated method stub
-		return false;
+		EntityManager em = factory.createEntityManager();
+		em.getTransaction().begin();
+		
+		Query q = em.createQuery("select w from Workflow_Data w.workflow_instanceID = :workflow_ID");
+		q.setParameter("workflow_ID", arg0.getWorkflowInstanceId());
+		Workflow_Data wData = (Workflow_Data) q.getSingleResult();
+		
+		Node_Data nData = new Node_Data();
+		nData.setWorkflow_Data(wData);
+		nData.setNode_id(arg0.getNodeId());
+		nData.setInputs(arg0.getValue());
+		nData.setNode_type((arg0.getNodeType().toString()));
+		nData.setStatus(arg0.getNodeStatus().toString());
+		
+		em.persist(nData);
+	
+		em.getTransaction().commit();
+		em.close();
+		
+		return true;
 	}
 
 	@Override
@@ -204,7 +248,20 @@ public class AiravataJPAProvenanceRegist
 	public boolean saveWorkflowExecutionStatus(String arg0, ExecutionStatus arg1)
 			throws RegistryException {
 		// TODO Auto-generated method stub
-		return false;
+		
+		EntityManager em = factory.createEntityManager();
+		em.getTransaction().begin();
+		
+		Query q = em.createQuery("select w from Workflow_Data w.workflow_instanceID = :workflow_ID");
+		q.setParameter("workflow_ID", arg0);
+		Workflow_Data wData = (Workflow_Data) q.getSingleResult();
+		
+		wData.setStatus(arg1.toString());
+		
+		em.getTransaction().commit();
+		em.close();
+		
+		return true;
 	}
 
 	@Override
@@ -246,7 +303,24 @@ public class AiravataJPAProvenanceRegist
 	public boolean saveWorkflowNodeStatus(String arg0, String arg1,
 			ExecutionStatus arg2) throws RegistryException {
 		// TODO Auto-generated method stub
-		return false;
+		
+		EntityManager em = factory.createEntityManager();
+		em.getTransaction().begin();
+		
+		Query q = em.createQuery("select w from Workflow_Data w.workflow_instanceID = :workflow_ID");
+		q.setParameter("workflow_ID", arg0);
+		Workflow_Data wData = (Workflow_Data) q.getSingleResult();
+		
+		q = em.createQuery("SELECT p FROM Node_Data p WHERE p.workflow_Data = :workflow_data AND
p.node_id = :node_ID");
+		q.setParameter("workflow_data", wData);
+		q.setParameter("node_ID", arg1);
+		Node_Data nData = (Node_Data) q.getSingleResult();
+		nData.setStatus(arg2.toString());
+		
+		em.getTransaction().commit();
+		em.close();
+		
+		return true;
 	}
 
 	@Override

Added: incubator/airavata/trunk/modules/commons/provenance-registry/src/main/resources/provenance.sql
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/commons/provenance-registry/src/main/resources/provenance.sql?rev=1377131&view=auto
==============================================================================
--- incubator/airavata/trunk/modules/commons/provenance-registry/src/main/resources/provenance.sql
(added)
+++ incubator/airavata/trunk/modules/commons/provenance-registry/src/main/resources/provenance.sql
Fri Aug 24 21:56:56 2012
@@ -0,0 +1,42 @@
+create table Experiment_Data
+(
+	experiment_ID varchar(255),
+	name varchar(255),
+	PRIMARY KEY (experiment_ID)
+)
+
+create table Workflow_Data
+(
+       experiment_ID varchar(255),
+       workflow_instanceID varchar(255),
+       template_name varchar(255),
+       status varchar(100),
+       start_time TIMESTAMP DEFAULT '0000-00-00 00:00:00',
+       last_update_time TIMESTAMP DEFAULT now() on update now(),
+       PRIMARY KEY(workflow_instanceID),
+       FOREIGN KEY (experiment_ID) REFERENCES Experiment_Data(experiment_ID) ON DELETE CASCADE
+)
+
+create table Node_Data
+(
+       workflow_instanceID varchar(255),
+       node_id varchar(255),
+       node_type varchar(255),
+       inputs varchar(1000),
+       outputs varchar(1000),
+       status varchar(100),
+       start_time TIMESTAMP DEFAULT '0000-00-00 00:00:00',
+       last_update_time TIMESTAMP DEFAULT now() on update now(),
+       PRIMARY KEY(workflow_instanceID, node_id),
+       FOREIGN KEY (workflow_instanceID) REFERENCES Workflow_Data(workflow_instanceID) ON
DELETE CASCADE
+)
+
+create table Gram_Data
+(
+       workflow_instanceID varchar(255),
+       node_id varchar(255),
+       rsl varchar(2000),
+       invoked_host varchar(255),
+       PRIMARY KEY(workflow_instanceID, node_id),
+       FOREIGN KEY (workflow_instanceID) REFERENCES Workflow_Data(workflow_instanceID) ON
DELETE CASCADE
+)
\ No newline at end of file



Mime
View raw message