You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sis.apache.org by de...@apache.org on 2015/05/18 14:56:24 UTC
svn commit: r1680022 - in /sis/branches/JDK8:
core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/
core/sis-referencing/src/main/java/org/apache/sis/referencing/
core/sis-referencing/src/main/java/org/apache/sis/referencing/operation...
Author: desruisseaux
Date: Mon May 18 12:56:23 2015
New Revision: 1680022
URL: http://svn.apache.org/r1680022
Log:
Referencing: register GeodeticObjectFactory in META-INF/services.
Added:
sis/branches/JDK8/core/sis-referencing/src/main/resources/META-INF/services/org.opengis.referencing.crs.CRSFactory (with props)
sis/branches/JDK8/core/sis-referencing/src/main/resources/META-INF/services/org.opengis.referencing.cs.CSFactory (with props)
sis/branches/JDK8/core/sis-referencing/src/main/resources/META-INF/services/org.opengis.referencing.datum.DatumFactory (with props)
sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/GeodeticObjectFactoryTest.java (with props)
Modified:
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/OperationMethods.java
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/Pending.java
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/GeodeticObjectFactory.java
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/DefaultCoordinateOperationFactory.java
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/DefaultMathTransformFactory.java
sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/test/suite/ReferencingTestSuite.java
sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/internal/system/DefaultFactories.java
sis/branches/JDK8/ide-project/NetBeans/build.xml
Modified: sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/OperationMethods.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/OperationMethods.java?rev=1680022&r1=1680021&r2=1680022&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/OperationMethods.java [UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/OperationMethods.java [UTF-8] Mon May 18 12:56:23 2015
@@ -82,6 +82,9 @@ public final class OperationMethods exte
* @param methods The method candidates.
* @param identifier The name or identifier of the operation method to search.
* @return The coordinate operation method for the given name or identifier, or {@code null} if none.
+ *
+ * @see org.apache.sis.referencing.operation.DefaultCoordinateOperationFactory#getOperationMethod(String)
+ * @see org.apache.sis.referencing.operation.transform.DefaultMathTransformFactory#getOperationMethod(String)
*/
public static OperationMethod getOperationMethod(final Iterable<? extends OperationMethod> methods, final String identifier) {
OperationMethod fallback = null;
Modified: sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/Pending.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/Pending.java?rev=1680022&r1=1680021&r2=1680022&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/Pending.java [UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/Pending.java [UTF-8] Mon May 18 12:56:23 2015
@@ -17,6 +17,10 @@
package org.apache.sis.internal.referencing;
import java.text.ParseException;
+import org.opengis.referencing.crs.CRSFactory;
+import org.opengis.referencing.crs.CoordinateReferenceSystem;
+import org.opengis.referencing.cs.CSFactory;
+import org.opengis.referencing.datum.DatumFactory;
import org.opengis.referencing.operation.MathTransform;
import org.opengis.referencing.operation.MathTransformFactory;
import org.apache.sis.internal.system.DefaultFactories;
@@ -41,4 +45,14 @@ public abstract class Pending {
}
public abstract MathTransform createFromWKT(MathTransformFactory factory, String text) throws ParseException;
+
+ public CoordinateReferenceSystem createFromWKT(
+ final DatumFactory datumFactory,
+ final CSFactory csFactory,
+ final CRSFactory crsFactory,
+ final MathTransformFactory mtFactory,
+ final String text) throws ParseException
+ {
+ throw new UnsupportedOperationException();
+ }
}
Modified: sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/GeodeticObjectFactory.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/GeodeticObjectFactory.java?rev=1680022&r1=1680021&r2=1680022&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/GeodeticObjectFactory.java [UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/GeodeticObjectFactory.java [UTF-8] Mon May 18 12:56:23 2015
@@ -21,6 +21,7 @@ import java.util.Locale;
import java.util.Map;
import java.util.HashMap;
import java.util.Collections;
+import java.text.ParseException;
import javax.measure.unit.Unit;
import javax.measure.quantity.Angle;
import javax.measure.quantity.Length;
@@ -40,6 +41,7 @@ import org.apache.sis.referencing.crs.*;
import org.apache.sis.referencing.datum.*;
import org.apache.sis.internal.referencing.OperationMethods;
import org.apache.sis.internal.referencing.MergedProperties;
+import org.apache.sis.internal.referencing.Pending;
import org.apache.sis.internal.system.DefaultFactories;
import org.apache.sis.internal.util.CollectionsExt;
import org.apache.sis.util.collection.WeakHashSet;
@@ -172,7 +174,7 @@ import org.apache.sis.xml.XML;
* is used only on a <cite>best effort</cite> basis. The locale is discarded after successful construction
* since localizations are applied by the {@link InternationalString#toString(Locale)} method.</p>
*
- * @author Martin Desruisseaux (IRD)
+ * @author Martin Desruisseaux (IRD, Geomatys)
* @since 0.6
* @version 0.6
* @module
@@ -1324,11 +1326,20 @@ public class GeodeticObjectFactory exten
/**
* Creates a coordinate reference system object from a string.
*
- * @param wkt Coordinate system encoded in Well-Known Text format.
+ * @param text Coordinate system encoded in Well-Known Text format (version 1 or 2).
* @throws FactoryException if the object creation failed.
*/
@Override
- public CoordinateReferenceSystem createFromWKT(final String wkt) throws FactoryException {
- throw new FactoryException("Not yet implemented");
+ public CoordinateReferenceSystem createFromWKT(final String text) throws FactoryException {
+ final Pending pending = Pending.getInstance();
+ try {
+ return pending.createFromWKT(this, this, this, getMathTransformFactory(), text);
+ } catch (ParseException exception) {
+ final Throwable cause = exception.getCause();
+ if (cause instanceof FactoryException) {
+ throw (FactoryException) cause;
+ }
+ throw new FactoryException(exception);
+ }
}
}
Modified: sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/DefaultCoordinateOperationFactory.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/DefaultCoordinateOperationFactory.java?rev=1680022&r1=1680021&r2=1680022&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/DefaultCoordinateOperationFactory.java [UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/DefaultCoordinateOperationFactory.java [UTF-8] Mon May 18 12:56:23 2015
@@ -155,13 +155,12 @@ public class DefaultCoordinateOperationF
* Returns the operation method of the given name. The given argument shall be either a method
* {@linkplain DefaultOperationMethod#getName() name} (e.g. <cite>"Transverse Mercator"</cite>)
* or one of its {@linkplain DefaultOperationMethod#getIdentifiers() identifiers} (e.g. {@code "EPSG:9807"}).
- *
- * <p>The search is case-insensitive. Comparisons against method names can be
- * {@linkplain DefaultOperationMethod#isHeuristicMatchForName(String) heuristic}.</p>
+ * The search is case-insensitive and comparisons against method names can be
+ * {@linkplain DefaultOperationMethod#isHeuristicMatchForName(String) heuristic}.
*
* <p>If more than one method match the given name, then the first (according iteration order)
- * non-{@linkplain Deprecable#isDeprecated() deprecated} matching method is returned. If all matching
- * methods are deprecated, the first one is returned.</p>
+ * non-{@linkplain org.apache.sis.util.Deprecable#isDeprecated() deprecated} matching method is returned.
+ * If all matching methods are deprecated, the first one is returned.</p>
*
* @param name The name of the operation method to fetch.
* @return The operation method of the given name.
Modified: sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/DefaultMathTransformFactory.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/DefaultMathTransformFactory.java?rev=1680022&r1=1680021&r2=1680022&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/DefaultMathTransformFactory.java [UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/DefaultMathTransformFactory.java [UTF-8] Mon May 18 12:56:23 2015
@@ -59,7 +59,6 @@ import org.apache.sis.referencing.operat
import org.apache.sis.util.ArgumentChecks;
import org.apache.sis.util.CharSequences;
import org.apache.sis.util.Classes;
-import org.apache.sis.util.Deprecable;
import org.apache.sis.util.collection.WeakHashSet;
import org.apache.sis.util.iso.AbstractFactory;
import org.apache.sis.util.logging.Logging;
@@ -340,8 +339,8 @@ public class DefaultMathTransformFactory
* {@linkplain DefaultOperationMethod#isHeuristicMatchForName(String) heuristic}.</p>
*
* <p>If more than one method match the given identifier, then the first (according iteration order)
- * non-{@linkplain Deprecable#isDeprecated() deprecated} matching method is returned. If all matching
- * methods are deprecated, the first one is returned.</p>
+ * non-{@linkplain org.apache.sis.util.Deprecable#isDeprecated() deprecated} matching method is returned.
+ * If all matching methods are deprecated, the first one is returned.</p>
*
* @param identifier The name or identifier of the operation method to search.
* @return The coordinate operation method for the given name or identifier.
Added: sis/branches/JDK8/core/sis-referencing/src/main/resources/META-INF/services/org.opengis.referencing.crs.CRSFactory
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/resources/META-INF/services/org.opengis.referencing.crs.CRSFactory?rev=1680022&view=auto
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/main/resources/META-INF/services/org.opengis.referencing.crs.CRSFactory (added)
+++ sis/branches/JDK8/core/sis-referencing/src/main/resources/META-INF/services/org.opengis.referencing.crs.CRSFactory [UTF-8] Mon May 18 12:56:23 2015
@@ -0,0 +1,2 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements.
+org.apache.sis.referencing.GeodeticObjectFactory
Propchange: sis/branches/JDK8/core/sis-referencing/src/main/resources/META-INF/services/org.opengis.referencing.crs.CRSFactory
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: sis/branches/JDK8/core/sis-referencing/src/main/resources/META-INF/services/org.opengis.referencing.crs.CRSFactory
------------------------------------------------------------------------------
svn:mime-type = text/plain;charset=UTF-8
Added: sis/branches/JDK8/core/sis-referencing/src/main/resources/META-INF/services/org.opengis.referencing.cs.CSFactory
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/resources/META-INF/services/org.opengis.referencing.cs.CSFactory?rev=1680022&view=auto
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/main/resources/META-INF/services/org.opengis.referencing.cs.CSFactory (added)
+++ sis/branches/JDK8/core/sis-referencing/src/main/resources/META-INF/services/org.opengis.referencing.cs.CSFactory [UTF-8] Mon May 18 12:56:23 2015
@@ -0,0 +1,2 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements.
+org.apache.sis.referencing.GeodeticObjectFactory
Propchange: sis/branches/JDK8/core/sis-referencing/src/main/resources/META-INF/services/org.opengis.referencing.cs.CSFactory
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: sis/branches/JDK8/core/sis-referencing/src/main/resources/META-INF/services/org.opengis.referencing.cs.CSFactory
------------------------------------------------------------------------------
svn:mime-type = text/plain;charset=UTF-8
Added: sis/branches/JDK8/core/sis-referencing/src/main/resources/META-INF/services/org.opengis.referencing.datum.DatumFactory
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/resources/META-INF/services/org.opengis.referencing.datum.DatumFactory?rev=1680022&view=auto
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/main/resources/META-INF/services/org.opengis.referencing.datum.DatumFactory (added)
+++ sis/branches/JDK8/core/sis-referencing/src/main/resources/META-INF/services/org.opengis.referencing.datum.DatumFactory [UTF-8] Mon May 18 12:56:23 2015
@@ -0,0 +1,2 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements.
+org.apache.sis.referencing.GeodeticObjectFactory
Propchange: sis/branches/JDK8/core/sis-referencing/src/main/resources/META-INF/services/org.opengis.referencing.datum.DatumFactory
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: sis/branches/JDK8/core/sis-referencing/src/main/resources/META-INF/services/org.opengis.referencing.datum.DatumFactory
------------------------------------------------------------------------------
svn:mime-type = text/plain;charset=UTF-8
Added: sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/GeodeticObjectFactoryTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/GeodeticObjectFactoryTest.java?rev=1680022&view=auto
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/GeodeticObjectFactoryTest.java (added)
+++ sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/GeodeticObjectFactoryTest.java [UTF-8] Mon May 18 12:56:23 2015
@@ -0,0 +1,66 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.sis.referencing;
+
+import org.opengis.referencing.cs.CSFactory;
+import org.opengis.referencing.crs.CRSFactory;
+import org.opengis.referencing.datum.DatumFactory;
+import org.opengis.test.referencing.ObjectFactoryTest;
+import org.opengis.util.FactoryException;
+import org.apache.sis.internal.system.DefaultFactories;
+import org.apache.sis.referencing.operation.DefaultCoordinateOperationFactory;
+import org.apache.sis.test.DependsOn;
+import org.junit.runner.RunWith;
+import org.junit.runners.JUnit4;
+import org.junit.Ignore;
+
+
+/**
+ * Tests {@link GeodeticObjectFactory} using the suite of tests provided in the GeoAPI project.
+ * Note that this does not include authority factories tests or GIGS tests.
+ *
+ * @author Cédric Briançon (Geomatys)
+ * @since 0.6
+ * @version 0.6
+ * @module
+ */
+@RunWith(JUnit4.class)
+@DependsOn({
+ org.apache.sis.referencing.crs.DefaultGeocentricCRSTest.class,
+ org.apache.sis.referencing.crs.DefaultGeographicCRSTest.class,
+ org.apache.sis.referencing.crs.DefaultProjectedCRSTest.class
+})
+public final strictfp class GeodeticObjectFactoryTest extends ObjectFactoryTest {
+ /**
+ * Creates a new test suite using the singleton factory instance.
+ */
+ public GeodeticObjectFactoryTest() {
+ super(DefaultFactories.forBuildin(DatumFactory.class),
+ DefaultFactories.forBuildin(CSFactory .class),
+ DefaultFactories.forBuildin(CRSFactory .class),
+ new DefaultCoordinateOperationFactory()); // TODO: use DefaultFactories.
+ }
+
+ @Override
+ @Ignore("This tests need the Transverse Mercator projection, which is not yet implemented in SIS.")
+ public void testProjected3D() throws FactoryException {
+ }
+
+ @Ignore("This tests need the Transverse Mercator projection, which is not yet implemented in SIS.")
+ public void testProjectedWithGeoidalHeight() throws FactoryException {
+ }
+}
Propchange: sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/GeodeticObjectFactoryTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/GeodeticObjectFactoryTest.java
------------------------------------------------------------------------------
svn:mime-type = text/plain;charset=UTF-8
Modified: sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/test/suite/ReferencingTestSuite.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/test/suite/ReferencingTestSuite.java?rev=1680022&r1=1680021&r2=1680022&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/test/suite/ReferencingTestSuite.java [UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/test/suite/ReferencingTestSuite.java [UTF-8] Mon May 18 12:56:23 2015
@@ -136,6 +136,7 @@ import org.junit.BeforeClass;
org.apache.sis.referencing.crs.SubTypesTest.class,
org.apache.sis.referencing.crs.DefaultCompoundCRSTest.class,
org.apache.sis.referencing.crs.HardCodedCRSTest.class,
+ org.apache.sis.referencing.GeodeticObjectFactoryTest.class,
org.apache.sis.referencing.StandardDefinitionsTest.class,
org.apache.sis.referencing.CommonCRSTest.class,
org.apache.sis.referencing.CRSTest.class,
Modified: sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/internal/system/DefaultFactories.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/internal/system/DefaultFactories.java?rev=1680022&r1=1680021&r2=1680022&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/internal/system/DefaultFactories.java [UTF-8] (original)
+++ sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/internal/system/DefaultFactories.java [UTF-8] Mon May 18 12:56:23 2015
@@ -87,6 +87,19 @@ public final class DefaultFactories exte
if (factory == null) {
factory = fallback;
}
+ /*
+ * Verifies if the factory that we just selected is the same implementation than an existing instance.
+ * The main case for this test is org.apache.sis.referencing.GeodeticObjectFactory, where the same class
+ * implements 3 factory interfaces.
+ */
+ if (factory != null) {
+ for (final Object existing : FACTORIES.values()) {
+ if (existing != null && factory.getClass().equals(existing.getClass())) {
+ factory = type.cast(existing);
+ break;
+ }
+ }
+ }
FACTORIES.put(type, factory);
}
return factory;
Modified: sis/branches/JDK8/ide-project/NetBeans/build.xml
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/ide-project/NetBeans/build.xml?rev=1680022&r1=1680021&r2=1680022&view=diff
==============================================================================
--- sis/branches/JDK8/ide-project/NetBeans/build.xml (original)
+++ sis/branches/JDK8/ide-project/NetBeans/build.xml Mon May 18 12:56:23 2015
@@ -77,6 +77,27 @@
</fileset>
</concat>
+ <!-- CRSFactory implementations to be loaded by ServiceLoader. -->
+ <concat destfile="${build.classes.dir}/META-INF/services/org.opengis.referencing.crs.CRSFactory" encoding="UTF-8" fixlastline="yes">
+ <fileset dir="${project.root}">
+ <include name="*/*/src/main/resources/META-INF/services/org.opengis.referencing.crs.CRSFactory"/>
+ </fileset>
+ </concat>
+
+ <!-- CSFactory implementations to be loaded by ServiceLoader. -->
+ <concat destfile="${build.classes.dir}/META-INF/services/org.opengis.referencing.cs.CSFactory" encoding="UTF-8" fixlastline="yes">
+ <fileset dir="${project.root}">
+ <include name="*/*/src/main/resources/META-INF/services/org.opengis.referencing.cs.CSFactory"/>
+ </fileset>
+ </concat>
+
+ <!-- DatumFactory implementations to be loaded by ServiceLoader. -->
+ <concat destfile="${build.classes.dir}/META-INF/services/org.opengis.referencing.datum.DatumFactory" encoding="UTF-8" fixlastline="yes">
+ <fileset dir="${project.root}">
+ <include name="*/*/src/main/resources/META-INF/services/org.opengis.referencing.datum.DatumFactory"/>
+ </fileset>
+ </concat>
+
<!-- MathTransformFactory implementations to be loaded by ServiceLoader. -->
<concat destfile="${build.classes.dir}/META-INF/services/org.opengis.referencing.operation.MathTransformFactory" encoding="UTF-8" fixlastline="yes">
<fileset dir="${project.root}">