1.2.1 - Using JConfig class
JConfig is the main configuration class, that reads in properties and uses search paths to find resources. It also configures the logging system from user and builtin logger properties.
When JConfig is first initialized by the JRE, it uses a special sequence of steps to initialize the SDK and envionment. The initialization steps are as follows:
- Create a basic, barely initialized logger so that error messages at this very importat startup sequence can be reported.
- Export some global builtin variables into a variable table
- Load builtin, user and system properties and combine them using a special CompositeProperties class. The CompositeProperities class, allows 3 different Properties objects to be queried and accessed for each getProperty request. This class provides properties inherinance.
- Export more variables that may have been defined in configuartion properties. Any property that begins with a prefix of "var." is automatically exported as a variable.
- Now look for builtin and user supplied logger.properties files. Combine the using CompositeProperties class and reinitialize LogManager. LogManager will reread the combined properties.
- Setup PropertyChangeSupport for dispatching property changes to listeners.
After initialization the logger and SDK configuration properties are loaded. JConfig is not ready for property change listeners to register themselves with JConfig for any property changes. During registration, each listener is immediately notified of the config values, overriding any default internal values they may have had.
At this point JConfig is up and running.