ABL4J (Alignment Based Learning for Java) - 0.9.7

org.schwiebert.abl4j.util
Class ABLInitializer

java.lang.Object
  extended by 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

Field Summary
private static Boolean log4JConfigured
          Log4J should be configured only once
private  Logger logger
           
private  InheritableThreadLocal<PropertiesMap> properties
           
 
Constructor Summary
ABLInitializer()
           
 
Method Summary
private  void addProperty(String key, boolean value)
           
private  void addProperty(String key, int value)
           
private  void addProperty(String key, String value)
           
 Object getNewClassInstance(String identifier)
           
private static int getOption(String string)
           
 PropertiesMap getProperties()
           
 void initialize()
           
 void initialize(Properties props)
           
 void initialize(String[] arguments)
           
 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
private  void loadProperties()
           
private  void loadProperties(InputStream in)
           
private  void overrideProperties(String[] args)
           
private  void setDefaults()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

properties

private InheritableThreadLocal<PropertiesMap> properties

logger

private Logger logger

log4JConfigured

private static Boolean log4JConfigured
Log4J should be configured only once

Constructor Detail

ABLInitializer

public ABLInitializer()
Method Detail

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:
  1. load default values
  2. override (or add) properties found in file abl4j.properties
  3. override (or add) properties of parameter props
  4. 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

ABL4J (Alignment Based Learning for Java) - 0.9.7

© 2007 Stephan Schwiebert