Nuxeo ECM Projects 5.4.3-SNAPSHOT

org.nuxeo.ecm.core.storage.sql.ra
Class ManagedConnectionImpl

java.lang.Object
  extended by org.nuxeo.ecm.core.storage.sql.ra.ManagedConnectionImpl
All Implemented Interfaces:
ManagedConnection, ManagedConnectionMetaData

public class ManagedConnectionImpl
extends Object
implements ManagedConnection, ManagedConnectionMetaData

The managed connection represents an actual physical connection to the underlying storage. It is created by the ManagedConnectionFactory, and then encapsulated into a Connection which is then returned to the application (via the ConnectionFactory).

If sharing is allowed, several different Connections may be associated to a given ManagedConnection, although not at the same time.

Author:
Florent Guillaume

Constructor Summary
ManagedConnectionImpl(ManagedConnectionFactoryImpl managedConnectionFactory, ConnectionRequestInfoImpl connectionRequestInfo)
          Creates a new physical connection to the underlying storage.
 
Method Summary
 void addConnectionEventListener(ConnectionEventListener listener)
          Called by the application server to add a listener who should be notified of all relevant events on this connection.
 void associateConnection(Object object)
          Called by the application server to change the association of an application-level Connection handle with a ManagedConnection instance.
 void cleanup()
          Cleans up the physical connection, so that it may be reused.
 void destroy()
          Destroys the physical connection.
 Connection getConnection(Subject subject, ConnectionRequestInfo connectionRequestInfo)
          Creates a new Connection handle to this ManagedConnection .
 String getEISProductName()
           
 String getEISProductVersion()
           
 LocalTransaction getLocalTransaction()
           
 PrintWriter getLogWriter()
           
 int getMaxConnections()
           
 ManagedConnectionMetaData getMetaData()
           
 String getUserName()
           
 XAResource getXAResource()
           
 void removeConnectionEventListener(ConnectionEventListener listener)
          Called by the application server to remove a listener.
 void setLogWriter(PrintWriter out)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ManagedConnectionImpl

public ManagedConnectionImpl(ManagedConnectionFactoryImpl managedConnectionFactory,
                             ConnectionRequestInfoImpl connectionRequestInfo)
                      throws ResourceException
Creates a new physical connection to the underlying storage. Called by the ManagedConnectionFactory when it needs a new connection.

Throws:
ResourceException
Method Detail

getConnection

public Connection getConnection(Subject subject,
                                ConnectionRequestInfo connectionRequestInfo)
                         throws ResourceException
Creates a new Connection handle to this ManagedConnection .

Specified by:
getConnection in interface ManagedConnection
Throws:
ResourceException

cleanup

public void cleanup()
Cleans up the physical connection, so that it may be reused.

Called by the application server before putting back this ManagedConnection into the application server pool.

Later, the application server may call getConnection(javax.security.auth.Subject, javax.resource.spi.ConnectionRequestInfo) again.

Specified by:
cleanup in interface ManagedConnection

destroy

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

Called by the application server before this ManagedConnection is destroyed.

Specified by:
destroy in interface ManagedConnection
Throws:
ResourceException

associateConnection

public void associateConnection(Object object)
                         throws ResourceException
Called by the application server to change the association of an application-level Connection handle with a ManagedConnection instance.

Specified by:
associateConnection in interface ManagedConnection
Throws:
ResourceException

getXAResource

public XAResource getXAResource()
Specified by:
getXAResource in interface ManagedConnection

getLocalTransaction

public LocalTransaction getLocalTransaction()
Specified by:
getLocalTransaction in interface ManagedConnection

addConnectionEventListener

public void addConnectionEventListener(ConnectionEventListener listener)
Called by the application server to add a listener who should be notified of all relevant events on this connection.

Specified by:
addConnectionEventListener in interface ManagedConnection

removeConnectionEventListener

public void removeConnectionEventListener(ConnectionEventListener listener)
Called by the application server to remove a listener.

Specified by:
removeConnectionEventListener in interface ManagedConnection

getMetaData

public ManagedConnectionMetaData getMetaData()
Specified by:
getMetaData in interface ManagedConnection

setLogWriter

public void setLogWriter(PrintWriter out)
Specified by:
setLogWriter in interface ManagedConnection

getLogWriter

public PrintWriter getLogWriter()
Specified by:
getLogWriter in interface ManagedConnection

getEISProductName

public String getEISProductName()
Specified by:
getEISProductName in interface ManagedConnectionMetaData

getEISProductVersion

public String getEISProductVersion()
Specified by:
getEISProductVersion in interface ManagedConnectionMetaData

getMaxConnections

public int getMaxConnections()
Specified by:
getMaxConnections in interface ManagedConnectionMetaData

getUserName

public String getUserName()
                   throws ResourceException
Specified by:
getUserName in interface ManagedConnectionMetaData
Throws:
ResourceException

Nuxeo ECM Projects 5.4.3-SNAPSHOT

Copyright © 2011 Nuxeo SAS. All Rights Reserved.