airavata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ami...@apache.org
Subject svn commit: r1459504 - /airavata/trunk/modules/security/src/main/java/org/apache/airavata/security/userstore/AbstractJDBCUserStore.java
Date Thu, 21 Mar 2013 20:09:44 GMT
Author: amilaj
Date: Thu Mar 21 20:09:43 2013
New Revision: 1459504

URL: http://svn.apache.org/r1459504
Log:
Fixing issue AIRAVATA-742

Modified:
    airavata/trunk/modules/security/src/main/java/org/apache/airavata/security/userstore/AbstractJDBCUserStore.java

Modified: airavata/trunk/modules/security/src/main/java/org/apache/airavata/security/userstore/AbstractJDBCUserStore.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/security/src/main/java/org/apache/airavata/security/userstore/AbstractJDBCUserStore.java?rev=1459504&r1=1459503&r2=1459504&view=diff
==============================================================================
--- airavata/trunk/modules/security/src/main/java/org/apache/airavata/security/userstore/AbstractJDBCUserStore.java
(original)
+++ airavata/trunk/modules/security/src/main/java/org/apache/airavata/security/userstore/AbstractJDBCUserStore.java
Thu Mar 21 20:09:43 2013
@@ -21,8 +21,13 @@
 
 package org.apache.airavata.security.userstore;
 
+import org.apache.airavata.common.exception.ApplicationSettingsException;
+import org.apache.airavata.common.utils.ApplicationSettings;
+import org.apache.airavata.common.utils.ServerSettings;
 import org.apache.airavata.security.UserStore;
 import org.apache.airavata.security.UserStoreException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 import org.w3c.dom.Element;
 import org.w3c.dom.Node;
 import org.w3c.dom.NodeList;
@@ -32,6 +37,8 @@ import org.w3c.dom.NodeList;
  */
 public abstract class AbstractJDBCUserStore implements UserStore {
 
+    protected static Logger log = LoggerFactory.getLogger(JDBCUserStore.class);
+
     private String databaseURL = null;
     private String databaseDriver = null;
     private String databaseUserName = null;
@@ -55,9 +62,8 @@ public abstract class AbstractJDBCUserSt
 
     /**
      * Configures primary JDBC parameters. i.e
-     * 
-     * @param node
-     *            An XML configuration node.
+     *
+     * @param node An XML configuration node.
      * @throws UserStoreException
      */
     public void configure(Node node) throws UserStoreException {
@@ -103,5 +109,26 @@ public abstract class AbstractJDBCUserSt
             }
         }
 
+        if (databaseURL == null || databaseUserName == null || databasePassword == null)
{
+            // If database configurations are not specified in authenticators.xml we will
read them from
+            // server.properties file.
+            try {
+                databaseDriver = ServerSettings.getCredentialStoreDBDriver();
+                databaseURL = ServerSettings.getCredentialStoreDBURL();
+                databaseUserName = ServerSettings.getCredentialStoreDBUser();
+                databasePassword = ServerSettings.getCredentialStoreDBPassword();
+
+            } catch (ApplicationSettingsException e) {
+                log.error("Error reading default user store DB configurations.");
+                throw new UserStoreException(e);
+            }
+
+            StringBuilder stringBuilder = new StringBuilder("User store configurations -
dbDriver - ");
+            stringBuilder.append(databaseDriver);
+            stringBuilder.append(" URL - ").append(databaseURL).append(" DB user - ").append(databaseUserName);
+            log.info(stringBuilder.toString());
+
+        }
+
     }
 }



Mime
View raw message