ConnectionFactory (Java EE 5)

Java EE API


javax.xml.registry Class ConnectionFactory

java.lang.Object
  extended by javax.xml.registry.ConnectionFactory

public abstract class ConnectionFactory
extends Object


此类是用于创建 JAXR 连接的工厂类的抽象基类。JAXR ConnectionFactory 对象是以特定于提供者的方式配置的,用于创建与注册表提供者的连接。

使用 JNDI API 查找 ConnectionFactory

客户端查找 JAXR ConnectionFactory 的首选方法在 Java Naming and Directory InterfaceTM (JNDI) API 中。ConnectionFactory 对象以特定于提供者的方式向命名服务注册,比如基于 JNDI API 的服务。此注册将 ConnectionFactory 对象与逻辑名称关联。当应用程序想与提供者(该提供者与 ConnectionFactory 对象关联)建立连接时,它根据提供的逻辑名称进行查找。然后应用程序可以使用返回的 ConnectionFactory 对象创建与消息传递提供者的连接。

不使用 JNDI API 查找 ConnectionFactory

JAXR API 提供了查找 JAXR ConnectionFactory 的替代方法,该方法不需要使用 JNDI API。此方法对 JAXR API 提供的抽象类 ConnectionFactory 使用 newInstance 静态方法实现查找。newInstance 方法返回一个 JAXR ConnectionFactory。客户端可以定义系统属性 javax.xml.registry.ConnectionFactoryClass,以指示 newInstance 方法应该实例化哪个工厂类。如果没有设置此属性,则 JAXR 提供者必须返回默认 ConnectionFactory 实例。
英文文档:

This is the abstract base class for factory classes for creating a JAXR connection. A JAXR ConnectionFactory object is configured in a provider-specific way to create connections with registry providers.

Looking Up a ConnectionFactory Using the JNDI API

The preferred way for a client to look up a JAXR ConnectionFactory is within the Java Naming and Directory InterfaceTM (JNDI) API. A ConnectionFactory object is registered with a naming service in a provider specific way, such as one based on the JNDI API. This registration associates the ConnectionFactory object with a logical name. When an application wants to establish a connection with the provider associated with that ConnectionFactory object, it does a lookup, providing the logical name. The application can then use the ConnectionFactory object that is returned to create a connection to the messaging provider.

Looking Up a ConnectionFactory Without Using the JNDI API

The JAXR API provides an alternative way to look up a JAXR ConnectionFactory that does not require the use of the JNDI API. This is done using the newInstance static method on the abstract class ConnectionFactory provided in the JAXR API. The newInstance method returns a JAXR ConnectionFactory. The client may indicate which factory class should be instantiated by the newInstance method by defining the system property javax.xml.registry.ConnectionFactoryClass. If this property is not set, the JAXR provider must return a default ConnectionFactory instance.

Author:
Farrukh S. Najmi
See Also:
Connection

Constructor Summary
 
Method Summary
abstract  Connection
abstract  FederatedConnection
abstract  Properties
static ConnectionFactory
abstract  void
 
Methods inherited from class java.lang.Object
 

Constructor Detail

public ConnectionFactory()
英文文档:

ConnectionFactory

public ConnectionFactory()
Method Detail

abstract public void setProperties(java.util.Properties properties) throws JAXRException
设置调用 createConnection 和 createFederatedConnection 期间使用的属性。

标准连接属性:
javax.xml.registry.queryManagerURL - 用于目标注册表提供者中的查询管理器服务的 URL String
javax.xml.registry.lifeCycleManagerURL - 用于目标注册表提供者中的生命周期管理器服务的 URL String。如果未指定,则必须使用上文描述的 queryManagerURL 的默认值
javax.xml.registry.semanticEquivalences - 遵守语义等价规范的 String
javax.xml.registry.security.authenticationMethod - 为 JAXR 提供者提供提示的 String,该提示关于使用注册表提供者进行验证时将使用的验证方法。可能的值包括但不限于 "UDDI_GET_AUTHTOKEN"、"HTTP_BASIC"、"CLIENT_CERTIFICATE" 和 "MS_PASSPORT"
javax.xml.registry.uddi.maxRows - 指定将为查找操作返回的最大行数的整数。此属性特定于 UDDI 提供者
javax.xml.registry.postalAddressScheme - 指定 ClassificationScheme ID 的 String,该 ClassificationScheme 用作此连接的默认邮政地址方案

