7 Replies Latest reply on Sep 28, 2006 8:30 AM by Mark Little

    PropertyManager

    Mark Little Master

      I've checked the PropertyManager into the 'rearchitecture' branch and will check in the javadocs next. There's a lot the PropertyManager can do, but probably for now the simplest approach is the best. It looks and behaves like setting or getting properties via System, except it sources the properties from a range of places. The default is an XML configuration file, but users can plugin different implementations (e.g., a remote property service).

      If you look at a cut-down version of a JBossTS property file:

      <?xml version="1.0" encoding="UTF-8"?>
      <transaction-service>
       <properties depends="common" name="arjuna">
       <!--
       Transaction Reaper Timeout (default is 120000 microseconds).
       -->
       <property
       name="com.arjuna.ats.arjuna.coordinator.txReaperTimeout" value="120000"/>
       <!--
       Transaction Reaper Mode, can be: NORMAL or DYNAMIC (default is NORMAL).
       -->
       <property name="com.arjuna.ats.arjuna.coordinator.txReaperMode" value="NORMAL"/>
      </properties>
       <properties depends="arjuna" name="recoverymanager">
       <!--
       Properties used only by the RecoveryManager.
       -->
       <!--
       Periodic recovery settings.
       Time values in this section are in seconds.
       -->
       <!--
       Interval in seconds between initiating the periodic recovery modules.
       Default is 120 seconds.
       -->
      </properties>
       <properties name="common">
       <!-- CLF 2.0 properties -->
       <property name="com.arjuna.common.util.logging.DebugLevel"
       type="System" value="0x00000000"/>
       <property name="com.arjuna.common.util.logging.FacilityLevel"
       type="System" value="0xffffffff"/>
       <property name="com.arjuna.common.util.logging.VisibilityLevel"
       type="System" value="0xffffffff"/>
       <property name="com.arjuna.common.util.logger" type="System" value="log4j"/>
       </properties>
       <properties depends="arjuna" name="txoj">
       <!--
       (default is LockStore of installation - must be writeable!)
       -->
       <!--
       <property
       name="com.arjuna.ats.txoj.lockstore.lockStoreDir"
       value="LockStore"/>
       -->
       </properties>
      </transaction-service>
      


      All properties are grouped within sections and individual properties by . If you look at some you'll see that they may be named and may have a depends value, which relates to another section. This tells the PropertyManager to load the depends section first. A property value may be overridden by a dependant section, but the PropertyManager remembers the hierarchy, so if you want to you can inspect and change the lower level value and the PropertyManager can be used to preserve these changes if the values are written back out to the source location.

      As I said, there's a lot more in the PropertyManager than we need at the moment, but I think we'll get there fairly soon.

      I want to put all deployment configuration options within a property file like the one above. I don't know yet whether that will cover things like the DOM trees we use for connecting listeners with actions. I suspect not: different things.

        • 1. Re: PropertyManager
          Mark Little Master

          OK, the PropertyManager is in trunk and I've changes all occurrences of System.get/set to use it. Everything is in a single section at the moment (example file in etc). I'm going to go through the code and work with various people to make sure we segment the file appropriately after this.

          In order to get picked up, the file needs to be in your classpath or the current working directory. There are other search rules, but those are the simplest!

          Any questions, let me know.

          • 2. Re: PropertyManager
            Mark Little Master

            If anyone cares, he's the example property file:

            <?xml version="1.0" encoding="ISO-8859-1"?>
            <!--
             JBoss, Home of Professional Open Source
             Copyright 2006, JBoss Inc., and others contributors as indicated
             by the @authors tag. All rights reserved.
             See the copyright.txt in the distribution for a
             full listing of individual contributors.
             This copyrighted material is made available to anyone wishing to use,
             modify, copy, or redistribute it subject to the terms and conditions
             of the GNU Lesser General Public License, v. 2.1.
             This program is distributed in the hope that it will be useful, but WITHOUT A
             WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
             PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
             You should have received a copy of the GNU Lesser General Public License,
             v.2.1 along with this distribution; if not, write to the Free Software
             Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
             MA 02110-1301, USA.
            
             (C) 2005-2006,
             @author JBoss Inc.
            -->
            <!-- $Id: default-jbossesb-properties.xml $ -->
            <!--
             These options are described in the JBossESB manual.
             Defaults are provided here for convenience only.
            
             Please read through this file prior to using the system, and consider
             updating the specified entries.
            -->
            <esb
             xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
             xsi:noNamespaceSchemaLocation="jbossesb-1_0.xsd">
             <properties name="core">
             <property name="org.jboss.soa.esb.mail.smtp.host" value="localhost"/>
             <property name="org.jboss.soa.esb.mail.smtp.user" value=""/>
             <property name="org.jboss.soa.esb.mail.smtp.password" value=""/>
             <property name="org.jboss.soa.esb.mail.smtp.port" value="25"/>
             <!-- property name="org.jboss.soa.esb.mail.smtp.from" value="" -->
             <!-- property name="org.jboss.soa.esb.mail.smtp.auth" value="" -->
             <property name="org.jboss.soa.esb.jndi.server.type" value="jboss"/>
             <property name="org.jboss.soa.esb.jndi.server.url" value="localhost"/>
             <!-- property name="org.jboss.soa.esb.paramsRepository.class" value="" -->
             <!-- property name="org.jboss.soa.esb.encryption.factory.class" value="" -->
             <!-- property name="org.jboss.soa.esb.objStore.configFile" value="" -->
             </properties>
            </esb>
            


            • 3. Re: PropertyManager
              Mark Little Master

              BTW, I'm in the process of updating the unit tests and adding new ones.

              • 4. Re: PropertyManager
                Mark Little Master

                Here's an updated config file:

                <?xml version="1.0" encoding="ISO-8859-1"?>
                <!--
                 JBoss, Home of Professional Open Source
                 Copyright 2006, JBoss Inc., and others contributors as indicated
                 by the @authors tag. All rights reserved.
                 See the copyright.txt in the distribution for a
                 full listing of individual contributors.
                 This copyrighted material is made available to anyone wishing to use,
                 modify, copy, or redistribute it subject to the terms and conditions
                 of the GNU Lesser General Public License, v. 2.1.
                 This program is distributed in the hope that it will be useful, but WITHOUT A
                 WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
                 PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
                 You should have received a copy of the GNU Lesser General Public License,
                 v.2.1 along with this distribution; if not, write to the Free Software
                 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
                 MA 02110-1301, USA.
                
                 (C) 2005-2006,
                 @author JBoss Inc.
                -->
                <!-- $Id: default-jbossesb-properties.xml $ -->
                <!--
                 These options are described in the JBossESB manual.
                 Defaults are provided here for convenience only.
                
                 Please read through this file prior to using the system, and consider
                 updating the specified entries.
                -->
                <esb
                 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                 xsi:noNamespaceSchemaLocation="jbossesb-1_0.xsd">
                 <properties name="core">
                 <property name="org.jboss.soa.esb.jndi.server.type" value="jboss"/>
                 <property name="org.jboss.soa.esb.jndi.server.url" value="localhost"/>
                 <!-- property name="org.jboss.soa.esb.paramsRepository.class" value="" -->
                 <!-- property name="org.jboss.soa.esb.encryption.factory.class" value="" -->
                 <!-- property name="org.jboss.soa.esb.objStore.configFile" value="" -->
                 </properties>
                 <properties name="transports" depends="core">
                 <property name="org.jboss.soa.esb.mail.smtp.host" value="localhost"/>
                 <property name="org.jboss.soa.esb.mail.smtp.user" value=""/>
                 <property name="org.jboss.soa.esb.mail.smtp.password" value=""/>
                 <property name="org.jboss.soa.esb.mail.smtp.port" value="25"/>
                 <!-- property name="org.jboss.soa.esb.mail.smtp.from" value="" -->
                 <!-- property name="org.jboss.soa.esb.mail.smtp.auth" value="" -->
                 </properties>
                 <properties name="connection">
                 <!-- property name="isolation" value="" -->
                 <!-- property name="connection-url" value="" -->
                 <property name="min-pool-size" value="5"/>
                 <property name="max-pool=size" value="10"/>
                 <property name="blocking-timeout-millis" value="5000"/>
                 <!-- property name="connection-pool-class" value="" -->
                 <!-- property name="user-name" value="" -->
                 <!-- property name="password" value="" -->
                 <!-- property name"password-decrypter" value="" -->
                 <property name="abandoned-connection-timeout" value="10000"/>
                 <property name="abandoned-connection-time-interval" value="30000"/>
                 </properties>
                </esb>
                


                I've broken the properties into different modules, with associated dependencies. The way the PropertyManager works means that it builds up a list of dependant modules in a directed acyclic graph. This means that there is a root, which can see every property below it, but nodes below cannot see properties above them: there is a level of isolation.

                When creating PropertyManagers, you need to specify where in the graph it is to "tie in". This obviously has an affect on what that instance can then see or do: if it goes in at the wrong level, it won't be able to see properties it may need (unless they were defined to be "system" properties, and in which case they are globally accessible.)

                This means that we now have isolated PropertyManagers for each module. It helps the management side of things a lot, but does mean that we have to consider where in the graph a property needs to be, or which PropertyManager we want to use to try to access it.

                What we have at the moment in terms of properties is pretty basic, so this 3 module approach seems about right to me. I'll check the code in now (along with some tests!) and we can discuss the structuring tomorrow. It's fairly trivial to change.

                • 5. Re: PropertyManager
                  Mark Little Master

                  Hopefully this goes without saying, but ... no more checking in of code that uses System, OK? Thanks.

                  • 6. Re: PropertyManager
                    Arvinder Singh Novice

                    Should we move the xml file https://svn.labs.jboss.com/labs/jbossesb/trunk/product/etc/jbossesb-properties.xml
                    to product/config and instead put the xsd reference - jbossesb-1_0.xsd under product/etc/schemas ?

                    Related:
                    We should start to organise etc/schemas + etc/validation into something better. I'll put some thoughts through group discussions later.

                    • 7. Re: PropertyManager
                      Mark Little Master

                       

                      "arvinder" wrote:
                      Should we move the xml file https://svn.labs.jboss.com/labs/jbossesb/trunk/product/etc/jbossesb-properties.xml
                      to product/config and instead put the xsd reference - jbossesb-1_0.xsd under product/etc/schemas ?


                      I suppose that is the JBoss way ;-) Too used to other approaches to be honest.


                      Related:
                      We should start to organise etc/schemas + etc/validation into something better. I'll put some thoughts through group discussions later.


                      OK, thanks.