OpenRefine icon indicating copy to clipboard operation
OpenRefine copied to clipboard

Replace Properties with Map<String, String> in Exporters interfaces

Open tfmorris opened this issue 1 year ago • 2 comments

~This should be considered experimental. It's not clear that benefit will outweigh the cost of the API churn, but it depends on the proposed solution.~

We would like to phase out usage of java.util.Properties in places where it's only being used because it was the only option at the time. One candidate is the Exporter API, specifically it's StreamExporter and WriterExporter subinterfaces (UrlExporter can be ignored since it isn't used anywhere). Each has a single method export() which includes a Properties-typed options parameter in its API. These should be replaced with a Map<String, String> https://github.com/OpenRefine/OpenRefine/blob/f4878804960162ba6145941bfbe0d14e60133d9b/main/src/com/google/refine/exporters/StreamExporter.java#L45

Proposed solution

Alternatives considered

There are (at least) two possible ways to do this:

  1. Introduce new StreamExporter2 and WriterExporter2 interfaces which are independent of the current interfaces
  2. Have the new interfaces extend StreamExporter and WriterExporter

Additional context

Acceptance criteria:

  • all existing exporters, both bundled and those provided by extensions, continue to work without being modified or recompiled
  • a clear migration path is defined from the old API to the new API for exporters which are not bundled, but are part of extensions

tfmorris avatar Mar 05 '24 04:03 tfmorris

I agree that the cost/benefit ratio is not super clear. One option would be to bundle this change with the 4.0 changes, which already impact this interface (by passing a Grid instead of a Project, so the signature of the method already changes). This way, you wouldn't need to duplicate interfaces to keep the existing Properties-based exporters working.

wetneb avatar Mar 05 '24 09:03 wetneb

I missed the most obvious compatibility option when I first wrote this up. I've updated the description.

tfmorris avatar Aug 16 '24 19:08 tfmorris