Search in sources :

Example 1 with BasePathClassLoader

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;
}
Also used : BasePathClassLoader(nl.nn.adapterframework.configuration.classloaders.BasePathClassLoader) DirectoryClassLoader(nl.nn.adapterframework.configuration.classloaders.DirectoryClassLoader) ServiceClassLoader(nl.nn.adapterframework.configuration.classloaders.ServiceClassLoader) DummyClassLoader(nl.nn.adapterframework.configuration.classloaders.DummyClassLoader) JarFileClassLoader(nl.nn.adapterframework.configuration.classloaders.JarFileClassLoader) BasePathClassLoader(nl.nn.adapterframework.configuration.classloaders.BasePathClassLoader) DatabaseClassLoader(nl.nn.adapterframework.configuration.classloaders.DatabaseClassLoader)

Aggregations

BasePathClassLoader (nl.nn.adapterframework.configuration.classloaders.BasePathClassLoader)1 DatabaseClassLoader (nl.nn.adapterframework.configuration.classloaders.DatabaseClassLoader)1 DirectoryClassLoader (nl.nn.adapterframework.configuration.classloaders.DirectoryClassLoader)1 DummyClassLoader (nl.nn.adapterframework.configuration.classloaders.DummyClassLoader)1 JarFileClassLoader (nl.nn.adapterframework.configuration.classloaders.JarFileClassLoader)1 ServiceClassLoader (nl.nn.adapterframework.configuration.classloaders.ServiceClassLoader)1