Skip to content

Commit

Permalink
Remove whitespace at end of lines in JPF related files
Browse files Browse the repository at this point in the history
  • Loading branch information
alfh committed Nov 26, 2023
1 parent 9130aae commit 2618858
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 29 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public TaskRegistrar() {

/**
* Returns the configured task manager factory register configured.
*
*
* @return The task manager factory register.
*/
public TaskManagerFactoryRegister getFactoryRegister() {
Expand All @@ -71,7 +71,7 @@ public TaskManagerFactoryRegister getFactoryRegister() {
/**
* Initialises factories for all tasks. Loads additionally specified plugins
* as well as default tasks.
*
*
* @param plugins
* The class names of all plugins to be loaded.
*/
Expand All @@ -83,14 +83,14 @@ public void initialize(List<String> plugins) {
for (String plugin : plugins) {
loadPlugin(plugin);
}

// Register the plugins loaded via JPF.
loadJPFPlugins();
}

/**
* Loads a plugin manually.
*
*
* @param pluginLoader The pluginLoader that you wish to load.
*/
public void loadPlugin(final PluginLoader pluginLoader) {
Expand All @@ -105,39 +105,38 @@ public void loadPlugin(final PluginLoader pluginLoader) {

private void loadBuiltInPlugins() {
final String pluginResourceName = "osmosis-plugins.conf";

try {
for (URL pluginConfigurationUrl : Collections.list(Thread.currentThread()
.getContextClassLoader().getResources(pluginResourceName))) {
BufferedReader pluginReader;

LOG.finer("Loading plugin configuration file from url " + pluginConfigurationUrl + ".");

try (InputStream pluginInputStream = pluginConfigurationUrl.openStream()) {
if (pluginInputStream == null) {
throw new OsmosisRuntimeException("Cannot open URL " + pluginConfigurationUrl + ".");
}

pluginReader = new BufferedReader(new InputStreamReader(pluginInputStream));

for (;;) {
String plugin;

plugin = pluginReader.readLine();
if (plugin == null) {
break;
}

plugin = plugin.trim();
if (!plugin.isEmpty()) {
LOG.finer("Loading plugin via loader " + plugin + ".");

loadPlugin(plugin);
}
}
}
}

} catch (IOException e) {
throw new OsmosisRuntimeException(
"Unable to load the plugins based on " + pluginResourceName
Expand All @@ -148,30 +147,30 @@ private void loadBuiltInPlugins() {

/**
* 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
Expand All @@ -198,30 +197,30 @@ private void loadJPFPlugins() {

/**
* Register the core plugin from which other plugins will extend.
*
*
* @param pluginManager
* The plugin manager to register the plugin with.
*/
private void registerCorePlugin(PluginManager pluginManager) {
try {
URL core;
PluginDescriptor coreDescriptor;

// Get the plugin configuration file.
core = getClass().getResource("/org/openstreetmap/osmosis/core/plugin/plugin.xml");
LOG.finest("Plugin URL: " + core);

// Register the core plugin in the plugin registry.
pluginManager.getRegistry().register(new URL[] {core});

// Get the plugin descriptor from the registry.
coreDescriptor = pluginManager.getRegistry().getPluginDescriptor(
"org.openstreetmap.osmosis.core.plugin.Core");

// Enable the plugin.
pluginManager.enablePlugin(coreDescriptor, true);
pluginManager.activatePlugin("org.openstreetmap.osmosis.core.plugin.Core");

} catch (ManifestProcessingException e) {
throw new OsmosisRuntimeException("Unable to register core plugin.", e);
} catch (PluginLifecycleException e) {
Expand All @@ -232,7 +231,7 @@ private void registerCorePlugin(PluginManager pluginManager) {

/**
* Register the given JPF-plugins with the {@link PluginManager}.
*
*
* @param locations
* the plugins found
*/
Expand Down Expand Up @@ -304,7 +303,7 @@ public boolean accept(final File dir, final String name) {

/**
* Loads the tasks associated with a plugin (old plugin-api).
*
*
* @param plugin
* The plugin loader class name.
*/
Expand All @@ -322,7 +321,7 @@ private void loadPlugin(final String plugin) {

/**
* Load the given plugin, old API or new JPF.
*
*
* @param pluginClassName
* the name of the class to instantiate
* @param classLoader
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

/**
* The core plugin entry point.
*
*
* @author Marcus Wolschon
*/
public class CorePlugin extends Plugin {
Expand Down

0 comments on commit 2618858

Please sign in to comment.