You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airavata.apache.org by ch...@apache.org on 2012/11/29 20:40:29 UTC

svn commit: r1415334 - in /airavata/trunk/modules: distribution/src/main/resources/conf/ gfac-axis2/src/main/java/org/apache/airavata/services/gfac/axis2/ registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resourc...

Author: chathuri
Date: Thu Nov 29 19:40:27 2012
New Revision: 1415334

URL: http://svn.apache.org/viewvc?rev=1415334&view=rev
Log:
update reading property files

Added:
    airavata/trunk/modules/registry/airavata-jpa-registry/src/test/resources/registry.properties
      - copied, changed from r1415188, airavata/trunk/modules/distribution/src/main/resources/conf/registry.properties
    airavata/trunk/modules/registry/airavata-registry-test/src/test/resources/registry.properties
Removed:
    airavata/trunk/modules/registry/airavata-jpa-registry/src/test/resources/airavata-server.properties
    airavata/trunk/modules/registry/airavata-registry-test/src/test/resources/airavata-server.properties
Modified:
    airavata/trunk/modules/distribution/src/main/resources/conf/registry.properties
    airavata/trunk/modules/gfac-axis2/src/main/java/org/apache/airavata/services/gfac/axis2/GFacService.java
    airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/AiravataRegistryConnectionDataProviderImpl.java
    airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/Utils.java
    airavata/trunk/modules/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/util/Initialize.java
    airavata/trunk/modules/registry/airavata-registry-service/src/main/java/org/apache/airavata/registry/services/RegistryService.java
    airavata/trunk/modules/registry/airavata-registry-test/src/test/java/org/apache/airavata/registry/api/test/util/Initialize.java
    airavata/trunk/modules/registry/registry-api/src/main/java/org/apache/airavata/registry/api/AiravataRegistryConnectionDataProvider.java
    airavata/trunk/modules/registry/registry-api/src/main/java/org/apache/airavata/registry/api/AiravataRegistryFactory.java
    airavata/trunk/modules/rest/mappings/src/main/java/org/apache/airavata/rest/mappings/utils/RestServicesConstants.java
    airavata/trunk/modules/rest/service/src/main/java/org/apache/airavata/services/registry/rest/resources/ConfigurationRegistryResource.java
    airavata/trunk/modules/rest/service/src/main/java/org/apache/airavata/services/registry/rest/resources/ExperimentRegistryResource.java
    airavata/trunk/modules/rest/service/src/main/java/org/apache/airavata/services/registry/rest/utils/RegistryListener.java
    airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/interpretor/WorkflowInterpretorSkeleton.java

Modified: airavata/trunk/modules/distribution/src/main/resources/conf/registry.properties
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/distribution/src/main/resources/conf/registry.properties?rev=1415334&r1=1415333&r2=1415334&view=diff
==============================================================================
--- airavata/trunk/modules/distribution/src/main/resources/conf/registry.properties (original)
+++ airavata/trunk/modules/distribution/src/main/resources/conf/registry.properties Thu Nov 29 19:40:27 2012
@@ -45,6 +45,10 @@ registry.jdbc.user=airavata
 registry.jdbc.password=airavata
 start.derby.server.mode=true
 
+default.registry.user=admin
+default.registry.password=admin
+default.registry.gateway=default
+
 #for rest [RegistryClient]
 #registry.jdbc.url=http://localhost:9080/airavata-services
 

Modified: airavata/trunk/modules/gfac-axis2/src/main/java/org/apache/airavata/services/gfac/axis2/GFacService.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/gfac-axis2/src/main/java/org/apache/airavata/services/gfac/axis2/GFacService.java?rev=1415334&r1=1415333&r2=1415334&view=diff
==============================================================================
--- airavata/trunk/modules/gfac-axis2/src/main/java/org/apache/airavata/services/gfac/axis2/GFacService.java (original)
+++ airavata/trunk/modules/gfac-axis2/src/main/java/org/apache/airavata/services/gfac/axis2/GFacService.java Thu Nov 29 19:40:27 2012
@@ -34,9 +34,10 @@ import org.apache.airavata.client.Airava
 import org.apache.airavata.client.api.AiravataAPI;
 import org.apache.airavata.client.api.AiravataAPIInvocationException;
 import org.apache.airavata.client.tools.PeriodicExecutorThread;
+import org.apache.airavata.common.exception.ServerSettingsException;
+import org.apache.airavata.common.utils.ServerSettings;
 import org.apache.airavata.common.utils.ServiceUtils;
 import org.apache.airavata.core.gfac.context.GFacConfiguration;
-import org.apache.airavata.registry.api.*;
 import org.apache.airavata.services.gfac.axis2.dispatchers.GFacURIBasedDispatcher;
 import org.apache.airavata.services.gfac.axis2.handlers.AmazonSecurityHandler;
 import org.apache.airavata.services.gfac.axis2.handlers.MyProxySecurityHandler;
@@ -56,11 +57,9 @@ public class GFacService implements Serv
 
     public static final String SECURITY_CONTEXT = "security_context";
 
-    public static final String REPOSITORY_PROPERTIES = "airavata-server.properties";
-
     public static final int JCR_AVAIALABILITY_WAIT_INTERVAL = 1000 * 10;
 
-    public static final String REGISTRY_USER = "registry.user";
+    public static final String SYSTEM_USER = "system.user";
 
     public static final String SERVICE_NAME = "GFacService";
 
@@ -73,8 +72,8 @@ public class GFacService implements Serv
     public static final String MYPROXY_PASS = "myproxy.pass";
     public static final String MYPROXY_LIFE = "myproxy.life";
     public static final String GFAC_CONFIGURATION = "gfacConfiguration";
