Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding ability to use Osmosis as a library with limited functionality. #61

Merged
merged 1 commit into from
Apr 14, 2020

Conversation

mgcuthbert
Copy link
Contributor

This PR adds the ability to run Osmosis as a library within another JVM language.

Example:

final OsmosisTask task1 = new OsmosisTask(new XmlPluginLoader(), "read-xml-change", <MAP OF ARGUMENTS>);
final OsmosisTask task2 = new OsmosisTask(new PgSnapshotPluginLoader(), "write-pgsql-change", <MAP OF ARGUMENTS>);
final OsmosisRunner runner = new OsmosisRunner(task1, task2);
runner.run();

The variable would simply be the key value pair strings that you would ordinarily send in along with the task.

@migurski
Copy link
Collaborator

migurski commented Apr 7, 2020

Looks great! Are there any meaningful unit tests that could be added here?

@mgcuthbert
Copy link
Contributor Author

Unfortunately I would say there aren't any truly meaningful unit tests that could be added for this particular PR. Ultimately it just wraps other functionality in the system to make it easier to use the system as a whole.

@migurski
Copy link
Collaborator

migurski commented Apr 7, 2020

Okay cool. I’ll leave the PR open for a few more days to collect potential dangling feedback before merging. Don't hesitate to stack additional PRs on top of this one as you work further through #53!

@mmd-osm
Copy link

mmd-osm commented Apr 11, 2020

I have two questions:

  • Do we really need the additional dependency on com.github.jengelman.gradle.plugins:shadow? Could this be done outside of this repo?
  • You've mentioned in the title that this PR offers "limited functionality" to run osmosis as a lib. Can you describe in a few words where you see actual limits of your design?

A bit of a documentation in the README file would probably be nice to get people started.

@mgcuthbert
Copy link
Contributor Author

@mnd-osm

So first on the limits, this is primarily because you can only, in this design, use 2 tasks for the library. So basically an input task and an output task. Osmosis in general allows multiple tasks to be run, so in that sense this is limited. It probably wouldn't be too much more difficult to extend the functionality to allow multiple task inputs.

As far as the ShadowJar dependency is concerned this is due to some modules that use spring components, which use Typesafe configuration reference files. Using as an application this is fine, however when you wrap this up as a single jar library it becomes problematic because the configuration files just overwrite each other giving you some very unexpected results. The main part that is used from that plugin is the appendingTransformer that gets around that.

@migurski
Copy link
Collaborator

I’m going to go ahead and merge this. We can revisit the docs later.

@migurski migurski merged commit 79220e0 into openstreetmap:master Apr 14, 2020
@mmd-osm
Copy link

mmd-osm commented May 21, 2020

Fyi: Debian folks didn’t like the additional dependency and removed it again: https://sources.debian.org/patches/osmosis/0.48.0-1/no-shadow.patch/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants