1 package org.apache.fulcrum.yaafi.service.systemproperty; 2 3 19 20 import org.apache.avalon.framework.configuration.Configurable; 21 import org.apache.avalon.framework.configuration.Configuration; 22 import org.apache.avalon.framework.configuration.ConfigurationException; 23 import org.apache.avalon.framework.logger.AbstractLogEnabled; 24 25 26 34 35 public class SystemPropertyServiceImpl 36 extends AbstractLogEnabled 37 implements SystemPropertyService, Configurable 38 { 39 42 public SystemPropertyServiceImpl() 43 { 44 } 45 46 49 public void configure(Configuration configuration) throws ConfigurationException 50 { 51 String key = null; 52 String value = null; 53 String oldValue = null; 54 Configuration[] systemProperties = configuration.getChildren(); 55 56 for( int i=0; i<systemProperties.length; i++ ) 57 { 58 key = systemProperties[i].getAttribute("name"); 59 value = systemProperties[i].getValue(); 60 oldValue = System.getProperty(key); 61 62 if( oldValue != null ) 63 { 64 this.getLogger().debug( 65 "Changing the value of " + key + " from " + oldValue + " to " + value 66 ); 67 } 68 else 69 { 70 this.getLogger().debug( 71 "Setting the value of " + key + " to " + value 72 ); 73 } 74 75 System.setProperty( key, value ); 76 77 this.getLogger().debug( "Processed the following number of properties : " + systemProperties.length ); 78 } 79 } 80 81 } 82 | Popular Tags |