1 2 Previous Next 19 Replies Latest reply on Mar 5, 2007 11:14 AM by vickyk

    Evaluating IOC Containers

    deaddowney

      I'm in the process of evaluating a few IOC frameworks for building applications. My requirements are:

      1. Support for creating/wiring up POJO's using XML configuration
      2. Support for breaking out configuration across multiple components
      3. Support for "discovery" of deployed components by container (not hard coded in a startup script or xml file)
      4. Lifecycle management
      5. Dependency management
      6. JMX interface for deployed components if desired
      7. Special Classloader to find jars in a specified directory so that startup scripts are minimal

      JBoss microcontainer seems to support the first 5 requirements nicely, but perhaps not the last 2, which perhaps are meant to be built on top of the microcontainer.

      Does JBoss offer addons to provide support for the last 2 items? I know JBoss AS does these 2 things, but is the microcontainer integrated with the MBeanServer and JBoss classloader? Basically I'm looking for the traditional JBoss microkernel with POJO support. Does such a thing exist yet?

      Thanks,
      Adam

        • 2. Re: Evaluating IOC Containers
          eknathkadam

           

          "bkeh12" wrote:
          6. JMX interface for deployed components if desired
          http://jira.jboss.com/jira/secure/IssueNavigator.jspa?reset=true&mode=hide&sorter/order=DESC&sorter/field=priority&resolutionIds=-1&pid=12310060&fixfor=12310587


          I clicked this link but found nothing, any update on point 6 ?

          • 3. Re: Evaluating IOC Containers
            alesj

             

            "eknathkadam" wrote:
            "bkeh12" wrote:
            6. JMX interface for deployed components if desired
            http://jira.jboss.com/jira/secure/IssueNavigator.jspa?reset=true&mode=hide&sorter/order=DESC&sorter/field=priority&resolutionIds=-1&pid=12310060&fixfor=12310587

            I clicked this link but found nothing, any update on point 6 ?


            Yes.
            It is there for a while now.
            Already used with JBoss5 clustering support.

            See this issues:
            - JMXDecoratedTestCase in MC testing
            - http://www.jboss.org/index.html?module=bb&op=viewtopic&t=94154&start=0
            - http://www.jboss.org/index.html?module=bb&op=viewtopic&t=102792

            • 4. Re: Evaluating IOC Containers
              vickyk

               

              org.jboss.aop.advice.AdviceBinding binding = new AdviceBinding("execution(POJO->new(..))", null);
               binding.addInterceptor(SimpleInterceptor.class);
               AspectManager.instance().addBinding(binding);

              All we need to do is to have the above code formed through the xml file when using the MC . Am I right ?

              And logically the Interceptor will
              1) Read the annotation data of the POJO .
              2) Get the MBeanServer .
              3) Register the POJO in the MBeanServer .

              Am I missing something here ?


              • 5. Re: Evaluating IOC Containers
                alesj

                 

                "vickyk" wrote:

                All we need to do is to have the above code formed through the xml file when using the MC . Am I right ?

                Yes, see how this is done in JMXDecoratedTestCase.(java|xml).
                And this can be simplified now - less aop xml code.

                • 6. Re: Evaluating IOC Containers
                  alesj

                   

                  "alesj" wrote:
                  And this can be simplified now - less aop xml code.

                  See JMXLifecycleTestCase.xml.

                  • 7. Re: Evaluating IOC Containers
                    eknathkadam

                    I believe all this JMX support is for microcontainer that is supplied with Jboss5, I think the MC release is 2.0, is there any JMX support in prior release, the one supplied with Jboss 4.x (release 1.0, I guss.) ?

                    • 8. Re: Evaluating IOC Containers
                      alesj

                      Can you look if KernelControllerContextAware interface is present with v1.0?

                      • 9. Re: Evaluating IOC Containers
                        alesj

                        Or you can always add a MBean Exporter kind of bean.
                        Inject MBean server bean into it and all the beans that you want to export (along with ObjectName and exposed interface info).
                        There is no 'exporter' impl within MC, but you can probably use this one (with slight modifications) http://www.springframework.org/docs/api/org/springframework/jmx/export/MBeanExporter.html.

                        • 10. Re: Evaluating IOC Containers
                          eknathkadam

                           

                          "alesj" wrote:
                          Can you look if KernelControllerContextAware interface is present with v1.0?


                          Yes, it is present with v1.0

                          • 11. Re: Evaluating IOC Containers
                            alesj

                            Ok, I had some idea, but it is far uglier than the one with exporter.
                            Never mind about KCCA in v1.0.
                            Try with exporter.

                            Or what's the problem updating MC to v2.0(beta)?

                            • 12. Re: Evaluating IOC Containers
                              eknathkadam

                              Thanks for the response.
                              Eventually we would start using v2.0, but that also means Jboss5, for which we will have to wait for sometime untill GA is out.

                              • 13. Re: Evaluating IOC Containers
                                alesj

                                JBoss5_Beta2 is about to be released.
                                MC features are quite polished there.
                                Or maybe you can port MC v2.0 to replace v1.0 in JBoss4.

                                • 14. Re: Evaluating IOC Containers
                                  vickyk

                                   

                                  "alesj" wrote:
                                  "vickyk" wrote:

                                  All we need to do is to have the above code formed through the xml file when using the MC . Am I right ?

                                  Yes, see how this is done in JMXDecoratedTestCase.(java|xml).
                                  And this can be simplified now - less aop xml code.


                                  After looking into the JMXDecoratedTestCase I have found this
                                  <beanfactory name="MetaDataContextAdvice" class="org.jboss.test.microcontainer.support.MetaDataContextInterceptor">
                                   <property name="annotation">org.jboss.aop.microcontainer.aspects.jmx.JMX</property>
                                   </beanfactory>
                                  

                                  What does this precisely do ?

                                  I have prepared a POJO , I have prepared a jar of that and dropped in the server/default/lib as pojo.jar . The pojo.jar contains the required POJO .
                                  The step where I am getting stuck is how to configure the pojo-beans.xml for the POJO
                                  I am not able to understand what to have instead of this
                                  <beanfactory name="MetaDataContextAdvice" class="org.jboss.test.microcontainer.support.MetaDataContextInterceptor">
                                   <property name="annotation">org.jboss.aop.microcontainer.aspects.jmx.JMX</property>
                                   </beanfactory>
                                  


                                  Here goes my pojo-beans.xml contents
                                  <?xml version="1.0" encoding="UTF-8"?>
                                  
                                  <!-- deployment xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                                   xsi:schemaLocation="urn:jboss:bean-deployer bean-deployer_2_0.xsd"
                                   xmlns="urn:jboss:bean-deployer:2.0" -->
                                  <deployment xmlns="urn:jboss:bean-deployer:2.0">
                                  
                                  
                                   <!-- bean name="AspectManager" class="org.jboss.aop.AspectManager">
                                   <constructor factoryClass="org.jboss.aop.AspectManager" factoryMethod="instance"/>
                                   </bean -->
                                  
                                   <beanfactory name="MetaDataContextAdvice" class="org.jboss.test.microcontainer.support.MetaDataContextInterceptor/???????">
                                   <property name="annotation">org.jboss.aop.microcontainer.aspects.jmx.JMX</property>
                                   </beanfactory>
                                  
                                   <bean name="MetaDataContextAspect" class="org.jboss.aop.microcontainer.beans.Aspect">
                                   <property name="advice"><inject bean="MetaDataContextAdvice"/></property>
                                   <property name="manager"><inject bean="AspectManager"/></property>
                                   </bean>
                                  
                                   <bean name="MetaDataContextBinding" class="org.jboss.aop.microcontainer.beans.AspectBinding">
                                   <property name="pointcut">execution(* org.jboss.test.microcontainer.support.SimpleBeanImpl->*(..))</property>
                                   <property name="aspect"><inject bean="MetaDataContextAspect" property="definition"/></property>
                                   <property name="manager"><inject bean="AspectManager"/></property>
                                   </bean>
                                  
                                   <bean name="SimplePojo" class="org.jboss.mc.SimplePojo">
                                  
                                   <!-- FIXME restore the property replacement on the partition name once JBMICROCONT-143 is fixed -->
                                   <annotation>@org.jboss.aop.microcontainer.aspects.jmx.JMX(name="jboss:service=POJO", exposedInterface=org.jboss.mc.SimplePojoMBean.class, registerDirectly=true)</annotation>
                                   </bean>
                                  
                                  </deployment>


                                  What should be the entry for the beanfactory's classname in the pojo-beans.xml which I have pasted above? Looks like I need to write some class specific to POJO here or I can use some standard one from the Jboss itself ?



                                  1 2 Previous Next