Thanks this looks great.
The key design question is the API break from Java ServiceProvider to
GeoTools Factory. I think this change is important enough to Break API; in
part because we were broken by Java 9 restrictions - by changing our API we
are really clear to downstream applications that there is an
incompatibility.
We should also be able to detect implementations that still implement
ServiceProvider, log a warning, and ignore - rather than fail.
I may add one example using the FactoryFinder classes - just to show that
for the majority of code (which uses a FactoryFinder) there will be no
change. This will be a good test of our architecture to see how well we
protected downstream applications from the plugin system.
--
Jody Garnett
On 22 September 2017 at 00:21, Nicolai Parlog <[email protected]> wrote:
> Hi!
>
> I finally found some time to accompany my pull request[1] containing the
> refactored FactoryRegistry with a formal proposal[2]. These are the main
> points:
>
> * FactoryRegistry extends javax.imageio.spi.ServiceRegistry, but on
> Java 9 the latter throws an exception if extended by non-JDK
> classes; this breaks GeoTools on Java 9.
> * Reimplement required ServiceRegistry functionality in
> FactoryRegistry, so the latter no longer needs to extend the former.
> * Take the opportunity of the resulting runtime incompatibility (has
> to do with registration callbacks) to further change the API:
> * name new methods according to GeoTools' terminology (e.g.
> registerFactory) as opposed to the service registry's
> (registerServiceProvider)
> * have registry methods return Stream instead of Iterator to
> allow clients to use more modern APIs and language features
> (note that Stream::iterator makes it easy to switch from
> streaming to iterating)
> * replace use of javax.imageio.spi.RegisterableService with the
> new org.geotools.factory.RegistrableFactory
> * replace use of javax.imageio.spi.ServiceRegistry.Filter with
> java.util.function.Predicate
>
> The PR[1] implements all of those except for the Stream return type. It
> also provides deprecated method variants with the old signature.
>
> Any feedback?
>
> so long ... Nicolai
>
>
> [1] https://github.com/geotools/geotools/pull/1670
> [2]
> https://github.com/geotools/geotools/wiki/FactoryRegistry-
> Refactoring-for-Java-9-Compatibility
>
>
>
> --
>
> PGP Key:
> http://keys.gnupg.net/pks/lookup?op=vindex&search=0xCA3BAD2E9CCCD509
>
> Web:
> http://codefx.org
> a blog about software development
> https://www.sitepoint.com/java
> high-quality Java/JVM content
> http://do-foss.de
> Free and Open Source Software for the City of Dortmund
>
> Twitter:
> https://twitter.com/nipafx
>
> ------------------------------------------------------------
> ------------------
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
> _______________________________________________
> GeoTools-Devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/geotools-devel
>
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
GeoTools-Devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-devel