airavata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lah...@apache.org
Subject svn commit: r1381686 - in /incubator/airavata/trunk/modules: commons/provenance-registry/src/main/java/org/ commons/provenance-registry/src/main/resources/ commons/provenance-registry/src/main/resources/META-INF/ commons/provenance-registry/src/test/ja...
Date Thu, 06 Sep 2012 17:34:26 GMT
Author: lahiru
Date: Thu Sep  6 17:34:25 2012
New Revision: 1381686

URL: http://svn.apache.org/viewvc?rev=1381686&view=rev
Log:
Applying the patch provided by Chathuri for AIRAVATA-562

Added:
    incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/
      - copied from r1381682, incubator/airavata/trunk/modules/commons/provenance-registry/src/main/java/org/
    incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/resources/META-INF/
      - copied from r1381682, incubator/airavata/trunk/modules/commons/provenance-registry/src/main/resources/META-INF/
    incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/resources/data.sql
      - copied, changed from r1381682, incubator/airavata/trunk/modules/commons/provenance-registry/src/main/resources/data.sql
    incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/test/java/org/
      - copied from r1381682, incubator/airavata/trunk/modules/commons/provenance-registry/src/test/java/org/
Removed:
    incubator/airavata/trunk/modules/commons/provenance-registry/src/main/java/org/
    incubator/airavata/trunk/modules/commons/provenance-registry/src/main/resources/META-INF/
    incubator/airavata/trunk/modules/commons/provenance-registry/src/main/resources/data.sql
    incubator/airavata/trunk/modules/commons/provenance-registry/src/test/java/org/
Modified:
    incubator/airavata/trunk/modules/registry/airavata-jpa-registry/pom.xml
    incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/Resource.java
    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/Test.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/Configuration.java
    incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Experiment.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/model/Host_Descriptor.java
    incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Project.java
    incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Published_Workflow.java
    incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Service_Descriptor.java
    incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/User_Workflow.java
    incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Users.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/ApplicationDescriptorResource.java
    incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/ConfigurationResource.java
    incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/ExperimentResource.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/HostDescriptorResource.java
    incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/ProjectResource.java
    incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/PublishWorkflowResource.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/java/org/apache/airavata/persistance/registry/jpa/resources/UserResource.java
    incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/UserWorkflowResource.java
    incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/resources/META-INF/persistence.xml

Modified: incubator/airavata/trunk/modules/registry/airavata-jpa-registry/pom.xml
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/registry/airavata-jpa-registry/pom.xml?rev=1381686&r1=1381685&r2=1381686&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/registry/airavata-jpa-registry/pom.xml (original)
+++ incubator/airavata/trunk/modules/registry/airavata-jpa-registry/pom.xml Thu Sep  6 17:34:25 2012
@@ -60,11 +60,6 @@
         	<version>2.2.0</version>
         </dependency>
         <dependency>
-        	<groupId>mysql</groupId>
-        	<artifactId>mysql-connector-java</artifactId>
-        	<version>5.1.21</version>
-        </dependency>
-        <dependency>
             <groupId>org.apache.airavata</groupId>
             <artifactId>airavata-registry-api</artifactId>
             <version>${project.version}</version>

