airavata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lah...@apache.org
Subject svn commit: r1386977 - in /incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src: main/java/org/apache/airavata/persistance/registry/jpa/ main/java/org/apache/airavata/persistance/registry/jpa/impl/ main/java/org/apache/airavata/persistan...
Date Tue, 18 Sep 2012 03:30:53 GMT
Author: lahiru
Date: Tue Sep 18 03:30:52 2012
New Revision: 1386977

URL: http://svn.apache.org/viewvc?rev=1386977&view=rev
Log:
applying patch AIRAVATA-546.patch by Chathuri

Added:
    incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Experiment_Data.java
      - copied, changed from r1386768, incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/provenance/model/Experiment_Data.java
    incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Experiment_Metadata.java
    incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Gram_Data.java
      - copied, changed from r1386768, incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/provenance/model/Gram_Data.java
    incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Gram_DataPK.java
    incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Node_Data.java
      - copied, changed from r1386768, incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/provenance/model/Node_Data.java
    incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Node_DataPK.java
    incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Workflow_Data.java
      - copied, changed from r1386768, incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/provenance/model/Workflow_Data.java
    incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/ExperimentDataResource.java
    incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/ExperimentMetadataResource.java
    incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/GramDataResource.java
    incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/NodeDataResource.java
    incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/WorkflowDataResource.java
Removed:
    incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/provenance/model/Experiment_Data.java
    incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/provenance/model/Gram_Data.java
    incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/provenance/model/Node_Data.java
    incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/provenance/model/Workflow_Data.java
Modified:
    incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/ResourceType.java
    incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/ResourceUtils.java
    incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/impl/AiravataJPARegistry.java
    incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/AbstractResource.java
    incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/Utils.java
    incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/resources/META-INF/persistence.xml
    incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/resources/data-derby.sql
    incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/resources/data-mysql.sql
    incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/resources/provenance.sql
    incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/provenance/test/JpaTest.java

Modified: incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/ResourceType.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/ResourceType.java?rev=1386977&r1=1386976&r2=1386977&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/ResourceType.java (original)
+++ incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/ResourceType.java Tue Sep 18 03:30:52 2012
@@ -31,5 +31,11 @@ public enum ResourceType {
     APPLICATION_DESCRIPTOR,
     EXPERIMENT,
     CONFIGURATION,
-    GATEWAY_WORKER
+    GATEWAY_WORKER,
+    EXPERIMENT_DATA,
+    EXPERIMENT_METADATA,
+    WORKFLOW_DATA,
+    NODE_DATA,
+    GRAM_DATA
+
 }

