6 Replies Latest reply on May 25, 2005 9:32 AM by adrian.brock

    Need advice for AOP/Microcontainer XML integration

    bill.burke

      I'm currently writing a JBossXB implementation for AOP XML and wondering what approach I should take. Should I use the ObjectModelFactory or the SchemaBinding approach(what MC uses)?

      What I think will end up happening is that we'll mix two schema's together. AOP will use the bean-deployer XSD to embed bean definitions of Aspect Factories. The MC will use the AOP XSD to embed AOP constructs into bean metadata. It looks like this kind of arrangement would require a SchemaBinding model?

      Also, any clue when multiple namespace support will be available in JBossXB so I can finish this?

      Thanks.

        • 1. Re: Need advice for AOP/Microcontainer XML integration
          starksm64

          There already is multiple namespace support in JBossXB. I use it in 4.0 for a login-config.xml document:

          <?xml version="1.0" encoding="UTF-8"?>
          <!-- A login-config.xml example that uses the extended schema and jbossxb
          to marshall non-trival module-options.
          -->
          <policy xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
           xmlns="http://www.jboss.org/j2ee/schema/jaas"
           targetNamespace="http://www.jboss.org/j2ee/schema/jaas"
           >
          
           <application-policy name="testXMLLoginModule">
           <authentication>
           <login-module code="org.jboss.security.auth.spi.XMLLoginModule" flag="required">
           <module-option name="userInfo">
           <lm:users xmlns:lm="http://www.jboss.org/j2ee/schemas/XMLLoginModule">
           <lm:user name="jduke" password="theduke">
           <lm:role name="Role1"/>
           <lm:role name="Role2"/>
           <lm:role name="Echo"/>
           <lm:role name="callerJduke" group="CallerPrincipal" />
           </lm:user>
           <lm:user name="scott" password="echoman">
           <lm:role name="Echo"/>
           <lm:role name="ProjectUser"/>
           <lm:role name="callerScott" group="CallerPrincipal" />
           </lm:user>
           <lm:user name="stark" password="javaman">
           <lm:role name="Java"/>
           <lm:role name="Coder"/>
           <lm:role name="callerStark" group="CallerPrincipal" />
           </lm:user>
           <lm:user name="jdukeman" password="anotherduke">
           <lm:role name="Role2"/>
           <lm:role name="Role3"/>
           <lm:role name="callerJdukeman" group="CallerPrincipal" />
           </lm:user>
           <lm:user name="invoker" password="invoker">
           <lm:role name="HttpInvoker"/>
           </lm:user>
           <lm:user name="admin" password="admin">
           <lm:role name="JBossAdmin"/>
           </lm:user>
           </lm:users>
           </module-option>
           <module-option name="unauthenticatedIdentity">guest</module-option>
           </login-module>
           </authentication>
           </application-policy>
          
          


          This is parsed using the org.jboss.security.auth.login.LoginConfigObjectModelFactory factory.

          The issue is getting to a stable xsd driven version. In terms of something is stable and usable now, we may need to simply freeze/fork an ObjectModelFactory based implementation for use.


          • 2. Re: Need advice for AOP/Microcontainer XML integration
            aloubyansky

            ObjectModelFactory API is stable currently. I don't plan to change this API in the near future.
            SchemaBinding is under development. You can use it but I might need to update your code after my refactorings.

            I would say use whatever is easier for you for now. We will refactor it anyway in the future.

            About namespaces, please, clarify. Namespaces have been there since day one.

            • 3. Re: Need advice for AOP/Microcontainer XML integration
              bill.burke

               

              "scott.stark@jboss.org" wrote:
              There already is multiple namespace support in JBossXB. I use it in 4.0 for a login-config.xml document:


              It looks like I would need the SchemaBinding approach as I want to integrate with the MC's BeanSchemaBinding. This is so I can embed AOP elements with a bean config and in an AOP document where aspect definitions are defind as MC Beans.

              It looks like you can only map an ObjectFactory to a namespace and not a SchemaBinding.



              • 4. Re: Need advice for AOP/Microcontainer XML integration

                We need the support for ANY processing.

                Currently, Bill is using CDATA to deploy beans inside his AOP xml:

                <?xml version="1.0" encoding="UTF-8"?>
                
                <aop xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                 xsi:schemaLocation="urn:jboss:aop-deployer aop-deployer_1_1.xsd"
                 xmlns="urn:jboss:aop-deployer">
                
                 <interceptor name="SimpleInterceptor">
                 <![CDATA[
                <deployment xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                 xsi:schemaLocation="urn:jboss:bean-deployer bean-deployer_1_0.xsd"
                 xmlns="urn:jboss:bean-deployer">
                 <bean class="org.jboss.test.kernel.SimpleInterceptor">
                 <constructor>
                 <parameter>Hello</parameter>
                 </constructor>
                 <property name="second">World</property>
                 </bean>
                </deployment>
                
                 ]]>
                 </interceptor>
                etc.
                


                • 5. Re: Need advice for AOP/Microcontainer XML integration
                  aloubyansky

                  Have a look at org.jboss.test.xml.AnyUnitTestCase.java. This is the first approach to anyType.

                  • 6. Re: Need advice for AOP/Microcontainer XML integration

                    So the next step would be to have a SchemaBindingResolver that
                    looks at a JBossXB annotation inside the schema for a SchemaBindingFactory
                    and then uses that SchemaBinding to create the object.

                    The schema being loaded through an entity resolver.