* @throws Exception if the plugin's descriptor could not be parsed or could not be loaded into the plugin container
*/
public synchronized void loadPlugin(URL pluginUrl, boolean enabled) throws Exception {
ServerPluginDescriptorType descriptor = ServerPluginDescriptorUtil.loadPluginDescriptorFromUrl(pluginUrl);
ServerPluginType pluginType = new ServerPluginType(descriptor);
PluginKey pluginKey = PluginKey.createServerPluginKey(pluginType.stringify(), descriptor.getName());
this.classLoaderManager.loadPlugin(pluginUrl, descriptor);
ClassLoader classLoader = this.classLoaderManager.obtainServerPluginClassLoader(pluginKey);
log.debug("Loading server plugin [" + pluginKey + "] from [" + pluginUrl + "] into its plugin container");
try {
ServerPluginEnvironment env = new ServerPluginEnvironment(pluginUrl, classLoader, descriptor);
AbstractTypeServerPluginContainer pc = getPluginContainerByDescriptor(descriptor);
if (pc != null) {
pc.loadPlugin(env, enabled);
log.info("Loaded server plugin [" + pluginKey.getPluginName() + "]");
} else {
throw new Exception("No plugin container can load server plugin [" + pluginKey + "]");
}
} catch (Exception e) {
log.warn("Failed to load server plugin file [" + pluginUrl + "]", e);