-    public static final String GATEWAY_ID = "gateway.id";
-    public static final String REGISTRY_PASSWORD = "registry.password";
+    public static final String SYSTEM_GATEWAY = "system.gateway";
+    public static final String SYSTEM_PASSWORD = "system.password";
 //    public static final String REGISTRY_URL = "registry.jdbc.url";
 
     /*
@@ -113,33 +112,31 @@ public class GFacService implements Serv
                 String port = null;
                 String username = null;
                 String password = null;
+                String gatewayName = null;
                 AiravataAPI airavataAPI = null;
                 try {
-                    URL url = this.getClass().getClassLoader().getResource(REPOSITORY_PROPERTIES);
                     try {
                         Thread.sleep(JCR_AVAIALABILITY_WAIT_INTERVAL);
                     } catch (InterruptedException e1) {
                         e1.printStackTrace();
-                    }
-                    Properties properties = new Properties();
-                    try {
-                        properties.load(url.openStream());
-                        if (properties.get(REGISTRY_USER) != null) {
-                            username = (String) properties.get(REGISTRY_USER);
-                        }
-                        if (properties.get(REGISTRY_PASSWORD) != null) {
-                            password = (String) properties.get(REGISTRY_PASSWORD);
+
+                        try {
+                            if (ServerSettings.getSystemUser() != null) {
+                                username = ServerSettings.getSystemUser();
+                            }
+                            if (ServerSettings.getSystemUserPassword() != null) {
+                                password = ServerSettings.getSystemUserPassword();
+                            }
+                            gatewayName = ServerSettings.getDefaultGatewayId();
+                        }catch (ServerSettingsException e) {
+                            log.error("Unable to read properties", e);
                         }
-                    } catch (MalformedURLException e) {
-                        e.printStackTrace();
-                    } catch (IOException e) {
-                        e.printStackTrace();
                     }
-                    String gatewayName = properties.getProperty(GATEWAY_ID);
+
                     airavataAPI = AiravataAPIFactory.getAPI(gatewayName, username);
                     context.setProperty(GFAC_URL, ServiceUtils.generateServiceURLFromConfigurationContext(context,SERVICE_NAME));
-                    GFacConfiguration gfacConfig = new GFacConfiguration(properties.getProperty(MYPROXY_SERVER),properties.getProperty(MYPROXY_USER),
-                            properties.getProperty(MYPROXY_PASS),Integer.parseInt(properties.getProperty(MYPROXY_LIFE)),airavataAPI,properties.getProperty(TRUSTED_CERT_LOCATION));
+                    GFacConfiguration gfacConfig = new GFacConfiguration(ServerSettings.getSetting(MYPROXY_SERVER),ServerSettings.getSetting(MYPROXY_USER),
+                            ServerSettings.getSetting(MYPROXY_PASS),Integer.parseInt(ServerSettings.getSetting(MYPROXY_LIFE)),airavataAPI,ServerSettings.getSetting(TRUSTED_CERT_LOCATION));
 					context.setProperty(GFAC_CONFIGURATION,
 							gfacConfig);
 					/*

Modified: airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/AiravataRegistryConnectionDataProviderImpl.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/AiravataRegistryConnectionDataProviderImpl.java?rev=1415334&r1=1415333&r2=1415334&view=diff
==============================================================================
--- airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/AiravataRegistryConnectionDataProviderImpl.java (original)
+++ airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/AiravataRegistryConnectionDataProviderImpl.java Thu Nov 29 19:40:27 2012
@@ -24,7 +24,9 @@ package org.apache.airavata.persistance.
 import org.apache.airavata.registry.api.AiravataRegistryConnectionDataProvider;
 import org.apache.airavata.registry.api.AiravataUser;
 import org.apache.airavata.registry.api.Gateway;
+import org.apache.airavata.registry.api.exception.RegistrySettingsException;
 import org.apache.airavata.registry.api.exception.UnknownRegistryConnectionDataException;
+import org.apache.airavata.registry.api.util.RegistrySettings;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -36,23 +38,10 @@ public class AiravataRegistryConnectionD
 
     private final static Logger logger = LoggerFactory.getLogger(AiravataRegistryConnectionDataProviderImpl.class);
 
-    public static Properties loadProperties() {
-        URL resource = Utils.class.getClassLoader().getResource("airavata-server.properties");
-        Properties properties = new Properties();
-        try {
-            properties.load(resource.openStream());
-        } catch (IOException e) {
-            e.printStackTrace();
-            logger.error("Unable to read airavata-server.properties " + e);
-
-        }
-        return properties;
-    }
-
     public void setIdentity(Gateway gateway, AiravataUser use) {
     }
 
-    public Object getValue(String key) throws UnknownRegistryConnectionDataException {
-        return loadProperties().getProperty(key);
+    public Object getValue(String key) throws RegistrySettingsException {
+        return RegistrySettings.getSetting(key);
     }
 }

Modified: airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/Utils.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/Utils.java?rev=1415334&r1=1415333&r2=1415334&view=diff
==============================================================================
--- airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/Utils.java (original)
+++ airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/Utils.java Thu Nov 29 19:40:27 2012
@@ -46,7 +46,9 @@ import org.apache.airavata.persistance.r
 import org.apache.airavata.persistance.registry.jpa.model.Workflow_Data;
 import org.apache.airavata.registry.api.AiravataRegistryConnectionDataProvider;
 import org.apache.airavata.registry.api.AiravataRegistryFactory;
+import org.apache.airavata.registry.api.exception.RegistrySettingsException;
 import org.apache.airavata.registry.api.exception.UnknownRegistryConnectionDataException;
+import org.apache.airavata.registry.api.util.RegistrySettings;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -54,17 +56,6 @@ import org.slf4j.LoggerFactory;
 public class Utils {
     private final static Logger logger = LoggerFactory.getLogger(Utils.class);
 
-    public static Properties loadProperties(){
-        URL resource = Utils.class.getClassLoader().getResource("airavata-server.properties");
-        Properties properties = new Properties();
-        try {
-            properties.load(resource.openStream());
-        } catch (IOException e) {
-            logger.error("Unable to read airavata-server.properties ..", e);
-        }
-        return properties;
-    }
-
     public static String getJDBCFullURL(){
 		String jdbcUrl = getJDBCURL();
 		String jdbcUser = getJDBCUser();
@@ -76,10 +67,10 @@ public class Utils {
     public static String getJDBCURL(){
     	try {
             return getProvider().getValue(JPAConstants.KEY_JDBC_URL).toString();
-		} catch (UnknownRegistryConnectionDataException e) {
+		} catch (RegistrySettingsException e) {
             logger.error(e.getMessage(), e);
             return null;
-		}
+        }
     }
 
     public static String getHost(){
@@ -124,7 +115,7 @@ public class Utils {
             if("true".equals(s)){
                 return true;
             }
-        } catch (UnknownRegistryConnectionDataException e) {
+        } catch (RegistrySettingsException e) {
             logger.error(e.getMessage(), e);
             return false;
         }
@@ -146,36 +137,40 @@ public class Utils {
     	try {
 			if (getProvider()!=null){
 				return getProvider().getValue(JPAConstants.KEY_JDBC_USER).toString();
-			}
-		} catch (UnknownRegistryConnectionDataException e) {
+			} else {
+                return RegistrySettings.getSetting(JPAConstants.KEY_JDBC_USER);
+            }
+		} catch (RegistrySettingsException e) {
             logger.error(e.getMessage(), e);
+            return null;
 		}
-        Properties properties = loadProperties();
-        return properties.getProperty(JPAConstants.KEY_JDBC_USER);
     }
 
     public static String getJDBCPassword(){
     	try {
 			if (getProvider()!=null){
 				return getProvider().getValue(JPAConstants.KEY_JDBC_PASSWORD).toString();
-			}
-		} catch (UnknownRegistryConnectionDataException e) {
+			}else {
+                return RegistrySettings.getSetting(JPAConstants.KEY_JDBC_PASSWORD);
+            }
+		} catch (RegistrySettingsException e) {
             logger.error(e.getMessage(), e);
+            return null;
 		}
-        Properties properties = loadProperties();
-        return properties.getProperty(JPAConstants.KEY_JDBC_PASSWORD);
+
     }
 
     public static String getJDBCDriver(){
     	try {
 			if (getProvider()!=null){
 				return getProvider().getValue(JPAConstants.KEY_JDBC_DRIVER).toString();
-			}
-		} catch (UnknownRegistryConnectionDataException e) {
+			}  else {
+                return RegistrySettings.getSetting(JPAConstants.KEY_JDBC_DRIVER);
+            }
+		} catch (RegistrySettingsException e) {
             logger.error(e.getMessage(), e);
+            return null;
 		}
-        Properties properties = loadProperties();
-        return properties.getProperty(JPAConstants.KEY_JDBC_DRIVER);
     }
 
     /**

Modified: airavata/trunk/modules/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/util/Initialize.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/util/Initialize.java?rev=1415334&r1=1415333&r2=1415334&view=diff
==============================================================================
--- airavata/trunk/modules/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/util/Initialize.java (original)
+++ airavata/trunk/modules/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/util/Initialize.java Thu Nov 29 19:40:27 2012
@@ -21,12 +21,16 @@
 
 package org.apache.airavata.persistance.registry.jpa.util;
 
+import org.apache.airavata.common.exception.ServerSettingsException;
+import org.apache.airavata.common.utils.ServerSettings;
 import org.apache.airavata.persistance.registry.jpa.ResourceType;
 import org.apache.airavata.persistance.registry.jpa.ResourceUtils;
 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.Utils;
 import org.apache.airavata.persistance.registry.jpa.resources.WorkerResource;
+import org.apache.airavata.registry.api.exception.RegistrySettingsException;
+import org.apache.airavata.registry.api.util.RegistrySettings;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.apache.derby.drda.NetworkServerControl;
@@ -43,9 +47,6 @@ import java.util.StringTokenizer;
 
 public class Initialize {
     private static final Logger logger = LoggerFactory.getLogger(Initialize.class);
-    public static final String GATEWAY_ID = "gateway.id";
-    public static final String REGISTRY_USER = "registry.user";
-    public static final String REGISTRY_PASSWORD = "registry.password";
     public static final String DERBY_SERVER_MODE_SYS_PROPERTY = "derby.drda.startNetworkServer";
     private NetworkServerControl server;
     private static final String delimiter = ";";
@@ -77,18 +78,18 @@ public class Initialize {
     public void initializeDB() {
         String jdbcUrl = null;
         String jdbcDriver = null;
-        URL resource = this.getClass().getClassLoader().getResource("airavata-server.properties");
-        Properties properties = new Properties();
-        try {
-            properties.load(resource.openStream());
-        } catch (IOException e) {
-            System.out.println("Unable to read airavata-server.properties");
+        String jdbcUser = null;
+        String jdbcPassword = null;
+        try{
+            jdbcDriver = RegistrySettings.getSetting("registry.jdbc.driver");
+            jdbcUrl = RegistrySettings.getSetting("registry.jdbc.url");
+            jdbcUser = RegistrySettings.getSetting("registry.jdbc.user");
+            jdbcPassword = RegistrySettings.getSetting("registry.jdbc.password");
+            jdbcUrl = jdbcUrl + "?" + "user=" + jdbcUser + "&" + "password=" + jdbcPassword;
+        } catch (RegistrySettingsException e) {
+            logger.error("Unable to read properties" , e);
         }
-        jdbcDriver = properties.getProperty("registry.jdbc.driver");
-        jdbcUrl = properties.getProperty("registry.jdbc.url");
-        String jdbcUser = properties.getProperty("registry.jdbc.user");
-        String jdbcPassword = properties.getProperty("registry.jdbc.password");
-        jdbcUrl = jdbcUrl + "?" + "user=" + jdbcUser + "&" + "password=" + jdbcPassword;
+
 
         startDerbyInServerMode();
 //      startDerbyInEmbeddedMode();
@@ -118,19 +119,24 @@ public class Initialize {
             }
         }
 
-        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();
+        try{
+            GatewayResource gatewayResource = new GatewayResource();
+            gatewayResource.setGatewayName(ServerSettings.getDefaultGatewayId());
+            gatewayResource.setOwner(ServerSettings.getDefaultGatewayId());
+            gatewayResource.save();
+
+            UserResource userResource = (UserResource) gatewayResource.create(ResourceType.USER);
+            userResource.setUserName(ServerSettings.getSystemUser());
+            userResource.setPassword(ServerSettings.getSystemUserPassword());
+            userResource.save();
+
+            WorkerResource workerResource = (WorkerResource) gatewayResource.create(ResourceType.GATEWAY_WORKER);
+            workerResource.setUser(userResource.getUserName());
+            workerResource.save();
+        } catch (ServerSettingsException e) {
+            logger.error("Unable to read properties" , e);
+        }
+
 
     }
 

Copied: airavata/trunk/modules/registry/airavata-jpa-registry/src/test/resources/registry.properties (from r1415188, airavata/trunk/modules/distribution/src/main/resources/conf/registry.properties)
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/registry/airavata-jpa-registry/src/test/resources/registry.properties?p2=airavata/trunk/modules/registry/airavata-jpa-registry/src/test/resources/registry.properties&p1=airavata/trunk/modules/distribution/src/main/resources/conf/registry.properties&r1=1415188&r2=1415334&rev=1415334&view=diff
==============================================================================
--- airavata/trunk/modules/distribution/src/main/resources/conf/registry.properties (original)
+++ airavata/trunk/modules/registry/airavata-jpa-registry/src/test/resources/registry.properties Thu Nov 29 19:40:27 2012
@@ -40,11 +40,15 @@ class.registry.accessor=org.apache.airav
 
 #for derby [AiravataJPARegistry]
 registry.jdbc.driver=org.apache.derby.jdbc.ClientDriver
-registry.jdbc.url=jdbc:derby://localhost:1527/persistent_data;create=true;user=airavata;password=airavata
+registry.jdbc.url=jdbc:derby:memory:unit-testing;create=true;user=airavata;password=airavata
 registry.jdbc.user=airavata
 registry.jdbc.password=airavata
 start.derby.server.mode=true
 
+default.registry.user=admin
+default.registry.password=admin
+default.registry.gateway=default
+
 #for rest [RegistryClient]
 #registry.jdbc.url=http://localhost:9080/airavata-services
 

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=1415334&r1=1415333&r2=1415334&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 Thu Nov 29 19:40:27 2012
@@ -20,11 +20,15 @@
 */
 package org.apache.airavata.registry.services;
 
