airavata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lah...@apache.org
Subject svn commit: r1377048 - in /incubator/airavata/trunk/modules/commons: ./ provenance-registry/ provenance-registry/src/ provenance-registry/src/main/ provenance-registry/src/main/java/ provenance-registry/src/main/java/org/ provenance-registry/src/main/j...
Date Fri, 24 Aug 2012 18:56:30 GMT
Author: lahiru
Date: Fri Aug 24 18:56:29 2012
New Revision: 1377048

URL: http://svn.apache.org/viewvc?rev=1377048&view=rev
Log:
Adding patch provided by Ye for AIRAVATA-456.

Added:
    incubator/airavata/trunk/modules/commons/provenance-registry/
    incubator/airavata/trunk/modules/commons/provenance-registry/pom.xml
    incubator/airavata/trunk/modules/commons/provenance-registry/src/
    incubator/airavata/trunk/modules/commons/provenance-registry/src/main/
    incubator/airavata/trunk/modules/commons/provenance-registry/src/main/java/
    incubator/airavata/trunk/modules/commons/provenance-registry/src/main/java/org/
    incubator/airavata/trunk/modules/commons/provenance-registry/src/main/java/org/apache/
    incubator/airavata/trunk/modules/commons/provenance-registry/src/main/java/org/apache/airavata/
    incubator/airavata/trunk/modules/commons/provenance-registry/src/main/java/org/apache/airavata/provenance/
    incubator/airavata/trunk/modules/commons/provenance-registry/src/main/java/org/apache/airavata/provenance/model/
    incubator/airavata/trunk/modules/commons/provenance-registry/src/main/java/org/apache/airavata/provenance/model/Experiment_Data.java
    incubator/airavata/trunk/modules/commons/provenance-registry/src/main/java/org/apache/airavata/provenance/model/Gram_Data.java
    incubator/airavata/trunk/modules/commons/provenance-registry/src/main/java/org/apache/airavata/provenance/model/Node_Data.java
    incubator/airavata/trunk/modules/commons/provenance-registry/src/main/java/org/apache/airavata/provenance/model/Workflow_Data.java
    incubator/airavata/trunk/modules/commons/provenance-registry/src/test/
    incubator/airavata/trunk/modules/commons/provenance-registry/src/test/org/
    incubator/airavata/trunk/modules/commons/provenance-registry/src/test/org/apache/
    incubator/airavata/trunk/modules/commons/provenance-registry/src/test/org/apache/airavata/
    incubator/airavata/trunk/modules/commons/provenance-registry/src/test/org/apache/airavata/provenance/
    incubator/airavata/trunk/modules/commons/provenance-registry/src/test/org/apache/airavata/provenance/test/
    incubator/airavata/trunk/modules/commons/provenance-registry/src/test/org/apache/airavata/provenance/test/JpaTest.java
Modified:
    incubator/airavata/trunk/modules/commons/pom.xml

Modified: incubator/airavata/trunk/modules/commons/pom.xml
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/commons/pom.xml?rev=1377048&r1=1377047&r2=1377048&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/commons/pom.xml (original)
+++ incubator/airavata/trunk/modules/commons/pom.xml Fri Aug 24 18:56:29 2012
@@ -35,6 +35,7 @@
                 <module>common-registry-api</module>
                 <module>registry-api</module>
                 <module>workflow-execution-context</module>
+		<module>provenance-registry</module>
             </modules>
         </profile>
     </profiles>

