geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From genspr...@apache.org
Subject svn commit: r1033454 - in /geronimo/server/branches/2.1/plugins/derby/geronimo-derby/src/main/java/org/apache/geronimo/derby: DerbyNetworkGBean.java DerbySystemGBean.java
Date Wed, 10 Nov 2010 13:18:04 GMT
Author: genspring
Date: Wed Nov 10 13:18:04 2010
New Revision: 1033454

URL: http://svn.apache.org/viewvc?rev=1033454&view=rev
Log:
GERONIMO-5679 Enable derby.connection.requireAuthentication system property so that derby
can be set without authentication.

Modified:
    geronimo/server/branches/2.1/plugins/derby/geronimo-derby/src/main/java/org/apache/geronimo/derby/DerbyNetworkGBean.java
    geronimo/server/branches/2.1/plugins/derby/geronimo-derby/src/main/java/org/apache/geronimo/derby/DerbySystemGBean.java

Modified: geronimo/server/branches/2.1/plugins/derby/geronimo-derby/src/main/java/org/apache/geronimo/derby/DerbyNetworkGBean.java
URL: http://svn.apache.org/viewvc/geronimo/server/branches/2.1/plugins/derby/geronimo-derby/src/main/java/org/apache/geronimo/derby/DerbyNetworkGBean.java?rev=1033454&r1=1033453&r2=1033454&view=diff
==============================================================================
--- geronimo/server/branches/2.1/plugins/derby/geronimo-derby/src/main/java/org/apache/geronimo/derby/DerbyNetworkGBean.java
(original)
+++ geronimo/server/branches/2.1/plugins/derby/geronimo-derby/src/main/java/org/apache/geronimo/derby/DerbyNetworkGBean.java
Wed Nov 10 13:18:04 2010
@@ -82,7 +82,12 @@ public class DerbyNetworkGBean implement
 
     public void doStart() throws Exception {
         InetAddress address = InetAddress.getByName(host);
-        network = new NetworkServerControl(address, port, userName, userPassword);
+     // set system property to enable Derby user authentication
+        if ("false".equals(System.getProperty("derby.connection.requireAuthentication"))){
+            network = new NetworkServerControl(address, port);
+        } else {
+            network = new NetworkServerControl(address, port, userName, userPassword);
+        }        
         network.start(null); // todo work out how to add this to our log stream
         log.debug("Started on host " + host + ':' + port);
     }

Modified: geronimo/server/branches/2.1/plugins/derby/geronimo-derby/src/main/java/org/apache/geronimo/derby/DerbySystemGBean.java
URL: http://svn.apache.org/viewvc/geronimo/server/branches/2.1/plugins/derby/geronimo-derby/src/main/java/org/apache/geronimo/derby/DerbySystemGBean.java?rev=1033454&r1=1033453&r2=1033454&view=diff
==============================================================================
--- geronimo/server/branches/2.1/plugins/derby/geronimo-derby/src/main/java/org/apache/geronimo/derby/DerbySystemGBean.java
(original)
+++ geronimo/server/branches/2.1/plugins/derby/geronimo-derby/src/main/java/org/apache/geronimo/derby/DerbySystemGBean.java
Wed Nov 10 13:18:04 2010
@@ -46,6 +46,7 @@ public class DerbySystemGBean implements
     private final String systemHome;
     private String actualHome;
     private Kernel kernel;
+    private boolean disableAuthentication = false;
 
     public DerbySystemGBean(ServerInfo serverInfo, String derbySystemHome, Kernel kernel)
{
          this.serverInfo = serverInfo;
@@ -91,6 +92,8 @@ public class DerbySystemGBean implements
         if (System.getProperty("derby.connection.requireAuthentication") == null) {
             System.setProperty("derby.connection.requireAuthentication", "true");
             System.setProperty("derby.authentication.provider", "org.apache.geronimo.derby.DerbyUserAuthenticator");
+        }else if ("false".equals(System.getProperty("derby.connection.requireAuthentication"))){
+            disableAuthentication = true;
         }
 
         // load the Embedded driver to initialize the home
@@ -100,7 +103,11 @@ public class DerbySystemGBean implements
 
     public void doStop() throws Exception {
         try {
-            DriverManager.getConnection(SHUTDOWN_ALL, getDerbyUserID(), getDerbyUserPassword());
+            if (disableAuthentication) {
+                DriverManager.getConnection(SHUTDOWN_ALL, null, null); 
+            } else {
+                DriverManager.getConnection(SHUTDOWN_ALL, getDerbyUserID(), getDerbyUserPassword());
+            }
         } catch (SQLException e) {
             // SQLException gets thrown on successful shutdown so ignore
         }
@@ -110,7 +117,11 @@ public class DerbySystemGBean implements
 
     public void doFail() {
         try {
-            DriverManager.getConnection(SHUTDOWN_ALL, getDerbyUserID(), getDerbyUserPassword());
+            if (disableAuthentication) {
+                DriverManager.getConnection(SHUTDOWN_ALL, null, null); 
+            } else {
+                DriverManager.getConnection(SHUTDOWN_ALL, getDerbyUserID(), getDerbyUserPassword());
+            }
         } catch (SQLException e) {
             // SQLException gets thrown on successful shutdown so ignore
         }



Mime
View raw message