+import org.apache.airavata.common.exception.ServerSettingsException;
+import org.apache.airavata.common.utils.ServerSettings;
 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.Utils;
 import org.apache.airavata.persistance.registry.jpa.resources.WorkerResource;
+import org.apache.airavata.registry.api.exception.RegistrySettingsException;
+import org.apache.airavata.registry.api.util.RegistrySettings;
 import org.apache.airavata.registry.services.utils.DatabaseCreator;
 import org.apache.airavata.registry.services.utils.JdbcStorage;
 import org.apache.axis2.context.ConfigurationContext;
@@ -45,10 +49,14 @@ 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";
+    public static final String REGISTRY_DEFAULT_GATEWAY_ID = "default.registry.gateway";
+    public static final String REGISTRY_DEFAULT_USER = "default.registry.user";
+    public static final String REGISTRY_DEFAULT_USER_PASSWORD = "default.registry.user.password";
     public static final String DERBY_SERVER_MODE_SYS_PROPERTY = "derby.drda.startNetworkServer";
+    public static final String REGISTRY_JDBC_DRIVER = "registry.jdbc.driver";
+    public static final String REGISTRY_JDBC_URL = "registry.jdbc.url";
+    public static final String REGISTRY_JDBC_USER = "registry.jdbc.user";
+    public static final String REGISTRY_JDBC_PASSWORD = "registry.jdbc.password";
     private JdbcStorage db;
     private NetworkServerControl server;
 
