airavata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lah...@apache.org
Subject svn commit: r1384931 - in /incubator/airavata/trunk/modules: registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/ registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/impl/ regi...
Date Fri, 14 Sep 2012 21:42:12 GMT
Author: lahiru
Date: Fri Sep 14 21:42:11 2012
New Revision: 1384931

URL: http://svn.apache.org/viewvc?rev=1384931&view=rev
Log:
change the database script and modified the model and resources accordingly, applying patch
AIRAVATA-562.15.patch by Chathuri

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/Application_Descriptor.java
    incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Application_Descriptor_PK.java
    incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Configuration.java
    incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/ApplicationDescriptorResource.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/ServiceDescriptorResource.java
    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/test/java/org/apache/airavata/persistance/registry/jpa/GatewayResourceTest.java
    incubator/airavata/trunk/modules/xbaya-gui/src/main/resources/repository.properties

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=1384931&r1=1384930&r2=1384931&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
Fri Sep 14 21:42:11 2012
@@ -275,44 +275,4 @@ public class ResourceUtils {
         return lock;
     }
 
-    public static ApplicationDescriptorResource getApplicationDescriptorResource(String applicationDescName,
-                                                                          String gatewayName,
-                                                                          String hostDescName,
-                                                                          String serviceDescName){
-
-        EntityManager em = ResourceUtils.getEntityManager();
-        em.getTransaction().begin();
-        QueryGenerator queryGenerator = new QueryGenerator(AbstractResource.APPLICATION_DESCRIPTOR);
-        queryGenerator.setParameter(AbstractResource.ApplicationDescriptorConstants.GATEWAY_NAME,
gatewayName);
-        queryGenerator.setParameter(AbstractResource.ApplicationDescriptorConstants.APPLICATION_DESC_ID,
applicationDescName);
-        queryGenerator.setParameter(AbstractResource.ApplicationDescriptorConstants.HOST_DESC_ID,
hostDescName);
-        queryGenerator.setParameter(AbstractResource.ApplicationDescriptorConstants.SERVICE_DESC_ID,
serviceDescName);
-        Query q = queryGenerator.selectQuery(em);
-        Application_Descriptor applicationDescriptor = (Application_Descriptor) q.getSingleResult();
-        ApplicationDescriptorResource applicationDescriptorResource =
-                (ApplicationDescriptorResource) Utils.getResource(
-                        ResourceType.APPLICATION_DESCRIPTOR, applicationDescriptor);
-        em.getTransaction().commit();
-        em.close();
-        return applicationDescriptorResource;
-    }
-
-    public static void removeApplicationDescriptor(String gatewayName,
-                                                   String appDescName,
-                                                   String hostDescName,
-                                                   String serviceDescName){
-        EntityManager em = ResourceUtils.getEntityManager();
-        em.getTransaction().begin();
-        QueryGenerator queryGenerator = new QueryGenerator(AbstractResource.APPLICATION_DESCRIPTOR);
-        queryGenerator.setParameter(AbstractResource.ApplicationDescriptorConstants.GATEWAY_NAME,
gatewayName);
-        queryGenerator.setParameter(AbstractResource.ApplicationDescriptorConstants.APPLICATION_DESC_ID,
appDescName);
-        queryGenerator.setParameter(AbstractResource.ApplicationDescriptorConstants.HOST_DESC_ID,
hostDescName);
-        queryGenerator.setParameter(AbstractResource.ApplicationDescriptorConstants.SERVICE_DESC_ID,
serviceDescName);
-        Query q = queryGenerator.deleteQuery(em);
-        q.executeUpdate();
-        em.getTransaction().commit();
-        em.close();
-
-    }
-
 }

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=1384931&r1=1384930&r2=1384931&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
Fri Sep 14 21:42:11 2012
@@ -434,8 +434,7 @@ public class AiravataJPARegistry extends
 		if (!isApplicationDescriptorExists(serviceName,hostName,descriptor.getType().getApplicationName().getStringValue())){
         	throw new DescriptorDoesNotExistsException(applicationName);
         }
