db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d..@apache.org
Subject svn commit: r1438035 [2/2] - in /db/derby/code/trunk/java: testing/org/apache/derbyTesting/functionTests/testData/serializedDataSources/ testing/org/apache/derbyTesting/functionTests/tests/jdbc4/ testing/org/apache/derbyTesting/functionTests/tests/jdbc...
Date Thu, 24 Jan 2013 15:05:35 GMT
Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/replicationTests/ReplicationRun_Local_1Indexing.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/replicationTests/ReplicationRun_Local_1Indexing.java?rev=1438035&r1=1438034&r2=1438035&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/replicationTests/ReplicationRun_Local_1Indexing.java
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/replicationTests/ReplicationRun_Local_1Indexing.java
Thu Jan 24 15:05:34 2013
@@ -26,7 +26,8 @@ import java.sql.SQLException;
 import java.sql.Statement;
 import junit.framework.Test;
 import junit.framework.TestSuite;
-import org.apache.derby.jdbc.ClientDataSource;
+import org.apache.derby.jdbc.ClientDataSourceInterface;
+import org.apache.derbyTesting.junit.JDBC;
 import org.apache.derbyTesting.junit.SecurityManagerSetup;
 
 
@@ -122,9 +123,18 @@ public class ReplicationRun_Local_1Index
             String dbPath,
             int startVal,
             int _noTuplesToInsert)