Modified: incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/Resource.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/Resource.java?rev=1381686&r1=1381682&r2=1381686&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/Resource.java (original)
+++ incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/Resource.java Thu Sep  6 17:34:25 2012
@@ -1,3 +1,23 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+*/
 package org.apache.airavata.persistance.registry.jpa;
 
 import java.util.List;

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=1381686&r1=1381682&r2=1381686&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 Thu Sep  6 17:34:25 2012
@@ -1,3 +1,23 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+*/
 package org.apache.airavata.persistance.registry.jpa;
 
 public enum ResourceType {

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=1381686&r1=1381682&r2=1381686&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 Thu Sep  6 17:34:25 2012
@@ -1,15 +1,46 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+*/
 package org.apache.airavata.persistance.registry.jpa;
 
+import org.apache.airavata.persistance.registry.jpa.resources.GatewayResource;
+import org.apache.airavata.persistance.registry.jpa.resources.UserResource;
+
 public class ResourceUtils {
-    public static Resource createGateway (){
+    public static Resource createGateway() {
         return null;
     }
 
-    public static boolean isGatewayExist(String gatewayName){
+    public static boolean isGatewayExist(String gatewayName) {
         return true;
     }
 
-    public static boolean removeGateway (){
+    public static boolean removeGateway() {
         return true;
     }
+
+    public static void addGatewayWorker(GatewayResource gatewayResource, UserResource userResource) {
+
+    }
+
+    public static void removeGatewayWorker(GatewayResource gatewayResource, UserResource userResource) {
+
+    }
 }

Modified: incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/Test.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/Test.java?rev=1381686&r1=1381682&r2=1381686&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/Test.java (original)
+++ incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/Test.java Thu Sep  6 17:34:25 2012
@@ -1,10 +1,56 @@
 package org.apache.airavata.persistance.registry.jpa;
 
+import org.apache.airavata.persistance.registry.jpa.model.Project;
+import org.apache.airavata.persistance.registry.jpa.model.Users;
+import org.apache.airavata.persistance.registry.jpa.resources.ApplicationDescriptorResource;
 import org.apache.airavata.persistance.registry.jpa.resources.GatewayResource;
+import org.apache.airavata.persistance.registry.jpa.resources.HostDescriptorResource;
 import org.apache.airavata.persistance.registry.jpa.resources.ProjectResource;
+import org.apache.airavata.persistance.registry.jpa.resources.PublishWorkflowResource;
+import org.apache.airavata.persistance.registry.jpa.resources.ServiceDescriptorResource;
+import org.apache.airavata.persistance.registry.jpa.resources.UserResource;
+import org.apache.airavata.registry.api.PublishedWorkflowRegistry;
+
+import java.sql.Date;
+
 
 public class Test {
+
+    public static void main(String[] args) {
+        GatewayResource gatewayResource = new GatewayResource();
+        gatewayResource.setName("abc");
+//        gatewayResource.setGatewayID(1);
+
+        // ProjectResource projectResource = (ProjectResource)gatewayResource.create(ResourceType.PROJECT);
+        UserResource userResource = (UserResource)gatewayResource.create(ResourceType.USER);
+        //PublishWorkflowResource publishWorkflowResource = (PublishWorkflowResource)gatewayResource.create(ResourceType.PUBLISHED_WORKFLOW);
+        //ServiceDescriptorResource serviceDescriptorResource = (ServiceDescriptorResource) gatewayResource.create(ResourceType.SERVICE_DESCRIPTOR);
+        //HostDescriptorResource hostDescriptorResource = (HostDescriptorResource) gatewayResource.create(ResourceType.HOST_DESCRIPTOR);
+        //ApplicationDescriptorResource applicationDescriptorResource = (ApplicationDescriptorResource) gatewayResource.create(ResourceType.APPLICATION_DESCRIPTOR);
+
+
+        userResource.setUserName("chathuri");
+        userResource.setPassword("11111111");
+
+       // projectResource.setName("myproject");
+
+        //userResource.setProjectResource(projectResource);
+
+        //Date date = new Date(2012, 9, 5);
+
+        //publishWorkflowResource.setPublishedDate(date);
+        //publishWorkflowResource.setContent("mycontent");
+        //publishWorkflowResource.setVersion("1");
+
+        gatewayResource.save();
+        userResource.save();
+        //projectResource.save();
+        //publishWorkflowResource.save();
+
+    }
+
     public void test() {
+
         GatewayResource gatewayResource = new GatewayResource();
 
         ProjectResource p = (ProjectResource) gatewayResource.create(ResourceType.PROJECT);

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=1381686&r1=1381682&r2=1381686&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 Thu Sep  6 17:34:25 2012
@@ -1,3 +1,24 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+*/
+
 package org.apache.airavata.persistance.registry.jpa.model;
 
 import javax.persistence.*;
@@ -9,19 +30,19 @@ public class Application_Descriptor {
     private String application_descriptor_xml;
 
     @ManyToOne
-    @JoinColumn(name="gateway_ID")
+    @JoinColumn(name = "gateway_ID")
     private Gateway gateway;
 
     @OneToOne
-    @JoinColumn(name="service_descriptor_ID")
+    @JoinColumn(name = "service_descriptor_ID")
     private Service_Descriptor service_descriptor;
 
-    @OneToMany
-    @JoinColumn(name="host_descriptor_ID")
+    @ManyToOne
+    @JoinColumn(name = "host_descriptor_ID")
     private Host_Descriptor host_descriptor;
 
-    @ManyToMany
-    @JoinColumn(name="user_ID")
+    @ManyToOne
+    @JoinColumn(name = "user_ID")
     private Users user;
 
     public String getApplication_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=1381686&r1=1381682&r2=1381686&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 Thu Sep  6 17:34:25 2012
@@ -1,3 +1,23 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+*/
 package org.apache.airavata.persistance.registry.jpa.model;
 
 import javax.persistence.Entity;

Modified: incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Experiment.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.java?rev=1381686&r1=1381682&r2=1381686&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Experiment.java (original)
+++ incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Experiment.java Thu Sep  6 17:34:25 2012
@@ -1,8 +1,30 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+*/
+
 package org.apache.airavata.persistance.registry.jpa.model;
 
 import javax.persistence.Entity;
 import javax.persistence.Id;
 import javax.persistence.JoinColumn;
+import javax.persistence.ManyToOne;
 import javax.persistence.OneToMany;
 import java.sql.Date;
 
@@ -12,12 +34,12 @@ public class Experiment {
     private String experiment_ID;
     private Date submitted_date;
 
-    @OneToMany
-    @JoinColumn(name="user_ID")
+    @ManyToOne
+    @JoinColumn(name = "user_ID")
     private Users user;
 
-    @OneToMany
-    @JoinColumn(name="project_ID")
+    @ManyToOne
+    @JoinColumn(name = "project_ID")
     private Project project;
 
     public String getExperiment_ID() {

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=1381686&r1=1381682&r2=1381686&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 Thu Sep  6 17:34:25 2012
@@ -1,22 +1,100 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+*/
 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;
 
 @Entity
 @IdClass(Gateway_Worker_PK.class)
 public class Gateway_Worker {
+    @Id
+    private int gateway_ID;
+
+    @Id
+    private int user_ID;
+
+    @ManyToOne
+    @JoinColumn(name = "gateway_ID")
+    private Gateway gateway;
 
 
+    @ManyToOne
+    @JoinColumn(name = "user_ID")
+    private Users user;
+
+    public int getUser_ID() {
+        return user_ID;
+    }
+
+    public void setUser_ID(int user_ID) {
+        this.user_ID = user_ID;
+    }
+
+    public int getGateway_ID() {
+        return gateway_ID;
+    }
+
+    public void setGateway(Gateway gateway) {
+        this.gateway = gateway;
+    }
+
+    public Gateway getGateway() {
+        return gateway;
+    }
+
+    public Users getUser() {
+        return user;
+    }
+
+    public void setGateway_ID(int gateway_ID) {
+        this.gateway_ID = gateway_ID;
+    }
+
+    public void setUser(Users user) {
+        this.user = user;
+    }
 }
 
 class Gateway_Worker_PK {
     private int gateway_ID;
     private int user_ID;
 
-    Gateway_Worker_PK() {
+    public Gateway_Worker_PK() {
+        ;
     }
 
+    @Override
+	public boolean equals(Object o) {
+		return false;
+	}
+
+	@Override
+	public int hashCode() {
+		return 1;
+	}
+
     public int getGateway_ID() {
         return gateway_ID;
     }

Modified: incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Host_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/Host_Descriptor.java?rev=1381686&r1=1381682&r2=1381686&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Host_Descriptor.java (original)
+++ incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Host_Descriptor.java Thu Sep  6 17:34:25 2012
@@ -1,3 +1,23 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+*/
 package org.apache.airavata.persistance.registry.jpa.model;
 
 import javax.persistence.*;
@@ -9,11 +29,11 @@ public class Host_Descriptor {
     private String host_descriptor_xml;
 
     @ManyToOne
-    @JoinColumn(name="gateway_ID")
+    @JoinColumn(name = "gateway_ID")
     private Gateway gateway;
 
-    @ManyToMany
-    @JoinColumn(name="user_ID")
+    @ManyToOne
+    @JoinColumn(name = "user_ID")
     private Users user;
 
     public String getHost_descriptor_ID() {

Modified: incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Project.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/Project.java?rev=1381686&r1=1381682&r2=1381686&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Project.java (original)
+++ incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Project.java Thu Sep  6 17:34:25 2012
@@ -1,3 +1,23 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+*/
 package org.apache.airavata.persistance.registry.jpa.model;
 
 import javax.persistence.*;
@@ -9,10 +29,10 @@ public class Project {
     private String project_name;
 
     @ManyToOne
-    @JoinColumn(name="gateway_ID")
+    @JoinColumn(name = "gateway_ID")
     private Gateway gateway;
 
-    @ManyToMany
+    @ManyToOne
     @JoinColumn(name = "user_ID")
     private Users users;
 

Modified: incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Published_Workflow.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/Published_Workflow.java?rev=1381686&r1=1381682&r2=1381686&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Published_Workflow.java (original)
+++ incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Published_Workflow.java Thu Sep  6 17:34:25 2012
@@ -1,9 +1,30 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+*/
 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.OneToMany;
 import java.sql.Date;
 
@@ -18,9 +39,12 @@ public class Published_Workflow {
     private String workflow_content;
 
     @Id
-    @OneToMany()
-    @JoinColumn(name = "gateway_ID")
-    private Gateway gateway;
+    private int gateway_ID;
+
+//    @Id
+//    @ManyToOne
+//    @JoinColumn(name = "gateway_ID")
+//    private Gateway gateway;
 
     public String getPublish_workflow_name() {
         return publish_workflow_name;
@@ -38,9 +62,9 @@ public class Published_Workflow {
         return workflow_content;
     }
 
-    public Gateway getGateway() {
-        return gateway;
-    }
+//    public Gateway getGateway() {
+//        return gateway;
+//    }
 
     public void setPublish_workflow_name(String publish_workflow_name) {
         this.publish_workflow_name = publish_workflow_name;
@@ -58,19 +82,38 @@ public class Published_Workflow {
         this.workflow_content = workflow_content;
     }
 
-    public void setGateway(Gateway gateway) {
-        this.gateway = gateway;
+    public int getGateway_ID() {
+        return gateway_ID;
     }
+
+    public void setGateway_ID(int gateway_ID) {
+        this.gateway_ID = gateway_ID;
+    }
+
+    //    public void setGateway(Gateway gateway) {
+//        this.gateway = gateway;
+//    }
 }
 
 class Published_Workflow_PK {
     private int gateway_ID;
     private String publish_workflow_name;
 
-    private Published_Workflow_PK() {
-
+    public Published_Workflow_PK() {
+        ;
     }
 
+    @Override
+	public boolean equals(Object o) {
+		return false;
+	}
+
+	@Override
+	public int hashCode() {
+		return 1;
+	}
+
+
     public int getGateway_ID() {
         return gateway_ID;
     }

Modified: incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Service_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/Service_Descriptor.java?rev=1381686&r1=1381682&r2=1381686&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Service_Descriptor.java (original)
+++ incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Service_Descriptor.java Thu Sep  6 17:34:25 2012
@@ -1,3 +1,23 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+*/
 package org.apache.airavata.persistance.registry.jpa.model;
 
 import javax.persistence.*;
@@ -9,11 +29,11 @@ public class Service_Descriptor {
     private String service_descriptor_xml;
 
     @ManyToOne
-    @JoinColumn(name="gateway_ID")
+    @JoinColumn(name = "gateway_ID")
     private Gateway gateway;
 
-    @ManyToMany
-    @JoinColumn(name="user_ID")
+    @ManyToOne
+    @JoinColumn(name = "user_ID")
     private Users user;
 
     public String getService_descriptor_ID() {

Modified: incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/User_Workflow.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/User_Workflow.java?rev=1381686&r1=1381682&r2=1381686&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/User_Workflow.java (original)
+++ incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/User_Workflow.java Thu Sep  6 17:34:25 2012
@@ -1,3 +1,23 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+*/
 package org.apache.airavata.persistance.registry.jpa.model;
 
 import javax.persistence.Entity;
@@ -5,6 +25,7 @@ import javax.persistence.Id;
 import javax.persistence.IdClass;
 import javax.persistence.JoinColumn;
 import javax.persistence.ManyToMany;
+import javax.persistence.ManyToOne;
 import javax.persistence.OneToMany;
 import java.sql.Date;
 
@@ -15,14 +36,20 @@ public class User_Workflow {
     private String user_workflow_name;
 
     @Id
-	@OneToMany()
-	@JoinColumn(name = "user_ID")
-    private Users users;
+    private int project_ID;
 
     @Id
-	@ManyToMany()
-	@JoinColumn(name = "project_ID")
-    private Project project;
+    private int user_ID;
+
+//    @Id
+//    @ManyToOne
+//    @JoinColumn(name = "user_ID")
+//    private Users users;
+//
+//    @Id
+//    @ManyToOne
+//    @JoinColumn(name = "project_ID")
+//    private Project project;
 
     private Date last_update_date;
     private String workflow_content;
@@ -31,13 +58,13 @@ public class User_Workflow {
         return user_workflow_name;
     }
 
-    public Users getUsers() {
-        return users;
-    }
-
-    public Project getProject() {
-        return project;
-    }
+//    public Users getUsers() {
+//        return users;
+//    }
+//
+//    public Project getProject() {
+//        return project;
+//    }
 
     public Date getLast_update_date() {
         return last_update_date;
@@ -51,12 +78,29 @@ public class User_Workflow {
         this.user_workflow_name = user_workflow_name;
     }
 
-    public void setUsers(Users users) {
-        this.users = users;
+//    public void setUsers(Users users) {
+//        this.users = users;
+//    }
+//
+//    public void setProject(Project project) {
+//        this.project = project;
+//    }
+
+
+    public int getProject_ID() {
+        return project_ID;
     }
 
-    public void setProject(Project project) {
-        this.project = project;
+    public int getUser_ID() {
+        return user_ID;
+    }
+
+    public void setProject_ID(int project_ID) {
+        this.project_ID = project_ID;
+    }
+
+    public void setUser_ID(int user_ID) {
+        this.user_ID = user_ID;
     }
 
     public void setLast_update_date(Date last_update_date) {
@@ -68,14 +112,25 @@ public class User_Workflow {
     }
 }
 
-class User_Workflow_PK{
+class User_Workflow_PK {
     private String user_workflow_name;
     private int project_ID;
     private int user_ID;
 
-    User_Workflow_PK() {
+    public User_Workflow_PK() {
+        ;
     }
 
+    @Override
+	public boolean equals(Object o) {
+		return false;
+	}
+
+	@Override
+	public int hashCode() {
+		return 1;
+	}
+
     public String getUser_workflow_name() {
         return user_workflow_name;
     }

Modified: incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Users.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/Users.java?rev=1381686&r1=1381682&r2=1381686&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Users.java (original)
+++ incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Users.java Thu Sep  6 17:34:25 2012
@@ -1,30 +1,39 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+*/
 package org.apache.airavata.persistance.registry.jpa.model;
 
 import javax.persistence.Entity;
 import javax.persistence.Id;
 import javax.persistence.JoinColumn;
 import javax.persistence.ManyToMany;
+import javax.persistence.ManyToOne;
+import javax.persistence.OneToMany;
 
 @Entity
 public class Users {
 
-    @ManyToMany
-    @JoinColumn(name="gateway_ID")
-    private Gateway gateway;
-
     @Id
     private int user_ID;
     private String password;
     private String user_name;
-    private int gateway_ID;
-
-    public Gateway getGateway() {
-        return gateway;
-    }
-
-    public void setGateway(Gateway gateway) {
-        this.gateway = gateway;
-    }
 
     public int getUser_ID() {
         return user_ID;
@@ -34,9 +43,6 @@ public class Users {
         return user_name;
     }
 
-    public int getGateway_ID() {
-        return gateway_ID;
-    }
 
     public void setUser_ID(int user_ID) {
         this.user_ID = user_ID;
@@ -46,10 +52,6 @@ public class Users {
         this.user_name = user_name;
     }
 
-    public void setGateway_ID(int gateway_ID) {
-        this.gateway_ID = gateway_ID;
-    }
-
     public String getPassword() {
         return password;
     }

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=1381686&r1=1381682&r2=1381686&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 Thu Sep  6 17:34:25 2012
@@ -1,27 +1,49 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+*/
 package org.apache.airavata.persistance.registry.jpa.resources;
 
 import org.apache.airavata.persistance.registry.jpa.Resource;
 
 import javax.persistence.EntityManager;
 import javax.persistence.EntityManagerFactory;
+import javax.persistence.Persistence;
 
-public abstract class AbstractResource implements Resource{
+public abstract class AbstractResource implements Resource {
     private static final String PERSISTENCE_UNIT_NAME = "airavata_data";
-	protected EntityManagerFactory factory;
+    protected EntityManagerFactory factory;
 
     protected EntityManager em;
 
     protected AbstractResource() {
+        factory = Persistence.createEntityManagerFactory(PERSISTENCE_UNIT_NAME);
         em = factory.createEntityManager();
     }
 
-    protected void begin(){
-       em.getTransaction().begin();
+    protected void begin() {
+        em.getTransaction().begin();
     }
 
-    protected void end(){
+    protected void end() {
         em.getTransaction().commit();
-		em.close();
+        em.close();
 
     }
 

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=1381686&r1=1381682&r2=1381686&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 Thu Sep  6 17:34:25 2012
@@ -1,3 +1,23 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+*/
 package org.apache.airavata.persistance.registry.jpa.resources;
 
 import org.apache.airavata.persistance.registry.jpa.Resource;
@@ -9,7 +29,7 @@ import org.apache.airavata.persistance.r
 
 import java.util.List;
 
-public class ApplicationDescriptorResource extends AbstractResource{
+public class ApplicationDescriptorResource extends AbstractResource {
     private String name;
     private int gatewayID;
     private int userID;
@@ -103,6 +123,6 @@ public class ApplicationDescriptorResour
     }
 
     public boolean isExists(ResourceType type, Object name) {
-        return false;
+        throw new UnsupportedOperationException();
     }
 }

Modified: incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/ConfigurationResource.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/ConfigurationResource.java?rev=1381686&r1=1381682&r2=1381686&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/ConfigurationResource.java (original)
+++ incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/ConfigurationResource.java Thu Sep  6 17:34:25 2012
@@ -1,3 +1,23 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+*/
 package org.apache.airavata.persistance.registry.jpa.resources;
 
 import org.apache.airavata.persistance.registry.jpa.Resource;

Modified: incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/ExperimentResource.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/ExperimentResource.java?rev=1381686&r1=1381682&r2=1381686&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/ExperimentResource.java (original)
+++ incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/ExperimentResource.java Thu Sep  6 17:34:25 2012
@@ -1,3 +1,23 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+*/
 package org.apache.airavata.persistance.registry.jpa.resources;
 
 import org.apache.airavata.persistance.registry.jpa.Resource;

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=1381686&r1=1381682&r2=1381686&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 Thu Sep  6 17:34:25 2012
@@ -1,3 +1,23 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+*/
 package org.apache.airavata.persistance.registry.jpa.resources;
 
 import org.apache.airavata.persistance.registry.jpa.Resource;
@@ -257,71 +277,49 @@ public class GatewayResource extends Abs
             gateway.setGateway_ID(gatewayID);
         }
         em.persist(gateway);
+
+        System.out.println(gateway);
         end();
     }
 
     public boolean isExists(ResourceType type, Object name) {
         begin();
-        if(type == ResourceType.PROJECT){
+        if (type == ResourceType.PROJECT) {
             Query q = em.createQuery("SELECT p FROM Project p WHERE p.gateway_ID =:gate_ID and p.project_name =:proj_name");
             q.setParameter("gate_ID", gatewayID);
-            q.setParameter("proj_name",name);
-            Project project = (Project)q.getSingleResult();
-            if(project != null){
-                return true;
-            }else {
-                return false;
-            }
-        } else if (type == ResourceType.USER){
+            q.setParameter("proj_name", name);
+            Project project = (Project) q.getSingleResult();
+            return project != null;
+        } else if (type == ResourceType.USER) {
             Query q = em.createQuery("SELECT p FROM Users p WHERE p.gateway_ID =:gate_ID and p.user_name =:usr_name");
             q.setParameter("gate_ID", gatewayID);
-            q.setParameter("usr_name",name);
-            Users users = (Users)q.getSingleResult();
-            if(users != null){
-                return true;
-            }else {
-                return false;
-            }
-        }  else if (type == ResourceType.PUBLISHED_WORKFLOW){
-                Query q = em.createQuery("SELECT p FROM Published_Workflow p WHERE p.gateway_ID =:gate_ID and p.Published_Workflow =:pub_wf_name");
+            q.setParameter("usr_name", name);
+            Users users = (Users) q.getSingleResult();
+            return users != null;
+        } else if (type == ResourceType.PUBLISHED_WORKFLOW) {
+            Query q = em.createQuery("SELECT p FROM Published_Workflow p WHERE p.gateway_ID =:gate_ID and p.Published_Workflow =:pub_wf_name");
             q.setParameter("gate_ID", gatewayID);
-            q.setParameter("pub_wf_name",name);
-            Published_Workflow publishedWrkflow = (Published_Workflow)q.getSingleResult();
-            if(publishedWrkflow != null){
-                return true;
-            }else {
-                return false;
-            }
-        }  else if (type == ResourceType.HOST_DESCRIPTOR){
+            q.setParameter("pub_wf_name", name);
+            Published_Workflow publishedWrkflow = (Published_Workflow) q.getSingleResult();
+            return publishedWrkflow != null;
+        } else if (type == ResourceType.HOST_DESCRIPTOR) {
             Query q = em.createQuery("SELECT p FROM Host_Descriptor p WHERE p.gateway_ID =:gate_ID and p.host_descriptor_ID =:host_desc_name");
             q.setParameter("gate_ID", gatewayID);
-            q.setParameter("host_desc_name",name);
-            Host_Descriptor hostDescriptor = (Host_Descriptor)q.getSingleResult();
-            if(hostDescriptor != null){
-                return true;
-            }else {
-                return false;
-            }
-        }else if (type == ResourceType.SERVICE_DESCRIPTOR){
+            q.setParameter("host_desc_name", name);
+            Host_Descriptor hostDescriptor = (Host_Descriptor) q.getSingleResult();
+            return hostDescriptor != null;
+        } else if (type == ResourceType.SERVICE_DESCRIPTOR) {
             Query q = em.createQuery("SELECT p FROM Service_Descriptor p WHERE p.gateway_ID =:gate_ID and p.service_descriptor_ID =:service_desc_name");
             q.setParameter("gate_ID", gatewayID);
-            q.setParameter("service_desc_name",name);
-            Service_Descriptor serviceDescriptor = (Service_Descriptor)q.getSingleResult();
-            if(serviceDescriptor != null){
-                return true;
-            }else {
-                return false;
-            }
-        }   else if (type == ResourceType.APPLICATION_DESCRIPTOR){
+            q.setParameter("service_desc_name", name);
+            Service_Descriptor serviceDescriptor = (Service_Descriptor) q.getSingleResult();
+            return serviceDescriptor != null;
+        } else if (type == ResourceType.APPLICATION_DESCRIPTOR) {
             Query q = em.createQuery("SELECT p FROM Application_Descriptor p WHERE p.gateway_ID =:gate_ID and p.application_descriptor_ID =:app_desc_name");
             q.setParameter("gate_ID", gatewayID);
-            q.setParameter("app_desc_name",name);
-            Application_Descriptor applicationDescriptor = (Application_Descriptor)q.getSingleResult();
-            if(applicationDescriptor != null){
-                return true;
-            }else {
-                return false;
-            }
+            q.setParameter("app_desc_name", name);
+            Application_Descriptor applicationDescriptor = (Application_Descriptor) q.getSingleResult();
+            return applicationDescriptor != null;
         }
         end();
         return false;
@@ -334,4 +332,12 @@ public class GatewayResource extends Abs
     public void setName(String name) {
         this.name = name;
     }
+
+    public int getGatewayID() {
+        return gatewayID;
+    }
+
+    public void setGatewayID(int gatewayID) {
+        this.gatewayID = gatewayID;
+    }
 }

Modified: incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/HostDescriptorResource.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/HostDescriptorResource.java?rev=1381686&r1=1381682&r2=1381686&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/HostDescriptorResource.java (original)
+++ incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/HostDescriptorResource.java Thu Sep  6 17:34:25 2012
@@ -1,3 +1,23 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+*/
 package org.apache.airavata.persistance.registry.jpa.resources;
 
 import org.apache.airavata.persistance.registry.jpa.Resource;
@@ -130,6 +150,18 @@ public class HostDescriptorResource exte
     }
 
     public boolean isExists(ResourceType type, Object name) {
+        if (type == ResourceType.APPLICATION_DESCRIPTOR) {
+            begin();
+            Query q = em.createQuery("SELECT p FROM Application_Descriptor p WHERE p.host_descriptor_ID =:host_desc_id and p.application_descriptor_ID =:app_dist_id");
+            q.setParameter("host_desc_id", hostDescName);
+            q.setParameter("app_dist_id", name);
+            Application_Descriptor applicationDescriptor = (Application_Descriptor) q.getSingleResult();
+            if (applicationDescriptor != null) {
+                return true;
+            } else {
+                return false;
+            }
+        }
         return false;
     }
 }

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=1381686&r1=1381682&r2=1381686&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 Thu Sep  6 17:34:25 2012
@@ -1,3 +1,23 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+*/
 package org.apache.airavata.persistance.registry.jpa.resources;
 
 import org.apache.airavata.persistance.registry.jpa.Resource;
@@ -42,11 +62,6 @@ public class ProjectResource extends Abs
     }
 
     public Resource create(ResourceType type) {
-//        if (type == ResourceType.USER){
-//            UserResource userResource = new UserResource();
-//            userResource.setGatewayID(gatewayID);
-//            return userResource;
-//        }
         if (type == ResourceType.USER_WORKFLOW) {
             UserWorkflowResource userWorkflowResource = new UserWorkflowResource();
             userWorkflowResource.setProjectID(id);
@@ -119,7 +134,7 @@ 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().getProject_ID(), userWorkflow.getUsers().getUser_ID(), userWorkflow.getUser_workflow_name());
+                    UserWorkflowResource userWorkflowResource = new UserWorkflowResource(userWorkflow.getProject_ID(), userWorkflow.getUser_ID(), userWorkflow.getUser_workflow_name());
                     userWorkflowResource.setContent(userWorkflow.getWorkflow_content());
                     userWorkflowResource.setLastUpdateDate(userWorkflow.getLast_update_date());
                     resourceList.add(userWorkflowResource);
@@ -151,9 +166,13 @@ public class ProjectResource extends Abs
         Gateway gateway = new Gateway();
         gateway.setGateway_ID(gatewayID);
         project.setGateway(gateway);
+
         if (id != -1) {
             project.setProject_ID(id);
         }
+
+
+
         em.persist(project);
         end();
 
@@ -161,26 +180,26 @@ public class ProjectResource extends Abs
 
     public boolean isExists(ResourceType type, Object name) {
         begin();
-        if(type == ResourceType.USER_WORKFLOW){
+        if (type == ResourceType.USER_WORKFLOW) {
             Query q = em.createQuery("SELECT p FROM User_Workflow p WHERE p.gateway_ID =:gate_ID and p.user_ID =:userID and p.project_ID =:projectID");
             q.setParameter("gate_ID", gatewayID);
-            q.setParameter("userID",userResource.getId());
+            q.setParameter("userID", userResource.getId());
             q.setParameter("projectID", id);
-            User_Workflow userWorkflow = (User_Workflow)q.getSingleResult();
-            if(userWorkflow != null){
+            User_Workflow userWorkflow = (User_Workflow) q.getSingleResult();
+            if (userWorkflow != null) {
                 return true;
-            }else {
+            } else {
                 return false;
             }
-        }else if(type == ResourceType.EXPERIMENT){
+        } else if (type == ResourceType.EXPERIMENT) {
             Query q = em.createQuery("SELECT p FROM Experiment p WHERE p.gateway_ID =:gate_ID and p.user_ID =:userID and p.project_ID =:projectID");
             q.setParameter("gate_ID", gatewayID);
-            q.setParameter("userID",userResource.getId());
+            q.setParameter("userID", userResource.getId());
             q.setParameter("projectID", id);
-            Experiment experiment = (Experiment)q.getSingleResult();
-            if(experiment != null){
+            Experiment experiment = (Experiment) q.getSingleResult();
+            if (experiment != null) {
                 return true;
-            }else {
+            } else {
                 return false;
             }
         }

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=1381686&r1=1381682&r2=1381686&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 Thu Sep  6 17:34:25 2012
@@ -1,3 +1,23 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+*/
 package org.apache.airavata.persistance.registry.jpa.resources;
 
 import org.apache.airavata.persistance.registry.jpa.Resource;
@@ -59,19 +79,19 @@ public class PublishWorkflowResource ext
     }
 
     public Resource create(ResourceType type) {
-        return null;
+        throw new UnsupportedOperationException();
     }
 
     public void remove(ResourceType type, Object name) {
-
+        throw new UnsupportedOperationException();
     }
 
     public Resource get(ResourceType type, Object name) {
-        return null;
+        throw new UnsupportedOperationException();
     }
 
     public List<Resource> get(ResourceType type) {
-        return null;
+        throw new UnsupportedOperationException();
     }
 
     public void save() {
@@ -83,12 +103,12 @@ public class PublishWorkflowResource ext
         publishedWorkflow.setWorkflow_content(content);
         Gateway gateway = new Gateway();
         gateway.setGateway_ID(gatewayID);
-        publishedWorkflow.setGateway(gateway);
+        publishedWorkflow.setGateway_ID(gatewayID);
         em.persist(gateway);
         end();
     }
 
     public boolean isExists(ResourceType type, Object name) {
-        return false;
+        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=1381686&r1=1381682&r2=1381686&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 Thu Sep  6 17:34:25 2012
@@ -1,3 +1,23 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+*/
 package org.apache.airavata.persistance.registry.jpa.resources;
 
 import org.apache.airavata.persistance.registry.jpa.Resource;
@@ -133,6 +153,18 @@ public class ServiceDescriptorResource e
     }
 
     public boolean isExists(ResourceType type, Object name) {
+        if (type == ResourceType.APPLICATION_DESCRIPTOR) {
+            begin();
+            Query q = em.createQuery("SELECT p FROM Application_Descriptor p WHERE p.service_descriptor_ID =:service_desc_id and p.application_descriptor_ID =:app_dist_id");
+            q.setParameter("service_desc_id", serviceDescName);
+            q.setParameter("app_dist_id", name);
+            Application_Descriptor applicationDescriptor = (Application_Descriptor) q.getSingleResult();
+            if (applicationDescriptor != null) {
+                return true;
+            } else {
+                return false;
+            }
+        }
         return false;
     }
 }

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=1381686&r1=1381682&r2=1381686&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 Thu Sep  6 17:34:25 2012
@@ -1,9 +1,28 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+*/
 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.model.Experiment;
-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;
 
@@ -12,20 +31,17 @@ import java.util.ArrayList;
 import java.util.List;
 
 public class UserResource extends AbstractResource {
-    private int id;
+    private int id = -1;
     private String userName;
     private String password;
     private int gatewayID;
     private ProjectResource projectResource;
 
-
     public UserResource() {
     }
 
     public UserResource(int id) {
         this.id = id;
-//        this.gatewayID = gatewayID;
-//        this.projectResource = projectResource;
     }
 
     public int getId() {
@@ -66,12 +82,12 @@ public class UserResource extends Abstra
 
     public void remove(ResourceType type, Object name) {
         begin();
-        if(type == ResourceType.USER_WORKFLOW){
+        if (type == ResourceType.USER_WORKFLOW) {
             Query q = em.createQuery("Delete p FROM User_Workflow p WHERE p.user_ID = :user_id and p.user_workflow_name = :usrwf_name");
             q.setParameter("user_id", id);
             q.setParameter("usrwf_name", name);
             q.executeUpdate();
-        }else if (type == ResourceType.EXPERIMENT){
+        } else if (type == ResourceType.EXPERIMENT) {
             Query q = em.createQuery("Delete p FROM Experiment p WHERE p.user_ID = :user_id and p.experiment_ID = :ex_name");
             q.setParameter("user_id", id);
             q.setParameter("ex_name", name);
@@ -88,7 +104,7 @@ public class UserResource extends Abstra
             q.setParameter("user_id", id);
             q.setParameter("usrwf_name", name);
             User_Workflow userWorkflow = (User_Workflow) q.getSingleResult();
-            UserWorkflowResource userWorkflowResource = new UserWorkflowResource(userWorkflow.getProject().getProject_ID(), id, userWorkflow.getUser_workflow_name());
+            UserWorkflowResource userWorkflowResource = new UserWorkflowResource(userWorkflow.getProject_ID(), id, userWorkflow.getUser_workflow_name());
             userWorkflowResource.setContent(userWorkflow.getWorkflow_content());
             userWorkflowResource.setLastUpdateDate(userWorkflow.getLast_update_date());
             end();
@@ -123,7 +139,7 @@ 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().getProject_ID(), userWorkflow.getUsers().getUser_ID(), userWorkflow.getUser_workflow_name());
+                    UserWorkflowResource userWorkflowResource = new UserWorkflowResource(userWorkflow.getProject_ID(), userWorkflow.getUser_ID(), userWorkflow.getUser_workflow_name());
                     userWorkflowResource.setContent(userWorkflow.getWorkflow_content());
                     userWorkflowResource.setLastUpdateDate(userWorkflow.getLast_update_date());
                     resourceList.add(userWorkflowResource);
@@ -151,43 +167,33 @@ public class UserResource extends Abstra
     public void save() {
         begin();
         Users user = new Users();
-        Gateway gateway = new Gateway();
-        gateway.setGateway_ID(gatewayID);
-        user.setGateway(gateway);
+
         user.setUser_name(userName);
         user.setPassword(password);
+
         if (id != -1) {
             user.setUser_ID(id);
         }
         em.persist(user);
         end();
-
     }
 
     public boolean isExists(ResourceType type, Object name) {
         begin();
-        if(type == ResourceType.USER_WORKFLOW){
+        if (type == ResourceType.USER_WORKFLOW) {
             Query q = em.createQuery("SELECT p FROM User_Workflow p WHERE p.gateway_ID =:gate_ID and p.user_ID =:userID and p.user_workflow_name =:usr_wf_name");
             q.setParameter("gate_ID", gatewayID);
-            q.setParameter("userID",id);
+            q.setParameter("userID", id);
             q.setParameter("usr_wf_name", name);
-            User_Workflow userWorkflow = (User_Workflow)q.getSingleResult();
-            if(userWorkflow != null){
-                return true;
-            }else {
-                return false;
-            }
-        }else if(type == ResourceType.EXPERIMENT){
+            User_Workflow userWorkflow = (User_Workflow) q.getSingleResult();
+            return userWorkflow != null;
+        } else if (type == ResourceType.EXPERIMENT) {
             Query q = em.createQuery("SELECT p FROM Experiment p WHERE p.gateway_ID =:gate_ID and p.user_ID =:userID and p.experiment_ID =:experimentID");
             q.setParameter("gate_ID", gatewayID);
-            q.setParameter("userID",id);
+            q.setParameter("userID", id);
             q.setParameter("experimentID", name);
-            Experiment experiment = (Experiment)q.getSingleResult();
-            if(experiment != null){
-                return true;
-            }else {
-                return false;
-            }
+            Experiment experiment = (Experiment) q.getSingleResult();
+            return experiment != null;
         }
         end();
         return false;

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=1381686&r1=1381682&r2=1381686&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 Thu Sep  6 17:34:25 2012
@@ -1,3 +1,23 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+*/
 package org.apache.airavata.persistance.registry.jpa.resources;
 
 import org.apache.airavata.persistance.registry.jpa.Resource;
@@ -66,19 +86,19 @@ public class UserWorkflowResource extend
     }
 
     public Resource create(ResourceType type) {
-        return null;
+        throw new UnsupportedOperationException();
     }
 
     public void remove(ResourceType type, Object name) {
-
+        throw new UnsupportedOperationException();
     }
 
     public Resource get(ResourceType type, Object name) {
-        return null;
+        throw new UnsupportedOperationException();
     }
 
     public List<Resource> get(ResourceType type) {
-        return null;
+        throw new UnsupportedOperationException();
     }
 
     public void save() {
@@ -89,15 +109,15 @@ public class UserWorkflowResource extend
         userWorkflow.setWorkflow_content(content);
         Project project = new Project();
         project.setProject_ID(projectID);
-        userWorkflow.setProject(project);
+        userWorkflow.setProject_ID(projectID);
         Users user = new Users();
         user.setUser_ID(userID);
-        userWorkflow.setUsers(user);
+        userWorkflow.setUser_ID(userID);
         em.persist(userWorkflow);
         end();
     }
 
     public boolean isExists(ResourceType type, Object name) {
-        return false;
+        throw new UnsupportedOperationException();
     }
 }

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=1381686&r1=1381682&r2=1381686&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 Thu Sep  6 17:34:25 2012
@@ -40,4 +40,30 @@
 				value="PrettyPrint=true, PrettyPrintLineLength=72, PrintParameters=true, MaxActive=10, MaxIdle=5, MinIdle=2, MaxWait=60000" />
 		</properties>
 	</persistence-unit>
+    <persistence-unit name="airavata_data">
+        <provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider>
+        <class>org.apache.airavata.persistance.registry.jpa.model.Gateway</class>
+        <class>org.apache.airavata.persistance.registry.jpa.model.Configuration</class>
+        <class>org.apache.airavata.persistance.registry.jpa.model.Users</class>
+        <class>org.apache.airavata.persistance.registry.jpa.model.Gateway_Worker</class>
+        <class>org.apache.airavata.persistance.registry.jpa.model.Project</class>
+        <class>org.apache.airavata.persistance.registry.jpa.model.Published_Workflow</class>
+        <class>org.apache.airavata.persistance.registry.jpa.model.User_Workflow</class>
+        <class>org.apache.airavata.persistance.registry.jpa.model.Host_Descriptor</class>
+        <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>
+        <properties>
+            <property name="openjpa.ConnectionURL"
+                      value="jdbc:mysql://localhost:3306/persitant_data" />
+            <property name="openjpa.ConnectionDriverName" value="com.mysql.jdbc.Driver" />
+            <property name="openjpa.ConnectionUserName" value="root" />
+            <property name="openjpa.ConnectionPassword" value="root123" />
+            <property name="openjpa.DynamicEnhancementAgent" value="true" />
+            <property name="openjpa.RuntimeUnenhancedClasses" value="supported" />
+            <property name="openjpa.Log" value="SQL=TRACE" />
+            <property name="openjpa.ConnectionFactoryProperties"
+                      value="PrettyPrint=true, PrettyPrintLineLength=72, PrintParameters=true, MaxActive=10, MaxIdle=5, MinIdle=2, MaxWait=60000" />
+       </properties>
+    </persistence-unit>
 </persistence>
\ No newline at end of file

Copied: incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/resources/data.sql (from r1381682, incubator/airavata/trunk/modules/commons/provenance-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?p2=incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/resources/data.sql&p1=incubator/airavata/trunk/modules/commons/provenance-registry/src/main/resources/data.sql&r1=1381682&r2=1381686&rev=1381686&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/commons/provenance-registry/src/main/resources/data.sql (original)
+++ incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/resources/data.sql Thu Sep  6 17:34:25 2012
@@ -14,20 +14,22 @@ create table Configuration
         PRIMARY KEY(config_ID)
 );
 
-create table Gateway_Worker
-(
-      gateway_ID int(11) ,
-      user_ID int(11),
-      PRIMARY KEY (gateway_ID, user_ID)
-);
-
 create table Users
 (
         user_ID int(11) NOT NULL AUTO_INCREMENT,
         user_name varchar(255),
         password varchar(255),
-        PRIMARY KEY(user_ID),
-        FOREIGN KEY (gateway_ID) REFERENCES Gateway(gateway_ID) ON DELETE CASCADE
+        PRIMARY KEY(user_ID)
+);
+
+create table Gateway_Worker
+(
+      gateway_ID int(11) ,
+      user_ID int(11),
+      PRIMARY KEY (gateway_ID, user_ID),
+      FOREIGN KEY (gateway_ID) REFERENCES Gateway(gateway_ID) ON DELETE CASCADE,
+      FOREIGN KEY (user_ID) REFERENCES Users(user_ID) ON DELETE CASCADE
+
 );
 
 create table Project
@@ -38,7 +40,7 @@ create table Project
        project_name varchar(255),
        PRIMARY KEY(project_ID),
        FOREIGN KEY (gateway_ID) REFERENCES Gateway(gateway_ID) ON DELETE CASCADE,
-       FOREIGN KEY (user_ID) REFERENCES Gateway(user_ID) ON DELETE CASCADE
+       FOREIGN KEY (user_ID) REFERENCES Users(user_ID) ON DELETE CASCADE
 );
 
 create table Published_Workflow
@@ -60,7 +62,7 @@ create table User_Workflow
        last_update_date DATE,
        workflow_content varchar(2000),
        PRIMARY KEY(project_ID, user_ID, user_workflow_name),
-       FOREIGN KEY (project_ID) REFERENCES Projects(project_ID) ON DELETE CASCADE,
+       FOREIGN KEY (project_ID) REFERENCES Project(project_ID) ON DELETE CASCADE,
        FOREIGN KEY (user_ID) REFERENCES Users(user_ID) ON DELETE CASCADE
 );
 
@@ -72,7 +74,7 @@ create table Host_Descriptor
        host_descriptor_ID varchar(255),
        host_descriptor_xml varchar(2000),
        PRIMARY KEY(host_descriptor_ID),
-       FOREIGN KEY (gateway_ID) REFERENCES Gateway(gateway_ID) ON DELETE CASCADE
+       FOREIGN KEY (gateway_ID) REFERENCES Gateway(gateway_ID) ON DELETE CASCADE,
        FOREIGN KEY (user_ID) REFERENCES Users(user_ID) ON DELETE CASCADE
 );
 
@@ -83,7 +85,7 @@ create table Service_Descriptor
          service_descriptor_ID varchar(255),
          service_descriptor_xml varchar(2000),
          PRIMARY KEY(service_descriptor_ID),
-         FOREIGN KEY (gateway_ID) REFERENCES Gateway(gateway_ID) ON DELETE CASCADE
+         FOREIGN KEY (gateway_ID) REFERENCES Gateway(gateway_ID) ON DELETE CASCADE,
          FOREIGN KEY (user_ID) REFERENCES Users(user_ID) ON DELETE CASCADE
 );
 
@@ -98,7 +100,7 @@ create table Application_Descriptor
          PRIMARY KEY(application_descriptor_ID),
          FOREIGN KEY (gateway_ID) REFERENCES Gateway(gateway_ID) 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 (service_descriptor_ID) REFERENCES Service_Descriptor(service_descriptor_ID) ON DELETE CASCADE,
          FOREIGN KEY (user_ID) REFERENCES Users(user_ID) ON DELETE CASCADE
 );
 
@@ -109,7 +111,7 @@ create table Experiment
           experiment_ID varchar(255),
           submitted_date Date,
           PRIMARY KEY(experiment_ID),
-          FOREIGN KEY (project_ID) REFERENCES Projects(project_ID) ON DELETE CASCADE,
+          FOREIGN KEY (project_ID) REFERENCES Project(project_ID) ON DELETE CASCADE,
           FOREIGN KEY (user_ID) REFERENCES Users(user_ID) ON DELETE CASCADE
 );
 



Mime
View raw message