功能级别:0
properties 配置属性,该属性由 JAXR 规范指定,也可以是特定于提供者的。
ThrowsJAXRException: 如果 JAXR 提供者遇到内部错误
英文文档:

setProperties

public abstract void setProperties(Properties properties)
                            throws JAXRException
Sets the Properties used during createConnection and createFederatedConnection calls.

Standard Connection Properties:
javax.xml.registry.queryManagerURL - URL String for the query manager service within the target registry provider
javax.xml.registry.lifeCycleManagerURL - URL String for the life cycle manager service within the target registry provider. If unspecified, must default to value of the queryManagerURL described above
javax.xml.registry.semanticEquivalences - String that allows specification of semantic equivalences
javax.xml.registry.security.authenticationMethod - string that provides a hint to the JAXR provider on the authentication method to be used when authenticating with the registry provider. Possible value include but are not limited to "UDDI_GET_AUTHTOKEN", "HTTP_BASIC", "CLIENT_CERTIFICATE", "MS_PASSPORT"
javax.xml.registry.uddi.maxRows - integer that specifies the maximum number of rows to be returned for find operations. This property is specific for UDDI providers
javax.xml.registry.postalAddressScheme - String that specifies the id of a ClassificationScheme that is used as the default postal address scheme for this connection

Capability Level: 0

Parameters:
properties - configuration properties that are either specified by JAXR specification or are provider specific.
Throws:
JAXRException - If the JAXR provider encounters an internal error

abstract public java.util.Properties getProperties() throws JAXRException
获取调用 createConnection 和 createFederatedConnection 期间使用的属性。

功能级别:0
return 为此对象定义的属性
ThrowsJAXRException: 如果 JAXR 提供者遇到内部错误
英文文档:

getProperties

public abstract Properties getProperties()
                                  throws JAXRException
Gets the Properties used during createConnection and createFederatedConnection calls.

Capability Level: 0

Returns:
the Properties defined for this object
Throws:
JAXRException - If the JAXR provider encounters an internal error

abstract public Connection createConnection() throws JAXRException
创建指定连接。这类连接可用于与 JAXR 提供者进行通信。

功能级别:0
return 此调用创建的 Connection
ThrowsJAXRException: 如果 JAXR 提供者遇到内部错误
link
dependency
label
creates
associates <{Connection}>
英文文档:

createConnection

public abstract Connection createConnection()
                                     throws JAXRException
Create a named connection. Such a connection can be used to communicate with a JAXR provider.

Capability Level: 0

Returns:
the Connection created by this call
Throws:
JAXRException - If the JAXR provider encounters an internal error

abstract public FederatedConnection createFederatedConnection(java.util.Collection<E> connections) throws JAXRException
创建一个 FederatedConnection。

功能级别:0(可选)
connections Connection 对象所组成的 Collection。注意,Connection 对象也可以是 FederatedConnection 对象。
return 此调用创建的 FederatedConnection
ThrowsJAXRException: 如果 JAXR 提供者遇到内部错误
link
dependency
label
creates
associates <{Federation}>
英文文档:

createFederatedConnection

public abstract FederatedConnection createFederatedConnection(Collection connections)
                                                       throws JAXRException
Create a FederatedConnection.

Capability Level: 0 (optional)

Parameters:
connections - Is a Collection of Connection objects. Note that Connection objects may also be FederatedConnection objects.
Returns:
the FederatedConnection created by this call
Throws:
JAXRException - If the JAXR provider encounters an internal error

public static ConnectionFactory newInstance() throws JAXRException
创建默认 ConnectionFactory 对象。
return 新的 ConnectionFactory 实例
ThrowsJAXRException: 如果 JAXR 提供者遇到内部错误
英文文档:

newInstance

public static ConnectionFactory newInstance()
                                     throws JAXRException
Creates a default ConnectionFactory object.

Returns:
a new instance of a ConnectionFactory
Throws:
JAXRException - If the JAXR provider encounters an internal error


Submit a bug or feature

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

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

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