8 Replies Latest reply on Mar 6, 2009 6:00 PM by starksm64

    Extending jboss-beans.xml schema?

    starksm64

      I don't remember what needs to be done to extend the accepted elements for a new bean metadatafactory like this application-policy element:

      <deployment xmlns="urn:jboss:bean-deployer:2.0">
      
       <!-- profileservice secureview application-policy definition -->
       <application-policy xmlns="urn:jboss:security-beans:1.0" name="profileservice">
       <authentication>
       <login-module code="org.jboss.security.auth.spi.UsersRolesLoginModule" flag="required">
       <module-option name="unauthenticatedIdentity">nouser</module-option>
       <module-option name="usersProperties">profileservice-users.properties</module-option>
       <module-option name="rolesProperties">profileservice-roles.properties</module-option>
       </login-module>
       </authentication>
       </application-policy>
      


      Where does the mapping from urn:jboss:security-beans:1.0 to the associated BeanMetaDataFactory implementation happen?


        • 1. Re: Extending jboss-beans.xml schema?
          alesj

          Might be SingletonSchemaResolverFactory (if I remember correctly).

          Or you can add this dynamically via JBossXBDeployer(Helper).

          • 2. Re: Extending jboss-beans.xml schema?
            anil.saldhana

            http://anonsvn.jboss.org/repos/jbossas/projects/security/security-jboss-sx/trunk/

            In the security-mc-int project.

            For JBAS5, you would need to use the Branch_2_0 of security

            • 3. Re: Extending jboss-beans.xml schema?
              starksm64

              I see the ApplicationPolicyMetaDataFactory and its use of jbossxb/jaxb to declare the namespace, but I'm not finding where this namespace is made known to the jbossxb layer as something that is allowed as a child of deployment. Let's see if I can find SingletonSchemaResolverFactory...

              • 4. Re: Extending jboss-beans.xml schema?
                starksm64

                It looks like its a side-effect of the SecurityParser deployer:

                 <bean name="SecurityParser" class="org.jboss.deployers.vfs.spi.deployer.SchemaResolverDeployer">
                 <constructor>
                 <parameter>org.jboss.security.microcontainer.beans.metadata.SecurityPolicyMetaData</parameter>
                 </constructor>
                 <!-- The Deployer mandates this suffix. So we use a dummy -->
                 <property name="suffix">dummy-policy.xml</property>
                 <property name="registerWithJBossXB">true</property>
                 </bean>
                


                The SecurityPolicyMetaData declares:
                @JBossXmlSchema(namespace = "urn:jboss:security-beans:1.0", elementFormDefault = XmlNsForm.QUALIFIED)
                @XmlRootElement(name = "policy")
                @XmlType(name = "policyType", propOrder = {"appPolicies"})
                public class SecurityPolicyMetaData implements BeanMetaDataFactory
                


                SchemaResolverDeployer is calling JBossXBDeployerHelper.addClassBinding when the registerWithJBossXB is true.

                • 5. Re: Extending jboss-beans.xml schema?
                  starksm64

                  Trying to use the SingletonSchemaResolverFactory as a bean to register a namespace to class mapping isn't working. Need to figure this out and add it to the mc faq:
                  http://www.jboss.org/community/docs/DOC-10669

                  • 6. Re: Extending jboss-beans.xml schema?
                    alesj

                     

                    "scott.stark@jboss.org" wrote:
                    Trying to use the SingletonSchemaResolverFactory as a bean to register a namespace to class mapping isn't working.

                    How come it works in JBossXBDeployerHelper?
                    We're there registering it against DefaultSchemaResolver.
                    (btw: this has changed a bit in new/trunk jbossxb)

                    • 7. Re: Extending jboss-beans.xml schema?
                      dmlloyd

                      This is how I do it with all the deployers I've done, like Threads and XNIO and so forth:

                      <deployment xmlns="urn:jboss:bean-deployer:2.0">
                       <bean name="XnioMetaDataDeployer" class="org.jboss.deployers.vfs.deployer.kernel.BeanMetaDataFactoryDeployer">
                       <constructor>
                       <parameter>org.jboss.xnio.metadata.XnioMetaData</parameter>
                       </constructor>
                       </bean>
                      
                       <bean name="XnioParserDeployer" class="org.jboss.deployers.vfs.spi.deployer.SchemaResolverDeployer">
                       <constructor>
                       <parameter>org.jboss.xnio.metadata.XnioMetaData</parameter>
                       </constructor>
                       <property name="name">jboss-xnio.xml</property>
                       <property name="registerWithJBossXB">true</property>
                       </bean>
                      
                      </deployment>
                      
                      


                      Then XnioMetaData implements BeanMetaDataFactory, which allows "xnio" elements to exist directly under "deployment" elements. I'm not sure if this is what you're looking for though...


                      • 8. Re: Extending jboss-beans.xml schema?
                        starksm64

                        Every usage that is working has included a SchemaResolverDeployer with the registerWithJBossXB=true which is updating the jbossxb schema mappings. I don't need a parsing deployer, but I'm not sure why just trying to register the namespace mapping directly is not working. Could just be I'm not doing it correctly.