ManagedConnectionFactory (Java EE 5)

Java EE API


javax.resource.spi Interface ManagedConnectionFactory

All Superinterfaces:
Serializable

public interface ManagedConnectionFactory
extends Serializable

Implements: java.io.Serializable

ManagedConnectionFactory 实例是 ManagedConnection 和特定于 EIS 连接工厂实例的工厂。此接口提供匹配和创建 ManagedConnection 实例的方法,以支持连接入池。ManagedConnectionFactory 实例必须是 JavaBean。
英文文档:

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.

Version:
0.6
Author:
Rahul Sharma
See Also:
ManagedConnection

Method Summary
 Object
 Object
 ManagedConnection
 boolean
 PrintWriter
 int
 ManagedConnection
 void
 

Method Detail

public Object createConnectionFactory(ConnectionManager cxManager) throws ResourceException
创建一个 Connection Factory 实例。Connection Factory 实例使用传递的 ConnectionManager 进行初始化。在托管情况下,ConnectionManager 由应用服务器提供。
cxManager 要与创建的 EIS 连接工厂实例关联的 ConnectionManager
return 特定于 EIS 的 Connection Factory 实例或 javax.resource.cci.ConnectionFactory 实例
ThrowsResourceException: 一般异常
ThrowsResourceAdapterInternalException: 与资源适配器有关的错误情况
英文文档:

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.

Parameters:
cxManager - ConnectionManager to be associated with created EIS connection factory instance
Returns:
EIS-specific Connection Factory instance or javax.resource.cci.ConnectionFactory instance
Throws:
ResourceException - Generic exception
ResourceAdapterInternalException - Resource adapter related error condition

public Object createConnectionFactory() throws ResourceException
创建一个 Connection Factory 实例。Connection Factory 实例使用资源适配器提供的默认 ConnectionManager 进行初始化。
return 特定于 EIS 的 Connection Factory 实例或 javax.resource.cci.ConnectionFactory 实例
ThrowsResourceException: 一般异常
ThrowsResourceAdapterInternalException: 与资源适配器有关的错误情况
英文文档:

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.

Returns:
EIS-specific Connection Factory instance or javax.resource.cci.ConnectionFactory instance
Throws:
ResourceException - Generic exception
ResourceAdapterInternalException - Resource adapter related error condition

public ManagedConnection createManagedConnection(javax.security.auth.Subject subject, ConnectionRequestInfo cxRequestInfo) throws ResourceException
创建一个连接底层 EIS 资源管理器的新物理连接。

ManagedConnectionFactory 使用安全信息(作为 Subject 传递)和其他 ConnectionRequestInfo(特定于 ResourceAdapter 并且对应用服务器不透明)创建此新连接。

subject 调用者的安全信息
cxRequestInfo 特定于其他资源适配器的连接请求信息
ThrowsResourceException: 一般异常
ThrowsSecurityException: 与安全有关的错误
ThrowsResourceAllocationException: 无法为连接请求分配系统资源
ThrowsResourceAdapterInternalException: 与资源适配器相关的错误情况
ThrowsEISSystemException: EIS 实例中的内部错误情况
return ManagedConnection 实例

英文文档:

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.

Parameters:
subject - Caller's security information
cxRequestInfo - Additional resource adapter specific connection request information
Returns:
ManagedConnection instance
Throws:
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

public ManagedConnection matchManagedConnections(java.util.Set<E> connectionSet, javax.security.auth.Subject subject, ConnectionRequestInfo cxRequestInfo) throws ResourceException
返回候选连接集中的匹配连接。

ManagedConnectionFactory 使用安全信息(如 Subject 中的信息)、通过 ConnectionRequestInfo 提供的信息以及特定于其他资源适配器的标准执行匹配。注意,用于匹配的标准是特定于资源适配器的,不是 Connector 规范指定的。

此方法返回一个 ManagedConnection 实例,该实例是处理连接分配请求的最佳匹配。

connectionSet 候选连接集
subject 调用者的安全信息
cxRequestInfo 特定于其他资源适配器的连接请求信息
ThrowsResourceException: 一般异常
ThrowsSecurityException: 与安全有关的错误
ThrowsResourceAdapterInternalException: 与资源适配器相关的错误情况
ThrowsNotSupportedException: 如果不支持该操作
return 如果资源适配器找到一个可接受的匹配项,则返回 ManagedConnection;否则返回 null
英文文档:

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.

Parameters:
connectionSet - candidate connection set
subject - caller's security information
cxRequestInfo - additional resource adapter specific connection request information
Returns:
ManagedConnection if resource adapter finds an acceptable match otherwise null
Throws:
ResourceException - generic exception
SecurityException - security related error
ResourceAdapterInternalException - resource adapter related error condition
NotSupportedException - if operation is not supported

public void setLogWriter(java.io.PrintWriter out) throws ResourceException
设置此 ManagedConnectionFactory 实例的日志 writer。

日志 writer 是一个字符输出流,此 ManagedConnectionfactory 实例的所有记录和跟踪消息都将打印到该输出流。

ApplicationServer 管理输出流与 ManagedConnectionFactory 的关联。创建 ManagedConnectionFactory 对象时,日志 writer 最初为 null,即禁用日志记录。将日志 writer 与 ManagedConnectionFactory 关联之后,将启用 ManagedConnectionFactory 实例的记录和跟踪。

ManagedConnectionFactory 创建的 ManagedConnection 实例“继承”该日志 writer,ApplicationServer 可以使用 ManagedConnection.setLogWriter 将其重写,以设置特定于 ManagedConnection 的记录和跟踪。

英文文档:

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.

Parameters:
out - PrintWriter - an out stream for error logging and tracing
Throws:
ResourceException - generic exception
ResourceAdapterInternalException - resource adapter related error condition

public java.io.PrintWriter getLogWriter() throws ResourceException
获取此 ManagedConnectionFactory 实例的日志 writer。

日志 writer 是一个字符输出流,此 ManagedConnectionFactory 实例的所有记录和跟踪消息都将打印到该输出流。

ApplicationServer 管理输出流与 ManagedConnectionFactory 的关联。创建 ManagedConnectionFactory 对象时,日志 writer 最初为 null,即禁用日志记录。

return
PrintWriter
ThrowsResourceException: 一般异常

英文文档:

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.

Returns:
PrintWriter
Throws:
ResourceException - generic exception

public int hashCode()
返回 ManagedConnectionFactory 的哈希码
return ManagedConnectionFactory 的哈希码
英文文档:

hashCode

int hashCode()
Returns the hash code for the ManagedConnectionFactory

Overrides:
hashCode in class Object
Returns:
hash code for the ManagedConnectionFactory

public boolean equals(Object other)
检查此 ManagedConnectionFactory 是否等于另一个 ManagedConnectionFactory。
return 如果两个实例相等,则返回 true
英文文档:

equals

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

Overrides:
equals in class Object
Returns:
true if two instances are equal


Submit a bug or feature

Copyright 2007 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms.

一看就知道只有菜鸟才干这么无知的事啦。

PS : 未经我党受权你也可自由散发此文档。 如有任何错误请自行修正;若因此而造成任何损失请直接找人民主席,请勿与本人联系。谢谢!