[jboss-svn-commits] JBL Code SVN: r30006 - in labs/jbosstm/trunk: ArjunaCore/arjuna/classes/com/arjuna/ats/arjuna/tools and 8 other directories.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Thu Nov 5 05:57:16 EST 2009


Author: jhalliday
Date: 2009-11-05 05:57:16 -0500 (Thu, 05 Nov 2009)
New Revision: 30006

Added:
   labs/jbosstm/trunk/common/classes/com/arjuna/common/util/propertyservice/PropertiesFactory.java
Removed:
   labs/jbosstm/trunk/ArjunaCore/tsmx/classes/com/arjuna/ats/internal/tsmx/mbeans/PropertyServiceJMXPlugin.java
   labs/jbosstm/trunk/ArjunaCore/tsmx/classes/com/arjuna/ats/internal/tsmx/mbeans/PropertyServiceMBeanWrapper.java
   labs/jbosstm/trunk/common/classes/com/arjuna/common/internal/util/propertyservice/PropertyManagerImpl.java
   labs/jbosstm/trunk/common/classes/com/arjuna/common/internal/util/propertyservice/plugins/io/
   labs/jbosstm/trunk/common/classes/com/arjuna/common/util/concurrency/
   labs/jbosstm/trunk/common/classes/com/arjuna/common/util/exceptions/LoadPropertiesException.java
   labs/jbosstm/trunk/common/classes/com/arjuna/common/util/exceptions/ManagementPluginException.java
   labs/jbosstm/trunk/common/classes/com/arjuna/common/util/exceptions/SavePropertiesException.java
   labs/jbosstm/trunk/common/classes/com/arjuna/common/util/propertyservice/Environment.java
   labs/jbosstm/trunk/common/classes/com/arjuna/common/util/propertyservice/PropertyManager.java
   labs/jbosstm/trunk/common/classes/com/arjuna/common/util/propertyservice/PropertyManagerFactory.java
   labs/jbosstm/trunk/common/classes/com/arjuna/common/util/propertyservice/plugins/
   labs/jbosstm/trunk/common/classes/com/arjuna/common/util/propertyservice/propertycontainer/
   labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/ArjunaCore/Common/PropertyManagerTest.java
Modified:
   labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/arjuna/common/CoreEnvironmentBean.java
   labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/arjuna/common/CoreEnvironmentBeanMBean.java
   labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/arjuna/tools/OTM.java
   labs/jbosstm/trunk/ArjunaJTA/jdbc/classes/com/arjuna/ats/internal/jdbc/recovery/BasicXARecovery.java
   labs/jbosstm/trunk/ArjunaJTA/jdbc/classes/com/arjuna/ats/internal/jdbc/recovery/JDBCXARecovery.java
   labs/jbosstm/trunk/common/classes/com/arjuna/common/internal/util/propertyservice/BeanPopulator.java
Log:
Remove obsolete PropertyManager (replaced by EnvironmentBeans) and other beanification cleanup. JBTM-628


