com.caucho.sql
Class ManagedConnectionImpl

java.lang.Object
  extended by com.caucho.sql.ManagedConnectionImpl
All Implemented Interfaces:
java.util.EventListener, ManagedConnection, javax.sql.ConnectionEventListener

public class ManagedConnectionImpl
extends java.lang.Object
implements ManagedConnection, javax.sql.ConnectionEventListener

Represents a single pooled connection. For the most part, it just passes the requests to the underlying JDBC connection.

Closing the connection will return the real connection to the pool and close any statements.


Field Summary
protected static L10N L
           
protected static java.util.logging.Logger log
           
 
Method Summary
 void addConnectionEventListener(ConnectionEventListener listener)
          Adds a connection event listener.
 void associateConnection(java.lang.Object connection)
          Associates the associate connection.
 void cleanup()
          Cleans up the instance.
 void closeEvent(UserConnection userConn)
          Sends the close event.
 void connectionClosed(javax.sql.ConnectionEvent event)
           
 void connectionErrorOccurred(javax.sql.ConnectionEvent event)
           
 void destroy()
          Destroys the physical connection.
 void fatalEvent()
          Sends the fatal event.
 void fatalEvent(java.lang.Exception e)
          Sends the fatal event.
 java.lang.Object getConnection(javax.security.auth.Subject subject, ConnectionRequestInfo info)
          Returns the underlying connection.
 java.lang.Class<?> getDriverClass()
           
 LocalTransaction getLocalTransaction()
          Returns the XA resource for the connection.
 java.io.PrintWriter getLogWriter()
          Gets the log writer.
 ManagedConnectionMetaData getMetaData()
          Returns the meta data.
 java.lang.String getURL()
           
 XAResource getXAResource()
          Returns the XA resource for the connection.
 boolean isClosed()
           
 void onRuntimeException(java.lang.RuntimeException e)
           
 void onSqlException(java.sql.SQLException e)
           
 void removeConnectionEventListener(ConnectionEventListener listener)
          Removes a connection event listener.
 void sendFatalEvent(java.lang.Exception e)
          Sends the fatal event.
 void setAutoCommit(boolean autoCommit)
          Sets the auto-commit.
 void setCatalog(java.lang.String catalog)
          Sets the JDBC catalog.
 void setIsolation(int isolation)
          Sets the isolation.
 void setLogWriter(java.io.PrintWriter out)
          Sets the log writer.
 void setPingRequired()
           
 void setReadOnly(boolean readOnly)
          Sets the read only attribute.
 void setTransactionIsolation(int isolation)
          Sets the connection's isolation.
 void setTypeMap(java.util.Map<java.lang.String,java.lang.Class<?>> map)
          Sets the connection's type map.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

log

protected static final java.util.logging.Logger log

L

protected static L10N L
Method Detail

isClosed

public boolean isClosed()

getConnection

public java.lang.Object getConnection(javax.security.auth.Subject subject,
                                      ConnectionRequestInfo info)
                               throws ResourceException
Returns the underlying connection.

Specified by:
getConnection in interface ManagedConnection
Throws:
ResourceException

associateConnection

public void associateConnection(java.lang.Object connection)
                         throws ResourceException
Associates the associate connection.

Specified by:
associateConnection in interface ManagedConnection
Throws:
ResourceException

addConnectionEventListener

public void addConnectionEventListener(ConnectionEventListener listener)
Adds a connection event listener.

Specified by:
addConnectionEventListener in interface ManagedConnection

removeConnectionEventListener

public void removeConnectionEventListener(ConnectionEventListener listener)
Removes a connection event listener.

Specified by:
removeConnectionEventListener in interface ManagedConnection

getDriverClass

public java.lang.Class<?> getDriverClass()

getURL

public java.lang.String getURL()

getXAResource

public XAResource getXAResource()
                         throws ResourceException
Returns the XA resource for the connection.

Specified by:
getXAResource in interface ManagedConnection
Throws:
ResourceException

getLocalTransaction

public LocalTransaction getLocalTransaction()
                                     throws ResourceException
Returns the XA resource for the connection.

Specified by:
getLocalTransaction in interface ManagedConnection
Throws:
ResourceException

getMetaData

public ManagedConnectionMetaData getMetaData()
                                      throws ResourceException
Returns the meta data.

Specified by:
getMetaData in interface ManagedConnection
Throws:
ResourceException

setLogWriter

public void setLogWriter(java.io.PrintWriter out)
                  throws ResourceException
Sets the log writer.

Specified by:
setLogWriter in interface ManagedConnection
Throws:
ResourceException

getLogWriter

public java.io.PrintWriter getLogWriter()
                                 throws ResourceException
Gets the log writer.

Specified by:
getLogWriter in interface ManagedConnection
Throws:
ResourceException

setIsolation

public void setIsolation(int isolation)
                  throws java.sql.SQLException
Sets the isolation.

Throws:
java.sql.SQLException

connectionClosed

public void connectionClosed(javax.sql.ConnectionEvent event)
Specified by:
connectionClosed in interface javax.sql.ConnectionEventListener

connectionErrorOccurred

public void connectionErrorOccurred(javax.sql.ConnectionEvent event)
Specified by:
connectionErrorOccurred in interface javax.sql.ConnectionEventListener

closeEvent

public void closeEvent(UserConnection userConn)
Sends the close event.


fatalEvent

public void fatalEvent()
Sends the fatal event.


fatalEvent

public void fatalEvent(java.lang.Exception e)
Sends the fatal event.


sendFatalEvent

public void sendFatalEvent(java.lang.Exception e)
Sends the fatal event.


onSqlException

public void onSqlException(java.sql.SQLException e)

onRuntimeException

public void onRuntimeException(java.lang.RuntimeException e)

setPingRequired

public void setPingRequired()

setAutoCommit

public void setAutoCommit(boolean autoCommit)
                   throws java.sql.SQLException
Sets the auto-commit.

Throws:
java.sql.SQLException

setReadOnly

public void setReadOnly(boolean readOnly)
                 throws java.sql.SQLException
Sets the read only attribute.

Throws:
java.sql.SQLException

setCatalog

public void setCatalog(java.lang.String catalog)
                throws java.sql.SQLException
Sets the JDBC catalog.

Throws:
java.sql.SQLException

setTypeMap

public void setTypeMap(java.util.Map<java.lang.String,java.lang.Class<?>> map)
                throws java.sql.SQLException
Sets the connection's type map.

Throws:
java.sql.SQLException

setTransactionIsolation

public void setTransactionIsolation(int isolation)
                             throws java.sql.SQLException
Sets the connection's isolation.

Throws:
java.sql.SQLException

cleanup

public void cleanup()
             throws ResourceException
Cleans up the instance.

Specified by:
cleanup in interface ManagedConnection
Throws:
ResourceException

destroy

public void destroy()
             throws ResourceException
Destroys the physical connection.

Specified by:
destroy in interface ManagedConnection
Throws:
ResourceException

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object