org.openmdx.kernel.application.container.lightweight
Class AbstractConnectionManager

java.lang.Object
  extended by org.openmdx.kernel.application.container.lightweight.AbstractConnectionManager
All Implemented Interfaces:
Serializable, ConnectionManager
Direct Known Subclasses:
LightweightConnectionManager, ShareableConnectionManager

public abstract class AbstractConnectionManager
extends Object
implements ConnectionManager

Abstract Connection Manager

See Also:
Serialized Form

Constructor Summary
protected AbstractConnectionManager(Set credentials)
          Constructor
protected AbstractConnectionManager(Set credentials, Class connectionClass)
          Constructor
protected AbstractConnectionManager(Set credentials, String connectionClass)
          Constructor
 
Method Summary
 Object allocateConnection(ManagedConnectionFactory managedConnectionFactory, ConnectionRequestInfo connectionRequestInfo)
           
protected  ManagedConnection allocateManagedConnection(Subject subject, ManagedConnectionFactory managedConnectionFactory, ConnectionRequestInfo connectionRequestInfo)
          Allocate a managed connection
protected  ManagedConnection allocateMangedConnection(Set managedConnections, Subject subject, ManagedConnectionFactory managedConnectionFactory, ConnectionRequestInfo connectionRequestInfo)
          Allocate a managed connection
protected  Object createConnection()
          Create a new connection instance
protected  Set getManagedConnections()
          This method must be overriden by a sub-class unless its own allocateConnection implementation does not need it.
protected  Subject getSubject()
          Establish and return the subject
protected static ResourceException toResourceException(Exception cause, String message)
          Convert an exception to a resource exception
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractConnectionManager

protected AbstractConnectionManager(Set credentials)
Constructor

Parameters:
credentials -
Throws:
ResourceException

AbstractConnectionManager

protected AbstractConnectionManager(Set credentials,
                                    Class connectionClass)
Constructor

Parameters:
credentials -
connectionClass -
Throws:
ResourceException

AbstractConnectionManager

protected AbstractConnectionManager(Set credentials,
                                    String connectionClass)
                             throws ResourceException
Constructor

Parameters:
credentials -
connectionClass -
Throws:
ResourceException
Method Detail

toResourceException

protected static ResourceException toResourceException(Exception cause,
                                                       String message)
Convert an exception to a resource exception

Parameters:
cause -
message -
Returns:
a resource exception with the given exception linked to it

createConnection

protected Object createConnection()
                           throws ResourceException
Create a new connection instance

Returns:
a new connectionClass instance
Throws:
ResourceException

getSubject

protected Subject getSubject()
Establish and return the subject

Returns:
the subject with its private credetnial set

getManagedConnections

protected Set getManagedConnections()
                             throws ResourceException
This method must be overriden by a sub-class unless its own allocateConnection implementation does not need it.

Returns:
the set of managed connections.
Throws:
ResourceException

allocateManagedConnection

protected ManagedConnection allocateManagedConnection(Subject subject,
                                                      ManagedConnectionFactory managedConnectionFactory,
                                                      ConnectionRequestInfo connectionRequestInfo)
                                               throws ResourceException
Allocate a managed connection

Parameters:
subject -
managedConnectionFactory -
connectionRequestInfo -
Returns:
a (maybe newly created) managed connection
Throws:
ResourceException

allocateMangedConnection

protected ManagedConnection allocateMangedConnection(Set managedConnections,
                                                     Subject subject,
                                                     ManagedConnectionFactory managedConnectionFactory,
                                                     ConnectionRequestInfo connectionRequestInfo)
                                              throws ResourceException
Allocate a managed connection

Parameters:
managedConnections - set of managed conections
managedConnectionPool - pool of unused managed connections
subject -
managedConnectionFactory -
connectionRequestInfo -
Returns:
a (maybe newly created) managed connection
Throws:
ResourceException

allocateConnection

public Object allocateConnection(ManagedConnectionFactory managedConnectionFactory,
                                 ConnectionRequestInfo connectionRequestInfo)
                          throws ResourceException
Specified by:
allocateConnection in interface ConnectionManager
Throws:
ResourceException


This software is published under the BSD license. Copyright © 2003-2007, OMEX AG, Switzerland, All rights reserved. Use is subject to license terms.