JCA 接続ファクトリーの構成
Java™ EE Connector Architecture (JCA) 仕様に準拠する接続ファクトリーを構成することができます。
このタスクについて
注: Liberty プロファイルの JCA サポートを構成するには、WebSphere® Application Server Developer Tools for Eclipse のサーバー構成エディターの「ソース」ビュー、または他のテキスト・エディターを使用して server.xml ファイルを編集する必要があります。このトピックでは、MyAdapter という固有 ID を持つリソース・アダプターが既にサーバーに構成されていると想定しています。詳細については、リソース・アダプターの構成に関する資料を参照してください。以下のステップでは、基本シナリオの構成のエンドツーエンド・サンプルを提供します。
注: WebSphere® Development Tools (WDT) の「設計」ビューで接続ファクトリー、管理オブジェクト、アクティベーション・スペック、およびリソース・アダプターのサーバー構成のプロパティー・サブエレメントを編集することはサポートされていません。
手順
例
固有のインターフェース・クラス名を持つ 2 つの接続ファクトリーを含むリソース・アダプターの構成方法については、以下の例を使用してください。
ra.xml ファイルからの以下のスニペットで、MyAdapter リソース・アダプターは、固有のインターフェース・クラス名を持つ 2 つの接続ファクトリーを提供します。
<connection-definition>
<config-property>
<config-property-name>ServerName</config-property-name>
<config-property-type>java.lang.String</config-property-type>
</config-property>
<connectionfactory-interface>javax.resource.cci.ConnectionFactory</connectionfactory-interface>
<connectionfactory-impl-class>com.vendor.adapter.ConnectionFactoryImpl</connectionfactory-impl-class>
</connection-defintion>
<connection-definition>
<config-property>
<config-property-name>ServerName</config-property-name>
<config-property-type>java.lang.String</config-property-type>
</config-property>
<connectionfactory-interface>javax.sql.DataSource</connectionfactory-interface>
<connectionfactory-impl-class>com.vendor.adapter.DataSourceImpl</connectionfactory-impl-class>
</connection-defintion>
以下に、このシナリオのサーバー構成の例を示します。<connectionFactory jndiName="eis/cf">
<properties.MyAdapter.ConnectionFactory serverName="localhost"/>
</connectionFactory>
<connectionFactory jndiName="jdbc/ds">
<properties.MyAdapter.DataSource serverName="localhost"/>
</connectionFactory>
固有の実装クラス名を持つ 2 つの接続ファクトリーを含むリソース・アダプターの構成方法については、以下の例を使用してください。
ra.xml ファイルからの以下のスニペットで、MyAdapter リソース・アダプターは、固有の実装クラス名を持つ 2 つの接続ファクトリーを提供します。
<connection-definition>
<config-property>
<config-property-name>ServerName</config-property-name>
<config-property-type>java.lang.String</config-property-type>
</config-property>
<connectionfactory-interface>javax.resource.cci.ConnectionFactory</connectionfactory-interface>
<connectionfactory-impl-class>com.vendor.adapter.ConnectionFactoryImpl</connectionfactory-impl-class>
</connection-defintion>
<connection-definition>
<config-property>
<config-property-name>ServerName</config-property-name>
<config-property-type>java.lang.String</config-property-type>
</config-property>
<connectionfactory-interface>com.vendor.adapter.ConnectionFactory</connectionfactory-interface>
<connectionfactory-impl-class>com.vendor.adapter.MyConnectionFactoryImpl</connectionfactory-impl-class>
</connection-defintion>
以下に、このシナリオのサーバー構成の例を示します。<connectionFactory jndiName="eis/cf1">
<properties.MyAdapter.ConnectionFactoryImpl serverName="localhost"/>
</connectionFactory>
<connectionFactory jndiName="eis/cf2">
<properties.MyAdapter.MyConnectionFactoryImpl serverName="localhost"/>
</connectionFactory>
シンプル・インターフェース・クラス名または実装クラス名のいずれも固有でない 2 つの接続ファクトリーを持つリソース・アダプターの構成方法については、以下の例を使用してください。
ra.xml ファイルからの以下のスニペットで、MyAdapter リソース・アダプターは、シンプル・インターフェース・クラス名または実装クラス名のいずれも固有でない 2 つの接続ファクトリーを提供します。
<connection-definition>
<config-property>
<config-property-name>ServerName</config-property-name>
<config-property-type>java.lang.String</config-property-type>
</config-property>
<connectionfactory-interface>javax.resource.cci.ConnectionFactory</connectionfactory-interface>
<connectionfactory-impl-class>com.vendor.adapter.ConnectionFactoryImpl</connectionfactory-impl-class>
</connection-defintion>
<connection-definition>
<config-property>
<config-property-name>HostName</config-property-name>
<config-property-type>java.lang.String</config-property-type>
</config-property>
<connectionfactory-interface>com.vendor.adapter.custom.ConnectionFactory</connectionfactory-interface>
<connectionfactory-impl-class>com.vendor.adapter.custom.ConnectionFactoryImpl</connectionfactory-impl-class>
</connection-defintion>
以下に、このシナリオのサーバー構成の例を示します。<connectionFactory jndiName="eis/cci-cf">
<properties.MyAdapter.javax.resource.cci.ConnectionFactory serverName="localhost"/>
</connectionFactory>
<connectionFactory jndiName="eis/custom-cf">
<properties.MyAdapter.com.vendor.adapter.custom.ConnectionFactory hostName="localhost"/>
</connectionFactory>
構成エレメント名のサフィックスはオーバーライドできます。構成エレメント名のサフィックスのオーバーライド方法については、JCA 構成エレメントのカスタマイズに関する情報を参照してください。