@@ -87,18 +95,15 @@ public class RegistryService implements 
     private void initializeDB() {
         String jdbcUrl = null;
         String jdbcDriver = null;
-        URL resource = this.getClass().getClassLoader().getResource("airavata-server.properties");
-        Properties properties = new Properties();
-        try {
-            properties.load(resource.openStream());
-        } catch (IOException e) {
-            logger.error("Unable to read repository properties", e);
+        try{
+            jdbcDriver = RegistrySettings.getSetting(REGISTRY_JDBC_DRIVER);
+            jdbcUrl = RegistrySettings.getSetting(REGISTRY_JDBC_URL);
+            String jdbcUser = RegistrySettings.getSetting(REGISTRY_JDBC_USER);
+            String jdbcPassword = RegistrySettings.getSetting(REGISTRY_JDBC_PASSWORD);
+            jdbcUrl = jdbcUrl + "?" + "user=" + jdbcUser + "&" + "password=" + jdbcPassword;
+        } catch (RegistrySettingsException e) {
+            logger.error("Unable to read properties" , e);
         }
-        jdbcDriver = properties.getProperty("registry.jdbc.driver");
-        jdbcUrl = properties.getProperty("registry.jdbc.url");
-        String jdbcUser = properties.getProperty("registry.jdbc.user");
-        String jdbcPassword = properties.getProperty("registry.jdbc.password");
-        jdbcUrl = jdbcUrl + "?" + "user=" + jdbcUser + "&" + "password=" + jdbcPassword;
 
         if (Utils.getDBType().equals("derby") && Utils.isDerbyStartEnabled()) {
             startDerbyInServerMode();
@@ -129,17 +134,22 @@ public class RegistryService implements 
                 e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
             }
         }
-        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();
+        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);
+        }
+
     }
 
     @Override

Modified: airavata/trunk/modules/registry/airavata-registry-test/src/test/java/org/apache/airavata/registry/api/test/util/Initialize.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/registry/airavata-registry-test/src/test/java/org/apache/airavata/registry/api/test/util/Initialize.java?rev=1415334&r1=1415333&r2=1415334&view=diff
==============================================================================
--- airavata/trunk/modules/registry/airavata-registry-test/src/test/java/org/apache/airavata/registry/api/test/util/Initialize.java (original)
+++ airavata/trunk/modules/registry/airavata-registry-test/src/test/java/org/apache/airavata/registry/api/test/util/Initialize.java Thu Nov 29 19:40:27 2012
@@ -21,11 +21,15 @@
 
 package org.apache.airavata.registry.api.test.util;
 
+import org.apache.airavata.common.exception.ServerSettingsException;
+import org.apache.airavata.common.utils.ServerSettings;
 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.Utils;
 import org.apache.airavata.persistance.registry.jpa.resources.WorkerResource;