-        throws SQLException
+        throws Exception
     {
-        ClientDataSource ds = new org.apache.derby.jdbc.ClientDataSource();
+        ClientDataSourceInterface ds;
+
+        if (JDBC.vmSupportsJNDI()) {
+            ds = (ClientDataSourceInterface)Class.forName(
+               "org.apache.derby.jdbc.ClientDataSource").newInstance();
+        } else {
+            ds = (ClientDataSourceInterface)Class.forName(
+               "org.apache.derby.jdbc.NonJNDIClientDataSource40").newInstance();
+        }
+
         ds.setDatabaseName(dbPath);
         ds.setServerName(serverHost);
         ds.setPortNumber(serverPort);

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/replicationTests/ReplicationRun_Local_3.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/replicationTests/ReplicationRun_Local_3.java?rev=1438035&r1=1438034&r2=1438035&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/replicationTests/ReplicationRun_Local_3.java
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/replicationTests/ReplicationRun_Local_3.java
Thu Jan 24 15:05:34 2013
@@ -22,7 +22,8 @@ package org.apache.derbyTesting.function
 
 import java.sql.Connection;
 import java.sql.SQLException;
-import org.apache.derby.jdbc.ClientDataSource;
+import org.apache.derby.jdbc.ClientDataSourceInterface;
+import org.apache.derbyTesting.junit.JDBC;
 
 
 /**
@@ -57,9 +58,19 @@ public class ReplicationRun_Local_3 exte
     
 
     SQLException _failOver(String serverHost, int serverPort, String dbPath) 
+            throws Exception
     {
         util.DEBUG("BEGIN _failOver"); 
-        ClientDataSource ds = new org.apache.derby.jdbc.ClientDataSource();
+        ClientDataSourceInterface ds;
+
+        if (JDBC.vmSupportsJNDI()) {
+            ds = (ClientDataSourceInterface)Class.forName(
+               "org.apache.derby.jdbc.ClientDataSource").newInstance();
+        } else {
+            ds =  (ClientDataSourceInterface)Class.forName(
+               "org.apache.derby.jdbc.NonJNDIClientDataSource40").newInstance();
+        }
+
         ds.setDatabaseName(dbPath);
         ds.setServerName(serverHost);
         ds.setPortNumber(serverPort);
@@ -80,10 +91,19 @@ public class ReplicationRun_Local_3 exte
     SQLException _startSlaveTrueAndCreateTrue(String serverHost, 
             int serverPort,
             String dbPath) 
-        throws SQLException 
+        throws Exception
     {
         util.DEBUG("_startSlaveTrueAndCreateTrue");
-        ClientDataSource ds = new org.apache.derby.jdbc.ClientDataSource();
+        ClientDataSourceInterface ds;
+
+        if (JDBC.vmSupportsJNDI()) {
+            ds = (ClientDataSourceInterface)Class.forName(
+               "org.apache.derby.jdbc.ClientDataSource").newInstance();
+        } else {
+            ds = (ClientDataSourceInterface)Class.forName(
+               "org.apache.derby.jdbc.NonJNDIClientDataSource40").newInstance();
+        }
+
         ds.setDatabaseName(dbPath);
         ds.setServerName(serverHost);
         ds.setPortNumber(serverPort);
@@ -99,9 +119,19 @@ public class ReplicationRun_Local_3 exte
     }
 
     SQLException _stopMaster(String masterServerHost, int masterServerPort, String dbPath)

+            throws Exception
     {
         util.DEBUG("_stopMaster");
-        ClientDataSource ds = new org.apache.derby.jdbc.ClientDataSource();
+        ClientDataSourceInterface ds;
+
+        if (JDBC.vmSupportsJNDI()) {
+            ds = (ClientDataSourceInterface)Class.forName(
+               "org.apache.derby.jdbc.ClientDataSource").newInstance();
+        } else {
+            ds = (ClientDataSourceInterface)Class.forName(
+               "org.apache.derby.jdbc.NonJNDIClientDataSource40").newInstance();
+        }
+
         ds.setDatabaseName(dbPath);
         ds.setServerName(masterServerHost);
         ds.setPortNumber(masterServerPort);

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/replicationTests/ReplicationRun_Local_3_p3.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/replicationTests/ReplicationRun_Local_3_p3.java?rev=1438035&r1=1438034&r2=1438035&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/replicationTests/ReplicationRun_Local_3_p3.java
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/replicationTests/ReplicationRun_Local_3_p3.java
Thu Jan 24 15:05:34 2013
@@ -23,7 +23,8 @@ package org.apache.derbyTesting.function
 import java.sql.SQLException;
 import junit.framework.Test;
 import junit.framework.TestSuite;
-import org.apache.derby.jdbc.ClientDataSource;
+import org.apache.derby.jdbc.ClientDataSourceInterface;
+import org.apache.derbyTesting.junit.JDBC;
 import org.apache.derbyTesting.junit.SecurityManagerSetup;
 
 
@@ -192,7 +193,17 @@ public class ReplicationRun_Local_3_p3 e
             {
                 String connectionURL =
                     slaveDatabasePath + FS + slaveDbSubPath + FS + replicatedDb;
-                ClientDataSource ds = new ClientDataSource();
+                ClientDataSourceInterface ds;
+
+                if (JDBC.vmSupportsJNDI()) {
+                    ds = (ClientDataSourceInterface)Class.forName(
+                        "org.apache.derby.jdbc.ClientDataSource").newInstance();
+                } else {
+                    ds = (ClientDataSourceInterface)Class.forName(
+                        "org.apache.derby.jdbc.NonJNDIClientDataSource40").
+                            newInstance();
+                }
+
                 ds.setDatabaseName(connectionURL);
                 ds.setServerName(slaveServerHost);
                 ds.setPortNumber(slaveServerPort);

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/replicationTests/ReplicationRun_Local_3_p4.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/replicationTests/ReplicationRun_Local_3_p4.java?rev=1438035&r1=1438034&r2=1438035&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/replicationTests/ReplicationRun_Local_3_p4.java
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/replicationTests/ReplicationRun_Local_3_p4.java
Thu Jan 24 15:05:34 2013
@@ -24,7 +24,8 @@ import java.sql.Connection;
 import java.sql.SQLException;
 import junit.framework.Test;
 import junit.framework.TestSuite;
-import org.apache.derby.jdbc.ClientDataSource;
+import org.apache.derby.jdbc.ClientDataSourceInterface;
+import org.apache.derbyTesting.junit.JDBC;
 import org.apache.derbyTesting.junit.SecurityManagerSetup;
 
 
@@ -172,9 +173,18 @@ public class ReplicationRun_Local_3_p4 e
     
     private SQLException _connectToSlave(String slaveServerHost, 
             int slaveServerPort, 
-            String dbPath) {
+            String dbPath) throws Exception {
         util.DEBUG("_connectToSlave");
-        ClientDataSource ds = new org.apache.derby.jdbc.ClientDataSource();
+        ClientDataSourceInterface ds;
+
+        if (JDBC.vmSupportsJNDI()) {
+            ds = (ClientDataSourceInterface)Class.forName(
+               "org.apache.derby.jdbc.ClientDataSource").newInstance();
+        } else {
+            ds = (ClientDataSourceInterface)Class.forName(
+               "org.apache.derby.jdbc.NonJNDIClientDataSource40").newInstance();
+        }
+
         ds.setDatabaseName(dbPath);
         ds.setServerName(slaveServerHost);
         ds.setPortNumber(slaveServerPort);
@@ -191,9 +201,18 @@ public class ReplicationRun_Local_3_p4 e
 
     private SQLException _internal_stopSlave(String slaveServerHost, 
             int slaveServerPort, 
-            String dbPath) {
+            String dbPath) throws Exception {
         util.DEBUG("_internal_stopSlave");
-        ClientDataSource ds = new org.apache.derby.jdbc.ClientDataSource();
+        ClientDataSourceInterface ds;
+
+        if (JDBC.vmSupportsJNDI()) {
+            ds = (ClientDataSourceInterface)Class.forName(
+               "org.apache.derby.jdbc.ClientDataSource").newInstance();
+        } else {
+            ds = (ClientDataSourceInterface)Class.forName(
+               "org.apache.derby.jdbc.NonJNDIClientDataSource40").newInstance();
+        }
+
         ds.setDatabaseName(dbPath);
         ds.setServerName(slaveServerHost);
         ds.setPortNumber(slaveServerPort);

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/replicationTests/ReplicationRun_Local_3_p6.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/replicationTests/ReplicationRun_Local_3_p6.java?rev=1438035&r1=1438034&r2=1438035&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/replicationTests/ReplicationRun_Local_3_p6.java
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/replicationTests/ReplicationRun_Local_3_p6.java
Thu Jan 24 15:05:34 2013
@@ -28,7 +28,8 @@ import java.sql.SQLException;
 import java.sql.Statement;
 import junit.framework.Test;
 import junit.framework.TestSuite;
-import org.apache.derby.jdbc.ClientDataSource;
+import org.apache.derby.jdbc.ClientDataSourceInterface;
+import org.apache.derbyTesting.junit.JDBC;
 import org.apache.derbyTesting.junit.SecurityManagerSetup;
 
 
@@ -220,9 +221,18 @@ public class ReplicationRun_Local_3_p6 e
         
     private Connection _getConnection(String databasePath, String dbSubPath, 
             String dbName, String serverHost, int serverPort)
-        throws SQLException
+        throws Exception
     {
-        ClientDataSource ds = new org.apache.derby.jdbc.ClientDataSource();
+        ClientDataSourceInterface ds;
+
+        if (JDBC.vmSupportsJNDI()) {
+            ds = (ClientDataSourceInterface)Class.forName(
+               "org.apache.derby.jdbc.ClientDataSource").newInstance();
+        } else {
+            ds = (ClientDataSourceInterface)Class.forName(
+               "org.apache.derby.jdbc.NonJNDIClientDataSource40").newInstance();
+        }
+
         ds.setDatabaseName(databasePath +FS+ dbSubPath +FS+ dbName);
         ds.setServerName(serverHost);
         ds.setPortNumber(serverPort);

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/replicationTests/ReplicationRun_Local_Encrypted_1.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/replicationTests/ReplicationRun_Local_Encrypted_1.java?rev=1438035&r1=1438034&r2=1438035&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/replicationTests/ReplicationRun_Local_Encrypted_1.java
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/replicationTests/ReplicationRun_Local_Encrypted_1.java
Thu Jan 24 15:05:34 2013
@@ -24,7 +24,8 @@ import java.sql.Connection;
 import java.sql.SQLException;
 import junit.framework.Test;
 import junit.framework.TestSuite;
-import org.apache.derby.jdbc.ClientDataSource;
+import org.apache.derby.jdbc.ClientDataSourceInterface;
+import org.apache.derbyTesting.junit.JDBC;
 import org.apache.derbyTesting.junit.SecurityManagerSetup;
 
 
@@ -218,10 +219,19 @@ public class ReplicationRun_Local_Encryp
     
     SQLException _connectToSlave(String slaveServerHost, int slaveServerPort,
             String dbPath) 
-        throws SQLException
+        throws Exception
     {
         util.DEBUG("_connectToSlave");
-        ClientDataSource ds = new org.apache.derby.jdbc.ClientDataSource();
+        ClientDataSourceInterface ds;
+
+        if (JDBC.vmSupportsJNDI()) {
+            ds = (ClientDataSourceInterface)Class.forName(
+               "org.apache.derby.jdbc.ClientDataSource").newInstance();
+        } else {
+            ds = (ClientDataSourceInterface)Class.forName(
+               "org.apache.derby.jdbc.NonJNDIClientDataSource40").newInstance();
+        }
+
         ds.setDatabaseName(dbPath);
         ds.setServerName(slaveServerHost);
         ds.setPortNumber(slaveServerPort);

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/replicationTests/SimplePerfTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/replicationTests/SimplePerfTest.java?rev=1438035&r1=1438034&r2=1438035&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/replicationTests/SimplePerfTest.java
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/replicationTests/SimplePerfTest.java
Thu Jan 24 15:05:34 2013
@@ -29,8 +29,10 @@ import java.sql.SQLException;
 import java.sql.Statement;
 import junit.framework.Test;
 import junit.framework.TestSuite;
-import org.apache.derby.jdbc.ClientDataSource;
+import org.apache.derby.jdbc.ClientDataSourceInterface;
+import org.apache.derby.jdbc.NonJNDIClientDataSource40;
 import org.apache.derbyTesting.junit.BaseJDBCTestCase;
+import org.apache.derbyTesting.junit.JDBC;
 import org.apache.derbyTesting.junit.SecurityManagerSetup;
 import org.apache.derbyTesting.junit.TestConfiguration;
 
@@ -80,7 +82,8 @@ public class SimplePerfTest extends Base
      * @throws SQLException, IOException, InterruptedException
      */
     public void testInserts()
-    throws SQLException, IOException, InterruptedException
+    throws SQLException, IOException, InterruptedException,
+        ClassNotFoundException, IllegalAccessException, InstantiationException
     {        
         String vc = "";
         for ( int i=0;i<20000;i++ )
@@ -123,7 +126,9 @@ public class SimplePerfTest extends Base
         System.out.println("count: "+count);
     }
     public void verifyTestInserts()
-    throws SQLException, IOException, InterruptedException
+        throws SQLException, IOException, InterruptedException,
+            ClassNotFoundException, IllegalAccessException,
+            InstantiationException
     {
         Connection conn = clientConnection(masterHostName, masterPortNo, dbPath);
         
@@ -135,9 +140,18 @@ public class SimplePerfTest extends Base
         // System.out.println("count: "+count);
     }
     private Connection clientConnection(String hostName, int portNo, String dbPath)
-            throws SQLException
+            throws SQLException, ClassNotFoundException, IllegalAccessException,
+            InstantiationException
     {
-        ClientDataSource ds = new org.apache.derby.jdbc.ClientDataSource();
+        ClientDataSourceInterface ds;
+
+        if (JDBC.vmSupportsJNDI()) {
+            ds = (ClientDataSourceInterface)Class.forName(
+                    "org.apache.derby.jdbc.ClientDataSource").newInstance();
+        } else {
+            ds = new NonJNDIClientDataSource40();
+        }
+
         ds.setDatabaseName(dbPath);
         ds.setServerName(hostName);
         ds.setPortNumber(portNo);

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/replicationTests/SimplePerfTest_Verify.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/replicationTests/SimplePerfTest_Verify.java?rev=1438035&r1=1438034&r2=1438035&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/replicationTests/SimplePerfTest_Verify.java
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/replicationTests/SimplePerfTest_Verify.java
Thu Jan 24 15:05:34 2013
@@ -28,8 +28,10 @@ import java.sql.SQLException;
 import java.sql.Statement;
 import junit.framework.Test;
 import junit.framework.TestSuite;
-import org.apache.derby.jdbc.ClientDataSource;
+import org.apache.derby.jdbc.ClientDataSourceInterface;
+import org.apache.derby.jdbc.NonJNDIClientDataSource40;
 import org.apache.derbyTesting.junit.BaseJDBCTestCase;
+import org.apache.derbyTesting.junit.JDBC;
 import org.apache.derbyTesting.junit.SecurityManagerSetup;
 import org.apache.derbyTesting.junit.TestConfiguration;
 
@@ -75,12 +77,14 @@ public class SimplePerfTest_Verify exten
      * @throws SQLException, IOException, InterruptedException
      */
     public void testVerify()
-    throws SQLException, IOException, InterruptedException
+        throws SQLException, IOException, InterruptedException,
+        ClassNotFoundException, IllegalAccessException, InstantiationException
     {
         verifyTestInserts();
     }
     private void verifyTestInserts()
-    throws SQLException, IOException, InterruptedException
+        throws SQLException, IOException, InterruptedException,
+        ClassNotFoundException, IllegalAccessException, InstantiationException
     {
         Connection conn = clientConnection(masterHostName, masterPortNo, dbPath); // getConnection();
         
@@ -92,9 +96,18 @@ public class SimplePerfTest_Verify exten
         this.assertEquals(count, tuplesToInsert);
     }
     private Connection clientConnection(String hostName, int portNo, String dbPath)
-            throws SQLException
+            throws SQLException, ClassNotFoundException, IllegalAccessException,
+            InstantiationException
     {
-        ClientDataSource ds = new org.apache.derby.jdbc.ClientDataSource();
+        ClientDataSourceInterface ds;
+
+        if (JDBC.vmSupportsJNDI()) {
+            ds = (ClientDataSourceInterface)Class.forName(
+                    "org.apache.derby.jdbc.ClientDataSource").newInstance();
+        } else {
+            ds = new NonJNDIClientDataSource40();
+        }
+
         ds.setDatabaseName(dbPath);
         ds.setServerName(hostName);
         ds.setPortNumber(portNo);

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/Derby.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/Derby.java?rev=1438035&r1=1438034&r2=1438035&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/Derby.java (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/Derby.java Thu Jan 24 15:05:34
2013
@@ -95,7 +95,9 @@ public class Derby {
         }
 
         return hasCorrectJar("/derbyclient.jar",
-                "org.apache.derby.jdbc.ClientDataSource");
+                JDBC.vmSupportsJNDI() ?
+                "org.apache.derby.jdbc.ClientDataSource" :
+                "org.apache.derby.jdbc.NonJNDIClientDataSource40");
     }
     
     private static boolean hasCorrectJar(String jarName, String className)

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/JDBC.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/JDBC.java?rev=1438035&r1=1438034&r2=1438035&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/JDBC.java (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/JDBC.java Thu Jan 24 15:05:34
2013
@@ -128,6 +128,17 @@ public class JDBC {
         HAVE_AUTO_CLOSEABLE_RESULT_SET = autoCloseable;
     }
 
+    private static final boolean HAVE_REFERENCEABLE;
+    static {
+        boolean ok = false;
+        try {
+            Class.forName("javax.naming.Referenceable");
+            ok = true;
+        } catch (Throwable t) {
+        }
+        HAVE_REFERENCEABLE = ok;
+    }
+
     /**
      * Can we load a specific class, use this to determine JDBC level.
      * @param className Class to attempt load on.
@@ -192,6 +203,13 @@ public class JDBC {
 		       && HAVE_SAVEPOINT;
 	}	
 	
+    /**
+     * @return {@code true} if JNDI is available.
+     */
+    public static boolean vmSupportsJNDI() {
+        return HAVE_REFERENCEABLE;
+    }
+
 	/**
 	 * Rollback and close a connection for cleanup.
 	 * Test code that is expecting Connection.close to succeed

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/JDBCClient.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/JDBCClient.java?rev=1438035&r1=1438034&r2=1438035&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/JDBCClient.java (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/JDBCClient.java Thu Jan
24 15:05:34 2013
@@ -45,9 +45,19 @@ public final class JDBCClient {
     static final JDBCClient EMBEDDED_40 = new JDBCClient(
             "Embedded_40", 
             "org.apache.derby.jdbc.EmbeddedDriver", 
-            "org.apache.derby.jdbc.EmbeddedDataSource40", 
-            "org.apache.derby.jdbc.EmbeddedConnectionPoolDataSource40",
-            "org.apache.derby.jdbc.EmbeddedXADataSource40",
+
+            JDBC.vmSupportsJNDI() ?
+            "org.apache.derby.jdbc.EmbeddedDataSource40":
+            "org.apache.derby.jdbc.NonJNDIEmbeddedDataSource40",
+
+            JDBC.vmSupportsJNDI() ?
+            "org.apache.derby.jdbc.EmbeddedConnectionPoolDataSource40":
+            "org.apache.derby.jdbc.NonJNDIEmbeddedConnectionPoolDataSource40",
+
+            JDBC.vmSupportsJNDI() ?
+            "org.apache.derby.jdbc.EmbeddedXADataSource40":
+            "org.apache.derby.jdbc.NonJNDIEmbeddedXADataSource40",
+
             "jdbc:derby:");
     
     /**
@@ -83,15 +93,25 @@ public final class JDBCClient {
     static final JDBCClient DERBYNETCLIENT= new JDBCClient(
             "DerbyNetClient",
             "org.apache.derby.jdbc.ClientDriver",
+
             JDBC.vmSupportsJDBC4() ?
+            (JDBC.vmSupportsJNDI() ?
             "org.apache.derby.jdbc.ClientDataSource40" :
-            "org.apache.derby.jdbc.ClientDataSource",
+            "org.apache.derby.jdbc.NonJNDIClientDataSource40") :
+             "org.apache.derby.jdbc.ClientDataSource",
+
             JDBC.vmSupportsJDBC4() ?
+            (JDBC.vmSupportsJNDI() ?
             "org.apache.derby.jdbc.ClientConnectionPoolDataSource40" :
+            "org.apache.derby.jdbc.NonJNDIClientConnectionPoolDataSource40") :
             "org.apache.derby.jdbc.ClientConnectionPoolDataSource",
+
             JDBC.vmSupportsJDBC4() ?
+            (JDBC.vmSupportsJNDI() ?
             "org.apache.derby.jdbc.ClientXADataSource40" :
+            "org.apache.derby.jdbc.NonJNDIClientXADataSource40") :
             "org.apache.derby.jdbc.ClientXADataSource",
+
             "jdbc:derby://");
     
     static final JDBCClient DERBYNETCLIENT_30 = new JDBCClient(

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/SecurityManagerSetup.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/SecurityManagerSetup.java?rev=1438035&r1=1438034&r2=1438035&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/SecurityManagerSetup.java
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/SecurityManagerSetup.java
Thu Jan 24 15:05:34 2013
@@ -386,11 +386,14 @@ public final class SecurityManagerSetup 
 		// JSR169, attempts will be made to load classes not supported in
 		// that environment, such as javax.naming.Referenceable. See DERBY-2269.
 		if (!JDBC.vmSupportsJSR169()) {
-		    URL client = getURL("org.apache.derby.jdbc.ClientDataSource");
+           URL client = getURL(
+                    JDBC.vmSupportsJNDI() ?
+                    "org.apache.derby.jdbc.ClientDataSource" :
+                    "org.apache.derby.jdbc.NonJNDIClientDataSource40");
+
 		    if(client != null)
 		        classPathSet.setProperty("derbyTesting.clientjar", stripJar(client));
-		}
-	
+        }
 		return false;
 	}
     

Modified: db/derby/code/trunk/java/tools/org/apache/derby/impl/tools/ij/ij.jj
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/tools/org/apache/derby/impl/tools/ij/ij.jj?rev=1438035&r1=1438034&r2=1438035&view=diff
==============================================================================
--- db/derby/code/trunk/java/tools/org/apache/derby/impl/tools/ij/ij.jj (original)
+++ db/derby/code/trunk/java/tools/org/apache/derby/impl/tools/ij/ij.jj Thu Jan 24 15:05:34
2013
@@ -150,7 +150,7 @@ class ij {
 		protocol = p.getProperty(PROTOCOL_PROPERTY);
 		String framework_property = p.getProperty(FRAMEWORK_PROPERTY);
 		
-		if (ij.JDBC20X() && ij.JTA() && ij.JNDI())
+       if (ij.JDBC20X() && ij.JTA())
 		{
 			try {
 				xahelper = (xaAbstractHelper) Class.forName("org.apache.derby.impl.tools.ij.xaHelper").newInstance();
@@ -218,7 +218,7 @@ class ij {
 	 *
 	 * @return true if JNDI extension classes can be loaded
 	 */
-	private static boolean JNDI()
+   public static boolean JNDI()
 	{
 		try
 		{

Modified: db/derby/code/trunk/java/tools/org/apache/derby/impl/tools/ij/xaHelper.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/tools/org/apache/derby/impl/tools/ij/xaHelper.java?rev=1438035&r1=1438034&r2=1438035&view=diff
==============================================================================
--- db/derby/code/trunk/java/tools/org/apache/derby/impl/tools/ij/xaHelper.java (original)
+++ db/derby/code/trunk/java/tools/org/apache/derby/impl/tools/ij/xaHelper.java Thu Jan 24
15:05:34 2013
@@ -521,41 +521,53 @@ class xaHelper implements xaAbstractHelp
                return (XADataSource) 
                 (Class.forName("com.ibm.db2.jcc.DB2XADataSource").newInstance());
             else if (isNetClient){
-                //running under jdk1.6 or higher 
-                // try instantiating EmbeddedXADataSource40
-                try {
+                if (ij.JNDI()) {
+                    //running under jdk1.6 or higher
+                    // try instantiating EmbeddedXADataSource40
+                    try {
+                        return (XADataSource)(Class.forName(
+                                "org.apache.derby.jdbc.ClientXADataSource40").
+                                newInstance());
+                    }
+                    catch (ClassNotFoundException e) {
+                        //probably it was not compiled with jdbc4.0
+                        //support go ahead with ClientXADataSource
+                    }
+                    catch (UnsupportedClassVersionError ue) {
+                        // ClientXADataSource
+                    }
+                    return (XADataSource) (Class.forName(
+                            "org.apache.derby.jdbc.ClientXADataSource"
+                            ).newInstance());
+                } else {
                     return (XADataSource)(Class.forName(
-                            "org.apache.derby.jdbc." +
-                    "ClientXADataSource40").newInstance());                             
          
+                        "org.apache.derby.jdbc.NonJNDIClientXADataSource40").
+                            newInstance());
                 }
-                catch (ClassNotFoundException e) {
-                    //probably it was not compiled with jdbc4.0
-                    //support go ahead with ClientXADataSource
-                }
-                catch (UnsupportedClassVersionError ue) { 
-                    // ClientXADataSource
-                }
-                return (XADataSource) (Class.forName(
-                        "org.apache.derby.jdbc.ClientXADataSource"
-                ).newInstance());
-            }
-            else {
-                //running under jdk1.6 or higher 
-                // try instantiating EmbeddedXADataSource40
-                try {
+            } else {
+                if (ij.JNDI()) {
+                    //running under jdk1.6 or higher
+                    // try instantiating EmbeddedXADataSource40
+                    try {
+                        return (XADataSource)(Class.forName(
+                            "org.apache.derby.jdbc.EmbeddedXADataSource40").
+                                newInstance());
+                    } catch (ClassNotFoundException e) {
+                        //probably it was not compiled with jdbc4.0
+                        //support go ahead with EmbeddedXADataSource
+                    } catch (UnsupportedClassVersionError ue) {
+                        // not jdk 16 or higher. Go ahead with
+                        // EmbeddedXADataSource
+                    }
+
                     return (XADataSource)(Class.forName(
-                            "org.apache.derby.jdbc." +
-                    "EmbeddedXADataSource40").newInstance());                           
            
-                }
-                catch (ClassNotFoundException e) {
-                    //probably it was not compiled with jdbc4.0
-                    //support go ahead with EmbeddedXADataSource
-                }
-                catch (UnsupportedClassVersionError ue) {
-                    // not jdk 16 or higher. Go ahead with
-                    // EmbeddedXADataSource
+                        "org.apache.derby.jdbc.EmbeddedXADataSource").
+                            newInstance());
+                } else {
+                    return (XADataSource)(Class.forName(
+                        "org.apache.derby.jdbc.NonJNDIEmbeddedXADataSource40").
+                            newInstance());
                 }
-                return (XADataSource)(Class.forName("org.apache.derby.jdbc.EmbeddedXADataSource").newInstance());
             }
         }
         catch(ClassNotFoundException cnfe) {



Mime
View raw message