[
https://issues.apache.org/jira/browse/SIS-584?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Martin Desruisseaux resolved SIS-584.
-------------------------------------
Resolution: Fixed
> Stable selection of default factories
> -------------------------------------
>
> Key: SIS-584
> URL: https://issues.apache.org/jira/browse/SIS-584
> Project: Spatial Information Systems
> Issue Type: Task
> Components: Metadata, Referencing, Utilities
> Affects Versions: 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 1.0, 1.1, 1.2, 1.3
> Reporter: Martin Desruisseaux
> Assignee: Martin Desruisseaux
> Priority: Major
> Fix For: 1.4
>
>
> Some SIS classes need various factories for creating geodetic objects. In
> particular the following factories are often requested internally:
> * {{org.opengis.util.NameFactory}}
> * {{org.opengis.referencing.datum.DatumFactory}}
> * {{org.opengis.referencing.cs.CSFactory}}
> * {{org.opengis.referencing.crs.CRSFactory}}
> * {{org.opengis.referencing.operation.CoordinateOperationFactory}}
> * {{org.opengis.referencing.operation.MathTransformFactory}}
> From SIS 0.3 to 1.3, those factories where fetching using
> {{java.util.ServiceLoader}}. It allowed some kind of dependency injection.
> However it has never been extensively tested with factories other than the
> ones provided by Apache SIS. While inversion of control is a nice goal, a
> more important goal is to make sure that Apache SIS and
> [PROJ-JNI|https://github.com/OSGeo/PROJ-JNI] (for example) can coexist in the
> same JVM without problems. We can reduce the risk of unexpected behaviour by
> removing the {{ServiceLoader}} usage when SIS is looking for a default
> factory for its own usage. We do that by adding {{provider()}} static methods
> in the following classes, which return an unique instance of the enclosing
> class:
> * {{org.apache.sis.util.iso.DefaultNameFactory}}
> * {{org.apache.sis.referencing.factory.GeodeticObjectFactory}}
> *
> {{org.apache.sis.referencing.operation.transform.DefaultMathTransformFactory}}
> The {{provider()}} methods will also be invoked by {{ServiceLoader}} in a
> modularized application, if the service loader mechanism is still used by
> client code.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)