geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From genspr...@apache.org
Subject svn commit: r1033400 - in /geronimo/server/branches/2.2/plugins/derby/geronimo-derby/src: main/java/org/apache/geronimo/derby/ test/java/org/apache/geronimo/derby/
Date Wed, 10 Nov 2010 09:13:38 GMT
Author: genspring
Date: Wed Nov 10 09:13:38 2010
New Revision: 1033400

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

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

Modified: geronimo/server/branches/2.2/plugins/derby/geronimo-derby/src/main/java/org/apache/geronimo/derby/DerbyNetworkGBean.java
URL: http://svn.apache.org/viewvc/geronimo/server/branches/2.2/plugins/derby/geronimo-derby/src/main/java/org/apache/geronimo/derby/DerbyNetworkGBean.java?rev=1033400&r1=1033399&r2=1033400&view=diff
==============================================================================
--- geronimo/server/branches/2.2/plugins/derby/geronimo-derby/src/main/java/org/apache/geronimo/derby/DerbyNetworkGBean.java
(original)
+++ geronimo/server/branches/2.2/plugins/derby/geronimo-derby/src/main/java/org/apache/geronimo/derby/DerbyNetworkGBean.java
Wed Nov 10 09:13:38 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.2/plugins/derby/geronimo-derby/src/main/java/org/apache/geronimo/derby/DerbySystemGBean.java
URL: http://svn.apache.org/viewvc/geronimo/server/branches/2.2/plugins/derby/geronimo-derby/src/main/java/org/apache/geronimo/derby/DerbySystemGBean.java?rev=1033400&r1=1033399&r2=1033400&view=diff
==============================================================================
--- geronimo/server/branches/2.2/plugins/derby/geronimo-derby/src/main/java/org/apache/geronimo/derby/DerbySystemGBean.java
(original)
+++ geronimo/server/branches/2.2/plugins/derby/geronimo-derby/src/main/java/org/apache/geronimo/derby/DerbySystemGBean.java
Wed Nov 10 09:13:38 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;
@@ -89,6 +90,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
@@ -98,7 +101,12 @@ 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
         }
@@ -108,7 +116,12 @@ 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
         }

Modified: geronimo/server/branches/2.2/plugins/derby/geronimo-derby/src/test/java/org/apache/geronimo/derby/DerbySystemGBeanTest.java
URL: http://svn.apache.org/viewvc/geronimo/server/branches/2.2/plugins/derby/geronimo-derby/src/test/java/org/apache/geronimo/derby/DerbySystemGBeanTest.java?rev=1033400&r1=1033399&r2=1033400&view=diff
==============================================================================
--- geronimo/server/branches/2.2/plugins/derby/geronimo-derby/src/test/java/org/apache/geronimo/derby/DerbySystemGBeanTest.java
(original)
+++ geronimo/server/branches/2.2/plugins/derby/geronimo-derby/src/test/java/org/apache/geronimo/derby/DerbySystemGBeanTest.java
Wed Nov 10 09:13:38 2010
@@ -38,7 +38,7 @@ public class DerbySystemGBeanTest extend
 
     public void testCreateSystemUsingServerInfo() throws Exception {
         
-        System.setProperty("derby.connection.requireAuthentication", "false");
+        System.setProperty("derby.connection.requireAuthentication", "true");
         
         ServerInfo serverInfo = new BasicServerInfo(systemDir.toString());
         String derbyDir = "var/dbderby";



Mime
View raw message