Uploaded image for project: 'Spatial Information Systems'
  1. Spatial Information Systems
  2. SIS-584

Stable selection of default factories

    XMLWordPrintableJSON

Details

    • Task
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 1.0, 1.1, 1.2, 1.3
    • 1.4
    • Metadata, Referencing, Utilities
    • None

    Description

      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 (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.

      Attachments

        Issue Links

          Activity

            People

              desruisseaux Martin Desruisseaux
              desruisseaux Martin Desruisseaux
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: