[Git][debian-gis-team/osmosis][master] 4 commits: New upstream version 0.49.2
Bas Couwenberg (@sebastic)
gitlab at salsa.debian.org
Sun Dec 3 08:17:12 GMT 2023
Bas Couwenberg pushed to branch master at Debian GIS Project / osmosis
Commits:
a3000293 by Bas Couwenberg at 2023-12-03T07:48:02+01:00
New upstream version 0.49.2
- - - - -
680afb2a by Bas Couwenberg at 2023-12-03T07:48:05+01:00
Update upstream source from tag 'upstream/0.49.2'
Update to upstream version '0.49.2'
with Debian dir 1b0ff6497d16b2111cdc76dbda7c505c3cab59c6
- - - - -
08bece0a by Bas Couwenberg at 2023-12-03T07:49:21+01:00
New upstream release.
- - - - -
a84175d2 by Bas Couwenberg at 2023-12-03T08:58:28+01:00
Update Maven packaging for JPF dependency.
- - - - -
11 changed files:
- debian/changelog
- debian/control
- debian/maven.rules
- debian/patches/maven.patch
- debian/plexus.conf
- gradle.properties
- osmosis-core/build.gradle
- osmosis-core/src/main/java/org/openstreetmap/osmosis/core/TaskRegistrar.java
- + osmosis-core/src/main/java/org/openstreetmap/osmosis/core/plugin/CorePlugin.java
- + osmosis-core/src/main/resources/org/openstreetmap/osmosis/core/plugin/plugin.xml.template
- osmosis/src/dist/changes.txt
Changes:
=====================================
debian/changelog
=====================================
@@ -1,3 +1,10 @@
+osmosis (0.49.2-1) UNRELEASED; urgency=medium
+
+ * New upstream release.
+ * Update Maven packaging for JPF dependency.
+
+ -- Bas Couwenberg <sebastic at debian.org> Sun, 03 Dec 2023 07:48:23 +0100
+
osmosis (0.49.1-1) unstable; urgency=medium
* Drop obsolete 04-osmosis-version.patch.
=====================================
debian/control
=====================================
@@ -15,6 +15,7 @@ Build-Depends: debhelper-compat (= 13),
libcommons-dbcp-java,
libcommons-io-java,
libguava-java,
+ libjpf-java,
libmariadb-java,
libmaven-clean-plugin-java,
libmaven-compiler-plugin-java,
=====================================
debian/maven.rules
=====================================
@@ -9,6 +9,8 @@ junit junit * s/.*/4.x/ * *
s/mysql/org.mariadb.jdbc/ s/mysql-connector-java/mariadb-java-client/ * s/.*/debian/ * *
+net.sf.jpf jpf * s/.*/debian/ * *
+
net.postgis postgis-jdbc * s/.*/debian/ * *
org.apache.commons commons-compress * s/.*/debian/ * *
=====================================
debian/patches/maven.patch
=====================================
@@ -4,7 +4,7 @@ Forwarded: https://github.com/openstreetmap/osmosis/pull/137
--- /dev/null
+++ b/pom.xml
-@@ -0,0 +1,117 @@
+@@ -0,0 +1,121 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
@@ -12,7 +12,7 @@ Forwarded: https://github.com/openstreetmap/osmosis/pull/137
+
+ <groupId>org.openstreetmap.osmosis</groupId>
+ <artifactId>osmosis</artifactId>
-+ <version>0.49.1</version>
++ <version>0.49.2</version>
+ <packaging>pom</packaging>
+
+ <name>osmosis</name>
@@ -44,6 +44,9 @@ Forwarded: https://github.com/openstreetmap/osmosis/pull/137
+ <maven-compiler-plugin.version>3.10.1</maven-compiler-plugin.version>
+ <maven-surefire-plugin.version>2.22.1</maven-surefire-plugin.version>
+
++ <exec-maven-plugin.version>3.1.0</exec-maven-plugin.version>
++ <maven-clean-plugin.version>3.2.0</maven-clean-plugin.version>
++
+ <java.min.version>17</java.min.version>
+
+ <commons-codec.version>1.16.0</commons-codec.version>
@@ -52,6 +55,7 @@ Forwarded: https://github.com/openstreetmap/osmosis/pull/137
+ <commons-dbcp.version>1.4</commons-dbcp.version>
+ <commons-io.version>2.15.0</commons-io.version>
+ <guava.version>32.1.3-jre</guava.version>
++ <jpf.version>1.5</jpf.version>
+ <junit.version>4.13.2</junit.version>
+ <mysql.version>8.0.33</mysql.version>
+ <osmpbf.version>1.5.0</osmpbf.version>
@@ -124,7 +128,7 @@ Forwarded: https://github.com/openstreetmap/osmosis/pull/137
+</project>
--- /dev/null
+++ b/osmosis-core/pom.xml
-@@ -0,0 +1,65 @@
+@@ -0,0 +1,95 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
@@ -133,19 +137,27 @@ Forwarded: https://github.com/openstreetmap/osmosis/pull/137
+ <parent>
+ <groupId>org.openstreetmap.osmosis</groupId>
+ <artifactId>osmosis</artifactId>
-+ <version>0.49.1</version>
++ <version>0.49.2</version>
+ <relativePath>..</relativePath>
+ </parent>
+
+ <artifactId>osmosis-core</artifactId>
+ <packaging>jar</packaging>
+
++ <dependencies>
++ <dependency>
++ <groupId>net.sf.jpf</groupId>
++ <artifactId>jpf</artifactId>
++ <version>${jpf.version}</version>
++ </dependency>
++ </dependencies>
++
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>exec-maven-plugin</artifactId>
-+ <version>3.1.0</version>
++ <version>${exec-maven-plugin.version}</version>
+ <executions>
+ <execution>
+ <id>generateJavaSources</id>
@@ -153,21 +165,37 @@ Forwarded: https://github.com/openstreetmap/osmosis/pull/137
+ <goals>
+ <goal>exec</goal>
+ </goals>
++ <configuration>
++ <executable>sh</executable>
++ <arguments>
++ <argument>generateJavaSources.sh</argument>
++ </arguments>
++ <environmentVariables>
++ <VERSION>${project.version}</VERSION>
++ </environmentVariables>
++ </configuration>
++ </execution>
++ <execution>
++ <id>generateResources</id>
++ <phase>generate-resources</phase>
++ <goals>
++ <goal>exec</goal>
++ </goals>
++ <configuration>
++ <executable>sh</executable>
++ <arguments>
++ <argument>generateResources.sh</argument>
++ </arguments>
++ <environmentVariables>
++ <VERSION>${project.version}</VERSION>
++ </environmentVariables>
++ </configuration>
+ </execution>
+ </executions>
-+ <configuration>
-+ <executable>sh</executable>
-+ <arguments>
-+ <argument>generateJavaSources.sh</argument>
-+ </arguments>
-+ <environmentVariables>
-+ <VERSION>${project.version}</VERSION>
-+ </environmentVariables>
-+ </configuration>
+ </plugin>
+ <plugin>
+ <artifactId>maven-clean-plugin</artifactId>
-+ <version>3.2.0</version>
++ <version>${maven-clean-plugin.version}</version>
+ <configuration>
+ <filesets>
+ <fileset>
@@ -176,6 +204,12 @@ Forwarded: https://github.com/openstreetmap/osmosis/pull/137
+ <include>OsmosisConstants.java</include>
+ </includes>
+ </fileset>
++ <fileset>
++ <directory>src/main/resources/org/openstreetmap/osmosis/core/plugin</directory>
++ <includes>
++ <include>plugin.xml</include>
++ </includes>
++ </fileset>
+ </filesets>
+ </configuration>
+ </plugin>
@@ -221,7 +255,7 @@ Forwarded: https://github.com/openstreetmap/osmosis/pull/137
+ <parent>
+ <groupId>org.openstreetmap.osmosis</groupId>
+ <artifactId>osmosis</artifactId>
-+ <version>0.49.1</version>
++ <version>0.49.2</version>
+ <relativePath>..</relativePath>
+ </parent>
+
@@ -250,6 +284,26 @@ Forwarded: https://github.com/openstreetmap/osmosis/pull/137
+ </build>
+</project>
--- /dev/null
++++ b/osmosis-core/generateResources.sh
+@@ -0,0 +1,17 @@
++#!/bin/sh
++
++SOURCE_DIR="$(dirname "$0")"
++SOURCE_FILE="${SOURCE_DIR}/src/main/resources/org/openstreetmap/osmosis/core/plugin/plugin.xml"
++TEMPLATE_FILE="${SOURCE_FILE}.template"
++
++if [ -z "${VERSION}" ]; then
++ echo "Error: VERSION not set in environment"
++ exit 1
++fi
++
++if [ ! -r "${TEMPLATE_FILE}" ]; then
++ echo "Error: Cannot read file: ${TEMPLATE_FILE}"
++ exit 1
++fi
++
++sed "s/no-version-specified/${VERSION}/g" "${TEMPLATE_FILE}" > "${SOURCE_FILE}"
+--- /dev/null
+++ b/osmosis-testutil/pom.xml
@@ -0,0 +1,42 @@
+<?xml version="1.0" encoding="UTF-8"?>
@@ -260,7 +314,7 @@ Forwarded: https://github.com/openstreetmap/osmosis/pull/137
+ <parent>
+ <groupId>org.openstreetmap.osmosis</groupId>
+ <artifactId>osmosis</artifactId>
-+ <version>0.49.1</version>
++ <version>0.49.2</version>
+ <relativePath>..</relativePath>
+ </parent>
+
@@ -305,7 +359,7 @@ Forwarded: https://github.com/openstreetmap/osmosis/pull/137
+ <parent>
+ <groupId>org.openstreetmap.osmosis</groupId>
+ <artifactId>osmosis</artifactId>
-+ <version>0.49.1</version>
++ <version>0.49.2</version>
+ <relativePath>..</relativePath>
+ </parent>
+
@@ -362,7 +416,7 @@ Forwarded: https://github.com/openstreetmap/osmosis/pull/137
+ <parent>
+ <groupId>org.openstreetmap.osmosis</groupId>
+ <artifactId>osmosis</artifactId>
-+ <version>0.49.1</version>
++ <version>0.49.2</version>
+ <relativePath>..</relativePath>
+ </parent>
+
@@ -414,7 +468,7 @@ Forwarded: https://github.com/openstreetmap/osmosis/pull/137
+ <parent>
+ <groupId>org.openstreetmap.osmosis</groupId>
+ <artifactId>osmosis</artifactId>
-+ <version>0.49.1</version>
++ <version>0.49.2</version>
+ <relativePath>..</relativePath>
+ </parent>
+
@@ -466,7 +520,7 @@ Forwarded: https://github.com/openstreetmap/osmosis/pull/137
+ <parent>
+ <groupId>org.openstreetmap.osmosis</groupId>
+ <artifactId>osmosis</artifactId>
-+ <version>0.49.1</version>
++ <version>0.49.2</version>
+ <relativePath>..</relativePath>
+ </parent>
+
@@ -529,7 +583,7 @@ Forwarded: https://github.com/openstreetmap/osmosis/pull/137
+ <parent>
+ <groupId>org.openstreetmap.osmosis</groupId>
+ <artifactId>osmosis</artifactId>
-+ <version>0.49.1</version>
++ <version>0.49.2</version>
+ <relativePath>..</relativePath>
+ </parent>
+
@@ -608,7 +662,7 @@ Forwarded: https://github.com/openstreetmap/osmosis/pull/137
+ <parent>
+ <groupId>org.openstreetmap.osmosis</groupId>
+ <artifactId>osmosis</artifactId>
-+ <version>0.49.1</version>
++ <version>0.49.2</version>
+ <relativePath>..</relativePath>
+ </parent>
+
@@ -683,7 +737,7 @@ Forwarded: https://github.com/openstreetmap/osmosis/pull/137
+ <parent>
+ <groupId>org.openstreetmap.osmosis</groupId>
+ <artifactId>osmosis</artifactId>
-+ <version>0.49.1</version>
++ <version>0.49.2</version>
+ <relativePath>..</relativePath>
+ </parent>
+
@@ -773,7 +827,7 @@ Forwarded: https://github.com/openstreetmap/osmosis/pull/137
+ <parent>
+ <groupId>org.openstreetmap.osmosis</groupId>
+ <artifactId>osmosis</artifactId>
-+ <version>0.49.1</version>
++ <version>0.49.2</version>
+ <relativePath>..</relativePath>
+ </parent>
+
@@ -825,7 +879,7 @@ Forwarded: https://github.com/openstreetmap/osmosis/pull/137
+ <parent>
+ <groupId>org.openstreetmap.osmosis</groupId>
+ <artifactId>osmosis</artifactId>
-+ <version>0.49.1</version>
++ <version>0.49.2</version>
+ <relativePath>..</relativePath>
+ </parent>
+
@@ -874,7 +928,7 @@ Forwarded: https://github.com/openstreetmap/osmosis/pull/137
+ <parent>
+ <groupId>org.openstreetmap.osmosis</groupId>
+ <artifactId>osmosis</artifactId>
-+ <version>0.49.1</version>
++ <version>0.49.2</version>
+ <relativePath>..</relativePath>
+ </parent>
+
@@ -954,7 +1008,7 @@ Forwarded: https://github.com/openstreetmap/osmosis/pull/137
+ <parent>
+ <groupId>org.openstreetmap.osmosis</groupId>
+ <artifactId>osmosis</artifactId>
-+ <version>0.49.1</version>
++ <version>0.49.2</version>
+ <relativePath>..</relativePath>
+ </parent>
+
@@ -1015,7 +1069,7 @@ Forwarded: https://github.com/openstreetmap/osmosis/pull/137
+ <parent>
+ <groupId>org.openstreetmap.osmosis</groupId>
+ <artifactId>osmosis</artifactId>
-+ <version>0.49.1</version>
++ <version>0.49.2</version>
+ <relativePath>..</relativePath>
+ </parent>
+
@@ -1067,7 +1121,7 @@ Forwarded: https://github.com/openstreetmap/osmosis/pull/137
+ <parent>
+ <groupId>org.openstreetmap.osmosis</groupId>
+ <artifactId>osmosis</artifactId>
-+ <version>0.49.1</version>
++ <version>0.49.2</version>
+ <relativePath>..</relativePath>
+ </parent>
+
=====================================
debian/plexus.conf
=====================================
@@ -7,6 +7,7 @@ load /usr/share/java/commons-csv.jar
load /usr/share/java/commons-dbcp.jar
load /usr/share/java/commons-io.jar
load /usr/share/java/guava.jar
+load /usr/share/java/jpf.jar
load /usr/share/java/mariadb-java-client.jar
load /usr/share/java/osmpbf.jar
load /usr/share/java/postgis-jdbc.jar
=====================================
gradle.properties
=====================================
@@ -14,6 +14,7 @@ dependencyVersionCommonsIo=2.15.0
# Should we be using Dbcp2?
dependencyVersionCommonsDbcp=1.4
dependencyVersionGuava=32.1.3-jre
+dependencyVersionJpf=1.5
# JUnit 5 is available, some re-write required
dependencyVersionJunit=4.13.2
dependencyVersionMySql=8.0.33
=====================================
osmosis-core/build.gradle
=====================================
@@ -1,3 +1,7 @@
+dependencies {
+ implementation group: 'net.sf.jpf', name: 'jpf', version: dependencyVersionJpf
+}
+
/*
* Define a custom task to automatically generate the OsmosisConstants file
* and update the java compilation task to depend on it.
@@ -28,3 +32,34 @@ task generateJavaSources {
// Define task dependency to ensure constants file is always up to date.
compileJava.dependsOn generateJavaSources
sourcesJar.dependsOn generateJavaSources
+
+
+/*
+ * Define a custom task to automatically generate the plugin.xml file
+ * and update the copy resources task to depend on it.
+ */
+task generateResources {
+ description = 'Generates the plugin.xml file with the current version number.'
+
+ // Build file objects for our template file, and output java file.
+ def commonPathPrefix = "$projectDir/src/main/resources/org/openstreetmap/osmosis/core/plugin/plugin.xml"
+ def outputFile = new File(commonPathPrefix)
+ def inputFile = new File(commonPathPrefix + ".template")
+
+ /*
+ * Declare inputs and outputs of the task to allow gradle to determine if
+ * it is up to date.
+ */
+ inputs.file inputFile
+ outputs.file outputFile
+
+ doLast {
+ // Insert the version string into the constants file.
+ def fileContent = inputFile.getText()
+ fileContent = fileContent.replace("no-version-specified", version)
+ outputFile.write(fileContent)
+ }
+}
+// Define task dependency to ensure constants file is always up to date.
+processResources.dependsOn generateResources
+sourcesJar.dependsOn generateResources
=====================================
osmosis-core/src/main/java/org/openstreetmap/osmosis/core/TaskRegistrar.java
=====================================
@@ -2,17 +2,31 @@
package org.openstreetmap.osmosis.core;
import java.io.BufferedReader;
+import java.io.File;
+import java.io.FilenameFilter;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
-import java.lang.reflect.InvocationTargetException;
+import java.net.MalformedURLException;
import java.net.URL;
import java.util.Collections;
+import java.util.Iterator;
+import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.logging.Logger;
+import org.java.plugin.JpfException;
+import org.java.plugin.ObjectFactory;
+import org.java.plugin.PluginLifecycleException;
+import org.java.plugin.PluginManager;
+import org.java.plugin.PluginManager.PluginLocation;
+import org.java.plugin.registry.Extension;
+import org.java.plugin.registry.ExtensionPoint;
+import org.java.plugin.registry.ManifestProcessingException;
+import org.java.plugin.registry.PluginDescriptor;
+import org.java.plugin.standard.StandardPluginLocation;
import org.openstreetmap.osmosis.core.pipeline.common.TaskManagerFactory;
import org.openstreetmap.osmosis.core.pipeline.common.TaskManagerFactoryRegister;
import org.openstreetmap.osmosis.core.plugin.PluginLoader;
@@ -46,7 +60,7 @@ public class TaskRegistrar {
/**
* Returns the configured task manager factory register configured.
- *
+ *
* @return The task manager factory register.
*/
public TaskManagerFactoryRegister getFactoryRegister() {
@@ -57,7 +71,7 @@ public class TaskRegistrar {
/**
* 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.
*/
@@ -69,11 +83,14 @@ public class TaskRegistrar {
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) {
@@ -88,39 +105,38 @@ public class TaskRegistrar {
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
@@ -129,9 +145,165 @@ public class TaskRegistrar {
}
+ /**
+ * 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);
+ }
+ }
+ }
+
+
+ /**
+ * 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) {
+ throw new OsmosisRuntimeException("Unable to enable core plugin.", e);
+ }
+ }
+
+
+ /**
+ * Register the given JPF-plugins with the {@link PluginManager}.
+ *
+ * @param locations
+ * the plugins found
+ */
+ private void registerJpfPlugins(PluginManager pluginManager, List<PluginLocation> locations) {
+ if (locations == null) {
+ throw new IllegalArgumentException("null plugin-list given");
+ }
+
+ try {
+ pluginManager.publishPlugins(locations.toArray(new PluginLocation[locations.size()]));
+ } catch (JpfException e) {
+ throw new OsmosisRuntimeException("Unable to publish plugins.", e);
+ }
+ }
+
+
+ /**
+ * @return a list of all JPF-plugins found.
+ */
+ private List<PluginLocation> gatherJpfPlugins() {
+ File[] pluginsDirs = new File[] {
+ new File("plugins"),
+ new File(System.getProperty("user.home") + "/.openstreetmap" + File.separator + "osmosis"
+ + File.separator + "plugins"),
+ new File(System.getenv("APPDATA") + File.separator + "openstreetmap" + File.separator + "osmosis"
+ + File.separator + "plugins")
+
+ };
+
+ FilenameFilter pluginFileNameFilter = new FilenameFilter() {
+
+ /**
+ * @param dir
+ * the directory of the file
+ * @param name
+ * the unqualified name of the file
+ * @return true if this may be a plugin-file
+ */
+ public boolean accept(final File dir, final String name) {
+ return name.toLowerCase().endsWith(".zip") || name.toLowerCase().endsWith(".jar");
+ }
+ };
+ List<PluginLocation> locations = new LinkedList<PluginLocation>();
+ for (File pluginDir : pluginsDirs) {
+ LOG.finer("Loading plugins in " + pluginDir.getAbsolutePath());
+ if (!pluginDir.exists()) {
+ continue;
+ }
+ File[] plugins = pluginDir.listFiles(pluginFileNameFilter);
+ try {
+ for (int i = 0; i < plugins.length; i++) {
+ LOG.finest("Found plugin " + plugins[i].getAbsolutePath());
+ PluginLocation location = StandardPluginLocation.create(plugins[i]);
+
+ if (location != null) {
+ locations.add(location);
+ } else {
+ LOG.warning("JPF Plugin " + plugins[i].getAbsolutePath()
+ + " is malformed and cannot be loaded.");
+ }
+ }
+ } catch (MalformedURLException e) {
+ throw new OsmosisRuntimeException("Cannot create plugin location " + pluginDir.getAbsolutePath(), e);
+ }
+ }
+ return locations;
+ }
+
+
/**
* Loads the tasks associated with a plugin (old plugin-api).
- *
+ *
* @param plugin
* The plugin loader class name.
*/
@@ -149,7 +321,7 @@ public class TaskRegistrar {
/**
* Load the given plugin, old API or new JPF.
- *
+ *
* @param pluginClassName
* the name of the class to instantiate
* @param classLoader
@@ -175,13 +347,7 @@ public class TaskRegistrar {
// Instantiate the plugin loader.
try {
- pluginLoader = pluginClass.getDeclaredConstructor().newInstance();
- } catch (InvocationTargetException e) {
- throw new IllegalArgumentException("Unable to instantiate plugin class (" + pluginClassName + ").", e);
- } catch (SecurityException e) {
- throw new IllegalArgumentException("Unable to instantiate plugin class (" + pluginClassName + ").", e);
- } catch (NoSuchMethodException e) {
- throw new IllegalArgumentException("Unable to instantiate plugin class (" + pluginClassName + ").", e);
+ pluginLoader = pluginClass.newInstance();
} catch (InstantiationException e) {
throw new IllegalArgumentException("Unable to instantiate plugin class (" + pluginClassName + ").", e);
} catch (IllegalAccessException e) {
=====================================
osmosis-core/src/main/java/org/openstreetmap/osmosis/core/plugin/CorePlugin.java
=====================================
@@ -0,0 +1,30 @@
+// This software is released into the Public Domain. See copying.txt for details.
+package org.openstreetmap.osmosis.core.plugin;
+
+import org.java.plugin.Plugin;
+
+
+/**
+ * The core plugin entry point.
+ *
+ * @author Marcus Wolschon
+ */
+public class CorePlugin extends Plugin {
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected void doStart() throws Exception {
+ // ignored
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected void doStop() throws Exception {
+ // ignored
+ }
+}
=====================================
osmosis-core/src/main/resources/org/openstreetmap/osmosis/core/plugin/plugin.xml.template
=====================================
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<!DOCTYPE plugin PUBLIC "-//JPF//Java Plug-in Manifest 1.0" "http://jpf.sourceforge.net/plugin_1_0.dtd">
+<plugin id="org.openstreetmap.osmosis.core.plugin.Core" version="no-version-specified"
+ class="org.openstreetmap.osmosis.core.plugin.CorePlugin">
+ <extension-point id="Task">
+ <parameter-def id="class" />
+ <parameter-def id="name" />
+ </extension-point>
+</plugin>
=====================================
osmosis/src/dist/changes.txt
=====================================
@@ -1,3 +1,9 @@
+0.49.2
+Revert removal of JPF (Java Plugin Framework). It's still being actively used without a convenient alternative.
+
+0.49.1
+Fix Maven publish process to include all artefacts
+
0.49.0
Use GitHub actions instead of Travis CI for continuous integration.
Improve Gradle performance by enabling parallel execution, build cache and on-demand configuration.
View it on GitLab: https://salsa.debian.org/debian-gis-team/osmosis/-/compare/fe21f99812a00723484312e7faedc0bd9d852f6c...a84175d2bcb325d361be16a6a06bf775d5d5abf8
--
View it on GitLab: https://salsa.debian.org/debian-gis-team/osmosis/-/compare/fe21f99812a00723484312e7faedc0bd9d852f6c...a84175d2bcb325d361be16a6a06bf775d5d5abf8
You're receiving this email because of your account on salsa.debian.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/pkg-grass-devel/attachments/20231203/c60ac04b/attachment-0001.htm>
More information about the Pkg-grass-devel
mailing list