Details
-
Task
-
Status: Closed
-
Minor
-
Resolution: Fixed
-
0.8
-
None
Description
The org.apache.sis.io.wkt package is currently located in the sis-metadata module. However the WKT parser/formatter is close to useless without sis-referencing module because the only objects currently parsed or formatted are in that module. This is illustrated by the fact that only basic tests are defined in sis-metadata and more "real situation" tests are in sis-referencing. Even if a future version is generalized to parsing/formatting of geometry objects, a geometry module would probably need sis-referencing.
We should move org.apache.sis.io.wkt package into the sis-referencing module. It would bring many simplifications, like a single place for all tests.
Post-migration cleanups
After this move has been done, we should apply the following cleanups:
Add the following case at the end of appendElement(Object) method:
} else if (value instanceof Position) { append(AbstractDirectPosition.castOrCopy(((Position) value).getDirectPosition())); } else if (value instanceof Envelope) { append(AbstractEnvelope.castOrCopy((Envelope) value)); // Non-standard
Retrofit org.apache.sis.util.internal.Citations into org.apache.sis.metadata.iso.citation.Citations, which will allow us to add the following code in Citations.identifierMatches:
if (c1 == c2) { return true; // Optimization for a common case. } /* * If both argument are one of the constants defined in the Citations class, * then we do not need to compare identifier; call to `equals` is sufficient. * This special case avoids the potentially costly call to `getIdentifiers()` * since that call may cause a connection to the spatial metadata database. */ if (c1 instanceof CitationConstant && c2 instanceof CitationConstant) { return c1.equals(c2); }
Other cleanups:
- Move EllipsoidalHeightCombiner, which will allow us to leverage ReferencingFactoryContainer instead than duplicating its work.
- Leverage ReferencingFactoryContainer into MathTransforParser too.
- Move WKTKeywords.
Requirement
The only dependency in sis-metadata is ImmutableIdentifier. May may need to move that class into sis-referencing, maybe in org.apache.sis.referencing package. That would need a "deprecate now delete later" cycle.
Execution
Commands to run on the command-line are below. It may be easier to execute those commands in each branches instead than only one branch and resolve merge conflicts (to be verified).
git mv core/sis-metadata/src/test/java/org/apache/sis/io/wkt/*.java core/sis-referencing/src/test/java/org/apache/sis/io/wkt/ git rm -r core/sis-metadata/src/test/java/org/apache/sis/io mkdir core/sis-referencing/src/main/java/org/apache/sis/io git mv core/sis-metadata/src/main/java/org/apache/sis/io/wkt core/sis-referencing/src/main/java/org/apache/sis/io/ rmdir core/sis-metadata/src/main/java/org/apache/sis/io mkdir core/sis-referencing/src/main/java/org/apache/sis/metadata mkdir core/sis-referencing/src/main/java/org/apache/sis/metadata/iso mkdir core/sis-referencing/src/test/java/org/apache/sis/metadata mkdir core/sis-referencing/src/test/java/org/apache/sis/metadata/iso git mv core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/ImmutableIdentifier.java core/sis-referencing/src/main/java/org/apache/sis/metadata/iso/ImmutableIdentifier.java
Some files need to be modified after the move (e.g. MetadataTestSuite, etc).