Added: 
incubator/derby/code/trunk/java/client/org/apache/derby/client/am/FloatingPoint.java
URL: 
http://svn.apache.org/viewcvs/incubator/derby/code/trunk/java/client/org/apache/derby/client/am/FloatingPoint.java?rev=165178&view=auto
==============================================================================
--- 
incubator/derby/code/trunk/java/client/org/apache/derby/client/am/FloatingPoint.java
 (added)
+++ 
incubator/derby/code/trunk/java/client/org/apache/derby/client/am/FloatingPoint.java
 Thu Apr 28 12:05:42 2005
@@ -0,0 +1,130 @@
+/*
+
+   Derby - Class org.apache.derby.client.am.FloatingPoint
+
+   Copyright (c) 2001, 2005 The Apache Software Foundation or its licensors, 
where applicable.
+
+   Licensed under the Apache License, Version 2.0 (the "License");
+   you may not use this file except in compliance with the License.
+   You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+
+*/
+package org.apache.derby.client.am;
+
+/**
+ * Converters from floating point bytes to Java <code>float</code>, 
<code>double</code>,
+ * or <code>java.math.BigDecimal</code>.
+ */
+public class FloatingPoint
+{
+  // Hide the default constructor, this is a static class.
+  private FloatingPoint () {}
+
+  /**
+   * Supported Unix Big Endian IEEE 754 floating point representation.
+   */
+  public final static int IEEE_754_FLOATING_POINT = 0x48;
+
+  //--------------------------private helper 
methods----------------------------
+
+  /**
+   * Convert the byte array to an int.
+   */
+  private static final int convertFromByteToInt(byte[] buffer, int offset)
+  {
+    return (  buffer[offset]           << 24 ) |
+           ( (buffer[offset+1] & 0xFF) << 16 ) |
+           ( (buffer[offset+2] & 0xFF) << 8  ) |
+           (  buffer[offset+3] & 0xFF );
+  }
+
+  /**
+   * Convert the byte array to a long.
+   */
+  private static final long convertFromByteToLong(byte[] buffer, int offset)
+  {
+    return ( (buffer[offset]   & 0xFFL) << 56 ) |
+           ( (buffer[offset+1] & 0xFFL) << 48 ) |
+           ( (buffer[offset+2] & 0xFFL) << 40 ) |
+           ( (buffer[offset+3] & 0xFFL) << 32 ) |
+           ( (buffer[offset+4] & 0xFFL) << 24 ) |
+           ( (buffer[offset+5] & 0xFFL) << 16 ) |
+           ( (buffer[offset+6] & 0xFFL) << 8  ) |
+           (  buffer[offset+7] & 0xFFL );
+  }
+
+
+  //--------------entry points for runtime 
representation-----------------------
+
+  /**
+   * Build a Java float from a 4-byte floating point representation.
+   * <p>
+   * This includes DERBY types:
+   * <ul>
+   * <li> REAL
+   * <li> FLOAT(1<=n<=24)
+   * </ul>
+   *
+   * @exception IllegalArgumentException if the specified representation is 
not recognized.
+   */
+  public static final float getFloat (byte[] buffer, int offset)
+  {
+    return Float.intBitsToFloat (convertFromByteToInt (buffer, offset));
+  }
+
+  /**
+   * Build a Java double from an 8-byte floating point representation.
+   * <p>
+   * <p>
+   * This includes DERBY types:
+   * <ul>
+   * <li> FLOAT
+   * <li> DOUBLE [PRECISION]
+   * </ul>
+   *
+   * @exception IllegalArgumentException if the specified representation is 
not recognized.
+   */
+  public static final double getDouble (byte[] buffer, int offset)
+  {
+    return Double.longBitsToDouble (convertFromByteToLong (buffer, offset));
+  }
+
+  //--------------entry points for runtime 
representation-----------------------
+
+  /**
+   * Write a Java <code>float</code> to a 4-byte floating point representation.
+   */
+  public static final void floatToIeee754Bytes (byte[] buffer, int offset, 
float f)
+  {
+    int intBits = Float.floatToIntBits (f);
+    buffer[offset]   = (byte) ((intBits >>> 24) & 0xFF);
+    buffer[offset+1] = (byte) ((intBits >>> 16) & 0xFF);
+    buffer[offset+2] = (byte) ((intBits >>>  8) & 0xFF);
+    buffer[offset+3] = (byte) ( intBits        & 0xFF);
+  }
+
+  /**
+   * Write a Java <code>double</code> to an 8-byte double precision
+   * floating point representation.
+  */
+  public static final void doubleToIeee754Bytes (byte[] buffer, int offset, 
double d)
+  {
+    long longBits = Double.doubleToLongBits (d);
+    buffer[offset]   = (byte) ((longBits >>> 56) & 0xFF);
+    buffer[offset+1] = (byte) ((longBits >>> 48) & 0xFF);
+    buffer[offset+2] = (byte) ((longBits >>> 40) & 0xFF);
+    buffer[offset+3] = (byte) ((longBits >>> 32) & 0xFF);
+    buffer[offset+4] = (byte) ((longBits >>> 24) & 0xFF);
+    buffer[offset+5] = (byte) ((longBits >>> 16) & 0xFF);
+    buffer[offset+6] = (byte) ((longBits >>>  8) & 0xFF);
+    buffer[offset+7] = (byte) ( longBits        & 0xFF);
+  }
+}

Propchange: 
incubator/derby/code/trunk/java/client/org/apache/derby/client/am/FloatingPoint.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: 
incubator/derby/code/trunk/java/client/org/apache/derby/client/am/GetFileInputStreamAction.java
URL: 
http://svn.apache.org/viewcvs/incubator/derby/code/trunk/java/client/org/apache/derby/client/am/GetFileInputStreamAction.java?rev=165178&view=auto
==============================================================================
--- 
incubator/derby/code/trunk/java/client/org/apache/derby/client/am/GetFileInputStreamAction.java
 (added)
+++ 
incubator/derby/code/trunk/java/client/org/apache/derby/client/am/GetFileInputStreamAction.java
 Thu Apr 28 12:05:42 2005
@@ -0,0 +1,55 @@
+/*
+
+   Derby - Class org.apache.derby.client.am.GetFileInputStreamAction
+
+   Copyright (c) 2002, 2005 The Apache Software Foundation or its licensors, 
where applicable.
+
+   Licensed under the Apache License, Version 2.0 (the "License");
+   you may not use this file except in compliance with the License.
+   You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+
+*/
+
+package org.apache.derby.client.am;
+
+/**
+ * Java 2 PrivilegedExceptionAction encapsulation of creating a new 
FileInputStream
+ * throws FileNotFoundException
+ */
+public class GetFileInputStreamAction implements 
java.security.PrivilegedExceptionAction
+{
+  // the pathname used by the input file in the file system
+  private String filePathName_ = null;
+  
+  private String canonicalPath_ = null; 
+
+  //-------------------- Constructors --------------------
+
+  public GetFileInputStreamAction (String filePathName)
+  {
+    filePathName_ = filePathName;
+  }
+
+  //-------------------- methods --------------------
+
+  public Object run() throws java.io.IOException
+  {
+    java.io.File file = new java.io.File (filePathName_);
+    java.io.FileInputStream fileInputStream = new java.io.FileInputStream 
(file);
+    canonicalPath_ = file.getCanonicalPath();
+    return fileInputStream;
+  }
+  
+  public String getCanonicalPath()
+  {
+    return canonicalPath_;
+  }
+}

Propchange: 
incubator/derby/code/trunk/java/client/org/apache/derby/client/am/GetFileInputStreamAction.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: 
incubator/derby/code/trunk/java/client/org/apache/derby/client/am/GetResourceBundleAction.java
URL: 
http://svn.apache.org/viewcvs/incubator/derby/code/trunk/java/client/org/apache/derby/client/am/GetResourceBundleAction.java?rev=165178&view=auto
==============================================================================
--- 
incubator/derby/code/trunk/java/client/org/apache/derby/client/am/GetResourceBundleAction.java
 (added)
+++ 
incubator/derby/code/trunk/java/client/org/apache/derby/client/am/GetResourceBundleAction.java
 Thu Apr 28 12:05:42 2005
@@ -0,0 +1,43 @@
+/*
+
+   Derby - Class org.apache.derby.client.am.GetResourceBundleAction
+
+   Copyright (c) 2002, 2005 The Apache Software Foundation or its licensors, 
where applicable.
+
+   Licensed under the Apache License, Version 2.0 (the "License");
+   you may not use this file except in compliance with the License.
+   You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+
+*/
+
+package org.apache.derby.client.am;
+
+// Java 2 PrivilegedExceptionAction encapsulation of 
java.util.ResourceBundle.getBundle() action
+public class GetResourceBundleAction implements 
java.security.PrivilegedExceptionAction
+{
+  private String resourceBundleName_ = null; // class name for resources
+
+  // the base name of the resource bundle, a fully qualified class name
+  public GetResourceBundleAction (String resourceBundleName)
+  {
+    resourceBundleName_ = resourceBundleName;
+  }
+
+  public Object run () throws NullPointerException, 
java.util.MissingResourceException
+  {
+    return java.util.ResourceBundle.getBundle (resourceBundleName_);
+  }
+
+  public void setResourceBundleName (String resourceBundleName)
+  {
+    resourceBundleName_ = resourceBundleName;
+  }
+}

Propchange: 
incubator/derby/code/trunk/java/client/org/apache/derby/client/am/GetResourceBundleAction.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: 
incubator/derby/code/trunk/java/client/org/apache/derby/client/am/GetResourceInputStreamAction.java
URL: 
http://svn.apache.org/viewcvs/incubator/derby/code/trunk/java/client/org/apache/derby/client/am/GetResourceInputStreamAction.java?rev=165178&view=auto
==============================================================================
--- 
incubator/derby/code/trunk/java/client/org/apache/derby/client/am/GetResourceInputStreamAction.java
 (added)
+++ 
incubator/derby/code/trunk/java/client/org/apache/derby/client/am/GetResourceInputStreamAction.java
 Thu Apr 28 12:05:42 2005
