airavata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lah...@apache.org
Subject svn commit: r1384133 - in /incubator/airavata/trunk/modules/registry/airavata-registry-service: pom.xml src/main/java/org/apache/airavata/registry/services/RegistryService.java
Date Wed, 12 Sep 2012 21:24:24 GMT
Author: lahiru
Date: Wed Sep 12 21:24:24 2012
New Revision: 1384133

URL: http://svn.apache.org/viewvc?rev=1384133&view=rev
Log:
ADding data during startup.

Modified:
    incubator/airavata/trunk/modules/registry/airavata-registry-service/pom.xml
    incubator/airavata/trunk/modules/registry/airavata-registry-service/src/main/java/org/apache/airavata/registry/services/RegistryService.java

Modified: incubator/airavata/trunk/modules/registry/airavata-registry-service/pom.xml
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/registry/airavata-registry-service/pom.xml?rev=1384133&r1=1384132&r2=1384133&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/registry/airavata-registry-service/pom.xml (original)
+++ incubator/airavata/trunk/modules/registry/airavata-registry-service/pom.xml Wed Sep 12
21:24:24 2012
@@ -57,6 +57,12 @@
             <version>${org.slf4j.version}</version>
             <scope>runtime</scope>
         </dependency>
+	<dependency>
+            <groupId>org.apache.airavata</groupId>
+            <artifactId>airavata-jpa-registry</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+
 
 	</dependencies>
     <build>

Modified: incubator/airavata/trunk/modules/registry/airavata-registry-service/src/main/java/org/apache/airavata/registry/services/RegistryService.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/registry/airavata-registry-service/src/main/java/org/apache/airavata/registry/services/RegistryService.java?rev=1384133&r1=1384132&r2=1384133&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/registry/airavata-registry-service/src/main/java/org/apache/airavata/registry/services/RegistryService.java
(original)
+++ incubator/airavata/trunk/modules/registry/airavata-registry-service/src/main/java/org/apache/airavata/registry/services/RegistryService.java
Wed Sep 12 21:24:24 2012
@@ -20,6 +20,10 @@
 */
 package org.apache.airavata.registry.services;
 
+import org.apache.airavata.persistance.registry.jpa.ResourceType;
+import org.apache.airavata.persistance.registry.jpa.resources.GatewayResource;
+import org.apache.airavata.persistance.registry.jpa.resources.UserResource;
+import org.apache.airavata.persistance.registry.jpa.resources.WorkerResource;
 import org.apache.airavata.registry.services.utils.DatabaseCreator;
 import org.apache.airavata.registry.services.utils.JdbcStorage;
 import org.apache.axis2.context.ConfigurationContext;
@@ -37,6 +41,9 @@ public class RegistryService implements 
     private static final Logger logger = LoggerFactory.getLogger(RegistryService.class);
 
     public static final String PERSISTANT_DATA = "Configuration";
+    public static final String GATEWAY_ID = "gateway.id";
+    public static final String REGISTRY_USER = "registry.user";
+    public static final String REGISTRY_PASSWORD = "registry.password";
     private JdbcStorage db;
 
     @Override
@@ -73,6 +80,17 @@ public class RegistryService implements 
         } finally {
             db.closeConnection(conn);
         }
+        GatewayResource gatewayResource = new GatewayResource();
+        gatewayResource.setGatewayName((String)properties.get(GATEWAY_ID));
+        gatewayResource.setOwner((String)properties.get(GATEWAY_ID));
+        gatewayResource.save();
+        UserResource userResource = (UserResource)gatewayResource.create(ResourceType.USER);
+        userResource.setUserName((String)properties.get(REGISTRY_USER));
+        userResource.setPassword((String)properties.get(REGISTRY_PASSWORD));
+        userResource.save();
+        WorkerResource workerResource = (WorkerResource)gatewayResource.create(ResourceType.GATEWAY_WORKER);
+        workerResource.setUser(userResource.getUserName());
+        workerResource.save();
     }
 
     @Override



Mime
View raw message