org.schwiebert.abl4j.util
Class ABLInitializer
java.lang.Object
org.schwiebert.abl4j.util.ABLInitializer
public class ABLInitializer
- extends Object
The ABLInitializer should be used to configure the ABL4J framework.
Configuration of ABL4J is done by setting properties in a PropertiesMap.
The AblInitializer must be initialized by calling initialize(String[]).
It configures Abl4J by first setting default properties (see AblProperties for default values),
than adding (or overriding) properties loaded from the file "abl4j.properties" (if found
on the classpath), and finally adding (or overriding) the properties with the values
used as parameter on initialize(String[]). Additionally, properties
can be added by addProperty(String, String) etc.
Note: Although the configuration of ABL4J is accessed via the static method
getProperties(), multiple configurations of ABL can be used
within the same virtual machine, as the PropertiesMap is stored within
an InheritableThreadLocal.
- Author:
- sschwieb
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
properties
private InheritableThreadLocal<PropertiesMap> properties
logger
private Logger logger
log4JConfigured
private static Boolean log4JConfigured
- Log4J should be configured only once
ABLInitializer
public ABLInitializer()
initialize
public void initialize()
initialize
public void initialize(Properties props)
initialize
public void initialize(String[] arguments)
initialize
public void initialize(String[] arguments,
Properties props)
- Initializes ABL4J as a 4-step-process:
- load default values
- override (or add) properties found in file abl4j.properties
- override (or add) properties of parameter
props
- override (or add) properties of parameter
arguments
- Parameters:
arguments - the properties to add.
setDefaults
private void setDefaults()
addProperty
private void addProperty(String key,
boolean value)
addProperty
private void addProperty(String key,
int value)
getOption
private static int getOption(String string)
loadProperties
private void loadProperties()
loadProperties
private void loadProperties(InputStream in)
throws IOException
- Throws:
IOException
overrideProperties
private void overrideProperties(String[] args)
addProperty
private void addProperty(String key,
String value)
getProperties
public PropertiesMap getProperties()
getNewClassInstance
public Object getNewClassInstance(String identifier)
throws Exception
- Throws:
Exception
© 2007 Stephan Schwiebert