@@ -0,0 +1,100 @@
+/*
+
+   Derby - Class org.apache.derby.client.am.GetResourceInputStreamAction
+
+   Copyright (c) 2003, 2005 The Apache Software Foundation or its licensors, 
where applicable.
+
+   Licensed under the Apache License, Version 2.0 (the "License");
+   you may not use this file except in compliance with the License.
+   You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+
+*/
+
+package org.apache.derby.client.am;
+
+/**
+ * Java 2 PrivilegedAction encapsulation of attempting to acquire 
driver-general
+ * properties as a System resource.
+ */
+public class GetResourceInputStreamAction implements 
java.security.PrivilegedAction
+{
+  // Name for loading the resource.
+  private String resourceName_ = null;
+  // Path of the resource being loaded.
+  private String resourcePath_ = null;
+  // Class loader being used to load the resource.
+  private String resourceLoaderId_ = null;
+
+  //-------------------- Constructors --------------------
+  
+  public GetResourceInputStreamAction (String resourceName)
+  {
+    resourceName_ = resourceName;
+  }
+
+  //-------------------- methods --------------------
+
+  public Object run()
+  {
+    try {
+      ClassLoader contextLoader = 
Thread.currentThread().getContextClassLoader();
+      if (contextLoader != null) {
+        java.net.URL resourceUrl = contextLoader.getResource (resourceName_);
+        if (resourceUrl != null) {
+          resourcePath_ = resourceUrl.getPath();
+          resourceLoaderId_ = "Context ClassLoader: " + contextLoader;
+          return contextLoader.getResourceAsStream (resourceName_);
+        }
+      }
+      ClassLoader thisLoader = getClass().getClassLoader();
+      if (thisLoader != contextLoader) {
+        java.net.URL resourceUrl = thisLoader.getResource (resourceName_);
+        if (resourceUrl != null) {
+          resourcePath_ = resourceUrl.getPath();
+          resourceLoaderId_ = "Driver ClassLoader: " + thisLoader;
+          return thisLoader.getResourceAsStream (resourceName_);
+        }
+      }
+      ClassLoader systemLoader = ClassLoader.getSystemClassLoader();
+      if (systemLoader != contextLoader &&
+          systemLoader != thisLoader) {
+        java.net.URL resourceUrl = systemLoader.getResource (resourceName_);
+        if (resourceUrl != null) {
+          resourcePath_ = resourceUrl.getPath();
+          resourceLoaderId_ = "System ClassLoader: " + systemLoader;
+          return systemLoader.getResourceAsStream (resourceName_);
+        }
+      }
+      return null;
+    }
+    catch (java.security.AccessControlException ace) {
+      // This happens in an Applet environment,
+      // so return with null.
+      return null;
+    }
+  }
+  
+  public void setResourceName (String resourceName)
+  {
+    resourceName_ = resourceName;
+  }
+  
+  public String getResourcePath()
+  {
+    return resourcePath_;
+  }
+  
+  public String getResourceLoaderId()
+  {
+    return resourceLoaderId_;
+  }
+
+}

Propchange: 
incubator/derby/code/trunk/java/client/org/apache/derby/client/am/GetResourceInputStreamAction.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: 
incubator/derby/code/trunk/java/client/org/apache/derby/client/am/GetSystemPropertiesAction.java
URL: 
http://svn.apache.org/viewcvs/incubator/derby/code/trunk/java/client/org/apache/derby/client/am/GetSystemPropertiesAction.java?rev=165178&view=auto
==============================================================================
--- 
incubator/derby/code/trunk/java/client/org/apache/derby/client/am/GetSystemPropertiesAction.java
 (added)
+++ 
incubator/derby/code/trunk/java/client/org/apache/derby/client/am/GetSystemPropertiesAction.java
 Thu Apr 28 12:05:42 2005
@@ -0,0 +1,57 @@
+/*
+
+   Derby - Class org.apache.derby.client.am.GetSystemPropertiesAction
+
+   Copyright (c) 2002, 2005 The Apache Software Foundation or its licensors, 
where applicable.
+
+   Licensed under the Apache License, Version 2.0 (the "License");
+   you may not use this file except in compliance with the License.
+   You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+
+*/
+
+package org.apache.derby.client.am;
+
+
+/**
+ * Java 2 PrivilegedAction encapsulation of System getProperties processing
+ */
+public class GetSystemPropertiesAction implements 
java.security.PrivilegedAction
+{
+  // System properties values, i.e. output from System.getProperties()
+  private java.util.Properties systemProperties_ = null;
+
+  //============================== Constructor ==============================
+
+  //-------------------- GetSystemPropertiesAction --------------------
+  /**
+   * Constructor.
+   */
+  public GetSystemPropertiesAction ()
+  {}
+
+  /**
+   * Performs the privileged action of System.getProperties()
+   */
+  public Object run()
+  {
+    this.systemProperties_ = System.getProperties();
+    return this.systemProperties_;
+  }
+
+  /**
+   * Accessor for system properties (used after run() method invocation)
+   */
+  public java.util.Properties getSystemProperties()
+  {
+    return this.systemProperties_;
+  }
+}

