org.datanucleus.store.connection
Interface ConnectionManager

All Known Implementing Classes:
ConnectionManagerImpl

public interface ConnectionManager

Manager of connections for an OMF, allowing ManagedConnection pooling, enlistment in transaction. The pool caches one connection per poolKey object. The "allocateConnection" method can create connections and enlist them (like most normal persistence operations need) or create a connection and return it without enlisting it into a transaction, for example the connections used to generate object identity, create the database schema or obtaining the schema metadata. Connections can be locked per object poolKey basis. Locking of connections is used to handle the connection over to the user application. A locked connection denies any further access to the datastore, until the user application unlock it.


Method Summary
 ManagedConnection allocateConnection(ConnectionFactory factory, java.lang.Object poolKey, Transaction tx, java.util.Map options)
          Allocate a connection using the specified factory (unless we already have one cached for the poolKey object).
 void disableConnectionPool()
          Disable binding objects to "poolKey" references, so automatically disables the connection pooling
 ConnectionFactory lookupConnectionFactory(java.lang.String name)
          Method to lookup a connection factory and create it if not yet existing.
 void registerConnectionFactory(java.lang.String name, ConnectionFactory factory)
          Method to register a connection factory
 

Method Detail

lookupConnectionFactory

ConnectionFactory lookupConnectionFactory(java.lang.String name)
Method to lookup a connection factory and create it if not yet existing.

Parameters:
name - The lookup name "e.g "jdbc/tx"
Returns:
The connection factory

registerConnectionFactory

void registerConnectionFactory(java.lang.String name,
                               ConnectionFactory factory)
Method to register a connection factory

Parameters:
name - The lookup name "e.g "jdbc/tx"
factory - The connection factory

allocateConnection

ManagedConnection allocateConnection(ConnectionFactory factory,
                                     java.lang.Object poolKey,
                                     Transaction tx,
                                     java.util.Map options)
Allocate a connection using the specified factory (unless we already have one cached for the poolKey object).

Parameters:
factory - The ConnectionFactory to create any new connection with
poolKey - the object that is bound the connection during its lifecycle
options - Any options for allocating the connection (e.g isolation)
Returns:
The ManagedConnection

disableConnectionPool

void disableConnectionPool()
Disable binding objects to "poolKey" references, so automatically disables the connection pooling



Copyright © 2010. All Rights Reserved.