Top Description Methods
javax.resource.spi

public Interface ManagedConnectionFactory

extends Serializable
Imports
javax.security.auth.Subject, java.util.Set, javax.resource.ResourceException, .NotSupportedException

ManagedConnectionFactory instance is a factory of both ManagedConnection and EIS-specific connection factory instances. This interface supports connection pooling by providing methods for matching and creation of ManagedConnection instance. A ManagedConnectionFactory instance is required to be a JavaBean.
Author
Rahul Sharma
Version
0.6
See Also
javax.resource.spi.ManagedConnection

Method Summary

Modifier and TypeMethod and Description
public Object

Returns:

EIS-specific Connection Factory instance or javax.resource.cci.ConnectionFactory instance
createConnectionFactory
(ConnectionManager
ConnectionManager to be associated with created EIS connection factory instance
cxManager
)

Creates a Connection Factory instance.

public Object

Returns:

EIS-specific Connection Factory instance or javax.resource.cci.ConnectionFactory instance
createConnectionFactory
()

Creates a Connection Factory instance.

public ManagedConnection

Returns:

ManagedConnection instance
createManagedConnection
(Subject
Caller's security information
subject
,
ConnectionRequestInfo
Additional resource adapter specific connection request information
cxRequestInfo
)

Creates a new physical connection to the underlying EIS resource manager.

public boolean

Returns:

true if two instances are equal
equals
(Object other)

Check if this ManagedConnectionFactory is equal to another ManagedConnectionFactory.

public PrintWriter

Returns:

PrintWriter
getLogWriter
()

Get the log writer for this ManagedConnectionFactory instance.

public int

Returns:

hash code for the ManagedConnectionFactory
hashCode
()

Returns the hash code for the ManagedConnectionFactory

public ManagedConnection

Returns:

ManagedConnection if resource adapter finds an acceptable match otherwise null
matchManagedConnections
(Set<E>
candidate connection set
connectionSet
,
Subject
caller's security information
subject
,
ConnectionRequestInfo
additional resource adapter specific connection request information
cxRequestInfo
)

Returns a matched connection from the candidate set of connections.

public void
setLogWriter(PrintWriter
PrintWriter - an out stream for error logging and tracing
out
)

Set the log writer for this ManagedConnectionFactory instance.

Method Detail

createConnectionFactoryback to summary
public Object createConnectionFactory(ConnectionManager cxManager) throws ResourceException

Creates a Connection Factory instance. The Connection Factory instance gets initialized with the passed ConnectionManager. In the managed scenario, ConnectionManager is provided by the application server.

Parameters
cxManager:ConnectionManager

ConnectionManager to be associated with created EIS connection factory instance

Returns:Object

EIS-specific Connection Factory instance or javax.resource.cci.ConnectionFactory instance

Exceptions
ResourceException:
Generic exception
ResourceAdapterInternalException:
Resource adapter related error condition
createConnectionFactoryback to summary
public Object createConnectionFactory() throws ResourceException

Creates a Connection Factory instance. The Connection Factory instance gets initialized with a default ConnectionManager provided by the resource adapter.

Returns:Object

EIS-specific Connection Factory instance or javax.resource.cci.ConnectionFactory instance

Exceptions
ResourceException:
Generic exception
ResourceAdapterInternalException:
Resource adapter related error condition
createManagedConnectionback to summary
public ManagedConnection createManagedConnection(Subject subject, ConnectionRequestInfo cxRequestInfo) throws ResourceException

Creates a new physical connection to the underlying EIS resource manager.

ManagedConnectionFactory uses the security information (passed as Subject) and additional ConnectionRequestInfo (which is specific to ResourceAdapter and opaque to application server) to create this new connection.

Parameters
subject:Subject

Caller's security information

cxRequestInfo:ConnectionRequestInfo

Additional resource adapter specific connection request information

Returns:ManagedConnection

ManagedConnection instance

Exceptions
ResourceException:
generic exception
SecurityException:
security related error
ResourceAllocationException:
failed to allocate system resources for connection request
ResourceAdapterInternalException:
resource adapter related error condition
EISSystemException:
internal error condition in EIS instance
equalsback to summary
public boolean equals(Object other)

Check if this ManagedConnectionFactory is equal to another ManagedConnectionFactory.

Returns:boolean

true if two instances are equal

getLogWriterback to summary
public PrintWriter getLogWriter() throws ResourceException

Get the log writer for this ManagedConnectionFactory instance.

The log writer is a character output stream to which all logging and tracing messages for this ManagedConnectionFactory instance will be printed

ApplicationServer manages the association of output stream with the ManagedConnectionFactory. When a ManagedConnectionFactory object is created the log writer is initially null, in other words, logging is disabled.

Returns:PrintWriter

PrintWriter

Exceptions
ResourceException:
generic exception
hashCodeback to summary
public int hashCode()

Returns the hash code for the ManagedConnectionFactory

Returns:int

hash code for the ManagedConnectionFactory

matchManagedConnectionsback to summary
public ManagedConnection matchManagedConnections(Set<E> connectionSet, Subject subject, ConnectionRequestInfo cxRequestInfo) throws ResourceException

Returns a matched connection from the candidate set of connections.

ManagedConnectionFactory uses the security info (as in Subject) and information provided through ConnectionRequestInfo and additional Resource Adapter specific criteria to do matching. Note that criteria used for matching is specific to a resource adapter and is not prescribed by the Connector specification.

This method returns a ManagedConnection instance that is the best match for handling the connection allocation request.

Parameters
connectionSet:Set<E>

candidate connection set

subject:Subject

caller's security information

cxRequestInfo:ConnectionRequestInfo

additional resource adapter specific connection request information

Returns:ManagedConnection

ManagedConnection if resource adapter finds an acceptable match otherwise null

Exceptions
ResourceException:
generic exception
SecurityException:
security related error
ResourceAdapterInternalException:
resource adapter related error condition
NotSupportedException:
if operation is not supported
setLogWriterback to summary
public void setLogWriter(PrintWriter out) throws ResourceException

Set the log writer for this ManagedConnectionFactory instance.

The log writer is a character output stream to which all logging and tracing messages for this ManagedConnectionfactory instance will be printed.

ApplicationServer manages the association of output stream with the ManagedConnectionFactory. When a ManagedConnectionFactory object is created the log writer is initially null, in other words, logging is disabled. Once a log writer is associated with a ManagedConnectionFactory, logging and tracing for ManagedConnectionFactory instance is enabled.

The ManagedConnection instances created by ManagedConnectionFactory "inherits" the log writer, which can be overridden by ApplicationServer using ManagedConnection.setLogWriter to set ManagedConnection specific logging and tracing.

Parameters
out:PrintWriter

PrintWriter - an out stream for error logging and tracing

Exceptions
ResourceException:
generic exception
ResourceAdapterInternalException:
resource adapter related error condition