[8.5.5.2 或更高版本]Liberty Repository

定制 JCA 配置元素

您可以定制在安装资源适配器时如何生成 JCA properties 子元素。

关于此任务

安装独立资源适配器或应用程序中嵌入的资源适配器时,可在 <resourceAdapter> 元素下添加一个或多个 <customize> 子元素,以针对指定接口类或实现类选择用于 properties 子元素的后缀。定制子元素可使您避免使用冗长 properties 子元素名称,但是,如果配置元素需要具有唯一名称,可能需要冗长名称。
注:

要添加 Liberty 概要文件的 JCA 支持,必须使用 WebSphere® Application Server Developer Tools for Eclipse 的服务器配置编辑器的“源代码”视图或某个其他文本编辑器来编辑 server.xml 文件。Beta 中不支持在“设计”视图中编辑连接工厂、管理对象、激活规范和资源适配器的配置的部分。

过程

  1. 对于独立资源适配器,使用要定制的现有配置启动。 例如,如果 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>
    <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>
  2. customize 子元素添加到 resourceAdapter,以便为两种连接工厂接口选择后缀。
    <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>
  3. 对于应用程序中嵌入的资源适配器,使用要定制的现有配置启动。 例如,假设您有一个应用程序 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>
  4. 针对应用程序中的资源适配器归档 (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>

用于指示主题类型的图标 任务主题

信息中心的条款和条件 | 反馈


时间戳记图标 最近一次更新时间: Wednesday, 2 September 2015
http://www14.software.ibm.com/webapp/wsbroker/redirect?version=phil&product=was-libcore-mp&topic=twlp_jca_config_custelements
文件名:twlp_jca_config_custelements.html