This content has been marked as final.
Show 9 replies
-
1. Re: How to add Annotation Plugin?
alesj Dec 10, 2008 6:52 AM (in response to alrubinger)"alr" wrote:
Is there a better way where this approach may be avoided?
Register BeanAnnotationAdapter singleton instance as MC bean.
Then add its add/remove plugin methods as callbacks.
And register your custom EJB plugin as MC bean as well.
It will be then auto-magically :-) picked up by BAA. -
2. Re: How to add Annotation Plugin?
alrubinger Dec 10, 2008 12:49 PM (in response to alrubinger)Yes, was hoping for this auto-registration much like is done when installing a KernelRegistryPlugin (ie. picks up the interface and takes appropriate action).
So the following works:// Install the BeanAnnotationAdapter w/ callback to add annotation plugins on install BeanAnnotationAdapter beanAnnotationAdapter = BeanAnnotationAdapterFactory.getInstance() .getBeanAnnotationAdapter(); String beanAnnotationAdapterBindName = "ejb3.BeanAnnotationAdapter"; BeanMetaDataBuilder bmdb = BeanMetaDataBuilder.createBuilder(beanAnnotationAdapterBindName, beanAnnotationAdapter .getClass().getName()); bmdb.addMethodInstallCallback("addAnnotationPlugin"); controller.install(bmdb.getBeanMetaData(), beanAnnotationAdapter);
...course, I still gotta hardcode that "addAnnotationPlugin" method as a String... ;)
S,
ALR -
3. Re: How to add Annotation Plugin?
trustin Jan 12, 2009 12:52 PM (in response to alrubinger)Thanks ALR for sharing your code: http://tinyurl.com/7wjv78
Are the callbacks called only when an installed AnnotationPlugin is described in the same deployment, or are they called regardless of whether the installed plugins are described in a different deployment (i.e. different JAR / different beans.xml)? -
4. Re: How to add Annotation Plugin?
trustin Jan 12, 2009 12:53 PM (in response to alrubinger)Just for the record, here's ALR's blog post which explains this topic more in detail: http://tinyurl.com/9wwgx7
-
5. Re: How to add Annotation Plugin?
alrubinger Jan 12, 2009 12:55 PM (in response to alrubinger)"trustin" wrote:
Thanks ALR for sharing your code: http://tinyurl.com/7wjv78
I put it out there just hoping you'd find it. :)"trustin" wrote:
Are the callbacks called only when an installed AnnotationPlugin is described in the same deployment, or are they called regardless of whether the installed plugins are described in a different deployment (i.e. different JAR / different beans.xml)?
The callbacks are added for any deployment under the same Controller.
S,
ALR -
6. Re: How to add Annotation Plugin?
alrubinger Jan 12, 2009 12:56 PM (in response to alrubinger)"ALRubinger" wrote:
The callbacks are added for any deployment under the same Controller
So beware, you're actually altering MC's behaviour. I believe Ales made some mention of considering whether these callbacks should be made by default (so this bit wouldn't be needed)?
S,
ALR -
7. Re: How to add Annotation Plugin?
trustin Jan 12, 2009 1:21 PM (in response to alrubinger)"ALRubinger" wrote:
"ALRubinger" wrote:
The callbacks are added for any deployment under the same Controller
So beware, you're actually altering MC's behaviour. I believe Ales made some mention of considering whether these callbacks should be made by default (so this bit wouldn't be needed)?
If it modifies MC's global behavior, then I think it should be part of MC. Otherwise each 3rd party integration module will end up with trying to add the same annotation plugin. Or... I might be missing something. ;-) -
8. Re: How to add Annotation Plugin?
alesj Jan 13, 2009 5:36 AM (in response to alrubinger)"trustin" wrote:
If it modifies MC's global behavior, then I think it should be part of MC. Otherwise each 3rd party integration module will end up with trying to add the same annotation plugin. Or... I might be missing something. ;-)
I don't think this should be made directly into MC code.
Since you can easily do it via API or xml (as shown).
What I meant was to put this xml code in some high (early) deployment.
e.g. in JBossAS we should put it next to beans deployers
And I'll probably do this asap - in JBossAS and in MC demos. -
9. Re: How to add Annotation Plugin?
wolfc Feb 17, 2009 8:53 AM (in response to alrubinger)This bit:
<bean name="AnnotationHandlerFactory"> <constructor factoryClass="org.jboss.kernel.plugins.annotations.BeanAnnotationAdapterFactory" factoryMethod="getInstance" /> </bean> <bean name="AnnotationHandler"> <constructor factoryMethod="getBeanAnnotationAdapter"> <factory bean="AnnotationHandlerFactory"/> </constructor> <incallback method="addAnnotationPlugin" /> <uncallback method="removeAnnotationPlugin" /> </bean>
must go into the bootstrap. https://jira.jboss.org/jira/browse/JBAS-6514