4 Replies Latest reply on Oct 25, 2005 6:09 AM by Manik Surtani

    Configuration XML file - Apache Digester to parse?

    Manik Surtani Master


      While most of the configuration elements in the XML file are parsed quite easily in JBossCache (elements of type

      <attribute name="blah">blah</attribute>
      ) more complex elements (such as ClusterConfig and EvictionPolicy) are a bit more cumbersome, resulting in an org.w3c.dom.Element object representing the relevant XML snippet being passed into a setter on TreeCache, and then some manual parsing taking place.

      My suggestion for refactoring (as this XML file is due to increase in complexity with new features being added in) would be to pass the entire XML document to Apache's Commons-Digester, which would then spit out a configuration object that represents these values.

      * Accessing configuration elements in JBossCache become easier - no parsing of DOM Elements.
      * Configurations live in a self-contained value object rather than as properties of TreeCache - makes it easier when we think of allowing interceptors to configure themselves.

      * Potential problems when run as an MBean? (Perhaps we can overcome this by registering 2 MBeans - a TreeCacheMBean containing operational methods and a TreeCacheConfigMBean containing config elements? This could be implemented by the Config object the Digester would spit out...)
      * More JARs to clutter /lib! (Bela will love this)

      What does everyone think about this?