4 Replies Latest reply on Feb 13, 2006 8:26 AM by Adrian Brock

    Allow bean instance to be created by custom schema

    Scott Stark Master

      Consider creating a bean using a custom schema. Right now this requires a wrapper bean:

      <?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_1_0.xsd"
       xmlns="urn:jboss:bean-deployer">
       <bean name="jboss.xb:service=SchemaResolverConfig"
       class="org.jboss.util.xml.SchemaResolverConfig">
      
       <!-- The locations (path name on the "classpath") -->
       <property name="schemaLocations">
       urn:urn:jboss:mbean-service=legacy-mbean-service_1_0.xsd
       </property>
       </bean>
      
       <bean name="MBeanServices"
       class="org.jboss.test.kernel.config.support.mbeanserver.ServicesWrapper">
       <property name="services">
       <mbean:server
       xmlns:mbean="urn:jboss:mbean-service">
       <mbean:mbean code="org.jboss.test.kernel.config.support.mbeanserver.SomeBean"
       name="jboss.security.tests:service=SomeBean">
      
       <mbean:attribute name="UserHome" replace="true">
       ${user.home}
       </mbean:attribute>
       <mbean:depends optional-attribute-name="LoginConfigService">
       jboss.security:service=XMLLoginConfig
       </mbean:depends>
       <mbean:depends optional-attribute-name="SecurityManagerService">
       jboss.security:service=JaasSecurityManager
       </mbean:depends>
       </mbean:mbean>
       </mbean:server>
       </property>
       </bean>
      </deployment>
      
      


      what I would like to be able to do is create the bean instance via a constructor element whose content is the custom schema doc fragment that creates a fully initialized instance:

      <?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_1_0.xsd"
       xmlns="urn:jboss:bean-deployer">
       <bean name="jboss.xb:service=SchemaResolverConfig"
       class="org.jboss.util.xml.SchemaResolverConfig">
      
       <!-- The locations (path name on the "classpath") -->
       <property name="schemaLocations">
       urn:urn:jboss:mbean-service=legacy-mbean-service_1_0.xsd
       </property>
       </bean>
      
       <bean name="MBeanServices"
       class="org.jboss.test.kernel.config.support.mbeanserver.Services">
       <constructor>
       <mbean:server
       xmlns:mbean="urn:jboss:mbean-service">
       <mbean:mbean code="org.jboss.test.kernel.config.support.mbeanserver.SomeBean"
       name="jboss.security.tests:service=SomeBean">
      
       <mbean:attribute name="UserHome" replace="true">
       ${user.home}
       </mbean:attribute>
       <mbean:depends optional-attribute-name="LoginConfigService">
       jboss.security:service=XMLLoginConfig
       </mbean:depends>
       <mbean:depends optional-attribute-name="SecurityManagerService">
       jboss.security:service=JaasSecurityManager
       </mbean:depends>
       </mbean:mbean>
       </mbean:server>
       </constructor>
       </bean>
      </deployment>