1.1 Preliminary Decision: Uni-Directional or Bidirectional Adapter?

When creating a Custom Adapter, the first decision you need to make is to decide if the Custom Adapter will be uni-directional or bidirectional-will it support invocation for outbound (synchronous) operations-that is, through the JCA Common Client (CCI) API. Alternatively, should the Adapter support both outbound and inbound (asynchronous) message flow?

Once you make this decision and then create a Custom Adapter that supports outbound and inbound message flow, it is important to know that:

  • To support outbound message flow, the adapter needs to define one or more implementations of javax.resource.cci.InteractionSpec.

  • To support inbound message flow, the adapter needs to define one or more implementations of javax.resource.spi.ActivationSpec.

Each of these specs (Java Beans) provide metadata as name/value pairs that define a specific operation that your adapter intends to support.

For example, for an FTP adapter, the interaction spec exposes a bean property named Directory. When the FTP adapter is invoked, the invoker can instruct the adapter to place the payload in a specific directory, by setting the interaction spec property Directory - for example, by setting FtpInteractionSpec.setDirectory("/tmp/receive")

If the adapter supports different kinds or categories of invocations, which each require a different set of properties, you can model each invocation type by a distinct implementation of javax.resource.cci.InteractionSpec.

For example. the adapter might further implement SshFtpInteractionSpec and SSLFtpInteractionSpec, with the first interaction spec supporting the S-FTP protocol and the second interaction spec supporting the FTP/S protocol.

Knowing this information, and the potential use of your Adapter in terms of the operations it supports, is a helpful first step in your customization.