/** * Sets up the configuration and runtime environment. This is called typically in the constructors before anything * else is called. Always call super on this method if you override it! At the end of this method, the configuration * node has been found and set for you to call in your {@link #getLoader()} method. */ public void initialize() throws Exception { // do not put logging messages (e.g. info) in this method since the actual // logger can't be loaded until the configuration file is found. All logging // messages before it is loaded will end up in the default log file, not // where the user wants them. if (getConfigFile() == null) { throw new MyConfigurationException("Error: no configuration file"); } if (getConfigFile().length() == 0) { throw new MyConfigurationException("Error:No configuration found."); } String cfgName = null; if (hasOption(CONFIG_NAME_OPTION, CONFIG_NAME_LONG_OPTION)) { cfgName = getCommandLine().getOptionValue(CONFIG_NAME_OPTION); } setConfigurationNode(ConfigUtil.findConfiguration(getConfigFile(), cfgName, getComponentName())); }