[jboss-dev-forums] [JBoss AS7 Development] - Custom resource adapter and MDB
Takayoshi Kimura
do-not-reply at jboss.com
Tue Aug 9 01:56:01 EDT 2011
Takayoshi Kimura [http://community.jboss.org/people/tkimura] created the discussion
"Custom resource adapter and MDB"
To view the discussion, visit: http://community.jboss.org/message/620023#620023
--------------------------------------------------------------
Hi,
I'm using AS7 head (7.1.0.Alpha1-SNAPSHOT) and I've created a basic resource adapter for twitter and an MDB. The files are twitter-ra.rar and twittermdb.jar. My code is hosted at GitHub https://github.com/nekop/twitter-resource-adapter https://github.com/nekop/twitter-resource-adapter .
There are 2 issues in EJBUtilities.
1. When I put those files in the standalone/deployment directory the MDB deployment failed with the following exception:
java.lang.IllegalStateException: Not found RA registered as twitter-ra
EJBUtilities tries to find a corresponding rar in the following way:
for (String id : getMdr().getResourceAdapters()) {
if (getMdr().getRoot(id).getName().indexOf(resourceAdapterName) != -1) {
but this doesn't work because the File#getName() method of the deployment root File returns just "content". It's not a rar name.
2. @ResourceAdapter("twitter-ra.rar") doesn't work but @ResourceAdapter("twitter-ra") works
Because the resource adapter id is "twitter-ra". I thought we support both with and without ".rar".
What's the design behind the current logic? Could it be a problem if we replaced the code with the following?
String resourceAdapterId =
resourceAdapterName.endsWith(".rar") ?
resourceAdapterName.substring(0, resourceAdapterName.length() - ".rar".length()) :
resourceAdapterName;
if (!raFound && getMdr().getResourceAdapter(resourceAdapterId) != null) {
ResourceAdapter ra = getMdr().getResourceAdapter(resourceAdapterId).getResourceadapter();
if (ra instanceof ResourceAdapter1516
&& ((ResourceAdapter1516) ra).getInboundResourceadapter() != null) {
String className = ((ResourceAdapter1516) ra).getResourceadapterClass();
if (className.lastIndexOf(".") != -1)
packageName = className.substring(0, className.lastIndexOf("."));
else
packageName = "";
raFound = true;
}
}
Thanks,
Takayoshi
--------------------------------------------------------------
Reply to this message by going to Community
[http://community.jboss.org/message/620023#620023]
Start a new discussion in JBoss AS7 Development at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2225]
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-dev-forums/attachments/20110809/292a3d6e/attachment.html
More information about the jboss-dev-forums
mailing list