/**
* Loads the tasks implemented as plugins.
*
*/
private void loadJPFPlugins() {
PluginManager pluginManager;
// Create a new JPF plugin manager.
pluginManager = ObjectFactory.newInstance().createManager();
// Search known locations for plugin files.
LOG.fine("Searching for JPF plugins.");
List<PluginLocation> locations = gatherJpfPlugins();
// Register the core plugin.
LOG.fine("Registering the core plugin.");
registerCorePlugin(pluginManager);
// Register all located plugins.
LOG.fine("Registering the extension plugins.");
if (locations.size() == 0) {
// There are no plugins available so stop processing here.
return;
}
registerJpfPlugins(pluginManager, locations);
// Initialise all of the plugins that have been registered.
LOG.fine("Activating the plugins.");
// load plugins for the task-extension-point
PluginDescriptor core = pluginManager.getRegistry()
.getPluginDescriptor("org.openstreetmap.osmosis.core.plugin.Core");
ExtensionPoint point = pluginManager.getRegistry().getExtensionPoint(core.getId(), "Task");
for (Iterator<Extension> it = point.getConnectedExtensions().iterator(); it.hasNext();) {
Extension ext = it.next();
PluginDescriptor descr = ext.getDeclaringPluginDescriptor();
try {
pluginManager.enablePlugin(descr, true);
pluginManager.activatePlugin(descr.getId());
ClassLoader classLoader = pluginManager.getPluginClassLoader(descr);
loadPluginClass(ext.getParameter("class").valueAsString(), classLoader);
} catch (PluginLifecycleException e) {
throw new OsmosisRuntimeException("Cannot load JPF-plugin '" + ext.getId()
+ "' for extensionpoint '" + ext.getExtendedPointId() + "'", e);
}