+import org.apache.airavata.registry.api.exception.RegistrySettingsException;
+import org.apache.airavata.registry.api.util.RegistrySettings;
 import org.apache.derby.drda.NetworkServerControl;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -42,9 +46,6 @@ import java.util.StringTokenizer;
 
 public class Initialize {
     private static final Logger logger = LoggerFactory.getLogger(Initialize.class);
-    public static final String GATEWAY_ID = "gateway.id";
-    public static final String REGISTRY_USER = "registry.user";
-    public static final String REGISTRY_PASSWORD = "registry.password";
     public static final String DERBY_SERVER_MODE_SYS_PROPERTY = "derby.drda.startNetworkServer";
     private NetworkServerControl server;
     private static final String delimiter = ";";
@@ -76,18 +77,18 @@ public class Initialize {
     public void initializeDB() {
         String jdbcUrl = null;
         String jdbcDriver = null;
-        URL resource = this.getClass().getClassLoader().getResource("airavata-server.properties");
-        Properties properties = new Properties();
-        try {
-            properties.load(resource.openStream());
-        } catch (IOException e) {
-            System.out.println("Unable to read repository properties");
+        String jdbcUser = null;
+        String jdbcPassword = null;
+        try{
+            jdbcDriver = RegistrySettings.getSetting("registry.jdbc.driver");
+            jdbcUrl = RegistrySettings.getSetting("registry.jdbc.url");
+            jdbcUser = RegistrySettings.getSetting("registry.jdbc.user");
+            jdbcPassword = RegistrySettings.getSetting("registry.jdbc.password");
+            jdbcUrl = jdbcUrl + "?" + "user=" + jdbcUser + "&" + "password=" + jdbcPassword;
+        } catch (RegistrySettingsException e) {
+            logger.error("Unable to read properties" , e);
         }
-        jdbcDriver = properties.getProperty("registry.jdbc.driver");
-        jdbcUrl = properties.getProperty("registry.jdbc.url");
-        String jdbcUser = properties.getProperty("registry.jdbc.user");
-        String jdbcPassword = properties.getProperty("registry.jdbc.password");
-        jdbcUrl = jdbcUrl + "?" + "user=" + jdbcUser + "&" + "password=" + jdbcPassword;
+
 
         startDerbyInServerMode();
 //      startDerbyInEmbeddedMode();
@@ -117,28 +118,24 @@ public class Initialize {
             }
         }
 
-        GatewayResource gatewayResource = new GatewayResource();
-        gatewayResource.setGatewayName((String) properties.get(GATEWAY_ID));
-        gatewayResource.setOwner((String) properties.get(GATEWAY_ID));
-        gatewayResource.save();
-
-        UserResource userResource1 = (UserResource) gatewayResource.create(ResourceType.USER);
-        userResource1.setUserName((String) properties.get(REGISTRY_USER));
-        userResource1.setPassword((String) properties.get(REGISTRY_PASSWORD));
-        userResource1.save();
-
-        UserResource userResource2 = (UserResource) gatewayResource.create(ResourceType.USER);
-        userResource2.setUserName("testUser");
-        userResource2.setPassword("testPassword");
-        userResource2.save();
-
-        WorkerResource workerResource1 = (WorkerResource) gatewayResource.create(ResourceType.GATEWAY_WORKER);
-        workerResource1.setUser(userResource1.getUserName());
-        workerResource1.save();
-
-        WorkerResource workerResource2 = (WorkerResource) gatewayResource.create(ResourceType.GATEWAY_WORKER);
-        workerResource2.setUser(userResource2.getUserName());
-        workerResource2.save();
+        try{
+            GatewayResource gatewayResource = new GatewayResource();
+            gatewayResource.setGatewayName(ServerSettings.getDefaultGatewayId());
+            gatewayResource.setOwner(ServerSettings.getDefaultGatewayId());
+            gatewayResource.save();
+
+            UserResource userResource = (UserResource) gatewayResource.create(ResourceType.USER);
+            userResource.setUserName(ServerSettings.getSystemUser());
+            userResource.setPassword(ServerSettings.getSystemUserPassword());
+            userResource.save();
+
+            WorkerResource workerResource = (WorkerResource) gatewayResource.create(ResourceType.GATEWAY_WORKER);
+            workerResource.setUser(userResource.getUserName());
+            workerResource.save();
+        } catch (ServerSettingsException e) {
+            logger.error("Unable to read properties" , e);
+        }
+
 
     }
 
@@ -174,41 +171,41 @@ public class Initialize {
         BufferedReader reader = null;
         try{
 
-        InputStream inputStream = this.getClass().getClassLoader().getResourceAsStream("data-derby.sql");
-        reader = new BufferedReader(new InputStreamReader(inputStream));
-        String line;
-        while ((line = reader.readLine()) != null) {
-            line = line.trim();
-            if (line.startsWith("//")) {
-                continue;
-            }
-            if (line.startsWith("--")) {
-                continue;
-            }
-            StringTokenizer st = new StringTokenizer(line);
-            if (st.hasMoreTokens()) {
-                String token = st.nextToken();
-                if ("REM".equalsIgnoreCase(token)) {
+            InputStream inputStream = this.getClass().getClassLoader().getResourceAsStream("data-derby.sql");
+            reader = new BufferedReader(new InputStreamReader(inputStream));
+            String line;
+            while ((line = reader.readLine()) != null) {
+                line = line.trim();
+                if (line.startsWith("//")) {
                     continue;
                 }
-            }
-            sql.append(" ").append(line);
+                if (line.startsWith("--")) {
+                    continue;
+                }
+                StringTokenizer st = new StringTokenizer(line);
+                if (st.hasMoreTokens()) {
+                    String token = st.nextToken();
+                    if ("REM".equalsIgnoreCase(token)) {
+                        continue;
+                    }
+                }
+                sql.append(" ").append(line);
 
-            // SQL defines "--" as a comment to EOL
-            // and in Oracle it may contain a hint
-            // so we cannot just remove it, instead we must end it
-            if (line.indexOf("--") >= 0) {
-                sql.append("\n");
+                // SQL defines "--" as a comment to EOL
+                // and in Oracle it may contain a hint
+                // so we cannot just remove it, instead we must end it
+                if (line.indexOf("--") >= 0) {
+                    sql.append("\n");
+                }
+                if ((checkStringBufferEndsWith(sql, delimiter))) {
+                    executeSQL(sql.substring(0, sql.length() - delimiter.length()), conn);
+                    sql.replace(0, sql.length(), "");
+                }
             }
-            if ((checkStringBufferEndsWith(sql, delimiter))) {
-                executeSQL(sql.substring(0, sql.length() - delimiter.length()), conn);
-                sql.replace(0, sql.length(), "");
+            // Catch any statements not followed by ;
+            if (sql.length() > 0) {
+                executeSQL(sql.toString(), conn);
             }
-        }
-        // Catch any statements not followed by ;
-        if (sql.length() > 0) {
-            executeSQL(sql.toString(), conn);
-        }
         }catch (IOException e){
             logger.error("Error occurred while executing SQL script for creating Airavata database", e);
             throw new Exception("Error occurred while executing SQL script for creating Airavata database", e);
@@ -312,3 +309,4 @@ public class Initialize {
         }
     }
 }
+

Added: airavata/trunk/modules/registry/airavata-registry-test/src/test/resources/registry.properties
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/registry/airavata-registry-test/src/test/resources/registry.properties?rev=1415334&view=auto
==============================================================================
--- airavata/trunk/modules/registry/airavata-registry-test/src/test/resources/registry.properties (added)
+++ airavata/trunk/modules/registry/airavata-registry-test/src/test/resources/registry.properties Thu Nov 29 19:40:27 2012
@@ -0,0 +1,54 @@
+#
+#
+# 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.
+#
+#
+
+
+###########################################################################
+#
+#  This properties file provides configuration to connect to Registry.
+#  Please do not use this for any server configurations.
+#
+###########################################################################
+
+###---------------------------REGISTRY API IMPLEMENTATION---------------------------###
+
+class.registry.accessor=org.apache.airavata.persistance.registry.jpa.impl.AiravataJPARegistry
+#class.registry.accessor=org.apache.airavata.rest.client.RegistryClient
+
+###---------------------REGISTRY API IMPLEMENTATION - CUSTOM SETTINGS----------------------###
+
+#for mysql [AiravataJPARegistry]
+#registry.jdbc.driver=com.mysql.jdbc.Driver
+#registry.jdbc.url=jdbc:mysql://localhost:3306/persistent_data
+
+#for derby [AiravataJPARegistry]
+registry.jdbc.driver=org.apache.derby.jdbc.EmbeddedDriver
+registry.jdbc.url=jdbc:derby:memory:unit-testing;create=true;user=airavata;password=airavata
+registry.jdbc.user=airavata
+registry.jdbc.password=airavata
+start.derby.server.mode=true
+
+default.registry.user=admin
+default.registry.password=admin
+default.registry.gateway=default
+
+#for rest [RegistryClient]
+#registry.jdbc.url=http://localhost:9080/airavata-services
+

Modified: airavata/trunk/modules/registry/registry-api/src/main/java/org/apache/airavata/registry/api/AiravataRegistryConnectionDataProvider.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/registry/registry-api/src/main/java/org/apache/airavata/registry/api/AiravataRegistryConnectionDataProvider.java?rev=1415334&r1=1415333&r2=1415334&view=diff
==============================================================================
--- airavata/trunk/modules/registry/registry-api/src/main/java/org/apache/airavata/registry/api/AiravataRegistryConnectionDataProvider.java (original)
+++ airavata/trunk/modules/registry/registry-api/src/main/java/org/apache/airavata/registry/api/AiravataRegistryConnectionDataProvider.java Thu Nov 29 19:40:27 2012
@@ -21,9 +21,10 @@
 
 package org.apache.airavata.registry.api;
 
+import org.apache.airavata.registry.api.exception.RegistrySettingsException;
 import org.apache.airavata.registry.api.exception.UnknownRegistryConnectionDataException;
 
 public interface AiravataRegistryConnectionDataProvider {
 	public void setIdentity(Gateway gateway, AiravataUser use);
-	public Object getValue(String key) throws UnknownRegistryConnectionDataException;
+	public Object getValue(String key) throws RegistrySettingsException;
 }

Modified: airavata/trunk/modules/registry/registry-api/src/main/java/org/apache/airavata/registry/api/AiravataRegistryFactory.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/registry/registry-api/src/main/java/org/apache/airavata/registry/api/AiravataRegistryFactory.java?rev=1415334&r1=1415333&r2=1415334&view=diff
==============================================================================
--- airavata/trunk/modules/registry/registry-api/src/main/java/org/apache/airavata/registry/api/AiravataRegistryFactory.java (original)
+++ airavata/trunk/modules/registry/registry-api/src/main/java/org/apache/airavata/registry/api/AiravataRegistryFactory.java Thu Nov 29 19:40:27 2012
@@ -27,14 +27,11 @@ import java.net.URL;
 import java.util.Properties;
 
 import org.apache.airavata.common.exception.AiravataConfigurationException;
-import org.apache.airavata.registry.api.exception.RegistryAccessorInstantiateException;
-import org.apache.airavata.registry.api.exception.RegistryAccessorInvalidException;
-import org.apache.airavata.registry.api.exception.RegistryAccessorNotFoundException;
-import org.apache.airavata.registry.api.exception.RegistryAccessorUndefinedException;
+import org.apache.airavata.registry.api.exception.*;
+import org.apache.airavata.registry.api.util.RegistrySettings;
 
 public class AiravataRegistryFactory {
 
-	private static final String REPOSITORY_PROPERTIES = "airavata-server.properties";
 	private static final String REGISTRY_ACCESSOR_CLASS = "class.registry.accessor";
 	private static AiravataRegistryConnectionDataProvider dataProvider;
 
@@ -103,42 +100,33 @@ public class AiravataRegistryFactory {
 			RegistryAccessorUndefinedException,
 			RegistryAccessorInstantiateException,
 			AiravataConfigurationException {
-		Properties properties = new Properties();
-		URL url = AiravataRegistryFactory.class.getClassLoader().getResource(
-				REPOSITORY_PROPERTIES);
-		if (url != null) {
-			try {
-				properties.load(url.openStream());
-				String provRegAccessorClass = properties.getProperty(
-						registryClassKey, null);
-				if (provRegAccessorClass == null) {
-					throw new RegistryAccessorUndefinedException();
-				} else {
-					try {
-						Class<?> classInstance = AiravataRegistryFactory.class
-								.getClassLoader().loadClass(
-										provRegAccessorClass);
-						return classInstance.newInstance();
-					} catch (ClassNotFoundException e) {
-						throw new RegistryAccessorNotFoundException(
-								provRegAccessorClass, e);
-					} catch (InstantiationException e) {
-						throw new RegistryAccessorInstantiateException(
-								provRegAccessorClass, e);
-					} catch (IllegalAccessException e) {
-						throw new RegistryAccessorInstantiateException(
-								provRegAccessorClass, e);
-					}
-				}
-			} catch (IOException e) {
-				throw new AiravataConfigurationException(
-						"Error reading the configuration file", e);
-			}
-		}else{
-			throw new AiravataConfigurationException(
-					"Error loading the configuration file");
-		}
-	}
+
+        try {
+            String provRegAccessorClass = RegistrySettings.getSetting(REGISTRY_ACCESSOR_CLASS);
+            if (provRegAccessorClass == null) {
+                throw new RegistryAccessorUndefinedException();
+            } else {
+                try {
+                    Class<?> classInstance = AiravataRegistryFactory.class
+                            .getClassLoader().loadClass(
+                                    provRegAccessorClass);
+                    return classInstance.newInstance();
+                } catch (ClassNotFoundException e) {
+                    throw new RegistryAccessorNotFoundException(
+                            provRegAccessorClass, e);
+                } catch (InstantiationException e) {
+                    throw new RegistryAccessorInstantiateException(
+                            provRegAccessorClass, e);
+                } catch (IllegalAccessException e) {
+                    throw new RegistryAccessorInstantiateException(
+                            provRegAccessorClass, e);
+                }
+            }
+        } catch (RegistrySettingsException e) {
+            throw new AiravataConfigurationException(
+                    "Error reading the configuration file", e);
+        }
+    }
 
 	public static void registerRegistryConnectionDataProvider(AiravataRegistryConnectionDataProvider provider){
 		dataProvider=provider;

Modified: airavata/trunk/modules/rest/mappings/src/main/java/org/apache/airavata/rest/mappings/utils/RestServicesConstants.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/rest/mappings/src/main/java/org/apache/airavata/rest/mappings/utils/RestServicesConstants.java?rev=1415334&r1=1415333&r2=1415334&view=diff
==============================================================================
--- airavata/trunk/modules/rest/mappings/src/main/java/org/apache/airavata/rest/mappings/utils/RestServicesConstants.java (original)
+++ airavata/trunk/modules/rest/mappings/src/main/java/org/apache/airavata/rest/mappings/utils/RestServicesConstants.java Thu Nov 29 19:40:27 2012
@@ -24,27 +24,6 @@ package org.apache.airavata.rest.mapping
 import org.apache.commons.codec.binary.Base64;
 
 public class RestServicesConstants {
-    public static final String AIRAVATA_SERVER_PROPERTIES = "airavata-server.properties";
-    public static final String GATEWAY_ID = "gateway.id";
     public static final String GATEWAY = "gateway";
-    public static final String REGISTRY_USERNAME = "registry.user";
-    public static final String REGISTRY_USER = "airavata.user";
-    public static final String AIRAVATA_REGISTRY = "airavataRegistry";
     public static final String AIRAVATA_REGISTRY_POOL = "airavataRegistryPool";
-
-
-    /**
-     * A method to use by clients in the case of Basic Access authentication.
-     * Creates Basic Auth header structure.
-     * Reference - http://en.wikipedia.org/wiki/Basic_access_authentication
-     * @param userName The user name.
-     * @param password Password as credentials.
-     * @return  Base64 encoded authorisation header.
-     */
-    public static String getBasicAuthHeader(String userName, String password) {
-
-        String credentials = userName + ":" + password;
-        String encodedString = new String(Base64.encodeBase64(credentials.getBytes()));
-        return "Basic " + encodedString;
-    }
 }

Modified: airavata/trunk/modules/rest/service/src/main/java/org/apache/airavata/services/registry/rest/resources/ConfigurationRegistryResource.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/rest/service/src/main/java/org/apache/airavata/services/registry/rest/resources/ConfigurationRegistryResource.java?rev=1415334&r1=1415333&r2=1415334&view=diff
==============================================================================
--- airavata/trunk/modules/rest/service/src/main/java/org/apache/airavata/services/registry/rest/resources/ConfigurationRegistryResource.java (original)
+++ airavata/trunk/modules/rest/service/src/main/java/org/apache/airavata/services/registry/rest/resources/ConfigurationRegistryResource.java Thu Nov 29 19:40:27 2012
@@ -143,7 +143,6 @@ public class ConfigurationRegistryResour
         try {
             DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
             Date formattedDate = dateFormat.parse(date);
-            airavataRegistry = (AiravataRegistry2) context.getAttribute(RestServicesConstants.AIRAVATA_REGISTRY);
             airavataRegistry.setConfiguration(key, value, formattedDate);
             Response.ResponseBuilder builder = Response.status(Response.Status.OK);
             builder.entity("Configuration saved successfully...");
@@ -178,7 +177,6 @@ public class ConfigurationRegistryResour
         try {
             DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
             Date formattedDate = dateFormat.parse(date);
-            airavataRegistry = (AiravataRegistry2) context.getAttribute(RestServicesConstants.AIRAVATA_REGISTRY);
             airavataRegistry.addConfiguration(key, value, formattedDate);
             Response.ResponseBuilder builder = Response.status(Response.Status.OK);
             builder.entity("Configuration updated successfully...");

Modified: airavata/trunk/modules/rest/service/src/main/java/org/apache/airavata/services/registry/rest/resources/ExperimentRegistryResource.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/rest/service/src/main/java/org/apache/airavata/services/registry/rest/resources/ExperimentRegistryResource.java?rev=1415334&r1=1415333&r2=1415334&view=diff
==============================================================================
--- airavata/trunk/modules/rest/service/src/main/java/org/apache/airavata/services/registry/rest/resources/ExperimentRegistryResource.java (original)
+++ airavata/trunk/modules/rest/service/src/main/java/org/apache/airavata/services/registry/rest/resources/ExperimentRegistryResource.java Thu Nov 29 19:40:27 2012
@@ -281,8 +281,8 @@ public class ExperimentRegistryResource 
         try {
             AiravataExperiment experiment = new AiravataExperiment();
             experiment.setExperimentId(experimentID);
-            Gateway gateway = (Gateway) context.getAttribute(RestServicesConstants.GATEWAY);
-            AiravataUser airavataUser = (AiravataUser) context.getAttribute(RestServicesConstants.REGISTRY_USER);
+            Gateway gateway = airavataRegistry.getGateway();
+            AiravataUser airavataUser = airavataRegistry.getAiravataUser();
             experiment.setGateway(gateway);
             experiment.setUser(airavataUser);
             DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");

Modified: airavata/trunk/modules/rest/service/src/main/java/org/apache/airavata/services/registry/rest/utils/RegistryListener.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/rest/service/src/main/java/org/apache/airavata/services/registry/rest/utils/RegistryListener.java?rev=1415334&r1=1415333&r2=1415334&view=diff
==============================================================================
--- airavata/trunk/modules/rest/service/src/main/java/org/apache/airavata/services/registry/rest/utils/RegistryListener.java (original)
+++ airavata/trunk/modules/rest/service/src/main/java/org/apache/airavata/services/registry/rest/utils/RegistryListener.java Thu Nov 29 19:40:27 2012
@@ -21,6 +21,7 @@
 
 package org.apache.airavata.services.registry.rest.utils;
 
+import org.apache.airavata.common.utils.ServerSettings;
 import org.apache.airavata.registry.api.Gateway;
 import org.apache.airavata.rest.mappings.utils.RestServicesConstants;
 
@@ -36,16 +37,7 @@ public class RegistryListener implements
     public void contextInitialized(ServletContextEvent servletContextEvent) {
         try {
             ServletContext servletContext = servletContextEvent.getServletContext();
-
-            URL url = this.getClass().getClassLoader().
-                    getResource(RestServicesConstants.AIRAVATA_SERVER_PROPERTIES);
-            Properties properties = new Properties();
-            try {
-                properties.load(url.openStream());
-            } catch (IOException e) {
-                e.printStackTrace();
-            }
-            String gatewayID = properties.getProperty(RestServicesConstants.GATEWAY_ID);
+            String gatewayID = ServerSettings.getDefaultGatewayId();
             Gateway gateway =  new Gateway(gatewayID);
 
             servletContext.setAttribute(RestServicesConstants.GATEWAY, gateway);

Modified: airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/interpretor/WorkflowInterpretorSkeleton.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/interpretor/WorkflowInterpretorSkeleton.java?rev=1415334&r1=1415333&r2=1415334&view=diff
==============================================================================
--- airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/interpretor/WorkflowInterpretorSkeleton.java (original)
+++ airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/interpretor/WorkflowInterpretorSkeleton.java Thu Nov 29 19:40:27 2012
@@ -46,6 +46,8 @@ import org.apache.airavata.client.Airava
 import org.apache.airavata.client.api.AiravataAPI;
 import org.apache.airavata.client.api.AiravataAPIInvocationException;
 import org.apache.airavata.client.tools.PeriodicExecutorThread;
+import org.apache.airavata.common.exception.ServerSettingsException;
+import org.apache.airavata.common.utils.ServerSettings;
 import org.apache.airavata.registry.api.exception.RegistryException;
 import org.apache.airavata.client.stub.interpretor.NameValue;
 import org.apache.airavata.common.utils.ServiceUtils;
@@ -87,26 +89,17 @@ public class WorkflowInterpretorSkeleton
 	public static final String PROXYSERVER = "myproxy.url";
 	public static final String MSGBOX = "msgbox";
 	public static final String GFAC = "gfac";
-	public static final String DSC = "dsc";
 	public static final String BROKER = "broker";
     public static final String MYPROXY_USER = "myproxy.username";
     public static final String MYPROXY_PASS = "myproxy.password";
     public static final String MYPROXY_SERVER = "myproxy.url";
     public static final String MYPROXY_LIFETIME = "myproxy.lifetime";
     public static final String TRUSTED_CERT_LOCATION = "trusted.cert.location";
-    public static final String JCR_USER = "jcr.username";
-    public static final String JCR_PASS = "jcr.password";
-    public static final String SYSTEM_USER = "system.user";
-    public static final String SYSTEM_PASS = "system.password";
-    public static final String SYSTEM_GATEWAY = "system.gateway";
-    public static final String DEFAULT_GATEWAY = "gateway.id";
 
-    public static final String JCR_URL = "jcr.url";
     public static boolean provenance = false;
     public static final String PROVENANCE = "provenance";
     public static  String systemUserName = "";
     public static  String systemUserPW = "";
-    public static  String jcrURL = "";
     public static boolean runInThread = false;
     public static final String RUN_IN_THREAD = "runInThread";
     public static  Boolean gfacEmbeddedMode = false;
@@ -117,7 +110,6 @@ public class WorkflowInterpretorSkeleton
     public static final int JCR_AVAIALABILITY_WAIT_INTERVAL = 1000 * 10;
     public static final String GFAC_EMBEDDED = "gfac.embedded";
     public static  ConfigurationContext configurationContext;
-    public static final String OUTPUT_DATA_PATH = "outputDataPath";
     public static final String SERVICE_NAME="WorkflowInterpretor";
     public static boolean notInterrupted = true;
     private String gateway;
@@ -129,29 +121,20 @@ public class WorkflowInterpretorSkeleton
 	protected WIServiceThread thread;
     
     private AiravataAPI getRegistry(){
-        Properties properties = new Properties();
         try {
-
-            URL url = getXBayaPropertiesURL();
-            properties.load(url.openStream());
-            systemUserName = (String)properties.get(SYSTEM_USER);
-            systemUserPW = (String) properties.get(SYSTEM_PASS);
-            jcrURL = (String) properties.get(JCR_URL);
-            gateway = properties.getProperty(DEFAULT_GATEWAY);
+            systemUserName = ServerSettings.getSystemUser();
+            systemUserPW = ServerSettings.getSystemUserPassword();
+            gateway = ServerSettings.getDefaultGatewayId();
             jcrComponentRegistry = new JCRComponentRegistry(systemUserName, systemUserPW);
             return jcrComponentRegistry.getAiravataAPI();
         } catch (RegistryException e) {
-            e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
-        } catch (IOException e) {
-			e.printStackTrace();
-		}
+            log.error("Unable to connect to registry", e);
+        } catch (ServerSettingsException e) {
+            log.error("Unable to read the properties file", e);
+        }
         return null;
     }
 
-	private URL getXBayaPropertiesURL() {
-		return this.getClass().getClassLoader().getResource("airavata-server.properties");
-	}
-
     public void startUp(final ConfigurationContext configctx, AxisService service) {
     	new Thread(){
 			@Override
@@ -161,27 +144,19 @@ public class WorkflowInterpretorSkeleton
 				} catch (InterruptedException e1) {
 					e1.printStackTrace();
 				}
-		        URL url = getXBayaPropertiesURL();
-		        Properties properties = new Properties();
 		        try {
-
-		            properties.load(url.openStream());
                     // Airavata deployer have to configure these properties,but if user send them alone the incoming message
                     // We are overwriting those values only for that particular request
-		            configctx.setProperty(MYPROXY_PASS, properties.get(MYPROXY_PASS));
-		            configctx.setProperty(MYPROXY_USER, properties.get(MYPROXY_USER));
-		            configctx.setProperty(MYPROXY_LIFETIME,properties.getProperty(MYPROXY_LIFETIME));
-                    configctx.setProperty(TRUSTED_CERT_LOCATION,properties.getProperty(TRUSTED_CERT_LOCATION));
-                    configctx.setProperty(MYPROXY_SERVER,properties.getProperty(MYPROXY_SERVER));
-//		            systemUserName = (String)properties.get(JCR_USER);
-//		            systemUserPW = (String) properties.get(JCR_PASS);
-//		            jcrURL = (String) properties.get(JCR_URL);
-		            provenanceWriterThreadPoolSize = Integer.parseInt((String) properties.get(PROVENANCE_WRITER_THREAD_POOL_SIZE));
-		            if("true".equals(properties.get(PROVENANCE))){
+		            configctx.setProperty(MYPROXY_PASS, ServerSettings.getSetting(MYPROXY_PASS));
+		            configctx.setProperty(MYPROXY_USER, ServerSettings.getSetting(MYPROXY_USER));
+		            configctx.setProperty(MYPROXY_LIFETIME,ServerSettings.getSetting(MYPROXY_LIFETIME));
+                    configctx.setProperty(TRUSTED_CERT_LOCATION,ServerSettings.getSetting(TRUSTED_CERT_LOCATION));
+                    configctx.setProperty(MYPROXY_SERVER,ServerSettings.getSetting(MYPROXY_SERVER));
+		            provenanceWriterThreadPoolSize = Integer.parseInt((String) ServerSettings.getSetting(PROVENANCE_WRITER_THREAD_POOL_SIZE));
+		            if("true".equals(ServerSettings.getSetting(PROVENANCE))){
 		                provenance = true;
 		                runner = new PredicatedTaskRunner(provenanceWriterThreadPoolSize);
 		                try {
-//		                    jcrComponentRegistry = new JCRComponentRegistry(systemUserName,systemUserPW);
                             List<HostDescription> hostList = getDefinedHostDescriptions();
                             for(HostDescription host:hostList){
                                 // This will avoid the changes user is doing to one of the predefined Hosts during a restart of the system
@@ -197,13 +172,13 @@ public class WorkflowInterpretorSkeleton
                     }else{
 		                provenance = false;
 		            }
-		            if("true".equals(properties.get(RUN_IN_THREAD))){
+		            if("true".equals(ServerSettings.getSetting(RUN_IN_THREAD))){
 		                runInThread = true;
 		            }else{
 		                runInThread = false;
 		            }
 
-                     if("true".equals(properties.get(GFAC_EMBEDDED))){
+                     if("true".equals(ServerSettings.getSetting(GFAC_EMBEDDED))){
 		                gfacEmbeddedMode = true;
 		            }else{
 		                gfacEmbeddedMode = false;
@@ -224,7 +199,9 @@ public class WorkflowInterpretorSkeleton
 		        } catch (URISyntaxException e) {
 					// TODO Auto-generated catch block
 					e.printStackTrace();
-				}
+				} catch (ServerSettingsException e) {
+                    e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
+                }
                 WorkflowInterpretorSkeleton.configurationContext = configctx;
     		}
     	}.start();
@@ -267,15 +244,15 @@ public class WorkflowInterpretorSkeleton
              s = setupAndLaunch(workflowAsString, topic,
                     user,inputs, configuration, runInThread, workflowContextHeaderBuilder);
         } catch (XMLStreamException e) {
-            e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
+            log.error(e.getMessage());
         } catch (RepositoryException e) {
-            e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
+            log.error(e.getMessage());
         } catch (MalformedURLException e) {
-            e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
+            log.error(e.getMessage());
         } catch (RegistryException e) {
-            e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
+            log.error(e.getMessage());
         } catch (AiravataAPIInvocationException e) {
-            e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
+            log.error(e.getMessage());
         }
         return s;
     }
@@ -311,9 +288,9 @@ public class WorkflowInterpretorSkeleton
             configuration.put(GFAC, gfac);
             configuration.put(MSGBOX, msgBox);
         } catch (XmlException e) {
-            e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
+            log.error(e.getMessage());
         } catch (AiravataAPIInvocationException e) {
-            e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
+            log.error(e.getMessage());
         }
         return new WorkflowContextHeaderBuilder(parse.getContextHeader());
     }