7 Replies Latest reply on Jan 20, 2009 5:03 AM by Jeff Mesnil

    XML configuration

    Jeff Mesnil Master

      I'm working on https://jira.jboss.org/jira/browse/JBMESSAGING-1301 to provide XML schema for all JBM 2 configuration.

      This includes:
      - configuration.xml -> the main config files
      - queues.xml -> the queues settings
      - jbm-jms.xml -> the JMS managed resources
      - jbm-security.xml -> security credential

      Using a XML schema to express our configuration files we can:
      - validate element types (boolean, string, int, etc.)
      - validate cardinality of elements (e.g. at least 1 acceptor)
      - validate the relations between the elements (e.g. if I have an element with an attribute connector-ref="netty", there MUST be a "netty" connector to validate the configuration)
      - we will still need to have a programmatic validation though

      I've started to write a XML schema for configuration.xml.

      I also thought about merging our configuration files.
      The merge I thought would be queues.xml & jbm-jms.xml. The first time, I wanted to add a JMS queue, I added settings only and did not declare it in jbm-jms.xml.

      We could have 3 configuration files:
      - configuration.xml -> the server configuration
      - resources.xml -> the settings & managed resources (including JMS)
      - security.xml -> the credentials

      wdyt?



        • 1. Re: XML configuration
          Jeff Mesnil Master

          another thing I forgot to mention...

          we will validate the configuration when starting the server but we can also provide a Ant task to help the user make sure his configuration is valid without restarting the server on and on

          • 2. Re: XML configuration
            Tim Fox Master

             

            "jmesnil" wrote:

            The merge I thought would be queues.xml & jbm-jms.xml. The first time, I wanted to add a JMS queue, I added settings only and did not declare it in jbm-jms.xml.



            No, core must be independent of JMS. We can't have JMS stuff in a core config file.

            However queues.xml can be merged with jbm-configuration.xm

            • 3. Re: XML configuration
              Andy Taylor Master

               

              I also thought about merging our configuration files.


              it should be just a case of changing ' public String[] getElementTagName()' in XmlDeployer

              • 4. Re: XML configuration
                Jeff Mesnil Master

                 

                "timfox" wrote:

                However queues.xml can be merged with jbm-configuration.xm


                I prefer to keep them separate so that in a cluster, both master and backup nodes could "share" the same queues.xml file.

                • 5. Re: XML configuration
                  Tim Fox Master

                   

                  "jmesnil" wrote:

                  I prefer to keep them separate so that in a cluster, both master and backup nodes could "share" the same queues.xml file.


                  good point

                  • 6. Re: XML configuration
                    Andy Taylor Master

                     

                    I prefer to keep them separate so that in a cluster, both master and backup nodes could "share" the same queues.xml file.


                    The config files support property replacement i.e.
                    <param key="jbm.remoting.netty.port" value="${jbm.remoting.netty.port}" type="Integer"/>


                    so they could still share the same single config file if needed.

                    • 7. Re: XML configuration
                      Jeff Mesnil Master

                      i've committed XML schema for all our configuration files.

                      Validation occurs in XmlDeployer subclasses.

                      Some tidbits about the XML schema:

                      == order matters ==

                      I've not found how to provide a "bag" of elements with a XML schema. Elements must now be ordered for the configuration to be valid

                      == ID/IDREF ==

                      I took advantage of ID & IDREF in the schema to validate our conf. E.g. if the backup-connector-ref element references a "blah" connector, there MUST be a connector element with the "blah" attribute. I did not change the code but we can now remove some validation done in Java and now handled by XSD.
                      However this does not apply to cross-configuration files (e.g. jbm-jms.xml connection-factory can not IDREF an element from jbm-configuration.xml).
                      This still must be done in Java

                      == Minimal configuration ==

                      The minimal valid configuration file is

                      <deployment>
                       <configuration>
                       <acceptor>...</acceptor>
                       </configuration>
                      </deployment>
                      


                      there MUST be at least 1 declared acceptor. All other elements are optional.

                      == Default values ==

                      The XML schemas DOES NOT define any default values. The defaults are taken from Configuration interface if the corresponding XML element is not present in the configuration