1 2 Previous Next 15 Replies Latest reply on Mar 27, 2007 4:06 AM by alesj

    ServiceMBeanSupport in the Microcontainer world

    genman


      I'd like to port my application that uses the JMX Microkernel's ServiceMBeanSupport class to the Microcontainer so it might run under a different application server.

      Basically what I want to do is intercept the various start/stop MBean operation calls and have these translate into calls to the Microcontainer service controller.

      I think it would be useful to have a similar class available (perhaps as an standardized example) for those moving into the Microcontainer world. But I want to ask, is there something like this out there or in the works? If not, could somebody hash out how this might be written?

        • 1. Re: ServiceMBeanSupport in the Microcontainer world
          alesj

           

          "genman" wrote:

          Basically what I want to do is intercept the various start/stop MBean operation calls and have these translate into calls to the Microcontainer service controller.

          Intercept in what way?
          This is already handled by the 'legacy' ServiceControllerContext.

          "genman" wrote:

          I think it would be useful to have a similar class available (perhaps as an standardized example) for those moving into the Microcontainer world. But I want to ask, is there something like this out there or in the works? If not, could somebody hash out how this might be written?

          I don't understand your need for such class.
          It's all POJO, don't limit yourself.

          • 2. Re: ServiceMBeanSupport in the Microcontainer world
            genman


            Basically, I want to have the JMX "stop" and "start" operations to stop the Bean and its dependencies. Perhaps it doesn't require writing such a base class because you use AOP. Is this the case?

            • 3. Re: ServiceMBeanSupport in the Microcontainer world
              alesj

               

              "genman" wrote:

              Basically, I want to have the JMX "stop" and "start" operations to stop the Bean and its dependencies.

              That is there by default.
              Have a look at LifecycleMetaData.

              "genman" wrote:
              Perhaps it doesn't require writing such a base class because you use AOP. Is this the case?

              Yes, you don't need it. Ok, maybe for your internal 'type safe' lifecycle. But we certenly don't want to impose such interface on pojos.
              AOP is not the reason. ;-)


              • 4. Re: ServiceMBeanSupport in the Microcontainer world
                genman


                How do I deploy my Bean to the MBeanServer in MC 1.0? Is this a 2.0 feature? I don't see any examples or docs for this ...

                I'm taking a look at 2.0, which has no distribution, but I'm not sure how to build the package as a distribution. It creates stuff under output/build but does not include the various JBoss dependencies.

                • 5. Re: ServiceMBeanSupport in the Microcontainer world
                  alesj

                   

                  "genman" wrote:

                  How do I deploy my Bean to the MBeanServer in MC 1.0? Is this a 2.0 feature?

                  See previous posts.

                  "genman" wrote:

                  I don't see any examples or docs for this ...

                  There are none yet. We are working on it.
                  But there are plenty of TestCases in the project.

                  "genman" wrote:

                  I'm taking a look at 2.0, which has no distribution, but I'm not sure how to build the package as a distribution. It creates stuff under output/build but does not include the various JBoss dependencies.

                  Which dependencies?
                  If you are able to build, then you get those dependant libs in thirdparty directory.

                  • 6. Re: ServiceMBeanSupport in the Microcontainer world
                    genman

                    alesj -

                    Thanks for answering my asinine questions.

                    I'll fish out some examples, but it'd be nice (especially within my team) if I had some official documentation to work from.

                    I can build 2.0, which builds the jars in but I don't have a distribution to copy and share with my team. I can certainly copy stuff out of thirdparty that is runtime required, but there's stuff like Junit that I don't need.

                    • 7. Re: ServiceMBeanSupport in the Microcontainer world
                      alesj

                      Docs are on their way.
                      They will be there for 2.0.0.GA.

                      • 8. Re: ServiceMBeanSupport in the Microcontainer world
                        genman

                        Having referred to the examples, there doesn't seem to be a very straightforward way to install MBeans, ala Spring's framework, which isn't very easy to read.

                        <?xml version="1.0" encoding="UTF-8"?>
                        
                        <deployment xmlns="urn:jboss:bean-deployer:2.0">
                        
                         <bean name="MBeanServer" class="java.lang.Object">
                         <constructor factoryClass="javax.management.MBeanServerFactory" factoryMethod="createMBeanServer"/>
                         </bean>
                        
                         <bean name="Repository" class="org.jboss.metadata.plugins.repository.basic.BasicMetaDataRepository"/>
                        
                         <bean name="AspectManager" class="org.jboss.aop.AspectManager">
                         <constructor factoryClass="org.jboss.aop.AspectManager" factoryMethod="instance"/>
                         </bean>
                        
                         <aop:lifecycle-configure xmlns:aop="urn:jboss:aop-beans:1.0"
                         name="DependencyAdvice"
                         class="org.jboss.aop.microcontainer.aspects.jmx.JMXLifecycleCallback"
                         classes="@org.jboss.aop.microcontainer.aspects.jmx.JMX">
                         <property name="mbeanServer"><inject bean="MBeanServer"/></property>
                         </aop:lifecycle-configure>
                        
                         <bean name="Bean" class="org.jboss.test.microcontainer.support.SimpleBeanImpl">
                         <annotation>@org.jboss.aop.microcontainer.aspects.jmx.JMX(name="", exposedInterface=org.jboss.test.microcontainer.support.SimpleBean.class)</annotation>
                         </bean>
                        </deployment>
                        
                        


                        The problem with this XML is it has quite a lot of low-level "commands" which are somewhat a separate concern from the bean deployment.

                        I want to make my deployment file easier to edit and read, perhaps more modular ... Is there a notion of
                        <import>
                        in the bean deployer?

                        I have SVN access, would you support this sort of feature?


                        • 9. Re: ServiceMBeanSupport in the Microcontainer world
                          alesj

                          No need for this.
                          Just have a separate -beans.xml with your 'low-level "commands"'.
                          But be sure to include proper dependencies.

                          • 10. Re: ServiceMBeanSupport in the Microcontainer world
                            genman

                            One more question, regarding the new on demand feature ..

                            Does a call to ControllerContext.getTarget() demand-load the bean?


                            • 11. Re: ServiceMBeanSupport in the Microcontainer world
                              alesj

                               

                              "genman" wrote:

                              Does a call to ControllerContext.getTarget() demand-load the bean?

                              No.

                              OnDemand has other usage.

                              • 12. Re: ServiceMBeanSupport in the Microcontainer world
                                genman

                                How do you demand a service load then? I checked out the tests and it wasn't immediately clear.

                                • 13. Re: ServiceMBeanSupport in the Microcontainer world
                                  alesj

                                  Service load?

                                  • 14. Re: ServiceMBeanSupport in the Microcontainer world
                                    genman

                                    I mean service start ...

                                    1 2 Previous Next