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 2017/05/06 13:00:51 UTC
svn commit: r1794138 [3/4] - in /sis/trunk: ./
core/sis-build-helper/src/main/java/org/apache/sis/internal/taglet/
core/sis-metadata/src/main/java/org/apache/sis/io/wkt/
core/sis-metadata/src/main/java/org/apache/sis/metadata/
core/sis-metadata/src/mai...
Modified: sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/CoordinateOperationRegistry.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/CoordinateOperationRegistry.java?rev=1794138&r1=1794137&r2=1794138&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/CoordinateOperationRegistry.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/CoordinateOperationRegistry.java [UTF-8] Sat May 6 13:00:50 2017
@@ -408,13 +408,13 @@ class CoordinateOperationRegistry {
} finally {
Semaphores.clear(Semaphores.METADATA_ONLY);
}
- } catch (NoSuchAuthorityCodeException | MissingFactoryResourceException exception) {
+ } catch (NoSuchAuthorityCodeException | MissingFactoryResourceException e) {
/*
* sourceCode or targetCode is unknown to the underlying authority factory.
* Ignores the exception and fallback on the generic algorithm provided by
* CoordinateOperationFinder.
*/
- log(exception);
+ log(null, e);
return null;
}
/*
@@ -491,6 +491,14 @@ class CoordinateOperationRegistry {
if (bestChoice instanceof DeferredCoordinateOperation) {
bestChoice = ((DeferredCoordinateOperation) bestChoice).create();
}
+ if (bestChoice instanceof SingleOperation && bestChoice.getMathTransform() == null) {
+ bestChoice = fromDefiningConversion((SingleOperation) bestChoice,
+ inverse ? targetCRS : sourceCRS,
+ inverse ? sourceCRS : targetCRS);
+ if (bestChoice == null) {
+ return null;
+ }
+ }
if (inverse) {
bestChoice = inverse(bestChoice);
}
@@ -511,7 +519,7 @@ class CoordinateOperationRegistry {
removed = operations.remove(deferred);
}
if (removed) {
- log(e);
+ log(null, e);
continue; // Try again with the next best case.
}
// Should never happen, but if happen anyway we should fail for avoiding never-ending loop.
@@ -655,6 +663,12 @@ class CoordinateOperationRegistry {
final MathTransformFactory mtFactory)
throws IllegalArgumentException, IncommensurableException, FactoryException
{
+ /*
+ * Assertion: source and target CRS must be equals, ignoring change in axis order or units.
+ * The first line is for disabling this check if the number of dimensions are not the same
+ * (e.g. as in the "geographic 3D to geographic 2D" conversion) because ALLOW_VARIANT mode
+ * still requires a matching number of dimensions.
+ */
assert ReferencingUtilities.getDimension(sourceCRS) != ReferencingUtilities.getDimension(targetCRS)
|| Utilities.deepEquals(sourceCRS, targetCRS, ComparisonMode.ALLOW_VARIANT);
final Matrix m = CoordinateSystems.swapAndScaleAxes(sourceCRS.getCoordinateSystem(), targetCRS.getCoordinateSystem());
@@ -797,6 +811,42 @@ class CoordinateOperationRegistry {
}
/**
+ * Creates a complete coordinate operation from a defining conversion. Defining conversions usually have
+ * null source and target CRS, but this method nevertheless checks that, in order to reuse the operation
+ * CRS if it happens to have some.
+ *
+ * @param operation the operation specified by the authority.
+ * @param sourceCRS the source CRS specified by the user.
+ * @param targetCRS the target CRS specified by the user
+ * @return a new operation from the given source CRS to target CRS.
+ * @throws FactoryException if an error occurred while creating the new operation.
+ */
+ private CoordinateOperation fromDefiningConversion(final SingleOperation operation,
+ CoordinateReferenceSystem sourceCRS,
+ CoordinateReferenceSystem targetCRS)
+ throws FactoryException
+ {
+ final ParameterValueGroup parameters = operation.getParameterValues();
+ if (parameters != null) {
+ CoordinateReferenceSystem crs;
+ if (Utilities.equalsApproximatively(sourceCRS, crs = operation.getSourceCRS())) sourceCRS = crs;
+ if (Utilities.equalsApproximatively(targetCRS, crs = operation.getTargetCRS())) targetCRS = crs;
+ final MathTransformFactory mtFactory = factorySIS.getMathTransformFactory();
+ if (mtFactory instanceof DefaultMathTransformFactory) {
+ MathTransform mt = ((DefaultMathTransformFactory) mtFactory).createParameterizedTransform(
+ parameters, ReferencingUtilities.createTransformContext(sourceCRS, targetCRS, null));
+ return factorySIS.createSingleOperation(IdentifiedObjects.getProperties(operation),
+ sourceCRS, targetCRS, null, operation.getMethod(), mt);
+ }
+ } else {
+ // Should never happen because parameters are mandatory, but let be safe.
+ log(Resources.forLocale(null).getLogRecord(Level.WARNING, Resources.Keys.MissingParameterValues_1,
+ IdentifiedObjects.getIdentifierOrName(operation)), null);
+ }
+ return null;
+ }
+
+ /**
* Returns a new coordinate operation with the ellipsoidal height added either in the source coordinates,
* in the target coordinates or both. If there is an ellipsoidal transform, then this method updates the
* transforms in order to use the ellipsoidal height (it has an impact on the transformed values).
@@ -906,7 +956,7 @@ class CoordinateOperationRegistry {
((SingleOperation) op).getParameterValues(),
ReferencingUtilities.createTransformContext(sourceCRS, targetCRS, null));
} catch (InvalidGeodeticParameterException e) {
- log(e);
+ log(null, e);
break;
}
operations.set(recreate(op, sourceCRS, targetCRS, mt, mtFactory.getLastMethodUsed()));
@@ -1122,10 +1172,13 @@ class CoordinateOperationRegistry {
* come from {@link CoordinateOperationFinder} since this is the public API which
* use this {@code CoordinateOperationRegistry} class.
*
- * @param exception the exception which occurred.
+ * @param record the record to log, or {@code null} for creating from the exception.
+ * @param exception the exception which occurred, or {@code null} if a {@code record} is specified instead.
*/
- private static void log(final Exception exception) {
- final LogRecord record = new LogRecord(Level.WARNING, exception.getLocalizedMessage());
+ private static void log(LogRecord record, final Exception exception) {
+ if (record == null) {
+ record = new LogRecord(Level.WARNING, exception.getLocalizedMessage());
+ }
record.setLoggerName(Loggers.COORDINATE_OPERATION);
/*
* We usually do not log the stack trace since this method should be invoked only for exceptions
Modified: sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/DefaultConcatenatedOperation.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/DefaultConcatenatedOperation.java?rev=1794138&r1=1794137&r2=1794138&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/DefaultConcatenatedOperation.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/DefaultConcatenatedOperation.java [UTF-8] Sat May 6 13:00:50 2017
@@ -105,19 +105,22 @@ final class DefaultConcatenatedOperation
* @param mtFactory the math transform factory to use for math transforms concatenation.
* @throws FactoryException if the factory can not concatenate the math transforms.
*/
- @SuppressWarnings("PublicConstructorInNonPublicClass")
public DefaultConcatenatedOperation(final Map<String,?> properties, CoordinateOperation[] operations,
final MathTransformFactory mtFactory) throws FactoryException
{
super(properties);
ArgumentChecks.ensureNonNull("operations", operations);
- final List<CoordinateOperation> flattened = new ArrayList<>(operations.length);
- initialize(properties, operations, flattened, mtFactory,
- (coordinateOperationAccuracy == null), (domainOfValidity == null));
- if (flattened.size() < 2) {
+ if (operations.length < 2) {
throw new IllegalArgumentException(Errors.getResources(properties).getString(
Errors.Keys.TooFewOccurrences_2, 2, CoordinateOperation.class));
}
+ final List<CoordinateOperation> flattened = new ArrayList<>(operations.length);
+ initialize(properties, operations, flattened, mtFactory,
+ (coordinateOperationAccuracy == null), (domainOfValidity == null));
+ /*
+ * At this point we should have flattened.size() >= 2, except if some operations
+ * were omitted because their associated math transform were identity operation.
+ */
// The array is of kind CoordinateOperation[] on GeoAPI 4.0-M03,
// but we have to restrict to SingleOperation[] on GeoAPI 3.x.
operations = flattened.toArray(new SingleOperation[flattened.size()]);
@@ -193,7 +196,7 @@ final class DefaultConcatenatedOperation
}
}
}
- previous = op.getTargetCRS(); // For next iteration cycle.
+ previous = op.getTargetCRS(); // For next iteration cycle.
/*
* Now that we have verified the CRS dimensions, we should be able to concatenate the transforms.
* If an operation is a nested ConcatenatedOperation (not allowed by ISO 19111, but we try to be
@@ -208,7 +211,7 @@ final class DefaultConcatenatedOperation
@SuppressWarnings("SuspiciousToArrayCall")
final CoordinateOperation[] asArray = children.toArray(new CoordinateOperation[children.size()]);
initialize(properties, asArray, flattened, (step == null) ? mtFactory : null, setAccuracy, setDomain);
- } else {
+ } else if (!step.isIdentity()) {
flattened.add(op);
}
if (mtFactory != null) {
Modified: sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/DefaultCoordinateOperationFactory.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/DefaultCoordinateOperationFactory.java?rev=1794138&r1=1794137&r2=1794138&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/DefaultCoordinateOperationFactory.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/DefaultCoordinateOperationFactory.java [UTF-8] Sat May 6 13:00:50 2017
@@ -648,12 +648,22 @@ next: for (int i=components.size(); --
if (operations != null && operations.length == 1) {
return operations[0];
}
- final CoordinateOperation op;
+ final ConcatenatedOperation op;
try {
op = new DefaultConcatenatedOperation(properties, operations, getMathTransformFactory());
} catch (IllegalArgumentException exception) {
throw new InvalidGeodeticParameterException(exception.getLocalizedMessage(), exception);
}
+ /*
+ * Verifies again the number of single operations. We may have a singleton if some operations
+ * were omitted because their associated math transform were identity. This happen for example
+ * if a "Geographic 3D to 2D conversion" as been redimensioned to a "3D to 3D" operation.
+ */
+ final List<? extends CoordinateOperation> co = op.getOperations();
+ if (co.size() == 1) {
+ assert op.getMathTransform().equals(co.get(0).getMathTransform()) : op;
+ return co.get(0);
+ }
return pool.unique(op);
}
Modified: sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/DefaultMathTransformFactory.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/DefaultMathTransformFactory.java?rev=1794138&r1=1794137&r2=1794138&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/DefaultMathTransformFactory.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/DefaultMathTransformFactory.java [UTF-8] Sat May 6 13:00:50 2017
@@ -851,7 +851,8 @@ public class DefaultMathTransformFactory
* <p>The given method and parameters are stored in the {@link #provider} and {@link #parameters}
* fields respectively. The actual stored values may differ from the values given to this method.</p>
*
- * @param method description of the transform to be created, or {@code null} if unknown.
+ * @param factory the enclosing factory.
+ * @param method description of the transform to be created, or {@code null} if unknown.
* @return the exception if the operation failed, or {@code null} if none. This exception is not thrown now
* because the caller may succeed in creating the transform anyway, or otherwise may produce a more
* informative exception.
@@ -861,9 +862,23 @@ public class DefaultMathTransformFactory
* @see #getCompletedParameters()
*/
@SuppressWarnings("null")
- final RuntimeException completeParameters(OperationMethod method, final ParameterValueGroup userParams)
- throws IllegalArgumentException
+ final RuntimeException completeParameters(final DefaultMathTransformFactory factory, OperationMethod method,
+ final ParameterValueGroup userParams) throws FactoryException, IllegalArgumentException
{
+ /*
+ * The "Geographic/geocentric conversions" conversion (EPSG:9602) can be either:
+ *
+ * - "Ellipsoid_To_Geocentric"
+ * - "Geocentric_To_Ellipsoid"
+ *
+ * EPSG defines both by a single operation, but Apache SIS needs to distinguish them.
+ */
+ if (method instanceof AbstractProvider) {
+ final String alt = ((AbstractProvider) method).resolveAmbiguity(this);
+ if (alt != null) {
+ method = factory.getOperationMethod(alt);
+ }
+ }
provider = method;
parameters = userParams;
/*
@@ -899,8 +914,8 @@ public class DefaultMathTransformFactory
if (targetEllipsoid != null) n |= 2;
}
/*
- * Set the ellipsoid axis-length parameter values. Those parameters may appear in the source
- * ellipsoid, in the target ellipsoid or in both ellipsoids.
+ * Set the ellipsoid axis-length parameter values. Those parameters may appear in the source ellipsoid,
+ * in the target ellipsoid or in both ellipsoids.
*/
switch (n) {
case 0: return null;
@@ -1023,7 +1038,7 @@ public class DefaultMathTransformFactory
* since the standard place where to provide this information is in the ellipsoid object.
*/
if (context != null) {
- failure = context.completeParameters(method, parameters);
+ failure = context.completeParameters(this, method, parameters);
parameters = context.parameters;
method = context.provider;
}
@@ -1051,8 +1066,10 @@ public class DefaultMathTransformFactory
lastMethod.set(method); // May be null in case of failure, which is intended.
if (context != null) {
context.provider = null;
- // For now we conservatively reset the provider information to null. But if we choose to make
- // that information public in a future SIS version, then we would remove this code.
+ /*
+ * For now we conservatively reset the provider information to null. But if we choose to
+ * make that information public in a future SIS version, then we would remove this code.
+ */
}
}
return transform;
@@ -1316,6 +1333,9 @@ public class DefaultMathTransformFactory
* Creates a math transform object from a
* <a href="http://www.geoapi.org/snapshot/javadoc/org/opengis/referencing/doc-files/WKT.html"><cite>Well
* Known Text</cite> (WKT)</a>.
+ * If the given text contains non-fatal anomalies (unknown or unsupported WKT elements,
+ * inconsistent unit definitions, <i>etc.</i>), warnings may be reported in a
+ * {@linkplain java.util.logging.Logger logger} named {@code "org.apache.sis.io.wkt"}.
*
* @param text math transform encoded in Well-Known Text format.
* @return the math transform (never {@code null}).
Modified: sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/provider/Geographic3Dto2DTest.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/provider/Geographic3Dto2DTest.java?rev=1794138&r1=1794137&r2=1794138&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/provider/Geographic3Dto2DTest.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/provider/Geographic3Dto2DTest.java [UTF-8] Sat May 6 13:00:50 2017
@@ -34,7 +34,7 @@ import static org.apache.sis.test.Assert
* Tests the {@link Geographic3Dto2D} class.
*
* @author Martin Desruisseaux (Geomatys)
- * @version 0.7
+ * @version 0.8
* @since 0.7
* @module
*/
@@ -69,6 +69,18 @@ public final strictfp class Geographic3D
}
/**
+ * Tests {@link Geographic3Dto2D#redimension(int, int)}.
+ */
+ @Test
+ public void testRedimension() {
+ final Geographic3Dto2D provider = new Geographic3Dto2D();
+ assertSame ("3 → 2", provider, provider.redimension(3, 2));
+ assertEquals("2 → 3", Geographic2Dto3D.class, provider.redimension(2, 3).getClass());
+ assertEquals("3 → 3", GeographicRedimension.class, provider.redimension(3, 3).getClass());
+ assertEquals("2 → 2", GeographicRedimension.class, provider.redimension(2, 2).getClass());
+ }
+
+ /**
* Creates a "Geographic 2D to 3D → Geocentric → Affine → Geographic → Geographic 3D to 2D" chain.
* This method is used for integration tests.
*
Modified: sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/provider/ProvidersTest.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/provider/ProvidersTest.java?rev=1794138&r1=1794137&r2=1794138&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/provider/ProvidersTest.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/provider/ProvidersTest.java [UTF-8] Sat May 6 13:00:50 2017
@@ -124,6 +124,8 @@ public final strictfp class ProvidersTes
PositionVector7Param3D.class,
GeocentricTranslation2D.class,
GeocentricTranslation3D.class,
+ Geographic3Dto2D.class,
+ Geographic2Dto3D.class,
Molodensky.class,
AbridgedMolodensky.class,
FranceGeocentricInterpolation.class
Modified: sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/CRSTest.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/CRSTest.java?rev=1794138&r1=1794137&r2=1794138&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/CRSTest.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/CRSTest.java [UTF-8] Sat May 6 13:00:50 2017
@@ -151,12 +151,12 @@ public final strictfp class CRSTest exte
}
/**
- * Tests {@link CRS#suggestTargetCRS(GeographicBoundingBox, CoordinateReferenceSystem...)}.
+ * Tests {@link CRS#suggestCommonTarget(GeographicBoundingBox, CoordinateReferenceSystem...)}.
*
* @since 0.8
*/
@Test
- public void testSuggestTargetCRS() {
+ public void testSuggestCommonTarget() {
/*
* Prepare 4 CRS with different datum (so we can more easily differentiate them in the assertions) and
* different domain of validity. CRS[1] is given a domain large enough for all CRS except the last one.
@@ -185,34 +185,34 @@ public final strictfp class CRSTest exte
* of validity large enough for all CRS; this is the second CRS created in above 'switch' statement.
*/
assertSame("Expected CRS with widest domain of validity.", crs[1],
- CRS.suggestTargetCRS(null, overlappingCRS));
+ CRS.suggestCommonTarget(null, overlappingCRS));
/*
* If we specify a smaller region of interest, we should get the CRS having the smallest domain of validity that
* cover the ROI. Following lines gradually increase the ROI size and verify that we get CRS for larger domain.
*/
final DefaultGeographicBoundingBox regionOfInterest = new DefaultGeographicBoundingBox(-1, +1, 2.1, 2.9);
assertSame("Expected best fit for [2.1 … 2.9]°N", crs[2],
- CRS.suggestTargetCRS(regionOfInterest, overlappingCRS));
+ CRS.suggestCommonTarget(regionOfInterest, overlappingCRS));
regionOfInterest.setNorthBoundLatitude(3.1);
assertSame("Expected best fit for [2.1 … 3.1]°N", crs[0],
- CRS.suggestTargetCRS(regionOfInterest, overlappingCRS));
+ CRS.suggestCommonTarget(regionOfInterest, overlappingCRS));
regionOfInterest.setSouthBoundLatitude(1.9);
assertSame("Expected best fit for [1.9 … 3.1]°N", crs[1],
- CRS.suggestTargetCRS(regionOfInterest, overlappingCRS));
+ CRS.suggestCommonTarget(regionOfInterest, overlappingCRS));
/*
* All above tests returned one of the CRS in the given array. Test now a case where none of those CRS
- * have a domain of validity wide enough, so suggestTargetCRS(…) need to search among the base CRS.
+ * have a domain of validity wide enough, so suggestCommonTarget(…) need to search among the base CRS.
*/
assertSame("Expected a GeodeticCRS since none of the ProjectedCRS have a domain of validity wide enough.",
- crs[0].getBaseCRS(), CRS.suggestTargetCRS(null, crs));
+ crs[0].getBaseCRS(), CRS.suggestCommonTarget(null, crs));
/*
- * With the same domain of validity than above, suggestTargetCRS(…) should not need to fallback on the
+ * With the same domain of validity than above, suggestCommonTarget(…) should not need to fallback on the
* base CRS anymore.
*/
assertSame("Expected best fit for [1.9 … 3.1]°N", crs[1],
- CRS.suggestTargetCRS(regionOfInterest, crs));
+ CRS.suggestCommonTarget(regionOfInterest, crs));
}
/**
Modified: sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/test/integration/ConsistencyTest.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/test/integration/ConsistencyTest.java?rev=1794138&r1=1794137&r2=1794138&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/test/integration/ConsistencyTest.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/test/integration/ConsistencyTest.java [UTF-8] Sat May 6 13:00:50 2017
@@ -35,6 +35,7 @@ import org.apache.sis.io.wkt.Unformattab
import org.apache.sis.util.ComparisonMode;
import org.apache.sis.util.CharSequences;
import org.apache.sis.util.Utilities;
+import org.apache.sis.test.DependsOn;
import org.apache.sis.test.TestCase;
import org.junit.Test;
@@ -57,13 +58,17 @@ import static org.junit.Assert.*;
* @since 0.7
* @module
*/
+@DependsOn({
+ org.apache.sis.referencing.CRSTest.class,
+ org.apache.sis.io.wkt.WKTFormatTest.class
+})
public final strictfp class ConsistencyTest extends TestCase {
/**
* Codes to exclude for now.
*/
private static final Set<String> EXCLUDES = new HashSet<>(Arrays.asList(
- "CRS:1", // Computer display
- "EPSG:5819" // EPSG topocentric example A
+ "CRS:1", // Computer display
+ "EPSG:5819" // EPSG topocentric example A
));
/**
Modified: sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/test/suite/ReferencingTestSuite.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/test/suite/ReferencingTestSuite.java?rev=1794138&r1=1794137&r2=1794138&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/test/suite/ReferencingTestSuite.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/test/suite/ReferencingTestSuite.java [UTF-8] Sat May 6 13:00:50 2017
@@ -202,6 +202,7 @@ import org.junit.BeforeClass;
org.apache.sis.referencing.AuthorityFactoriesTest.class,
org.apache.sis.referencing.cs.CodesTest.class,
org.apache.sis.referencing.CRSTest.class,
+ org.apache.sis.internal.referencing.DefinitionVerifierTest.class,
// Coordinate operation finders are last, since they need everything else.
org.apache.sis.referencing.operation.CoordinateOperationRegistryTest.class,
@@ -228,6 +229,7 @@ import org.junit.BeforeClass;
org.apache.sis.distance.LatLonPointRadiusTest.class, // Pending refactoring in a geometry package.
+ org.apache.sis.test.integration.CoordinateOperationTest.class,
org.apache.sis.test.integration.DatumShiftTest.class,
org.apache.sis.test.integration.MetadataTest.class,
org.apache.sis.test.integration.ConsistencyTest.class
Modified: sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/logging/WarningListener.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/logging/WarningListener.java?rev=1794138&r1=1794137&r2=1794138&view=diff
==============================================================================
--- sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/logging/WarningListener.java [UTF-8] (original)
+++ sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/logging/WarningListener.java [UTF-8] Sat May 6 13:00:50 2017
@@ -24,15 +24,16 @@ import java.util.logging.LogRecord;
/**
* Intercepts non-fatal error messages logged by {@link org.apache.sis.storage.DataStore} or other SIS objects.
* Warnings are encapsulated in {@link LogRecord} objects and logged at {@link Level#WARNING} if the emitter does not
- * have any registered any {@code WarningListener}. This listener allows applications to intercept warning records for:
+ * have registered any {@code WarningListener}. This listener allows applications to intercept warning records for
+ * displaying them in a dialog (or any other action that the application may choose) instead than logging them.
*
- * <ul>
- * <li>displaying the warning in a dialog or performing any other action that the application may choose,</li>
- * <li>reducing the amount of records to be logged.</li>
- * </ul>
- *
- * The difference between using this listener or configuring the logging {@link java.util.logging.Handler} is
- * that listeners allow to handle the warnings on a per-{@code DataStore} (or any other emitter) instance.
+ * <div class="note"><b>Comparison with alternative approaches:</b>
+ * it is also possible to listen to login events by registering a custom {@link java.util.logging.Handler} to the logger.
+ * But {@code Handler} instances are registered on a per-logger basis and receive all messages sent to that logger
+ * regardless their emitter. By contrast, {@code WarningListener} instances are registered on a per-{@code DataStore}
+ * basis (or any other emitter) and receive all messages sent by that emitter regardless the destination logger.
+ * The emitter is part of the information given to the {@link #warningOccured(Object, LogRecord)} method,
+ * in addition to the log record.</div>
*
* @author Martin Desruisseaux (Geomatys)
* @version 0.3
Modified: sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/logging/WarningListeners.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/logging/WarningListeners.java?rev=1794138&r1=1794137&r2=1794138&view=diff
==============================================================================
--- sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/logging/WarningListeners.java [UTF-8] (original)
+++ sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/logging/WarningListeners.java [UTF-8] Sat May 6 13:00:50 2017
@@ -32,15 +32,22 @@ import org.apache.sis.internal.util.Unmo
/**
* Holds a list of {@link WarningListener} instances and provides convenience methods for emitting warnings.
- * The convenience {@code warning(…)} methods can build {@code LogRecord} from an exception or from a string.
- *
- * <p>In the default implementation, all {@code warning(…)} methods delegate to {@link #warning(LogRecord)},
- * thus providing a single point that subclasses can override for intercepting all warnings.
- * The default behavior is:</p>
+ * This is a helper class for {@link org.apache.sis.storage.DataStore} implementations or for other services
+ * susceptible to emit warnings.
+ * Observers can {@linkplain #addWarningListener can add listeners} for being notified about warnings, and
+ * processes can invoke one of the {@code warning(…)} methods for emitting warnings. All warnings are given
+ * to the listeners as {@link LogRecord} instances (this allows localizable messages and additional information
+ * like {@linkplain LogRecord#getMillis() timestamp} and {@linkplain LogRecord#getThrown() stack trace}).
+ * This {@code WarningListeners} class provides convenience methods like {@link #warning(String, Exception)},
+ * which builds {@code LogRecord} from an exception or from a string, but all those {@code warning(…)} methods
+ * ultimately delegate to {@link #warning(LogRecord)}, thus providing a single point that subclasses can override.
+ * When a warning is emitted, the default behavior is:
*
* <ul>
* <li>If at least one {@link WarningListener} is registered,
* then all listeners are notified and the warning is <strong>not</strong> logged.
+ * <li>Otherwise if the value returned by {@link LogRecord#getLoggerName()} is non-null,
+ * then the warning will be logged to that named logger.</li>
* <li>Otherwise the warning is logged to the logger returned by {@link #getLogger()}.</li>
* </ul>
*
@@ -83,7 +90,8 @@ public class WarningListeners<S> impleme
/**
* Creates a new instance with initially no listener.
- * Warnings will be logger to the logger, unless at least one listener is registered.
+ * Warnings will be logger to the destination given by {@link #getLogger()},
+ * unless at least one listener is {@linkplain #addWarningListener registered}.
*
* @param source the declared source of warnings. This is not necessarily the real source,
* but this is the source that the implementor wants to declare as public API.
@@ -95,6 +103,8 @@ public class WarningListeners<S> impleme
/**
* Creates a new instance initialized with the same listeners than the given instance.
+ * This constructor is useful when a {@code DataStore} or other data producer needs to
+ * be duplicated for concurrency reasons.
*
* @param source the declared source of warnings. This is not necessarily the real source,
* but this is the source that the implementor wants to declare as public API.
@@ -120,19 +130,35 @@ public class WarningListeners<S> impleme
}
/**
- * Returns the logger where to send the warnings. The default implementation returns a logger for
- * the package name of the {@code source} object. Subclasses should override this method if they
- * can provide a fixed logger instance (typically a static final constant).
+ * Returns the logger where to send the warnings when no other destination is specified.
+ * This logger is used when:
+ *
+ * <ul>
+ * <li>no listener has been {@linkplain #addWarningListener registered}, and</li>
+ * <li>the {@code LogRecord} does not {@linkplain LogRecord#getLoggerName() specify a logger}.</li>
+ * </ul>
+ *
+ * The default implementation infers a logger name from the package name of the {@code source} object.
+ * Subclasses should override this method if they can provide a more determinist logger instance,
+ * typically from a static final constant.
*
- * @return the logger where to send the warnings when there is no registered listeners.
+ * @return the logger where to send the warnings when there is no other destination.
*/
public Logger getLogger() {
return Logging.getLogger(source.getClass());
}
/**
- * Reports a warning represented by the given log record. The default implementation notifies the listeners
- * if any, or logs the message to the logger returned by {@link #getLogger()} otherwise.
+ * Reports a warning represented by the given log record. The default implementation forwards
+ * the given record to <strong>one</strong> of the following destinations, in preference order:
+ *
+ * <ol>
+ * <li><code>{@linkplain WarningListener#warningOccured WarningListener.warningOccured}(source, record)</code>
+ * on all {@linkplain #addWarningListener registered listeners} it at least one such listener exists.</li>
+ * <li><code>{@linkplain Logging#getLogger(String) Logging.getLogger}(record.{@linkplain LogRecord#getLoggerName
+ * getLoggerName()}).{@linkplain Logger#log(LogRecord) log}(record)</code> if the logger name is non-null.</li>
+ * <li><code>{@linkplain #getLogger()}.{@linkplain Logger#log(LogRecord) log}(record)</code> otherwise.</li>
+ * </ol>
*
* @param record the warning as a log record.
*/
@@ -146,8 +172,14 @@ public class WarningListeners<S> impleme
listener.warningOccured(source, record);
}
} else {
- final Logger logger = getLogger();
- record.setLoggerName(logger.getName());
+ final String name = record.getLoggerName();
+ final Logger logger;
+ if (name != null) {
+ logger = Logging.getLogger(name);
+ } else {
+ logger = getLogger();
+ record.setLoggerName(logger.getName());
+ }
if (record instanceof QuietLogRecord) {
((QuietLogRecord) record).clearThrown();
}
Modified: sis/trunk/core/sis-utility/src/test/java/org/apache/sis/util/logging/EmptyWarningListeners.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/test/java/org/apache/sis/util/logging/EmptyWarningListeners.java?rev=1794138&r1=1794137&r2=1794138&view=diff
==============================================================================
--- sis/trunk/core/sis-utility/src/test/java/org/apache/sis/util/logging/EmptyWarningListeners.java [UTF-8] (original)
+++ sis/trunk/core/sis-utility/src/test/java/org/apache/sis/util/logging/EmptyWarningListeners.java [UTF-8] Sat May 6 13:00:50 2017
@@ -24,7 +24,7 @@ import org.apache.sis.util.resources.Err
/**
* A unmodifiable empty list of listeners. Calls to {@link #addWarningListener(WarningListener) addWarningListener(…)}
- * will throw {@link UnsupportedOperationException}. Since this listener list is empty, it doesn't need a source.
+ * will throw {@link UnsupportedOperationException}. Since this listener list is empty, it does not need a source.
*
* <p>This class is used in some modules like {@code sis-netcdf}, when a JUnit test is testing some low-level
* component where the real {@link WarningListeners} instance is not yet available.</p>
Modified: sis/trunk/pom.xml
URL: http://svn.apache.org/viewvc/sis/trunk/pom.xml?rev=1794138&r1=1794137&r2=1794138&view=diff
==============================================================================
--- sis/trunk/pom.xml (original)
+++ sis/trunk/pom.xml Sat May 6 13:00:50 2017
@@ -709,6 +709,10 @@ Apache SIS is a free software, Java lang
<module name="FileTabCharacter"/> <!-- No tab characters in the file. -->
<module name="NewlineAtEndOfFile"/> <!-- Newline at the end of each file. -->
<module name="TreeWalker">
+ <module name="RegexpSinglelineJava">
+ <property name="format" value="\s+$"/>
+ <property name="message" value="Trailing spaces not allowed."/>
+ </module>
<module name="NoLineWrap"/> <!-- Imports and package statements are not line-wrapped. -->
<module name="RedundantImport"/> <!-- No redundant import statements. -->
<module name="GenericWhitespace"/> <!-- Whitespace around the Generic tokens follow typical convention. -->
Modified: sis/trunk/src/main/javadoc/stylesheet.css
URL: http://svn.apache.org/viewvc/sis/trunk/src/main/javadoc/stylesheet.css?rev=1794138&r1=1794137&r2=1794138&view=diff
==============================================================================
--- sis/trunk/src/main/javadoc/stylesheet.css (original)
+++ sis/trunk/src/main/javadoc/stylesheet.css Sat May 6 13:00:50 2017
@@ -212,6 +212,28 @@ div.block center {
}
/*
+ * Output of {@preformat} inline tag.
+ */
+pre.code-sample {
+ margin-left: 40px;
+ margin-right: 40px;
+ margin-top: 12px;
+ margin-bottom: 12px;
+}
+
+td > pre.code-sample {
+ margin: 9px;
+}
+
+:not(td) > pre.code-sample {
+ padding: 9px;
+ border-style: solid;
+ border-width: 1px;
+ border-color: gray;
+ background-color: rgba(200, 200, 200, 0.1);
+}
+
+/*
* Miscellaneous.
*/
span.deprecated {
Modified: sis/trunk/storage/sis-earth-observation/src/main/java/org/apache/sis/storage/earthobservation/LandsatReader.java
URL: http://svn.apache.org/viewvc/sis/trunk/storage/sis-earth-observation/src/main/java/org/apache/sis/storage/earthobservation/LandsatReader.java?rev=1794138&r1=1794137&r2=1794138&view=diff
==============================================================================
--- sis/trunk/storage/sis-earth-observation/src/main/java/org/apache/sis/storage/earthobservation/LandsatReader.java [UTF-8] (original)
+++ sis/trunk/storage/sis-earth-observation/src/main/java/org/apache/sis/storage/earthobservation/LandsatReader.java [UTF-8] Sat May 6 13:00:50 2017
@@ -50,6 +50,7 @@ import org.apache.sis.metadata.iso.conte
import org.apache.sis.metadata.sql.MetadataStoreException;
import org.apache.sis.referencing.CRS;
import org.apache.sis.referencing.CommonCRS;
+import org.apache.sis.storage.DataStore;
import org.apache.sis.storage.DataStoreException;
import org.apache.sis.storage.DataStoreReferencingException;
import org.apache.sis.util.Characters;
@@ -220,7 +221,7 @@ final class LandsatReader {
/**
* Where to send the warnings.
*/
- private final WarningListeners<?> listeners;
+ private final WarningListeners<DataStore> listeners;
/**
* Group in process of being parsed, or {@code null} if none.
@@ -297,7 +298,7 @@ final class LandsatReader {
* @param filename an identifier of the file being read, or {@code null} if unknown.
* @param listeners where to sent warnings that may occur during the parsing process.
*/
- LandsatReader(final String filename, final WarningListeners<?> listeners) {
+ LandsatReader(final String filename, final WarningListeners<DataStore> listeners) {
this.filename = filename;
this.listeners = listeners;
this.metadata = new MetadataBuilder();
Modified: sis/trunk/storage/sis-earth-observation/src/test/java/org/apache/sis/storage/earthobservation/LandsatReaderTest.java
URL: http://svn.apache.org/viewvc/sis/trunk/storage/sis-earth-observation/src/test/java/org/apache/sis/storage/earthobservation/LandsatReaderTest.java?rev=1794138&r1=1794137&r2=1794138&view=diff
==============================================================================
--- sis/trunk/storage/sis-earth-observation/src/test/java/org/apache/sis/storage/earthobservation/LandsatReaderTest.java [UTF-8] (original)
+++ sis/trunk/storage/sis-earth-observation/src/test/java/org/apache/sis/storage/earthobservation/LandsatReaderTest.java [UTF-8] Sat May 6 13:00:50 2017
@@ -24,6 +24,7 @@ import java.io.InputStreamReader;
import org.opengis.metadata.Metadata;
import org.opengis.util.FactoryException;
import org.apache.sis.metadata.iso.DefaultMetadata;
+import org.apache.sis.storage.DataStore;
import org.apache.sis.storage.DataStoreException;
import org.apache.sis.util.logging.EmptyWarningListeners;
import org.apache.sis.internal.system.Modules;
@@ -87,7 +88,7 @@ public class LandsatReaderTest extends T
LandsatReaderTest.class.getResourceAsStream("LandsatTest.txt"), "UTF-8")))
{
final LandsatReader reader = new LandsatReader("LandsatTest.txt",
- new EmptyWarningListeners<>(Locale.ENGLISH, Modules.EARTH_OBSERVATION));
+ new EmptyWarningListeners<DataStore>(Locale.ENGLISH, Modules.EARTH_OBSERVATION));
reader.read(in);
actual = reader.getMetadata();
}
@@ -96,36 +97,29 @@ public class LandsatReaderTest extends T
"Metadata\n"
+ " ├─Spatial representation info (1 of 2)\n"
+ " │ ├─Number of dimensions………………………………………………… 2\n"
- + " │ ├─Axis dimension properties (1 of 2)\n"
- + " │ │ ├─Dimension name……………………………………………………… Sample\n"
+ + " │ ├─Axis dimension properties (1 of 2)…………… Sample\n"
+ " │ │ └─Dimension size……………………………………………………… 15000\n"
- + " │ ├─Axis dimension properties (2 of 2)\n"
- + " │ │ ├─Dimension name……………………………………………………… Line\n"
+ + " │ ├─Axis dimension properties (2 of 2)…………… Line\n"
+ " │ │ └─Dimension size……………………………………………………… 15500\n"
+ " │ ├─Transformation parameter availability…… false\n"
+ " │ └─Check point availability……………………………………… false\n"
+ " ├─Spatial representation info (2 of 2)\n"
+ " │ ├─Number of dimensions………………………………………………… 2\n"
- + " │ ├─Axis dimension properties (1 of 2)\n"
- + " │ │ ├─Dimension name……………………………………………………… Sample\n"
+ + " │ ├─Axis dimension properties (1 of 2)…………… Sample\n"
+ " │ │ └─Dimension size……………………………………………………… 7600\n"
- + " │ ├─Axis dimension properties (2 of 2)\n"
- + " │ │ ├─Dimension name……………………………………………………… Line\n"
+ + " │ ├─Axis dimension properties (2 of 2)…………… Line\n"
+ " │ │ └─Dimension size……………………………………………………… 7800\n"
+ " │ ├─Transformation parameter availability…… false\n"
+ " │ └─Check point availability……………………………………… false\n"
+ " ├─Reference system info………………………………………………………… EPSG:WGS 84 / UTM zone 49N\n"
+ " ├─Identification info\n"
+ " │ ├─Citation\n"
- + " │ │ ├─Date\n"
- + " │ │ │ ├─Date……………………………………………………………………… 2016-06-27 16:48:12\n"
+ + " │ │ ├─Date………………………………………………………………………………… 2016-06-27 16:48:12\n"
+ " │ │ │ └─Date type………………………………………………………… Creation\n"
- + " │ │ └─Identifier\n"
- + " │ │ └─Code……………………………………………………………………… LandsatTest\n"
+ + " │ │ └─Identifier………………………………………………………………… LandsatTest\n"
+ " │ ├─Credit……………………………………………………………………………………… Derived from U.S. Geological Survey data\n"
+ " │ ├─Resource format\n"
- + " │ │ └─Format specification citation\n"
- + " │ │ ├─Title…………………………………………………………………… GeoTIFF Coverage Encoding Profile\n"
+ + " │ │ └─Format specification citation……………… GeoTIFF Coverage Encoding Profile\n"
+ " │ │ └─Alternate title………………………………………… GeoTIFF\n"
+ " │ ├─Spatial resolution (1 of 2)\n"
+ " │ │ └─Distance……………………………………………………………………… 15.0\n"
@@ -153,8 +147,7 @@ public class LandsatReaderTest extends T
+ " │ │ │ ├─Transfer function type……………………… Linear\n"
+ " │ │ │ ├─Bound units…………………………………………………… nm\n"
+ " │ │ │ ├─Description…………………………………………………… Coastal Aerosol\n"
- + " │ │ │ └─Name\n"
- + " │ │ │ └─Code…………………………………………………………… TestImage_B1.TIF\n"
+ + " │ │ │ └─Name……………………………………………………………………… TestImage_B1.TIF\n"
+ " │ │ ├─Attribute (2 of 8)\n"
+ " │ │ │ ├─Max value………………………………………………………… 65535.0\n"
+ " │ │ │ ├─Min value………………………………………………………… 1.0\n"
@@ -164,8 +157,7 @@ public class LandsatReaderTest extends T
+ " │ │ │ ├─Transfer function type……………………… Linear\n"
+ " │ │ │ ├─Bound units…………………………………………………… nm\n"
+ " │ │ │ ├─Description…………………………………………………… Blue\n"
- + " │ │ │ └─Name\n"
- + " │ │ │ └─Code…………………………………………………………… TestImage_B2.TIF\n"
+ + " │ │ │ └─Name……………………………………………………………………… TestImage_B2.TIF\n"
+ " │ │ ├─Attribute (3 of 8)\n"
+ " │ │ │ ├─Max value………………………………………………………… 65535.0\n"
+ " │ │ │ ├─Min value………………………………………………………… 1.0\n"
@@ -175,8 +167,7 @@ public class LandsatReaderTest extends T
+ " │ │ │ ├─Transfer function type……………………… Linear\n"
+ " │ │ │ ├─Bound units…………………………………………………… nm\n"
+ " │ │ │ ├─Description…………………………………………………… Green\n"
- + " │ │ │ └─Name\n"
- + " │ │ │ └─Code…………………………………………………………… TestImage_B3.TIF\n"
+ + " │ │ │ └─Name……………………………………………………………………… TestImage_B3.TIF\n"
+ " │ │ ├─Attribute (4 of 8)\n"
+ " │ │ │ ├─Max value………………………………………………………… 65535.0\n"
+ " │ │ │ ├─Min value………………………………………………………… 1.0\n"
@@ -186,8 +177,7 @@ public class LandsatReaderTest extends T
+ " │ │ │ ├─Transfer function type……………………… Linear\n"
+ " │ │ │ ├─Bound units…………………………………………………… nm\n"
+ " │ │ │ ├─Description…………………………………………………… Red\n"
- + " │ │ │ └─Name\n"
- + " │ │ │ └─Code…………………………………………………………… TestImage_B4.TIF\n"
+ + " │ │ │ └─Name……………………………………………………………………… TestImage_B4.TIF\n"
+ " │ │ ├─Attribute (5 of 8)\n"
+ " │ │ │ ├─Max value………………………………………………………… 65535.0\n"
+ " │ │ │ ├─Min value………………………………………………………… 1.0\n"
@@ -197,8 +187,7 @@ public class LandsatReaderTest extends T
+ " │ │ │ ├─Transfer function type……………………… Linear\n"
+ " │ │ │ ├─Bound units…………………………………………………… nm\n"
+ " │ │ │ ├─Description…………………………………………………… Near-Infrared\n"
- + " │ │ │ └─Name\n"
- + " │ │ │ └─Code…………………………………………………………… TestImage_B5.TIF\n"
+ + " │ │ │ └─Name……………………………………………………………………… TestImage_B5.TIF\n"
+ " │ │ ├─Attribute (6 of 8)\n"
+ " │ │ │ ├─Max value………………………………………………………… 65535.0\n"
+ " │ │ │ ├─Min value………………………………………………………… 1.0\n"
@@ -208,8 +197,7 @@ public class LandsatReaderTest extends T
+ " │ │ │ ├─Transfer function type……………………… Linear\n"
+ " │ │ │ ├─Bound units…………………………………………………… nm\n"
+ " │ │ │ ├─Description…………………………………………………… Short Wavelength Infrared (SWIR) 1\n"
- + " │ │ │ └─Name\n"
- + " │ │ │ └─Code…………………………………………………………… TestImage_B6.TIF\n"
+ + " │ │ │ └─Name……………………………………………………………………… TestImage_B6.TIF\n"
+ " │ │ ├─Attribute (7 of 8)\n"
+ " │ │ │ ├─Max value………………………………………………………… 65535.0\n"
+ " │ │ │ ├─Min value………………………………………………………… 1.0\n"
@@ -219,8 +207,7 @@ public class LandsatReaderTest extends T
+ " │ │ │ ├─Transfer function type……………………… Linear\n"
+ " │ │ │ ├─Bound units…………………………………………………… nm\n"
+ " │ │ │ ├─Description…………………………………………………… Short Wavelength Infrared (SWIR) 2\n"
- + " │ │ │ └─Name\n"
- + " │ │ │ └─Code…………………………………………………………… TestImage_B7.TIF\n"
+ + " │ │ │ └─Name……………………………………………………………………… TestImage_B7.TIF\n"
+ " │ │ └─Attribute (8 of 8)\n"
+ " │ │ ├─Max value………………………………………………………… 65535.0\n"
+ " │ │ ├─Min value………………………………………………………… 1.0\n"
@@ -230,8 +217,7 @@ public class LandsatReaderTest extends T
+ " │ │ ├─Transfer function type……………………… Linear\n"
+ " │ │ ├─Bound units…………………………………………………… nm\n"
+ " │ │ ├─Description…………………………………………………… Cirrus\n"
- + " │ │ └─Name\n"
- + " │ │ └─Code…………………………………………………………… TestImage_B9.TIF\n"
+ + " │ │ └─Name……………………………………………………………………… TestImage_B9.TIF\n"
+ " │ ├─Attribute group (2 of 3)\n"
+ " │ │ ├─Content type…………………………………………………………… Physical measurement\n"
+ " │ │ └─Attribute\n"
@@ -243,8 +229,7 @@ public class LandsatReaderTest extends T
+ " │ │ ├─Transfer function type……………………… Linear\n"
+ " │ │ ├─Bound units…………………………………………………… nm\n"
+ " │ │ ├─Description…………………………………………………… Panchromatic\n"
- + " │ │ └─Name\n"
- + " │ │ └─Code…………………………………………………………… TestImage_B8.TIF\n"
+ + " │ │ └─Name……………………………………………………………………… TestImage_B8.TIF\n"
+ " │ └─Attribute group (3 of 3)\n"
+ " │ ├─Content type…………………………………………………………… Physical measurement\n"
+ " │ ├─Attribute (1 of 2)\n"
@@ -256,8 +241,7 @@ public class LandsatReaderTest extends T
+ " │ │ ├─Transfer function type……………………… Linear\n"
+ " │ │ ├─Bound units…………………………………………………… nm\n"
+ " │ │ ├─Description…………………………………………………… Thermal Infrared Sensor (TIRS) 1\n"
- + " │ │ └─Name\n"
- + " │ │ └─Code…………………………………………………………… TestImage_B10.TIF\n"
+ + " │ │ └─Name……………………………………………………………………… TestImage_B10.TIF\n"
+ " │ └─Attribute (2 of 2)\n"
+ " │ ├─Max value………………………………………………………… 65535.0\n"
+ " │ ├─Min value………………………………………………………… 1.0\n"
@@ -267,12 +251,10 @@ public class LandsatReaderTest extends T
+ " │ ├─Transfer function type……………………… Linear\n"
+ " │ ├─Bound units…………………………………………………… nm\n"
+ " │ ├─Description…………………………………………………… Thermal Infrared Sensor (TIRS) 2\n"
- + " │ └─Name\n"
- + " │ └─Code…………………………………………………………… TestImage_B11.TIF\n"
+ + " │ └─Name……………………………………………………………………… TestImage_B11.TIF\n"
+ " ├─Acquisition information\n"
+ " │ ├─Acquisition requirement\n"
- + " │ │ └─Identifier\n"
- + " │ │ └─Code……………………………………………………………………… Software unit tests\n"
+ + " │ │ └─Identifier………………………………………………………………… Software unit tests\n"
+ " │ ├─Operation\n"
+ " │ │ ├─Status…………………………………………………………………………… Completed\n"
+ " │ │ ├─Type………………………………………………………………………………… Real\n"
@@ -280,38 +262,28 @@ public class LandsatReaderTest extends T
+ " │ │ ├─Context……………………………………………………………… Acquisition\n"
+ " │ │ └─Time……………………………………………………………………… 2016-06-26 03:02:01\n"
+ " │ └─Platform\n"
- + " │ ├─Identifier\n"
- + " │ │ └─Code……………………………………………………………………… Pseudo LANDSAT\n"
+ + " │ ├─Identifier………………………………………………………………… Pseudo LANDSAT\n"
+ " │ └─Instrument\n"
- + " │ └─Identifier\n"
- + " │ └─Code…………………………………………………………… Pseudo TIRS\n"
- + " ├─Date info\n"
- + " │ ├─Date…………………………………………………………………………………………… 2016-06-27 16:48:12\n"
+ + " │ └─Identifier……………………………………………………… Pseudo TIRS\n"
+ + " ├─Date info………………………………………………………………………………………… 2016-06-27 16:48:12\n"
+ " │ └─Date type……………………………………………………………………………… Creation\n"
+ " ├─Default locale+other locale………………………………………… en\n"
+ " ├─Metadata scope\n"
+ " │ └─Resource scope………………………………………………………………… COVERAGE\n"
- + " ├─Metadata identifier\n"
- + " │ └─Code…………………………………………………………………………………………… LandsatTest\n"
- + " ├─Metadata standard (1 of 2)\n"
- + " │ ├─Title………………………………………………………………………………………… Geographic Information — Metadata Part 1: Fundamentals\n"
+ + " ├─Metadata identifier……………………………………………………………… LandsatTest\n"
+ + " ├─Metadata standard (1 of 2)…………………………………………… Geographic Information — Metadata Part 1: Fundamentals\n"
+ " │ ├─Edition…………………………………………………………………………………… ISO 19115-1:2014(E)\n"
- + " │ ├─Identifier\n"
- + " │ │ └─Code………………………………………………………………………………… 19115-1\n"
+ + " │ ├─Identifier…………………………………………………………………………… 19115-1\n"
+ " │ ├─Cited responsible party\n"
+ " │ │ ├─Role………………………………………………………………………………… Principal investigator\n"
- + " │ │ └─Party\n"
- + " │ │ └─Name……………………………………………………………………… International Organization for Standardization\n"
+ + " │ │ └─Party……………………………………………………………………………… International Organization for Standardization\n"
+ " │ └─Presentation form………………………………………………………… Document digital\n"
- + " └─Metadata standard (2 of 2)\n"
- + " ├─Title………………………………………………………………………………………… Geographic Information — Metadata Part 2: Extensions for imagery and gridded data\n"
+ + " └─Metadata standard (2 of 2)…………………………………………… Geographic Information — Metadata Part 2: Extensions for imagery and gridded data\n"
+ " ├─Edition…………………………………………………………………………………… ISO 19115-2:2009(E)\n"
- + " ├─Identifier\n"
- + " │ └─Code………………………………………………………………………………… 19115-2\n"
+ + " ├─Identifier…………………………………………………………………………… 19115-2\n"
+ " ├─Cited responsible party\n"
+ " │ ├─Role………………………………………………………………………………… Principal investigator\n"
- + " │ └─Party\n"
- + " │ └─Name……………………………………………………………………… International Organization for Standardization\n"
+ + " │ └─Party……………………………………………………………………………… International Organization for Standardization\n"
+ " └─Presentation form………………………………………………………… Document digital\n", text);
}
}
Modified: sis/trunk/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/Decoder.java
URL: http://svn.apache.org/viewvc/sis/trunk/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/Decoder.java?rev=1794138&r1=1794137&r2=1794138&view=diff
==============================================================================
--- sis/trunk/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/Decoder.java [UTF-8] (original)
+++ sis/trunk/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/Decoder.java [UTF-8] Sat May 6 13:00:50 2017
@@ -23,6 +23,7 @@ import java.io.IOException;
import javax.measure.Unit;
import javax.measure.format.ParserException;
import org.apache.sis.measure.Units;
+import org.apache.sis.storage.DataStore;
import org.apache.sis.storage.DataStoreException;
import org.apache.sis.util.logging.WarningListeners;
@@ -42,7 +43,7 @@ public abstract class Decoder implements
/**
* Where to send the warnings.
*/
- public final WarningListeners<?> listeners;
+ public final WarningListeners<DataStore> listeners;
/**
* Sets to {@code true} for canceling a reading process.
@@ -55,7 +56,7 @@ public abstract class Decoder implements
*
* @param listeners where to send the warnings.
*/
- protected Decoder(final WarningListeners<?> listeners) {
+ protected Decoder(final WarningListeners<DataStore> listeners) {
Objects.requireNonNull(listeners);
this.listeners = listeners;
}
Modified: sis/trunk/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/impl/ChannelDecoder.java
URL: http://svn.apache.org/viewvc/sis/trunk/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/impl/ChannelDecoder.java?rev=1794138&r1=1794137&r2=1794138&view=diff
==============================================================================
--- sis/trunk/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/impl/ChannelDecoder.java [UTF-8] (original)
+++ sis/trunk/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/impl/ChannelDecoder.java [UTF-8] Sat May 6 13:00:50 2017
@@ -45,6 +45,7 @@ import org.apache.sis.internal.netcdf.Re
import org.apache.sis.internal.storage.io.ChannelDataInput;
import org.apache.sis.internal.util.CollectionsExt;
import org.apache.sis.internal.util.StandardDateFormat;
+import org.apache.sis.storage.DataStore;
import org.apache.sis.storage.DataStoreException;
import org.apache.sis.storage.DataStoreContentException;
import org.apache.sis.util.iso.DefaultNameSpace;
@@ -223,7 +224,7 @@ public final class ChannelDecoder extend
* @throws IOException if an error occurred while reading the channel.
* @throws DataStoreException if the content of the given channel is not a NetCDF file.
*/
- public ChannelDecoder(final WarningListeners<?> listeners, final ChannelDataInput input)
+ public ChannelDecoder(final WarningListeners<DataStore> listeners, final ChannelDataInput input)
throws IOException, DataStoreException
{
super(listeners);
Modified: sis/trunk/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/ucar/DecoderWrapper.java
URL: http://svn.apache.org/viewvc/sis/trunk/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/ucar/DecoderWrapper.java?rev=1794138&r1=1794137&r2=1794138&view=diff
==============================================================================
--- sis/trunk/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/ucar/DecoderWrapper.java [UTF-8] (original)
+++ sis/trunk/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/ucar/DecoderWrapper.java [UTF-8] Sat May 6 13:00:50 2017
@@ -43,6 +43,7 @@ import org.apache.sis.internal.netcdf.De
import org.apache.sis.internal.netcdf.Variable;
import org.apache.sis.internal.netcdf.GridGeometry;
import org.apache.sis.internal.netcdf.DiscreteSampling;
+import org.apache.sis.storage.DataStore;
/**
@@ -100,7 +101,7 @@ public final class DecoderWrapper extend
* @param listeners where to send the warnings.
* @param file the NetCDF file from which to read data.
*/
- public DecoderWrapper(final WarningListeners<?> listeners, final NetcdfFile file) {
+ public DecoderWrapper(final WarningListeners<DataStore> listeners, final NetcdfFile file) {
super(listeners);
this.file = file;
}
@@ -113,7 +114,7 @@ public final class DecoderWrapper extend
* @throws IOException if an error occurred while opening the NetCDF file.
*/
@SuppressWarnings("ThisEscapedInObjectConstruction")
- public DecoderWrapper(final WarningListeners<?> listeners, final String filename) throws IOException {
+ public DecoderWrapper(final WarningListeners<DataStore> listeners, final String filename) throws IOException {
super(listeners);
file = NetcdfDataset.openDataset(filename, false, this);
}
Modified: sis/trunk/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/ucar/LogAdapter.java
URL: http://svn.apache.org/viewvc/sis/trunk/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/ucar/LogAdapter.java?rev=1794138&r1=1794137&r2=1794138&view=diff
==============================================================================
--- sis/trunk/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/ucar/LogAdapter.java [UTF-8] (original)
+++ sis/trunk/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/ucar/LogAdapter.java [UTF-8] Sat May 6 13:00:50 2017
@@ -16,6 +16,7 @@
*/
package org.apache.sis.internal.netcdf.ucar;
+import org.apache.sis.storage.DataStore;
import org.apache.sis.util.CharSequences;
import org.apache.sis.util.logging.WarningListeners;
@@ -40,12 +41,12 @@ final class LogAdapter implements Append
/**
* Where to sends the warning messages.
*/
- private final WarningListeners<?> listeners;
+ private final WarningListeners<DataStore> listeners;
/**
* Creates a new adapter which will send lines to the given listeners.
*/
- LogAdapter(final WarningListeners<?> listeners) {
+ LogAdapter(final WarningListeners<DataStore> listeners) {
this.listeners = listeners;
}
Modified: sis/trunk/storage/sis-netcdf/src/main/java/org/apache/sis/storage/netcdf/NetcdfStoreProvider.java
URL: http://svn.apache.org/viewvc/sis/trunk/storage/sis-netcdf/src/main/java/org/apache/sis/storage/netcdf/NetcdfStoreProvider.java?rev=1794138&r1=1794137&r2=1794138&view=diff
==============================================================================
--- sis/trunk/storage/sis-netcdf/src/main/java/org/apache/sis/storage/netcdf/NetcdfStoreProvider.java [UTF-8] (original)
+++ sis/trunk/storage/sis-netcdf/src/main/java/org/apache/sis/storage/netcdf/NetcdfStoreProvider.java [UTF-8] Sat May 6 13:00:50 2017
@@ -237,7 +237,7 @@ public class NetcdfStoreProvider extends
* @throws IOException if an error occurred while opening the NetCDF file.
* @throws DataStoreException if a logical error (other than I/O) occurred.
*/
- static Decoder decoder(final WarningListeners<?> listeners, final StorageConnector storage)
+ static Decoder decoder(final WarningListeners<DataStore> listeners, final StorageConnector storage)
throws IOException, DataStoreException
{
Decoder decoder;
@@ -276,7 +276,7 @@ public class NetcdfStoreProvider extends
* @throws IOException if an error occurred while opening the NetCDF file.
* @throws DataStoreException if a logical error (other than I/O) occurred.
*/
- private static Decoder createByReflection(final WarningListeners<?> listeners, final Object input, final boolean isUCAR)
+ private static Decoder createByReflection(final WarningListeners<DataStore> listeners, final Object input, final boolean isUCAR)
throws IOException, DataStoreException
{
ensureInitialized(true);
Modified: sis/trunk/storage/sis-netcdf/src/test/java/org/apache/sis/internal/netcdf/TestCase.java
URL: http://svn.apache.org/viewvc/sis/trunk/storage/sis-netcdf/src/test/java/org/apache/sis/internal/netcdf/TestCase.java?rev=1794138&r1=1794137&r2=1794138&view=diff
==============================================================================
--- sis/trunk/storage/sis-netcdf/src/test/java/org/apache/sis/internal/netcdf/TestCase.java [UTF-8] (original)
+++ sis/trunk/storage/sis-netcdf/src/test/java/org/apache/sis/internal/netcdf/TestCase.java [UTF-8] Sat May 6 13:00:50 2017
@@ -22,6 +22,7 @@ import java.util.HashMap;
import java.util.Iterator;
import java.io.IOException;
import java.lang.reflect.UndeclaredThrowableException;
+import org.apache.sis.storage.DataStore;
import org.apache.sis.storage.DataStoreException;
import org.apache.sis.util.logging.EmptyWarningListeners;
import org.apache.sis.internal.netcdf.ucar.DecoderWrapper;
@@ -46,7 +47,7 @@ public abstract strictfp class TestCase
/**
* A dummy list of listeners which can be given to the {@link Decoder} constructor.
*/
- public static EmptyWarningListeners<Decoder> LISTENERS = new EmptyWarningListeners<>(null, Modules.NETCDF);
+ public static EmptyWarningListeners<DataStore> LISTENERS = new EmptyWarningListeners<>(null, Modules.NETCDF);
/**
* The {@code searchPath} argument value to be given to the {@link Decoder#setSearchPath(String[])}