-        ApplicationDescriptorResource serviceDescriptorResource = ResourceUtils.getApplicationDescriptorResource(applicationName,
gateway.getGatewayName(),
-                hostName, serviceName);
+        ApplicationDescriptorResource serviceDescriptorResource = gateway.getApplicationDescriptorResource(applicationName);
         serviceDescriptorResource.setContent(descriptor.toXML());
         serviceDescriptorResource.save();
     }
@@ -451,11 +450,10 @@ public class AiravataJPARegistry extends
     
     public ApplicationDeploymentDescription getApplicationDescriptor(String serviceName,
String hostname, String applicationName)throws DescriptorDoesNotExistsException, MalformedDescriptorException,
RegistryException{
     	GatewayResource gateway = jpa.getGateway();
-        String appName = createAppName(serviceName, hostname, applicationName);
 		if (!isApplicationDescriptorExists(serviceName,hostname,applicationName)){
         	throw new DescriptorDoesNotExistsException(createAppName(serviceName, hostname,
applicationName));
         }
-        return createApplicationDescriptor(ResourceUtils.getApplicationDescriptorResource(appName,gateway.getGatewayName(),hostname,
serviceName));
+        return createApplicationDescriptor(gateway.getApplicationDescriptorResource(createAppName(serviceName,
hostname, applicationName)));
     }
     
     public ApplicationDeploymentDescription getApplicationDescriptors(String serviceName,
String hostname) throws MalformedDescriptorException {
@@ -493,7 +491,7 @@ public class AiravataJPARegistry extends
     	if (!isApplicationDescriptorExists(serviceName,hostName,applicationName)){
 			throw new DescriptorDoesNotExistsException(appName);
 		}
-        ResourceUtils.removeApplicationDescriptor(gateway.getGatewayName(), appName, hostName,
serviceName);
+        gateway.removeApplicationDescriptor(appName);
     }
 
     public ResourceMetadata getApplicationDescriptorMetadata(String serviceName, String hostName,
String applicationName) throws UnimplementedRegistryOperationException {

Modified: incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Application_Descriptor.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/Application_Descriptor.java?rev=1384931&r1=1384930&r2=1384931&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Application_Descriptor.java
(original)
+++ incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Application_Descriptor.java
Fri Sep 14 21:42:11 2012
@@ -29,19 +29,17 @@ public class Application_Descriptor {
     @Id
     private String application_descriptor_ID;
     @Id
-    private String host_descriptor_ID;
-    @Id
-    private String service_descriptor_ID;
-    @Id
     private String gateway_name;
 
+    private String host_descriptor_ID;
+    private String service_descriptor_ID;
     private String application_descriptor_xml;
 
-    @ManyToOne(cascade=CascadeType.MERGE)
+    @ManyToOne(cascade=CascadeType.PERSIST)
     @JoinColumn(name = "gateway_name")
     private Gateway gateway;
 
-    @ManyToOne(cascade=CascadeType.MERGE)
+    @ManyToOne(cascade=CascadeType.PERSIST)
     @JoinColumn(name = "updated_user", referencedColumnName = "user_name")
     private Users user;
 

Modified: incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Application_Descriptor_PK.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/Application_Descriptor_PK.java?rev=1384931&r1=1384930&r2=1384931&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Application_Descriptor_PK.java
(original)
+++ incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Application_Descriptor_PK.java
Fri Sep 14 21:42:11 2012
@@ -4,14 +4,10 @@ package org.apache.airavata.persistance.
 public class Application_Descriptor_PK {
     private String gateway_name;
     private String application_descriptor_ID;
-    private String host_descriptor_ID;
-    private String service_descriptor_ID;
 
-    public Application_Descriptor_PK(String gateway_name, String application_descriptor_ID,
String host_descriptor_ID, String service_descriptor_ID) {
+    public Application_Descriptor_PK(String gateway_name, String application_descriptor_ID)
{
         this.gateway_name = gateway_name;
         this.application_descriptor_ID = application_descriptor_ID;
-        this.host_descriptor_ID = host_descriptor_ID;
-        this.service_descriptor_ID = service_descriptor_ID;
     }
 
     public Application_Descriptor_PK() {
@@ -36,14 +32,6 @@ public class Application_Descriptor_PK {
         return application_descriptor_ID;
     }
 
-    public String getHost_descriptor_ID() {
-        return host_descriptor_ID;
-    }
-
-    public String getService_descriptor_ID() {
-        return service_descriptor_ID;
-    }
-
     public void setGateway_name(String gateway_name) {
         this.gateway_name = gateway_name;
     }
@@ -52,11 +40,4 @@ public class Application_Descriptor_PK {
         this.application_descriptor_ID = application_descriptor_ID;
     }
 
-    public void setHost_descriptor_ID(String host_descriptor_ID) {
-        this.host_descriptor_ID = host_descriptor_ID;
-    }
-
-    public void setService_descriptor_ID(String service_descriptor_ID) {
-        this.service_descriptor_ID = service_descriptor_ID;
-    }
 }

Modified: incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Configuration.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/Configuration.java?rev=1384931&r1=1384930&r2=1384931&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Configuration.java
(original)
+++ incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Configuration.java
Fri Sep 14 21:42:11 2012
@@ -57,43 +57,3 @@ public class Configuration implements Se
         this.expire_date = expire_date;
     }
 }
-
-//class Configuration_PK{
-//    private String config_key;
-//    private String config_val;
-//
-//    public Configuration_PK(String config_key, String config_val) {
-//        this.config_key = config_key;
-//        this.config_val = config_val;
-//    }
-//
-//    public Configuration_PK() {
-//        ;
-//    }
-//
-//    @Override
-//    public boolean equals(Object o) {
-//        return false;
-//    }
-//
-//    @Override
-//    public int hashCode() {
-//        return 1;
-//    }
-//
-//    public String getConfig_key() {
-//        return config_key;
-//    }
-//
-//    public void setConfig_key(String config_key) {
-//        this.config_key = config_key;
-//    }
-//
-//    public void setConfig_val(String config_val) {
-//        this.config_val = config_val;
-//    }
-//
-//    public String getConfig_val() {
-//        return config_val;
-//    }
-//}

Modified: incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/ApplicationDescriptorResource.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/ApplicationDescriptorResource.java?rev=1384931&r1=1384930&r2=1384931&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/ApplicationDescriptorResource.java
(original)
+++ incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/ApplicationDescriptorResource.java
Fri Sep 14 21:42:11 2012
@@ -43,16 +43,11 @@ public class ApplicationDescriptorResour
      *
      * @param name application descriptor name
      * @param gatewayName  gateway name
-     * @param hostDescName host descriptor name
-     * @param serviceDescName service descriptor name
      * returns ApplicationDescriptorResource
      */
-    public ApplicationDescriptorResource(String name, String gatewayName,
-                                         String hostDescName, String serviceDescName) {
+    public ApplicationDescriptorResource(String name, String gatewayName) {
         this.setName(name);
         this.gatewayName = gatewayName;
-        this.hostDescName = hostDescName;
-        this.serviceDescName = serviceDescName;
     }
 
     /**
@@ -232,34 +227,38 @@ public class ApplicationDescriptorResour
      *  save application descriptor to database
      */
     public void save() {
-        EntityManager em = ResourceUtils.getEntityManager();
-        Application_Descriptor existingAppDesc = em.find(Application_Descriptor.class, new
Application_Descriptor_PK(gatewayName,
-                name, hostDescName, serviceDescName));
-        em.close();
-
-        em = ResourceUtils.getEntityManager();
-        em.getTransaction().begin();
-        Application_Descriptor applicationDescriptor = new Application_Descriptor();
-        applicationDescriptor.setApplication_descriptor_ID(getName());
-        Gateway gateway = new Gateway();
-        gateway.setGateway_name(gatewayName);
-        applicationDescriptor.setGateway(gateway);
-        Users user = new Users();
-        user.setUser_name(updatedUser);
-        applicationDescriptor.setUser(user);
-        applicationDescriptor.setApplication_descriptor_xml(content);
-        applicationDescriptor.setService_descriptor_ID(serviceDescName);
-        applicationDescriptor.setHost_descriptor_ID(hostDescName);
-        if (existingAppDesc != null) {
+        try{
+            EntityManager em = ResourceUtils.getEntityManager();
+            Application_Descriptor existingAppDesc = em.find(Application_Descriptor.class,
new Application_Descriptor_PK(gatewayName, name));
+            em.close();
+
+            em = ResourceUtils.getEntityManager();
+            em.getTransaction().begin();
+            Application_Descriptor applicationDescriptor = new Application_Descriptor();
+            applicationDescriptor.setApplication_descriptor_ID(getName());
+
+            Gateway gateway = em.find(Gateway.class, gatewayName);
+            Users user = em.find(Users.class, updatedUser);
+            applicationDescriptor.setGateway(gateway);
             applicationDescriptor.setUser(user);
             applicationDescriptor.setApplication_descriptor_xml(content);
-            applicationDescriptor = em.merge(existingAppDesc);
-        } else {
-            em.merge(applicationDescriptor);
+            applicationDescriptor.setService_descriptor_ID(serviceDescName);
+            applicationDescriptor.setHost_descriptor_ID(hostDescName);
+            if (existingAppDesc != null) {
+                existingAppDesc.setUser(user);
+                existingAppDesc.setApplication_descriptor_xml(content);
+                existingAppDesc.setHost_descriptor_ID(hostDescName);
+                existingAppDesc.setService_descriptor_ID(serviceDescName);
+                applicationDescriptor = em.merge(existingAppDesc);
+            } else {
+                em.persist(applicationDescriptor);
+            }
+            em.getTransaction().commit();
+            em.close();
+        } catch (Exception e){
+            e.printStackTrace();
         }
 
-        em.getTransaction().commit();
-        em.close();
     }
 
     /**

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=1384931&r1=1384930&r2=1384931&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
Fri Sep 14 21:42:11 2012
@@ -182,6 +182,13 @@ public class GatewayResource extends Abs
                 q = generator.deleteQuery(em);
                 q.executeUpdate();
                 break;
+            case APPLICATION_DESCRIPTOR:
+                generator = new QueryGenerator(APPLICATION_DESCRIPTOR);
+                generator.setParameter(ApplicationDescriptorConstants.APPLICATION_DESC_ID,
name);
+                generator.setParameter(ApplicationDescriptorConstants.GATEWAY_NAME, gatewayName);
+                q = generator.deleteQuery(em);
+                q.executeUpdate();
+                break;
             default:
                 break;
         }
@@ -257,6 +264,17 @@ public class GatewayResource extends Abs
                 em.getTransaction().commit();
                 em.close();
                 return serviceDescriptorResource;
+            case APPLICATION_DESCRIPTOR:
+                generator = new QueryGenerator(APPLICATION_DESCRIPTOR);
+                generator.setParameter(ApplicationDescriptorConstants.APPLICATION_DESC_ID,
name);
+                generator.setParameter(ApplicationDescriptorConstants.GATEWAY_NAME, gatewayName);
+                q = generator.selectQuery(em);
+                Application_Descriptor eAppDesc = (Application_Descriptor) q.getSingleResult();
+                ApplicationDescriptorResource applicationDescriptorResource =
+                        (ApplicationDescriptorResource)Utils.getResource(ResourceType.APPLICATION_DESCRIPTOR,
eAppDesc);
+                em.getTransaction().commit();
+                em.close();
+                return applicationDescriptorResource;
             default:
                 em.getTransaction().commit();
                 em.close();
@@ -444,14 +462,9 @@ public class GatewayResource extends Abs
                 return existingServiceDesc != null;
             case APPLICATION_DESCRIPTOR:
                 em = ResourceUtils.getEntityManager();
-                em.getTransaction().begin();
-                q = em.createQuery("SELECT COUNT(p.application_descriptor_ID) FROM Application_Descriptor
p WHERE p.gateway_name =:gate_name and p.application_descriptor_ID =:app_desc_name");
-                q.setParameter("gate_name", gatewayName);
-                q.setParameter("app_desc_name",name);
-                count = (Number) q.getSingleResult();
-                em.getTransaction().commit();
+                Application_Descriptor existingAppDesc = em.find(Application_Descriptor.class,
new Application_Descriptor_PK(gatewayName, name.toString()));
                 em.close();
-                return count.intValue() != 0;
+                return existingAppDesc != null;
             case EXPERIMENT:
                 em = ResourceUtils.getEntityManager();
                 Experiment existingExp = em.find(Experiment.class, name.toString());
@@ -582,22 +595,22 @@ public class GatewayResource extends Abs
     	return hdr;
     }
 
-//    /**
-//     *
-//     * @param descriptorName application descriptor name
-//     * @return ApplicationDescriptorResource
-//     */
-//    public ApplicationDescriptorResource getApplicationDescriptorResource(String descriptorName){
-//    	return (ApplicationDescriptorResource)get(ResourceType.APPLICATION_DESCRIPTOR,descriptorName);
-//    }
+    /**
+     *
+     * @param descriptorName application descriptor name
+     * @return ApplicationDescriptorResource
+     */
+    public ApplicationDescriptorResource getApplicationDescriptorResource(String descriptorName){
+    	return (ApplicationDescriptorResource)get(ResourceType.APPLICATION_DESCRIPTOR,descriptorName);
+    }
 
     /**
      *
      * @param descriptorName  application descriptor name
      */
-//    public void removeApplicationDescriptor(String descriptorName){
-//    	remove(ResourceType.APPLICATION_DESCRIPTOR, descriptorName);
-//    }
+    public void removeApplicationDescriptor(String descriptorName){
+    	remove(ResourceType.APPLICATION_DESCRIPTOR, descriptorName);
+    }
 
     /**
      *
@@ -640,11 +653,11 @@ public class GatewayResource extends Abs
                 ApplicationDescriptorResource applicationDescriptorResource =
                         new ApplicationDescriptorResource(
                                 applicationDescriptor.getApplication_descriptor_ID(),
-                                applicationDescriptor.getGateway().getGateway_name(),
-                                applicationDescriptor.getHost_descriptor_ID(),
-                                applicationDescriptor.getService_descriptor_ID());
+                                applicationDescriptor.getGateway().getGateway_name());
                 applicationDescriptorResource.setContent(applicationDescriptor.getApplication_descriptor_xml());
                 applicationDescriptorResource.setUpdatedUser(applicationDescriptor.getUser().getUser_name());
+                applicationDescriptorResource.setHostDescName(applicationDescriptor.getHost_descriptor_ID());
+                applicationDescriptorResource.setServiceDescName(applicationDescriptor.getService_descriptor_ID());
                 resourceList.add(applicationDescriptorResource);
             }
         }

Modified: incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/ServiceDescriptorResource.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/ServiceDescriptorResource.java?rev=1384931&r1=1384930&r2=1384931&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/ServiceDescriptorResource.java
(original)
+++ incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/ServiceDescriptorResource.java
Fri Sep 14 21:42:11 2012
@@ -138,15 +138,13 @@ public class ServiceDescriptorResource e
 
         em = ResourceUtils.getEntityManager();
         em.getTransaction().begin();
+
         Service_Descriptor serviceDescriptor = new Service_Descriptor();
         serviceDescriptor.setService_descriptor_ID(getServiceDescName());
-        Gateway gateway = new Gateway();
-        gateway.setGateway_name(gatewayName);
+        Gateway gateway = em.find(Gateway.class, gatewayName);
         serviceDescriptor.setGateway(gateway);
         serviceDescriptor.setService_descriptor_xml(content);
-        Users user = new Users();
-        user.setUser_name(userName);
-        serviceDescriptor.setUser(user);
+        Users user = em.find(Users.class, userName);
         serviceDescriptor.setUser(user);
         if(existingServiceDesc != null) {
             existingServiceDesc.setUser(user);
@@ -156,7 +154,7 @@ public class ServiceDescriptorResource e
             em.merge(serviceDescriptor);
         }
         em.getTransaction().commit();
-         em.close();
+        em.close();
 
     }
 

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=1384931&r1=1384930&r2=1384931&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
Fri Sep 14 21:42:11 2012
@@ -122,7 +122,7 @@ create table Application_Descriptor
          host_descriptor_ID varchar(255),
          service_descriptor_ID varchar(255),
          application_descriptor_xml varchar(2000),
-         PRIMARY KEY(gateway_name,host_descriptor_ID, service_descriptor_ID,application_descriptor_ID),
+         PRIMARY KEY(gateway_name,application_descriptor_ID),
          FOREIGN KEY (gateway_name) REFERENCES Gateway(gateway_name) ON DELETE CASCADE,
          FOREIGN KEY (updated_user) REFERENCES Users(user_name) 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=1384931&r1=1384930&r2=1384931&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
Fri Sep 14 21:42:11 2012
@@ -120,7 +120,7 @@ create table Application_Descriptor
          host_descriptor_ID varchar(255),
          service_descriptor_ID varchar(255),
          application_descriptor_xml varchar(2000),
-         PRIMARY KEY(gateway_name,host_descriptor_ID, service_descriptor_ID,application_descriptor_ID),
+         PRIMARY KEY(gateway_name,application_descriptor_ID),
          FOREIGN KEY (gateway_name) REFERENCES Gateway(gateway_name) ON DELETE CASCADE,
          FOREIGN KEY (updated_user) REFERENCES Users(user_name) ON DELETE CASCADE
 );

Modified: incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/GatewayResourceTest.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/GatewayResourceTest.java?rev=1384931&r1=1384930&r2=1384931&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/GatewayResourceTest.java
(original)
+++ incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/GatewayResourceTest.java
Fri Sep 14 21:42:11 2012
@@ -32,6 +32,17 @@ public class GatewayResourceTest extends
     }
 
     public void testSave() throws Exception {
+//        ServiceDescriptorResource serviceDescriptorResource = gatewayResource.createServiceDescriptorResource("bb");
+//        serviceDescriptorResource.setUserName("admin");
+//        serviceDescriptorResource.setContent("ccccc");
+//        serviceDescriptorResource.save();
+//
+//        ApplicationDescriptorResource applicationDescriptorResource = gatewayResource.createApplicationDescriptorResource("test");
+//        applicationDescriptorResource.setUpdatedUser("admin");
+//        applicationDescriptorResource.setContent("abc");
+//        applicationDescriptorResource.setHostDescName("aa");
+//        applicationDescriptorResource.setServiceDescName("bb");
+//        applicationDescriptorResource.save();
 //        Calendar cal = Calendar.getInstance();
 //        cal.set( cal.YEAR, 1970 );
 //        cal.set( cal.MONTH, cal.JANUARY );

Modified: incubator/airavata/trunk/modules/xbaya-gui/src/main/resources/repository.properties
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/xbaya-gui/src/main/resources/repository.properties?rev=1384931&r1=1384930&r2=1384931&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/xbaya-gui/src/main/resources/repository.properties (original)
+++ incubator/airavata/trunk/modules/xbaya-gui/src/main/resources/repository.properties Fri
Sep 14 21:42:11 2012
@@ -83,5 +83,5 @@ gateway.id=default
 registry.jdbc.driver=org.apache.derby.jdbc.EmbeddedDriver
 registry.jdbc.user=airavata
 registry.jdbc.password=airavata
-registry.jdbc.url=jdbc:mysql://localhost:3306/ppp
+registry.jdbc.url=jdbc:mysql://localhost:3306/persistent_data
 



Mime
View raw message