airavata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lah...@apache.org
Subject svn commit: r1383117 - in /incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa: ./ impl/ model/ resources/ utils/
Date Mon, 10 Sep 2012 21:38:41 GMT
Author: lahiru
Date: Mon Sep 10 21:38:41 2012
New Revision: 1383117

URL: http://svn.apache.org/viewvc?rev=1383117&view=rev
Log: (empty)

Modified:
    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/model/Gateway_Worker.java
    incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/GatewayResource.java
    incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/WorkerResource.java
    incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/utils/QueryGenerator.java

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=1383117&r1=1383116&r2=1383117&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
Mon Sep 10 21:38:41 2012
@@ -219,9 +219,12 @@ public class ResourceUtils {
      * @param configValue
      */
     public static void removeConfiguration(String configkey, String configValue) {
-        factory = Persistence.createEntityManagerFactory(PERSISTENCE_UNIT_NAME);
-        em = factory.createEntityManager();
-        em.getTransaction().begin();
+//        factory = Persistence.createEntityManagerFactory(PERSISTENCE_UNIT_NAME);
+//        em = factory.createEntityManager();
+//        em.getTransaction().begin();
+//        Query q = em.createQuery("Delete FROM Configuration p WHERE p.config_key = :configKey
and p.config_val = :configVal");
+//        q.setParameter("configKey", configkey);
+//        q.setParameter("configVal", configValue);
         QueryGenerator queryGenerator = new QueryGenerator(AbstractResource.CONFIGURATION);
         queryGenerator.setParameter(AbstractResource.ConfigurationConstants.CONFIG_KEY, configkey);
         queryGenerator.setParameter(AbstractResource.ConfigurationConstants.CONFIG_VAL, configValue);

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=1383117&r1=1383116&r2=1383117&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
Mon Sep 10 21:38:41 2012
@@ -91,6 +91,10 @@ public class AiravataJPARegistry extends
     	jpa = new JPAResourceAccessor(this);
     }
 
+    @Override
+    public void closeConnection() {
+    }
+
     /**---------------------------------Configuration Registry----------------------------------**/
     
     public Object getConfiguration(String key) {
@@ -107,12 +111,6 @@ public class AiravataJPARegistry extends
 		return values;
     }
 
-    @Override
-    public void closeConnection() {
-        //todo close the database connection safely
-
-    }
-
     public void setConfiguration(String key, String value, Date expire) {
     	ConfigurationResource config;
 		if (ResourceUtils.isConfigurationExist(key)) {

Modified: incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Gateway_Worker.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/Gateway_Worker.java?rev=1383117&r1=1383116&r2=1383117&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Gateway_Worker.java
(original)
+++ incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Gateway_Worker.java
Mon Sep 10 21:38:41 2012
@@ -20,11 +20,7 @@
 */
 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(Gateway_Worker_PK.class)
@@ -35,12 +31,12 @@ public class Gateway_Worker {
     @Id
     private String user_name;
 
-    @ManyToOne
+    @ManyToOne()
     @JoinColumn(name = "gateway_name")
     private Gateway gateway;
 
 
-    @ManyToOne
+    @ManyToOne()
     @JoinColumn(name = "user_name")
     private Users user;
 

Modified: incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/GatewayResource.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/GatewayResource.java?rev=1383117&r1=1383116&r2=1383117&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/GatewayResource.java
(original)
+++ incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/GatewayResource.java
Mon Sep 10 21:38:41 2012
@@ -119,6 +119,10 @@ public class GatewayResource extends Abs
                 ExperimentResource experimentResource =new ExperimentResource();
                 experimentResource.setGateway(this);
                 return experimentResource;
+            case GATEWAY_WORKER:
+                WorkerResource workerResource = new WorkerResource();
+                workerResource.setGateway(this);
+                return workerResource;
             default:
                 throw new IllegalArgumentException("Unsupported resource type for gateway
resource.");
         }
@@ -404,6 +408,9 @@ public class GatewayResource extends Abs
                 end();
                 return publishedWrkflow != null;
             case HOST_DESCRIPTOR:
+//                q = em.createQuery("SELECT p FROM Host_Descriptor p WHERE p.gateway_name
=:gate_ID and p.host_descriptor_ID =:host_desc_name");
+//                q.setParameter("gate_ID", gatewayName);
+//                q.setParameter("host_desc_name",name);
                 generator = new QueryGenerator(HOST_DESCRIPTOR);
                 generator.setParameter(HostDescriptorConstants.GATEWAY_NAME, gatewayName);
                 generator.setParameter(HostDescriptorConstants.HOST_DESC_ID, name);

Modified: incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/WorkerResource.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/WorkerResource.java?rev=1383117&r1=1383116&r2=1383117&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/WorkerResource.java
(original)
+++ incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/WorkerResource.java
Mon Sep 10 21:38:41 2012
@@ -37,6 +37,12 @@ public class WorkerResource extends Abst
 
     /**
      *
+     */
+    public WorkerResource() {
+    }
+
+    /**
+     *
      * @param user username
      * @param gateway  gatewayResource
      */
@@ -214,9 +220,10 @@ public class WorkerResource extends Abst
         Users users = new Users();
         users.setUser_name(user);
         gatewayWorker.setUser(users);
-        Gateway gateway = new Gateway();
-        gateway.setGateway_name(gateway.getGateway_name());
-        gatewayWorker.setGateway(gateway);
+        Gateway gatewaymodel = new Gateway();
+        gatewaymodel.setGateway_name(gateway.getGatewayName());
+        gatewaymodel.setOwner(gateway.getOwner());
+        gatewayWorker.setGateway(gatewaymodel);
         em.persist(gatewayWorker);
         end();
 	}

Modified: incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/utils/QueryGenerator.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/utils/QueryGenerator.java?rev=1383117&r1=1383116&r2=1383117&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/utils/QueryGenerator.java
(original)
+++ incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/utils/QueryGenerator.java
Mon Sep 10 21:38:41 2012
@@ -60,12 +60,12 @@ public class QueryGenerator {
 	}
 	
 	public Query selectQuery(EntityManager entityManager){
-		String queryString="SELECT "+SELECT_OBJ+" FROM "+getTableName()+" "+TABLE_OBJ;
+		String queryString="SELECT FROM "+getTableName()+" "+TABLE_OBJ;
 		return generateQueryWithParameters(entityManager, queryString);
 	}
 	
 	public Query deleteQuery(EntityManager entityManager){
-		String queryString="Delete "+DELETE_OBJ+" FROM "+getTableName()+" "+TABLE_OBJ;
+		String queryString="Delete FROM "+getTableName()+" "+TABLE_OBJ;
 		return generateQueryWithParameters(entityManager, queryString);
 	}
 



Mime
View raw message