this.logger.finest("Trying to load " + name + " as a plugin.");
// Obtain some shared objects
// final JARCache jarCache = this.pluginManager.getJARCache();
final ClassPathManager classPathManager = this.pluginManager.getClassPathManager();
final PluginRegistry pluginRegistry = this.pluginManager.getPluginRegistry();
final PluginConfigurationUtil pcu = new PluginConfigurationUtil(this.pluginManager.getPluginConfiguration());
final Spawner spawner = this.pluginManager.getSpawner();
// Obtain information
// final JARInformation jarInformation = jarCache.getJARInformation(name);
// final String file = jarCache.classTofile(name);
try {
// Get class of the candidate
final Class<?> possiblePlugin = classPathManager.loadClass(location, name);
// Don't load plugins already spawned.
if (name.startsWith("net.xeoh.plugins.base") ||
name.startsWith("net.xeoh.plugins.diagnosis.") ||
name.startsWith("net.xeoh.plugins.informationbroker.")) return;
// Get the plugin's annotation
final PluginImplementation annotation = possiblePlugin.getAnnotation(PluginImplementation.class);
// Nothing to load here if no annotation is present
if (annotation == null) { return; }
// Don't load classes already loaded from this location
final PluginClassMetaInformation preexistingMeta = pluginRegistry.getMetaInformationFor((Class<? extends Plugin>) possiblePlugin);
if (preexistingMeta != null) {
this.logger.info("Skipping plugin " + possiblePlugin + " because we already have it ");
return;
}
// Register class at registry
final PluginClassMetaInformation metaInformation = new PluginClassMetaInformation();
metaInformation.pluginClassStatus = PluginClassStatus.ACCEPTED;
if (location != null) {
metaInformation.pluginOrigin = location.getToplevelLocation();
} else {
metaInformation.pluginOrigin = new URI("classpath://UNDEFINED");
}
pluginRegistry.registerPluginClass((Class<? extends Plugin>) possiblePlugin, metaInformation);
// Update the class information of the corresponding cache entry
this.logger.finer("Updating cache information");
// Avoid loading if annotation request it.