Propchange: 
incubator/derby/code/trunk/java/client/org/apache/derby/client/am/GetSystemPropertiesAction.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: 
incubator/derby/code/trunk/java/client/org/apache/derby/client/am/Lob.java
URL: 
http://svn.apache.org/viewcvs/incubator/derby/code/trunk/java/client/org/apache/derby/client/am/Lob.java?rev=165178&view=auto
==============================================================================
--- incubator/derby/code/trunk/java/client/org/apache/derby/client/am/Lob.java 
(added)
+++ incubator/derby/code/trunk/java/client/org/apache/derby/client/am/Lob.java 
Thu Apr 28 12:05:42 2005
@@ -0,0 +1,102 @@
+/*
+
+   Derby - Class org.apache.derby.client.am.Lob
+
+   Copyright (c) 2001, 2005 The Apache Software Foundation or its licensors, 
where applicable.
+
+   Licensed under the Apache License, Version 2.0 (the "License");
+   you may not use this file except in compliance with the License.
+   You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+
+*/
+
+package org.apache.derby.client.am;
+
+public abstract class Lob implements UnitOfWorkListener
+{
+  // The following flags specify the data type(s) a LOB instance currently 
contains
+  public static final int STRING = 2;
+  public static final int ASCII_STREAM = 4;
+  public static final int UNICODE_STREAM = 8;
+  public static final int CHARACTER_STREAM = 16;
+  public static final int BINARY_STREAM = 32;
+  public static final int BINARY_STRING = 64;
+
+  //---------------------navigational 
members-----------------------------------
+  protected Agent agent_;
+
+  
//-----------------------------state------------------------------------------
+  protected int dataType_ = 0;      // data type(s) the LOB instance currently 
contains
+
+  protected long sqlLength_;      // length of the LOB value, as defined by 
the server
+  protected boolean lengthObtained_;
+
+  
//---------------------constructors/finalizer---------------------------------
+  protected Lob (Agent agent)
+  {
+    agent_ = agent;
+    lengthObtained_ = false;
+  }
+
+  protected void finalize () throws java.lang.Throwable
+  {
+    super.finalize();
+  }
+
+  // ---------------------------jdbc 
2------------------------------------------
+
+  // should only be called by a synchronized method.
+
+
+  // should only be called by a synchronized method.
+  public long sqlLength () throws SqlException
+  {
+    checkForClosedConnection ();
+
+    return sqlLength_;
+  }
+
+
+  //-----------------------event callback 
methods-------------------------------
+
+  public void listenToUnitOfWork()
+  {
+    agent_.connection_.CommitAndRollbackListeners_.add (this);
+  }
+
+  public void completeLocalCommit (java.util.Iterator listenerIterator)
+  {
+    listenerIterator.remove();
+  }
+
+  public void completeLocalRollback (java.util.Iterator listenerIterator)
+  {
+    listenerIterator.remove();
+  }
+
+  //----------------------------helper 
methods----------------------------------
+
+  public Agent getAgent () { return agent_; }
+
+  void checkForClosedConnection () throws SqlException
+  {
+    if (agent_.connection_.isClosedX()) {
+      agent_.checkForDeferredExceptions();
+      throw new SqlException (agent_.logWriter_, "Lob method called after 
connection was closed");
+    }
+    else {
+      agent_.checkForDeferredExceptions();
+    }
+  }
+
+  void completeLocalRollback() { ; }
+  void completeLocalCommit() { ; }
+}

Propchange: 
incubator/derby/code/trunk/java/client/org/apache/derby/client/am/Lob.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: 
incubator/derby/code/trunk/java/client/org/apache/derby/client/am/LogWriter.java
URL: 
http://svn.apache.org/viewcvs/incubator/derby/code/trunk/java/client/org/apache/derby/client/am/LogWriter.java?rev=165178&view=auto
==============================================================================
--- 
incubator/derby/code/trunk/java/client/org/apache/derby/client/am/LogWriter.java
 (added)
+++ 
incubator/derby/code/trunk/java/client/org/apache/derby/client/am/LogWriter.java
 Thu Apr 28 12:05:42 2005
@@ -0,0 +1,1095 @@
+/*
+
+   Derby - Class org.apache.derby.client.am.LogWriter
+
+   Copyright (c) 2001, 2005 The Apache Software Foundation or its licensors, 
where applicable.
+
+   Licensed under the Apache License, Version 2.0 (the "License");
+   you may not use this file except in compliance with the License.
+   You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+
+*/
+
+package org.apache.derby.client.am;
+
+import org.apache.derby.jdbc.ClientDataSource;
+
+public class LogWriter
+{
+  protected java.io.PrintWriter printWriter_;
+  protected int traceLevel_;
+  private boolean driverConfigurationHasBeenWrittenToJdbc1Stream_ = false;
+  private boolean driverConfigurationHasBeenWrittenToJdbc2Stream_ = false;
+
+  // It is assumed that this constructor is never called when logWriter is 
null.
+  public LogWriter (java.io.PrintWriter printWriter, int traceLevel)
+  {
+    printWriter_ = printWriter;
+    traceLevel_ = traceLevel;
+  }
+
+  final protected boolean loggingEnabled (int traceLevel)
+  {
+    // It is an invariant that the printWriter is never null, so remove the
+    return printWriter_ != null && (traceLevel & traceLevel_) != 0;
+  }
+
+  final protected boolean traceSuspended () { return 
org.apache.derby.client.am.Configuration.traceSuspended__; }
+
+  // When garbage collector doesn't kick in in time
+  // to close file descriptors, "Too many open files"
+  // exception may occur (currently found on Linux).
+  // To minimize the chance of this problem happening,
+  // the print writer needs to be closed (after this
+  // DNC log writer is closed) when each connection has
+  // its own trace file (i.e. traceDirectory is specified).
+  public boolean printWriterNeedsToBeClosed_;
+
+  void close()
+  {
+    if (printWriterNeedsToBeClosed_) {
+      printWriter_.close();
+      printWriterNeedsToBeClosed_ = false;
+    }
+    // printWriter_ = null; // help GC.
+  }
+
+  // 
---------------------------------------------------------------------------
+
+  public void dncprintln (String s)
+  {
+    synchronized (printWriter_) {
+      printWriter_.println ("[derby] " + s);
+      printWriter_.flush();
+    }
+  }
+
+  private void dncprint (String s)
+  {
+    synchronized (printWriter_) {
+      printWriter_.print ("[derby] " + s);
+      printWriter_.flush();
+    }
+  }
+
+  private void dncprintln (String header, String s)
+  {
+    synchronized (printWriter_) {
+      printWriter_.println ("[derby]" + header + " " + s);
+      printWriter_.flush();
+    }
+  }
+
+  private void dncprint (String header, String s)
+  {
+    synchronized (printWriter_) {
+      printWriter_.print ("[derby]" + header + " " + s);
+      printWriter_.flush();
+    }
+  }
+
+  // ------------------------ tracepoint api 
-----------------------------------
+
+  public void tracepoint (String component, int tracepoint, String message)
+  {
+    if (traceSuspended()) return;
+    dncprintln (component,
+      "[time:" + System.currentTimeMillis() + "]" +
+      "[thread:" + Thread.currentThread().getName() + "]" +
+      "[tracepoint:" + tracepoint + "]" +
+      message);
+  }
+
+  public void tracepoint (String component, int tracepoint,
+                          String classContext, String methodContext)
+  {
+    if (traceSuspended()) return;
+    String staticContextTracepointRecord =
+      component +
+      "[time:" + System.currentTimeMillis() + "]" +
+      "[thread:" + Thread.currentThread().getName() + "]" +
+      "[tracepoint:" + tracepoint + "]" +
+      "[" + classContext + "." + methodContext + "]";
+    dncprintln (staticContextTracepointRecord);
+  }
+
+  public void tracepoint (String component, int tracepoint,
+                          Object instance, String classContext, String 
methodContext)
+  {
+    if (traceSuspended()) return;
+    String instanceContextTracepointRecord =
+      component +
+      "[time:" + System.currentTimeMillis() + "]" +
+      "[thread:" + Thread.currentThread().getName() + "]" +
+      "[tracepoint:" + tracepoint + "]" +
+      "[" + classContext + "@" + Integer.toHexString (instance.hashCode()) + 
"." + methodContext + "]";
+    dncprintln (instanceContextTracepointRecord);
+  }
+
+  public void tracepoint (String component, int tracepoint,
+                          String classContext, String methodContext,
+                          java.util.Map memory)
+  {
+    if (traceSuspended()) return;
+    String staticContextTracepointRecord =
+      component +
+      "[time:" + System.currentTimeMillis() + "]" +
+      "[thread:" + Thread.currentThread().getName() + "]" +
+      "[tracepoint:" + tracepoint + "]" +
+      "[" + classContext + "." + methodContext + "]";
+    dncprintln (staticContextTracepointRecord + getMemoryMapDisplay (memory));
+  }
+
+  public void tracepoint (String component, int tracepoint,
+                          Object instance, String classContext, String 
methodContext,
+                          java.util.Map memory)
+  {
+    if (traceSuspended()) return;
+    String instanceContextTracepointRecord =
+      component +
+      "[time:" + System.currentTimeMillis() + "]" +
+      "[thread:" + Thread.currentThread().getName() + "]" +
+      "[tracepoint:" + tracepoint + "]" +
+      "[" + classContext + "@" + Integer.toHexString (instance.hashCode()) + 
"." + methodContext + "]";
+    dncprintln (instanceContextTracepointRecord + getMemoryMapDisplay 
(memory));
+  }
+
+  private String getMemoryMapDisplay (java.util.Map memory)
+  {
+    return memory.toString(); // need to loop thru all keys in the map and 
print values
+  }
+
+  // ------------- API entry and exit trace methods 
----------------------------
+  // Entry and exit are be traced separately because input arguments need
+  // to be traced before any potential exception can occur.
+  // Exit tracing is only performed on methods that return values.
+  // Entry tracing is only performed on methods that update state,
+  // so entry tracing is not performed on simple getter methods.
+  // We could decide in the future to restrict entry tracing only to methods 
with input arguments.
+
+  private void traceExternalMethod (Object instance, String className, String 
methodName)
+  {
+    if (traceSuspended()) return;
+    dncprint (buildExternalMethodHeader (instance, className), methodName);
+  }
+
+  private void traceExternalDeprecatedMethod (Object instance, String 
className, String methodName)
+  {
+    if (traceSuspended()) return;
+    dncprint (buildExternalMethodHeader (instance, className), "Deprecated " + 
methodName);
+  }
+
+  private String buildExternalMethodHeader (Object instance, String className)
+  {
+    return
+      "[Time:" + System.currentTimeMillis() + "]" +
+      "[Thread:" + Thread.currentThread().getName() + "]" +
+      "[" + className + "@" + Integer.toHexString (instance.hashCode()) + "]";
+  }
+
+  private String getClassNameOfInstanceIfTraced (Object instance)
+  {
+    if (instance == null) // this prevents NPE from instance.getClass() used 
below
+      return null;
+    else if (instance instanceof Connection && loggingEnabled 
(ClientDataSource.TRACE_CONNECTION_CALLS))
+      return "Connection";
+    else if (instance instanceof ResultSet && loggingEnabled 
(ClientDataSource.TRACE_RESULT_SET_CALLS))
+      return "ResultSet";
+    else if (instance instanceof CallableStatement && loggingEnabled 
(ClientDataSource.TRACE_STATEMENT_CALLS))
+      return "CallableStatement";
+    else if (instance instanceof PreparedStatement && loggingEnabled 
(ClientDataSource.TRACE_STATEMENT_CALLS))
+      return "PreparedStatement";
+    else if (instance instanceof Statement && loggingEnabled 
(ClientDataSource.TRACE_STATEMENT_CALLS))
+      return "Statement";
+    // Not yet externalizing Blob tracing, except for trace_all
+    else if (instance instanceof Blob && loggingEnabled 
(ClientDataSource.TRACE_ALL)) // add a trace level for lobs !!
+      return "Blob";
+    // Not yet externalizing Clob tracing, except for trace_all
+    else if (instance instanceof Clob && loggingEnabled 
(ClientDataSource.TRACE_ALL)) // add a trace level for bobs !!
+      return "Clob";
+    // Not yet externalizing dbmd catalog call tracing, except for trace_all
+    else if (instance instanceof DatabaseMetaData && loggingEnabled 
(ClientDataSource.TRACE_ALL)) // add a trace level for dbmd ??
+      return "DatabaseMetaData";
+    // we don't use instanceof javax.transaction.XAResource to avoid 
dependency on j2ee.jar
+    else if (loggingEnabled (ClientDataSource.TRACE_XA_CALLS) &&
+             instance.getClass().getName().startsWith 
("org.apache.derby.client.net.NetXAResource"))
+      return "NetXAResource";
+    else if (loggingEnabled (ClientDataSource.TRACE_ALL) &&
+      
instance.getClass().getName().equals("org.apache.derby.client.ClientPooledConnection"))
+      return "ClientPooledConnection";
+    else if (loggingEnabled (ClientDataSource.TRACE_ALL) &&
+      
instance.getClass().getName().equals("org.apache.derby.jdbc.ClientConnectionPoolDataSource"))
+      return "ClientConnectionPoolDataSource";
+    else if (loggingEnabled (ClientDataSource.TRACE_ALL) &&
+      
instance.getClass().getName().equals("org.apache.derby.client.ClientXAConnection"))
+      return "ClientXAConnection";
+    else if (loggingEnabled (ClientDataSource.TRACE_ALL) &&
+      
instance.getClass().getName().equals("org.apache.derby.jdbc.ClientDataSource"))
+      return "ClientDataSource";
+    else if (loggingEnabled (ClientDataSource.TRACE_ALL) &&
+      
instance.getClass().getName().equals("org.apache.derby.jdbc.ClientXADataSource"))
+      return "ClientXADataSource";
+    else
+      return instance.getClass().getName();
+  }
+
+  // --------------------------- method exit tracing --------------------------
+
+  public void traceExit (Object instance, String methodName, Object 
returnValue)
+  {
+    if (traceSuspended()) return;
+    String className = getClassNameOfInstanceIfTraced (instance);
+    if (className == null) return;
+    synchronized (printWriter_) {
+      traceExternalMethod (instance, className, methodName);
+      printWriter_.println (" () returned " + returnValue);
+      printWriter_.flush();
+    }
+  }
+
+  public void traceDeprecatedExit (Object instance, String methodName, Object 
returnValue)
+  {
+    if (traceSuspended()) return;
+    String className = getClassNameOfInstanceIfTraced (instance);
+    if (className == null) return;
+    synchronized (printWriter_) {
+      traceExternalDeprecatedMethod (instance, className, methodName);
+      printWriter_.println (" () returned " + returnValue);
+      printWriter_.flush();
+    }
+  }
+
+  public void traceExit (Object instance, String methodName, ResultSet 
resultSet)
+  {
+    if (traceSuspended()) return;
+    String returnValue = (resultSet == null) ? "[EMAIL PROTECTED]" : 
"ResultSet@" + Integer.toHexString (resultSet.hashCode());
+    traceExit (instance, methodName, returnValue);
+  }
+
+  public void traceExit (Object instance, String methodName, CallableStatement 
returnValue)
+  {
+    if (traceSuspended()) return;
+    traceExit (instance, methodName, "CallableStatement@" + 
Integer.toHexString (returnValue.hashCode()));
+  }
+
+  public void traceExit (Object instance, String methodName, PreparedStatement 
returnValue)
+  {
+    if (traceSuspended()) return;
+    traceExit (instance, methodName, "PreparedStatement@" + 
Integer.toHexString (returnValue.hashCode()));
+  }
+
+  public void traceExit (Object instance, String methodName, Statement 
returnValue)
+  {
+    if (traceSuspended()) return;
+    traceExit (instance, methodName, "Statement@" + Integer.toHexString 
(returnValue.hashCode()));
+  }
+
+  public void traceExit (Object instance, String methodName, Blob blob)
+  {
+    if (traceSuspended()) return;
+    String returnValue = (blob == null) ? "[EMAIL PROTECTED]" : "Blob@" + 
Integer.toHexString (blob.hashCode());
+    traceExit (instance, methodName, returnValue);
+  }
+
+  public void traceExit (Object instance, String methodName, Clob clob)
+  {
+    if (traceSuspended()) return;
+    String returnValue = (clob == null) ? "[EMAIL PROTECTED]" : "Clob@" + 
Integer.toHexString (clob.hashCode());
+    traceExit (instance, methodName, returnValue);
+  }
+
+  public void traceExit (Object instance, String methodName, DatabaseMetaData 
returnValue)
+  {
+    if (traceSuspended()) return;
+    traceExit (instance, methodName, "DatabaseMetaData@" + Integer.toHexString 
(returnValue.hashCode()));
+  }
+
+  public void traceExit (Object instance, String methodName, Connection 
returnValue)
+  {
+    if (traceSuspended()) return;
+    traceExit (instance, methodName, "Connection@" + Integer.toHexString 
(returnValue.hashCode()));
+  }
+
+  public void traceExit (Object instance, String methodName, ColumnMetaData 
returnValue)
+  {
+    if (traceSuspended()) return;
+    traceExit (instance, methodName, "MetaData@" + (returnValue != null ? 
Integer.toHexString (returnValue.hashCode()) : null));
+  }
+
+  public void traceExit (Object instance, String methodName, byte[] 
returnValue)
+  {
+    if (traceSuspended()) return;
+    traceExit (instance, methodName, Utils.getStringFromBytes (returnValue));
+  }
+
+  public void traceExit (Object instance, String methodName, int[] returnValue)
+  {
+    if (traceSuspended()) return;
+    traceExit (instance, methodName, Utils.getStringFromInts (returnValue));
+  }
+
+  public void traceDeprecatedExit (Object instance, String methodName, byte[] 
returnValue)
+  {
+    if (traceSuspended()) return;
+    traceDeprecatedExit (instance, methodName, Utils.getStringFromBytes 
(returnValue));
+  }
+
+  public void traceExit (Object instance, String methodName, byte returnValue)
+  {
+    if (traceSuspended()) return;
+    traceExit (instance, methodName, "0x" + Integer.toHexString 
(returnValue&0xff));
+  }
+
+  public void traceExit (Object instance, String methodName, int returnValue)
+  {
+    if (traceSuspended()) return;
+    traceExit (instance, methodName, String.valueOf (returnValue));
+  }
+
+  public void traceExit (Object instance, String methodName, boolean 
returnValue)
+  {
+    if (traceSuspended()) return;
+    traceExit (instance, methodName, String.valueOf (returnValue));
+  }
+
+  public void traceExit (Object instance, String methodName, long returnValue)
+  {
+    if (traceSuspended()) return;
+    traceExit (instance, methodName, String.valueOf (returnValue));
+  }
+
+  public void traceExit (Object instance, String methodName, float returnValue)
+  {
+    if (traceSuspended()) return;
+    traceExit (instance, methodName, String.valueOf (returnValue));
+  }
+
+  public void traceExit (Object instance, String methodName, double 
returnValue)
+  {
+    if (traceSuspended()) return;
+    traceExit (instance, methodName, String.valueOf (returnValue));
+  }
+
+  // --------------------------- method entry tracing 
--------------------------
+
+  private void traceEntryAllArgs (Object instance, String methodName, String 
argList)
+  {
+    if (traceSuspended()) return;
+    String className = getClassNameOfInstanceIfTraced (instance);
+    if (className == null) return;
+    synchronized (printWriter_) {
+      traceExternalMethod (instance, className, methodName);
+      printWriter_.println (" " + argList + " called");
+      printWriter_.flush();
+    }
+  }
+
+  private void traceDeprecatedEntryAllArgs (Object instance, String 
methodName, String argList)
+  {
+    if (traceSuspended()) return;
+    String className = getClassNameOfInstanceIfTraced (instance);
+    if (className == null) return;
+    synchronized (printWriter_) {
+      traceExternalDeprecatedMethod (instance, className, methodName);
+      printWriter_.println (" " + argList + " called");
+      printWriter_.flush();
+    }
+  }
+
+  // ---------------------- trace entry of methods w/ no args 
------------------
+
+  public void traceEntry (Object instance, String methodName)
+  {
+    if (traceSuspended()) return;
+    traceEntryAllArgs (instance, methodName, "()");
+  }
+
+  // ---------------------- trace entry of methods w/ 1 arg 
--------------------
+
+  public void traceEntry (Object instance, String methodName, Object argument)
+  {
+    if (traceSuspended()) return;
+    traceEntryAllArgs (instance, methodName,
+      "(" + argument + ")");
+  }
+
+  public void traceEntry (Object instance, String methodName, boolean argument)
+  {
+    if (traceSuspended()) return;
+    traceEntryAllArgs (instance, methodName,
+      "(" + argument + ")");
+  }
+
+  public void traceEntry (Object instance, String methodName, int argument)
+  {
+    if (traceSuspended()) return;
+    traceEntryAllArgs (instance, methodName,
+      "(" + argument + ")");
+  }
+
+  public void traceDeprecatedEntry (Object instance, String methodName, int 
argument)
+  {
+    if (traceSuspended()) return;
+    traceDeprecatedEntryAllArgs (instance, methodName,
+      "(" + argument + ")");
+  }
+
+  public void traceDeprecatedEntry (Object instance, String methodName, Object 
argument)
+  {
+    if (traceSuspended()) return;
+    traceDeprecatedEntryAllArgs (instance, methodName,
+      "(" + argument + ")");
+  }
+
+  // ---------------------- trace entry of methods w/ 2 args 
-------------------
+
+  public void traceEntry (Object instance, String methodName, Object arg1, 
Object arg2)
+  {
+    if (traceSuspended()) return;
+    traceEntryAllArgs (instance, methodName,
+      "(" + arg1 + ", " + arg2 + ")");
+  }
+
+  public void traceEntry (Object instance, String methodName, int arg1, Object 
arg2)
+  {
+    if (traceSuspended()) return;
+    traceEntryAllArgs (instance, methodName,
+      "(" + arg1 + ", " + arg2 + ")");
+  }
+
+  public void traceEntry (Object instance, String methodName, int arg1, byte[] 
arg2)
+  {
+    if (traceSuspended()) return;
+    traceEntryAllArgs (instance, methodName,
+      "(" + arg1 + ", " + Utils.getStringFromBytes (arg2) + ")");
+  }
+
+  public void traceDeprecatedEntry (Object instance, String methodName, int 
arg1, int arg2)
+  {
+    if (traceSuspended()) return;
+    traceDeprecatedEntryAllArgs (instance, methodName,
+      "(" + arg1 + ", " + arg2 + ")");
+  }
+
+  public void traceDeprecatedEntry (Object instance, String methodName, Object 
arg1, int arg2)
+  {
+    if (traceSuspended()) return;
+    traceDeprecatedEntryAllArgs (instance, methodName,
+      "(" + arg1 + ", " + arg2 + ")");
+  }
+
+  public void traceEntry (Object instance, String methodName, int arg1, 
boolean arg2)
+  {
+    if (traceSuspended()) return;
+    traceEntryAllArgs (instance, methodName,
+      "(" + arg1 + ", " + arg2 + ")");
+  }
+
+  public void traceEntry (Object instance, String methodName, int arg1, byte 
arg2)
+  {
+    if (traceSuspended()) return;
+    traceEntryAllArgs (instance, methodName,
+      "(" + arg1 + ", 0x" + Integer.toHexString (arg2&0xff) + ")");
+  }
+
+  public void traceEntry (Object instance, String methodName, int arg1, short 
arg2)
+  {
+    if (traceSuspended()) return;
+    traceEntryAllArgs (instance, methodName,
+      "(" + arg1 + ", " + arg2 + ")");
+  }
+
+  public void traceEntry (Object instance, String methodName, int arg1, int 
arg2)
+  {
+    if (traceSuspended()) return;
+    traceEntryAllArgs (instance, methodName,
+      "(" + arg1 + ", " + arg2 + ")");
+  }
+
+  public void traceEntry (Object instance, String methodName, int arg1, long 
arg2)
+  {
+    if (traceSuspended()) return;
+    traceEntryAllArgs (instance, methodName,
+      "(" + arg1 + ", " + arg2 + ")");
+  }
+
+  public void traceEntry (Object instance, String methodName, int arg1, float 
arg2)
+  {
+    if (traceSuspended()) return;
+    traceEntryAllArgs (instance, methodName,
+      "(" + arg1 + ", " + arg2 + ")");
+  }
+
+  public void traceEntry (Object instance, String methodName, int arg1, double 
arg2)
+  {
+    if (traceSuspended()) return;
+    traceEntryAllArgs (instance, methodName,
+      "(" + arg1 + ", " + arg2 + ")");
+  }
+
+  public void traceEntry (Object instance, String methodName, Object arg1, 
boolean arg2)
+  {
+    if (traceSuspended()) return;
+    traceEntryAllArgs (instance, methodName,
+      "(" + arg1 + ", " + arg2 + ")");
+  }
+
+  public void traceEntry (Object instance, String methodName, Object arg1, 
byte arg2)
+  {
+    if (traceSuspended()) return;
+    traceEntryAllArgs (instance, methodName,
+      "(" + arg1 + ", 0x" + Integer.toHexString (arg2&0xff) + ")");
+  }
+
+  public void traceEntry (Object instance, String methodName, Object arg1, 
short arg2)
+  {
+    if (traceSuspended()) return;
+    traceEntryAllArgs (instance, methodName,
+      "(" + arg1 + ", " + arg2 + ")");
+  }
+
+  public void traceEntry (Object instance, String methodName, Object arg1, int 
arg2)
+  {
+    if (traceSuspended()) return;
+    traceEntryAllArgs (instance, methodName,
+      "(" + arg1 + ", " + arg2 + ")");
+  }
+
+  public void traceEntry (Object instance, String methodName, Object arg1, 
long arg2)
+  {
+    if (traceSuspended()) return;
+    traceEntryAllArgs (instance, methodName,
+      "(" + arg1 + ", " + arg2 + ")");
+  }
+
+  public void traceEntry (Object instance, String methodName, Object arg1, 
float arg2)
+  {
+    if (traceSuspended()) return;
+    traceEntryAllArgs (instance, methodName,
+      "(" + arg1 + ", " + arg2 + ")");
+  }
+
+  public void traceEntry (Object instance, String methodName, Object arg1, 
double arg2)
+  {
+    if (traceSuspended()) return;
+    traceEntryAllArgs (instance, methodName,
+      "(" + arg1 + ", " + arg2 + ")");
+  }
+
+  // ---------------------- trace entry of methods w/ 3 args 
-------------------
+
+  public void traceEntry (Object instance, String methodName,
+                          Object arg1, Object arg2, Object arg3)
+  {
+    if (traceSuspended()) return;
+    traceEntryAllArgs (instance, methodName,
+      "(" + arg1 + ", " + arg2 + ", " + arg3 + ")");
+  }
+
+  public void traceEntry (Object instance, String methodName,
+                          int arg1, Object arg2, Object arg3)
+  {
+    if (traceSuspended()) return;
+    traceEntryAllArgs (instance, methodName,
+      "(" + arg1 + ", " + arg2 + ", " + arg3 + ")");
+  }
+
+  public void traceEntry (Object instance, String methodName,
+                     Object arg1, Object arg2, int arg3)
+  {
+    if (traceSuspended()) return;
+    traceEntryAllArgs (instance, methodName,
+      "(" + arg1 + ", " + arg2 + ", " + arg3 + ")");
+  }
+
+  public void traceEntry (Object instance, String methodName,
+                     int arg1, Object arg2, int arg3)
+  {
+    if (traceSuspended()) return;
+    traceEntryAllArgs (instance, methodName,
+      "(" + arg1 + ", " + arg2 + ", " + arg3 + ")");
+  }
+
+  public void traceDeprecatedEntry (Object instance, String methodName,
+                     int arg1, Object arg2, int arg3)
+  {
+    if (traceSuspended()) return;
+    traceEntryAllArgs (instance, methodName,
+      "(" + arg1 + ", " + arg2 + ", " + arg3 + ")");
+  }
+
+  public void traceEntry (Object instance, String methodName,
+                     int arg1, int arg2, Object arg3)
+  {
+    if (traceSuspended()) return;
+    traceEntryAllArgs (instance, methodName,
+      "(" + arg1 + ", " + arg2 + ", " + arg3 + ")");
+  }
+
+  public void traceEntry (Object instance, String methodName,
+                     int arg1, int arg2, int arg3)
+  {
+    if (traceSuspended()) return;
+    traceEntryAllArgs (instance, methodName,
+      "(" + arg1 + ", " + arg2 + ", " + arg3 + ")");
+  }
+
+  public void traceEntry (Object instance, String methodName,
+                     Object arg1, int arg2, int arg3)
+  {
+    if (traceSuspended()) return;
+    traceEntryAllArgs (instance, methodName,
+      "(" + arg1 + ", " + arg2 + ", " + arg3 + ")");
+  }
+
+  public void traceEntry (Object instance, String methodName,
+                     Object arg1, int arg2, Object arg3)
+  {
+    if (traceSuspended()) return;
+    traceEntryAllArgs (instance, methodName,
+      "(" + arg1 + ", " + arg2 + ", " + arg3 + ")");
+  }
+
+  public void traceEntry (Object instance, String methodName,
+                     Object arg1, boolean arg2, boolean arg3)
+  {
+    if (traceSuspended()) return;
+    traceEntryAllArgs (instance, methodName,
+      "(" + arg1 + ", " + arg2 + ", " + arg3 + ")");
+  }
+
+  public void traceEntry (Object instance, String methodName,
+                     Object arg1, boolean arg2, int arg3)
+  {
+    if (traceSuspended()) return;
+    traceEntryAllArgs (instance, methodName,
+      "(" + arg1 + ", " + arg2 + ", " + arg3 + ")");
+  }
+
+  // ---------------------- trace entry of methods w/ 4 args 
-------------------
+
+  public void traceEntry (Object instance, String methodName,
+                     Object arg1, Object arg2, Object arg3, Object arg4)
+  {
+    if (traceSuspended()) return;
+    traceEntryAllArgs (instance, methodName,
+      "(" + arg1 + ", " + arg2 + ", " + arg3 + ", " + arg4 + ")");
+  }
+
+  public void traceEntry (Object instance, String methodName,
+                     int arg1, Object arg2, Object arg3, Object arg4)
+  {
+    if (traceSuspended()) return;
+    traceEntryAllArgs (instance, methodName,
+      "(" + arg1 + ", " + arg2 + ", " + arg3 + ", " + arg4 + ")");
+  }
+
+  public void traceEntry (Object instance, String methodName,
+                     int arg1, Object arg2, int arg3, int arg4)
+  {
+    if (traceSuspended()) return;
+    traceEntryAllArgs (instance, methodName,
+      "(" + arg1 + ", " + arg2 + ", " + arg3 + ", " + arg4 + ")");
+  }
+
+  public void traceEntry (Object instance, String methodName,
+                     Object arg1, int arg2, int arg3, int arg4)
+  {
+    if (traceSuspended()) return;
+    traceEntryAllArgs (instance, methodName,
+      "(" + arg1 + ", " + arg2 + ", " + arg3 + ", " + arg4 + ")");
+  }
+
+  public void traceEntry (Object instance, String methodName,
+                     Object arg1, Object arg2, int arg3, int arg4)
+  {
+    if (traceSuspended()) return;
+    traceEntryAllArgs (instance, methodName,
+      "(" + arg1 + ", " + arg2 + ", " + arg3 + ", " + arg4 + ")");
+  }
+
+  // ---------------------- trace entry of methods w/ 5 args 
-------------------
+
+  public void traceEntry (Object instance, String methodName,
+                     Object arg1, Object arg2, Object arg3, int arg4, boolean 
arg5)
+  {
+    if (traceSuspended()) return;
+    traceEntryAllArgs (instance, methodName,
+      "(" + arg1 + ", " + arg2 + ", " + arg3 + ", " + arg4 + ", " + arg5 + 
")");
+  }
+
+  public void traceEntry (Object instance, String methodName,
+                     Object arg1, Object arg2, Object arg3, boolean arg4, 
boolean arg5)
+  {
+    if (traceSuspended()) return;
+    traceEntryAllArgs (instance, methodName,
+      "(" + arg1 + ", " + arg2 + ", " + arg3 + ", " + arg4 + ", " + arg5 + 
")");
+  }
+
+  // ---------------------- trace entry of methods w/ 6 args 
-------------------
+
+  public void traceEntry (Object instance, String methodName,
+                     Object arg1, Object arg2, Object arg3, Object arg4, 
Object arg5, Object arg6)
+  {
+    if (traceSuspended()) return;
+    traceEntryAllArgs (instance, methodName,
+      "(" + arg1 + ", " + arg2 + ", " + arg3 + ", " + arg4 + ", " + arg5 + ", 
" + arg6 + ")");
+  }
+
+  // ---------------------------tracing exceptions and 
warnings-----------------
+
+  public void traceDiagnosable (java.sql.SQLException e)
+  {
+    if (traceSuspended()) return;
+    if (!loggingEnabled (ClientDataSource.TRACE_DIAGNOSTICS)) return;
+    synchronized (printWriter_) {
+      dncprintln ("BEGIN TRACE_DIAGNOSTICS");
+      ExceptionFormatter.printTrace (e, printWriter_, "[derby]", true); // 
true means return tokens only
+      dncprintln ("END TRACE_DIAGNOSTICS");
+    }
+  }
+
+  public void traceDiagnosable (javax.transaction.xa.XAException e)
+  {
+    if (traceSuspended()) return;
+    if (!loggingEnabled (ClientDataSource.TRACE_DIAGNOSTICS)) return;
+    synchronized (printWriter_) {
+      dncprintln ("BEGIN TRACE_DIAGNOSTICS");
+      ExceptionFormatter.printTrace (e, printWriter_, "[derby]");
+      dncprintln ("END TRACE_DIAGNOSTICS");
+    }
+  }
+  // ------------------------ meta data tracing 
--------------------------------
+
+  public void traceParameterMetaData (Statement statement, ColumnMetaData 
columnMetaData)
+  {
+    if (traceSuspended()) return;
+    if (!loggingEnabled (ClientDataSource.TRACE_PARAMETER_META_DATA) || 
columnMetaData == null) return;
+    synchronized (printWriter_) {
+      String header = "[ParameterMetaData@" + Integer.toHexString 
(columnMetaData.hashCode()) + "]";
+      try {
+        dncprintln (header, "BEGIN TRACE_PARAMETER_META_DATA");
+        dncprintln (header, "Parameter meta data for statement Statement@" + 
Integer.toHexString (statement.hashCode()));
+        dncprintln (header, "Number of parameter columns: " + 
columnMetaData.getColumnCount());
+        traceColumnMetaData (header, columnMetaData);
+        dncprintln (header, "END TRACE_PARAMETER_META_DATA");
+      }
+      catch (SqlException e) {
+        dncprintln (header, "Encountered an SQL exception while trying to 
trace parameter meta data");
+        dncprintln (header, "END TRACE_PARAMETER_META_DATA");
+      }
+    }
+  }
+
+  public void traceResultSetMetaData (Statement statement, ColumnMetaData 
columnMetaData)
+  {
+    if (traceSuspended()) return;
+    if (!loggingEnabled (ClientDataSource.TRACE_RESULT_SET_META_DATA) || 
columnMetaData == null) return;
+    synchronized (printWriter_) {
+    String header = "[ResultSetMetaData@" + Integer.toHexString 
(columnMetaData.hashCode()) + "]";
+      try {
+        dncprintln (header, "BEGIN TRACE_RESULT_SET_META_DATA");
+        dncprintln (header, "Result set meta data for statement Statement@" + 
Integer.toHexString (statement.hashCode()));
+        dncprintln (header, "Number of result set columns: " + 
columnMetaData.getColumnCount());
+        traceColumnMetaData (header, columnMetaData);
+        dncprintln (header, "END TRACE_RESULT_SET_META_DATA");
+      }
+      catch (SqlException e) {
+        dncprintln (header, "Encountered an SQL exception while trying to 
trace result set meta data");
+        dncprintln (header, "END TRACE_RESULT_SET_META_DATA");
+      }
+    }
+  }
+
+  //-----------------------------transient 
state--------------------------------
+
+  private void traceColumnMetaData (String header, ColumnMetaData 
columnMetaData)
+  {
+    if (traceSuspended()) return;
+    try {
+      synchronized (printWriter_) {
+
+        for (int column = 1; column <= columnMetaData.getColumnCount(); 
column++) {
+          dncprint (header, "Column " + column + ": { ");
+          printWriter_.print ("label=" + columnMetaData.getColumnLabel 
(column) + ", ");
+          printWriter_.print ("name=" + columnMetaData.getColumnName (column) 
+ ", ");
+          printWriter_.print ("type name=" + columnMetaData.getColumnTypeName 
(column) + ", ");
+          printWriter_.print ("type=" + columnMetaData.getColumnType (column) 
+ ", ");
+          printWriter_.print ("nullable=" + columnMetaData.isNullable (column) 
+ ", ");
+          printWriter_.print ("precision=" + columnMetaData.getPrecision 
(column) + ", ");
+          printWriter_.print ("scale=" + columnMetaData.getScale (column) + ", 
");
+          printWriter_.print ("schema name=" + columnMetaData.getSchemaName 
(column) + ", ");
+          printWriter_.print ("table name=" + columnMetaData.getTableName 
(column) + ", ");
+          printWriter_.print ("writable=" + columnMetaData.isWritable (column) 
+ ", ");
+          printWriter_.print ("sqlPrecision=" + (columnMetaData.sqlPrecision_ 
== null ? "<null>" : ""+columnMetaData.sqlPrecision_[column-1]) + ", ");
+          printWriter_.print ("sqlScale=" + (columnMetaData.sqlScale_ == null 
? "<null>" : ""+columnMetaData.sqlScale_[column-1]) + ", ");
+          printWriter_.print ("sqlLength=" + (columnMetaData.sqlLength_ == 
null ? "<null>" : ""+columnMetaData.sqlLength_[column-1]) + ", ");
+          printWriter_.print ("sqlType=" + (columnMetaData.sqlType_ == null ? 
"<null>" : ""+columnMetaData.sqlType_[column-1]) + ", ");
+          printWriter_.print ("sqlCcsid=" + (columnMetaData.sqlCcsid_ == null 
? "<null>" : ""+columnMetaData.sqlCcsid_[column-1]) + ", ");
+          printWriter_.print ("sqlName=" + (columnMetaData.sqlName_ == null ? 
"<null>" : columnMetaData.sqlName_[column-1]) + ", ");
+          printWriter_.print ("sqlLabel=" + (columnMetaData.sqlLabel_ == null 
? "<null>" : columnMetaData.sqlLabel_[column-1]) + ", ");
+          printWriter_.print ("sqlUnnamed=" + (columnMetaData.sqlUnnamed_ == 
null ? "<null>" : ""+columnMetaData.sqlUnnamed_[column-1]) + ", ");
+          printWriter_.print ("sqlComment=" + (columnMetaData.sqlComment_ == 
null ? "<null>" : columnMetaData.sqlComment_[column-1]) + ", ");
+          printWriter_.print ("sqlxKeymem=" + (columnMetaData.sqlxKeymem_ == 
null ? "<null>" : ""+columnMetaData.sqlxKeymem_[column-1]) + ", ");
+          printWriter_.print ("sqlxGenerated=" + 
(columnMetaData.sqlxGenerated_ == null ? "<null>" : 
""+columnMetaData.sqlxGenerated_[column-1]) + ", ");
+          printWriter_.print ("sqlxParmmode=" + (columnMetaData.sqlxParmmode_ 
== null ? "<null>" : ""+columnMetaData.sqlxParmmode_[column-1]) + ", ");
+          printWriter_.print ("sqlxCorname=" + (columnMetaData.sqlxCorname_ == 
null ? "<null>" : columnMetaData.sqlxCorname_[column-1]) + ", ");
+          printWriter_.print ("sqlxName=" + (columnMetaData.sqlxName_ == null 
? "<null>" : columnMetaData.sqlxName_[column-1]) + ", ");
+          printWriter_.print ("sqlxBasename=" + (columnMetaData.sqlxBasename_ 
== null ? "<null>" : columnMetaData.sqlxBasename_[column-1]) + ", ");
+          printWriter_.print ("sqlxUpdatable=" + 
(columnMetaData.sqlxUpdatable_ == null ? "<null>" : 
""+columnMetaData.sqlxUpdatable_[column-1]) + ", ");
+          printWriter_.print ("sqlxSchema=" + (columnMetaData.sqlxSchema_ == 
null ? "<null>" : columnMetaData.sqlxSchema_[column-1]) + ", ");
+          printWriter_.print ("sqlxRdbnam=" + (columnMetaData.sqlxRdbnam_ == 
null ? "<null>" : columnMetaData.sqlxRdbnam_[column-1]) + ", ");
+          printWriter_.print ("internal type=" + 
columnMetaData.types_[column-1] + ", ");
+          printWriter_.println (" }");
+        }
+        dncprint (header, "{ ");
+        printWriter_.print ("sqldHold=" + columnMetaData.sqldHold_ + ", ");
+        printWriter_.print ("sqldReturn=" + columnMetaData.sqldReturn_ + ", ");
+        printWriter_.print ("sqldScroll=" + columnMetaData.sqldScroll_ + ", ");
+        printWriter_.print ("sqldSensitive=" + columnMetaData.sqldSensitive_ + 
", ");
+        printWriter_.print ("sqldFcode=" + columnMetaData.sqldFcode_ + ", ");
+        printWriter_.print ("sqldKeytype=" + columnMetaData.sqldKeytype_ + ", 
");
+        printWriter_.print ("sqldRdbnam=" + columnMetaData.sqldRdbnam_ + ", ");
+        printWriter_.print ("sqldSchema=" + columnMetaData.sqldSchema_);
+        printWriter_.println (" }");
+        printWriter_.flush();
+      }
+    }
+    catch (SqlException e) {
+      dncprintln (header, "Encountered an SQL exception while trying to trace 
column meta data");
+    }
+  }
+
+  // ---------------------- 3-way tracing connects 
-----------------------------
+  // Including protocol manager levels, and driver configuration
+
+  // Jdbc 2
+  public void traceConnectEntry (ClientDataSource dataSource)
+  {
+    if (traceSuspended()) return;
+    if (loggingEnabled (ClientDataSource.TRACE_DRIVER_CONFIGURATION))
+      traceDriverConfigurationJdbc2 ();
+    if (loggingEnabled (ClientDataSource.TRACE_CONNECTS))
+      traceConnectsEntry (dataSource);
+  }
+
+  // Jdbc 1
+  public void traceConnectEntry ( String server,
+                                   int port,
+                                   String database,
+                                   java.util.Properties properties)
+  {
+    if (traceSuspended()) return;
+    if (loggingEnabled (ClientDataSource.TRACE_DRIVER_CONFIGURATION))
+      traceDriverConfigurationJdbc1 ();
+    if (loggingEnabled (ClientDataSource.TRACE_CONNECTS))
+      traceConnectsEntry (server, port, database, properties);
+  }
+
+  public void traceConnectResetEntry (Object instance, LogWriter logWriter, 
String user, ClientDataSource ds)
+  {
+    if (traceSuspended()) return;
+    traceEntry (instance, "reset", logWriter, user, "<escaped>", ds);
+    if (loggingEnabled(ClientDataSource.TRACE_CONNECTS))
+      traceConnectsResetEntry(ds);
+  }
+
+  public void traceConnectExit (Connection connection)
+  {
+    if (traceSuspended()) return;
+    if (loggingEnabled (ClientDataSource.TRACE_CONNECTS))
+      traceConnectsExit (connection);
+  }
+
+  public void traceConnectResetExit (Connection connection)
+  {
+    if (traceSuspended()) return;
+    if (loggingEnabled (ClientDataSource.TRACE_CONNECTS))
+      traceConnectsResetExit (connection);
+  }
+
+
+  // ---------------------- tracing connects 
-----------------------------------
+
+  private void traceConnectsResetEntry (ClientDataSource dataSource)
+  {
+    if (traceSuspended()) return;
+    try {
+      traceConnectsResetEntry (dataSource.getServerName(),
+                               dataSource.getPortNumber(),
+                               dataSource.getDatabaseName(),
+                               dataSource.getProperties());
+    }
+    catch (java.sql.SQLException e) {
+      dncprintln ("Encountered an SQL exception while trying to trace 
connection reset entry");
+    }
+  }
+
+  private void traceConnectsEntry (ClientDataSource dataSource)
+  {
+    if (traceSuspended()) return;
+    try {
+      traceConnectsEntry (dataSource.getServerName(),
+                          dataSource.getPortNumber(),
+                          dataSource.getDatabaseName(),
+                          dataSource.getProperties());
+    }
+    catch (java.sql.SQLException e) {
+      dncprintln ("Encountered an SQL exception while trying to trace 
connection entry");
+    }
+  }
+
+  private void traceConnectsResetEntry (String server,
+                                        int port,
+                                        String database,
+                                        java.util.Properties properties)
+  {
+    if (traceSuspended()) return;
+    dncprintln ("BEGIN TRACE_CONNECT_RESET");
+    dncprintln ("Connection reset requested for " + server + ":" + port + "/" 
+ database);
+    dncprint ("Using properties: ");
+    writeProperties (properties);
+    dncprintln ("END TRACE_CONNECT_RESET");
+  }
+
+  private void traceConnectsEntry (String server,
+                                   int port,
+                                   String database,
+                                   java.util.Properties properties)
+  {
+    if (traceSuspended()) return;
+    synchronized (printWriter_) {
+      dncprintln ("BEGIN TRACE_CONNECTS");
+      dncprintln ("Attempting connection to " + server + ":" + port + "/" + 
database);
+      dncprint ("Using properties: ");
+      writeProperties (properties);
+      dncprintln ("END TRACE_CONNECTS");
+    }
+  }
+
+  // Specialized by NetLogWriter.traceConnectsExit()
+  public void traceConnectsExit (Connection c)
+  {
+    if (traceSuspended()) return;
+    synchronized (printWriter_) {
+      String header = "[Connection@" + Integer.toHexString (c.hashCode()) + 
"]";
+      try {
+        dncprintln (header, "BEGIN TRACE_CONNECTS");
+        dncprintln (header, "Successfully connected to server " + 
c.databaseMetaData_.getURL());
+        dncprintln (header, "User: " + c.databaseMetaData_.getUserName());
+        dncprintln (header, "Database product name: " + 
c.databaseMetaData_.getDatabaseProductName());
+        dncprintln (header, "Database product version: " + 
c.databaseMetaData_.getDatabaseProductVersion());
+        dncprintln (header, "Driver name: " + 
c.databaseMetaData_.getDriverName());
+        dncprintln (header, "Driver version: " + 
c.databaseMetaData_.getDriverVersion());
+        dncprintln (header, "END TRACE_CONNECTS");
+      }
+      catch (java.sql.SQLException e) {
+        dncprintln (header, "Encountered an SQL exception while trying to 
trace connection exit");
+        dncprintln (header, "END TRACE_CONNECTS");
+      }
+    }
+  }
+
+  public void traceConnectsResetExit (org.apache.derby.client.am.Connection c)
+  {
+    if (traceSuspended()) return;
+    synchronized (printWriter_) {
+      String header = "[Connection@" + Integer.toHexString (c.hashCode()) + 
"]";
+      try {
+        dncprintln (header, "BEGIN TRACE_CONNECT_RESET");
+        dncprintln (header, "Successfully reset connection to server " + 
c.databaseMetaData_.getURL());
+        dncprintln (header, "User: " + c.databaseMetaData_.getUserName());
+        dncprintln (header, "Database product name: " + 
c.databaseMetaData_.getDatabaseProductName());
+        dncprintln (header, "Database product version: " + 
c.databaseMetaData_.getDatabaseProductVersion());
+        dncprintln (header, "Driver name: " + 
c.databaseMetaData_.getDriverName());
+        dncprintln (header, "Driver version: " + 
c.databaseMetaData_.getDriverVersion());
+        dncprintln (header, "END TRACE_CONNECT_RESET");
+      }
+      catch (java.sql.SQLException e) {
+        dncprintln (header, "Encountered an SQL exception while trying to 
trace connection reset exit");
+        dncprintln (header, "END TRACE_CONNECT_RESET");
+      }
+    }
+  }
+
+
+  // properties.toString() will print out passwords,
+  // so this method was written to escape the password property value.
+  // printWriter_ synchronized by caller.
+  private void writeProperties (java.util.Properties properties)
+  {
+    printWriter_.print ("{ ");
+    for (java.util.Iterator i = properties.entrySet().iterator(); i.hasNext(); 
) {
+      java.util.Map.Entry e = (java.util.Map.Entry) (i.next());
+      if ("password".equals(e.getKey())){
+        printWriter_.print ("password=" + 
escapePassword((String)e.getValue()));
+      }
+      else
+        printWriter_.print (e.getKey() + "=" + e.getValue());
+      if (i.hasNext())
+        printWriter_.print (", ");
+    }
+    printWriter_.println (" }");
+    printWriter_.flush();
+  }
+
+  private String escapePassword(String pw) {
+    StringBuffer sb = new StringBuffer (pw);
+    for (int j = 0; j< pw.length(); j++) {
+      sb.setCharAt(j,'*');
+    }
+    return sb.toString();
+  }
+  //-------------------------tracing driver 
configuration-----------------------
+
+  private void traceDriverConfigurationJdbc2 ()
+  {
+    if (traceSuspended()) return;
+    synchronized (printWriter_) {
+      if (!driverConfigurationHasBeenWrittenToJdbc2Stream_) {
+        writeDriverConfiguration();
+        driverConfigurationHasBeenWrittenToJdbc2Stream_ = true;
+      }
+    }
+  }
+
+  private void traceDriverConfigurationJdbc1 ()
+  {
+    if (traceSuspended()) return;
+    synchronized (printWriter_) {
+      if (!driverConfigurationHasBeenWrittenToJdbc1Stream_) {
+        writeDriverConfiguration();
+        driverConfigurationHasBeenWrittenToJdbc1Stream_ = true;
+      }
+    }
+  }
+
+  public void writeDriverConfiguration()
+  {
+    org.apache.derby.client.am.Version.writeDriverConfiguration (printWriter_);
+  }
+  public static java.io.PrintWriter getPrintWriter (String fileName, boolean 
fileAppend) throws SqlException
+  {
+    try {
+      java.io.PrintWriter printWriter = null;
+      String fileCanonicalPath = new java.io.File 
(fileName).getCanonicalPath();
+      printWriter =
+        new java.io.PrintWriter (
+          new java.io.BufferedOutputStream (
+            new java.io.FileOutputStream (fileCanonicalPath, fileAppend), 
4096), true);
+      return printWriter;
+    }
+    catch (java.io.IOException e) {
+      throw new SqlException (null, "Unable to open file " + fileName);
+    }
+  }
+
+}

Propchange: 
incubator/derby/code/trunk/java/client/org/apache/derby/client/am/LogWriter.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: 
incubator/derby/code/trunk/java/client/org/apache/derby/client/am/LogicalConnection.java
URL: 
http://svn.apache.org/viewcvs/incubator/derby/code/trunk/java/client/org/apache/derby/client/am/LogicalConnection.java?rev=165178&view=auto
==============================================================================
--- 
incubator/derby/code/trunk/java/client/org/apache/derby/client/am/LogicalConnection.java
 (added)
+++ 
incubator/derby/code/trunk/java/client/org/apache/derby/client/am/LogicalConnection.java
 Thu Apr 28 12:05:42 2005
@@ -0,0 +1,348 @@
+/*
+
+   Derby - Class org.apache.derby.client.am.LogicalConnection
+
+   Copyright (c) 2001, 2005 The Apache Software Foundation or its licensors, 
where applicable.
+
+   Licensed under the Apache License, Version 2.0 (the "License");
+   you may not use this file except in compliance with the License.
+   You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+
+*/
+
+package org.apache.derby.client.am;
+
+
+// A simple delegation wrapper handle for a physical connection.
+// All methods are forwarded to the underlying physical connection except for 
close() and isClosed().
+// When a physical connection is wrapped, it is non-null, when the logical 
connection
+// is closed, the wrapped physical connection is always set to null.
+// Both the finalizer and close() methods will always set the physical 
connection to null.
+// After the physical conneciton is set to null,
+// only the Pooled Connection instance will maintain a handle to the physical 
connection.
+public class LogicalConnection implements java.sql.Connection
+{
+  private Connection physicalConnection_ = null; // reset to null when the 
logical connection is closed.
+  private org.apache.derby.client.ClientPooledConnection pooledConnection_ = 
null;
+
+  public LogicalConnection (Connection physicalConnection,
+                            org.apache.derby.client.ClientPooledConnection 
pooledConnection) throws SqlException
+  {
+    physicalConnection_ = physicalConnection;
+    pooledConnection_ = pooledConnection;
+    checkForNullPhysicalConnection();
+  }
+
+  protected void finalize () throws java.lang.Throwable
+  {
+    close();
+  }
+
+  // Used by ClientPooledConnection close when it disassociates itself from 
the LogicalConnection
+  synchronized public void nullPhysicalConnection ()
+  {
+    physicalConnection_ = null;
+  }
+
+  // ------------------------ logical connection close 
-------------------------
+  // All methods are simply forwarded to the physical connection, except for 
close() and isClosed().
+
+  synchronized public void close () throws SqlException
+  {
+    // we also need to loop thru all the logicalStatements and close them
+    if (physicalConnection_ == null) return;
+    if (physicalConnection_.agent_.loggingEnabled())
+      physicalConnection_.agent_.logWriter_.traceEntry (this, "close");
+
+      if (physicalConnection_.isClosed()) // connection is closed or has 
become stale
+        pooledConnection_.trashConnection (new SqlException (null, "Connection 
is stale."));
+
+      else {
+      physicalConnection_.closeForReuse();
+      if ( ! physicalConnection_.isGlobalPending_() )
+        pooledConnection_.recycleConnection();
+      }
+      physicalConnection_ = null;
+    pooledConnection_.nullLogicalConnection();
+  }
+
+  synchronized public void closeWithoutRecyclingToPool () throws SqlException
+  {
+    if (physicalConnection_ == null) return;
+    physicalConnection_.checkForTransactionInProgress();
+    try {
+      if (physicalConnection_.isClosed()) // connection is closed or has 
become stale
+        throw new SqlException (null, "Connection is stale."); // no call to 
trashConnection()
+      else {
+        ; // no call to recycleConnection()
+      }
+    }
+    finally {
+      physicalConnection_.closeForReuse();  //poolfix
+      physicalConnection_ = null;
+    }
+  }
+
+  public boolean isClosed () throws SqlException
+  {
+    if (physicalConnection_ == null) return true;
+    return physicalConnection_.isClosed();
+  }
+
+  // --------------------------- helper methods 
--------------------------------
+
+  // this method doesn't wrap in the standard way, because it went out without 
a throws clause.
+  // Unlike all other LogicalConnection methods, if the physical connection is 
null, it won't throw an exception, but will return false.
+
+  private void checkForNullPhysicalConnection () throws SqlException
+  {
+    if (physicalConnection_ == null)
+      throw new SqlException (null, " Attempt to use a closed connection. ");
+  }
+
+  // ---------------------- wrapped public entry points 
------------------------
+  // All methods are forwarded to the physical connection in a standard way
+
+  synchronized public java.sql.Statement createStatement () throws SqlException
+  {
+    checkForNullPhysicalConnection();
+    return physicalConnection_.createStatement();
+  }
+
+  synchronized public java.sql.PreparedStatement prepareStatement (String sql) 
throws SqlException
+  {
+    checkForNullPhysicalConnection();
+    return physicalConnection_.prepareStatement(sql);
+  }
+
+  synchronized public PreparedStatement preparePositionedUpdateStatement 
(String sql, Section querySection) throws SqlException
+  {
+    checkForNullPhysicalConnection();
+    return physicalConnection_.preparePositionedUpdateStatement (sql, 
querySection);
+  }
+
+  synchronized public java.sql.CallableStatement prepareCall (String sql) 
throws SqlException
+  {
+    checkForNullPhysicalConnection();
+    return physicalConnection_.prepareCall(sql);
+  }
+
+  public String nativeSQL (String sql) throws SqlException
+  {
+    checkForNullPhysicalConnection();
+    return physicalConnection_.nativeSQL(sql);
+  }
+
+  synchronized public void setAutoCommit (boolean autoCommit) throws 
SqlException
+  {
+    checkForNullPhysicalConnection();
+    physicalConnection_.setAutoCommit(autoCommit);
+  }
+
+  public boolean getAutoCommit () throws SqlException
+  {
+    checkForNullPhysicalConnection();
+    return physicalConnection_.getAutoCommit();
+  }
+
+  synchronized public void commit () throws SqlException
+  {
+    checkForNullPhysicalConnection();
+    physicalConnection_.commit();
+  }
+
+  synchronized public void rollback () throws SqlException
+  {
+    checkForNullPhysicalConnection();
+    physicalConnection_.rollback();
+  }
+
+  synchronized public void setTransactionIsolation (int level) throws 
SqlException
+  {
+    checkForNullPhysicalConnection();
+    physicalConnection_.setTransactionIsolation(level);
+  }
+
+  public int getTransactionIsolation () throws SqlException
+  {
+    checkForNullPhysicalConnection();
+    return physicalConnection_.getTransactionIsolation();
+  }
+
+  public java.sql.SQLWarning getWarnings () throws SqlException
+  {
+    checkForNullPhysicalConnection();
+    return physicalConnection_.getWarnings();
+  }
+
+  synchronized public void clearWarnings () throws SqlException
+  {
+    checkForNullPhysicalConnection();
+    physicalConnection_.clearWarnings();
+  }
+
+  public java.sql.DatabaseMetaData getMetaData () throws SqlException
+  {
+    checkForNullPhysicalConnection();
+    return physicalConnection_.getMetaData();
+  }
+
+  synchronized public void setReadOnly (boolean readOnly) throws SqlException
+  {
+    checkForNullPhysicalConnection();
+    physicalConnection_.setReadOnly (readOnly);
+  }
+
+  public boolean isReadOnly () throws SqlException
+  {
+    checkForNullPhysicalConnection();
+    return physicalConnection_.isReadOnly();
+  }
+
+  synchronized public void setCatalog (String catalog) throws SqlException
+  {
+    checkForNullPhysicalConnection();
+    physicalConnection_.setCatalog(catalog);
+  }
+
+  public String getCatalog () throws SqlException
+  {
+    checkForNullPhysicalConnection();
+    return physicalConnection_.getCatalog();
+  }
+
+  synchronized public java.sql.Statement createStatement (int resultSetType,
+                                                          int 
resultSetConcurrency) throws SqlException
+  {
+    checkForNullPhysicalConnection();
+    return physicalConnection_.createStatement(resultSetType, 
resultSetConcurrency);
+  }
+
+  synchronized public java.sql.PreparedStatement prepareStatement (String sql,
+                                                                   int 
resultSetType,
+                                                                   int 
resultSetConcurrency) throws SqlException
+  {
+    checkForNullPhysicalConnection();
+    return physicalConnection_.prepareStatement(sql, resultSetType, 
resultSetConcurrency);
+  }
+
+  synchronized public java.sql.CallableStatement prepareCall (String sql,
+                                                              int 
resultSetType,
+                                                              int 
resultSetConcurrency) throws SqlException
+  {
+    checkForNullPhysicalConnection();
+    return physicalConnection_.prepareCall(sql,  resultSetType, 
resultSetConcurrency);
+  }
+
+  public java.util.Map getTypeMap () throws SqlException
+  {
+    checkForNullPhysicalConnection();
+    return physicalConnection_.getTypeMap();
+  }
+
+  synchronized public void setTypeMap (java.util.Map map) throws SqlException
+  {
+    checkForNullPhysicalConnection();
+    physicalConnection_.setTypeMap(map);
+  }
+
+  public java.sql.Statement createStatement(int resultSetType, int 
resultSetConcurrency,
+                             int resultSetHoldability) throws SqlException
+  {
+    checkForNullPhysicalConnection();
+    return physicalConnection_.createStatement(resultSetType, 
resultSetConcurrency, resultSetHoldability);
+  }
+
+  public java.sql.CallableStatement prepareCall(String sql, int resultSetType,
+                                 int resultSetConcurrency,
+                                 int resultSetHoldability) throws SqlException
+  {
+    checkForNullPhysicalConnection();
+    return physicalConnection_.prepareCall(sql, resultSetType, 
resultSetConcurrency, resultSetHoldability);
+  }
+
+  public java.sql.PreparedStatement prepareStatement(String sql, int 
resultSetType,
+                                      int resultSetConcurrency, int 
resultSetHoldability)
+       throws SqlException
+  {
+    checkForNullPhysicalConnection();
+    return physicalConnection_.prepareStatement(sql, resultSetType, 
resultSetConcurrency,
+      resultSetHoldability);
+  }
+
+  public java.sql.PreparedStatement prepareStatement(String sql, int 
autoGeneratedKeys)
+       throws SqlException
+  {
+    checkForNullPhysicalConnection();
+    return physicalConnection_.prepareStatement(sql, autoGeneratedKeys);
+  }
+
+  public java.sql.PreparedStatement prepareStatement(String sql, int 
columnIndexes[])
+       throws SqlException
+  {
+    checkForNullPhysicalConnection();
+    return physicalConnection_.prepareStatement(sql, columnIndexes);
+  }
+
+  public java.sql.PreparedStatement prepareStatement(String sql, String 
columnNames[])
+       throws SqlException
+  {
+    checkForNullPhysicalConnection();
+    return physicalConnection_.prepareStatement(sql, columnNames);
+  }
+
+  public void setHoldability(int holdability) throws SqlException
+  {
+    checkForNullPhysicalConnection();
+    physicalConnection_.setHoldability(holdability);
+  }
+
+  public int getHoldability() throws SqlException
+  {
+    checkForNullPhysicalConnection();
+    return physicalConnection_.getHoldability();
+  }
+
+  public java.sql.Savepoint setSavepoint() throws SqlException
+  {
+    checkForNullPhysicalConnection();
+    return physicalConnection_.setSavepoint ();
+  }
+
+  public java.sql.Savepoint setSavepoint(String name) throws SqlException
+  {
+    checkForNullPhysicalConnection();
+    return physicalConnection_.setSavepoint (name);
+  }
+
+  public void rollback(java.sql.Savepoint savepoint) throws SqlException
+  {
+    checkForNullPhysicalConnection();
+    physicalConnection_.rollback (savepoint);
+  }
+
+  public void releaseSavepoint(java.sql.Savepoint savepoint) throws 
SqlException
+  {
+    checkForNullPhysicalConnection();
+    physicalConnection_.releaseSavepoint (savepoint);
+  }
+
+  
//----------------------------------------------------------------------------
+
+  public int getServerVersion()
+  {
+    if (physicalConnection_ == null)
+      return -1;
+    else
+      return physicalConnection_.getServerVersion();
+  }
+
+}

Propchange: 
incubator/derby/code/trunk/java/client/org/apache/derby/client/am/LogicalConnection.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: 
incubator/derby/code/trunk/java/client/org/apache/derby/client/am/MaterialPreparedStatement.java
URL: 
http://svn.apache.org/viewcvs/incubator/derby/code/trunk/java/client/org/apache/derby/client/am/MaterialPreparedStatement.java?rev=165178&view=auto
==============================================================================
--- 
incubator/derby/code/trunk/java/client/org/apache/derby/client/am/MaterialPreparedStatement.java
 (added)
+++ 
incubator/derby/code/trunk/java/client/org/apache/derby/client/am/MaterialPreparedStatement.java
 Thu Apr 28 12:05:42 2005
@@ -0,0 +1,60 @@
+/*
+
+   Derby - Class org.apache.derby.client.am.MaterialPreparedStatement
+
+   Copyright (c) 2001, 2005 The Apache Software Foundation or its licensors, 
where applicable.
+
+   Licensed under the Apache License, Version 2.0 (the "License");
+   you may not use this file except in compliance with the License.
+   You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+
+*/
+
+package org.apache.derby.client.am;
+
+import org.apache.derby.client.am.Section;
+
+public interface MaterialPreparedStatement extends MaterialStatement
+{
+
+
+  // ------------------------ abstract box car and callback methods 
--------------------------------
+
+  public abstract void writeExecute_ (Section section,
+                            ColumnMetaData parameterMetaData,
+                            Object[] inputs,
+                            int numInputColumns,
+                            boolean outputExpected,
+                            // This is a hint to the material layer that more 
write commands will follow.
+                            // It is ignored by the driver in all cases except 
when blob data is written,
+                            // in which case this boolean is used to optimize 
the implementation.
+                            // Otherwise we wouldn't be able to chain after 
blob data is sent.
+                            // Current servers have a restriction that blobs 
can only be chained with blobs
+                            // Can the blob code
+                            boolean chainedWritesFollowingSetLob
+                            ) throws SqlException;
+
+
+  public abstract void readExecute_ () throws SqlException;
+
+  public abstract void writeOpenQuery_ (Section section,
+                              int fetchSize,
+                              int resultSetType,
+                              int numInputColumns,
+                              ColumnMetaData parameterMetaData,
+                              Object[] inputs
+                              ) throws SqlException;
+  public abstract void writeDescribeInput_ (Section section) throws 
SqlException;
+  public abstract void readDescribeInput_ () throws SqlException;
+
+  public abstract void writeDescribeOutput_ (Section section) throws 
SqlException;
+  public abstract void readDescribeOutput_ () throws SqlException;
+}

Propchange: 
incubator/derby/code/trunk/java/client/org/apache/derby/client/am/MaterialPreparedStatement.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: 
incubator/derby/code/trunk/java/client/org/apache/derby/client/am/MaterialStatement.java
URL: 
http://svn.apache.org/viewcvs/incubator/derby/code/trunk/java/client/org/apache/derby/client/am/MaterialStatement.java?rev=165178&view=auto
==============================================================================
--- 
incubator/derby/code/trunk/java/client/org/apache/derby/client/am/MaterialStatement.java
 (added)
+++ 
incubator/derby/code/trunk/java/client/org/apache/derby/client/am/MaterialStatement.java
 Thu Apr 28 12:05:42 2005
@@ -0,0 +1,64 @@
+/*
+
+   Derby - Class org.apache.derby.client.am.MaterialStatement
+
+   Copyright (c) 2001, 2005 The Apache Software Foundation or its licensors, 
where applicable.
+
+   Licensed under the Apache License, Version 2.0 (the "License");
+   you may not use this file except in compliance with the License.
+   You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+
+*/
+
+package org.apache.derby.client.am;
+
+import org.apache.derby.client.am.Section;
+
+public interface MaterialStatement
+{
+  public abstract void writeExecuteImmediate_ (String sql, Section section) 
throws SqlException;
+  public abstract void readExecuteImmediate_ () throws SqlException;
+  // The sql parameter is supplied in the read method for drivers that
+  // process all commands on the "read-side" and do little/nothing on the 
"write-side".
+  // Drivers that follow the write/read paradigm (e.g. NET) will likely ignore 
the sql parameter.
+  public abstract void readExecuteImmediateForBatch_ (String sql) throws 
SqlException;
+
+  public abstract void writePrepareDescribeOutput_ (String sql, Section 
section) throws SqlException;
+  public abstract void readPrepareDescribeOutput_ () throws SqlException;
+
+  public abstract void writeOpenQuery_ (Section section,
+                              int fetchSize,
+                              int resultSetType) throws SqlException;
+  public abstract void readOpenQuery_ () throws SqlException;
+
+  public abstract void writeExecuteCall_ (boolean outputExpected,
+                                String procedureName,
+                                Section section,
+                                int fetchSize,
+                                boolean suppressResultSets,  // for batch 
updates set to true, otherwise to false
+                                int resultSetType,
+                                ColumnMetaData parameterMetaData,
+                                Object[] inputs) throws SqlException;
+  public abstract void readExecuteCall_ () throws SqlException;
+
+  // Used for re-prepares across commit and other places as well
+  public abstract void writePrepare_ (String sql, Section section) throws 
SqlException;
+  public abstract void readPrepare_ () throws SqlException;
+
+  public abstract void markClosedOnServer_();
+
+  public abstract void writeSetSpecialRegister_ (java.util.ArrayList 
sqlsttList) throws SqlException;
+  public abstract void readSetSpecialRegister_ () throws SqlException;
+
+ public abstract void reset_ ();
+
+}
+

Propchange: 
incubator/derby/code/trunk/java/client/org/apache/derby/client/am/MaterialStatement.java
------------------------------------------------------------------------------
    svn:eol-style = native


Reply via email to