}
return plugin;
}
protected Plugin getPlugin(String resource) throws JAXBException, FileNotFoundException {
Plugin plugin = plugins.get(resource);
if (plugin == null) {
InputStream is = null;
if (new File(resource).exists()) {
is = new BufferedInputStream(new FileInputStream(new File(resource)));
} else {
is = getClass().getResourceAsStream(resource);
}
if (is == null) {
Message msg = new Message("PLUGIN_MISSING", LOG, resource);
LOG.log(Level.SEVERE, msg.toString());
throw new ToolException(msg);
}
plugin = getPlugin(is);
if (plugin == null || StringUtils.isEmpty(plugin.getName())) {
Message msg = new Message("PLUGIN_LOAD_FAIL", LOG, resource);
LOG.log(Level.SEVERE, msg.toString());
throw new ToolException(msg);
}
plugins.put(resource, plugin);