-
1. Re: Annotation for MC bean
alesj Apr 1, 2009 5:53 PM (in response to anil.saldhana)What exactly are you trying to do or miss?
-
2. Re: Annotation for MC bean
anil.saldhana Apr 1, 2009 6:10 PM (in response to anil.saldhana)I am trying to write an annotation called as Password (which will basically specify a name of a property). The PasswordCallback will basically read the annotation and then inject a password into the method configured in the annotation.
The JndiBindingCallback basically registers the target (mc bean) in JNDI.
The JMXCallback registers the bean in the MBean Server.
http://anonsvn.jboss.org/repos/jbossas/projects/microcontainer/trunk/aop-mc-int/src/main/java/org/jboss/aop/microcontainer/aspects/jndi/JndiLifecycleCallback.java
http://anonsvn.jboss.org/repos/jbossas/projects/microcontainer/trunk/aop-mc-int/src/main/java/org/jboss/aop/microcontainer/aspects/jmx/JMXLifecycleCallback.java
I applied my annotation on a mc bean. I get no error in the logs. I do not know whether it got applied. Break point unsuccessful. I am trying to find the missing hook that binds the JMX annotation and the JMXCallback. Something in the aop layer? -
3. Re: Annotation for MC bean
kabirkhan Apr 1, 2009 6:14 PM (in response to anil.saldhana)You need a 'lifecycle-xxx' element as well, 'xxx' being the state you want to handle. e.g. http://anonsvn.jboss.org/repos/jbossas/trunk/server/src/etc/conf/default/bootstrap/jmx.xml
-
4. Re: Annotation for MC bean
anil.saldhana Apr 1, 2009 6:24 PM (in response to anil.saldhana)"kabir.khan@jboss.com" wrote:
You need a 'lifecycle-xxx' element as well, 'xxx' being the state you want to handle. e.g. http://anonsvn.jboss.org/repos/jbossas/trunk/server/src/etc/conf/default/bootstrap/jmx.xml
There is the magic. Let me try that. :)
Maybe this needs to be documented some place. Once I get my annotation working, I will write a wiki entry for folks who have an itch to write a mc annotation. -
5. Re: Annotation for MC bean
anil.saldhana Apr 1, 2009 6:33 PM (in response to anil.saldhana)Kabir, do you know where the lifecycle declaration for the @JndiBinding annotation is?
-
6. Re: Annotation for MC bean
brian.stansberry Apr 1, 2009 6:50 PM (in response to anil.saldhana)There may not be one anywhere. I don't think @Jndi actually works. (Not that the code doesn't work if the lifecycle-xxx declaration is there; just that applying the annotation doesn't currently do anything.)
-
7. Re: Annotation for MC bean
anil.saldhana Apr 1, 2009 6:54 PM (in response to anil.saldhana)"bstansberry@jboss.com" wrote:
There may not be one anywhere. I don't think @Jndi actually works. (Not that the code doesn't work if the lifecycle-xxx declaration is there; just that applying the annotation doesn't currently do anything.)
I think the lifecycle declaration for JndiBinding does not exist. Until that happens, the annotation is not useful.
As I see it, the code for the lifecycle callbacks for JMX in the system folder are quite identical to the JMXCallback class.
Kabir, there are two sets of callback classes (one in the system folder and the other is the JMXCallback). The lifecycle declaration is for the former. I guess lifecycle declaration can be for the latter alone (I am going to try it out on my annotation). -
8. Re: Annotation for MC bean
brian.stansberry Apr 1, 2009 6:55 PM (in response to anil.saldhana)"bstansberry@jboss.com" wrote:
just that applying the annotation doesn't currently do anything.)
I should say it didn't do anything at one point in second half of last year; don't know about now. -
9. Re: Annotation for MC bean
brian.stansberry Apr 1, 2009 6:57 PM (in response to anil.saldhana)"anil.saldhana@jboss.com" wrote:
I think the lifecycle declaration for JndiBinding does not exist. Until that happens, the annotation is not useful.
Yep, that's what I meant. -
10. Re: Annotation for MC bean
anil.saldhana Apr 1, 2009 7:36 PM (in response to anil.saldhana)With the lifecycle registration, I can see that xxxLifecycleCallback methods for my annotation xxx are being called. So currently I can proceed with my annotation.
Kabir, regarding the @JMX annotation, maybe you want to change the lifecycle registration to aim at the JMXLifecycleCallback class rather than the call back methods from the system workspace. :) -
11. Re: Annotation for MC bean
alesj Apr 2, 2009 4:39 AM (in response to anil.saldhana)I know Galder experimented with @JNDI,
so he can tell us more. ;-) -
12. Re: Annotation for MC bean
kabirkhan Apr 2, 2009 5:57 AM (in response to anil.saldhana)"anil.saldhana@jboss.com" wrote:
"bstansberry@jboss.com" wrote:
There may not be one anywhere. I don't think @Jndi actually works. (Not that the code doesn't work if the lifecycle-xxx declaration is there; just that applying the annotation doesn't currently do anything.)
I think the lifecycle declaration for JndiBinding does not exist. Until that happens, the annotation is not useful.
As I see it, the code for the lifecycle callbacks for JMX in the system folder are quite identical to the JMXCallback class.
This was something Scott started, not sure if it is used or not."anil.saldhana@jboss.com" wrote:
Kabir, there are two sets of callback classes (one in the system folder and the other is the JMXCallback). The lifecycle declaration is for the former. I guess lifecycle declaration can be for the latter alone (I am going to try it out on my annotation).
Do you mean org.jboss.system.microcontainer.jmx.ServiceControllerXXXLifecycleCallback vs org.jboss.aop.microcontainer.aspects.jmx.JMXLifecycleCallback? JMXLifecycleCallback was the simple original version, the ServiceController ones are the next version for AS 5. -
13. Re: Annotation for MC bean
galder.zamarreno Apr 2, 2009 8:45 AM (in response to anil.saldhana)"bstansberry@jboss.com" wrote:
There may not be one anywhere. I don't think @Jndi actually works. (Not that the code doesn't work if the lifecycle-xxx declaration is there; just that applying the annotation doesn't currently do anything.)
@Jndi does not work but @JndiBinding does, see https://jira.jboss.org/jira/browse/JBAS-6502. To make sure this is clear, annotating a bean with @JndiBinding serializes the bean and puts it in the JNDI, it doesn't provide any remote access to the bean itself or anything similar :) -
14. Re: Annotation for MC bean
anil.saldhana Apr 2, 2009 10:33 AM (in response to anil.saldhana)Galder, did you add the lifecycle declaration to any of the xml configuration files?
Something like I am doing (not yet checked in):<deployment xmlns="urn:jboss:bean-deployer:2.0"> <!-- Support for @Password --> <lifecycle-configure xmlns="urn:jboss:aop-beans:1.0" name="PasswordRegistrationAdvice" class="org.jboss.security.integration.password.PasswordLifecycleCallback" classes="@org.jboss.security.integration.password.Password" manager-bean="AspectManager" manager-property="aspectManager"> </lifecycle-configure> <lifecycle-create xmlns="urn:jboss:aop-beans:1.0" name="PasswordCreateDestroyAdvice" class="org.jboss.security.integration.password.PasswordLifecycleCallback" classes="@org.jboss.security.integration.password.Password" manager-bean="AspectManager" manager-property="aspectManager"> </lifecycle-create> <lifecycle-install xmlns="urn:jboss:aop-beans:1.0" name="PasswordStartStopAdvice" class="org.jboss.security.integration.password.PasswordLifecycleCallback" classes="@org.jboss.security.integration.password.Password" manager-bean="AspectManager" manager-property="aspectManager"> </lifecycle-install>