[ 
https://issues.apache.org/jira/browse/SIS-463?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Martin Desruisseaux updated SIS-463:
------------------------------------
    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.

h2. 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:

{code:java}
} else if (value instanceof Position) {
    append(AbstractDirectPosition.castOrCopy(((Position) 
value).getDirectPosition()));
} else if (value instanceof Envelope) {
    append(AbstractEnvelope.castOrCopy((Envelope) value));          // 
Non-standard
{code}

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}}:

{code:java}
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);
}
{code}

Other cleanups:
* Move {{EllipsoidalHeightCombiner}}, which will allow us to leverage 
{{ReferencingFactoryContainer}} instead than duplicating its work.
* Leverage {{ReferencingFactoryContainer}} dans {{MathTransforParser}} too.
* Move {{WKTKeywords}}.

h2. 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, which is why the {{sis.apache.sis.io.wkt}} migration can not be 
done in Apache SIS 1.0 release.

h2. 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).

{code:bash}
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
{code}

Some files need to be modified after the move (e.g. {{MetadataTestSuite}}, 
_etc_).


  was:
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.

h2. 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:

{code:java}
} else if (value instanceof Position) {
    append(AbstractDirectPosition.castOrCopy(((Position) 
value).getDirectPosition()));
} else if (value instanceof Envelope) {
    append(AbstractEnvelope.castOrCopy((Envelope) value));          // 
Non-standard
{code}

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}}:

{code:java}
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);
}
{code}

Other cleanups:
* Move {{EllipsoidalHeightCombiner}}, which will allow us to leverage 
{{ReferencingFactoryContainer}} instead than duplicating its work.
* Leverage {{ReferencingFactoryContainer}} dans {{MathTransforParser}} too.
* Move {{WKTKeywords}}.

h2. 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, which is why the {{sis.apache.sis.io.wkt}} migration can not be 
done in Apache SIS 1.0 release.

h2. 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).

{code:bash}
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
{code}



> Move WKT support from sis-metadata to sis-referencing
> -----------------------------------------------------
>
>                 Key: SIS-463
>                 URL: https://issues.apache.org/jira/browse/SIS-463
>             Project: Spatial Information Systems
>          Issue Type: Task
>          Components: Metadata, Referencing
>    Affects Versions: 1.0
>            Reporter: Martin Desruisseaux
>            Assignee: Martin Desruisseaux
>            Priority: Minor
>             Fix For: 1.1
>
>
> 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.
> h2. 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:
> {code:java}
> } else if (value instanceof Position) {
>     append(AbstractDirectPosition.castOrCopy(((Position) 
> value).getDirectPosition()));
> } else if (value instanceof Envelope) {
>     append(AbstractEnvelope.castOrCopy((Envelope) value));          // 
> Non-standard
> {code}
> 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}}:
> {code:java}
> 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);
> }
> {code}
> Other cleanups:
> * Move {{EllipsoidalHeightCombiner}}, which will allow us to leverage 
> {{ReferencingFactoryContainer}} instead than duplicating its work.
> * Leverage {{ReferencingFactoryContainer}} dans {{MathTransforParser}} too.
> * Move {{WKTKeywords}}.
> h2. 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, which is why the {{sis.apache.sis.io.wkt}} migration can 
> not be done in Apache SIS 1.0 release.
> h2. 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).
> {code:bash}
> 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
> {code}
> Some files need to be modified after the move (e.g. {{MetadataTestSuite}}, 
> _etc_).



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to