db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d..@apache.org
Subject svn commit: r427293 - in /db/derby/code/trunk/java/tools/org/apache/derby/impl/tools/ij: Main.java mtTestCase.java utilMain.java utilMain14.java
Date Mon, 31 Jul 2006 21:35:23 GMT
Author: djd
Date: Mon Jul 31 14:35:23 2006
New Revision: 427293

URL: http://svn.apache.org/viewvc?rev=427293&view=rev
Log:
DERBY-1609 (partial) Move initializing connections from system properties
in ij's utilMain into a separate method from the constructor. Allows ij's
runScript method to create a constructor without creating unrequired
connections based upon System properties.

Modified:
    db/derby/code/trunk/java/tools/org/apache/derby/impl/tools/ij/Main.java
    db/derby/code/trunk/java/tools/org/apache/derby/impl/tools/ij/mtTestCase.java
    db/derby/code/trunk/java/tools/org/apache/derby/impl/tools/ij/utilMain.java
    db/derby/code/trunk/java/tools/org/apache/derby/impl/tools/ij/utilMain14.java

Modified: db/derby/code/trunk/java/tools/org/apache/derby/impl/tools/ij/Main.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/tools/org/apache/derby/impl/tools/ij/Main.java?rev=427293&r1=427292&r2=427293&view=diff
==============================================================================
--- db/derby/code/trunk/java/tools/org/apache/derby/impl/tools/ij/Main.java (original)
+++ db/derby/code/trunk/java/tools/org/apache/derby/impl/tools/ij/Main.java Mon Jul 31 14:35:23
2006
@@ -57,7 +57,6 @@
  *
  */
 public class Main {
-	private LocalizedOutput out;
 	private utilMain utilInstance;
 
 	/**
@@ -197,7 +196,7 @@
 		Give a shortcut to go on the utilInstance so
 		we don't expose utilMain.
 	 */
-	public void go(LocalizedInput in, LocalizedOutput out , 
+	private void go(LocalizedInput in, LocalizedOutput out , 
 				   Properties connAttributeDefaults)
 	{
 		LocalizedInput[] inA = { in } ;
@@ -212,12 +211,11 @@
 	}
 
 	public Main(LocalizedOutput out) {
-		if (out!=null) {
-			this.out = out;
-		} else {
-	        this.out = LocalizedResource.getInstance().getNewOutput(System.out);
+		if (out == null) {
+	        out = LocalizedResource.getInstance().getNewOutput(System.out);
 		}
-		utilInstance = getutilMain(1, this.out);
+		utilInstance = getutilMain(1, out);
+		utilInstance.initConnections();
 	}
 
 	/**

Modified: db/derby/code/trunk/java/tools/org/apache/derby/impl/tools/ij/mtTestCase.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/tools/org/apache/derby/impl/tools/ij/mtTestCase.java?rev=427293&r1=427292&r2=427293&view=diff
==============================================================================
--- db/derby/code/trunk/java/tools/org/apache/derby/impl/tools/ij/mtTestCase.java (original)
+++ db/derby/code/trunk/java/tools/org/apache/derby/impl/tools/ij/mtTestCase.java Mon Jul
31 14:35:23 2006
@@ -240,6 +240,7 @@
 	
 		out.println("--------------"+file+"-----------------");
 		utilInstance = new utilMain(1, out, ignoreErrors);
+		utilInstance.initConnections();
 		utilInstance.setMtUse(true);
 		utilInstance.go(in, out, (java.util.Properties) null);
 		log.flush();

Modified: db/derby/code/trunk/java/tools/org/apache/derby/impl/tools/ij/utilMain.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/tools/org/apache/derby/impl/tools/ij/utilMain.java?rev=427293&r1=427292&r2=427293&view=diff
==============================================================================
--- db/derby/code/trunk/java/tools/org/apache/derby/impl/tools/ij/utilMain.java (original)
+++ db/derby/code/trunk/java/tools/org/apache/derby/impl/tools/ij/utilMain.java Mon Jul 31
14:35:23 2006
@@ -69,7 +69,7 @@
 	ij ijParser;
 	ConnectionEnv[] connEnv;
 	private int currCE;
-	private int		numConnections;
+	private final int		numConnections;
 	private boolean fileInput;
 	private boolean initialFileInput;
 	private boolean mtUse;
@@ -97,7 +97,7 @@
 	 *
 	 * @param numConnections	The number of connections/users to test.
 	 */
-	public utilMain(int numConnections, LocalizedOutput out)
+	utilMain(int numConnections, LocalizedOutput out)
 		throws ijFatalException
 	{
 		this(numConnections, out, (Hashtable)null);
@@ -115,7 +115,7 @@
 	 *							thrown.  ignoreErrors is used for stress
 	 *							tests.
 	 */
-	public utilMain(int numConnections, LocalizedOutput out, Hashtable ignoreErrors)
+	utilMain(int numConnections, LocalizedOutput out, Hashtable ignoreErrors)
 		throws ijFatalException
 	{
 		String framework_property = util.getSystemProperty("framework");
@@ -145,6 +145,23 @@
 		{
 		    commandGrabber[ictr] = new StatementFinder(langUtil.getNewInput(System.in));
 			connEnv[ictr] = new ConnectionEnv(ictr, (numConnections > 1), (numConnections == 1));
+		}
+
+		/* Start with connection/user 0 */
+		currCE = 0;
+		fileInput = false;
+		initialFileInput = false;
+		firstRun = true;
+	}
+	
+	/**
+	 * Initialize the connections from the environment.
+	 *
+	 */
+	void initConnections()
+	{
+		for (int ictr = 0; ictr < numConnections; ictr++)
+		{
 			try {
 				connEnv[ictr].init(out);
 			} catch (SQLException s) {
@@ -157,12 +174,6 @@
 				JDBCDisplayUtil.ShowException(out, ia); // will continue past driver failure
 			}
 		}
-
-		/* Start with connection/user 0 */
-		currCE = 0;
-		fileInput = false;
-		initialFileInput = false;
-		firstRun = true;
 	}
 
 

Modified: db/derby/code/trunk/java/tools/org/apache/derby/impl/tools/ij/utilMain14.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/tools/org/apache/derby/impl/tools/ij/utilMain14.java?rev=427293&r1=427292&r2=427293&view=diff
==============================================================================
--- db/derby/code/trunk/java/tools/org/apache/derby/impl/tools/ij/utilMain14.java (original)
+++ db/derby/code/trunk/java/tools/org/apache/derby/impl/tools/ij/utilMain14.java Mon Jul
31 14:35:23 2006
@@ -36,7 +36,7 @@
 
 	@author jerry
  */
-public class utilMain14 extends utilMain
+class utilMain14 extends utilMain
 {
     private static final String JDBC_NOTSUPPORTED = "JDBC 3 method called - not yet supported";
 	/**
@@ -45,7 +45,7 @@
 	 * @param numConnections	The number of connections/users to test.
 	 *
 	 */
-	public utilMain14(int numConnections, LocalizedOutput out)
+	utilMain14(int numConnections, LocalizedOutput out)
 		throws ijFatalException
 	{
 		super(numConnections, out, (Hashtable)null);
@@ -64,7 +64,7 @@
 	 *							tests.
 	 *
 	 */
-	public utilMain14(int numConnections, LocalizedOutput out, Hashtable ignoreErrors)
+	utilMain14(int numConnections, LocalizedOutput out, Hashtable ignoreErrors)
 		throws ijFatalException
 	{
 		super(numConnections, out, ignoreErrors);



Mime
View raw message