Added: incubator/airavata/trunk/modules/commons/provenance-registry/pom.xml
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/commons/provenance-registry/pom.xml?rev=1377048&view=auto
==============================================================================
--- incubator/airavata/trunk/modules/commons/provenance-registry/pom.xml (added)
+++ incubator/airavata/trunk/modules/commons/provenance-registry/pom.xml Fri Aug 24 18:56:29
2012
@@ -0,0 +1,92 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--Licensed to the Apache Software Foundation (ASF) under one or more contributor license
agreements. See the NOTICE file 
+    distributed with this work for additional information regarding copyright ownership.
The ASF licenses this file to you under 
+    the Apache License, Version 2.0 (theÏ "License"); you may not use this file except
in compliance with the License. You may 
+    obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required
by applicable law or agreed to 
+    in writing, software distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF 
+    ANY ~ KIND, either express or implied. See the License for the specific language governing
permissions and limitations under 
+    the License. -->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+
+    <parent>
+        <groupId>org.apache.airavata</groupId>
+        <artifactId>commons</artifactId>
+        <version>0.5-incubating-SNAPSHOT</version>
+        <relativePath>../pom.xml</relativePath>
+    </parent>
+
+    <modelVersion>4.0.0</modelVersion>
+    <artifactId>airavata-provenance-registry</artifactId>
+    <packaging>jar</packaging>
+    <name>Airavata Provenance Registry</name>
+    <url>http://incubator.apache.org/airavata/</url>
+
+    <dependencies>
+        <dependency>
+            <groupId>javax.jcr</groupId>
+            <artifactId>jcr</artifactId>
+            <version>${jcr.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.slf4j</groupId>
+            <artifactId>slf4j-api</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.airavata</groupId>
+            <artifactId>airavata-gfac-schema-utils</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.airavata</groupId>
+            <artifactId>airavata-common-utils</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+        <!-- Test -->
+        <dependency>
+            <groupId>junit</groupId>
+            <artifactId>junit</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.slf4j</groupId>
+            <artifactId>slf4j-simple</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.jackrabbit</groupId>
+            <artifactId>jackrabbit-core</artifactId>
+            <version>${jackrabbit.version}</version>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.jackrabbit</groupId>
+            <artifactId>jackrabbit-jcr-rmi</artifactId>
+            <version>${jackrabbit.version}</version>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.airavata</groupId>
+            <artifactId>airavata-common-registry-api</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+        <dependency>
+        	<groupId>org.apache.openjpa</groupId>
+        	<artifactId>openjpa-all</artifactId>
+        	<version>2.2.0</version>
+        </dependency>
+        <dependency>
+        	<groupId>mysql</groupId>
+        	<artifactId>mysql-connector-java</artifactId>
+        	<version>5.1.21</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.airavata</groupId>
+            <artifactId>airavata-registry-api</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+
+    </dependencies>
+
+</project>

Added: incubator/airavata/trunk/modules/commons/provenance-registry/src/main/java/org/apache/airavata/provenance/model/Experiment_Data.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/commons/provenance-registry/src/main/java/org/apache/airavata/provenance/model/Experiment_Data.java?rev=1377048&view=auto
==============================================================================
--- incubator/airavata/trunk/modules/commons/provenance-registry/src/main/java/org/apache/airavata/provenance/model/Experiment_Data.java
(added)
+++ incubator/airavata/trunk/modules/commons/provenance-registry/src/main/java/org/apache/airavata/provenance/model/Experiment_Data.java
Fri Aug 24 18:56:29 2012
@@ -0,0 +1,34 @@
+package org.apache.airavata.provenance.model;
+
+import javax.persistence.Entity;
+import javax.persistence.Id;
+
+@Entity
+public class Experiment_Data {
+	@Id
+	private String experiment_ID;
+	private String name;
+
+	/*@OneToMany(cascade=CascadeType.ALL, mappedBy = "Experiment_Data")
+	private final List<Workflow_Data> workflows = new ArrayList<Workflow_Data>();*/
+
+	public String getExperiment_ID() {
+		return experiment_ID;
+	}
+
+	public void setExperiment_ID(String experiment_ID) {
+		this.experiment_ID = experiment_ID;
+	}
+
+	public String getName() {
+		return name;
+	}
+
+	public void setName(String name) {
+		this.name = name;
+	}
+	
+	/*public List<Workflow_Data> getWorkflows() {
+		return workflows;
+	}*/
+}

Added: incubator/airavata/trunk/modules/commons/provenance-registry/src/main/java/org/apache/airavata/provenance/model/Gram_Data.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/commons/provenance-registry/src/main/java/org/apache/airavata/provenance/model/Gram_Data.java?rev=1377048&view=auto
==============================================================================
--- incubator/airavata/trunk/modules/commons/provenance-registry/src/main/java/org/apache/airavata/provenance/model/Gram_Data.java
(added)
+++ incubator/airavata/trunk/modules/commons/provenance-registry/src/main/java/org/apache/airavata/provenance/model/Gram_Data.java
Fri Aug 24 18:56:29 2012
@@ -0,0 +1,91 @@
+package org.apache.airavata.provenance.model;
+
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.IdClass;
+import javax.persistence.JoinColumn;
+import javax.persistence.ManyToOne;
+
+@Entity
+@IdClass(Gram_DataPK.class)
+public class Gram_Data {
+
+	@Id
+	@ManyToOne()
+	@JoinColumn(name = "workflow_instanceID")
+	private Workflow_Data workflow_Data;
+
+	@Id
+	private String node_id;
+
+	private String rsl;
+	private String invoked_host;
+
+	public Workflow_Data getWorkflow_Data() {
+		return workflow_Data;
+	}
+
+	public void setWorkflow_Data(Workflow_Data workflow_Data) {
+		this.workflow_Data = workflow_Data;
+	}
+
+	public String getNode_id() {
+		return node_id;
+	}
+
+	public void setNode_id(String node_id) {
+		this.node_id = node_id;
+	}
+
+	public String getRsl() {
+		return rsl;
+	}
+
+	public void setRsl(String rsl) {
+		this.rsl = rsl;
+	}
+
+	public String getInvoked_host() {
+		return invoked_host;
+	}
+
+	public void setInvoked_host(String invoked_host) {
+		this.invoked_host = invoked_host;
+	}
+
+}
+
+class Gram_DataPK {
+	private String workflow_Data;
+	private String node_id;
+
+	public Gram_DataPK() {
+		;
+	}
+
+	@Override
+	public boolean equals(Object o) {
+		return false;
+	}
+
+	@Override
+	public int hashCode() {
+		return 1;
+	}
+
+	public String getWorkflow_Data() {
+		return workflow_Data;
+	}
+
+	public void setWorkflow_Data(String workflow_Data) {
+		this.workflow_Data = workflow_Data;
+	}
+
+	public String getNode_id() {
+		return node_id;
+	}
+
+	public void setNode_id(String node_id) {
+		this.node_id = node_id;
+	}
+}
\ No newline at end of file

Added: incubator/airavata/trunk/modules/commons/provenance-registry/src/main/java/org/apache/airavata/provenance/model/Node_Data.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/commons/provenance-registry/src/main/java/org/apache/airavata/provenance/model/Node_Data.java?rev=1377048&view=auto
==============================================================================
--- incubator/airavata/trunk/modules/commons/provenance-registry/src/main/java/org/apache/airavata/provenance/model/Node_Data.java
(added)
+++ incubator/airavata/trunk/modules/commons/provenance-registry/src/main/java/org/apache/airavata/provenance/model/Node_Data.java
Fri Aug 24 18:56:29 2012
@@ -0,0 +1,128 @@
+package org.apache.airavata.provenance.model;
+
+import java.sql.Timestamp;
+
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.IdClass;
+import javax.persistence.JoinColumn;
+import javax.persistence.ManyToOne;
+
+@Entity
+@IdClass(Node_DataPK.class)
+public class Node_Data {
+
+	@Id
+	@ManyToOne()
+	@JoinColumn(name = "workflow_instanceID")
+	private Workflow_Data workflow_Data;
+
+	@Id
+	private String node_id;
+
+	private String node_type;
+	private String inputs;
+	private String outputs;
+	private String status;
+	private Timestamp start_time;
+	private Timestamp last_update_time;
+
+	public Workflow_Data getWorkflow_Data() {
+		return workflow_Data;
+	}
+
+	public void setWorkflow_Data(Workflow_Data workflow_Data) {
+		this.workflow_Data = workflow_Data;
+	}
+
+	public String getNode_id() {
+		return node_id;
+	}
+
+	public void setNode_id(String node_id) {
+		this.node_id = node_id;
+	}
+
+	public String getNode_type() {
+		return node_type;
+	}
+
+	public void setNode_type(String node_type) {
+		this.node_type = node_type;
+	}
+
+	public String getInputs() {
+		return inputs;
+	}
+
+	public void setInputs(String inputs) {
+		this.inputs = inputs;
+	}
+
+	public String getOutputs() {
+		return outputs;
+	}
+
+	public void setOutputs(String outputs) {
+		this.outputs = outputs;
+	}
+
+	public String getStatus() {
+		return status;
+	}
+
+	public void setStatus(String status) {
+		this.status = status;
+	}
+
+	public Timestamp getStart_time() {
+		return start_time;
+	}
+
+	public void setStart_time(Timestamp start_time) {
+		this.start_time = start_time;
+	}
+
+	public Timestamp getLast_update_time() {
+		return last_update_time;
+	}
+
+	public void setLast_update_time(Timestamp last_update_time) {
+		this.last_update_time = last_update_time;
+	}
+}
+
+class Node_DataPK {
+	private String workflow_Data;
+	private String node_id;
+
+	public Node_DataPK() {
+		;
+	}
+
+	@Override
+	public boolean equals(Object o) {
+		return false;
+	}
+
+	@Override
+	public int hashCode() {
+		return 1;
+	}
+
+	public String getWorkflow_Data() {
+		return workflow_Data;
+	}
+
+	public void setWorkflow_Data(String workflow_Data) {
+		this.workflow_Data = workflow_Data;
+	}
+
+	public String getNode_id() {
+		return node_id;
+	}
+
+	public void setNode_id(String node_id) {
+		this.node_id = node_id;
+	}
+}

Added: incubator/airavata/trunk/modules/commons/provenance-registry/src/main/java/org/apache/airavata/provenance/model/Workflow_Data.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/commons/provenance-registry/src/main/java/org/apache/airavata/provenance/model/Workflow_Data.java?rev=1377048&view=auto
==============================================================================
--- incubator/airavata/trunk/modules/commons/provenance-registry/src/main/java/org/apache/airavata/provenance/model/Workflow_Data.java
(added)
+++ incubator/airavata/trunk/modules/commons/provenance-registry/src/main/java/org/apache/airavata/provenance/model/Workflow_Data.java
Fri Aug 24 18:56:29 2012
@@ -0,0 +1,70 @@
+package org.apache.airavata.provenance.model;
+
+import java.sql.Timestamp;
+
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.JoinColumn;
+import javax.persistence.ManyToOne;
+
+@Entity
+public class Workflow_Data {
+
+	@ManyToOne()
+	@JoinColumn(name="experiment_ID")
+	private Experiment_Data experiment_Data;
+	@Id
+	private String workflow_instanceID;
+	private String template_name;
+	private String status;
+	private Timestamp start_time;
+	private Timestamp last_update_time;
+
+	public Experiment_Data getExperiment_Data() {
+		return experiment_Data;
+	}
+
+	public void setExperiment_Data(Experiment_Data experiment_Data) {
+		this.experiment_Data = experiment_Data;
+	}
+
+	public String getWorkflow_instanceID() {
+		return workflow_instanceID;
+	}
+
+	public void setWorkflow_instanceID(String workflow_instanceID) {
+		this.workflow_instanceID = workflow_instanceID;
+	}
+
+	public String getTemplate_name() {
+		return template_name;
+	}
+
+	public void setTemplate_name(String template_name) {
+		this.template_name = template_name;
+	}
+
+	public String getStatus() {
+		return status;
+	}
+
+	public void setStatus(String status) {
+		this.status = status;
+	}
+
+	public Timestamp getStart_time() {
+		return start_time;
+	}
+
+	public void setStart_time(Timestamp start_time) {
+		this.start_time = start_time;
+	}
+
+	public Timestamp getLast_update_time() {
+		return last_update_time;
+	}
+
+	public void setLast_update_time(Timestamp last_update_time) {
+		this.last_update_time = last_update_time;
+	}
+}

Added: incubator/airavata/trunk/modules/commons/provenance-registry/src/test/org/apache/airavata/provenance/test/JpaTest.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/commons/provenance-registry/src/test/org/apache/airavata/provenance/test/JpaTest.java?rev=1377048&view=auto
==============================================================================
--- incubator/airavata/trunk/modules/commons/provenance-registry/src/test/org/apache/airavata/provenance/test/JpaTest.java
(added)
+++ incubator/airavata/trunk/modules/commons/provenance-registry/src/test/org/apache/airavata/provenance/test/JpaTest.java
Fri Aug 24 18:56:29 2012
@@ -0,0 +1,143 @@
+package org.apache.airavata.provenance.test;
+
+import static org.junit.Assert.assertTrue;
+
+import javax.persistence.EntityManager;
+import javax.persistence.EntityManagerFactory;
+import javax.persistence.Persistence;
+import javax.persistence.Query;
+
+import org.apache.airavata.provenance.model.Experiment_Data;
+import org.apache.airavata.provenance.model.Gram_Data;
+import org.apache.airavata.provenance.model.Node_Data;
+import org.apache.airavata.provenance.model.Workflow_Data;
+import org.junit.Before;
+import org.junit.Test;
+
+public class JpaTest {
+	private static final String PERSISTENCE_UNIT_NAME = "airavata_provenance";
+	private EntityManagerFactory factory;
+
+	@Before
+	public void setUp() throws Exception {
+		factory = Persistence.createEntityManagerFactory(PERSISTENCE_UNIT_NAME);
+		EntityManager em = factory.createEntityManager();
+
+		// Begin a new local transaction so that we can persist a new entity
+		em.getTransaction().begin();
+
+		// Read the existing entries
+		Query q = em.createQuery("select m from Experiment_Data m");
+		// Persons should be empty
+
+		// Do we have entries?
+		boolean createNewEntries = (q.getResultList().size() == 0);
+
+		// No, so lets create new entries
+		if (createNewEntries) {
+			assertTrue(q.getResultList().size() == 0);
+			Experiment_Data data = new Experiment_Data();
+			data.setExperiment_ID("Experiement_ID1");
+			data.setName("Name1");
+			em.persist(data);
+			for (int i = 0; i < 5; i++) {
+				Workflow_Data wData = new Workflow_Data();
+				wData.setWorkflow_instanceID("instance_ID" + i);
+				wData.setExperiment_Data(data);
+				em.persist(wData);
+				for (int j = 0; j < 5; j++) {
+					Node_Data nData = new Node_Data();
+					nData.setNode_id("node_ID" + j);
+					nData.setWorkflow_Data(wData);
+					em.persist(nData);
+					
+					Gram_Data gData = new Gram_Data();
+					gData.setNode_id("node_ID" + j);
+					gData.setWorkflow_Data(wData);
+					em.persist(gData);
+				}
+				// Now persists the family person relationship
+				// data.getWorkflows().add(wData);
+				// em.persist(wData);
+				// em.persist(data);
+			}
+		}
+
+		// Commit the transaction, which will cause the entity to
+		// be stored in the database
+		em.getTransaction().commit();
+
+		// It is always good practice to close the EntityManager so that
+		// resources are conserved.
+		em.close();
+
+	}
+
+	@Test
+	public void checkInsertedWorkflow() {
+
+		// Now lets check the database and see if the created entries are there
+		// Create a fresh, new EntityManager
+		EntityManager em = factory.createEntityManager();
+
+		// Perform a simple query for all the Message entities
+		Query q = em.createQuery("select m from Workflow_Data m");
+
+		// We should have 5 Persons in the database
+		assertTrue(q.getResultList().size() == 5);
+
+		em.close();
+	}
+
+	@Test
+	public void checkInsertedNode() {
+		EntityManager em = factory.createEntityManager();
+
+		Query q = em.createQuery("select m from Node_Data m");
+
+		assertTrue(q.getResultList().size() == 25);
+
+		em.close();
+	}
+
+	@Test (expected = javax.persistence.NoResultException.class)
+	public void deleteNode_Data() throws InterruptedException {
+		Thread.sleep(1000);
+		EntityManager em = factory.createEntityManager();
+		// Begin a new local transaction so that we can persist a new entity
+		em.getTransaction().begin();
+		Query q = em.createQuery("SELECT p FROM Experiment_Data p WHERE p.experiment_ID = :firstName");
+		q.setParameter("firstName", "Experiement_ID1");
+		Experiment_Data eData = (Experiment_Data) q.getSingleResult();
+		
+		q = em.createQuery("SELECT p FROM Workflow_Data p WHERE p.experiment_Data = :firstName
AND p.workflow_instanceID = :lastName");
+		q.setParameter("firstName", eData);
+		q.setParameter("lastName", "instance_ID4");
+		Workflow_Data wData = (Workflow_Data) q.getSingleResult();
+		
+		q = em.createQuery("SELECT p FROM Node_Data p WHERE p.workflow_Data = :firstName AND p.node_id
= :lastName");
+		q.setParameter("firstName", wData);
+		q.setParameter("lastName", "node_ID4");
+		Node_Data nData = (Node_Data) q.getSingleResult();
+
+		//System.out.println(nData.getStart_time());
+		em.remove(nData);
+		
+		q = em.createQuery("SELECT p FROM Node_Data p WHERE p.workflow_Data = :firstName AND p.node_id
= :lastName");
+		q.setParameter("firstName", wData);
+		q.setParameter("lastName", "node_ID3");
+		nData = (Node_Data) q.getSingleResult();
+		nData.setStatus("finished");
+		Thread.sleep(5000);
+		em.getTransaction().commit();
+
+		q = em.createQuery("SELECT p FROM Node_Data p WHERE p.workflow_Data = :firstName AND p.node_id
= :lastName");
+		q.setParameter("firstName", wData);
+		q.setParameter("lastName", "node_ID4");
+		Node_Data person = (Node_Data) q.getSingleResult();
+		person.getInputs();
+		// Begin a new local transaction so that we can persist a new entity
+
+		em.close();
+	}
+}



Mime
View raw message