Modified: incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/ResourceUtils.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/ResourceUtils.java?rev=1386977&r1=1386976&r2=1386977&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/ResourceUtils.java (original)
+++ incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/ResourceUtils.java Tue Sep 18 03:30:52 2012
@@ -51,6 +51,7 @@ public class ResourceUtils {
         properties.put("openjpa.WriteLockLevel", "none");
         properties.put("openjpa.LockTimeout", "30000");
         properties.put("openjpa.LockManager", "none");
+//        properties.put("openjpa.jdbc.Schema", "AIRAVATA");
         properties.put("openjpa.ConnectionFactoryProperties","PrettyPrint=true, PrettyPrintLineLength=72, PrintParameters=true, MaxActive=10, MaxIdle=5, MinIdle=2, MaxWait=60000");
 
         if (factory == null) {

Modified: incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/impl/AiravataJPARegistry.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/impl/AiravataJPARegistry.java?rev=1386977&r1=1386976&r2=1386977&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/impl/AiravataJPARegistry.java (original)
+++ incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/impl/AiravataJPARegistry.java Tue Sep 18 03:30:52 2012
@@ -31,7 +31,6 @@ import java.util.List;
 import java.util.Map;
 
 import javax.persistence.EntityManager;
-import javax.persistence.EntityManagerFactory;
 import javax.persistence.Query;
 
 import org.apache.airavata.common.registry.api.exception.RegistryException;
@@ -39,8 +38,6 @@ import org.apache.airavata.commons.gfac.
 import org.apache.airavata.commons.gfac.type.HostDescription;
 import org.apache.airavata.commons.gfac.type.ServiceDescription;
 import org.apache.airavata.persistance.registry.jpa.JPAResourceAccessor;
-import org.apache.airavata.persistance.registry.jpa.Resource;
-import org.apache.airavata.persistance.registry.jpa.ResourceType;
 import org.apache.airavata.persistance.registry.jpa.ResourceUtils;
 import org.apache.airavata.persistance.registry.jpa.resources.ApplicationDescriptorResource;
 import org.apache.airavata.persistance.registry.jpa.resources.ConfigurationResource;
@@ -52,9 +49,9 @@ import org.apache.airavata.persistance.r
 import org.apache.airavata.persistance.registry.jpa.resources.ServiceDescriptorResource;
 import org.apache.airavata.persistance.registry.jpa.resources.UserWorkflowResource;
 import org.apache.airavata.persistance.registry.jpa.resources.WorkerResource;
-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.persistance.registry.jpa.model.Experiment_Data;
+import org.apache.airavata.persistance.registry.jpa.model.Node_Data;
+import org.apache.airavata.persistance.registry.jpa.model.Workflow_Data;
 import org.apache.airavata.registry.api.AiravataExperiment;
 import org.apache.airavata.registry.api.AiravataRegistry2;
 import org.apache.airavata.registry.api.AiravataUser;

Copied: incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Experiment_Data.java (from r1386768, incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/provenance/model/Experiment_Data.java)
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Experiment_Data.java?p2=incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Experiment_Data.java&p1=incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/provenance/model/Experiment_Data.java&r1=1386768&r2=1386977&rev=1386977&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/provenance/model/Experiment_Data.java (original)
+++ incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Experiment_Data.java Tue Sep 18 03:30:52 2012
@@ -18,7 +18,7 @@
  * under the License.
  *
 */
-package org.apache.airavata.provenance.model;
+package org.apache.airavata.persistance.registry.jpa.model;
 
 import javax.persistence.Entity;
 import javax.persistence.Id;
@@ -28,6 +28,7 @@ public class Experiment_Data {
 	@Id
 	private String experiment_ID;
 	private String name;
+    private String username;
 
 	/*@OneToMany(cascade=CascadeType.ALL, mappedBy = "Experiment_Data")
 	private final List<Workflow_Data> workflows = new ArrayList<Workflow_Data>();*/
@@ -47,8 +48,16 @@ public class Experiment_Data {
 	public void setName(String name) {
 		this.name = name;
 	}
-	
-	/*public List<Workflow_Data> getWorkflows() {
-		return workflows;
-	}*/
+
+    public String getUsername() {
+        return username;
+    }
+
+    public void setUsername(String username) {
+        this.username = username;
+    }
+
+    /*public List<Workflow_Data> getWorkflows() {
+        return workflows;
+    }*/
 }

Added: incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Experiment_Metadata.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Experiment_Metadata.java?rev=1386977&view=auto
==============================================================================
--- incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Experiment_Metadata.java (added)
+++ incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Experiment_Metadata.java Tue Sep 18 03:30:52 2012
@@ -0,0 +1,29 @@
+package org.apache.airavata.persistance.registry.jpa.model;
+
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.Lob;
+
+@Entity
+public class Experiment_Metadata {
+    @Id
+    private String experiment_ID;
+    @Lob
+    private String metadata;
+
+    public String getExperiment_ID() {
+        return experiment_ID;
+    }
+
+    public String getMetadata() {
+        return metadata;
+    }
+
+    public void setMetadata(String metadata) {
+        this.metadata = metadata;
+    }
+
+    public void setExperiment_ID(String experiment_ID) {
+        this.experiment_ID = experiment_ID;
+    }
+}

Copied: incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Gram_Data.java (from r1386768, incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/provenance/model/Gram_Data.java)
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Gram_Data.java?p2=incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Gram_Data.java&p1=incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/provenance/model/Gram_Data.java&r1=1386768&r2=1386977&rev=1386977&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/provenance/model/Gram_Data.java (original)
+++ incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Gram_Data.java Tue Sep 18 03:30:52 2012
@@ -18,28 +18,26 @@
  * under the License.
  *
 */
-package org.apache.airavata.provenance.model;
+package org.apache.airavata.persistance.registry.jpa.model;
 
-import javax.persistence.Entity;
-import javax.persistence.Id;
-import javax.persistence.IdClass;
-import javax.persistence.JoinColumn;
-import javax.persistence.ManyToOne;
+import javax.persistence.*;
 
 @Entity
 @IdClass(Gram_DataPK.class)
 public class Gram_Data {
 
 	@Id
-	@ManyToOne()
+	@ManyToOne(cascade = CascadeType.PERSIST)
 	@JoinColumn(name = "workflow_instanceID")
 	private Workflow_Data workflow_Data;
 
 	@Id
 	private String node_id;
 
+    @Lob
 	private String rsl;
 	private String invoked_host;
+    private String local_Job_ID;
 
 	public Workflow_Data getWorkflow_Data() {
 		return workflow_Data;
@@ -73,39 +71,12 @@ public class Gram_Data {
 		this.invoked_host = invoked_host;
 	}
 
+    public String getLocal_Job_ID() {
+        return local_Job_ID;
+    }
+
+    public void setLocal_Job_ID(String local_Job_ID) {
+        this.local_Job_ID = local_Job_ID;
+    }
 }
 
-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/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Gram_DataPK.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Gram_DataPK.java?rev=1386977&view=auto
==============================================================================
--- incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Gram_DataPK.java (added)
+++ incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Gram_DataPK.java Tue Sep 18 03:30:52 2012
@@ -0,0 +1,42 @@
+package org.apache.airavata.persistance.registry.jpa.model;
+
+
+public class Gram_DataPK {
+	private String workflow_Data;
+	private String node_id;
+
+	public Gram_DataPK() {
+		;
+	}
+
+    public Gram_DataPK(String workflow_Data, String node_id) {
+        this.workflow_Data = workflow_Data;
+        this.node_id = node_id;
+    }
+
+    @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;
+	}
+}

Copied: incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Node_Data.java (from r1386768, incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/provenance/model/Node_Data.java)
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Node_Data.java?p2=incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Node_Data.java&p1=incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/provenance/model/Node_Data.java&r1=1386768&r2=1386977&rev=1386977&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/provenance/model/Node_Data.java (original)
+++ incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Node_Data.java Tue Sep 18 03:30:52 2012
@@ -18,15 +18,11 @@
  * under the License.
  *
 */
-package org.apache.airavata.provenance.model;
+package org.apache.airavata.persistance.registry.jpa.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;
+import javax.persistence.*;
 
 @Entity
 @IdClass(Node_DataPK.class)
@@ -41,8 +37,10 @@ public class Node_Data {
 	private String node_id;
 
 	private String node_type;
-	private String inputs;
-	private String outputs;
+	@Lob
+    private String inputs;
+	@Lob
+    private String outputs;
 	private String status;
 	private Timestamp start_time;
 	private Timestamp last_update_time;
@@ -112,37 +110,3 @@ public class Node_Data {
 	}
 }
 
-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/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Node_DataPK.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Node_DataPK.java?rev=1386977&view=auto
==============================================================================
--- incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Node_DataPK.java (added)
+++ incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Node_DataPK.java Tue Sep 18 03:30:52 2012
@@ -0,0 +1,42 @@
+package org.apache.airavata.persistance.registry.jpa.model;
+
+
+public class Node_DataPK {
+	private String workflow_Data;
+	private String node_id;
+
+	public Node_DataPK() {
+		;
+	}
+
+    public Node_DataPK(String workflow_Data, String node_id) {
+        this.workflow_Data = workflow_Data;
+        this.node_id = node_id;
+    }
+
+    @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;
+	}
+}

Copied: incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Workflow_Data.java (from r1386768, incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/provenance/model/Workflow_Data.java)
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Workflow_Data.java?p2=incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Workflow_Data.java&p1=incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/provenance/model/Workflow_Data.java&r1=1386768&r2=1386977&rev=1386977&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/provenance/model/Workflow_Data.java (original)
+++ incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Workflow_Data.java Tue Sep 18 03:30:52 2012
@@ -18,19 +18,18 @@
  * under the License.
  *
 */
-package org.apache.airavata.provenance.model;
+package org.apache.airavata.persistance.registry.jpa.model;
+
+import org.apache.airavata.persistance.registry.jpa.model.Experiment_Data;
 
 import java.sql.Timestamp;
 
-import javax.persistence.Entity;
-import javax.persistence.Id;
-import javax.persistence.JoinColumn;
-import javax.persistence.ManyToOne;
+import javax.persistence.*;
 
 @Entity
 public class Workflow_Data {
 
-	@ManyToOne()
+	@ManyToOne(cascade = CascadeType.PERSIST)
 	@JoinColumn(name="experiment_ID")
 	private Experiment_Data experiment_Data;
 	@Id

Modified: incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/AbstractResource.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/AbstractResource.java?rev=1386977&r1=1386976&r2=1386977&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/AbstractResource.java (original)
+++ incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/AbstractResource.java Tue Sep 18 03:30:52 2012
@@ -136,6 +136,47 @@ public abstract class AbstractResource i
 
     }
 
+    //Experiment_Data table
+    public final class ExperimentDataConstants{
+        public static final String EXPERIMENT_ID="experiment_ID";
+        public static final String NAME = "name";
+        public static final String USERNAME = "username";
+        public static final String METADATA = "metadata";
+    }
+
+    //Workflow_Data table
+    public final class WorkflowDataConstants{
+        public static final String EXPERIMENT_ID="experiment_ID";
+        public static final String WORKFLOW_INSTANCE_ID = "workflow_instanceID";
+        public static final String TEMPLATE_NAME = "template_name";
+        public static final String STATUS = "status";
+        public static final String START_TIME = "start_time";
+        public static final String LAST_UPDATE_TIME = "last_update_time";
+    }
+
+    //Node_Data table
+    public final class NodeDataConstants{
+        public static final String WORKFLOW_INSTANCE_ID = "workflow_instanceID";
+        public static final String NODE_ID = "node_id";
+        public static final String NODE_TYPE = "node_type";
+        public static final String INPUTS = "inputs";
+        public static final String OUTPUTS = "outputs";
+        public static final String STATUS = "status";
+        public static final String START_TIME = "start_time";
+        public static final String LAST_UPDATE_TIME = "last_update_time";
+    }
+
+    //Gram_Data table
+    public final class GramDataConstants{
+        public static final String WORKFLOW_INSTANCE_ID = "workflow_instanceID";
+        public static final String NODE_ID = "node_id";
+        public static final String RSL = "rsl";
+        public static final String INVOKED_HOST = "invoked_host";
+        public static final String LOCAL_JOB_ID = "local_Job_ID";
+
+
+    }
+
     protected AbstractResource() {
     }
 

Added: incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/ExperimentDataResource.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/ExperimentDataResource.java?rev=1386977&view=auto
==============================================================================
--- incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/ExperimentDataResource.java (added)
+++ incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/ExperimentDataResource.java Tue Sep 18 03:30:52 2012
@@ -0,0 +1,195 @@
+package org.apache.airavata.persistance.registry.jpa.resources;
+
+import org.apache.airavata.persistance.registry.jpa.Resource;
+import org.apache.airavata.persistance.registry.jpa.ResourceType;
+import org.apache.airavata.persistance.registry.jpa.ResourceUtils;
+import org.apache.airavata.persistance.registry.jpa.model.Experiment_Data;
+import org.apache.airavata.persistance.registry.jpa.model.Experiment_Metadata;
+import org.apache.airavata.persistance.registry.jpa.model.Workflow_Data;
+import org.apache.airavata.persistance.registry.jpa.utils.QueryGenerator;
+
+import javax.persistence.EntityManager;
+import javax.persistence.Query;
+import java.util.ArrayList;
+import java.util.List;
+
+public class ExperimentDataResource extends AbstractResource{
+    public static final String WORKFLOW_DATA = "Workflow_Data";
+    public static final String EXPERIMENT_METADATA = "Experiment_Metadata";
+
+    private String experimentID;
+    private String expName;
+    private String userName;
+
+    public String getExperimentID() {
+        return experimentID;
+    }
+
+    public String getExpName() {
+        return expName;
+    }
+
+    public String getUserName() {
+        return userName;
+    }
+
+    public void setExperimentID(String experimentID) {
+        this.experimentID = experimentID;
+    }
+
+    public void setExpName(String expName) {
+        this.expName = expName;
+    }
+
+    public void setUserName(String userName) {
+        this.userName = userName;
+    }
+
+    @Override
+    public Resource create(ResourceType type) {
+        switch (type){
+            case WORKFLOW_DATA:
+                WorkflowDataResource workflowDataResource = new WorkflowDataResource();
+                workflowDataResource.setExperimentID(experimentID);
+                return workflowDataResource;
+            case EXPERIMENT_METADATA:
+                ExperimentMetadataResource experimentMetadataResource = new ExperimentMetadataResource();
+                experimentMetadataResource.setExpID(experimentID);
+                return experimentMetadataResource;
+            default:
+                throw new IllegalArgumentException("Unsupported resource type for experiment data resource.");
+        }
+
+    }
+
+    @Override
+    public void remove(ResourceType type, Object name) {
+        EntityManager em = ResourceUtils.getEntityManager();
+        em.getTransaction().begin();
+        Query q;
+        QueryGenerator generator;
+        switch (type){
+            case WORKFLOW_DATA:
+                generator = new QueryGenerator(WORKFLOW_DATA);
+                generator.setParameter(WorkflowDataConstants.EXPERIMENT_ID, experimentID);
+                generator.setParameter(WorkflowDataConstants.WORKFLOW_INSTANCE_ID, name);
+                q = generator.deleteQuery(em);
+                q.executeUpdate();
+                break;
+            case EXPERIMENT_METADATA:
+                generator = new QueryGenerator(EXPERIMENT_METADATA);
+                generator.setParameter(ExperimentDataConstants.EXPERIMENT_ID, experimentID);
+                generator.setParameter(ExperimentDataConstants.METADATA, name);
+                q = generator.deleteQuery(em);
+                q.executeUpdate();
+                break;
+            default:
+                break;
+        }
+        em.getTransaction().commit();
+        em.close();
+    }
+
+    @Override
+    public Resource get(ResourceType type, Object name) {
+        EntityManager em = ResourceUtils.getEntityManager();
+        em.getTransaction().begin();
+        QueryGenerator generator;
+        Query q;
+        switch (type) {
+            case WORKFLOW_DATA:
+                generator = new QueryGenerator(WORKFLOW_DATA);
+                generator.setParameter(WorkflowDataConstants.EXPERIMENT_ID, experimentID);
+                generator.setParameter(WorkflowDataConstants.WORKFLOW_INSTANCE_ID, name);
+                q = generator.selectQuery(em);
+                Workflow_Data eworkflowData = (Workflow_Data)q.getSingleResult();
+                WorkflowDataResource workflowDataResource = (WorkflowDataResource)Utils.getResource(ResourceType.WORKFLOW_DATA, eworkflowData);
+                em.getTransaction().commit();
+                em.close();
+                return workflowDataResource;
+            case EXPERIMENT_METADATA:
+                generator = new QueryGenerator(EXPERIMENT_METADATA);
+                generator.setParameter(ExperimentDataConstants.EXPERIMENT_ID, experimentID);
+                generator.setParameter(ExperimentDataConstants.METADATA, name);
+                q = generator.selectQuery(em);
+                Experiment_Metadata expMetadata = (Experiment_Metadata)q.getSingleResult();
+                ExperimentMetadataResource experimentMetadataResource = (ExperimentMetadataResource)Utils.getResource(ResourceType.EXPERIMENT_METADATA, expMetadata);
+                em.getTransaction().commit();
+                em.close();
+                return experimentMetadataResource;
+            default:
+                em.getTransaction().commit();
+                em.close();
+                throw new IllegalArgumentException("Unsupported resource type for experiment data resource.");
+        }
+    }
+
+    @Override
+    public List<Resource> get(ResourceType type) {
+        List<Resource> resourceList = new ArrayList<Resource>();
+        EntityManager em = ResourceUtils.getEntityManager();
+        em.getTransaction().begin();
+        Query q;
+        QueryGenerator generator;
+        List results;
+        switch (type){
+            case WORKFLOW_DATA:
+                generator = new QueryGenerator(WORKFLOW_DATA);
+                generator.setParameter(WorkflowDataConstants.EXPERIMENT_ID, experimentID);
+                q = generator.selectQuery(em);
+                results = q.getResultList();
+                if (results.size() != 0) {
+                    for (Object result : results) {
+                        Workflow_Data workflowData = (Workflow_Data) result;
+                        WorkflowDataResource workflowDataResource = (WorkflowDataResource)Utils.getResource(ResourceType.WORKFLOW_DATA, workflowData);
+                        resourceList.add(workflowDataResource);
+                    }
+                }
+                break;
+            case EXPERIMENT_METADATA:
+                generator = new QueryGenerator(EXPERIMENT_METADATA);
+                generator.setParameter(ExperimentDataConstants.EXPERIMENT_ID, experimentID);
+                q = generator.selectQuery(em);
+                results = q.getResultList();
+                if (results.size() != 0) {
+                    for (Object result : results) {
+                        Experiment_Metadata expMetadata = (Experiment_Metadata) result;
+                        ExperimentMetadataResource experimentMetadataResource = (ExperimentMetadataResource)Utils.getResource(ResourceType.EXPERIMENT_METADATA, expMetadata);
+                        resourceList.add(experimentMetadataResource);
+                    }
+                }
+                break;
+            default:
+                em.getTransaction().commit();
+                em.close();
+                throw new IllegalArgumentException("Unsupported resource type for experiment data resource.");
+        }
+        em.getTransaction().commit();
+        em.close();
+        return resourceList;
+    }
+
+    @Override
+    public void save() {
+        EntityManager em = ResourceUtils.getEntityManager();
+        Experiment_Data existingExpData = em.find(Experiment_Data.class, experimentID);
+        em.close();
+
+        em = ResourceUtils.getEntityManager();
+        em.getTransaction().begin();
+        Experiment_Data experimentData = new Experiment_Data();
+        experimentData.setExperiment_ID(experimentID);
+        experimentData.setName(expName);
+        experimentData.setUsername(userName);
+        if(existingExpData != null){
+            existingExpData.setName(expName);
+            existingExpData.setUsername(userName);
+            experimentData = em.merge(existingExpData);
+        } else{
+            em.persist(experimentData);
+        }
+        em.getTransaction().commit();
+        em.close();
+
+    }
+}

Added: incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/ExperimentMetadataResource.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/ExperimentMetadataResource.java?rev=1386977&view=auto
==============================================================================
--- incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/ExperimentMetadataResource.java (added)
+++ incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/ExperimentMetadataResource.java Tue Sep 18 03:30:52 2012
@@ -0,0 +1,70 @@
+package org.apache.airavata.persistance.registry.jpa.resources;
+
+import org.apache.airavata.persistance.registry.jpa.Resource;
+import org.apache.airavata.persistance.registry.jpa.ResourceType;
+import org.apache.airavata.persistance.registry.jpa.ResourceUtils;
+import org.apache.airavata.persistance.registry.jpa.model.Experiment_Metadata;
+
+import javax.persistence.EntityManager;
+import java.util.List;
+
+public class ExperimentMetadataResource extends AbstractResource{
+    private String expID;
+    private String metadata;
+
+    public String getExpID() {
+        return expID;
+    }
+
+    public String getMetadata() {
+        return metadata;
+    }
+
+    public void setExpID(String expID) {
+        this.expID = expID;
+    }
+
+    public void setMetadata(String metadata) {
+        this.metadata = metadata;
+    }
+
+    @Override
+    public Resource create(ResourceType type) {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public void remove(ResourceType type, Object name) {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public Resource get(ResourceType type, Object name) {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public List<Resource> get(ResourceType type) {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public void save() {
+        EntityManager em = ResourceUtils.getEntityManager();
+        Experiment_Metadata existingExpMetaData = em.find(Experiment_Metadata.class, expID);
+        em.close();
+
+        em = ResourceUtils.getEntityManager();
+        em.getTransaction().begin();
+        Experiment_Metadata experimentMetadata = new Experiment_Metadata();
+        existingExpMetaData.setMetadata(metadata);
+
+        if(existingExpMetaData != null){
+            existingExpMetaData.setMetadata(metadata);
+            experimentMetadata = em.merge(existingExpMetaData);
+        }else{
+            em.persist(existingExpMetaData);
+        }
+
+    }
+}

Added: incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/GramDataResource.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/GramDataResource.java?rev=1386977&view=auto
==============================================================================
--- incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/GramDataResource.java (added)
+++ incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/GramDataResource.java Tue Sep 18 03:30:52 2012
@@ -0,0 +1,108 @@
+package org.apache.airavata.persistance.registry.jpa.resources;
+
+
+import org.apache.airavata.persistance.registry.jpa.Resource;
+import org.apache.airavata.persistance.registry.jpa.ResourceType;
+import org.apache.airavata.persistance.registry.jpa.ResourceUtils;
+import org.apache.airavata.persistance.registry.jpa.model.Gram_Data;
+import org.apache.airavata.persistance.registry.jpa.model.Gram_DataPK;
+import org.apache.airavata.persistance.registry.jpa.model.Node_Data;
+import org.apache.airavata.persistance.registry.jpa.model.Workflow_Data;
+
+import javax.persistence.EntityManager;
+import java.util.List;
+
+public class GramDataResource extends AbstractResource{
+    private WorkflowDataResource workflowDataResource;
+    private String nodeID;
+    private String rsl;
+    private String invokedHost;
+    private String localJobID;
+
+    public String getNodeID() {
+        return nodeID;
+    }
+
+    public String getRsl() {
+        return rsl;
+    }
+
+    public String getInvokedHost() {
+        return invokedHost;
+    }
+
+    public String getLocalJobID() {
+        return localJobID;
+    }
+
+    public WorkflowDataResource getWorkflowDataResource() {
+        return workflowDataResource;
+    }
+
+    public void setWorkflowDataResource(WorkflowDataResource workflowDataResource) {
+        this.workflowDataResource = workflowDataResource;
+    }
+
+    public void setNodeID(String nodeID) {
+        this.nodeID = nodeID;
+    }
+
+    public void setRsl(String rsl) {
+        this.rsl = rsl;
+    }
+
+    public void setInvokedHost(String invokedHost) {
+        this.invokedHost = invokedHost;
+    }
+
+    public void setLocalJobID(String localJobID) {
+        this.localJobID = localJobID;
+    }
+
+    @Override
+    public Resource create(ResourceType type) {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public void remove(ResourceType type, Object name) {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public Resource get(ResourceType type, Object name) {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public List<Resource> get(ResourceType type) {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public void save() {
+        EntityManager em = ResourceUtils.getEntityManager();
+        Gram_Data existingGramData = em.find(Gram_Data.class, new Gram_DataPK(workflowDataResource.getWorkflowInstanceID(), nodeID));
+        em.close();
+
+        em = ResourceUtils.getEntityManager();
+        Gram_Data gramData = new Gram_Data();
+        gramData.setNode_id(nodeID);
+        Workflow_Data workflow_data = em.find(Workflow_Data.class, workflowDataResource.getWorkflowInstanceID());
+        gramData.setWorkflow_Data(workflow_data);
+        gramData.setNode_id(nodeID);
+        gramData.setInvoked_host(invokedHost);
+        gramData.setLocal_Job_ID(localJobID);
+        gramData.setRsl(rsl);
+        if(existingGramData != null){
+            existingGramData.setInvoked_host(invokedHost);
+            existingGramData.setLocal_Job_ID(localJobID);
+            existingGramData.setRsl(rsl);
+            gramData = em.merge(existingGramData);
+        }  else {
+            em.persist(gramData);
+        }
+        em.getTransaction().commit();
+        em.close();
+    }
+}

Added: incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/NodeDataResource.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/NodeDataResource.java?rev=1386977&view=auto
==============================================================================
--- incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/NodeDataResource.java (added)
+++ incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/NodeDataResource.java Tue Sep 18 03:30:52 2012
@@ -0,0 +1,140 @@
+package org.apache.airavata.persistance.registry.jpa.resources;
+
+
+import org.apache.airavata.persistance.registry.jpa.Resource;
+import org.apache.airavata.persistance.registry.jpa.ResourceType;
+import org.apache.airavata.persistance.registry.jpa.ResourceUtils;
+import org.apache.airavata.persistance.registry.jpa.model.Node_Data;
+import org.apache.airavata.persistance.registry.jpa.model.Node_DataPK;
+import org.apache.airavata.persistance.registry.jpa.model.Workflow_Data;
+
+import javax.persistence.EntityManager;
+import java.sql.Timestamp;
+import java.util.List;
+
+public class NodeDataResource extends AbstractResource{
+    private WorkflowDataResource workflowDataResource;
+    private String nodeID;
+    private String nodeType;
+    private String inputs;
+    private String outputs;
+    private String status;
+    private Timestamp startTime;
+    private Timestamp lastUpdateTime;
+
+    public WorkflowDataResource getWorkflowDataResource() {
+        return workflowDataResource;
+    }
+
+    public String getNodeID() {
+        return nodeID;
+    }
+
+    public String getNodeType() {
+        return nodeType;
+    }
+
+    public String getInputs() {
+        return inputs;
+    }
+
+    public String getOutputs() {
+        return outputs;
+    }
+
+    public String getStatus() {
+        return status;
+    }
+
+    public Timestamp getStartTime() {
+        return startTime;
+    }
+
+    public Timestamp getLastUpdateTime() {
+        return lastUpdateTime;
+    }
+
+    public void setWorkflowDataResource(WorkflowDataResource workflowDataResource) {
+        this.workflowDataResource = workflowDataResource;
+    }
+
+    public void setNodeID(String nodeID) {
+        this.nodeID = nodeID;
+    }
+
+    public void setNodeType(String nodeType) {
+        this.nodeType = nodeType;
+    }
+
+    public void setInputs(String inputs) {
+        this.inputs = inputs;
+    }
+
+    public void setOutputs(String outputs) {
+        this.outputs = outputs;
+    }
+
+    public void setStatus(String status) {
+        this.status = status;
+    }
+
+    public void setStartTime(Timestamp startTime) {
+        this.startTime = startTime;
+    }
+
+    public void setLastUpdateTime(Timestamp lastUpdateTime) {
+        this.lastUpdateTime = lastUpdateTime;
+    }
+
+    @Override
+    public Resource create(ResourceType type) {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public void remove(ResourceType type, Object name) {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public Resource get(ResourceType type, Object name) {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public List<Resource> get(ResourceType type) {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public void save() {
+        EntityManager em = ResourceUtils.getEntityManager();
+        Node_Data existingNodeData = em.find(Node_Data.class, new Node_DataPK(workflowDataResource.getWorkflowInstanceID(), nodeID));
+        em.close();
+
+        em = ResourceUtils.getEntityManager();
+        Node_Data nodeData = new Node_Data();
+        nodeData.setNode_id(nodeID);
+        Workflow_Data workflow_data = em.find(Workflow_Data.class, workflowDataResource.getWorkflowInstanceID());
+        nodeData.setWorkflow_Data(workflow_data);
+        nodeData.setInputs(inputs);
+        nodeData.setOutputs(outputs);
+        nodeData.setNode_type(nodeType);
+        nodeData.setLast_update_time(lastUpdateTime);
+        nodeData.setStart_time(startTime);
+        nodeData.setStatus(status);
+        if(existingNodeData != null){
+            existingNodeData.setInputs(inputs);
+            existingNodeData.setOutputs(outputs);
+            existingNodeData.setLast_update_time(lastUpdateTime);
+            existingNodeData.setNode_type(nodeType);
+            existingNodeData.setStart_time(startTime);
+            existingNodeData.setStatus(status);
+            nodeData = em.merge(existingNodeData);
+        }  else {
+            em.persist(nodeData);
+        }
+        em.getTransaction().commit();
+        em.close();
+    }
+}

Modified: incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/Utils.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/Utils.java?rev=1386977&r1=1386976&r2=1386977&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/Utils.java (original)
+++ incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/Utils.java Tue Sep 18 03:30:52 2012
@@ -146,6 +146,36 @@ public class Utils {
                 } else {
                     throw  new IllegalArgumentException("Object should be a Gateway Worker.");
                 }
+            case EXPERIMENT_DATA:
+                if (o instanceof  Experiment_Data){
+                    return createExperimentData((Experiment_Data)o);
+                }else {
+                    throw new IllegalArgumentException("Object should be a Experiment Data.");
+                }
+            case EXPERIMENT_METADATA:
+                if (o instanceof  Experiment_Metadata){
+                    return createExperimentMetadata((Experiment_Metadata)o);
+                }else {
+                    throw new IllegalArgumentException("Object should be a Experiment Metadata.");
+                }
+            case WORKFLOW_DATA:
+                if (o instanceof  Workflow_Data){
+                    return createWorkflowData((Workflow_Data) o);
+                }else {
+                    throw new IllegalArgumentException("Object should be a Workflow Data.");
+                }
+            case NODE_DATA:
+                if (o instanceof  Node_Data){
+                    return createNodeData((Node_Data) o);
+                }else {
+                    throw new IllegalArgumentException("Object should be a Node Data.");
+                }
+            case GRAM_DATA:
+                if (o instanceof  Gram_Data){
+                    return createGramData((Gram_Data) o);
+                }else {
+                    throw new IllegalArgumentException("Object should be a Gram Data.");
+                }
             default:
         }
         return null;
@@ -319,4 +349,54 @@ public class Utils {
         return userResource;
     }
 
+    private static Resource createExperimentData(Experiment_Data o){
+        ExperimentDataResource experimentDataResource = new ExperimentDataResource();
+        experimentDataResource.setExperimentID(o.getExperiment_ID());
+        experimentDataResource.setExpName(o.getName());
+        experimentDataResource.setUserName(o.getUsername());
+        return experimentDataResource;
+    }
+
+    private static Resource createExperimentMetadata(Experiment_Metadata o) {
+        ExperimentMetadataResource experimentMetadataResource = new ExperimentMetadataResource();
+        experimentMetadataResource.setExpID(o.getExperiment_ID());
+        experimentMetadataResource.setMetadata(o.getMetadata());
+        return experimentMetadataResource;
+    }
+
+    private static Resource createWorkflowData(Workflow_Data o){
+        WorkflowDataResource workflowDataResource = new WorkflowDataResource();
+        workflowDataResource.setExperimentID(o.getExperiment_Data().getExperiment_ID());
+        workflowDataResource.setWorkflowInstanceID(o.getWorkflow_instanceID());
+        workflowDataResource.setTemplateName(o.getTemplate_name());
+        workflowDataResource.setStatus(o.getStatus());
+        workflowDataResource.setStartTime(o.getStart_time());
+        workflowDataResource.setLastUpdatedTime(o.getLast_update_time());
+        return workflowDataResource;
+    }
+
+    private static Resource createNodeData (Node_Data o){
+        NodeDataResource nodeDataResource = new NodeDataResource();
+        WorkflowDataResource workflowDataResource = (WorkflowDataResource)createWorkflowData(o.getWorkflow_Data());
+        nodeDataResource.setWorkflowDataResource(workflowDataResource);
+        nodeDataResource.setNodeID(o.getNode_id());
+        nodeDataResource.setNodeType(o.getNode_type());
+        nodeDataResource.setInputs(o.getInputs());
+        nodeDataResource.setOutputs(o.getOutputs());
+        nodeDataResource.setStatus(o.getStatus());
+        nodeDataResource.setStartTime(o.getStart_time());
+        nodeDataResource.setLastUpdateTime(o.getLast_update_time());
+        return nodeDataResource;
+    }
+
+    private static Resource createGramData (Gram_Data o){
+        GramDataResource gramDataResource = new GramDataResource();
+        WorkflowDataResource workflowDataResource = (WorkflowDataResource)createWorkflowData(o.getWorkflow_Data());
+        gramDataResource.setWorkflowDataResource(workflowDataResource);
+        gramDataResource.setNodeID(o.getNode_id());
+        gramDataResource.setRsl(o.getRsl());
+        gramDataResource.setInvokedHost(o.getInvoked_host());
+        gramDataResource.setLocalJobID(o.getLocal_Job_ID());
+        return gramDataResource;
+    }
 }

Added: incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/WorkflowDataResource.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/WorkflowDataResource.java?rev=1386977&view=auto
==============================================================================
--- incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/WorkflowDataResource.java (added)
+++ incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/WorkflowDataResource.java Tue Sep 18 03:30:52 2012
@@ -0,0 +1,231 @@
+package org.apache.airavata.persistance.registry.jpa.resources;
+
+import org.apache.airavata.persistance.registry.jpa.Resource;
+import org.apache.airavata.persistance.registry.jpa.ResourceType;
+import org.apache.airavata.persistance.registry.jpa.ResourceUtils;
+import org.apache.airavata.persistance.registry.jpa.model.Experiment_Data;
+import org.apache.airavata.persistance.registry.jpa.model.Gram_Data;
+import org.apache.airavata.persistance.registry.jpa.model.Node_Data;
+import org.apache.airavata.persistance.registry.jpa.model.Workflow_Data;
+import org.apache.airavata.persistance.registry.jpa.utils.QueryGenerator;
+
+import javax.persistence.EntityManager;
+import javax.persistence.Query;
+import java.sql.Timestamp;
+import java.util.ArrayList;
+import java.util.List;
+
+public class WorkflowDataResource extends AbstractResource{
+    public static final String NODE_DATA = "Node_Data";
+    public static final String GRAM_DATA = "Gram_Data";
+    private String experimentID;
+    private String workflowInstanceID;
+    private String templateName;
+    private String status;
+    private Timestamp startTime;
+    private Timestamp lastUpdatedTime;
+
+    public String getExperimentID() {
+        return experimentID;
+    }
+
+    public String getWorkflowInstanceID() {
+        return workflowInstanceID;
+    }
+
+    public String getTemplateName() {
+        return templateName;
+    }
+
+    public String getStatus() {
+        return status;
+    }
+
+    public void setExperimentID(String experimentID) {
+        this.experimentID = experimentID;
+    }
+
+    public void setWorkflowInstanceID(String workflowInstanceID) {
+        this.workflowInstanceID = workflowInstanceID;
+    }
+
+    public void setTemplateName(String templateName) {
+        this.templateName = templateName;
+    }
+
+    public void setStatus(String status) {
+        this.status = status;
+    }
+
+    public Timestamp getStartTime() {
+        return startTime;
+    }
+
+    public Timestamp getLastUpdatedTime() {
+        return lastUpdatedTime;
+    }
+
+    public void setStartTime(Timestamp startTime) {
+        this.startTime = startTime;
+    }
+
+    public void setLastUpdatedTime(Timestamp lastUpdatedTime) {
+        this.lastUpdatedTime = lastUpdatedTime;
+    }
+
+    @Override
+    public Resource create(ResourceType type) {
+       switch (type){
+           case NODE_DATA:
+               NodeDataResource nodeDataResource = new NodeDataResource();
+               nodeDataResource.setWorkflowDataResource(this);
+               return nodeDataResource;
+           case GRAM_DATA:
+               GramDataResource gramDataResource = new GramDataResource();
+               gramDataResource.setWorkflowDataResource(this);
+               return gramDataResource;
+           default:
+               throw new IllegalArgumentException("Unsupported resource type for workflow data resource.");
+       }
+    }
+
+    @Override
+    public void remove(ResourceType type, Object name) {
+        EntityManager em = ResourceUtils.getEntityManager();
+        em.getTransaction().begin();
+        Query q;
+        QueryGenerator generator;
+        switch (type){
+            case NODE_DATA:
+                generator = new QueryGenerator(NODE_DATA);
+                generator.setParameter(NodeDataConstants.WORKFLOW_INSTANCE_ID, workflowInstanceID);
+                generator.setParameter(NodeDataConstants.NODE_ID, name);
+                q = generator.deleteQuery(em);
+                q.executeUpdate();
+                break;
+            case GRAM_DATA:
+                generator = new QueryGenerator(GRAM_DATA);
+                generator.setParameter(GramDataConstants.WORKFLOW_INSTANCE_ID, workflowInstanceID);
+                generator.setParameter(GramDataConstants.NODE_ID, name);
+                q = generator.deleteQuery(em);
+                q.executeUpdate();
+                break;
+            default:
+                break;
+        }
+        em.getTransaction().commit();
+        em.close();
+    }
+
+    @Override
+    public Resource get(ResourceType type, Object name) {
+        EntityManager em = ResourceUtils.getEntityManager();
+        em.getTransaction().begin();
+        QueryGenerator generator;
+        Query q;
+        switch (type) {
+            case NODE_DATA:
+                generator = new QueryGenerator(NODE_DATA);
+                generator.setParameter(NodeDataConstants.WORKFLOW_INSTANCE_ID, workflowInstanceID);
+                generator.setParameter(NodeDataConstants.NODE_ID, name);
+                q = generator.selectQuery(em);
+                Node_Data enodeDeata = (Node_Data)q.getSingleResult();
+                NodeDataResource nodeDataResource = (NodeDataResource)Utils.getResource(ResourceType.NODE_DATA, enodeDeata);
+                em.getTransaction().commit();
+                em.close();
+                return nodeDataResource;
+            case GRAM_DATA:
+                generator = new QueryGenerator(GRAM_DATA);
+                generator.setParameter(GramDataConstants.WORKFLOW_INSTANCE_ID, workflowInstanceID);
+                generator.setParameter(GramDataConstants.NODE_ID, name);
+                q = generator.selectQuery(em);
+                Gram_Data egramData = (Gram_Data)q.getSingleResult();
+                GramDataResource gramDataResource = (GramDataResource)Utils.getResource(ResourceType.GRAM_DATA, egramData);
+                em.getTransaction().commit();
+                em.close();
+                return gramDataResource;
+            default:
+                em.getTransaction().commit();
+                em.close();
+                throw new IllegalArgumentException("Unsupported resource type for workflow data resource.");
+
+
+        }
+    }
+
+    @Override
+    public List<Resource> get(ResourceType type) {
+        List<Resource> resourceList = new ArrayList<Resource>();
+        EntityManager em = ResourceUtils.getEntityManager();
+        em.getTransaction().begin();
+        Query q;
+        QueryGenerator generator;
+        List results;
+        switch (type){
+            case NODE_DATA:
+                generator = new QueryGenerator(NODE_DATA);
+                generator.setParameter(NodeDataConstants.WORKFLOW_INSTANCE_ID, workflowInstanceID);
+                q = generator.selectQuery(em);
+                results = q.getResultList();
+                if (results.size() != 0) {
+                    for (Object result : results) {
+                        Node_Data nodeData = (Node_Data)result;
+                        NodeDataResource nodeDataResource = (NodeDataResource)Utils.getResource(ResourceType.NODE_DATA,nodeData);
+                        resourceList.add(nodeDataResource);
+
+                    }
+                }
+                break;
+            case GRAM_DATA:
+                generator = new QueryGenerator(GRAM_DATA);
+                generator.setParameter(GramDataConstants.WORKFLOW_INSTANCE_ID, workflowInstanceID);
+                q = generator.selectQuery(em);
+                results = q.getResultList();
+                if (results.size() != 0) {
+                    for (Object result : results) {
+                        Gram_Data gramData = (Gram_Data)result;
+                        GramDataResource gramDataResource = (GramDataResource)Utils.getResource(ResourceType.GRAM_DATA, gramData);
+                        resourceList.add(gramDataResource);
+                    }
+                }
+                break;
+            default:
+                em.getTransaction().commit();
+                em.close();
+                throw new IllegalArgumentException("Unsupported resource type for workflow data resource.");
+        }
+        em.getTransaction().commit();
+        em.close();
+        return resourceList;
+    }
+
+    @Override
+    public void save() {
+        EntityManager em = ResourceUtils.getEntityManager();
+        Workflow_Data existingWFData = em.find(Workflow_Data.class, workflowInstanceID);
+        em.close();
+
+        em = ResourceUtils.getEntityManager();
+        em.getTransaction().begin();
+        Workflow_Data workflowData = new Workflow_Data();
+        Experiment_Data expData = em.find(Experiment_Data.class, experimentID);
+        workflowData.setExperiment_Data(expData);
+        workflowData.setWorkflow_instanceID(workflowInstanceID);
+        workflowData.setLast_update_time(lastUpdatedTime);
+        workflowData.setStart_time(startTime);
+        workflowData.setTemplate_name(templateName);
+        workflowData.setStatus(status);
+        if(existingWFData != null){
+            existingWFData.setExperiment_Data(expData);
+            existingWFData.setLast_update_time(lastUpdatedTime);
+            existingWFData.setStart_time(startTime);
+            existingWFData.setStatus(status);
+            existingWFData.setTemplate_name(templateName);
+            workflowData = em.merge(existingWFData);
+        }else {
+            em.persist(workflowData);
+        }
+        em.getTransaction().commit();
+        em.close();
+    }
+}

Modified: incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/resources/META-INF/persistence.xml
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/resources/META-INF/persistence.xml?rev=1386977&r1=1386976&r2=1386977&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/resources/META-INF/persistence.xml (original)
+++ incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/resources/META-INF/persistence.xml Tue Sep 18 03:30:52 2012
@@ -34,10 +34,10 @@
         <class>org.apache.airavata.persistance.registry.jpa.model.Service_Descriptor</class>
         <class>org.apache.airavata.persistance.registry.jpa.model.Application_Descriptor</class>
         <class>org.apache.airavata.persistance.registry.jpa.model.Experiment</class>
-        <class>org.apache.airavata.provenance.model.Experiment_Data</class>
-		<class>org.apache.airavata.provenance.model.Workflow_Data</class>
-		<class>org.apache.airavata.provenance.model.Node_Data</class>
-		<class>org.apache.airavata.provenance.model.Gram_Data</class>
+        <class>org.apache.airavata.persistance.registry.jpa.model.Experiment_Data</class>
+		<class>org.apache.airavata.persistance.registry.jpa.model.Workflow_Data</class>
+		<class>org.apache.airavata.persistance.registry.jpa.model.Node_Data</class>
+		<class>org.apache.airavata.persistance.registry.jpa.model.Gram_Data</class>
         <!--properties>
             <property name="openjpa.ConnectionURL"
                       value="jdbc:mysql://localhost:3306/persitant_data" />

Modified: incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/resources/data-derby.sql
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/resources/data-derby.sql?rev=1386977&r1=1386976&r2=1386977&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/resources/data-derby.sql (original)
+++ incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/resources/data-derby.sql Tue Sep 18 03:30:52 2012
@@ -140,3 +140,57 @@ create table Experiment
           FOREIGN KEY (user_name) REFERENCES Users(user_name) ON DELETE CASCADE
 );
 
+create table Experiment_Data
+(
+	experiment_ID varchar(255),
+	name varchar(255),
+	username varchar(255),
+	PRIMARY KEY (experiment_ID)
+);
+
+create table Experiment_Metadata
+(
+	experiment_ID varchar(255),
+	metadata BLOB,
+	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 BLOB,
+       outputs BLOB,
+       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 BLOB,
+       invoked_host varchar(255),
+       local_Job_ID varchar(255),
+       PRIMARY KEY(workflow_instanceID, node_id),
+       FOREIGN KEY (workflow_instanceID) REFERENCES Workflow_Data(workflow_instanceID) ON DELETE CASCADE
+);
+
+

Modified: incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/resources/data-mysql.sql
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/resources/data-mysql.sql?rev=1386977&r1=1386976&r2=1386977&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/resources/data-mysql.sql (original)
+++ incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/resources/data-mysql.sql Tue Sep 18 03:30:52 2012
@@ -138,3 +138,57 @@ create table Experiment
           FOREIGN KEY (user_name) REFERENCES Users(user_name) ON DELETE CASCADE
 );
 
+create table Experiment_Data
+(
+	experiment_ID varchar(255),
+	name varchar(255),
+	username varchar(255),
+	PRIMARY KEY (experiment_ID)
+);
+
+create table Experiment_Metadata
+(
+	experiment_ID varchar(255),
+	metadata BLOB,
+	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 BLOB,
+       outputs BLOB,
+       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 BLOB,
+       invoked_host varchar(255),
+       local_Job_ID varchar(255),
+       PRIMARY KEY(workflow_instanceID, node_id),
+       FOREIGN KEY (workflow_instanceID) REFERENCES Workflow_Data(workflow_instanceID) ON DELETE CASCADE
+);
+
+

Modified: incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/resources/provenance.sql
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/resources/provenance.sql?rev=1386977&r1=1386976&r2=1386977&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/resources/provenance.sql (original)
+++ incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/resources/provenance.sql Tue Sep 18 03:30:52 2012
@@ -30,7 +30,7 @@ create table Experiment_Data
 create table Experiment_Metadata
 (
 	experiment_ID varchar(255),
-	metadata varchar(2000),
+	metadata BLOB,
 	PRIMARY KEY (experiment_ID)
 );
 
@@ -52,8 +52,8 @@ create table Node_Data
        workflow_instanceID varchar(255),
        node_id varchar(255),
        node_type varchar(255),
-       inputs varchar(1000),
-       outputs varchar(1000),
+       inputs BLOB,
+       outputs BLOB,
        status varchar(100),
        start_time TIMESTAMP DEFAULT '0000-00-00 00:00:00',
        last_update_time TIMESTAMP DEFAULT now() on update now(),
@@ -65,9 +65,9 @@ create table Gram_Data
 (
        workflow_instanceID varchar(255),
        node_id varchar(255),
-       rsl varchar(2000),
+       rsl BLOB,
        invoked_host varchar(255),
-       
+       local_Job_ID varchar(255),
        PRIMARY KEY(workflow_instanceID, node_id),
        FOREIGN KEY (workflow_instanceID) REFERENCES Workflow_Data(workflow_instanceID) ON DELETE CASCADE
 );

Modified: incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/provenance/test/JpaTest.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/provenance/test/JpaTest.java?rev=1386977&r1=1386976&r2=1386977&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/provenance/test/JpaTest.java (original)
+++ incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/provenance/test/JpaTest.java Tue Sep 18 03:30:52 2012
@@ -22,18 +22,6 @@ package org.apache.airavata.provenance.t
 
 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;



Mime
View raw message