You can customize how JCA properties subelements are generated
when installing a resource adapter.
About this task
When you install a stand-alone resource adapter or a resource
adapter that is embedded in an application, you can add one or more
<customize> subelements under the <resourceAdapter>
element to choose the suffix that is used for the properties subelement
for the specified interface or implementation class. Customizing subelement
enables you to avoid lengthy properties subelement names that might
otherwise be required for the configuration elements to have unique
names. Note:
To add JCA support for Liberty, you must edit the server.xml file using
either the Source view of the Server configuration editor of the WebSphere® Application Server Developer Tools for Eclipse, or some other text
editor. Editing portions of the configuration for connection factories, administrative objects,
activation specifications, and resource adapters in the Design view is not supported in the
Beta.
Procedure
- For a stand-alone resource adapter, start with the existing
configuration that you want to customize.
For example,
if a resource adapter
MyAdapter provides two
connection factories, where neither the simple interface nor implementation
class names are unique:
<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>
- Add
customize subelements to the resourceAdapter to
choose the suffixes for both of the connection factory interfaces.
<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>
- For a resource adapter that is embedded in an application,
start with the existing configuration that you want to customize.
For example, assume that you have an application
app1 with
an embedded resource adapter named
MyAdapter as
follows:
<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>
- Specify a
resourceAdapter element for
the Resource Adapter Archive (RAR) module in the application. Specify
the id attribute to be the module name of the RAR module. Add customize subelements
to choose the suffixes for both of the administered objects that are
based on the interface or implementation class. In
this example, only the implementation class is specified, which is
sufficient to identify the administered objects:
<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>