ManagedConnectionFactory (Java EE 5 SDK)

Java

Java EE 5 SDK

深圳电信培训中心.徐海蛟老师.


javax.resource.spi Interface ManagedConnectionFactory

所有父接口:
Serializable

public interface ManagedConnectionFactory
extends Serializable

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.

版本:
0.6
作者:
Rahul Sharma
另请参见:
ManagedConnection

方法摘要
 Object createConnectionFactory()
          Creates a Connection Factory instance.
 Object createConnectionFactory(ConnectionManager cxManager)
          Creates a Connection Factory instance.
 ManagedConnection createManagedConnection(Subject subject, ConnectionRequestInfo cxRequestInfo)
          Creates a new physical connection to the underlying EIS resource manager.
 boolean equals(Object other)
          Check if this ManagedConnectionFactory is equal to another ManagedConnectionFactory.
 PrintWriter getLogWriter()
          Get the log writer for this ManagedConnectionFactory instance.
 int hashCode()
          Returns the hash code for the ManagedConnectionFactory
 ManagedConnection matchManagedConnections(Set connectionSet, Subject subject, ConnectionRequestInfo cxRequestInfo)
          Returns a matched connection from the candidate set of connections.
 void setLogWriter(PrintWriter out)
          Set the log writer for this ManagedConnectionFactory instance.
 

方法详细信息

createConnectionFactory

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.

参数:
cxManager - ConnectionManager to be associated with created EIS connection factory instance
返回:
EIS-specific Connection Factory instance or javax.resource.cci.ConnectionFactory instance
抛出异常:
ResourceException - Generic exception
ResourceAdapterInternalException - Resource adapter related error condition

createConnectionFactory

Object createConnectionFactory()
                               throws ResourceException
Creates a Connection Factory instance. The Connection Factory instance gets initialized with a default ConnectionManager provided by the resource adapter.

返回:
EIS-specific Connection Factory instance or javax.resource.cci.ConnectionFactory instance
抛出异常:
ResourceException - Generic exception
ResourceAdapterInternalException - Resource adapter related error condition

createManagedConnection

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.

参数:
subject - Caller's security information
cxRequestInfo - Additional resource adapter specific connection request information
返回:
ManagedConnection instance
抛出异常:
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

matchManagedConnections

ManagedConnection matchManagedConnections(Set 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.

参数:
connectionSet - candidate connection set
subject - caller's security information
cxRequestInfo - additional resource adapter specific connection request information
返回:
ManagedConnection if resource adapter finds an acceptable match otherwise null
抛出异常:
ResourceException - generic exception
SecurityException - security related error
ResourceAdapterInternalException - resource adapter related error condition
NotSupportedException - if operation is not supported

setLogWriter

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.

参数:
out - PrintWriter - an out stream for error logging and tracing
抛出异常:
ResourceException - generic exception
ResourceAdapterInternalException - resource adapter related error condition

getLogWriter

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.

返回:
PrintWriter
抛出异常:
ResourceException - generic exception

hashCode

int hashCode()
Returns the hash code for the ManagedConnectionFactory

重写:
hashCode in class Object
返回:
hash code for the ManagedConnectionFactory

equals

boolean equals(Object other)
Check if this ManagedConnectionFactory is equal to another ManagedConnectionFactory.

重写:
equals in class Object
返回:
true if two instances are equal

Java EE 5 SDK

深圳电信培训中心.徐海蛟老师.


提交错误或意见

版权所有 2007 Sun Microsystems, Inc. 保留所有权利。 请遵守许可证条款。深圳电信培训中心.徐海蛟老师教学参考.