JCA 1.6 ResourceAdapter是否需要ManagedConnectionFactory? [英] Does a JCA 1.6 ResourceAdapter need a ManagedConnectionFactory?

查看:149
本文介绍了JCA 1.6 ResourceAdapter是否需要ManagedConnectionFactory?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我之前已经编写过 JCA资源适配器

然而,现在我发现自己只能编写一个来访问 BootstrapContext 及其相关的 WorkManager ,并且没有其他原因。

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.

如果我正确地阅读规范 - 这是我的问题 - 它看起来如果我希望某人能够以符合规范的方式使用我的资源适配器,我仍然需要实现 ManagedConnectionFactory ,因为它看来只有 ManagedConnectionFactory 实施的用户连接工厂才有资格通过 @Resource 注释进行注入。

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. :-)

在一个完美的世界里,我想编写我的 ResourceAdapter 实现,用<注释 @Connector ,指定所有 @ConfigProperty 位,将其打包在 .rar 文件,并完成它。

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.

然而,在我看来,规范有效地要求消费者之间的所有通信(无状态的EJB)我的情况)和资源适配器模块应该通过用户连接工厂完成。

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.

例如,第6.10.1节说:

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

但第18节 - 关于注释的部分 - 似乎没有提供e以任何有意义的方式执行此操作。

But section 18--the section on annotations--doesn't seem to provide for enforcing this in any meaningful way.

这是否确实如此?我想它一定是,但我很想听听那些已经组装1.6资源适配器的人。

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.

推荐答案

本节概述了连接管理合同的要求。

"This section outlines requirements for the connection management contract."


仅使用JCA 1.6注释来定义ResourceAdapter实现是否合法与 - 基本上 - 模块中没有别的东西?

Is it legal, using only JCA 1.6 annotations, to simply define a ResourceAdapter implementation with--basically--nothing else in the module?

是的。这很好。


规范在第19.2节中指出,出站资源适配器(这将是)必须{handwave handwave}使用连接管理,

The specification indicates in section 19.2 that an outbound resource adapter (which this would be) must {handwave handwave} make use of the connection management,

事务管理和安全管理合同。在所有三种情况下,我只想表明 - 最好省略注释和/或代码 - 我不支持其中任何一个

transaction management and security management contracts. In all three cases, I just want to indicate--preferably by omitting annotations and/or code--that I don't suppo'r't any of them

如果您不需要出站通信功能,则无需定义它们(连接工厂,管理连接工厂等)。

If you do not need outbound communication capabilities, you do not have to define them (connection-factory, managed-connection-factory etc.,)


只需构建一个实现ResourceAdapter的POJO,用@Connector注释它,然后从那里开始就足够了吗?

Is it sufficient to simply build a POJO that implements ResourceAdapter, annotate it with @Connector, and go from there?

是。


我可以使用@Resource注释将这样的POJO注入我的EJB吗?

Can I then inject such a POJO into my EJB using the @Resource annotation?

我不认为可以使用@Resource注释注入ResourceAdapterJava Bean。每当资源适配器被部署/启用/服务器启动时,

I do not think "ResourceAdapter" Java Bean can be injected using @Resource annotation. Whenever the resource-adapter is deployed / enabled / server is started,

GlassFish将引导资源适配器。

GlassFish will bootstrap the resource-adapter.

这篇关于JCA 1.6 ResourceAdapter是否需要ManagedConnectionFactory?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