11 Replies Latest reply on Nov 22, 2008 3:26 AM by alesj

    Lots of little XML files?

    dmlloyd

      I'm finding that as a consequence of having many deployers for a variety of XML files, that a deployment could have as many as 5 or 6 small XML files to configure various things.

      What about some kind of mechanism to allow users to combine descriptors into a single file? Something like this:

      <multi xmlns="urn:jboss:multi:1.0">
       <descriptor name="jboss-beans.xml">
       <deployment xmlns="urn:jboss:bean-deployer:2.0">
       <bean name="blah">
       ...
       </bean>
       </deployment>
       </descriptor>
       <descriptor name="jboss-classloading.xml">
       <classloading xmlns="urn:jboss:classloading:1.0">
       <capabilities>
       <package name="foo.bar" version="1.0"/>
       </capabilities>
       </classloading>
       </descriptor>
       <descriptor name="jboss-io.xml">
       ...etc...
       </descriptor>
      </multi>


        • 1. Re: Lots of little XML files?
          alesj

           

          "david.lloyd@jboss.com" wrote:

          What about some kind of mechanism to allow users to combine descriptors into a single file?

          You can already do this.
          It's called 'urn:jboss:bean-deployer:2.0'. ;-)

          <deployment xmlns="urn:jboss:bean-deployer:2.0">
           <bean name="blah">
           ...
           </bean>
          
           <classloading xmlns="urn:jboss:classloading:1.0">
           <capabilities>
           <package name="foo.bar" version="1.0"/>
           </capabilities>
           </classloading>
          
           <jbossxb-parser .../>
          
           ...
          
          </deployment>
          


          That's the whole point on having wildcard on BeanMetaDataFactory in KernelDeployment.
          And your metadata implementing it.

          Or how is your suggestion different from this?

          • 2. Re: Lots of little XML files?
            dmlloyd

            Cool, I didn't know that...

            • 3. Re: Lots of little XML files?
              dmlloyd

              So what's the programmatic equivalent of doing this? Say I've got a BeanMetaDataFactory... can I return other MetaData types as well from that somehow, using BeanMetaDataBuilder?

              • 4. Re: Lots of little XML files?
                alesj

                Like what?

                KernelDeployment only cares about BMDF.
                What this BMDF actually is or what it does it's up to you.
                At the end all BMDs from those BMDFs are installed into Controller.

                BMDB only deals with BMD,
                actually the current impl deals with AbstractBMD.

                The idea is to have your custom MD, which implements BMDF,
                where its getBeans method uses BMDB extensively.

                • 5. Re: Lots of little XML files?
                  alesj

                   

                  "alesj" wrote:
                  The idea is to have your custom MD, which implements BMDF,
                  where its getBeans method uses BMDB extensively.

                  The idea behind BMDB is to hide impl details of how BMD is to be created/assembled.

                  • 6. Re: Lots of little XML files?
                    dmlloyd

                    So you're saying that only custom MD that implements BMDF can be included in a jboss-beans.xml deployment like you describe above?

                    • 7. Re: Lots of little XML files?
                      alesj

                      Hmmm ... actually I'm not really sure what JBossXB will do
                      if some wildcard deployment's element maps to MD which doesn't implement BMDF.
                      I would expect it to throw a useful exception. :-)

                      • 8. Re: Lots of little XML files?
                        alesj

                         

                        "alesj" wrote:
                        Hmmm ... actually I'm not really sure what JBossXB will do
                        if some wildcard deployment's element maps to MD which doesn't implement BMDF.
                        I would expect it to throw a useful exception. :-)

                        I did a quick check, this is the result:
                        java.lang.ClassCastException: org.jboss.deployers.vfs.plugins.xb.SchemaResolverDeployerMetaData
                         at org.jboss.kernel.plugins.deployment.AbstractKernelDeployment.getBeans(AbstractKernelDeployment.java:224)
                         at org.jboss.kernel.plugins.deployment.AbstractKernelDeployer.deployBeans(AbstractKernelDeployer.java:304)
                         at org.jboss.kernel.plugins.deployment.AbstractKernelDeployer.deploy(AbstractKernelDeployer.java:130)
                         at org.jboss.kernel.plugins.deployment.BasicKernelDeployer.deploy(BasicKernelDeployer.java:76)
                         at org.jboss.kernel.plugins.deployment.xml.BasicXMLDeployer.deploy(BasicXMLDeployer.java:88)
                         at org.jboss.kernel.plugins.deployment.xml.BasicXMLDeployer.deploy(BasicXMLDeployer.java:158)
                         at org.jboss.test.kernel.junit.MicrocontainerTestDelegate.deploy(MicrocontainerTestDelegate.java:294)
                         at org.jboss.test.kernel.junit.MicrocontainerTestDelegate.deploy(MicrocontainerTestDelegate.java:438)
                         at org.jboss.test.deployers.vfs.xb.XBDeployersTestDelegate.deploy(XBDeployersTestDelegate.java:46)
                         at org.jboss.test.kernel.junit.MicrocontainerTestDelegate.setUp(MicrocontainerTestDelegate.java:83)


                        It actually only fails later on when in tries to cast it to BMDF.
                        JBossXB doesn't consider generics info --> see JBossXB's CollectionPropertyHandler

                        • 9. Re: Lots of little XML files?
                          alesj

                           

                          "alesj" wrote:

                          JBossXB doesn't consider generics info --> see JBossXB's CollectionPropertyHandler

                          http://www.jboss.com/index.html?module=bb&op=viewtopic&t=146116

                          • 10. Re: Lots of little XML files?
                            dmlloyd

                            OK, so the rule is that SchemaResolverDeployers must, must, MUST produce metadata that implements BMDF. Affirmed once again. :-)

                            • 11. Re: Lots of little XML files?
                              alesj

                               

                              "david.lloyd@jboss.com" wrote:
                              OK, so the rule is that SchemaResolverDeployers must, must, MUST produce metadata that implements BMDF.

                              No. ;-)

                              The MD that maps to deployment's element must, must, MUST produce metadata that implements BMDF.
                              e.g.
                              <deployment xmlns="urn:jboss:bean-deployer:2.0">
                               <my-custom-element ...> // <-- HERE
                               ...
                               </my-custom-element>
                              </deployment>
                              


                              SRD can produce whatever.
                              Since it doesn't mean all SRD's MD is gonna be (directly) used with MC.

                              e.g. you can have a deployer in the middle that does custom transformation: SRD --> custom X MD --> X to BMD(F) --> MC
                              e.g.2 simply use custom MD for some non MC/BMD operation / info
                              My scanning MD:
                              - http://anonsvn.jboss.org/repos/jbossas/projects/jboss-deployers/trunk/deployers-vfs/src/main/java/org/jboss/deployers/vfs/plugins/annotations/ScanningMetaDataDeployer.java
                              - http://anonsvn.jboss.org/repos/jbossas/projects/jboss-deployers/trunk/deployers-impl/src/main/java/org/jboss/deployers/plugins/annotations/AbstractScanningMetaData.java