use of nl.nn.adapterframework.configuration.classloaders.BasePathClassLoader in project iaf by ibissource.
the class ClassLoaderManager method init.
public ClassLoader init(String configurationName, String parentConfig) throws ConfigurationException {
if (contains(configurationName))
throw new ConfigurationException("unable to add configuration with duplicate name [" + configurationName + "]");
String configurationFile = ibisContext.getConfigurationFile(configurationName);
LOG.info("attempting to create new configurationClassLoader for configuration [" + configurationName + "] with file [" + configurationFile + "]");
ClassLoader classLoader;
if (parentConfig != null) {
if (!contains(parentConfig))
throw new ConfigurationException("failed to locate parent configuration [" + parentConfig + "]");
classLoader = createClassloader(configurationName, configurationFile, get(parentConfig));
LOG.debug("wrapped configuration [" + configurationName + "] in parentConfig [" + parentConfig + "]");
} else
classLoader = createClassloader(configurationName, configurationFile);
if (classLoader == null) {
// If this is thrown, the ibis developer specifically did not want to throw an exception.
return null;
}
String basePath = "";
int i = configurationFile.lastIndexOf('/');
if (i != -1) {
basePath = configurationFile.substring(0, i + 1);
}
classLoader = new BasePathClassLoader(classLoader, basePath);
classLoaders.put(configurationName, classLoader);
return classLoader;
}
Aggregations