[jboss-svn-commits] JBL Code SVN: r6615 - labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/common

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Thu Oct 5 08:30:18 EDT 2006


Author: tfennelly
Date: 2006-10-05 08:30:16 -0400 (Thu, 05 Oct 2006)
New Revision: 6615

Modified:
   labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/common/ModulePropertyManager.java
Log:
removed logging and temp manual setting of properties in PM

Modified: labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/common/ModulePropertyManager.java
===================================================================
--- labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/common/ModulePropertyManager.java	2006-10-05 11:50:05 UTC (rev 6614)
+++ labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/common/ModulePropertyManager.java	2006-10-05 12:30:16 UTC (rev 6615)
@@ -31,17 +31,8 @@
 
 package org.jboss.soa.esb.common;
 
-import java.lang.reflect.InvocationHandler;
-import java.lang.reflect.Method;
-import java.lang.reflect.Proxy;
 import java.util.Hashtable;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.Properties;
-import java.util.Map.Entry;
 
-import org.apache.log4j.Logger;
-
 import com.arjuna.common.internal.util.propertyservice.plugins.io.XMLFilePlugin;
 import com.arjuna.common.util.propertyservice.PropertyManager;
 import com.arjuna.common.util.propertyservice.PropertyManagerFactory;
@@ -81,7 +72,6 @@
  */
 public class ModulePropertyManager
 {
-	private static Logger logger = Logger.getLogger(ModulePropertyManager.class);
 	
 	/*
 	 * The names of the various modules in the property file.
@@ -140,99 +130,17 @@
 
 		try
 		{
-			Properties properties = propertyManager.getProperties();
-			Properties propertiesBefore = null;
-			Properties propertiesAfter = null;
-			
-			if(properties != null) {
-				propertiesBefore = (Properties) properties.clone();
-			}
-			
-			logger.info("Loading properties file [" + propertiesFilename + "] into property manager type [" + propertyManager.getClass().getName() + "]");
 			propertyManager.load(XMLFilePlugin.class.getName(),
 					propertiesFilename);
-
-			properties = propertyManager.getProperties();
-			if(properties != null) {
-				propertiesAfter = (Properties) properties.clone();
-			}
-			if(propertiesAfter != null && propertiesAfter.equals(propertiesBefore)) {
-				// FIXME: This all needs to be fixed - dunno what the story is with the PropertyManager stuff!
-				logger.warn("No change in properties after loading properties file: " + propertiesFilename);
-			} else if(propertiesAfter != null) {
-				// FIXME: This all needs to be fixed - dunno what the story is with the PropertyManager stuff!
-				hack_manuallySetNewPropertiesInPropertyManager(propertiesBefore, propertiesAfter, propertyManager);
-			}
-			
-			if(logger.isDebugEnabled()) {
-				logger.debug("PropertyManager contents after loading properties file [" + propertiesFilename + "]: " + properties);
-			}
 		} catch (Exception e)
 		{
-			logger.error("Failed to load properties file: " + propertiesFilename, e);
+			e.printStackTrace();
 
 			return null;
 		}
 
-		return (PropertyManager) Proxy.newProxyInstance(
-				PropertyManager.class.getClassLoader(), // Classloader 
-				new Class[] {PropertyManager.class}, // Interfaces to be proxied
-				new PropertyManagerInvocationHandler(propertyManager)); // InvocationHandler impl
+		return propertyManager;
 	}
 
-	/**
-	 * Short term hack to get around the issues with PropertyManager.
-	 * <p/>
-	 * FIXME: This all needs to be fixed - dunno what the story is with the PropertyManager stuff!
-	 * @param propertiesBefore Properties before load.
-	 * @param propertiesAfter Properties after load.
-	 * @param propertyManager Property manager on which to set the newer properties.
-	 */
-	@SuppressWarnings("unchecked")
-	private static void hack_manuallySetNewPropertiesInPropertyManager(Properties propertiesBefore, Properties propertiesAfter, PropertyManager propertyManager) {
-		if(propertiesAfter == null) {
-			throw new IllegalArgumentException("null 'propertiesAfter' arg in method call.");
-		}
-		
-		Iterator properties = propertiesAfter.entrySet().iterator();
-		while(properties.hasNext()) {
-			Entry property = (Entry) properties.next();
-			
-			// If the property is new, set it in the System...
-			if(propertiesBefore == null || !propertiesBefore.containsKey(property.getKey())) {
-				logger.warn("Manually setting property in PropertyManager: [" + property + "].  PropertyManager instance: " + propertyManager);
-				propertyManager.setProperty((String)property.getKey(), (String)property.getValue());
-			}
-		}
-	}
-
 	private static Hashtable<String, PropertyManager> managers = new Hashtable<String, PropertyManager>();
-	
-	/**
-	 * Proxying calls to the ProperyManager instance because we need to get some logging around
-	 * it no mater what the ProperyManager implementation is.
-	 * @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
-	 */
-	private static class PropertyManagerInvocationHandler implements InvocationHandler {
-
-		private PropertyManager propertyManagerInstance;
-		
-		private PropertyManagerInvocationHandler(PropertyManager propertyManagerInstance) {
-			this.propertyManagerInstance = propertyManagerInstance;			
-		}
-		
-		/* (non-Javadoc)
-		 * @see java.lang.reflect.InvocationHandler#invoke(java.lang.Object, java.lang.reflect.Method, java.lang.Object[])
-		 */
-		public Object invoke(Object proxy, Method method, Object[] methodArgs) throws Throwable {
-			Object returnVal = method.invoke(propertyManagerInstance, methodArgs);
-			
-			if(returnVal == null && method.getName().equals("getProperty")) {
-				logger.warn("Property [" + methodArgs[0] + "] not found.  Returning null!  PropertyManager instance: " + propertyManagerInstance);
-			}
-			
-			return returnVal;
-		}
-		
-	}
 }




More information about the jboss-svn-commits mailing list