Modified: labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/arjuna/common/CoreEnvironmentBean.java
===================================================================
--- labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/arjuna/common/CoreEnvironmentBean.java	2009-11-05 10:55:44 UTC (rev 30005)
+++ labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/arjuna/common/CoreEnvironmentBean.java	2009-11-05 10:57:16 UTC (rev 30006)
@@ -34,9 +34,6 @@
 @PropertyPrefix(prefix = "com.arjuna.ats.arjuna.")
 public class CoreEnvironmentBean implements CoreEnvironmentBeanMBean
 {
-    @FullPropertyName(name = "com.arjuna.ats.arjuna.common.propertiesFile")
-    private volatile String propertiesFile = "";
-
     @FullPropertyName(name = "com.arjuna.ats.arjuna.common.varDir")
     private volatile String varDir = System.getProperty("user.dir") + File.separator + "var" + File.separator + "tmp";
 
@@ -55,34 +52,8 @@
     private volatile boolean allowMultipleLastResources = false;
     private volatile boolean disableMultipleLastResourcesWarning = false;
 
-//    @FullPropertyName(name = "jbossts.bind.address")
-//    private String bindAddress;
 
-
     /**
-     * Returns the name of the properties file.
-     *
-     * Default: ""
-     * Equivalent deprecated property: com.arjuna.ats.arjuna.common.propertiesFile
-     *
-     * @return the name of the properties file.
-     */
-    public String getPropertiesFile()
-    {
-        return propertiesFile;
-    }
-
-    /**
-     * Sets the name of the properties file.
-     *
-     * @param propertiesFile the name of the properties file.
-     */
-    public void setPropertiesFile(String propertiesFile)
-    {
-        this.propertiesFile = propertiesFile;
-    }
-
-    /**
      * Returns the 'var' directory path.
      *
      * Default: {user.dir}/var/tmp

Modified: labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/arjuna/common/CoreEnvironmentBeanMBean.java
===================================================================
--- labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/arjuna/common/CoreEnvironmentBeanMBean.java	2009-11-05 10:55:44 UTC (rev 30005)
+++ labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/arjuna/common/CoreEnvironmentBeanMBean.java	2009-11-05 10:57:16 UTC (rev 30006)
@@ -27,10 +27,6 @@
  */
 public interface CoreEnvironmentBeanMBean
 {
-    String getPropertiesFile();
-
-    void setPropertiesFile(String propertiesFile);
-
     String getVarDir();
 
     void setVarDir(String varDir);

Modified: labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/arjuna/tools/OTM.java
===================================================================
--- labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/arjuna/tools/OTM.java	2009-11-05 10:55:44 UTC (rev 30005)
+++ labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/arjuna/tools/OTM.java	2009-11-05 10:57:16 UTC (rev 30006)
@@ -31,7 +31,7 @@
 
 package com.arjuna.ats.arjuna.tools;
 
-import com.arjuna.common.util.propertyservice.PropertyManagerFactory;
+import com.arjuna.common.util.propertyservice.PropertiesFactory;
 import com.arjuna.ats.arjuna.common.*;
 import com.arjuna.ats.arjuna.objectstore.ObjectStore;
 import com.arjuna.ats.arjuna.state.*;
@@ -821,7 +821,7 @@
     public static void main (String[] args)
     {
         Uid u = new Uid();
-        String timeout = PropertyManagerFactory.getDefaultProperties().getProperty(
+        String timeout = PropertiesFactory.getDefaultProperties().getProperty(
                 pollingTimeout);
 
         if (timeout != null)

Deleted: labs/jbosstm/trunk/ArjunaCore/tsmx/classes/com/arjuna/ats/internal/tsmx/mbeans/PropertyServiceJMXPlugin.java
===================================================================
--- labs/jbosstm/trunk/ArjunaCore/tsmx/classes/com/arjuna/ats/internal/tsmx/mbeans/PropertyServiceJMXPlugin.java	2009-11-05 10:55:44 UTC (rev 30005)
+++ labs/jbosstm/trunk/ArjunaCore/tsmx/classes/com/arjuna/ats/internal/tsmx/mbeans/PropertyServiceJMXPlugin.java	2009-11-05 10:57:16 UTC (rev 30006)
@@ -1,93 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2006, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags.
- * 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.
- */
-package com.arjuna.ats.internal.tsmx.mbeans;
-
-import com.arjuna.common.util.propertyservice.plugins.PropertyManagementPlugin;
-import com.arjuna.common.util.propertyservice.propertycontainer.PropertyManagerPluginInterface;
-import com.arjuna.common.util.exceptions.ManagementPluginException;
-
-import com.arjuna.ats.tsmx.TransactionServiceMX;
-import com.arjuna.ats.tsmx.logging.tsmxLogger;
-
-import java.io.IOException;
-
-/*
- * Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003
- *
- * Arjuna Technologies Ltd.
- * Newcastle upon Tyne,
- * Tyne and Wear,
- * UK.
- *
- * $Id: PropertyServiceJMXPlugin.java 2342 2006-03-30 13:06:17Z  $
- */
-
-/**
- * This class is a Management plugin for the property manager which registers each and
- * every property manager in a property manager tree as mbeans.
- *
- * @author Richard A. Begg (richard.begg at arjuna.com)
- * @version $Id: PropertyServiceJMXPlugin.java 2342 2006-03-30 13:06:17Z  $
- */
-public class PropertyServiceJMXPlugin implements PropertyManagementPlugin
-{
-	public void initialise(PropertyManagerPluginInterface pm) throws ManagementPluginException, IOException
-	{
-		try
-		{
-			registerPropertyManagers(pm);
-		}
-		catch (Exception e)
-		{
-			throw new ManagementPluginException("Failed to register mbeans: "+e, e);
-		}
-	}
-
-	/**
-	 * Register the given property manager dynamic mbean wrapper.
-	 * @param pm
-	 * @throws Exception
-	 */
-	private void registerPropertyManagers(PropertyManagerPluginInterface pm) throws Exception
-	{
-		/** If this property manager has properties then register it as a JMX Bean **/
-		if ( !pm.getLocalProperties().isEmpty() )
-		{
-            PropertyServiceMBeanWrapper mbean = null;
-
-            try
-            {
-                /** Create the dynamic mbean for this property manager **/
-                mbean = new PropertyServiceMBeanWrapper(pm);
-
-                /** Register it with the current TSMX agent **/
-                TransactionServiceMX.getTransactionServiceMX().getAgentInterface().getAgent().registerMBean(mbean, mbean.getObjectName());
-            }
-            catch (MappingsNotFoundException e)
-            {
-                if ( pm.verbose() )
-                {
-                    System.err.println("Mappings not found: "+e.toString());
-                }
-            }
-		}
-	}
-}

Deleted: labs/jbosstm/trunk/ArjunaCore/tsmx/classes/com/arjuna/ats/internal/tsmx/mbeans/PropertyServiceMBeanWrapper.java
===================================================================
--- labs/jbosstm/trunk/ArjunaCore/tsmx/classes/com/arjuna/ats/internal/tsmx/mbeans/PropertyServiceMBeanWrapper.java	2009-11-05 10:55:44 UTC (rev 30005)
+++ labs/jbosstm/trunk/ArjunaCore/tsmx/classes/com/arjuna/ats/internal/tsmx/mbeans/PropertyServiceMBeanWrapper.java	2009-11-05 10:57:16 UTC (rev 30006)
@@ -1,343 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2006, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags.
- * 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.
- */
-/*
- * Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003
- *
- * Arjuna Technologies Ltd.
- * Newcastle upon Tyne,
- * Tyne and Wear,
- * UK.
- *
- * $Id: PropertyServiceMBeanWrapper.java 2342 2006-03-30 13:06:17Z  $
- */
-
-package com.arjuna.ats.internal.tsmx.mbeans;
-
-import com.arjuna.common.util.propertyservice.propertycontainer.PropertyManagerPluginInterface;
-import com.arjuna.common.util.exceptions.SavePropertiesException;
-
-import javax.management.*;
-import javax.management.MBeanOperationInfo;
-import javax.management.MBeanAttributeInfo;
-import javax.management.MBeanException;
-import java.util.Properties;
-import java.util.Enumeration;
-import java.util.ArrayList;
-import java.util.Hashtable;
-import java.io.InputStream;
-import java.io.BufferedReader;
-import java.io.InputStreamReader;
-
-/**
- * This is a dynamic mbean class which exposes the properties stored in
- * a property manager as attributes.
- *
- * @author Richard A. Begg (richard.begg at arjuna.com)
- * @version $Id: PropertyServiceMBeanWrapper.java 2342 2006-03-30 13:06:17Z  $
- */
-public class PropertyServiceMBeanWrapper implements DynamicMBean
-{
-	private final static String PROPERTY_FILE_MBEAN_OBJECT_NAME_PREFIX = "com.arjuna.ats.properties:module=";
-	private final static String MAPPINGS_FILENAME_SUFFIX = "-properties.mappings";
-	private final static String COMMENT_PREFIX = "#";
-
-	private PropertyManagerPluginInterface _pm = null;
-	private ArrayList _attributeMapping = new ArrayList();
-	private MBeanInfo _info = null;
-	private Hashtable _comment = new Hashtable();
-	private ArrayList _propertyMapping = new ArrayList();
-
-	PropertyServiceMBeanWrapper(PropertyManagerPluginInterface pm) throws MappingsNotFoundException
-	{
-		_pm = pm;
-
-		retrievePropertyToAttributeMappings(pm.getName());
-	}
-
-	/**
-	 * Save the properties stored in the property manager.
-	 * @throws java.io.IOException
-	 * @throws SavePropertiesException
-	 * @throws ClassNotFoundException
-	 */
-	public void save() throws java.io.IOException, SavePropertiesException, ClassNotFoundException
-	{
-		/**
-		 * Save using the plugin that loaded the properties
-		 * to the URI the properties were loaded from
-		 */
-		_pm.save(null, null);
-	}
-
-
-	private void retrievePropertyToAttributeMappings(String name) throws MappingsNotFoundException
-	{
-		InputStream mappingsIn = Thread.currentThread().getContextClassLoader().getResourceAsStream(name + MAPPINGS_FILENAME_SUFFIX);
-
-		if (mappingsIn != null)
-		{
-			try
-			{
-				BufferedReader in = new BufferedReader(new InputStreamReader(mappingsIn));
-				String mapping;
-				String comment = null;
-
-				/**
-				 * Read in each one-to-one mapping:
-				 *
-				 *     property=attribute
-				 *
-				 * Store them in separate arrays
-				 */
-				while ((mapping = in.readLine()) != null)
-				{
-					if (mapping.startsWith(COMMENT_PREFIX))
-					{
-						if (mapping.length() > 1)
-						{
-							comment = mapping.substring(1);
-						}
-					}
-					else
-					{
-						if (mapping.indexOf('=') == -1)
-						{
-							throw new MappingsNotFoundException("A valid property-to-attribute was not found (" + name + MAPPINGS_FILENAME_SUFFIX + ")");
-						}
-
-						_propertyMapping.add(mapping.substring(0, mapping.indexOf('=')));
-						_attributeMapping.add(mapping.substring(mapping.indexOf('=') + 1));
-
-
-                        if (comment != null)
-                        {
-                            _comment.put(mapping.substring(0, mapping.indexOf('=')), comment);
-                        }
-
-						comment = null;
-					}
-				}
-
-				in.close();
-			}
-			catch (java.io.IOException e)
-			{
-				throw new MappingsNotFoundException("Failed to load property-to-attribute mappings (" + name + MAPPINGS_FILENAME_SUFFIX + ")", e);
-			}
-		}
-		else
-		{
-			throw new MappingsNotFoundException("Failed to find property-to-attribute mappings (" + name + MAPPINGS_FILENAME_SUFFIX + ")");
-		}
-	}
-
-	private String getPropertyForAttribute(String attributeName)
-	{
-		String property = null;
-		int index = _attributeMapping.indexOf(attributeName);
-
-		if (index != -1)
-		{
-			property = (String) _propertyMapping.get(index);
-		}
-
-		return property;
-	}
-
-
-	public void setAttribute(Attribute attribute) throws AttributeNotFoundException, InvalidAttributeValueException, MBeanException, ReflectionException
-	{
-		/** If the attribute name is a valid property **/
-		if (_attributeMapping.contains(attribute.getName()))
-		{
-			String property = getPropertyForAttribute(attribute.getName());
-
-			if (property == null)
-			{
-				throw new AttributeNotFoundException("Attribute-to-property mapping not found for: " + attribute.getName());
-			}
-
-			/** Set the property **/
-			_pm.setProperty(property, (String) attribute.getValue());
-		}
-		else
-			throw new AttributeNotFoundException("Attribute '" + attribute.getName() + "' does not exist within this property manager");
-	}
-
-	public AttributeList setAttributes(AttributeList attributeList)
-	{
-		AttributeList returnList = new AttributeList();
-
-		for (int count = 0; count < attributeList.size(); count++)
-		{
-			Attribute attribute = (Attribute) attributeList.get(count);
-
-			/** If the attribute name is a valid property **/
-			if (_attributeMapping.contains(attribute.getName()))
-			{
-				try
-				{
-					/** Try to set the attribute **/
-					setAttribute(attribute);
-
-					/** Add this attribute to the returned list of set attributes **/
-					returnList.add(attribute);
-				}
-				catch (Exception e)
-				{
-					// Ignore
-				}
-			}
-		}
-
-		return returnList;
-	}
-
-	public Object getAttribute(String s) throws AttributeNotFoundException, MBeanException, ReflectionException
-	{
-		String returnValue = null;
-
-		/** Ensure the attribute maps onto an existing property **/
-		if (_attributeMapping.contains(s))
-		{
-			returnValue = _pm.getProperty(getPropertyForAttribute(s), null);
-		}
-
-		if (returnValue == null)
-		{
-			throw new AttributeNotFoundException("The attribute '" + s + "' is not defined");
-		}
-
-		return returnValue;
-	}
-
-	public AttributeList getAttributes(String[] strings)
-	{
-		AttributeList returnList = new AttributeList(strings.length);
-
-		for (int count = 0; count < strings.length; count++)
-		{
-			try
-			{
-				returnList.add(new Attribute(strings[count], getAttribute(strings[count])));
-			}
-			catch (Exception e)
-			{
-				// Ignore exceptions
-			}
-		}
-
-		return returnList;
-	}
-
-	public Object invoke(String methodName, Object[] params, String[] signature) throws MBeanException, ReflectionException
-	{
-		if ((methodName.equals("save")) && (params.length == 0))
-		{
-			try
-			{
-				save();
-			}
-			catch (Exception e)
-			{
-				throw new MBeanException(e);
-			}
-		}
-		return null;
-	}
-
-	public MBeanInfo getMBeanInfo()
-	{
-		if (_info == null)
-		{
-			_info = new MBeanInfo(this.getClass().getName(),
-					"This is a mbean representing the properties stored in '" + _pm.getName() + "'",
-					getAttributeInfo(),
-					null,
-					getOperationInfo(),
-					null);
-		}
-
-		return _info;
-	}
-
-	private MBeanOperationInfo[] getOperationInfo()
-	{
-		MBeanOperationInfo saveOperation = null;
-
-		try
-		{
-			saveOperation = new MBeanOperationInfo("Save the properties",
-					this.getClass().getMethod("save", (Class[])null));
-		}
-		catch (NoSuchMethodException e)
-		{
-			// This shouldn't happen
-		}
-
-		return new MBeanOperationInfo[]{saveOperation};
-	}
-
-	private MBeanAttributeInfo[] getAttributeInfo()
-	{
-		ArrayList attributes = new ArrayList();
-		Properties p = new Properties();
-		p.putAll(_pm.getLocalProperties());
-
-		for (Enumeration e = p.keys(); e.hasMoreElements();)
-		{
-			String propertyName = (String) e.nextElement();
-			// Only add the property if a mapping exists for it
-			if (_propertyMapping.contains(propertyName))
-			{
-				int index = _propertyMapping.indexOf(propertyName);
-
-				if (index != -1)
-				{
-					/** If a comment exists for this attribute then retrieve it **/
-                    String comment = (String) _comment.get(propertyName);
-
-					attributes.add(new MBeanAttributeInfo((String) _attributeMapping.get(index), // Attribute Name
-							java.lang.String.class.getName(), // Attribute Type
-							comment, // Attribute Description
-							true, // Attribute is readable
-							true, // Attribute is writable
-							false)); // Attribute is not is
-				}
-			}
-		}
-
-		MBeanAttributeInfo[] attrInfo = new MBeanAttributeInfo[attributes.size()];
-		attributes.toArray(attrInfo);
-
-		return attrInfo;
-	}
-
-	/**
-	 * Get the object name for this MBean
-	 * @return the ObjectName
-	 * @throws MalformedObjectNameException
-	 */
-	public ObjectName getObjectName() throws MalformedObjectNameException
-	{
-		return new ObjectName(PROPERTY_FILE_MBEAN_OBJECT_NAME_PREFIX + _pm.getName());
-	}
-}

Modified: labs/jbosstm/trunk/ArjunaJTA/jdbc/classes/com/arjuna/ats/internal/jdbc/recovery/BasicXARecovery.java
===================================================================
--- labs/jbosstm/trunk/ArjunaJTA/jdbc/classes/com/arjuna/ats/internal/jdbc/recovery/BasicXARecovery.java	2009-11-05 10:55:44 UTC (rev 30005)
+++ labs/jbosstm/trunk/ArjunaJTA/jdbc/classes/com/arjuna/ats/internal/jdbc/recovery/BasicXARecovery.java	2009-11-05 10:57:16 UTC (rev 30006)
@@ -37,7 +37,7 @@
 import com.arjuna.ats.jta.recovery.XAResourceRecovery;
 
 import com.arjuna.common.util.logging.*;
-import com.arjuna.common.util.propertyservice.PropertyManagerFactory;
+import com.arjuna.common.util.propertyservice.PropertiesFactory;
 
 import java.sql.*;
 import javax.transaction.xa.*;
@@ -158,7 +158,7 @@
 
 		try
 		{
-            props = PropertyManagerFactory.getPropertiesFromFile(fileName);
+            props = PropertiesFactory.getPropertiesFromFile(fileName);
 		}
 		catch (Exception e)
 		{

Modified: labs/jbosstm/trunk/ArjunaJTA/jdbc/classes/com/arjuna/ats/internal/jdbc/recovery/JDBCXARecovery.java
===================================================================
--- labs/jbosstm/trunk/ArjunaJTA/jdbc/classes/com/arjuna/ats/internal/jdbc/recovery/JDBCXARecovery.java	2009-11-05 10:55:44 UTC (rev 30005)
+++ labs/jbosstm/trunk/ArjunaJTA/jdbc/classes/com/arjuna/ats/internal/jdbc/recovery/JDBCXARecovery.java	2009-11-05 10:57:16 UTC (rev 30006)
@@ -38,7 +38,7 @@
 import javax.sql.*;
 import javax.transaction.xa.*;
 import com.arjuna.common.util.logging.*;
-import com.arjuna.common.util.propertyservice.PropertyManagerFactory;
+import com.arjuna.common.util.propertyservice.PropertiesFactory;
 import com.arjuna.ats.arjuna.logging.FacilityCode;
 import com.arjuna.ats.jdbc.logging.jdbcLogger;
 import com.arjuna.ats.jta.recovery.XAResourceRecovery;
@@ -96,7 +96,7 @@
 
         try
         {
-            _props = PropertyManagerFactory.getPropertiesFromFile(parameter);
+            _props = PropertiesFactory.getPropertiesFromFile(parameter);
 
             _dbName   = _props.getProperty(DATABASE_JNDI_NAME);
             _user     = _props.getProperty(USER_NAME);

Modified: labs/jbosstm/trunk/common/classes/com/arjuna/common/internal/util/propertyservice/BeanPopulator.java
===================================================================
--- labs/jbosstm/trunk/common/classes/com/arjuna/common/internal/util/propertyservice/BeanPopulator.java	2009-11-05 10:55:44 UTC (rev 30005)
+++ labs/jbosstm/trunk/common/classes/com/arjuna/common/internal/util/propertyservice/BeanPopulator.java	2009-11-05 10:57:16 UTC (rev 30006)
@@ -26,7 +26,7 @@
 import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.ConcurrentMap;
 
-import com.arjuna.common.util.propertyservice.PropertyManagerFactory;
+import com.arjuna.common.util.propertyservice.PropertiesFactory;
 
 /**
  * Utility class that configures *EnvironmentBean objects using a PropertyManager, which is usually
@@ -46,7 +46,7 @@
             T bean = null;
             try {
                 bean = beanClass.newInstance();
-                Properties properties = PropertyManagerFactory.getDefaultProperties();
+                Properties properties = PropertiesFactory.getDefaultProperties();
                 configureFromProperties(bean, properties);
             } catch (Exception e) {
                 throw new RuntimeException(e);

Deleted: labs/jbosstm/trunk/common/classes/com/arjuna/common/internal/util/propertyservice/PropertyManagerImpl.java
===================================================================
--- labs/jbosstm/trunk/common/classes/com/arjuna/common/internal/util/propertyservice/PropertyManagerImpl.java	2009-11-05 10:55:44 UTC (rev 30005)
+++ labs/jbosstm/trunk/common/classes/com/arjuna/common/internal/util/propertyservice/PropertyManagerImpl.java	2009-11-05 10:57:16 UTC (rev 30006)
@@ -1,335 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2006, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags.
- * 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.
- */
-package com.arjuna.common.internal.util.propertyservice;
-
-import com.arjuna.common.util.propertyservice.propertycontainer.PropertyManagerPluginInterface;
-import com.arjuna.common.util.propertyservice.Environment;
-import com.arjuna.common.util.propertyservice.plugins.PropertyManagerIOPlugin;
-import com.arjuna.common.util.propertyservice.plugins.PropertyManagementPlugin;
-import com.arjuna.common.util.exceptions.LoadPropertiesException;
-import com.arjuna.common.util.exceptions.SavePropertiesException;
-import com.arjuna.common.util.exceptions.ManagementPluginException;
-
-import java.util.Properties;
-import java.util.Enumeration;
-import java.io.IOException;
-
-/*
- * Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003
- *
- * Arjuna Technologies Ltd.
- * Newcastle upon Tyne,
- * Tyne and Wear,
- * UK.
- *
- * $Id: PropertyManagerImpl.java 2342 2006-03-30 13:06:17Z  $
- */
-
-/**
- * Implementation of the Property Manager.
- *
- * @author Richard A. Begg (richard.begg at arjuna.com)
- */
-public class PropertyManagerImpl implements PropertyManagerPluginInterface
-{
-    /** Specifies whether the property manager is in verbose mode **/
-	protected static boolean _verbose = false;
-    /** Properties stored within this property manager **/
-    protected Properties _properties;
-    /** The name of this property manager **/
-    protected String _name;
-    /** The uri associated with this property manager **/
-    protected String _associatedUri;
-    private String _associatedPluginClassname;
-
-    public PropertyManagerImpl(String name) {
-        _associatedUri = null;
-        _name = name;
-        _properties = new Properties();
-    }
-
-    /**
-     * Retrieve the name of this property manager
-     * @return the property manager name
-     */
-	public String getName()
-	{
-		return _name;
-	}
-
-    /**
-     * Retrieves the URI associated with this property manager
-     * @return the URI
-     */
-    public String getUri()
-    {
-        return _associatedUri;
-    }
-
-    /**
-     * Set the URI associated with this property manager
-     * @param uri the URI
-     */
-    public void setUri(String uri)
-    {
-        _associatedUri = uri;
-    }
-
-    public String getIOPluginClassname()
-	{
-		return _associatedPluginClassname;
-	}
-
-    public void setIOPluginClassname(String classname)
-	{
-		_associatedPluginClassname = classname;
-	}
-
-    /**
-	 * Get the value of the property with the name <code>name</code>
-	 *
-	 * @param name The name of the property to retrieve the value of.
-	 * @return The value of the property.
-	 */
-	public String getProperty(String name)
-	{
-		/** Get the system property **/
-		String value = System.getProperty(name);
-
-		/** If the system property is null look in the local properties **/
-		value = value != null ? value : _properties.getProperty(name);
-
-		return value;
-	}
-
-    /**
-	 * Get the value of the property with the name <code>name</code>.
-	 * If the property cannot be found return the value <code>defaultValue</code>.
-	 *
-	 * @param name The name of the property to retrieve the value of.
-	 * @param defaultValue The default value to return if the property cannot be found.
-	 * @return The value of the property (or defaultValue).
-	 */
-	public String getProperty(String name, String defaultValue)
-	{
-		String value = getProperty(name);
-
-		return value == null ? defaultValue : value;
-	}
-
-    /**
-	 * Set the value of the property <code>name</code> to <code>value</code>.
-	 *
-	 * @param name The name of the property to set.
-	 * @param value The value of the property being set.
-	 * @return The previous value of the property.
-	 */
-	public String setProperty(String name, String value)
-	{
-		return setProperty(name, value, true);
-	}
-
-    /**
-	 * Set the value of the property <code>name</code> to <code>value</code>.
-	 *
-	 * @param name The name of the property to set.
-	 * @param value The value of the property being set.
-	 * @param setSystemProperty True - set the system property if it has a value
-	 * @return the previous value of the property
-	 */
-	public String setProperty(String name, String value, boolean setSystemProperty)
-	{
-		/** If the property exists in the system properties ensure that is set also **/
-		if ( setSystemProperty && System.getProperty(name) != null )
-		{
-			System.setProperty(name, value);
-		}
-
-		String oldValue = _properties.getProperty(name);
-
-		_properties.setProperty(name, value);
-
-		return oldValue;
-	}
-
-    /**
-	 * Removes the property from the property manager.
-	 * @param name The name of the property to remove.
-	 * @return previous value of the property
-	 */
-	public String removeProperty(String name)
-	{
-		/** If the property exists in the system properties ensure that is removed also **/
-		if ( System.getProperty(name) != null )
-		{
-			System.getProperties().remove(name);
-		}
-
-        String oldValue = _properties.getProperty(name);
-
-        if ( oldValue != null )
-        {
-            _properties.remove(name);
-        }
-
-		return oldValue;
-	}
-
-    /**
-	 * Get the properties stored in this property manager only.
-	 * @return the Properties
-	 */
-	public Properties getLocalProperties()
-	{
-		return _properties;
-	}
-
-    /**
-	 * Get all the properties stored in this property manager and it's parents.
-     * It also includes the system properties.
-	 *
-	 * @return the Properties
-	 */
-	public Properties getProperties()
-	{
-		Properties returnProps = (Properties)_properties.clone();
-
-        returnProps.putAll(System.getProperties());
-
-        return returnProps;
-    }
-
-    /**
-	 * Returns an enumeration of the property names
-	 * @return the enumeration
-	 */
-	public Enumeration propertyNames()
-	{
-		return getProperties().keys();
-	}
-
-    /**
-	 * Loads properties from a given URI using the given property manager plugin.
-	 * This plugin can be overridden by setting the system property 'propertyservice.plugin'.
-	 *
-	 * @param pluginClassname The classname of the plugin in to use.  This plugin is loaded
-	 * using the current thread context classloader.
-	 * @param uri The URI to load.
-	 */
-	public synchronized void load(String pluginClassname, String uri) throws IOException, ClassNotFoundException, LoadPropertiesException
-	{
-		try
-		{
-            String existingUri = getUri();
-            if(existingUri != null && !existingUri.equals(uri)) {
-                throw new LoadPropertiesException("Not allowed to reload from a different uri! [existing: "+existingUri+", requested: "+uri+"]");
-            }
-
-			/** Check to see if the system property has been set **/
-			String classname = System.getProperty(Environment.OVERRIDING_PLUGIN_CLASSNAME);
-			classname = classname == null ? pluginClassname : classname;
-
-			PropertyManagerIOPlugin plugin = (PropertyManagerIOPlugin)Thread.currentThread().getContextClassLoader().loadClass(classname).newInstance();
-
-			plugin.load(uri, this, _verbose);
-
-            this.setUri(uri);
-		}
-		catch (IOException e)
-		{
-			throw e;
-		}
-        catch (Exception e)
-		{
-			throw new LoadPropertiesException("Failed to instantiate plugin: "+e, e);
-		}
-	}
-
-    /**
-	 * Saves the properties stored in this property manager using the given
-	 * property manager plugin.  This plugin can be overridden by setting the
-	 * system property 'propertyservice.plugin'
-	 *
-	 * @param pluginClassname The classname of the plugin to use.  This plugin is loaded
-	 * using the current thread context classloader.  If null is provided the plugin used to
-	 * load the properties is also used to save them.
-	 * @param uri The URI to save to.  If null is provided the uri used to load the properties
-	 * is also used to save them.
-	 * @throws java.io.IOException
-	 * @throws ClassNotFoundException
-	 * @throws com.arjuna.common.util.exceptions.SavePropertiesException
-	 */
-	public synchronized void save(String pluginClassname, String uri) throws IOException, ClassNotFoundException, SavePropertiesException
-	{
-		try
-		{
-			if ( pluginClassname == null )
-			{
-				pluginClassname = _associatedPluginClassname;
-			}
-
-			/** Check to see if the system property has been set **/
-			String classname = System.getProperty(Environment.OVERRIDING_PLUGIN_CLASSNAME);
-			classname = classname == null ? pluginClassname : classname;
-
-			PropertyManagerIOPlugin plugin = (PropertyManagerIOPlugin)Thread.currentThread().getContextClassLoader().loadClass(pluginClassname).newInstance();
-
-			plugin.save(uri, this);
-		}
-		catch (IOException e)
-		{
-			throw e;
-		}
-        catch (Exception e)
-		{
-			e.printStackTrace(System.err);
-			throw new SavePropertiesException("Failed to instantiate plugin: "+e, e);
-		}
-	}
-
-    public boolean verbose()
-	{
-		return _verbose;
-	}
-
-    /**
-	 * This adds a management plugin to this property manager.
-     *
-     * @param plugin The proeprty management plugin to plugin.
-     * @throws java.io.IOException
-     * @throws com.arjuna.common.util.exceptions.ManagementPluginException
-     */
-    public void addManagementPlugin(PropertyManagementPlugin plugin) throws IOException, ManagementPluginException
-    {
-        try
-        {
-            plugin.initialise(this);
-        }
-        catch (IOException e)
-        {
-            throw e;
-        }
-        catch (Exception e)
-        {
-            throw new ManagementPluginException(e.toString(), e);
-        }
-    }
-}

Deleted: labs/jbosstm/trunk/common/classes/com/arjuna/common/util/exceptions/LoadPropertiesException.java
===================================================================
--- labs/jbosstm/trunk/common/classes/com/arjuna/common/util/exceptions/LoadPropertiesException.java	2009-11-05 10:55:44 UTC (rev 30005)
+++ labs/jbosstm/trunk/common/classes/com/arjuna/common/util/exceptions/LoadPropertiesException.java	2009-11-05 10:57:16 UTC (rev 30006)
@@ -1,94 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2006, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags.
- * 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.
- */
-package com.arjuna.common.util.exceptions;
-
-/*
- * Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003
- *
- * Arjuna Technologies Ltd.
- * Newcastle upon Tyne,
- * Tyne and Wear,
- * UK.
- *
- * $Id: LoadPropertiesException.java 2342 2006-03-30 13:06:17Z  $
- */
-
-public class LoadPropertiesException extends Exception
-{
-    static final long serialVersionUID = 3399885534011195787L;
-    
-    /**
-     * Constructs a new exception with <code>null</code> as its detail message.
-     * The cause is not initialized, and may subsequently be initialized by a
-     * call to {@link #initCause}.
-     */
-    public LoadPropertiesException() {
-        super();
-    }
-
-    /**
-     * Constructs a new exception with the specified detail message.  The
-     * cause is not initialized, and may subsequently be initialized by
-     * a call to {@link #initCause}.
-     *
-     * @param message the detail message. The detail message is saved for
-     *                later retrieval by the {@link #getMessage()} method.
-     */
-    public LoadPropertiesException(String message) {
-        super(message);
-    }
-
-    /**
-     * Constructs a new exception with the specified detail message and
-     * cause.  <p>Note that the detail message associated with
-     * <code>cause</code> is <i>not</i> automatically incorporated in
-     * this exception's detail message.
-     *
-     * @param message the detail message (which is saved for later retrieval
-     *                by the {@link #getMessage()} method).
-     * @param cause   the cause (which is saved for later retrieval by the
-     *                {@link #getCause()} method).  (A <tt>null</tt> value is
-     *                permitted, and indicates that the cause is nonexistent or
-     *                unknown.)
-     * @since 1.4
-     */
-    public LoadPropertiesException(String message, Throwable cause) {
-        super(message, cause);
-    }
-
-    /**
-     * Constructs a new exception with the specified cause and a detail
-     * message of <tt>(cause==null ? null : cause.toString())</tt> (which
-     * typically contains the class and detail message of <tt>cause</tt>).
-     * This constructor is useful for exceptions that are little more than
-     * wrappers for other throwables (for example, {@link
-     * java.security.PrivilegedActionException}).
-     *
-     * @param cause the cause (which is saved for later retrieval by the
-     *              {@link #getCause()} method).  (A <tt>null</tt> value is
-     *              permitted, and indicates that the cause is nonexistent or
-     *              unknown.)
-     * @since 1.4
-     */
-    public LoadPropertiesException(Throwable cause) {
-        super(cause);
-    }
-}

Deleted: labs/jbosstm/trunk/common/classes/com/arjuna/common/util/exceptions/ManagementPluginException.java
===================================================================
--- labs/jbosstm/trunk/common/classes/com/arjuna/common/util/exceptions/ManagementPluginException.java	2009-11-05 10:55:44 UTC (rev 30005)
+++ labs/jbosstm/trunk/common/classes/com/arjuna/common/util/exceptions/ManagementPluginException.java	2009-11-05 10:57:16 UTC (rev 30006)
@@ -1,94 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2006, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags.
- * 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.
- */
-package com.arjuna.common.util.exceptions;
-
-/*
- * Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003
- *
- * Arjuna Technologies Ltd.
- * Newcastle upon Tyne,
- * Tyne and Wear,
- * UK.
- *
- * $Id: ManagementPluginException.java 2342 2006-03-30 13:06:17Z  $
- */
-
-public class ManagementPluginException extends Exception
-{
-    static final long serialVersionUID = -575951072304555978L;
-    
-    /**
-     * Constructs a new exception with <code>null</code> as its detail message.
-     * The cause is not initialized, and may subsequently be initialized by a
-     * call to {@link #initCause}.
-     */
-    public ManagementPluginException() {
-        super();
-    }
-
-    /**
-     * Constructs a new exception with the specified detail message.  The
-     * cause is not initialized, and may subsequently be initialized by
-     * a call to {@link #initCause}.
-     *
-     * @param message the detail message. The detail message is saved for
-     *                later retrieval by the {@link #getMessage()} method.
-     */
-    public ManagementPluginException(String message) {
-        super(message);
-    }
-
-    /**
-     * Constructs a new exception with the specified detail message and
-     * cause.  <p>Note that the detail message associated with
-     * <code>cause</code> is <i>not</i> automatically incorporated in
-     * this exception's detail message.
-     *
-     * @param message the detail message (which is saved for later retrieval
-     *                by the {@link #getMessage()} method).
-     * @param cause   the cause (which is saved for later retrieval by the
-     *                {@link #getCause()} method).  (A <tt>null</tt> value is
-     *                permitted, and indicates that the cause is nonexistent or
-     *                unknown.)
-     * @since 1.4
-     */
-    public ManagementPluginException(String message, Throwable cause) {
-        super(message, cause);
-    }
-
-    /**
-     * Constructs a new exception with the specified cause and a detail
-     * message of <tt>(cause==null ? null : cause.toString())</tt> (which
-     * typically contains the class and detail message of <tt>cause</tt>).
-     * This constructor is useful for exceptions that are little more than
-     * wrappers for other throwables (for example, {@link
-     * java.security.PrivilegedActionException}).
-     *
-     * @param cause the cause (which is saved for later retrieval by the
-     *              {@link #getCause()} method).  (A <tt>null</tt> value is
-     *              permitted, and indicates that the cause is nonexistent or
-     *              unknown.)
-     * @since 1.4
-     */
-    public ManagementPluginException(Throwable cause) {
-        super(cause);
-    }
-}

Deleted: labs/jbosstm/trunk/common/classes/com/arjuna/common/util/exceptions/SavePropertiesException.java
===================================================================
--- labs/jbosstm/trunk/common/classes/com/arjuna/common/util/exceptions/SavePropertiesException.java	2009-11-05 10:55:44 UTC (rev 30005)
+++ labs/jbosstm/trunk/common/classes/com/arjuna/common/util/exceptions/SavePropertiesException.java	2009-11-05 10:57:16 UTC (rev 30006)
@@ -1,94 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2006, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags.
- * 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.
- */
-package com.arjuna.common.util.exceptions;
-
-/*
- * Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003
- *
- * Arjuna Technologies Ltd.
- * Newcastle upon Tyne,
- * Tyne and Wear,
- * UK.
- *
- * $Id: SavePropertiesException.java 2342 2006-03-30 13:06:17Z  $
- */
-
-public class SavePropertiesException extends Exception
-{
-    static final long serialVersionUID = -2995710393937448490L;
-    
-    /**
-     * Constructs a new exception with <code>null</code> as its detail message.
-     * The cause is not initialized, and may subsequently be initialized by a
-     * call to {@link #initCause}.
-     */
-    public SavePropertiesException() {
-        super();
-    }
-
-    /**
-     * Constructs a new exception with the specified detail message.  The
-     * cause is not initialized, and may subsequently be initialized by
-     * a call to {@link #initCause}.
-     *
-     * @param message the detail message. The detail message is saved for
-     *                later retrieval by the {@link #getMessage()} method.
-     */
-    public SavePropertiesException(String message) {
-        super(message);
-    }
-
-    /**
-     * Constructs a new exception with the specified detail message and
-     * cause.  <p>Note that the detail message associated with
-     * <code>cause</code> is <i>not</i> automatically incorporated in
-     * this exception's detail message.
-     *
-     * @param message the detail message (which is saved for later retrieval
-     *                by the {@link #getMessage()} method).
-     * @param cause   the cause (which is saved for later retrieval by the
-     *                {@link #getCause()} method).  (A <tt>null</tt> value is
-     *                permitted, and indicates that the cause is nonexistent or
-     *                unknown.)
-     * @since 1.4
-     */
-    public SavePropertiesException(String message, Throwable cause) {
-        super(message, cause);
-    }
-
-    /**
-     * Constructs a new exception with the specified cause and a detail
-     * message of <tt>(cause==null ? null : cause.toString())</tt> (which
-     * typically contains the class and detail message of <tt>cause</tt>).
-     * This constructor is useful for exceptions that are little more than
-     * wrappers for other throwables (for example, {@link
-     * java.security.PrivilegedActionException}).
-     *
-     * @param cause the cause (which is saved for later retrieval by the
-     *              {@link #getCause()} method).  (A <tt>null</tt> value is
-     *              permitted, and indicates that the cause is nonexistent or
-     *              unknown.)
-     * @since 1.4
-     */
-    public SavePropertiesException(Throwable cause) {
-        super(cause);
-    }
-}

Deleted: labs/jbosstm/trunk/common/classes/com/arjuna/common/util/propertyservice/Environment.java
===================================================================
--- labs/jbosstm/trunk/common/classes/com/arjuna/common/util/propertyservice/Environment.java	2009-11-05 10:55:44 UTC (rev 30005)
+++ labs/jbosstm/trunk/common/classes/com/arjuna/common/util/propertyservice/Environment.java	2009-11-05 10:57:16 UTC (rev 30006)
@@ -1,43 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2006, Red Hat Middleware LLC, and individual contributors 
- * as indicated by the @author tags. 
- * 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.
- */
-package com.arjuna.common.util.propertyservice;
-
-/**
- * The various property variables that can be set at
- * runtime to configure the some of the classes within
- * the package.
- *
- * The various values are:
- * <ul>
- * <li> VERBOSE_PROPERTY_MANAGER = com.arjuna.common.util.propertyservice.verbosePropertyManager
- * <li> PROPERTY_MANAGER_IMPLEMENTATION = com.arjuna.common.propertyManagerImplementation
- * </ul>
- *
- * @author Richard Begg (richard.begg at arjun.com)
- * @version $Id: Environment.java 2342 2006-03-30 13:06:17Z  $
- * @since clf-2.0
- */
-
-public class Environment
-{
-   public static final String VERBOSE_PROPERTY_MANAGER = "com.arjuna.common.util.propertyservice.verbosePropertyManager";
-   public static final String OVERRIDING_PLUGIN_CLASSNAME = "com.arjuna.common.util.propertyservice.pluginclassname";
-}

Copied: labs/jbosstm/trunk/common/classes/com/arjuna/common/util/propertyservice/PropertiesFactory.java (from rev 30001, labs/jbosstm/trunk/common/classes/com/arjuna/common/util/propertyservice/PropertyManagerFactory.java)
===================================================================
--- labs/jbosstm/trunk/common/classes/com/arjuna/common/util/propertyservice/PropertiesFactory.java	                        (rev 0)
+++ labs/jbosstm/trunk/common/classes/com/arjuna/common/util/propertyservice/PropertiesFactory.java	2009-11-05 10:57:16 UTC (rev 30006)
@@ -0,0 +1,189 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors 
+ * as indicated by the @author tags. 
+ * 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.
+ */
+package com.arjuna.common.util.propertyservice;
+
+import com.arjuna.common.util.FileLocator;
+import com.arjuna.common.util.ConfigurationInfo;
+
+import java.util.Properties;
+import java.util.Enumeration;
+import java.io.*;
+import java.net.URL;
+
+/*
+ * Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003
+ *
+ * Arjuna Technologies Ltd.
+ * Newcastle upon Tyne,
+ * Tyne and Wear,
+ * UK.
+ *
+ */
+
+/**
+ * This class loads properties according to the file location, substitution and override rules described in the docs.
+ *
+ * @author Richard A. Begg (richard.begg at arjuna.com)
+ */
+public class PropertiesFactory
+{
+    private static volatile Properties defaultProperties = null;
+
+    /**
+     * Returns the systems default properties, as read from the configuration file.
+     * @return the configuration Properties
+     */
+    public static Properties getDefaultProperties() {
+        if(defaultProperties == null) {
+            // TODO: pick and document new standard for global config file name property. For now use 'common' module value.
+            initDefaultProperties("com.arjuna.ats.arjuna.common.propertiesFile");
+        }
+
+        return defaultProperties;
+    }
+
+    /**
+     * Returns the config properties read from a specified location.
+     *
+     * @param propertyFileName the file name. If relative, this is located using the FileLocator algorithm.
+     * @return the Properties loaded from the specified source.
+     */
+    public static Properties getPropertiesFromFile(String propertyFileName)
+    {
+        String filepath = null;
+        try
+        {
+            // Convert the possibly relative path into a canonical path, using FileLocator.
+            // This is the point where the search path is applied - user.dir (pwd), user.home, java.home, classpath
+            filepath = FileLocator.locateFile(propertyFileName);
+            File propertyFile = new File(filepath);
+            if(!propertyFile.exists() || !propertyFile.isFile()) {
+                throw new RuntimeException("invalid property file "+filepath);
+            }
+            filepath = propertyFile.getCanonicalPath();
+        }
+        catch(FileNotFoundException fileNotFoundException)
+        {
+            // try falling back to a default file built into the .jar
+            // Note the default- prefix on the name, to avoid finding it from the .jar at the previous stage
+            // in cases where the .jar comes before the etc dir on the classpath.
+            URL url = PropertiesFactory.class.getResource("/default-"+propertyFileName);
+            if(url == null) {
+                throw new RuntimeException("missing property file "+propertyFileName);
+            } else {
+                filepath = url.toString();
+            }
+        }
+        catch (IOException e)
+        {
+            throw new RuntimeException("invalid property file "+filepath, e);
+        }
+
+        Properties properties = null;
+
+        try {
+            properties = loadFromFile(filepath);
+            properties = applySystemProperties(properties);
+
+        } catch(Exception e) {
+            throw new RuntimeException("unable to load properties from file "+filepath, e);
+        }
+
+        return properties;
+    }
+
+    /////////////////
+
+    // system properties take precedence over ones from the file.
+    private static Properties applySystemProperties(Properties inputProperties)
+    {
+        Properties outputProperties = new Properties(inputProperties);
+        Enumeration enumeration = System.getProperties().propertyNames();
+        while(enumeration.hasMoreElements()) {
+            String key = (String)enumeration.nextElement();
+            outputProperties.setProperty(key, System.getProperty(key));
+        }
+        return outputProperties;
+    }
+
+    // standard java.util.Properties xml format, with JBossAS style substitution post-processing.
+    private static Properties loadFromFile(String uri) throws IOException
+    {
+        InputStream inputStream = null;
+        Properties inputProperties = new Properties();
+        Properties outputProperties = new Properties();
+
+        if( new File(uri).exists() ) {
+            inputStream = new FileInputStream(uri);
+        } else {
+            inputStream = new URL(uri).openStream();
+        }
+
+        try {
+            inputProperties.loadFromXML(inputStream);
+        } finally {
+            inputStream.close();
+        }
+
+        Enumeration namesEnumeration = inputProperties.propertyNames();
+        while(namesEnumeration.hasMoreElements()) {
+            String propertyName = (String)namesEnumeration.nextElement();
+            String propertyValue = inputProperties.getProperty(propertyName);
+
+            propertyValue = propertyValue.trim();
+
+            // perform JBossAS style property substitutions. JBTM-369
+            propertyValue = StringPropertyReplacer.replaceProperties(propertyValue);
+
+            outputProperties.setProperty(propertyName, propertyValue);
+        }
+
+        return outputProperties;
+    }
+
+    private static synchronized void initDefaultProperties(String fileNamePropertyKey)
+    {
+        if(defaultProperties != null) {
+            return;
+        }
+
+        // This is where the properties loading takes place. The algorithm is as follows:
+
+        // If the specified fileNamePropertyKey exists as a key is the system properties, take the value of that property as
+        // the location of the module's properties file. This allows file location to be overriden easily.
+        String propertyFileName = System.getProperty(fileNamePropertyKey);
+
+        // If the system property is not set, try to load the build time properties. Build time properties
+        // are not the module properties! These are optional and so loading may fail. That's not considered an error.
+        // If the properties file name is defined by the build time properties, use that.
+        // (In JBossTS it mostly does exist - the build scripts put build time properties into the .jars manifest file.)
+        if (propertyFileName == null) {
+            propertyFileName = ConfigurationInfo.getPropertiesFile();
+        }
+
+        // Bail out if it has not been possible to get a file name by either of these method.
+        if(propertyFileName == null) {
+            throw new RuntimeException("Unable to resolve property file name");
+        }
+
+        defaultProperties = getPropertiesFromFile(propertyFileName);
+    }
+}


Property changes on: labs/jbosstm/trunk/common/classes/com/arjuna/common/util/propertyservice/PropertiesFactory.java
___________________________________________________________________
Name: svn:executable
   + 

Deleted: labs/jbosstm/trunk/common/classes/com/arjuna/common/util/propertyservice/PropertyManager.java
===================================================================
--- labs/jbosstm/trunk/common/classes/com/arjuna/common/util/propertyservice/PropertyManager.java	2009-11-05 10:55:44 UTC (rev 30005)
+++ labs/jbosstm/trunk/common/classes/com/arjuna/common/util/propertyservice/PropertyManager.java	2009-11-05 10:57:16 UTC (rev 30006)
@@ -1,140 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2006, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags.
- * 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.
- */
-package com.arjuna.common.util.propertyservice;
-
-import com.arjuna.common.util.exceptions.LoadPropertiesException;
-import com.arjuna.common.util.exceptions.ManagementPluginException;
-import com.arjuna.common.util.propertyservice.plugins.PropertyManagementPlugin;
-import com.arjuna.common.util.exceptions.SavePropertiesException;
-
-import java.util.Properties;
-import java.util.Enumeration;
-
-/*
- * Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003
- *
- * Arjuna Technologies Ltd.
- * Newcastle upon Tyne,
- * Tyne and Wear,
- * UK.
- *
- * $Id: PropertyManager.java 2342 2006-03-30 13:06:17Z  $
- */
-
-public interface PropertyManager
-{
-	/**
-	 * Get the value of the property with the name <code>name</code>
-	 *
-	 * @param name The name of the property to retrieve the value of.
-	 * @return The value of the property.
-	 */
-    public String getProperty(String name);
-
-	/**
-	 * Get the value of the property with the name <code>name</code>.
-	 * If the property cannot be found return the value <code>defaultValue</code>.
-	 *
-	 * @param name The name of the property to retrieve the value of.
-	 * @param defaultValue The default value to return if the property cannot be found.
-	 * @return The value of the property (or defaultValue).
-	 */
-	public String getProperty(String name, String defaultValue);
-
-	/**
-	 * Set the value of the property <code>name</code> to <code>value</code>.
-	 *
-	 * @param name The name of the property to set.
-	 * @param value The value of the property being set.
-	 * @param setSystemProperty True - set the system property if it has a value
-	 * @return The previous value of the property.
-	 */
-	public String setProperty(String name, String value, boolean setSystemProperty);
-
-	/**
-	 * Set the value of the property <code>name</code> to <code>value</code>
-	 * @param name The name of the property to set.
-	 * @param value The value of the property to set.
-	 * @return The previous value of the property.
-	 */
-	public String setProperty(String name, String value);
-
-	/**
-	 * Removes the property from the property manager.
-	 * @param name The name of the property to remove.
-	 * @return The previous value of the property.
-	 */
-	public String removeProperty(String name);
-
-	/**
-	 * Get all the properties stored in this property manager
-	 *
-	 * @return the Properties
-	 */
-	public Properties getProperties();
-
-	/**
-	 * Returns an enumeration of the property names
-	 * @return the Enumeration
-	 */
-    public Enumeration propertyNames();
-
-	/**
-	 * Loads properties from a given URI using the given property manager plugin.
-	 * This plugin can be overridden by setting the system property 'propertyservice.plugin'.
-	 *
-	 * @param pluginClassname The classname of the plugin to use.  This plugin is loaded
-	 * using the current thread context classloader.
-	 * @param uri The URI to load.
-	 */
-	public void load(String pluginClassname, String uri) throws java.io.IOException, ClassNotFoundException, LoadPropertiesException;
-
-    /**
-	 * Saves the properties stored in this property manager using the given
-	 * property manager plugin.  This plugin can be overridden by setting the
-	 * system property 'propertyservice.plugin'
-	 *
-	 * @param pluginClassname The classname of the plugin to use.  This plugin is loaded
-	 * using the current thread context classloader.  If null is provided the plugin used
-	 * to load the properties is also used to save them.
-	 * @param uri The URI to save to.  If null is provided the uri used to load the properties
-	 * is also used to save them.
-	 * @throws java.io.IOException
-	 * @throws ClassNotFoundException
-	 * @throws SavePropertiesException
-	 */
-	public void save(String pluginClassname, String uri) throws java.io.IOException, ClassNotFoundException, SavePropertiesException;
-
-	/**
-	 * This adds a management plugin to this property manager.
-	 *
-	 * @param plugin The PropertyManagementPlugin to plug-in.
-	 * @throws java.io.IOException
-	 * @throws ManagementPluginException
-	 */
-	public void addManagementPlugin(PropertyManagementPlugin plugin) throws java.io.IOException, ManagementPluginException;
-
-	/**
-	 * Returns true if the property manager is in verbose mode
-	 * @return true if verbose, false otherwise
-	 */
-	public boolean verbose();
-}

Deleted: labs/jbosstm/trunk/common/classes/com/arjuna/common/util/propertyservice/PropertyManagerFactory.java
===================================================================
--- labs/jbosstm/trunk/common/classes/com/arjuna/common/util/propertyservice/PropertyManagerFactory.java	2009-11-05 10:55:44 UTC (rev 30005)
+++ labs/jbosstm/trunk/common/classes/com/arjuna/common/util/propertyservice/PropertyManagerFactory.java	2009-11-05 10:57:16 UTC (rev 30006)
@@ -1,177 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2006, Red Hat Middleware LLC, and individual contributors 
- * as indicated by the @author tags. 
- * 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.
- */
-package com.arjuna.common.util.propertyservice;
-
-import com.arjuna.common.internal.util.propertyservice.PropertyManagerImpl;
-import com.arjuna.common.internal.util.propertyservice.plugins.io.XMLFilePlugin;
-import com.arjuna.common.util.FileLocator;
-import com.arjuna.common.util.ConfigurationInfo;
-
-import java.util.Properties;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.ConcurrentMap;
-import java.io.IOException;
-import java.io.File;
-import java.io.FileNotFoundException;
-import java.net.URL;
-
-/*
- * Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003
- *
- * Arjuna Technologies Ltd.
- * Newcastle upon Tyne,
- * Tyne and Wear,
- * UK.
- *
- * $Id: PropertyManagerFactory.java 2342 2006-03-30 13:06:17Z  $
- */
-
-/**
- * This is the property manager factory used to produce properties.
- *
- * @author Richard A. Begg (richard.begg at arjuna.com)
- */
-public class PropertyManagerFactory
-{
-    private static ConcurrentMap<String, Properties> propertiesByModuleName = new ConcurrentHashMap<String, Properties>();
-    private static ConcurrentMap<String, Properties> propertiesByCanonicalFileName = new ConcurrentHashMap<String, Properties>();
-
-    public static Properties getDefaultProperties() {
-        // TODO: pick and document new standard for global config file name property. For now use 'common' module value.        
-       return getPropertiesForModule("common", "com.arjuna.ats.arjuna.common.propertiesFile");
-    }
-
-    /**
-     * Return a Properties object for the given module. If no such Properties exists, create one using
-     * the property file whose name is found by resolving the given key property.
-     *
-     * @param moduleName The symbolic name of the application module e.g. 'arjuna', 'txoj'.
-     * @param fileNamePropertyKey The name of the property whose value is the config file name.
-     * @return a Properties object.
-     */
-    private static Properties getPropertiesForModule(String moduleName, String fileNamePropertyKey)
-    {
-        // once loaded, Properties for each module are cached here.
-        // Clients (usually BeanPopulator classes in each app module) should not cache the returned
-        // Properties object, so that we can flush config just be clearing this one cache.
-        if(propertiesByModuleName.containsKey(moduleName)) {
-            return propertiesByModuleName.get(moduleName);
-        }
-
-        // first time we have been asked for this module's properties - try to load them.
-        return createPropertiesForModule(moduleName, fileNamePropertyKey);
-    }
-
-    public static Properties getPropertiesFromFile(String propertiesFileName) {
-        return getPropertiesFromFile(propertiesFileName, false);
-    }
-
-    private static Properties getPropertiesFromFile(String propertyFileName, boolean withCaching)
-    {
-        String filepath = null;
-        try
-        {
-            // Convert the possibly relative path into a canonical path, using FileLocator.
-            // This is the point where the search path is applied - user.dir (pwd), user.home, java.home, classpath
-            filepath = FileLocator.locateFile(propertyFileName);
-            File propertyFile = new File(filepath);
-            if(!propertyFile.exists() || !propertyFile.isFile()) {
-                throw new RuntimeException("invalid property file "+filepath);
-            }
-            filepath = propertyFile.getCanonicalPath();
-        }
-        catch(FileNotFoundException fileNotFoundException)
-        {
-            // try falling back to a default file built into the .jar
-            // Note the default- prefix on the name, to avoid finding it from the .jar at the previous stage
-            // in cases where the .jar comes before the etc dir on the classpath.
-            URL url = PropertyManagerFactory.class.getResource("/default-"+propertyFileName);
-            if(url == null) {
-                throw new RuntimeException("missing property file "+propertyFileName);
-            } else {
-                filepath = url.toString();
-            }
-        }
-        catch (IOException e)
-        {
-            throw new RuntimeException("invalid property file "+filepath, e);
-        }
-
-        // We have a candidate file. Check if we have loaded it already. If so, associate it to the module cache and return it.
-        Properties properties = null;
-
-        if(withCaching) {
-            properties = propertiesByCanonicalFileName.get(filepath);
-        }
-
-        // We have not loaded this file before. Do so now.
-        if(properties == null) {
-            PropertyManager propertyManager = new PropertyManagerImpl(propertyFileName);
-            try {
-                propertyManager.load(XMLFilePlugin.class.getName(), filepath);
-                properties = propertyManager.getProperties();
-                if(withCaching) {
-                    Properties existingProperties = propertiesByCanonicalFileName.putIfAbsent(filepath, properties);
-                    if(existingProperties != null) {
-                        properties = existingProperties;
-                    }
-                }
-            } catch(Exception e) {
-                throw new RuntimeException("unable to load properties from file "+filepath, e);
-            }
-        }
-        
-        return properties;
-    }
-
-
-    private static synchronized Properties createPropertiesForModule(String moduleName, String fileNamePropertyKey)
-    {
-        if(propertiesByModuleName.containsKey(moduleName)) {
-            return propertiesByModuleName.get(moduleName);
-        }
-
-        // This is where the properties loading takes place. The algorithm is as follows:
-
-        // If the specified fileNamePropertyKey exists as a key is the system properties, take the value of that property as
-        // the location of the module's properties file. This allows file location to be overriden easily.
-        String propertyFileName = System.getProperty(fileNamePropertyKey);
-
-        // If the system property is not set, try to load the build time properties. Build time properties
-        // are not the module properties! These are optional and so loading may fail. That's not considered an error.
-        // If the properties file name is defined by the build time properties, use that.
-        // (In JBossTS it mostly does exist - the build scripts put build time properties into the .jars manifest file.)
-        if (propertyFileName == null) {
-            propertyFileName = ConfigurationInfo.getPropertiesFile();
-        }
-
-        // Bail out if it has not been possible to get a file name by either of these method.
-        if(propertyFileName == null) {
-            throw new RuntimeException("Unable to resolve property file name for module "+moduleName);
-        }
-
-        Properties properties = getPropertiesFromFile(propertyFileName, true);
-
-        propertiesByModuleName.put(moduleName, properties);
-
-        return properties;
-    }
-}

Deleted: labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/ArjunaCore/Common/PropertyManagerTest.java
===================================================================
--- labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/ArjunaCore/Common/PropertyManagerTest.java	2009-11-05 10:55:44 UTC (rev 30005)
+++ labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/ArjunaCore/Common/PropertyManagerTest.java	2009-11-05 10:57:16 UTC (rev 30006)
@@ -1,205 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2007, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags.
- * 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.
- */
-package org.jboss.jbossts.qa.ArjunaCore.Common;
-
-import com.arjuna.common.util.propertyservice.PropertyManager;
-import com.arjuna.common.internal.util.propertyservice.PropertyManagerImpl;
-import org.jboss.jbossts.qa.ArjunaCore.Utils.ChangeClasspath;
-import org.jboss.jbossts.qa.ArjunaCore.Utils.qautil;
-
-/**
- * Simple test to see if Properties are being loaded correctly
- */
-public class PropertyManagerTest
-{
-	/**
-	 * Global varable for test result
-	 */
-	private static boolean mCorrect = true;
-	private static int mNumberOfFiles = 0;
-	private static String mOriginalarg = "";
-
-	/**
-	 * Simple test we only need to use the main method.
-	 */
-	public static void main(String[] args)
-	{
-		//since property manager does not check absolute path we need to add
-		//location of propertyfiles to the classpath.
-		ChangeClasspath.addToEnd(PropertyFileLoader.getFileLocation()); //we had to use '/etc' at the end of the path
-
-		try
-		{
-			mOriginalarg = (String) args[0];
-			mNumberOfFiles = Integer.parseInt(mOriginalarg);
-		}
-		catch (NumberFormatException nfe)
-		{
-			qautil.debug("Error in argument 1: ", nfe);
-			mCorrect = false;
-		}
-		catch (Exception e)
-		{
-			qautil.debug("No args provided: ", e);
-			mCorrect = false;
-		}
-
-		if (args.length < 2 || args[1].equals("force"))
-		{
-			forceReload();
-		}
-		else if (args[1].equals("reload"))
-		{
-			reload();
-		}
-		else
-		{
-			removeProperty();
-		}
-	}
-
-	public static void forceReload()
-	{
-		qautil.qadebug("Running force reload test");
-		loadProperty(true);
-
-		//get the property from both methods.
-		String systemProperty = System.getProperty("TESTPROPERTY");
-		String propertyManagerProperty = pm.getProperty("TESTPROPERTY");
-
-		//check final values
-		if (!mOriginalarg.equals(systemProperty))
-		{
-			qautil.debug("Error checking system property: " + systemProperty);
-			mCorrect = false;
-		}
-
-		if (!mOriginalarg.equals(propertyManagerProperty))
-		{
-			qautil.debug("Error checking property manager property: " + propertyManagerProperty);
-			mCorrect = false;
-		}
-		finishTest(mCorrect);
-	}
-
-	public static void reload()
-	{
-		qautil.qadebug("Running reload test");
-		loadProperty(false);
-
-		//get the property from both methods.
-		String systemProperty = System.getProperty("TESTPROPERTY");
-		String propertyManagerProperty = pm.getProperty("TESTPROPERTY");
-
-		//check final values
-		if (!Integer.toString(1).equals(systemProperty))
-		{
-			qautil.debug("Error checking system property: " + systemProperty);
-			qautil.debug("this is a known miss interpretation of the docs that has already been raised: see issue 565");
-			mCorrect = false;
-		}
-
-		if (!Integer.toString(1).equals(propertyManagerProperty))
-		{
-			qautil.debug("Error checking property manager property: " + propertyManagerProperty);
-			mCorrect = false;
-		}
-		finishTest(mCorrect);
-	}
-
-	/**
-	 * Test if remove property removes all instances of property.
-	 */
-	public static void removeProperty()
-	{
-		qautil.qadebug("Running removeproperty test with flag set to true");
-		loadProperty(true);
-
-		//check we have the value or not
-		String systemProperty = System.getProperty("TESTPROPERTY");
-		qautil.qadebug("first check = " + systemProperty);
-		String propertyManagerProperty = pm.getProperty("TESTPROPERTY");
-		qautil.qadebug("first check = " + propertyManagerProperty);
-		//if we have loaded more than 1 property file will this remove them all ?
-
-		//remove property (for some reason this returns a string)
-		String test = pm.removeProperty("TESTPROPERTY");
-		qautil.qadebug("removeProperty method returned: " + test);
-
-		//get the property from both methods.
-		systemProperty = System.getProperty("TESTPROPERTY");
-		propertyManagerProperty = pm.getProperty("TESTPROPERTY");
-
-		//check final values
-		if (systemProperty != null)
-		{
-			qautil.debug("Error checking system property: " + systemProperty);
-			qautil.debug("see jitterbug issue 566");
-			mCorrect = false;
-		}
-
-		if (propertyManagerProperty != null)
-		{
-			qautil.debug("Error checking property manager property: " + propertyManagerProperty);
-			qautil.debug("see jitterbug issue 566");
-			mCorrect = false;
-		}
-		finishTest(mCorrect);
-	}
-
-	public static void loadProperty(boolean flag)
-	{
-		/**
-		 * Load property files with true flag to force reload.
-		 */
-		try
-		{
-			for (int i = 1; i < mNumberOfFiles + 1; i++)
-			{
-				String filename = "t" + i + ".props";
-				qautil.qadebug("adding: " + filename);
-				pm.load(com.arjuna.common.internal.util.propertyservice.plugins.io.XMLFilePlugin.class.getName(), filename);
-			}
-		}
-		catch (Exception e)
-		{
-			qautil.debug("exception in test: ", e);
-			mCorrect = false;
-		}
-	}
-
-	/**
-	 * Simple method for printing result.
-	 */
-	public static void finishTest(boolean result)
-	{
-		if (result)
-		{
-			System.out.println("Passed");
-		}
-		else
-		{
-			System.out.println("Failed");
-		}
-	}
-
-	private static PropertyManager pm = new PropertyManagerImpl("qa");
-}



More information about the jboss-svn-commits mailing list