![[8.5.5.2 或更新版本]](../ng_v8552.gif)

自訂 JCA 配置元素
您可以自訂在安裝資源配接器時,產生 JCA 內容子元素的方法。
關於這項作業
註:
如果要新增 Liberty 設定檔的 JCA 支援,您必須使用 WebSphere® Application Server Developer Tools for Eclipse 的「伺服器配置」編輯器的「程式碼」視圖,或其他文字編輯器,來編輯 server.xml 檔。測試版不支援在「設計」視圖中編輯 Connection Factory、管理物件、啟動規格和資源配接器的部分配置。
程序
- 針對獨立式資源配接器,從您想要自訂的現有配置開始。 例如,如果資源配接器 MyAdapter 提供兩個 Connection Factory,其中簡式介面和實作類別名稱都不是唯一的:
<featureManager> <feature>jca-1.6</feature> <feature>jndi-1.0</feature> <!-- Add the jndi feature to enable look up of connection factories and administered objects. --> ... </featureManager> <resourceAdapter location="C:/adapters/MyAdapter.rar"/> <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>
- 新增 customize 子元素至 resourceAdapter,為這兩個 Connection Factory 介面選擇字尾。
<featureManager> <feature>jca-1.6</feature> <feature>jndi-1.0</feature> <!-- Add the jndi feature to enable look up of connection factories and administered objects. --> ... </featureManager> <resourceAdapter location="C:/adapters/MyAdapter.rar"> <customize interface="javax.resource.cci.ConnectionFactory" suffix="cci"/> <customize interface="com.vendor.adapter.custom.ConnectionFactory" suffix="custom"/> </resourceAdapter> <connectionFactory jndiName="eis/cci-cf"> <properties.MyAdapter.cci serverName="localhost"/> </connectionFactory> <connectionFactory jndiName="eis/custom-cf"> <properties.MyAdapter.custom hostName="localhost"/> </connectionFactory>
- 針對內嵌在應用程式中的資源配接器,從您想要自訂的現有配置開始。 例如,假設您的應用程式 app1 有一個名為 MyAdapter 的內嵌式資源配接器,如下所示:
<featureManager> <feature>jca-1.6</feature> <feature>jndi-1.0</feature> <!-- Add the jndi feature to enable look up of connection factories and administered objects. --> ... </featureManager> <application name="app1" type="ear" location="C:/applications/app1.ear"/> <adminObject jndiName="eis/interactionSpec-find"> <properties.app1.MyAdapter.javax.resource.cci.InteractionSpec-com.vendor.adapter.finder.InteractionSpecImpl resultSetType="1003"/> </adminObject> <adminObject jndiName="eis/interactionSpec-update"> <properties.app1.MyAdapter.com.vendor.adapter.InteractionSpec-com.vendor.adapter.updater.InteractionSpecImpl executionTimeout="3000"/> </adminObject>
- 為應用程式中的「資源配接器保存檔 (RAR)」模組指定 resourceAdapter 元素。將 id 屬性指定為 RAR 模組的模組名稱。新增 customize 子元素,為這兩個以介面或實作類別為基礎的受管理物件選擇字尾。 在此範例中,只有指定實作類別,這樣就足以識別受管理物件:
<featureManager> <feature>jca-1.6</feature> <feature>jndi-1.0</feature> <!-- Add the jndi feature to enable look up of connection factories and administered objects. --> ... </featureManager> <application name="app1" type="ear" location="C:/applications/app1.ear"> <resourceAdapter id="MyAdapter"> <customize implementation="com.vendor.adapter.finder.InteractionSpecImpl" suffix="finder"/> <customize implementation="com.vendor.adapter.updater.InteractionSpecImpl" suffix="updater"/> </resourceAdapter> </application> <adminObject jndiName="eis/interactionSpec-find"> <properties.app1.MyAdapter.finder resultSetType="1003"/> </adminObject> <adminObject jndiName="eis/interactionSpec-update"> <properties.app1.MyAdapter.updater executionTimeout="3000"/> </adminObject>
上層主題:
JCA 配置元素概觀
![[8.5.5.2 或更新版本]](../ng_v8552.gif)