litesoft
@ HEAD
litesoft / trunk / GWT_Sandbox / InitFrom / src / org / litesoft / initfrom / server / InitFrom_Configuration.java
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
package org.litesoft.initfrom.server; import org.litesoft.configuration.*; import java.util.*; public class InitFrom_Configuration { private static final String SYSTEM_PROP_CONFIG_FILE = "CONFIG_FILE"; private static String makeConfigFileName() { String zProperty = System.getProperty( SYSTEM_PROP_CONFIG_FILE ); return (zProperty != null) ? zProperty : "InitFrom.properties"; } // Set up the Search Path private static List<String> createConfigSearchPath( String... pAdditionalPaths ) { List<String> zSearchPath = new ArrayList<String>(); zSearchPath.add( System.getProperty( "CONFIG_DIR" ) ); if ( pAdditionalPaths != null ) { for ( String zAdditionalPath : pAdditionalPaths ) { if ( zAdditionalPath != null ) { zSearchPath.add( zAdditionalPath ); } } } zSearchPath.add( System.getenv( "CONFIG_DIR" ) ); return zSearchPath; } public static synchronized void initialize( String... pAdditionalPaths ) { if ( !Configuration.isInstantiated() ) { new ServerConfiguration( makeConfigAccessorLocator( pAdditionalPaths ) ); // force creation & self registration // LoggerFactory.init( new ConfigurationLoggerLevel(), getLoggerProxy() ); } } private static ConfigAccessorLocator makeConfigAccessorLocator( String... pAdditionalPaths ) { String configFileName = makeConfigFileName(); List<String> zSearchPath = createConfigSearchPath( pAdditionalPaths ); return new ConfigAccessorLocator( configFileName, ConfigAccessorFactoryProperties.INSTANCE, zSearchPath ); } } |