|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.ow2.jonas.ee.jdbc.ManagedConnectionImpl
public class ManagedConnectionImpl
Represent an underlying Connection
Field Summary | |
---|---|
protected HashSet |
cels
|
protected DataSource |
factory
|
protected boolean |
inLocalTransaction
|
protected PrintWriter |
out
|
org.objectweb.util.monolog.api.Logger |
trace
|
Constructor Summary | |
---|---|
ManagedConnectionImpl(ManagedConnectionFactoryImpl _mcf,
PasswordCredential _pc,
Connection _con,
PooledConnection _pcon,
XAConnection _xa,
org.ow2.jonas.ee.jdbc.DriverWrapper wrp)
Constructor |
Method Summary | |
---|---|
void |
addConnectionEventListener(ConnectionEventListener listener)
Adds a connection event listener. |
void |
addSignature(long sig)
|
void |
associateConnection(Object con)
Change the association of a connection handle. |
void |
begin()
start a new local transaction. |
void |
cleanup()
Cleanup the ManagedConnection instance. |
void |
clearSignature()
|
void |
clearSignature(long sig,
boolean clear)
|
void |
close(ConnectionImpl ch)
The Connection Handler has been closed by its user. |
void |
commit()
commit the local transaction. |
void |
destroy()
Destroys the physical connection. |
boolean |
getAutoCommit()
|
Object |
getConnection(Subject subject,
ConnectionRequestInfo cxRequestInfo)
Create a connection handle for user purpose. |
LocalTransaction |
getLocalTransaction()
Returns an javax.resource.spi.LocalTransaction instance. |
PrintWriter |
getLogWriter()
Gets the log writer for this ManagedConnection instance. |
ManagedConnectionMetaData |
getMetaData()
Gets the metadata information for this connection's underlying EIS resource manager instance. |
long |
getNewSignature(boolean setSig)
Gets the next signature value |
long |
getSignature()
Gets the current signature value |
long |
getSignature(long sig)
Gets the signature value passed in if found in the signature hash table |
XAResource |
getXAResource()
Get an XAResource to enlist with the Transaction Manager. |
boolean |
isValid()
Check if Connection is still valid |
void |
removeConnectionEventListener(ConnectionEventListener listener)
Removes an already registered connection event listener from the ManagedConnection instance |
void |
rollback()
rollback the local transaction. |
void |
setAutoCommit(boolean ac)
|
void |
setLogWriter(PrintWriter _out)
Sets the log writer for this ManagedConnection instance. |
void |
setSignature(long sig)
|
void |
signalEvent(int code,
Object ch,
Exception ex)
Signal an event to all the registered listeners. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public org.objectweb.util.monolog.api.Logger trace
protected PrintWriter out
protected DataSource factory
protected HashSet cels
protected boolean inLocalTransaction
Constructor Detail |
---|
public ManagedConnectionImpl(ManagedConnectionFactoryImpl _mcf, PasswordCredential _pc, Connection _con, PooledConnection _pcon, XAConnection _xa, org.ow2.jonas.ee.jdbc.DriverWrapper wrp)
_mcf
- The calling factory_pc
- username and password._con
- physical Connection_pcon
- PooledConnection in case of CP, or null._xa
- XAConnection in case of XA, or null.wrp
- DriverWrapper in case of DM, or null.Method Detail |
---|
public void signalEvent(int code, Object ch, Exception ex)
code
- type of event (CONNECTION_ERROR_OCCURRED, CONNECTION_CLOSED, ...)ch
- may be a connection handler or null.ex
- exception if CONNECTION_ERROR_OCCURREDpublic boolean getAutoCommit() throws ResourceException
ResourceException
public void setAutoCommit(boolean ac) throws ResourceException
ResourceException
public void addConnectionEventListener(ConnectionEventListener listener)
addConnectionEventListener
in interface ManagedConnection
public void removeConnectionEventListener(ConnectionEventListener listener)
removeConnectionEventListener
in interface ManagedConnection
public void associateConnection(Object con) throws ResourceException
associateConnection
in interface ManagedConnection
ResourceException
public void cleanup() throws ResourceException
cleanup
in interface ManagedConnection
ResourceException
- Error while cleaning up.
IllegalStateException
- A transaction is not ended.public void destroy() throws ResourceException
destroy
in interface ManagedConnection
ResourceException
public Object getConnection(Subject subject, ConnectionRequestInfo cxRequestInfo) throws ResourceException
getConnection
in interface ManagedConnection
ResourceException
- Cannot create Handlepublic void close(ConnectionImpl ch) throws ResourceException
ch
- Connection Handler
ResourceException
- error while signaling the event to listenerspublic LocalTransaction getLocalTransaction() throws ResourceException
getLocalTransaction
in interface ManagedConnection
ResourceException
public PrintWriter getLogWriter()
getLogWriter
in interface ManagedConnection
public ManagedConnectionMetaData getMetaData() throws ResourceException
getMetaData
in interface ManagedConnection
ResourceException
public XAResource getXAResource() throws ResourceException
getXAResource
in interface ManagedConnection
ResourceException
- cannot get it.public void setLogWriter(PrintWriter _out)
setLogWriter
in interface ManagedConnection
public void addSignature(long sig)
public void clearSignature()
public void clearSignature(long sig, boolean clear)
public void setSignature(long sig)
public long getSignature(long sig)
sig
- value to find in signature table
public long getSignature()
public long getNewSignature(boolean setSig)
public void begin() throws ResourceException
begin
in interface LocalTransaction
ResourceException
public void commit() throws ResourceException
commit
in interface LocalTransaction
ResourceException
public void rollback() throws ResourceException
rollback
in interface LocalTransaction
ResourceException
public boolean isValid()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |