airavata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From samin...@apache.org
Subject svn commit: r1382136 [2/2] - in /incubator/airavata/trunk/modules: commons/ commons/registry-api/src/main/java/org/apache/airavata/registry/api/ registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/ registry/airavat...
Date Fri, 07 Sep 2012 19:48:53 GMT
Modified: incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/ProjectResource.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/ProjectResource.java?rev=1382136&r1=1382135&r2=1382136&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/ProjectResource.java
(original)
+++ incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/ProjectResource.java
Fri Sep  7 19:48:52 2012
@@ -72,7 +72,7 @@ public class ProjectResource extends Abs
     public Resource create(ResourceType type) {
         if (type == ResourceType.USER_WORKFLOW) {
             UserWorkflowResource userWorkflowResource = new UserWorkflowResource();
-            userWorkflowResource.setProjectID(id);
+            userWorkflowResource.setGatewayname(gatewayName);
             userWorkflowResource.setUserName(userWorkflowResource.getUserName());
             return userWorkflowResource;
         } else if (type == ResourceType.EXPERIMENT) {
@@ -103,6 +103,10 @@ public class ProjectResource extends Abs
         end();
     }
 
+    public void removeMe(Object[] keys) {
+
+    }
+
     public Resource get(ResourceType type, Object name) {
         begin();
         if (type == ResourceType.USER_WORKFLOW) {
@@ -111,9 +115,9 @@ public class ProjectResource extends Abs
             q.setParameter("usr_name", userResource.getUserName());
             q.setParameter("usrwf_name", name);
             User_Workflow userWorkflow = (User_Workflow) q.getSingleResult();
-            UserWorkflowResource userWorkflowResource = new UserWorkflowResource(id, userResource.getUserName(),
userWorkflow.getUser_workflow_name());
-            userWorkflowResource.setContent(userWorkflow.getWorkflow_content());
-            userWorkflowResource.setLastUpdateDate(userWorkflow.getLast_update_date());
+            UserWorkflowResource userWorkflowResource = new UserWorkflowResource(gatewayName,
userResource.getUserName(), userWorkflow.getTemplate_name());
+            userWorkflowResource.setContent(userWorkflow.getWorkflow_graph());
+            userWorkflowResource.setLastUpdateDate(userWorkflow.getLast_updated_date());
             end();
             return userWorkflowResource;
         } else if (type == ResourceType.EXPERIMENT) {
@@ -132,6 +136,25 @@ public class ProjectResource extends Abs
         return null;
     }
 
+    public List<Resource> getMe(Object[] keys) {
+        List<Resource> list = new ArrayList<Resource>();
+        begin();
+        Query q = em.createQuery("SELECT p FROM Project p WHERE p.project_name = :proj_name");
+        q.setParameter("proj_name", keys[0]);
+        List resultList = q.getResultList();
+        if (resultList.size() != 0) {
+            for (Object result : resultList) {
+                Project project = (Project) result;
+                ProjectResource projectResource = new ProjectResource();
+                projectResource.setGatewayName(project.getGateway().getGateway_name());
+                projectResource.setUserName(project.getUsers().getUser_name());
+                list.add(projectResource);
+            }
+        }
+        end();
+        return list;
+    }
+
     public List<Resource> get(ResourceType type) {
         List<Resource> resourceList = new ArrayList<Resource>();
         begin();
@@ -142,9 +165,9 @@ public class ProjectResource extends Abs
             if (results.size() != 0) {
                 for (Object result : results) {
                     User_Workflow userWorkflow = (User_Workflow) result;
-                    UserWorkflowResource userWorkflowResource = new UserWorkflowResource(userWorkflow.getProject_ID(),
userWorkflow.getUser_name(), userWorkflow.getUser_workflow_name());
-                    userWorkflowResource.setContent(userWorkflow.getWorkflow_content());
-                    userWorkflowResource.setLastUpdateDate(userWorkflow.getLast_update_date());
+                    UserWorkflowResource userWorkflowResource = new UserWorkflowResource(userWorkflow.getGateway().getGateway_name(),
userWorkflow.getUser().getUser_name(), userWorkflow.getTemplate_name());
+                    userWorkflowResource.setContent(userWorkflow.getWorkflow_graph());
+                    userWorkflowResource.setLastUpdateDate(userWorkflow.getLast_updated_date());
                     resourceList.add(userWorkflowResource);
                 }
             }

Modified: incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/PublishWorkflowResource.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/PublishWorkflowResource.java?rev=1382136&r1=1382135&r2=1382136&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/PublishWorkflowResource.java
(original)
+++ incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/PublishWorkflowResource.java
Fri Sep  7 19:48:52 2012
@@ -25,7 +25,9 @@ import org.apache.airavata.persistance.r
 import org.apache.airavata.persistance.registry.jpa.model.Gateway;
 import org.apache.airavata.persistance.registry.jpa.model.Published_Workflow;
 
+import javax.persistence.Query;
 import java.sql.Date;
+import java.util.ArrayList;
 import java.util.List;
 
 public class PublishWorkflowResource extends AbstractResource {
@@ -86,10 +88,31 @@ public class PublishWorkflowResource ext
         throw new UnsupportedOperationException();
     }
 
+    public void removeMe(Object[] keys) {
+
+    }
+
     public Resource get(ResourceType type, Object name) {
         throw new UnsupportedOperationException();
     }
 
+    public List<Resource> getMe(Object[] keys) {
+        List<Resource> list = new ArrayList<Resource>();
+        begin();
+        Query q = em.createQuery("SELECT p FROM Published_Workflow p WHERE p.gateway_name
= :gate_name and p.publish_workflow_name =:pub_wf_name");
+        q.setParameter("gate_name", keys[0]);
+        q.setParameter("pub_wf_name", keys[1]);
+        Published_Workflow publishedWorkflow = (Published_Workflow)q.getSingleResult();
+        PublishWorkflowResource publishWorkflowResource = new PublishWorkflowResource();
+        publishWorkflowResource.setGatewayName(publishedWorkflow.getGateway().getGateway_name());
+        publishWorkflowResource.setContent(publishedWorkflow.getWorkflow_content());
+        publishWorkflowResource.setPublishedDate(publishedWorkflow.getPublished_date());
+        publishWorkflowResource.setVersion(publishedWorkflow.getVersion());
+        end();
+        list.add(publishWorkflowResource);
+        return list;
+    }
+
     public List<Resource> get(ResourceType type) {
         throw new UnsupportedOperationException();
     }
@@ -103,15 +126,11 @@ public class PublishWorkflowResource ext
         publishedWorkflow.setWorkflow_content(content);
         Gateway gateway = new Gateway();
         gateway.setGateway_name(gatewayName);
-        publishedWorkflow.setGateway_name(gatewayName);
+        publishedWorkflow.setGateway(gateway);
         em.persist(gateway);
         end();
     }
 
-    public void setName(String name) {
-        this.name = name;
-    }
-
     public boolean isExists(ResourceType type, Object name) {
         throw new UnsupportedOperationException();
     }

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=1382136&r1=1382135&r2=1382136&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  7 19:48:52 2012
@@ -96,6 +96,10 @@ public class ServiceDescriptorResource e
 
     }
 
+    public void removeMe(Object[] keys) {
+
+    }
+
     public Resource get(ResourceType type, Object name) {
         if (type == ResourceType.APPLICATION_DESCRIPTOR) {
             begin();
@@ -104,17 +108,31 @@ public class ServiceDescriptorResource e
             q.setParameter("service_desc_name", serviceDescName);
             q.setParameter("gate_name", gatewayName);
             Application_Descriptor eappDesc = (Application_Descriptor) q.getSingleResult();
-            ApplicationDescriptorResource applicationDescriptorResource = new ApplicationDescriptorResource(eappDesc.getApplication_descriptor_ID());
-            applicationDescriptorResource.setGatewayName(eappDesc.getGateway().getGateway_name());
+            ApplicationDescriptorResource applicationDescriptorResource = new ApplicationDescriptorResource(eappDesc.getApplication_descriptor_ID(),
+                    eappDesc.getGateway().getGateway_name(), eappDesc.getHost_descriptor_ID(),
eappDesc.getService_descriptor_ID());
             applicationDescriptorResource.setContent(eappDesc.getApplication_descriptor_xml());
-            applicationDescriptorResource.setHostDescName(eappDesc.getHost_descriptor().getHost_descriptor_ID());
-            applicationDescriptorResource.setServiceDescName(serviceDescName);
+            applicationDescriptorResource.setUpdatedUser(eappDesc.getUser().getUser_name());
             end();
             return applicationDescriptorResource;
         }
         return null;
     }
 
+    public List<Resource> getMe(Object[] keys) {
+        List<Resource> list = new ArrayList<Resource>();
+        begin();
+        Query q = em.createQuery("SELECT p FROM Service_Descriptor p WHERE p.service_descriptor_ID
= :service_desc_name");
+        q.setParameter("service_desc_name", keys[0]);
+        Service_Descriptor serviceDescriptor = (Service_Descriptor)q.getSingleResult();
+        ServiceDescriptorResource serviceDescriptorResource = new ServiceDescriptorResource(serviceDescriptor.getService_descriptor_ID());
+        serviceDescriptorResource.setGatewayName(serviceDescriptor.getGateway().getGateway_name());
+        serviceDescriptorResource.setUserName(serviceDescriptor.getUser().getUser_name());
+        serviceDescriptorResource.setContent(serviceDescriptor.getService_descriptor_xml());
+        end();
+        list.add(serviceDescriptorResource);
+        return list;
+    }
+
     public List<Resource> get(ResourceType type) {
         List<Resource> resourceList = new ArrayList<Resource>();
         if (type == ResourceType.APPLICATION_DESCRIPTOR) {
@@ -126,11 +144,12 @@ public class ServiceDescriptorResource e
             if (results.size() != 0) {
                 for (Object result : results) {
                     Application_Descriptor applicationDescriptor = (Application_Descriptor)
result;
-                    ApplicationDescriptorResource applicationDescriptorResource = new ApplicationDescriptorResource(applicationDescriptor.getApplication_descriptor_ID());
-                    applicationDescriptorResource.setGatewayName(gatewayName);
+                    ApplicationDescriptorResource applicationDescriptorResource = new ApplicationDescriptorResource(applicationDescriptor.getApplication_descriptor_ID(),
+                            applicationDescriptor.getGateway().getGateway_name(),
+                            applicationDescriptor.getHost_descriptor_ID(),
+                            applicationDescriptor.getService_descriptor_ID());
                     applicationDescriptorResource.setContent(applicationDescriptor.getApplication_descriptor_xml());
-                    applicationDescriptorResource.setHostDescName(applicationDescriptor.getHost_descriptor().getHost_descriptor_ID());
-                    applicationDescriptorResource.setServiceDescName(serviceDescName);
+                    applicationDescriptorResource.setUpdatedUser(applicationDescriptor.getUser().getUser_name());
                     resourceList.add(applicationDescriptorResource);
                 }
             }
@@ -167,8 +186,4 @@ public class ServiceDescriptorResource e
         }
         return false;
     }
-
-    public void setServiceDescName(String serviceDescName) {
-        this.serviceDescName = serviceDescName;
-    }
 }

Modified: incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/UserResource.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/UserResource.java?rev=1382136&r1=1382135&r2=1382136&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/UserResource.java
(original)
+++ incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/UserResource.java
Fri Sep  7 19:48:52 2012
@@ -88,6 +88,10 @@ public class UserResource extends Abstra
 
     }
 
+    public void removeMe(Object[] keys) {
+
+    }
+
     public Resource get(ResourceType type, Object name) {
         begin();
         if (type == ResourceType.USER_WORKFLOW) {
@@ -95,9 +99,9 @@ public class UserResource extends Abstra
             q.setParameter("user_name", userName);
             q.setParameter("usrwf_name", name);
             User_Workflow userWorkflow = (User_Workflow) q.getSingleResult();
-            UserWorkflowResource userWorkflowResource = new UserWorkflowResource(userWorkflow.getProject_ID(),
userName, userWorkflow.getUser_workflow_name());
-            userWorkflowResource.setContent(userWorkflow.getWorkflow_content());
-            userWorkflowResource.setLastUpdateDate(userWorkflow.getLast_update_date());
+            UserWorkflowResource userWorkflowResource = new UserWorkflowResource(userWorkflow.getGateway().getGateway_name(),
userName, userWorkflow.getTemplate_name());
+            userWorkflowResource.setContent(userWorkflow.getWorkflow_graph());
+            userWorkflowResource.setLastUpdateDate(userWorkflow.getLast_updated_date());
             end();
             return userWorkflowResource;
         } else if (type == ResourceType.EXPERIMENT) {
@@ -119,6 +123,10 @@ public class UserResource extends Abstra
         return null;
     }
 
+    public List<Resource> getMe(Object[] keys) {
+        throw new UnsupportedOperationException();
+    }
+
     public List<Resource> get(ResourceType type) {
         List<Resource> resourceList = new ArrayList<Resource>();
         begin();
@@ -129,9 +137,9 @@ public class UserResource extends Abstra
             if (results.size() != 0) {
                 for (Object result : results) {
                     User_Workflow userWorkflow = (User_Workflow) result;
-                    UserWorkflowResource userWorkflowResource = new UserWorkflowResource(userWorkflow.getProject_ID(),
userWorkflow.getUser_name(), userWorkflow.getUser_workflow_name());
-                    userWorkflowResource.setContent(userWorkflow.getWorkflow_content());
-                    userWorkflowResource.setLastUpdateDate(userWorkflow.getLast_update_date());
+                    UserWorkflowResource userWorkflowResource = new UserWorkflowResource(userWorkflow.getGateway().getGateway_name(),
userWorkflow.getUser().getUser_name(), userWorkflow.getTemplate_name());
+                    userWorkflowResource.setContent(userWorkflow.getWorkflow_graph());
+                    userWorkflowResource.setLastUpdateDate(userWorkflow.getLast_updated_date());
                     resourceList.add(userWorkflowResource);
                 }
             }

Modified: incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/UserWorkflowResource.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/UserWorkflowResource.java?rev=1382136&r1=1382135&r2=1382136&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/UserWorkflowResource.java
(original)
+++ incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/UserWorkflowResource.java
Fri Sep  7 19:48:52 2012
@@ -22,15 +22,17 @@ package org.apache.airavata.persistance.
 
 import org.apache.airavata.persistance.registry.jpa.Resource;
 import org.apache.airavata.persistance.registry.jpa.ResourceType;
-import org.apache.airavata.persistance.registry.jpa.model.Project;
+import org.apache.airavata.persistance.registry.jpa.model.Gateway;
 import org.apache.airavata.persistance.registry.jpa.model.User_Workflow;
 import org.apache.airavata.persistance.registry.jpa.model.Users;
 
+import javax.persistence.Query;
 import java.sql.Date;
+import java.util.ArrayList;
 import java.util.List;
 
 public class UserWorkflowResource extends AbstractResource {
-    private int projectID;
+    private String gatewayname;
     private String userName;
     private String name;
     private Date lastUpdateDate;
@@ -39,14 +41,14 @@ public class UserWorkflowResource extend
     public UserWorkflowResource() {
     }
 
-    public UserWorkflowResource(int projectID, String userName, String name) {
-        this.projectID = projectID;
+    public UserWorkflowResource(String gatewayname, String userName, String name) {
+        this.gatewayname = gatewayname;
         this.userName = userName;
         this.name = name;
     }
 
-    public int getProjectID() {
-        return projectID;
+    public String getGatewayname() {
+        return gatewayname;
     }
 
     public String getUserName() {
@@ -73,8 +75,8 @@ public class UserWorkflowResource extend
         return content;
     }
 
-    public void setProjectID(int projectID) {
-        this.projectID = projectID;
+    public void setGatewayname(String gatewayname) {
+        this.gatewayname = gatewayname;
     }
 
     public void setUserName(String userName) {
@@ -93,10 +95,37 @@ public class UserWorkflowResource extend
         throw new UnsupportedOperationException();
     }
 
+    public void removeMe(Object[] keys) {
+
+    }
+
     public Resource get(ResourceType type, Object name) {
         throw new UnsupportedOperationException();
     }
 
+    /**
+     *
+     * @param keys should be in the order of gateway_name,user_name and user_workflow_name
+     * @return
+     */
+    public List<Resource> getMe(Object[] keys) {
+        List<Resource> list = new ArrayList<Resource>();
+        begin();
+        Query q = em.createQuery("SELECT p FROM User_Workflow p WHERE p.gateway_name = :gate_name
and p.user_name =:usr_name and p.user_workflow_name=:usr_wf_name");
+        q.setParameter("gate_name", keys[0]);
+        q.setParameter("usr_name", keys[1]);
+        q.setParameter("usr_wf_name",keys[2]);
+        User_Workflow userWorkflow = (User_Workflow)q.getSingleResult();
+        UserWorkflowResource userWorkflowResource = new UserWorkflowResource();
+        userWorkflowResource.setUserName(userWorkflow.getUser().getUser_name());
+        userWorkflowResource.setGatewayname(userWorkflow.getGateway().getGateway_name());
+        userWorkflowResource.setName(userWorkflow.getTemplate_name());
+        userWorkflowResource.setContent(userWorkflow.getWorkflow_graph());
+        end();
+        list.add(userWorkflowResource);
+        return list;
+    }
+
     public List<Resource> get(ResourceType type) {
         throw new UnsupportedOperationException();
     }
@@ -104,15 +133,15 @@ public class UserWorkflowResource extend
     public void save() {
         begin();
         User_Workflow userWorkflow = new User_Workflow();
-        userWorkflow.setUser_workflow_name(name);
-        userWorkflow.setLast_update_date(lastUpdateDate);
-        userWorkflow.setWorkflow_content(content);
-        Project project = new Project();
-        project.setProject_ID(projectID);
-        userWorkflow.setProject_ID(projectID);
+        userWorkflow.setTemplate_name(name);
+        userWorkflow.setLast_updated_date(lastUpdateDate);
+        userWorkflow.setWorkflow_graph(content);
+        Gateway gateway = new Gateway();
+        gateway.setGateway_name(gatewayname);
+        userWorkflow.setGateway(gateway);
         Users user = new Users();
         user.setUser_name(userName);
-        userWorkflow.setUser_name(userName);
+        userWorkflow.setUser(user);
         em.persist(userWorkflow);
         end();
     }

Modified: incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/resources/data.sql
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/resources/data.sql?rev=1382136&r1=1382135&r2=1382136&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/resources/data.sql
(original)
+++ incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/resources/data.sql
Fri Sep  7 19:48:52 2012
@@ -1,6 +1,7 @@
 create table Gateway
 (
         gateway_name varchar(255),
+	    owner varchar(255),
         PRIMARY KEY (gateway_name)
 );
 
@@ -44,71 +45,75 @@ create table Project
 create table Published_Workflow
 (
        gateway_name varchar(255),
+       created_user varchar(255),
        publish_workflow_name varchar(255),
        version varchar(255),
        published_date DATE,
+       path varchar (255),
        workflow_content varchar(2000),
        PRIMARY KEY(gateway_name, publish_workflow_name),
-       FOREIGN KEY (gateway_name) REFERENCES Gateway(gateway_name) ON DELETE CASCADE
+       FOREIGN KEY (gateway_name) REFERENCES Gateway(gateway_name) ON DELETE CASCADE,
+       FOREIGN KEY (created_user) REFERENCES Users(user_name) ON DELETE CASCADE
 );
 
 create table User_Workflow
 (
        gateway_name varchar(255),
-       user_name varchar(255),
-       user_workflow_name varchar(255),
-       last_update_date DATE,
-       workflow_content varchar(2000),
-       PRIMARY KEY(project_ID, user_name, user_workflow_name),
-       FOREIGN KEY (project_ID) REFERENCES Project(project_ID) ON DELETE CASCADE,
-       FOREIGN KEY (user_name) REFERENCES Users(user_name) ON DELETE CASCADE
+       owner varchar(255),
+       template_name varchar(255),
+       last_updated_date DATE,
+       path varchar (255),
+       workflow_graph varchar(2000),
+       PRIMARY KEY(gateway_name, owner, template_name),
+       FOREIGN KEY (gateway_name) REFERENCES Gateway(gateway_name) ON DELETE CASCADE,
+       FOREIGN KEY (owner) REFERENCES Users(user_name) ON DELETE CASCADE
 );
 
 
 create table Host_Descriptor
 (
        gateway_name varchar(255),
-       user_name varchar(255),
+       updated_user varchar(255),
        host_descriptor_ID varchar(255),
        host_descriptor_xml varchar(2000),
-       PRIMARY KEY(host_descriptor_ID),
+       PRIMARY KEY(gateway_name, host_descriptor_ID),
        FOREIGN KEY (gateway_name) REFERENCES Gateway(gateway_name) ON DELETE CASCADE,
-       FOREIGN KEY (user_name) REFERENCES Users(user_name) ON DELETE CASCADE
+       FOREIGN KEY (updated_user) REFERENCES Users(user_name) ON DELETE CASCADE
 );
 
 create table Service_Descriptor
 (
          gateway_name varchar(255),
-         user_name varchar(255),
+         updated_user varchar(255),
          service_descriptor_ID varchar(255),
          service_descriptor_xml varchar(2000),
-         PRIMARY KEY(service_descriptor_ID),
+         PRIMARY KEY(gateway_name,service_descriptor_ID),
          FOREIGN KEY (gateway_name) REFERENCES Gateway(gateway_name) ON DELETE CASCADE,
-         FOREIGN KEY (user_name) REFERENCES Users(user_name) ON DELETE CASCADE
+         FOREIGN KEY (updated_user) REFERENCES Users(user_name) ON DELETE CASCADE
 );
 
 create table Application_Descriptor
 (
          gateway_name varchar(255),
-         user_name varchar(255),
+         updated_user varchar(255),
          application_descriptor_ID varchar(255),
          host_descriptor_ID varchar(255),
          service_descriptor_ID varchar(255),
          application_descriptor_xml varchar(2000),
-         PRIMARY KEY(application_descriptor_ID),
+         PRIMARY KEY(gateway_name,host_descriptor_ID, service_descriptor_ID,application_descriptor_ID),
          FOREIGN KEY (gateway_name) REFERENCES Gateway(gateway_name) ON DELETE CASCADE,
-         FOREIGN KEY (host_descriptor_ID) REFERENCES Host_Descriptor(host_descriptor_ID)
ON DELETE CASCADE,
-         FOREIGN KEY (service_descriptor_ID) REFERENCES Service_Descriptor(service_descriptor_ID)
ON DELETE CASCADE,
-         FOREIGN KEY (user_name) REFERENCES Users(user_name) ON DELETE CASCADE
+         FOREIGN KEY (updated_user) REFERENCES Users(user_name) ON DELETE CASCADE
 );
 
 create table Experiment
 (
           project_ID int(11),
+	      gateway_name varchar(255),
           user_name varchar(255),
           experiment_ID varchar(255),
           submitted_date Date,
           PRIMARY KEY(experiment_ID),
+          FOREIGN KEY (gateway_name) REFERENCES Gateway(gateway_name) ON DELETE CASCADE,
           FOREIGN KEY (project_ID) REFERENCES Project(project_ID) ON DELETE CASCADE,
           FOREIGN KEY (user_name) REFERENCES Users(user_name) ON DELETE CASCADE
 );



Mime
View raw message