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/06/01 19:00:33 UTC
svn commit: r1682952 - in /sis/branches/JDK8/core:
sis-metadata/src/main/java/org/apache/sis/internal/metadata/
sis-metadata/src/main/java/org/apache/sis/io/wkt/
sis-metadata/src/main/java/org/apache/sis/metadata/
sis-referencing/src/main/java/org/apac...
Author: desruisseaux
Date: Mon Jun 1 17:00:32 2015
New Revision: 1682952
URL: http://svn.apache.org/r1682952
Log:
WKT parsing: moved MathTransformParser from sis-referencing module to sis-metadata module, in order to avoid splitting a package in many modules (an OSGi restriction).
This force us to get ride of the OperationMethods internal class. Its work is now done by ReferencingServices instead.
Added:
sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/MathTransformParser.java
- copied, changed from r1682275, sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/io/wkt/MathTransformParser.java
Removed:
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/io/wkt/MathTransformParser.java
Modified:
sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/NameToIdentifier.java
sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/ReferencingServices.java
sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/AbstractMetadata.java
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/PositionalAccuracyConstant.java
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/ServicesForMetadata.java
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/AbstractIdentifiedObject.java
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/IdentifiedObjects.java
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/AbstractDerivedCRS.java
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/GeodeticObjectFactory.java
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/AbstractCoordinateOperation.java
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/AbstractSingleOperation.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/referencing/operation/DefaultConversionTest.java
sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/DefaultTransformationTest.java
sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/internal/util/MetadataServices.java
Modified: sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/NameToIdentifier.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/NameToIdentifier.java?rev=1682952&r1=1682951&r2=1682952&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/NameToIdentifier.java [UTF-8] (original)
+++ sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/NameToIdentifier.java [UTF-8] Mon Jun 1 17:00:32 2015
@@ -17,6 +17,7 @@
package org.apache.sis.internal.metadata;
import java.util.Locale;
+import java.util.Collection;
import org.opengis.util.NameSpace;
import org.opengis.util.GenericName;
import org.opengis.util.InternationalString;
@@ -24,8 +25,10 @@ import org.opengis.metadata.Identifier;
import org.opengis.metadata.citation.Citation;
import org.apache.sis.metadata.iso.citation.Citations;
import org.apache.sis.util.iso.DefaultNameSpace;
+import org.apache.sis.util.CharSequences;
import static org.apache.sis.util.ArgumentChecks.ensureNonNull;
+import static org.apache.sis.util.Characters.Filter.LETTERS_AND_DIGITS;
// Branch-dependent imports
import java.util.Objects;
@@ -33,6 +36,8 @@ import java.util.Objects;
/**
* Does the unobvious mapping between {@link Identifier} properties and {@link GenericName} ones.
+ * This class also implements the {@link #isHeuristicMatchForName(Identifier, Collection, CharSequence)}
+ * method since that method involves a mix of names and identifiers.
*
* <p><b>Limitation:</b>
* Current version does not yet work with URN or HTTP syntax.</p>
@@ -202,4 +207,46 @@ public final class NameToIdentifier impl
}
return null;
}
+
+ /**
+ * Returns {@code true} if the given {@linkplain org.apache.sis.referencing.AbstractIdentifiedObject#getName()
+ * primary name} or one of the given aliases matches the given name. The comparison ignores case, some Latin
+ * diacritical signs and any characters that are not letters or digits.
+ *
+ * @param name The name of the {@code IdentifiedObject} to check.
+ * @param aliases The list of alias in the {@code IdentifiedObject} (may be {@code null}). This method will never
+ * modify that list. Consequently, the given list can be a direct reference to an internal list.
+ * @param toSearch The name for which to check for equality.
+ * @return {@code true} if the primary name or at least one alias matches the given {@code name}.
+ */
+ public static boolean isHeuristicMatchForName(final Identifier name, final Collection<GenericName> aliases,
+ CharSequence toSearch)
+ {
+ toSearch = CharSequences.toASCII(toSearch);
+ if (name != null) { // Paranoiac check.
+ final CharSequence code = CharSequences.toASCII(name.getCode());
+ if (code != null) { // Paranoiac check.
+ if (CharSequences.equalsFiltered(toSearch, code, LETTERS_AND_DIGITS, true)) {
+ return true;
+ }
+ }
+ }
+ if (aliases != null) {
+ for (final GenericName alias : aliases) {
+ if (alias != null) { // Paranoiac check.
+ final CharSequence tip = CharSequences.toASCII(alias.tip().toString());
+ if (CharSequences.equalsFiltered(toSearch, tip, LETTERS_AND_DIGITS, true)) {
+ return true;
+ }
+ /*
+ * Note: a previous version compared also the scoped names. We removed that part,
+ * because experience has shown that this method is used only for the "code" part
+ * of an object name. If we really want to compare scoped name, it would probably
+ * be better to take a GenericName argument instead than String.
+ */
+ }
+ }
+ }
+ return false;
+ }
}
Modified: sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/ReferencingServices.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/ReferencingServices.java?rev=1682952&r1=1682951&r2=1682952&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/ReferencingServices.java [UTF-8] (original)
+++ sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/ReferencingServices.java [UTF-8] Mon Jun 1 17:00:32 2015
@@ -17,9 +17,11 @@
package org.apache.sis.internal.metadata;
import org.opengis.geometry.Envelope;
+import org.opengis.metadata.Identifier;
import org.opengis.parameter.ParameterDescriptor;
import org.opengis.referencing.IdentifiedObject;
import org.opengis.referencing.operation.MathTransform;
+import org.opengis.referencing.operation.OperationMethod;
import org.opengis.referencing.operation.TransformException;
import org.apache.sis.metadata.iso.extent.DefaultExtent;
import org.apache.sis.metadata.iso.extent.DefaultVerticalExtent;
@@ -29,7 +31,10 @@ import org.apache.sis.metadata.iso.exten
import org.apache.sis.internal.system.SystemListener;
import org.apache.sis.internal.system.Modules;
import org.apache.sis.io.wkt.FormattableObject;
+import org.apache.sis.util.iso.DefaultNameSpace;
import org.apache.sis.util.resources.Errors;
+import org.apache.sis.util.logging.Logging;
+import org.apache.sis.util.Deprecable;
/**
@@ -37,15 +42,15 @@ import org.apache.sis.util.resources.Err
* This class searches for the {@link org.apache.sis.internal.referencing.ServicesForMetadata}
* implementation using Java reflection.
*
- * <p>This class also opportunistically defines some constants related to "referencing by coordinates"
- * but needed by metadata.</p>
+ * <p>This class also opportunistically defines some methods and constants related to
+ * <cite>"referencing by coordinates"</cite> but needed by metadata.</p>
*
* @author Martin Desruisseaux (Geomatys)
* @since 0.3
* @version 0.6
* @module
*/
-public abstract class ReferencingServices extends SystemListener {
+public class ReferencingServices extends SystemListener {
/**
* The length of one nautical mile, which is {@value} metres.
*/
@@ -58,6 +63,32 @@ public abstract class ReferencingService
public static final double AUTHALIC_RADIUS = 6371007;
/**
+ * The key for specifying explicitely the value to be returned by
+ * {@link org.apache.sis.referencing.operation.DefaultConversion#getParameterValues()}.
+ * It is usually not necessary to specify those parameters because they are inferred either from
+ * the {@link MathTransform}, or specified explicitely in a {@code DefiningConversion}. However
+ * there is a few cases, for example the Molodenski transform, where none of the above can apply,
+ * because SIS implements those operations as a concatenation of math transforms, and such
+ * concatenations do not have {@link org.opengis.parameter.ParameterValueGroup}.
+ */
+ public static final String PARAMETERS_KEY = "parameters";
+
+ /**
+ * The key for specifying a {@linkplain org.opengis.referencing.operation.MathTransformFactory}
+ * instance to use for the construction of a geodetic object. This is usually not needed for CRS
+ * construction, except in the special case of a derived CRS created from a defining conversion.
+ */
+ public static final String MT_FACTORY = "mtFactory";
+
+ /**
+ * The separator character between an identifier and its namespace in the argument given to
+ * {@link #getOperationMethod(String)}. For example this is the separator in {@code "EPSG:9807"}.
+ *
+ * This is defined as a constant for now, but we may make it configurable in a future version.
+ */
+ private static final char IDENTIFIER_SEPARATOR = DefaultNameSpace.DEFAULT_SEPARATOR;
+
+ /**
* The services, fetched when first needed.
*/
private static volatile ReferencingServices instance;
@@ -88,10 +119,8 @@ public abstract class ReferencingService
* Returns the singleton instance.
*
* @return The singleton instance.
- * @throws UnsupportedOperationException If the {@code "sis-referencing"} module has not
- * been found on the classpath.
*/
- public static ReferencingServices getInstance() throws UnsupportedOperationException {
+ public static ReferencingServices getInstance() {
ReferencingServices c = instance;
if (c == null) {
synchronized (ReferencingServices.class) {
@@ -105,8 +134,22 @@ public abstract class ReferencingService
try {
c = (ReferencingServices) Class.forName("org.apache.sis.internal.referencing.ServicesForMetadata").newInstance();
} catch (ClassNotFoundException exception) {
- throw new UnsupportedOperationException(Errors.format(
- Errors.Keys.MissingRequiredModule_1, "sis-referencing"), exception);
+ /*
+ * Log at the "warning" level. This method is usually invoked from a metadata class,
+ * except org.apache.sis.io.wkt.Formatter. So we infer the logger from the stacktrace.
+ */
+ String logger = Modules.METADATA; // Default logger.
+ for (final StackTraceElement e : exception.getStackTrace()) {
+ final String name = e.getClassName();
+ if (name.startsWith(Modules.METADATA)) break;
+ if (name.startsWith("org.apache.sis.io.wkt")) {
+ logger = "org.apache.sis.io.wkt";
+ break;
+ }
+ }
+ Logging.unexpectedException(Logging.getLogger(logger),
+ ReferencingServices.class, "getInstance", exception);
+ c = new ReferencingServices();
} catch (ReflectiveOperationException exception) {
// Should never happen if we didn't broke our helper class.
throw new AssertionError(exception);
@@ -119,26 +162,40 @@ public abstract class ReferencingService
}
/**
+ * Returns the exception to throw when a method requiring the {@code sis-referencing} module is invoked
+ * but that module is not on the classpath.
+ */
+ private static UnsupportedOperationException referencingModuleNotFound() {
+ return new UnsupportedOperationException(Errors.format(Errors.Keys.MissingRequiredModule_1, "sis-referencing"));
+ }
+
+ /**
* Returns a fully implemented parameter descriptor.
*
* @param parameter A partially implemented parameter descriptor, or {@code null}.
* @return A fully implemented parameter descriptor, or {@code null} if the given argument was null.
+ * @throws UnsupportedOperationException if the {@code "sis-referencing"} module has not been found on the classpath.
*
* @since 0.5
*/
- public abstract ParameterDescriptor<?> toImplementation(ParameterDescriptor<?> parameter);
+ public ParameterDescriptor<?> toImplementation(ParameterDescriptor<?> parameter) {
+ throw referencingModuleNotFound();
+ }
/**
* Converts the given object in a {@code FormattableObject} instance.
*
* @param object The object to wrap.
* @return The given object converted to a {@code FormattableObject} instance.
+ * @throws UnsupportedOperationException if the {@code "sis-referencing"} module has not been found on the classpath.
*
* @see org.apache.sis.referencing.AbstractIdentifiedObject#castOrCopy(IdentifiedObject)
*
* @since 0.4
*/
- public abstract FormattableObject toFormattableObject(IdentifiedObject object);
+ public FormattableObject toFormattableObject(IdentifiedObject object) {
+ throw referencingModuleNotFound();
+ }
/**
* Converts the given object in a {@code FormattableObject} instance. Callers should verify that the given
@@ -148,10 +205,13 @@ public abstract class ReferencingService
* @param object The object to wrap.
* @param internal {@code true} if the formatting convention is {@code Convention.INTERNAL}.
* @return The given object converted to a {@code FormattableObject} instance, or {@code null}.
+ * @throws UnsupportedOperationException if the {@code "sis-referencing"} module has not been found on the classpath.
*
* @since 0.6
*/
- public abstract FormattableObject toFormattableObject(MathTransform object, boolean internal);
+ public FormattableObject toFormattableObject(MathTransform object, boolean internal) {
+ throw referencingModuleNotFound();
+ }
/**
* Sets a geographic bounding box from the specified envelope.
@@ -161,10 +221,12 @@ public abstract class ReferencingService
*
* @param envelope The source envelope.
* @param target The target bounding box.
- * @throws TransformException If the given envelope can't be transformed.
+ * @throws TransformException if the given envelope can't be transformed.
+ * @throws UnsupportedOperationException if the {@code "sis-referencing"} module has not been found on the classpath.
*/
- public abstract void setBounds(Envelope envelope, DefaultGeographicBoundingBox target)
- throws TransformException;
+ public void setBounds(Envelope envelope, DefaultGeographicBoundingBox target) throws TransformException {
+ throw referencingModuleNotFound();
+ }
/**
* Sets a vertical extent with the value inferred from the given envelope.
@@ -172,10 +234,12 @@ public abstract class ReferencingService
*
* @param envelope The source envelope.
* @param target The target vertical extent.
- * @throws TransformException If no vertical component can be extracted from the given envelope.
+ * @throws TransformException if no vertical component can be extracted from the given envelope.
+ * @throws UnsupportedOperationException if the {@code "sis-referencing"} module has not been found on the classpath.
*/
- public abstract void setBounds(Envelope envelope, DefaultVerticalExtent target)
- throws TransformException;
+ public void setBounds(Envelope envelope, DefaultVerticalExtent target) throws TransformException {
+ throw referencingModuleNotFound();
+ }
/**
* Sets a temporal extent with the value inferred from the given envelope.
@@ -183,10 +247,12 @@ public abstract class ReferencingService
*
* @param envelope The source envelope.
* @param target The target temporal extent.
- * @throws TransformException If no temporal component can be extracted from the given envelope.
+ * @throws TransformException if no temporal component can be extracted from the given envelope.
+ * @throws UnsupportedOperationException if the {@code "sis-referencing"} module has not been found on the classpath.
*/
- public abstract void setBounds(Envelope envelope, DefaultTemporalExtent target)
- throws TransformException;
+ public void setBounds(Envelope envelope, DefaultTemporalExtent target) throws TransformException {
+ throw referencingModuleNotFound();
+ }
/**
* Sets the geographic, vertical and temporal extents with the values inferred from the given envelope.
@@ -204,18 +270,90 @@ public abstract class ReferencingService
*
* @param envelope The source envelope.
* @param target The target spatio-temporal extent.
- * @throws TransformException If no temporal component can be extracted from the given envelope.
+ * @throws TransformException if no temporal component can be extracted from the given envelope.
+ * @throws UnsupportedOperationException if the {@code "sis-referencing"} module has not been found on the classpath.
*/
- public abstract void setBounds(Envelope envelope, DefaultSpatialTemporalExtent target)
- throws TransformException;
+ public void setBounds(Envelope envelope, DefaultSpatialTemporalExtent target) throws TransformException {
+ throw referencingModuleNotFound();
+ }
/**
- * Initializes a horizontal, vertical and temporal extent with the values inferred from
- * the given envelope.
+ * Initializes a horizontal, vertical and temporal extent with the values inferred from the given envelope.
*
* @param envelope The source envelope.
* @param target The target extent.
- * @throws TransformException If a coordinate transformation was required and failed.
+ * @throws TransformException if a coordinate transformation was required and failed.
+ * @throws UnsupportedOperationException if the {@code "sis-referencing"} module has not been found on the classpath.
*/
- public abstract void addElements(Envelope envelope, DefaultExtent target) throws TransformException;
+ public void addElements(Envelope envelope, DefaultExtent target) throws TransformException {
+ throw referencingModuleNotFound();
+ }
+
+ /**
+ * Returns {@code true} if the {@linkplain org.apache.sis.referencing.AbstractIdentifiedObject#getName()
+ * primary name} or an aliases of the given object matches the given name. The comparison ignores case,
+ * some Latin diacritical signs and any characters that are not letters or digits.
+ *
+ * @param object The object for which to check the name or alias.
+ * @param name The name to compare with the object name or aliases.
+ * @return {@code true} if the primary name of at least one alias matches the specified {@code name}.
+ */
+ public boolean isHeuristicMatchForName(final IdentifiedObject object, final String name) {
+ return NameToIdentifier.isHeuristicMatchForName(object.getName(), object.getAlias(), name);
+ }
+
+ /**
+ * Returns the operation method for the specified name or identifier. The given argument shall be either a
+ * method name (e.g. <cite>"Transverse Mercator"</cite>) or one of its identifiers (e.g. {@code "EPSG:9807"}).
+ *
+ * @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;
+ for (final OperationMethod method : methods) {
+ if (matches(method, identifier)) {
+ /*
+ * Stop the iteration at the first non-deprecated method.
+ * If we find only deprecated methods, take the first one.
+ */
+ if (!(method instanceof Deprecable) || !((Deprecable) method).isDeprecated()) {
+ return method;
+ }
+ if (fallback == null) {
+ fallback = method;
+ }
+ }
+ }
+ return fallback;
+ }
+
+ /**
+ * Returns {@code true} if the name or an identifier of the given method matches the given {@code identifier}.
+ *
+ * @param method The method to test for a match.
+ * @param identifier The name or identifier of the operation method to search.
+ * @return {@code true} if the given method is a match for the given identifier.
+ */
+ private static boolean matches(final OperationMethod method, final String identifier) {
+ if (getInstance().isHeuristicMatchForName(method, identifier)) {
+ return true;
+ }
+ for (int s = identifier.indexOf(IDENTIFIER_SEPARATOR); s >= 0;
+ s = identifier.indexOf(IDENTIFIER_SEPARATOR, s))
+ {
+ final String codespace = identifier.substring(0, s).trim();
+ final String code = identifier.substring(++s).trim();
+ for (final Identifier id : method.getIdentifiers()) {
+ if (codespace.equalsIgnoreCase(id.getCodeSpace()) && code.equalsIgnoreCase(id.getCode())) {
+ return true;
+ }
+ }
+ }
+ return false;
+ }
}
Copied: sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/MathTransformParser.java (from r1682275, sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/io/wkt/MathTransformParser.java)
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/MathTransformParser.java?p2=sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/MathTransformParser.java&p1=sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/io/wkt/MathTransformParser.java&r1=1682275&r2=1682952&rev=1682952&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/io/wkt/MathTransformParser.java [UTF-8] (original)
+++ sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/MathTransformParser.java [UTF-8] Mon Jun 1 17:00:32 2015
@@ -32,9 +32,9 @@ import org.opengis.referencing.operation
import org.opengis.referencing.operation.MathTransformFactory;
import org.opengis.referencing.operation.NoninvertibleTransformException;
import org.opengis.referencing.operation.OperationMethod;
-import org.apache.sis.internal.referencing.OperationMethods;
import org.apache.sis.internal.system.DefaultFactories;
import org.apache.sis.internal.metadata.WKTKeywords;
+import org.apache.sis.internal.metadata.ReferencingServices;
import org.apache.sis.internal.util.LocalizedParseException;
import org.apache.sis.measure.Units;
import org.apache.sis.util.Numbers;
@@ -316,7 +316,7 @@ class MathTransformParser extends Parser
* getLastMethod(). Performs a slower and less robust check as a fallback.
*/
if (classification != null) {
- lastMethod = OperationMethods.getOperationMethod(
+ lastMethod = ReferencingServices.getOperationMethod(
mtFactory.getAvailableMethods(SingleOperation.class), classification);
}
}
Modified: sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/AbstractMetadata.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/AbstractMetadata.java?rev=1682952&r1=1682951&r2=1682952&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/AbstractMetadata.java [UTF-8] (original)
+++ sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/AbstractMetadata.java [UTF-8] Mon Jun 1 17:00:32 2015
@@ -82,8 +82,15 @@ import org.apache.sis.util.logging.Loggi
public abstract class AbstractMetadata implements LenientComparable, Emptiable {
/**
* The logger for messages related to metadata implementations.
+ *
+ * Note that another logger is provided with public access in the {@code iso} sub-package:
+ * {@link org.apache.sis.metadata.iso.ISOMetadata#LOGGER}. This {@code LOGGER} instance is
+ * kept package-privated for avoiding confusion (other sub-packages like {@code sql} should
+ * create their own logger). This logger is declared in a static field because otherwise,
+ * any configuration done by the user may be lost when the garbage-collector collects the
+ * logger.
*/
- protected static final Logger LOGGER = Logging.getLogger(AbstractMetadata.class);
+ static final Logger LOGGER = Logging.getLogger(AbstractMetadata.class);
/**
* Creates an initially empty metadata.
Modified: sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/PositionalAccuracyConstant.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/PositionalAccuracyConstant.java?rev=1682952&r1=1682951&r2=1682952&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/PositionalAccuracyConstant.java [UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/PositionalAccuracyConstant.java [UTF-8] Mon Jun 1 17:00:32 2015
@@ -16,12 +16,25 @@
*/
package org.apache.sis.internal.referencing;
+import java.util.Collection;
import java.util.Collections;
import java.io.ObjectStreamException;
import javax.xml.bind.annotation.XmlTransient;
+import javax.measure.quantity.Length;
+import javax.measure.unit.SI;
+import javax.measure.unit.Unit;
+import org.opengis.util.Record;
import org.opengis.util.InternationalString;
import org.opengis.metadata.quality.PositionalAccuracy;
import org.opengis.metadata.quality.EvaluationMethodType;
+import org.opengis.metadata.quality.QuantitativeResult;
+import org.opengis.metadata.quality.Result;
+import org.opengis.referencing.operation.ConcatenatedOperation;
+import org.opengis.referencing.operation.Conversion;
+import org.opengis.referencing.operation.CoordinateOperation;
+import org.opengis.referencing.operation.SingleOperation;
+import org.opengis.referencing.operation.Transformation;
+import org.apache.sis.measure.Units;
import org.apache.sis.metadata.iso.citation.Citations;
import org.apache.sis.metadata.iso.quality.DefaultConformanceResult;
import org.apache.sis.metadata.iso.quality.DefaultAbsoluteExternalPositionalAccuracy;
@@ -55,7 +68,7 @@ public final class PositionalAccuracyCon
*
* @see org.apache.sis.referencing.operation.AbstractCoordinateOperation#getLinearAccuracy()
*/
- public static final double UNKNOWN_ACCURACY = 3000;
+ private static final double UNKNOWN_ACCURACY = 3000;
/**
* Default accuracy of datum shift, if not explicitly provided in the EPSG database.
@@ -66,7 +79,7 @@ public final class PositionalAccuracyCon
*
* @see org.apache.sis.referencing.operation.AbstractCoordinateOperation#getLinearAccuracy()
*/
- public static final double DATUM_SHIFT_ACCURACY = 25;
+ private static final double DATUM_SHIFT_ACCURACY = 25;
/**
* Indicates that a {@linkplain org.opengis.referencing.operation.Transformation transformation}
@@ -113,4 +126,95 @@ public final class PositionalAccuracyCon
if (equals(DATUM_SHIFT_OMITTED)) return DATUM_SHIFT_OMITTED;
return this;
}
+
+ /**
+ * Convenience method returning the accuracy in meters for the specified operation.
+ * This method tries each of the following procedures and returns the first successful one:
+ *
+ * <ul>
+ * <li>If a {@link QuantitativeResult} is found with a linear unit, then this accuracy estimate
+ * is converted to {@linkplain SI#METRE metres} and returned.</li>
+ * <li>Otherwise, if the operation is a {@link Conversion}, then returns 0 since a conversion
+ * is by definition accurate up to rounding errors.</li>
+ * <li>Otherwise, if the operation is a {@link Transformation}, then checks if the datum shift
+ * were applied with the help of Bursa-Wolf parameters. This procedure looks for SIS-specific
+ * {@link #DATUM_SHIFT_APPLIED} and {@link #DATUM_SHIFT_OMITTED DATUM_SHIFT_OMITTED} constants.</li>
+ * <li>Otherwise, if the operation is a {@link ConcatenatedOperation}, returns the sum of the accuracy
+ * of all components. This is a conservative scenario where we assume that errors cumulate linearly.
+ * Note that this is not necessarily the "worst case" scenario since the accuracy could be worst
+ * if the math transforms are highly non-linear.</li>
+ * </ul>
+ *
+ * If the above is modified, please update {@code AbstractCoordinateOperation.getLinearAccuracy()} javadoc.
+ *
+ * @param operation The operation to inspect for accuracy.
+ * @return The accuracy estimate (always in meters), or NaN if unknown.
+ *
+ * @see org.apache.sis.referencing.operation.AbstractCoordinateOperation#getLinearAccuracy()
+ */
+ public static double getLinearAccuracy(final CoordinateOperation operation) {
+ final Collection<PositionalAccuracy> accuracies = operation.getCoordinateOperationAccuracy();
+ for (final PositionalAccuracy accuracy : accuracies) {
+ for (final Result result : accuracy.getResults()) {
+ if (result instanceof QuantitativeResult) {
+ final QuantitativeResult quantity = (QuantitativeResult) result;
+ final Collection<? extends Record> records = quantity.getValues();
+ if (records != null) {
+ final Unit<?> unit = quantity.getValueUnit();
+ if (Units.isLinear(unit)) {
+ final Unit<Length> unitOfLength = unit.asType(Length.class);
+ for (final Record record : records) {
+ for (final Object value : record.getAttributes().values()) {
+ if (value instanceof Number) {
+ double v = ((Number) value).doubleValue();
+ v = unitOfLength.getConverterTo(SI.METRE).convert(v);
+ return v;
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ /*
+ * No quantitative (linear) accuracy were found. If the coordinate operation is actually
+ * a conversion, the accuracy is up to rounding error (i.e. conceptually 0) by definition.
+ */
+ if (operation instanceof Conversion) {
+ return 0;
+ }
+ /*
+ * If the coordinate operation is actually a transformation, checks if Bursa-Wolf parameters
+ * were available for the datum shift. This is SIS-specific. See field javadoc for a rational
+ * about the return values chosen.
+ */
+ if (operation instanceof Transformation) {
+ if (accuracies.contains(DATUM_SHIFT_APPLIED)) {
+ return DATUM_SHIFT_ACCURACY;
+ }
+ if (accuracies.contains(DATUM_SHIFT_OMITTED)) {
+ return UNKNOWN_ACCURACY;
+ }
+ }
+ /*
+ * If the coordinate operation is a compound of other coordinate operations, returns the sum of their accuracy,
+ * skipping unknown ones. Making the sum is a conservative approach (not exactly the "worst case" scenario,
+ * since it could be worst if the transforms are highly non-linear).
+ */
+ double accuracy = Double.NaN;
+ if (operation instanceof ConcatenatedOperation) {
+ for (final SingleOperation op : ((ConcatenatedOperation) operation).getOperations()) {
+ final double candidate = Math.abs(getLinearAccuracy(op));
+ if (!Double.isNaN(candidate)) {
+ if (Double.isNaN(accuracy)) {
+ accuracy = candidate;
+ } else {
+ accuracy += candidate;
+ }
+ }
+ }
+ }
+ return accuracy;
+ }
}
Modified: sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/ServicesForMetadata.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/ServicesForMetadata.java?rev=1682952&r1=1682951&r2=1682952&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/ServicesForMetadata.java [UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/ServicesForMetadata.java [UTF-8] Mon Jun 1 17:00:32 2015
@@ -42,6 +42,7 @@ import org.opengis.geometry.Envelope;
import org.apache.sis.geometry.Envelopes;
import org.apache.sis.referencing.CRS;
import org.apache.sis.referencing.CommonCRS;
+import org.apache.sis.referencing.IdentifiedObjects;
import org.apache.sis.referencing.AbstractIdentifiedObject;
import org.apache.sis.referencing.crs.DefaultTemporalCRS;
import org.apache.sis.referencing.operation.transform.MathTransforms;
@@ -414,4 +415,17 @@ public final class ServicesForMetadata e
target.getTemporalElements().add(extent);
}
}
+
+ /**
+ * Returns {@code true} if the {@linkplain AbstractIdentifiedObject#getName() primary name} or an aliases
+ * of the given object matches the given name.
+ *
+ * @param object The object for which to check the name or alias.
+ * @param name The name to compare with the object name or aliases.
+ * @return {@code true} if the primary name of at least one alias matches the specified {@code name}.
+ */
+ @Override
+ public boolean isHeuristicMatchForName(final IdentifiedObject object, final String name) {
+ return IdentifiedObjects.isHeuristicMatchForName(object, name);
+ }
}
Modified: sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/AbstractIdentifiedObject.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/AbstractIdentifiedObject.java?rev=1682952&r1=1682951&r2=1682952&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/AbstractIdentifiedObject.java [UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/AbstractIdentifiedObject.java [UTF-8] Mon Jun 1 17:00:32 2015
@@ -43,6 +43,7 @@ import org.apache.sis.internal.metadata.
import org.apache.sis.internal.jaxb.referencing.Code;
import org.apache.sis.internal.util.Numerics;
import org.apache.sis.internal.util.UnmodifiableArrayList;
+import org.apache.sis.internal.metadata.NameToIdentifier;
import org.apache.sis.internal.referencing.WKTUtilities;
import org.apache.sis.internal.referencing.ReferencingUtilities;
import org.apache.sis.internal.system.DefaultFactories;
@@ -55,6 +56,7 @@ import org.apache.sis.util.ComparisonMod
import org.apache.sis.util.LenientComparable;
import org.apache.sis.util.Classes;
import org.apache.sis.util.iso.Types;
+import org.apache.sis.util.iso.DefaultNameFactory;
import org.apache.sis.util.resources.Errors;
import static org.apache.sis.util.ArgumentChecks.*;
@@ -66,7 +68,6 @@ import static org.apache.sis.internal.ut
// Branch-dependent imports
import java.util.Objects;
-import org.apache.sis.util.iso.DefaultNameFactory;
/**
@@ -788,7 +789,7 @@ public class AbstractIdentifiedObject ex
* @see IdentifiedObjects#isHeuristicMatchForName(IdentifiedObject, String)
*/
public boolean isHeuristicMatchForName(final String name) {
- return IdentifiedObjects.isHeuristicMatchForName(this.name, alias, name);
+ return NameToIdentifier.isHeuristicMatchForName(this.name, alias, name);
}
/**
Modified: sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/IdentifiedObjects.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/IdentifiedObjects.java?rev=1682952&r1=1682951&r2=1682952&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/IdentifiedObjects.java [UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/IdentifiedObjects.java [UTF-8] Mon Jun 1 17:00:32 2015
@@ -33,9 +33,9 @@ import org.apache.sis.util.Static;
import org.apache.sis.util.CharSequences;
import org.apache.sis.util.iso.DefaultNameSpace;
import org.apache.sis.metadata.iso.citation.Citations; // For javadoc.
+import org.apache.sis.internal.metadata.NameToIdentifier;
import static org.apache.sis.util.ArgumentChecks.ensureNonNull;
-import static org.apache.sis.util.Characters.Filter.LETTERS_AND_DIGITS;
import static org.apache.sis.internal.util.Citations.iterator;
import static org.apache.sis.internal.util.Citations.identifierMatches;
@@ -405,54 +405,11 @@ public final class IdentifiedObjects ext
return ((AbstractIdentifiedObject) object).isHeuristicMatchForName(name);
} else {
ensureNonNull("object", object);
- return isHeuristicMatchForName(object.getName(), object.getAlias(), name);
+ return NameToIdentifier.isHeuristicMatchForName(object.getName(), object.getAlias(), name);
}
}
/**
- * Returns {@code true} if the given {@linkplain AbstractIdentifiedObject#getName() primary name} or one
- * of the given aliases matches the given name. The comparison ignores case, some Latin diacritical signs
- * and any characters that are not letters or digits.
- *
- * @param name The name of the {@code IdentifiedObject} to check.
- * @param aliases The list of alias in the {@code IdentifiedObject} (may be {@code null}).
- * This method will never modify this list. Consequently, the
- * given list can be a direct reference to an internal list.
- * @param toSearch The name for which to check for equality.
- * @return {@code true} if the primary name or at least one alias matches the given {@code name}.
- */
- static boolean isHeuristicMatchForName(final Identifier name, final Collection<GenericName> aliases,
- CharSequence toSearch)
- {
- toSearch = CharSequences.toASCII(toSearch);
- if (name != null) { // Paranoiac check.
- final CharSequence code = CharSequences.toASCII(name.getCode());
- if (code != null) { // Paranoiac check.
- if (CharSequences.equalsFiltered(toSearch, code, LETTERS_AND_DIGITS, true)) {
- return true;
- }
- }
- }
- if (aliases != null) {
- for (final GenericName alias : aliases) {
- if (alias != null) { // Paranoiac check.
- final CharSequence tip = CharSequences.toASCII(alias.tip().toString());
- if (CharSequences.equalsFiltered(toSearch, tip, LETTERS_AND_DIGITS, true)) {
- return true;
- }
- /*
- * Note: a previous version compared also the scoped names. We removed that part,
- * because experience has shown that this method is used only for the "code" part
- * of an object name. If we really want to compare scoped name, it would probably
- * be better to take a GenericName argument instead than String.
- */
- }
- }
- }
- return false;
- }
-
- /**
* Returns a string representation of the given identifier.
* This method applies the following rules:
*
Modified: sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/AbstractDerivedCRS.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/AbstractDerivedCRS.java?rev=1682952&r1=1682951&r2=1682952&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/AbstractDerivedCRS.java [UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/AbstractDerivedCRS.java [UTF-8] Mon Jun 1 17:00:32 2015
@@ -31,7 +31,7 @@ import org.opengis.referencing.operation
import org.opengis.referencing.operation.MathTransformFactory;
import org.opengis.geometry.MismatchedDimensionException;
import org.apache.sis.referencing.operation.DefaultConversion;
-import org.apache.sis.internal.referencing.OperationMethods;
+import org.apache.sis.internal.metadata.ReferencingServices;
import org.apache.sis.internal.system.DefaultFactories;
import org.apache.sis.internal.system.Semaphores;
import org.apache.sis.util.resources.Errors;
@@ -136,7 +136,7 @@ abstract class AbstractDerivedCRS<C exte
private C createConversionFromBase(final Map<String,?> properties, final SingleCRS baseCRS, final Conversion conversion) {
MathTransformFactory factory = null;
if (properties != null) {
- factory = (MathTransformFactory) properties.get(OperationMethods.MT_FACTORY);
+ factory = (MathTransformFactory) properties.get(ReferencingServices.MT_FACTORY);
}
if (factory == null) {
factory = DefaultFactories.forBuildin(MathTransformFactory.class);
Modified: sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/GeodeticObjectFactory.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/GeodeticObjectFactory.java?rev=1682952&r1=1682951&r2=1682952&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/GeodeticObjectFactory.java [UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/GeodeticObjectFactory.java [UTF-8] Mon Jun 1 17:00:32 2015
@@ -40,7 +40,7 @@ import org.opengis.referencing.operation
import org.apache.sis.referencing.cs.*;
import org.apache.sis.referencing.crs.*;
import org.apache.sis.referencing.datum.*;
-import org.apache.sis.internal.referencing.OperationMethods;
+import org.apache.sis.internal.metadata.ReferencingServices;
import org.apache.sis.internal.referencing.MergedProperties;
import org.apache.sis.internal.system.DefaultFactories;
import org.apache.sis.internal.metadata.WKTParser;
@@ -263,7 +263,7 @@ public class GeodeticObjectFactory exten
*/
@Override
protected Object invisibleEntry(final Object key) {
- if (OperationMethods.MT_FACTORY.equals(key)) {
+ if (ReferencingServices.MT_FACTORY.equals(key)) {
return getMathTransformFactory();
} else {
return super.invisibleEntry(key);
Modified: sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/AbstractCoordinateOperation.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/AbstractCoordinateOperation.java?rev=1682952&r1=1682951&r2=1682952&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/AbstractCoordinateOperation.java [UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/AbstractCoordinateOperation.java [UTF-8] Mon Jun 1 17:00:32 2015
@@ -45,8 +45,8 @@ import org.apache.sis.util.collection.Co
import org.apache.sis.util.UnsupportedImplementationException;
import org.apache.sis.referencing.AbstractIdentifiedObject;
import org.apache.sis.referencing.operation.transform.PassThroughTransform;
+import org.apache.sis.internal.referencing.PositionalAccuracyConstant;
import org.apache.sis.internal.referencing.ReferencingUtilities;
-import org.apache.sis.internal.referencing.OperationMethods;
import org.apache.sis.internal.referencing.WKTUtilities;
import org.apache.sis.internal.metadata.WKTKeywords;
import org.apache.sis.internal.util.CollectionsExt;
@@ -533,7 +533,7 @@ check: for (int isTarget=0; ; isTar
* @return The accuracy estimation (always in meters), or NaN if unknown.
*/
public double getLinearAccuracy() {
- return OperationMethods.getLinearAccuracy(this);
+ return PositionalAccuracyConstant.getLinearAccuracy(this);
}
/**
Modified: sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/AbstractSingleOperation.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/AbstractSingleOperation.java?rev=1682952&r1=1682951&r2=1682952&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/AbstractSingleOperation.java [UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/AbstractSingleOperation.java [UTF-8] Mon Jun 1 17:00:32 2015
@@ -32,7 +32,7 @@ import org.apache.sis.referencing.Identi
import org.apache.sis.referencing.operation.transform.MathTransforms;
import org.apache.sis.referencing.operation.transform.PassThroughTransform;
import org.apache.sis.internal.referencing.ReferencingUtilities;
-import org.apache.sis.internal.referencing.OperationMethods;
+import org.apache.sis.internal.metadata.ReferencingServices;
import org.apache.sis.internal.util.Constants;
import org.apache.sis.util.collection.Containers;
import org.apache.sis.util.resources.Errors;
@@ -108,7 +108,7 @@ class AbstractSingleOperation extends Ab
* However there is a few cases, for example the Molodenski transform, where we can not infer the
* parameters easily because the operation is implemented by a concatenation of math transforms.
*/
- parameters = Containers.property(properties, OperationMethods.PARAMETERS_KEY, ParameterValueGroup.class);
+ parameters = Containers.property(properties, ReferencingServices.PARAMETERS_KEY, ParameterValueGroup.class);
// No clone since this is a SIS internal property and SIS does not modify those values after construction.
}
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=1682952&r1=1682951&r2=1682952&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 Jun 1 17:00:32 2015
@@ -27,7 +27,7 @@ import org.opengis.referencing.operation
import org.opengis.referencing.IdentifiedObject;
import org.opengis.referencing.crs.CoordinateReferenceSystem;
import org.apache.sis.internal.referencing.MergedProperties;
-import org.apache.sis.internal.referencing.OperationMethods;
+import org.apache.sis.internal.metadata.ReferencingServices;
import org.apache.sis.internal.system.DefaultFactories;
import org.apache.sis.internal.util.CollectionsExt;
import org.apache.sis.referencing.operation.transform.DefaultMathTransformFactory;
@@ -176,7 +176,7 @@ public class DefaultCoordinateOperationF
}
name = CharSequences.trimWhitespaces(name);
ArgumentChecks.ensureNonEmpty("name", name);
- final OperationMethod method = OperationMethods.getOperationMethod(
+ final OperationMethod method = ReferencingServices.getOperationMethod(
mtFactory.getAvailableMethods(SingleOperation.class), name);
if (method != null) {
return method;
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=1682952&r1=1682951&r2=1682952&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 Jun 1 17:00:32 2015
@@ -50,7 +50,7 @@ import org.apache.sis.internal.util.Lazy
import org.apache.sis.internal.util.Constants;
import org.apache.sis.internal.metadata.WKTParser;
import org.apache.sis.internal.referencing.Formulas;
-import org.apache.sis.internal.referencing.OperationMethods;
+import org.apache.sis.internal.metadata.ReferencingServices;
import org.apache.sis.internal.referencing.ReferencingUtilities;
import org.apache.sis.internal.referencing.j2d.ParameterizedAffine;
import org.apache.sis.parameter.Parameters;
@@ -370,7 +370,7 @@ public class DefaultMathTransformFactory
ArgumentChecks.ensureNonEmpty("identifier", identifier);
OperationMethod method = methodsByName.get(identifier);
if (method == null) {
- method = OperationMethods.getOperationMethod(methods, identifier);
+ method = ReferencingServices.getOperationMethod(methods, identifier);
if (method == null) {
throw new NoSuchIdentifierException(Errors.format(Errors.Keys.NoSuchOperationMethod_1, identifier), identifier);
}
Modified: sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/DefaultConversionTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/DefaultConversionTest.java?rev=1682952&r1=1682951&r2=1682952&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/DefaultConversionTest.java [UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/DefaultConversionTest.java [UTF-8] Mon Jun 1 17:00:32 2015
@@ -30,7 +30,7 @@ import org.opengis.referencing.operation
import org.opengis.referencing.operation.MathTransformFactory;
import org.opengis.referencing.operation.Conversion;
import org.opengis.referencing.operation.OperationMethod;
-import org.apache.sis.internal.referencing.OperationMethods;
+import org.apache.sis.internal.metadata.ReferencingServices;
import org.apache.sis.internal.referencing.ReferencingUtilities;
import org.apache.sis.internal.system.DefaultFactories;
import org.apache.sis.referencing.IdentifiedObjects;
@@ -158,7 +158,7 @@ public final strictfp class DefaultConve
*/
final Map<String, Object> properties = new HashMap<>(4);
properties.put(DefaultTransformation.NAME_KEY, "Paris to Greenwich");
- properties.put(OperationMethods.PARAMETERS_KEY, pg);
+ properties.put(ReferencingServices.PARAMETERS_KEY, pg);
return new DefaultConversion(properties, sourceCRS, targetCRS, interpolationCRS,
method, MathTransforms.linear(rotation));
}
Modified: sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/DefaultTransformationTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/DefaultTransformationTest.java?rev=1682952&r1=1682951&r2=1682952&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/DefaultTransformationTest.java [UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/DefaultTransformationTest.java [UTF-8] Mon Jun 1 17:00:32 2015
@@ -23,7 +23,7 @@ import org.opengis.parameter.ParameterVa
import org.opengis.referencing.datum.GeodeticDatum;
import org.opengis.referencing.operation.Matrix;
import org.opengis.referencing.operation.OperationMethod;
-import org.apache.sis.internal.referencing.OperationMethods;
+import org.apache.sis.internal.metadata.ReferencingServices;
import org.apache.sis.parameter.DefaultParameterDescriptorTest;
import org.apache.sis.referencing.IdentifiedObjects;
import org.apache.sis.referencing.cs.HardCodedCS;
@@ -95,7 +95,7 @@ public final strictfp class DefaultTrans
*/
final Map<String, Object> properties = new HashMap<>(4);
properties.put(DefaultTransformation.NAME_KEY, "Tokyo to JGD2000 (GSI)");
- properties.put(OperationMethods.PARAMETERS_KEY, pg);
+ properties.put(ReferencingServices.PARAMETERS_KEY, pg);
return new DefaultTransformation(properties,
createCRS(null, HardCodedDatum.TOKYO), // SourceCRS
createCRS("JGD2000", HardCodedDatum.JGD2000), // TargetCRS
Modified: sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/internal/util/MetadataServices.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/internal/util/MetadataServices.java?rev=1682952&r1=1682951&r2=1682952&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/internal/util/MetadataServices.java [UTF-8] (original)
+++ sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/internal/util/MetadataServices.java [UTF-8] Mon Jun 1 17:00:32 2015
@@ -78,7 +78,8 @@ public class MetadataServices extends Sy
try {
c = (MetadataServices) Class.forName("org.apache.sis.internal.metadata.ServicesForUtility").newInstance();
} catch (ClassNotFoundException exception) {
- Logging.recoverableException(MetadataServices.class, "getInstance", exception);
+ Logging.unexpectedException(Logging.getLogger(Modules.UTILITIES),
+ MetadataServices.class, "getInstance", exception);
c = new MetadataServices();
} catch (ReflectiveOperationException exception) {
// Should never happen if we didn't broke our helper class.