use of edu.uiuc.ncsa.security.core.util.ConfigurationLoader in project OA4MP by ncsa.
the class CopyTool method getEnv.
protected ServiceEnvironmentImpl getEnv(String cfgFileOption, String cfgNameOption) {
if (getCommandLine().getOptionValue(SOURCE_CONFIG_NAME_OPTION).equals(getCommandLine().getOptionValue(TARGET_CONFIG_NAME_OPTION))) {
throw new MyConfigurationException("Error! You have specified that source and target as the same.");
}
String fileName = getCommandLine().getOptionValue(cfgFileOption);
if (fileName == null) {
fileName = getCommandLine().getOptionValue(SOURCE_CONFIG_FILE_OPTION);
}
String configName = getCommandLine().getOptionValue(cfgNameOption);
sayv("loading configuration \"" + (configName == null ? "(none)" : configName) + "\" from file " + fileName);
ConfigurationNode node = ConfigUtil.findConfiguration(fileName, getCommandLine().getOptionValue(cfgNameOption), OA4MPConfigTags.COMPONENT);
// override the logging in the configuration file, since that might be remote.
ConfigurationLoader loader = null;
setConfigurationNode(node);
try {
loader = getLoader();
} catch (Exception e) {
throw new GeneralException("Error: Could not get loader", e);
}
// new CILogonConfigurationLoader(node, getMyLogger());
ServiceEnvironmentImpl env = (ServiceEnvironmentImpl) loader.load();
return env;
}
use of edu.uiuc.ncsa.security.core.util.ConfigurationLoader in project OA4MP by ncsa.
the class AbstractClientBootstrapper method getConfigurationLoader.
@Override
public ConfigurationLoader getConfigurationLoader(ServletContext servletContext) throws Exception {
MyLoggingFacade logger = new MyLoggingFacade(getClass().getSimpleName());
logger.info("Starting to load configuration");
try {
ConfigurationLoader x = getConfigurationLoader(ServletConfigUtil.findConfigurationNode(servletContext, getOa4mpConfigFileKey(), getOa4mpConfigNameKey(), ClientXMLTags.COMPONENT));
logger.info("Loaded configuration named " + servletContext.getInitParameter(getOa4mpConfigNameKey()) + " from file " + servletContext.getInitParameter(getOa4mpConfigFileKey()));
return x;
} catch (MyConfigurationException ce) {
logger.info("Did not find a configuration via the servlet context:" + ce.getMessage());
}
logger.info("No configuration found in servlet context. Trying default locations");
// That didn't work, so try to look for it in a few other places.
String configName = servletContext.getInitParameter(getOa4mpConfigNameKey());
ConfigurationLoader loader = loadFromDefaultLocations(logger, configName);
if (loader != null) {
return loader;
}
MyConfigurationException cx = new MyConfigurationException("Error: No configuration found anyplace. OA4MP client startup aborted!");
logger.error(cx);
throw cx;
}
Aggregations