PluginDescriptorLoader pluginDescriptorLoader = new PluginDescriptorLoader(pluginUrl, classLoader);
PluginEnvironment pluginEnvironment = new PluginEnvironment(pluginDescriptor.getName(), pluginDescriptorLoader);
String pluginName = pluginEnvironment.getPluginName();
// tell the plugin we have loaded it
PluginLifecycleListener overseer = getPluginLifecycleListener(pluginName, pluginEnvironment, pluginDescriptor);
if (overseer != null) {
PluginContext context = createPluginContext(pluginName);
ClassLoader originalContextClassLoader = Thread.currentThread().getContextClassLoader();
try {
Thread.currentThread().setContextClassLoader(classLoader);
overseer.initialize(context);
} catch (Throwable t) {
throw new PluginContainerException("Plugin Lifecycle Listener failed to initialize plugin", t);
} finally {
Thread.currentThread().setContextClassLoader(originalContextClassLoader);
}