Author: chathuri
Date: Fri Sep 13 20:15:49 2013
New Revision: 1523077
URL: http://svn.apache.org/r1523077
Log:
adding default user info each time server starts
Modified:
airavata/trunk/modules/registry/airavata-jpa-registry/src/main/resources/data-derby.sql
airavata/trunk/modules/registry/airavata-jpa-registry/src/main/resources/data-mysql.sql
airavata/trunk/modules/registry/airavata-jpa-registry/src/test/resources/data-derby.sql
airavata/trunk/modules/registry/airavata-registry-service/src/main/java/org/apache/airavata/registry/services/RegistryService.java
Modified:
airavata/trunk/modules/registry/airavata-jpa-registry/src/main/resources/data-derby.sql
URL:
http://svn.apache.org/viewvc/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/resources/data-derby.sql?rev=1523077&r1=1523076&r2=1523077&view=diff
==============================================================================
---
airavata/trunk/modules/registry/airavata-jpa-registry/src/main/resources/data-derby.sql
(original)
+++
airavata/trunk/modules/registry/airavata-jpa-registry/src/main/resources/data-derby.sql
Fri Sep 13 20:15:49 2013
@@ -35,7 +35,7 @@ create table Configuration
PRIMARY KEY(config_key, config_val, category_id)
);
-INSERT INTO CONFIGURATION (config_key, config_val, expire_date, category_id)
VALUES('registry.version', '0.8', CURRENT_TIMESTAMP ,'SYSTEM');
+INSERT INTO CONFIGURATION (config_key, config_val, expire_date, category_id)
VALUES('registry.version', '0.9', CURRENT_TIMESTAMP ,'SYSTEM');
create table Users
(
Modified:
airavata/trunk/modules/registry/airavata-jpa-registry/src/main/resources/data-mysql.sql
URL:
http://svn.apache.org/viewvc/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/resources/data-mysql.sql?rev=1523077&r1=1523076&r2=1523077&view=diff
==============================================================================
---
airavata/trunk/modules/registry/airavata-jpa-registry/src/main/resources/data-mysql.sql
(original)
+++
airavata/trunk/modules/registry/airavata-jpa-registry/src/main/resources/data-mysql.sql
Fri Sep 13 20:15:49 2013
@@ -34,7 +34,7 @@ create table Configuration
PRIMARY KEY(config_key, config_val, category_id)
);
-INSERT INTO Configuration (config_key, config_val, expire_date, category_id)
VALUES('registry.version', '0.8', CURRENT_TIMESTAMP ,'SYSTEM');
+INSERT INTO Configuration (config_key, config_val, expire_date, category_id)
VALUES('registry.version', '0.9', CURRENT_TIMESTAMP ,'SYSTEM');
create table Users
(
Modified:
airavata/trunk/modules/registry/airavata-jpa-registry/src/test/resources/data-derby.sql
URL:
http://svn.apache.org/viewvc/airavata/trunk/modules/registry/airavata-jpa-registry/src/test/resources/data-derby.sql?rev=1523077&r1=1523076&r2=1523077&view=diff
==============================================================================
---
airavata/trunk/modules/registry/airavata-jpa-registry/src/test/resources/data-derby.sql
(original)
+++
airavata/trunk/modules/registry/airavata-jpa-registry/src/test/resources/data-derby.sql
Fri Sep 13 20:15:49 2013
@@ -35,7 +35,7 @@ create table Configuration
PRIMARY KEY(config_key, config_val, category_id)
);
-INSERT INTO CONFIGURATION (config_key, config_val, expire_date, category_id)
VALUES('registry.version', '0.8', CURRENT_TIMESTAMP ,'SYSTEM');
+INSERT INTO CONFIGURATION (config_key, config_val, expire_date, category_id)
VALUES('registry.version', '0.9', CURRENT_TIMESTAMP ,'SYSTEM');
create table Users
(
Modified:
airavata/trunk/modules/registry/airavata-registry-service/src/main/java/org/apache/airavata/registry/services/RegistryService.java
URL:
http://svn.apache.org/viewvc/airavata/trunk/modules/registry/airavata-registry-service/src/main/java/org/apache/airavata/registry/services/RegistryService.java?rev=1523077&r1=1523076&r2=1523077&view=diff
==============================================================================
---
airavata/trunk/modules/registry/airavata-registry-service/src/main/java/org/apache/airavata/registry/services/RegistryService.java
(original)
+++
airavata/trunk/modules/registry/airavata-registry-service/src/main/java/org/apache/airavata/registry/services/RegistryService.java
Fri Sep 13 20:15:49 2013
@@ -116,25 +116,25 @@ public class RegistryService implements
conn = db.connect();
if (!DatabaseCreator.isDatabaseStructureCreated(PERSISTANT_DATA,
conn)) {
DatabaseCreator.createRegistryDatabase(conn);
- try{
- GatewayResource gatewayResource = new GatewayResource();
-
gatewayResource.setGatewayName(RegistrySettings.getSetting(REGISTRY_DEFAULT_GATEWAY_ID));
-
gatewayResource.setOwner(RegistrySettings.getSetting(REGISTRY_DEFAULT_GATEWAY_ID));
- gatewayResource.save();
- UserResource userResource = (UserResource)
gatewayResource.create(ResourceType.USER);
-
userResource.setUserName(RegistrySettings.getSetting(REGISTRY_DEFAULT_USER));
-
userResource.setPassword(RegistrySettings.getSetting(REGISTRY_DEFAULT_USER_PASSWORD));
- userResource.save();
- WorkerResource workerResource = (WorkerResource)
gatewayResource.create(ResourceType.GATEWAY_WORKER);
- workerResource.setUser(userResource.getUserName());
- workerResource.save();
- } catch (RegistrySettingsException e) {
- logger.error("Unable to read properties", e);
- }
logger.info("New Database created for Registry");
} else {
logger.info("Database already created for Registry!");
}
+ try{
+ GatewayResource gatewayResource = new GatewayResource();
+
gatewayResource.setGatewayName(RegistrySettings.getSetting(REGISTRY_DEFAULT_GATEWAY_ID));
+
gatewayResource.setOwner(RegistrySettings.getSetting(REGISTRY_DEFAULT_GATEWAY_ID));
+ gatewayResource.save();
+ UserResource userResource = (UserResource)
gatewayResource.create(ResourceType.USER);
+
userResource.setUserName(RegistrySettings.getSetting(REGISTRY_DEFAULT_USER));
+
userResource.setPassword(RegistrySettings.getSetting(REGISTRY_DEFAULT_USER_PASSWORD));
+ userResource.save();
+ WorkerResource workerResource = (WorkerResource)
gatewayResource.create(ResourceType.GATEWAY_WORKER);
+ workerResource.setUser(userResource.getUserName());
+ workerResource.save();
+ } catch (RegistrySettingsException e) {
+ logger.error("Unable to read properties", e);
+ }
} catch (Exception e) {
logger.error(e.getMessage(), e);
throw new RuntimeException("Database failure");