I have written a JCA resource adapter before.
However, now I find myself in a position of having to write one solely to get access to the BootstrapContext and its associated WorkManager, and effectively for no other reason.
If I'm reading the specification correctly--and that's my question--it looks like if I want someone to be able to use my resource adapter in a spec-compliant fashion, I still need to implement ManagedConnectionFactory, because it would appear that only user connection factories vended by ManagedConnectionFactory implementations are eligible for injection via the @Resource annotation.
Go ahead, read it again; I'll wait. :-)
In a perfect world, I'd like to write my ResourceAdapter implementation, annotate it with @Connector, specify all the @ConfigProperty bits, pack it up in a .rar file, and be done with it.
However, it looks to me like the specification effectively mandates that all communication between the consumer (a stateless EJB in my case) and the resource adapter module is supposed to be accomplished through a user connection factory.
For example, section 6.10.1 says:
A resource adapter must provide implementations of the following interfaces:
- javax.resource.spi.ManagedConnectionFactory
- javax.resource.spi.ManagedConnection
- javax.resource.spi.ManagedConnectionMetaData
But section 18--the section on annotations--doesn't seem to provide for enforcing this in any meaningful way.
Is this indeed the case? I suppose it must be, but I'd be curious to hear from people who have put together a 1.6 resource adapter.