public Plugin load(String pluginId) {
File jar = loadPluginJar(pluginId);
Plugin plugin = null;
try {
PluginDescriptor descriptor = loadPluginDescriptorFromJar(jar);
if(descriptor == null) {
throw new Exception("Failed to load plugin descriptor");
}
plugin = new Plugin();
plugin.setId(pluginId);
plugin.setJarFile(jar);
plugin.setName(descriptor.getName());
plugin.setDescription(descriptor.getDescription());
plugin.setParameters(descriptor.getParameters());
plugin.setCrawljaxVersions(descriptor.getCrawljaxVersions());
} catch (Exception e) {
LOG.error("Could not load plugin {}", jar.getName());
LOG.debug("Could not load plugin {}. \n{}", jar.getName(), e.getStackTrace());
}
return plugin;