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/07/09 15:31:01 UTC
svn commit: r1690101 [2/3] - in /sis/branches/JDK7: ./
core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/
core/sis-metadata/src/main/java/org/apache/sis/io/wkt/
core/sis-metadata/src/main/java/org/apache/sis/metadata/
core/sis-metadata/s...
Modified: sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/spatial/DefaultGridSpatialRepresentation.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/spatial/DefaultGridSpatialRepresentation.java?rev=1690101&r1=1690100&r2=1690101&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/spatial/DefaultGridSpatialRepresentation.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/spatial/DefaultGridSpatialRepresentation.java [UTF-8] Thu Jul 9 13:31:00 2015
@@ -28,7 +28,7 @@ import org.opengis.metadata.spatial.Geor
import org.opengis.metadata.spatial.GridSpatialRepresentation;
import org.apache.sis.measure.ValueRange;
-import static org.apache.sis.internal.metadata.MetadataUtilities.warnNonPositiveArgument;
+import static org.apache.sis.internal.metadata.MetadataUtilities.ensurePositive;
/**
@@ -195,10 +195,9 @@ public class DefaultGridSpatialRepresent
*/
public void setNumberOfDimensions(final Integer newValue) {
checkWritePermission();
- if (newValue != null && newValue < 0) {
- warnNonPositiveArgument(DefaultGridSpatialRepresentation.class, "numberOfDimensions", false, newValue);
+ if (ensurePositive(DefaultGridSpatialRepresentation.class, "numberOfDimensions", false, newValue)) {
+ numberOfDimensions = newValue;
}
- numberOfDimensions = newValue;
}
/**
Modified: sis/branches/JDK7/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/AllMetadataTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/AllMetadataTest.java?rev=1690101&r1=1690100&r2=1690101&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/AllMetadataTest.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/AllMetadataTest.java [UTF-8] Thu Jul 9 13:31:00 2015
@@ -21,8 +21,10 @@ import java.lang.reflect.Modifier;
import org.opengis.util.Enumerated;
import org.opengis.annotation.UML;
import org.opengis.annotation.Specification;
+import org.apache.sis.internal.jaxb.Context;
import org.apache.sis.metadata.MetadataStandard;
import org.apache.sis.metadata.MetadataTestCase;
+import org.apache.sis.test.LoggingWatcher;
import org.apache.sis.test.DependsOn;
import org.apache.sis.xml.Namespaces;
import org.junit.Rule;
@@ -47,7 +49,7 @@ public final strictfp class AllMetadataT
* details (it should have been a private field).
*/
@Rule
- public final LoggingWatcher listener = new LoggingWatcher();
+ public final LoggingWatcher listener = new LoggingWatcher(Context.LOGGER);
/**
* Creates a new test case with all GeoAPI interfaces and code lists to test.
Modified: sis/branches/JDK7/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/identification/DefaultResolutionTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/identification/DefaultResolutionTest.java?rev=1690101&r1=1690100&r2=1690101&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/identification/DefaultResolutionTest.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/identification/DefaultResolutionTest.java [UTF-8] Thu Jul 9 13:31:00 2015
@@ -20,8 +20,9 @@ import javax.xml.bind.JAXBException;
import org.opengis.metadata.identification.RepresentativeFraction;
import org.apache.sis.xml.XML;
import org.apache.sis.xml.Namespaces;
-import org.apache.sis.metadata.iso.LoggingWatcher;
+import org.apache.sis.internal.jaxb.Context;
import org.apache.sis.internal.jaxb.Schemas;
+import org.apache.sis.test.LoggingWatcher;
import org.apache.sis.test.DependsOn;
import org.apache.sis.test.TestCase;
import org.junit.Rule;
@@ -46,7 +47,7 @@ public final strictfp class DefaultResol
* details (it should have been a private field).
*/
@Rule
- public final LoggingWatcher listener = new LoggingWatcher() {
+ public final LoggingWatcher listener = new LoggingWatcher(Context.LOGGER) {
/**
* Ensures that the logging message contains the name of the exclusive properties.
*/
Modified: sis/branches/JDK7/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/maintenance/DefaultScopeDescriptionTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/maintenance/DefaultScopeDescriptionTest.java?rev=1690101&r1=1690100&r2=1690101&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/maintenance/DefaultScopeDescriptionTest.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/maintenance/DefaultScopeDescriptionTest.java [UTF-8] Thu Jul 9 13:31:00 2015
@@ -16,8 +16,9 @@
*/
package org.apache.sis.metadata.iso.maintenance;
-import org.apache.sis.metadata.iso.LoggingWatcher;
import org.apache.sis.util.iso.SimpleInternationalString;
+import org.apache.sis.internal.jaxb.Context;
+import org.apache.sis.test.LoggingWatcher;
import org.apache.sis.test.TestCase;
import org.junit.Rule;
import org.junit.Test;
@@ -40,7 +41,7 @@ public final strictfp class DefaultScope
* details (it should have been a private field).
*/
@Rule
- public final LoggingWatcher listener = new LoggingWatcher() {
+ public final LoggingWatcher listener = new LoggingWatcher(Context.LOGGER) {
/**
* Ensures that the logging message contains the name of the exclusive properties.
*/
Modified: sis/branches/JDK7/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/spatial/DefaultGeorectifiedTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/spatial/DefaultGeorectifiedTest.java?rev=1690101&r1=1690100&r2=1690101&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/spatial/DefaultGeorectifiedTest.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/spatial/DefaultGeorectifiedTest.java [UTF-8] Thu Jul 9 13:31:00 2015
@@ -18,7 +18,8 @@ package org.apache.sis.metadata.iso.spat
import org.opengis.util.InternationalString;
import org.apache.sis.util.iso.SimpleInternationalString;
-import org.apache.sis.metadata.iso.LoggingWatcher;
+import org.apache.sis.internal.jaxb.Context;
+import org.apache.sis.test.LoggingWatcher;
import org.apache.sis.test.TestCase;
import org.junit.Rule;
import org.junit.Test;
@@ -41,7 +42,7 @@ public final strictfp class DefaultGeore
* details (it should have been a private field).
*/
@Rule
- public final LoggingWatcher listener = new LoggingWatcher() {
+ public final LoggingWatcher listener = new LoggingWatcher(Context.LOGGER) {
/**
* Ensures that the logging message contains the name of the exclusive properties.
*/
Modified: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/geometry/Envelopes.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/geometry/Envelopes.java?rev=1690101&r1=1690100&r2=1690101&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/geometry/Envelopes.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/geometry/Envelopes.java [UTF-8] Thu Jul 9 13:31:00 2015
@@ -45,6 +45,7 @@ import org.apache.sis.referencing.operat
import org.apache.sis.internal.referencing.DirectPositionView;
import org.apache.sis.internal.referencing.Formulas;
import org.apache.sis.internal.system.DefaultFactories;
+import org.apache.sis.internal.system.Loggers;
import static org.apache.sis.util.ArgumentChecks.ensureNonNull;
import static org.apache.sis.util.StringBuilders.trimFractionalPart;
@@ -123,7 +124,7 @@ public final class Envelopes extends Sta
* that they can be silently ignored in most cases.
*/
private static void recoverableException(final TransformException exception) {
- Logging.recoverableException(Envelopes.class, "transform", exception);
+ Logging.recoverableException(Logging.getLogger(Loggers.GEOMETRY), Envelopes.class, "transform", exception);
}
/**
Modified: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/jaxb/referencing/SecondDefiningParameter.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/jaxb/referencing/SecondDefiningParameter.java?rev=1690101&r1=1690100&r2=1690101&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/jaxb/referencing/SecondDefiningParameter.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/jaxb/referencing/SecondDefiningParameter.java [UTF-8] Thu Jul 9 13:31:00 2015
@@ -23,7 +23,6 @@ import org.opengis.referencing.datum.Ell
import org.apache.sis.xml.Namespaces;
import org.apache.sis.internal.jaxb.Context;
import org.apache.sis.internal.jaxb.gco.Measure;
-import org.apache.sis.internal.referencing.ReferencingUtilities;
import org.apache.sis.util.resources.Errors;
@@ -132,8 +131,7 @@ public final class SecondDefiningParamet
*/
public void setInverseFlattening(final Measure measure) {
if (measure.setUnit(Unit.ONE)) {
- Context.warningOccured(Context.current(), ReferencingUtilities.LOGGER,
- SecondDefiningParameter.class, "setInverseFlattening",
+ Context.warningOccured(Context.current(), SecondDefiningParameter.class, "setInverseFlattening",
Errors.class, Errors.Keys.IncompatiblePropertyValue_1, "uom");
}
this.measure = measure;
Modified: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/ReferencingUtilities.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/ReferencingUtilities.java?rev=1690101&r1=1690100&r2=1690101&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/ReferencingUtilities.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/ReferencingUtilities.java [UTF-8] Thu Jul 9 13:31:00 2015
@@ -17,7 +17,6 @@
package org.apache.sis.internal.referencing;
import java.util.Collection;
-import java.util.logging.Logger;
import javax.measure.unit.Unit;
import javax.measure.quantity.Angle;
import org.opengis.annotation.UML;
@@ -28,7 +27,6 @@ import org.opengis.referencing.datum.Ell
import org.opengis.referencing.datum.PrimeMeridian;
import org.apache.sis.util.Static;
import org.apache.sis.util.Utilities;
-import org.apache.sis.util.logging.Logging;
import org.apache.sis.util.resources.Errors;
import org.apache.sis.util.resources.Vocabulary;
import org.apache.sis.internal.jaxb.Context;
@@ -55,11 +53,6 @@ import static org.apache.sis.internal.ut
*/
public final class ReferencingUtilities extends Static {
/**
- * The logger to use for messages related to the {@code sis-referencing} module.
- */
- public static final Logger LOGGER = Logging.getLogger("org.apache.sis.referencing");
-
- /**
* Do not allow instantiation of this class.
*/
private ReferencingUtilities() {
@@ -322,7 +315,7 @@ public final class ReferencingUtilities
}
final Context context = Context.current();
if (context != null) {
- Context.warningOccured(context, LOGGER, classe, method, Errors.class, Errors.Keys.ElementAlreadyPresent_1, name);
+ Context.warningOccured(context, classe, method, Errors.class, Errors.Keys.ElementAlreadyPresent_1, name);
return false;
} else {
throw new IllegalStateException(Errors.format(Errors.Keys.ElementAlreadyPresent_1, name));
Modified: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/CRS.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/CRS.java?rev=1690101&r1=1690100&r2=1690101&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/CRS.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/CRS.java [UTF-8] Thu Jul 9 13:31:00 2015
@@ -45,6 +45,7 @@ import org.apache.sis.internal.util.Defi
import org.apache.sis.internal.metadata.AxisDirections;
import org.apache.sis.internal.referencing.ReferencingUtilities;
import org.apache.sis.internal.system.DefaultFactories;
+import org.apache.sis.internal.system.Loggers;
import org.apache.sis.referencing.cs.DefaultVerticalCS;
import org.apache.sis.referencing.cs.DefaultEllipsoidalCS;
import org.apache.sis.referencing.crs.DefaultGeographicCRS;
@@ -172,7 +173,7 @@ public final class CRS extends Static {
return factory.createCoordinateReferenceSystem(value);
} catch (FactoryException failure) {
final CoordinateReferenceSystem crs = CommonCRS.forCode(authority, value, failure);
- Logging.unexpectedException(CRS.class, "forCode", failure); // See above comment.
+ Logging.unexpectedException(Logging.getLogger(Loggers.CRS_FACTORY), CRS.class, "forCode", failure); // See above comment.
return crs;
} else {
return CommonCRS.forCode(authority, value, null);
Modified: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/CommonCRS.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/CommonCRS.java?rev=1690101&r1=1690100&r2=1690101&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/CommonCRS.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/CommonCRS.java [UTF-8] Thu Jul 9 13:31:00 2015
@@ -58,6 +58,7 @@ import org.apache.sis.referencing.crs.De
import org.apache.sis.referencing.crs.DefaultGeocentricCRS;
import org.apache.sis.internal.system.SystemListener;
import org.apache.sis.internal.system.Modules;
+import org.apache.sis.internal.system.Loggers;
import org.apache.sis.util.resources.Vocabulary;
import org.apache.sis.util.resources.Errors;
import org.apache.sis.util.logging.Logging;
@@ -1342,10 +1343,10 @@ public enum CommonCRS {
/**
* Invoked when a factory failed to create an object.
- * After invoking this method, then the caller will fallback on hard-coded values.
+ * After invoking this method, the caller will fallback on hard-coded values.
*/
static void failure(final Object caller, final String method, final FactoryException e) {
- Logging.unexpectedException(caller.getClass(), method, e);
+ Logging.unexpectedException(Logging.getLogger(Loggers.CRS_FACTORY), caller.getClass(), method, e);
}
/**
Modified: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/AbstractCRS.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/AbstractCRS.java?rev=1690101&r1=1690100&r2=1690101&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/AbstractCRS.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/AbstractCRS.java [UTF-8] Thu Jul 9 13:31:00 2015
@@ -468,8 +468,9 @@ public class AbstractCRS extends Abstrac
formatter.newLine();
formatter.append(toFormattable(getDatum()));
formatter.newLine();
- final boolean isWKT1 = formatter.getConvention().majorVersion() == 1;
- if (isWKT1 || !isBaseCRS(formatter)) {
+ final Convention convention = formatter.getConvention();
+ final boolean isWKT1 = convention.majorVersion() == 1;
+ if (isWKT1 || convention == Convention.INTERNAL || !isBaseCRS(formatter)) {
final CoordinateSystem cs = getCoordinateSystem();
formatCS(formatter, cs, ReferencingUtilities.getUnit(cs), isWKT1);
}
@@ -496,7 +497,7 @@ public class AbstractCRS extends Abstrac
*
* <p>In WKT 2 format, this method should not be invoked if {@link #isBaseCRS(Formatter)} returned {@code true}
* because ISO 19162 excludes the coordinate system definition in base CRS. Note however that WKT 1 includes the
- * coordinate systems.</p>
+ * coordinate systems. The SIS-specific {@link Convention#INTERNAL} formats also those coordinate systems.</p>
*
* <div class="note"><b>Note:</b> the {@code unit} and {@code isWKT1} arguments could be computed by this method,
* but are requested in order to avoid computing them twice, because the caller usually have them anyway.</div>
@@ -509,7 +510,7 @@ public class AbstractCRS extends Abstrac
final void formatCS(final Formatter formatter, final CoordinateSystem cs, final Unit<?> unit, final boolean isWKT1) {
assert unit == ReferencingUtilities.getUnit(cs) : unit;
assert (formatter.getConvention().majorVersion() == 1) == isWKT1 : isWKT1;
- assert isWKT1 || !isBaseCRS(formatter) : isWKT1; // Condition documented in javadoc.
+ assert isWKT1 || !isBaseCRS(formatter) || formatter.getConvention() == Convention.INTERNAL; // Condition documented in javadoc.
final Unit<?> oldUnit = formatter.addContextualUnit(unit);
if (isWKT1) { // WKT 1 writes unit before axes, while WKT 2 writes them after axes.
Modified: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultDerivedCRS.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultDerivedCRS.java?rev=1690101&r1=1690100&r2=1690101&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultDerivedCRS.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultDerivedCRS.java [UTF-8] Thu Jul 9 13:31:00 2015
@@ -48,6 +48,7 @@ import org.apache.sis.referencing.cs.Axe
import org.apache.sis.internal.referencing.ReferencingUtilities;
import org.apache.sis.internal.referencing.WKTUtilities;
import org.apache.sis.internal.metadata.WKTKeywords;
+import org.apache.sis.io.wkt.Convention;
import org.apache.sis.io.wkt.FormattableObject;
import org.apache.sis.io.wkt.Formatter;
import org.apache.sis.util.ComparisonMode;
@@ -504,7 +505,8 @@ public class DefaultDerivedCRS extends A
return super.formatTo(formatter);
}
WKTUtilities.appendName(this, formatter, null);
- final boolean isWKT1 = (formatter.getConvention().majorVersion() == 1);
+ final Convention convention = formatter.getConvention();
+ final boolean isWKT1 = (convention.majorVersion() == 1);
/*
* Both WKT 1 and WKT 2 format the base CRS. But WKT 1 formats the MathTransform before the base CRS,
* while WKT 2 formats the conversion method and parameter values after the base CRS.
@@ -538,7 +540,7 @@ public class DefaultDerivedCRS extends A
return WKTKeywords.DerivingConversion;
}
});
- if (!isBaseCRS(formatter)) {
+ if (convention == Convention.INTERNAL || !isBaseCRS(formatter)) {
final CoordinateSystem cs = getCoordinateSystem();
formatCS(formatter, cs, ReferencingUtilities.getUnit(cs), isWKT1);
}
Modified: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultGeodeticCRS.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultGeodeticCRS.java?rev=1690101&r1=1690100&r2=1690101&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultGeodeticCRS.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultGeodeticCRS.java [UTF-8] Thu Jul 9 13:31:00 2015
@@ -192,7 +192,7 @@ class DefaultGeodeticCRS extends Abstrac
formatter.newLine();
final PrimeMeridian pm = datum.getPrimeMeridian();
final Unit<Angle> angularUnit = AxisDirections.getAngularUnit(cs, null);
- if (convention != Convention.WKT2_SIMPLIFIED ||
+ if (convention != Convention.WKT2_SIMPLIFIED || // Really this specific enum, not Convention.isSimplified().
ReferencingUtilities.getGreenwichLongitude(pm, NonSI.DEGREE_ANGLE) != 0)
{
final Unit<Angle> oldUnit = formatter.addContextualUnit(angularUnit);
@@ -236,7 +236,7 @@ class DefaultGeodeticCRS extends Abstrac
* is part of a ProjectedCRS. Note however that in such case, the units to format are the angular units because
* the linear units will be formatted in the enclosing PROJCS[…] element.
*/
- if (!isBaseCRS) {
+ if (!isBaseCRS || convention == Convention.INTERNAL) {
formatCS(formatter, cs, ReferencingUtilities.getUnit(cs), isWKT1); // Will also format the axes unit.
} else if (convention.isSimplified()) {
formatter.append(formatter.toContextualUnit(angularUnit));
Modified: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultProjectedCRS.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultProjectedCRS.java?rev=1690101&r1=1690100&r2=1690101&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultProjectedCRS.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultProjectedCRS.java [UTF-8] Thu Jul 9 13:31:00 2015
@@ -43,6 +43,8 @@ import org.apache.sis.internal.metadata.
import org.apache.sis.internal.metadata.WKTKeywords;
import org.apache.sis.internal.referencing.WKTUtilities;
import org.apache.sis.internal.util.Constants;
+import org.apache.sis.internal.system.Loggers;
+import org.apache.sis.io.wkt.Convention;
import org.apache.sis.io.wkt.FormattableObject;
import org.apache.sis.io.wkt.Formatter;
import org.apache.sis.util.ComparisonMode;
@@ -383,7 +385,8 @@ public class DefaultProjectedCRS extends
return super.formatTo(formatter);
}
WKTUtilities.appendName(this, formatter, null);
- final boolean isWKT1 = (formatter.getConvention().majorVersion() == 1);
+ final Convention convention = formatter.getConvention();
+ final boolean isWKT1 = (convention.majorVersion() == 1);
final CartesianCS cs = getCoordinateSystem();
final GeographicCRS baseCRS = getBaseCRS();
final Unit<?> lengthUnit = ReferencingUtilities.getUnit(cs);
@@ -412,7 +415,7 @@ public class DefaultProjectedCRS extends
* In WKT 2 format, the coordinate system axes are written only if this projected CRS is not the base CRS
* of another derived CRS.
*/
- if (!isBaseCRS) {
+ if (!isBaseCRS || convention == Convention.INTERNAL) {
formatCS(formatter, cs, lengthUnit, isWKT1);
}
formatter.restoreContextualUnit(lengthUnit, oldLength);
@@ -472,7 +475,7 @@ public class DefaultProjectedCRS extends
* Since the intend of this check was to skip those parameters anyway, it is okay
* for the purpose of WKT formatting if there is no parameter for axis lengths.
*/
- Logging.recoverableException(DefaultProjectedCRS.class, "formatTo", e);
+ Logging.recoverableException(Logging.getLogger(Loggers.WKT), DefaultProjectedCRS.class, "formatTo", e);
continue;
}
if (Double.isNaN(value)) {
Modified: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultCoordinateSystemAxis.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultCoordinateSystemAxis.java?rev=1690101&r1=1690100&r2=1690101&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultCoordinateSystemAxis.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultCoordinateSystemAxis.java [UTF-8] Thu Jul 9 13:31:00 2015
@@ -523,7 +523,7 @@ public class DefaultCoordinateSystemAxis
* @param value The invalid value.
*/
private static void outOfRange(final String name, final Double value) {
- Context.warningOccured(Context.current(), ReferencingUtilities.LOGGER, DefaultCoordinateSystemAxis.class, name,
+ Context.warningOccured(Context.current(), DefaultCoordinateSystemAxis.class, name,
Errors.class, Errors.Keys.InconsistentAttribute_2, name, value);
}
Modified: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DirectionAlongMeridian.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DirectionAlongMeridian.java?rev=1690101&r1=1690100&r2=1690101&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DirectionAlongMeridian.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DirectionAlongMeridian.java [UTF-8] Thu Jul 9 13:31:00 2015
@@ -25,6 +25,7 @@ import org.apache.sis.measure.Longitude;
import org.apache.sis.internal.util.Numerics;
import org.apache.sis.internal.metadata.AxisDirections;
import org.apache.sis.internal.metadata.WKTKeywords;
+import org.apache.sis.internal.system.Modules;
import org.apache.sis.io.wkt.FormattableObject;
import org.apache.sis.io.wkt.Formatter;
import org.apache.sis.util.ArgumentChecks;
@@ -117,7 +118,7 @@ final class DirectionAlongMeridian exten
try {
candidate = parse(direction.name());
} catch (IllegalArgumentException e) {
- Logging.recoverableException(DirectionAlongMeridian.class, "parse", e);
+ Logging.recoverableException(Logging.getLogger(Modules.REFERENCING), DirectionAlongMeridian.class, "parse", e);
return null;
}
if (candidate != null) {
Modified: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultEllipsoid.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultEllipsoid.java?rev=1690101&r1=1690100&r2=1690101&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultEllipsoid.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultEllipsoid.java [UTF-8] Thu Jul 9 13:31:00 2015
@@ -33,7 +33,6 @@ import org.apache.sis.internal.util.Nume
import org.apache.sis.internal.jaxb.Context;
import org.apache.sis.internal.jaxb.gco.Measure;
import org.apache.sis.internal.jaxb.referencing.SecondDefiningParameter;
-import org.apache.sis.internal.referencing.ReferencingUtilities;
import org.apache.sis.internal.referencing.Formulas;
import org.apache.sis.internal.metadata.WKTKeywords;
import org.apache.sis.referencing.IdentifiedObjects;
@@ -581,7 +580,7 @@ public class DefaultEllipsoid extends Ab
*/
private static void warnDuplicated(final String element) {
// We cheat a bit for the "unmarshal" method name since there is not such method...
- Context.warningOccured(Context.current(), ReferencingUtilities.LOGGER, DefaultEllipsoid.class, "unmarshal",
+ Context.warningOccured(Context.current(), DefaultEllipsoid.class, "unmarshal",
Errors.class, Errors.Keys.DuplicatedElement_1, element);
}
Modified: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultGeodeticDatum.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultGeodeticDatum.java?rev=1690101&r1=1690100&r2=1690101&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultGeodeticDatum.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultGeodeticDatum.java [UTF-8] Thu Jul 9 13:31:00 2015
@@ -38,6 +38,7 @@ import org.apache.sis.internal.metadata.
import org.apache.sis.internal.metadata.ReferencingServices;
import org.apache.sis.internal.referencing.ExtentSelector;
import org.apache.sis.internal.util.CollectionsExt;
+import org.apache.sis.internal.system.Loggers;
import org.apache.sis.util.logging.Logging;
import org.apache.sis.util.ComparisonMode;
import org.apache.sis.io.wkt.Formatter;
@@ -414,7 +415,8 @@ public class DefaultGeodeticDatum extend
* is defined in such a way that matrix should always be invertible. If it happen anyway,
* returning 'null' is allowed by this method's contract.
*/
- Logging.unexpectedException(DefaultGeodeticDatum.class, "getPositionVectorTransformation", e);
+ Logging.unexpectedException(Logging.getLogger(Loggers.COORDINATE_OPERATION),
+ DefaultGeodeticDatum.class, "getPositionVectorTransformation", e);
}
}
/*
Modified: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/GeodeticObjectFactory.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/GeodeticObjectFactory.java?rev=1690101&r1=1690100&r2=1690101&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/GeodeticObjectFactory.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/GeodeticObjectFactory.java [UTF-8] Thu Jul 9 13:31:00 2015
@@ -21,6 +21,9 @@ import java.util.Locale;
import java.util.Map;
import java.util.HashMap;
import java.util.Collections;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+import java.util.logging.LogRecord;
import java.util.concurrent.atomic.AtomicReference;
import java.lang.reflect.Constructor;
import javax.measure.unit.Unit;
@@ -40,13 +43,18 @@ 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.referencing.IdentifiedObjects;
+import org.apache.sis.referencing.AbstractIdentifiedObject;
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.system.Loggers;
import org.apache.sis.internal.util.CollectionsExt;
import org.apache.sis.util.collection.WeakHashSet;
import org.apache.sis.util.iso.AbstractFactory;
+import org.apache.sis.util.resources.Messages;
import org.apache.sis.util.resources.Errors;
+import org.apache.sis.util.logging.Logging;
import org.apache.sis.util.ArgumentChecks;
import org.apache.sis.io.wkt.Parser;
import org.apache.sis.xml.XML;
@@ -182,6 +190,11 @@ import org.apache.sis.xml.XML;
*/
public class GeodeticObjectFactory extends AbstractFactory implements CRSFactory, CSFactory, DatumFactory, Parser {
/**
+ * The logger to use for reporting object creations.
+ */
+ private static final Logger LOGGER = Logging.getLogger(Loggers.CRS_FACTORY);
+
+ /**
* The constructor for WKT parsers, fetched when first needed. The WKT parser is defined in the
* same module than this class, so we will hopefully not have security issues. But we have to
* use reflection because the parser class is not yet public (because we do not want to commit
@@ -208,7 +221,7 @@ public class GeodeticObjectFactory exten
* Weak references to existing objects (CRS, CS, Datum, Ellipsoid or PrimeMeridian).
* This set is used in order to return a pre-existing object instead of creating a new one.
*/
- private final WeakHashSet<IdentifiedObject> pool;
+ private final WeakHashSet<AbstractIdentifiedObject> pool;
/**
* The <cite>Well Known Text</cite> parser for {@code CoordinateReferenceSystem} instances.
@@ -237,7 +250,7 @@ public class GeodeticObjectFactory exten
properties = CollectionsExt.compact(new HashMap<String,Object>(properties));
}
defaultProperties = properties;
- pool = new WeakHashSet<>(IdentifiedObject.class);
+ pool = new WeakHashSet<>(AbstractIdentifiedObject.class);
parser = new AtomicReference<>();
}
@@ -287,6 +300,27 @@ public class GeodeticObjectFactory exten
}
/**
+ * Returns a unique instance of the given object. If this method recycles an existing object,
+ * then the existing instance is returned silently. Otherwise this method logs a message at
+ * {@link Level#FINE} telling that a new object has been created.
+ */
+ private <T extends AbstractIdentifiedObject> T unique(final String caller, final T object) {
+ final T c = pool.unique(object);
+ if (c == object && LOGGER.isLoggable(Level.FINE)) {
+ final String id = IdentifiedObjects.toString(IdentifiedObjects.getIdentifier(c, null));
+ final LogRecord record = Messages.getResources(null).getLogRecord(Level.FINE,
+ (id != null) ? Messages.Keys.CreatedIdentifiedObject_3
+ : Messages.Keys.CreatedNamedObject_2,
+ c.getInterface(), c.getName().getCode(), id);
+ record.setSourceClassName(GeodeticObjectFactory.class.getCanonicalName());
+ record.setSourceMethodName(caller);
+ record.setLoggerName(LOGGER.getName());
+ LOGGER.log(record);
+ }
+ return c;
+ }
+
+ /**
* Creates a geocentric coordinate reference system from a {@linkplain CartesianCS Cartesian coordinate system}.
* Geocentric CRS have their origin at the approximate centre of mass of the earth.
* An {@linkplain #createGeocentricCRS(Map, GeodeticDatum, SphericalCS) alternate method} allows creation of the
@@ -311,13 +345,13 @@ public class GeodeticObjectFactory exten
public GeocentricCRS createGeocentricCRS(final Map<String,?> properties,
final GeodeticDatum datum, final CartesianCS cs) throws FactoryException
{
- final GeocentricCRS crs;
+ final DefaultGeocentricCRS crs;
try {
crs = new DefaultGeocentricCRS(complete(properties), datum, cs);
} catch (IllegalArgumentException exception) {
throw new FactoryException(exception);
}
- return pool.unique(crs);
+ return unique("createGeocentricCRS", crs);
}
/**
@@ -345,13 +379,13 @@ public class GeodeticObjectFactory exten
final CoordinateSystemAxis axis1,
final CoordinateSystemAxis axis2) throws FactoryException
{
- final CartesianCS cs;
+ final DefaultCartesianCS cs;
try {
cs = new DefaultCartesianCS(complete(properties), axis0, axis1, axis2);
} catch (IllegalArgumentException exception) {
throw new FactoryException(exception);
}
- return pool.unique(cs);
+ return unique("createCartesianCS", cs);
}
/**
@@ -379,13 +413,13 @@ public class GeodeticObjectFactory exten
public GeocentricCRS createGeocentricCRS(final Map<String,?> properties,
final GeodeticDatum datum, final SphericalCS cs) throws FactoryException
{
- final GeocentricCRS crs;
+ final DefaultGeocentricCRS crs;
try {
crs = new DefaultGeocentricCRS(complete(properties), datum, cs);
} catch (IllegalArgumentException exception) {
throw new FactoryException(exception);
}
- return pool.unique(crs);
+ return unique("createGeocentricCRS", crs);
}
/**
@@ -413,13 +447,13 @@ public class GeodeticObjectFactory exten
final CoordinateSystemAxis axis1,
final CoordinateSystemAxis axis2) throws FactoryException
{
- final SphericalCS cs;
+ final DefaultSphericalCS cs;
try {
cs = new DefaultSphericalCS(complete(properties), axis0, axis1, axis2);
} catch (IllegalArgumentException exception) {
throw new FactoryException(exception);
}
- return pool.unique(cs);
+ return unique("createSphericalCS", cs);
}
/**
@@ -445,13 +479,13 @@ public class GeodeticObjectFactory exten
public GeographicCRS createGeographicCRS(final Map<String,?> properties,
final GeodeticDatum datum, final EllipsoidalCS cs) throws FactoryException
{
- final GeographicCRS crs;
+ final DefaultGeographicCRS crs;
try {
crs = new DefaultGeographicCRS(complete(properties), datum, cs);
} catch (IllegalArgumentException exception) {
throw new FactoryException(exception);
}
- return pool.unique(crs);
+ return unique("createGeographicCRS", crs);
}
/**
@@ -478,13 +512,13 @@ public class GeodeticObjectFactory exten
public GeodeticDatum createGeodeticDatum(final Map<String,?> properties,
final Ellipsoid ellipsoid, final PrimeMeridian primeMeridian) throws FactoryException
{
- final GeodeticDatum datum;
+ final DefaultGeodeticDatum datum;
try {
datum = new DefaultGeodeticDatum(complete(properties), ellipsoid, primeMeridian);
} catch (IllegalArgumentException exception) {
throw new FactoryException(exception);
}
- return pool.unique(datum);
+ return unique("createGeodeticDatum", datum);
}
/**
@@ -504,13 +538,13 @@ public class GeodeticObjectFactory exten
public PrimeMeridian createPrimeMeridian(final Map<String,?> properties,
final double longitude, final Unit<Angle> angularUnit) throws FactoryException
{
- final PrimeMeridian meridian;
+ final DefaultPrimeMeridian meridian;
try {
meridian = new DefaultPrimeMeridian(complete(properties), longitude, angularUnit);
} catch (IllegalArgumentException exception) {
throw new FactoryException(exception);
}
- return pool.unique(meridian);
+ return unique("createPrimeMeridian", meridian);
}
/**
@@ -536,13 +570,13 @@ public class GeodeticObjectFactory exten
final CoordinateSystemAxis axis0,
final CoordinateSystemAxis axis1) throws FactoryException
{
- final EllipsoidalCS cs;
+ final DefaultEllipsoidalCS cs;
try {
cs = new DefaultEllipsoidalCS(complete(properties), axis0, axis1);
} catch (IllegalArgumentException exception) {
throw new FactoryException(exception);
}
- return pool.unique(cs);
+ return unique("createEllipsoidalCS", cs);
}
/**
@@ -571,13 +605,13 @@ public class GeodeticObjectFactory exten
final CoordinateSystemAxis axis1,
final CoordinateSystemAxis axis2) throws FactoryException
{
- final EllipsoidalCS cs;
+ final DefaultEllipsoidalCS cs;
try {
cs = new DefaultEllipsoidalCS(complete(properties), axis0, axis1, axis2);
} catch (IllegalArgumentException exception) {
throw new FactoryException(exception);
}
- return pool.unique(cs);
+ return unique("createEllipsoidalCS", cs);
}
/**
@@ -597,13 +631,13 @@ public class GeodeticObjectFactory exten
final double semiMajorAxis, final double semiMinorAxis,
final Unit<Length> unit) throws FactoryException
{
- final Ellipsoid ellipsoid;
+ final DefaultEllipsoid ellipsoid;
try {
ellipsoid = DefaultEllipsoid.createEllipsoid(complete(properties), semiMajorAxis, semiMinorAxis, unit);
} catch (IllegalArgumentException exception) {
throw new FactoryException(exception);
}
- return pool.unique(ellipsoid);
+ return unique("createEllipsoid", ellipsoid);
}
/**
@@ -623,13 +657,13 @@ public class GeodeticObjectFactory exten
final double semiMajorAxis, final double inverseFlattening,
final Unit<Length> unit) throws FactoryException
{
- final Ellipsoid ellipsoid;
+ final DefaultEllipsoid ellipsoid;
try {
ellipsoid = DefaultEllipsoid.createFlattenedSphere(complete(properties), semiMajorAxis, inverseFlattening, unit);
} catch (IllegalArgumentException exception) {
throw new FactoryException(exception);
}
- return pool.unique(ellipsoid);
+ return unique("createFlattenedSphere", ellipsoid);
}
/**
@@ -664,13 +698,13 @@ public class GeodeticObjectFactory exten
final GeographicCRS baseCRS, final Conversion conversion,
final CartesianCS derivedCS) throws FactoryException
{
- final ProjectedCRS crs;
+ final DefaultProjectedCRS crs;
try {
crs = new DefaultProjectedCRS(complete(properties), baseCRS, conversion, derivedCS);
} catch (IllegalArgumentException exception) {
throw new FactoryException(exception);
}
- return pool.unique(crs);
+ return unique("createProjectedCRS", crs);
}
/**
@@ -696,13 +730,13 @@ public class GeodeticObjectFactory exten
final CoordinateSystemAxis axis0,
final CoordinateSystemAxis axis1) throws FactoryException
{
- final CartesianCS cs;
+ final DefaultCartesianCS cs;
try {
cs = new DefaultCartesianCS(complete(properties), axis0, axis1);
} catch (IllegalArgumentException exception) {
throw new FactoryException(exception);
}
- return pool.unique(cs);
+ return unique("createCartesianCS", cs);
}
/**
@@ -739,13 +773,13 @@ public class GeodeticObjectFactory exten
final CoordinateSystem derivedCS) throws FactoryException
{
ArgumentChecks.ensureCanCast("baseCRS", SingleCRS.class, baseCRS);
- final DerivedCRS crs;
+ final DefaultDerivedCRS crs;
try {
crs = DefaultDerivedCRS.create(complete(properties), (SingleCRS) baseCRS, conversion, derivedCS);
} catch (IllegalArgumentException exception) {
throw new FactoryException(exception);
}
- return pool.unique(crs);
+ return unique("createDerivedCRS", crs);
}
/**
@@ -772,13 +806,13 @@ public class GeodeticObjectFactory exten
public VerticalCRS createVerticalCRS(final Map<String,?> properties,
final VerticalDatum datum, final VerticalCS cs) throws FactoryException
{
- final VerticalCRS crs;
+ final DefaultVerticalCRS crs;
try {
crs = new DefaultVerticalCRS(complete(properties), datum, cs);
} catch (IllegalArgumentException exception) {
throw new FactoryException(exception);
}
- return pool.unique(crs);
+ return unique("createVerticalCRS", crs);
}
/**
@@ -795,13 +829,13 @@ public class GeodeticObjectFactory exten
public VerticalDatum createVerticalDatum(final Map<String,?> properties,
final VerticalDatumType type) throws FactoryException
{
- final VerticalDatum datum;
+ final DefaultVerticalDatum datum;
try {
datum = new DefaultVerticalDatum(complete(properties), type);
} catch (IllegalArgumentException exception) {
throw new FactoryException(exception);
}
- return pool.unique(datum);
+ return unique("createVerticalDatum", datum);
}
/**
@@ -825,13 +859,13 @@ public class GeodeticObjectFactory exten
public VerticalCS createVerticalCS(final Map<String,?> properties,
final CoordinateSystemAxis axis) throws FactoryException
{
- final VerticalCS cs;
+ final DefaultVerticalCS cs;
try {
cs = new DefaultVerticalCS(complete(properties), axis);
} catch (IllegalArgumentException exception) {
throw new FactoryException(exception);
}
- return pool.unique(cs);
+ return unique("createVerticalCS", cs);
}
/**
@@ -856,13 +890,13 @@ public class GeodeticObjectFactory exten
public TemporalCRS createTemporalCRS(final Map<String,?> properties,
final TemporalDatum datum, final TimeCS cs) throws FactoryException
{
- final TemporalCRS crs;
+ final DefaultTemporalCRS crs;
try {
crs = new DefaultTemporalCRS(complete(properties), datum, cs);
} catch (IllegalArgumentException exception) {
throw new FactoryException(exception);
}
- return pool.unique(crs);
+ return unique("createTemporalCRS", crs);
}
/**
@@ -879,13 +913,13 @@ public class GeodeticObjectFactory exten
public TemporalDatum createTemporalDatum(final Map<String,?> properties,
final Date origin) throws FactoryException
{
- final TemporalDatum datum;
+ final DefaultTemporalDatum datum;
try {
datum = new DefaultTemporalDatum(complete(properties), origin);
} catch (IllegalArgumentException exception) {
throw new FactoryException(exception);
}
- return pool.unique(datum);
+ return unique("createTemporalDatum", datum);
}
/**
@@ -909,13 +943,13 @@ public class GeodeticObjectFactory exten
public TimeCS createTimeCS(final Map<String,?> properties,
final CoordinateSystemAxis axis) throws FactoryException
{
- final TimeCS cs;
+ final DefaultTimeCS cs;
try {
cs = new DefaultTimeCS(complete(properties), axis);
} catch (IllegalArgumentException exception) {
throw new FactoryException(exception);
}
- return pool.unique(cs);
+ return unique("createTimeCS", cs);
}
/**
@@ -941,13 +975,13 @@ public class GeodeticObjectFactory exten
public CompoundCRS createCompoundCRS(final Map<String,?> properties,
final CoordinateReferenceSystem... elements) throws FactoryException
{
- final CompoundCRS crs;
+ final DefaultCompoundCRS crs;
try {
crs = new DefaultCompoundCRS(complete(properties), elements);
} catch (IllegalArgumentException exception) {
throw new FactoryException(exception);
}
- return pool.unique(crs);
+ return unique("createCompoundCRS", crs);
}
/**
@@ -965,13 +999,13 @@ public class GeodeticObjectFactory exten
public ImageCRS createImageCRS(final Map<String,?> properties,
final ImageDatum datum, final AffineCS cs) throws FactoryException
{
- final ImageCRS crs;
+ final DefaultImageCRS crs;
try {
crs = new DefaultImageCRS(complete(properties), datum, cs);
} catch (IllegalArgumentException exception) {
throw new FactoryException(exception);
}
- return pool.unique(crs);
+ return unique("createImageCRS", crs);
}
/**
@@ -988,13 +1022,13 @@ public class GeodeticObjectFactory exten
public ImageDatum createImageDatum(final Map<String,?> properties,
final PixelInCell pixelInCell) throws FactoryException
{
- final ImageDatum datum;
+ final DefaultImageDatum datum;
try {
datum = new DefaultImageDatum(complete(properties), pixelInCell);
} catch (IllegalArgumentException exception) {
throw new FactoryException(exception);
}
- return pool.unique(datum);
+ return unique("createImageDatum", datum);
}
/**
@@ -1020,13 +1054,13 @@ public class GeodeticObjectFactory exten
final CoordinateSystemAxis axis0,
final CoordinateSystemAxis axis1) throws FactoryException
{
- final AffineCS cs;
+ final DefaultAffineCS cs;
try {
cs = new DefaultAffineCS(complete(properties), axis0, axis1);
} catch (IllegalArgumentException exception) {
throw new FactoryException(exception);
}
- return pool.unique(cs);
+ return unique("createAffineCS", cs);
}
/**
@@ -1057,13 +1091,13 @@ public class GeodeticObjectFactory exten
public EngineeringCRS createEngineeringCRS(final Map<String,?> properties,
final EngineeringDatum datum, final CoordinateSystem cs) throws FactoryException
{
- final EngineeringCRS crs;
+ final DefaultEngineeringCRS crs;
try {
crs = new DefaultEngineeringCRS(complete(properties), datum, cs);
} catch (IllegalArgumentException exception) {
throw new FactoryException(exception);
}
- return pool.unique(crs);
+ return unique("createEngineeringCRS", crs);
}
/**
@@ -1079,13 +1113,13 @@ public class GeodeticObjectFactory exten
public EngineeringDatum createEngineeringDatum(final Map<String,?> properties)
throws FactoryException
{
- final EngineeringDatum datum;
+ final DefaultEngineeringDatum datum;
try {
datum = new DefaultEngineeringDatum(complete(properties));
} catch (IllegalArgumentException exception) {
throw new FactoryException(exception);
}
- return pool.unique(datum);
+ return unique("createEngineeringDatum", datum);
}
/**
@@ -1113,13 +1147,13 @@ public class GeodeticObjectFactory exten
final CoordinateSystemAxis axis1,
final CoordinateSystemAxis axis2) throws FactoryException
{
- final AffineCS cs;
+ final DefaultAffineCS cs;
try {
cs = new DefaultAffineCS(complete(properties), axis0, axis1, axis2);
} catch (IllegalArgumentException exception) {
throw new FactoryException(exception);
}
- return pool.unique(cs);
+ return unique("createAffineCS", cs);
}
/**
@@ -1147,13 +1181,13 @@ public class GeodeticObjectFactory exten
final CoordinateSystemAxis axis1,
final CoordinateSystemAxis axis2) throws FactoryException
{
- final CylindricalCS cs;
+ final DefaultCylindricalCS cs;
try {
cs = new DefaultCylindricalCS(complete(properties), axis0, axis1, axis2);
} catch (IllegalArgumentException exception) {
throw new FactoryException(exception);
}
- return pool.unique(cs);
+ return unique("createCylindricalCS", cs);
}
/**
@@ -1179,13 +1213,13 @@ public class GeodeticObjectFactory exten
final CoordinateSystemAxis axis0,
final CoordinateSystemAxis axis1) throws FactoryException
{
- final PolarCS cs;
+ final DefaultPolarCS cs;
try {
cs = new DefaultPolarCS(complete(properties), axis0, axis1);
} catch (IllegalArgumentException exception) {
throw new FactoryException(exception);
}
- return pool.unique(cs);
+ return unique("createPolarCS", cs);
}
/**
@@ -1209,13 +1243,13 @@ public class GeodeticObjectFactory exten
public LinearCS createLinearCS(final Map<String,?> properties,
final CoordinateSystemAxis axis) throws FactoryException
{
- final LinearCS cs;
+ final DefaultLinearCS cs;
try {
cs = new DefaultLinearCS(complete(properties), axis);
} catch (IllegalArgumentException exception) {
throw new FactoryException(exception);
}
- return pool.unique(cs);
+ return unique("createLinearCS", cs);
}
/**
@@ -1241,13 +1275,13 @@ public class GeodeticObjectFactory exten
final CoordinateSystemAxis axis0,
final CoordinateSystemAxis axis1) throws FactoryException
{
- final UserDefinedCS cs;
+ final DefaultUserDefinedCS cs;
try {
cs = new DefaultUserDefinedCS(complete(properties), axis0, axis1);
} catch (IllegalArgumentException exception) {
throw new FactoryException(exception);
}
- return pool.unique(cs);
+ return unique("createUserDefinedCS", cs);
}
/**
@@ -1275,13 +1309,13 @@ public class GeodeticObjectFactory exten
final CoordinateSystemAxis axis1,
final CoordinateSystemAxis axis2) throws FactoryException
{
- final UserDefinedCS cs;
+ final DefaultUserDefinedCS cs;
try {
cs = new DefaultUserDefinedCS(complete(properties), axis0, axis1, axis2);
} catch (IllegalArgumentException exception) {
throw new FactoryException(exception);
}
- return pool.unique(cs);
+ return unique("createUserDefinedCS", cs);
}
/**
@@ -1304,13 +1338,13 @@ public class GeodeticObjectFactory exten
final String abbreviation, final AxisDirection direction,
final Unit<?> unit) throws FactoryException
{
- final CoordinateSystemAxis axis;
+ final DefaultCoordinateSystemAxis axis;
try {
axis = new DefaultCoordinateSystemAxis(complete(properties), abbreviation, direction, unit);
} catch (IllegalArgumentException exception) {
throw new FactoryException(exception);
}
- return pool.unique(axis);
+ return unique("createCoordinateSystemAxis", axis);
}
/**
Modified: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/ContextualParameters.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/ContextualParameters.java?rev=1690101&r1=1690100&r2=1690101&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/ContextualParameters.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/ContextualParameters.java [UTF-8] Thu Jul 9 13:31:00 2015
@@ -38,6 +38,7 @@ import org.opengis.referencing.operation
import org.apache.sis.internal.referencing.ExtendedPrecisionMatrix;
import org.apache.sis.internal.referencing.WKTUtilities;
import org.apache.sis.internal.metadata.WKTKeywords;
+import org.apache.sis.internal.system.Loggers;
import org.apache.sis.internal.util.DoubleDouble;
import org.apache.sis.internal.util.UnmodifiableArrayList;
import org.apache.sis.parameter.Parameters;
@@ -769,6 +770,6 @@ public class ContextualParameters extend
* transform.</p>
*/
private static void unexpectedException(final NoninvertibleMatrixException e) {
- Logging.unexpectedException(ConcatenatedTransform.class, "formatTo", e);
+ Logging.unexpectedException(Logging.getLogger(Loggers.WKT), ConcatenatedTransform.class, "formatTo", e);
}
}
Modified: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/DefaultMathTransformFactory.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/DefaultMathTransformFactory.java?rev=1690101&r1=1690100&r2=1690101&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/DefaultMathTransformFactory.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/DefaultMathTransformFactory.java [UTF-8] Thu Jul 9 13:31:00 2015
@@ -25,6 +25,7 @@ import java.util.concurrent.ConcurrentHa
import java.util.concurrent.ConcurrentMap;
import java.util.concurrent.atomic.AtomicReference;
import java.util.logging.Level;
+import java.util.logging.LogRecord;
import java.lang.reflect.Constructor;
import javax.measure.quantity.Length;
import javax.measure.unit.SI;
@@ -53,6 +54,7 @@ import org.apache.sis.internal.referenci
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.internal.system.Loggers;
import org.apache.sis.referencing.cs.AxesConvention;
import org.apache.sis.referencing.cs.CoordinateSystems;
import org.apache.sis.referencing.operation.DefaultOperationMethod;
@@ -537,10 +539,11 @@ public class DefaultMathTransformFactory
failure = e;
}
if (mismatchedParam != null) {
- Logging.log(DefaultMathTransformFactory.class, "createBaseToDerived",
- Messages.getResources((Locale) null).getLogRecord(Level.WARNING,
- Messages.Keys.MismatchedEllipsoidAxisLength_3, ellipsoid.getName().getCode(),
- mismatchedParam.getDescriptor().getName().getCode(), mismatchedValue));
+ final LogRecord record = Messages.getResources((Locale) null).getLogRecord(Level.WARNING,
+ Messages.Keys.MismatchedEllipsoidAxisLength_3, ellipsoid.getName().getCode(),
+ mismatchedParam.getDescriptor().getName().getCode(), mismatchedValue);
+ record.setLoggerName(Loggers.COORDINATE_OPERATION);
+ Logging.log(DefaultMathTransformFactory.class, "createBaseToDerived", record);
}
}
MathTransform baseToDerived;
Modified: sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/io/wkt/GeodeticObjectParserTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/io/wkt/GeodeticObjectParserTest.java?rev=1690101&r1=1690100&r2=1690101&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/io/wkt/GeodeticObjectParserTest.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/io/wkt/GeodeticObjectParserTest.java [UTF-8] Thu Jul 9 13:31:00 2015
@@ -18,6 +18,7 @@ package org.apache.sis.io.wkt;
import java.util.Collections;
import java.util.Date;
+import java.util.HashMap;
import java.util.Iterator;
import java.util.Locale;
import java.text.ParsePosition;
@@ -44,6 +45,9 @@ import org.junit.Test;
import static org.apache.sis.test.ReferencingAssert.*;
+// Branch-specific imports
+import org.opengis.util.Factory;
+
/**
* Tests {@link GeodeticObjectParser}.
@@ -74,7 +78,7 @@ public final strictfp class GeodeticObje
*/
private void newParser(final Convention convention) {
parser = new GeodeticObjectParser(Symbols.getDefault(), Collections.<String,Element>emptyMap(),
- null, null, null, convention, Transliterator.DEFAULT, null, null);
+ null, null, null, convention, Transliterator.DEFAULT, null, new HashMap<Class<?>,Factory>());
assertEquals(GeodeticObjectFactory.class.getCanonicalName(), parser.getPublicFacade());
}
Modified: sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultCompoundCRSTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultCompoundCRSTest.java?rev=1690101&r1=1690100&r2=1690101&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultCompoundCRSTest.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultCompoundCRSTest.java [UTF-8] Thu Jul 9 13:31:00 2015
@@ -168,10 +168,11 @@ public final strictfp class DefaultCompo
" UNIT[“degree”, 0.017453292519943295],\n" +
" AXIS[“Longitude”, EAST],\n" +
" AXIS[“Latitude”, NORTH]],\n" +
- " VERT_CS[“Gravity-related height”,\n" +
+ " VERT_CS[“MSL height”,\n" +
" VERT_DATUM[“Mean Sea Level”, 2005],\n" +
" UNIT[“metre”, 1],\n" +
- " AXIS[“Gravity-related height”, UP]],\n" +
+ " AXIS[“Gravity-related height”, UP],\n" +
+ " AUTHORITY[“EPSG”, “5714”]],\n" + // SIS includes Identifier for component of CompoundCRS.
" TIMECRS[“Time”,\n" +
" TIMEDATUM[“Modified Julian”, TIMEORIGIN[1858-11-17T00:00:00.0Z]],\n" +
" TIMEUNIT[“day”, 86400],\n" +
@@ -195,11 +196,12 @@ public final strictfp class DefaultCompo
" Axis[“Longitude (L)”, east, Order[1]],\n" +
" Axis[“Latitude (B)”, north, Order[2]],\n" +
" AngleUnit[“degree”, 0.017453292519943295]],\n" +
- " VerticalCRS[“Gravity-related height”,\n" +
+ " VerticalCRS[“MSL height”,\n" +
" VerticalDatum[“Mean Sea Level”],\n" +
" CS[vertical, 1],\n" +
" Axis[“Gravity-related height (H)”, up, Order[1]],\n" +
- " LengthUnit[“metre”, 1]],\n" +
+ " LengthUnit[“metre”, 1],\n" +
+ " Id[“EPSG”, 5714]],\n" + // SIS includes Identifier for component of CompoundCRS.
" TimeCRS[“Time”,\n" +
" TimeDatum[“Modified Julian”, TimeOrigin[1858-11-17T00:00:00.0Z]],\n" +
" CS[temporal, 1],\n" +
Modified: sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultProjectedCRSTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultProjectedCRSTest.java?rev=1690101&r1=1690100&r2=1690101&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultProjectedCRSTest.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultProjectedCRSTest.java [UTF-8] Thu Jul 9 13:31:00 2015
@@ -24,15 +24,19 @@ import org.opengis.util.FactoryException
import org.opengis.referencing.crs.ProjectedCRS;
import org.opengis.referencing.crs.GeographicCRS;
import org.opengis.test.Validators;
+import org.apache.sis.metadata.iso.citation.Citations;
import org.apache.sis.referencing.cs.HardCodedCS;
import org.apache.sis.referencing.GeodeticObjectBuilder;
-import org.apache.sis.metadata.iso.citation.Citations;
import org.apache.sis.internal.util.Constants;
+import org.apache.sis.internal.system.Loggers;
import org.apache.sis.io.wkt.Convention;
+import org.apache.sis.util.logging.Logging;
+import org.apache.sis.test.LoggingWatcher;
import org.apache.sis.test.DependsOnMethod;
import org.apache.sis.test.DependsOn;
import org.apache.sis.test.XMLTestCase;
import org.junit.Test;
+import org.junit.Rule;
import static org.apache.sis.test.MetadataAssert.*;
@@ -51,6 +55,22 @@ import static org.apache.sis.test.Metada
})
public final strictfp class DefaultProjectedCRSTest extends XMLTestCase {
/**
+ * A JUnit rule for listening to log events emitted during execution of {@link #testWKT1_WithExplicitAxisLength()}.
+ * This rule verifies that the message logged contains the expected information. The expected message is something
+ * like "Parameter semi_minor could have been omitted but got a value that does not match the WGS84 ellipsoid".
+ *
+ * <p>This field is public because JUnit requires us to do so, but should be considered as an implementation details
+ * (it should have been a private field).</p>
+ */
+ @Rule
+ public final LoggingWatcher listener = new LoggingWatcher(Logging.getLogger(Loggers.COORDINATE_OPERATION)) {
+ @Override protected void verifyMessage(final String message) {
+ assertTrue(message, message.contains("semi_minor"));
+ assertTrue(message, message.contains("WGS84"));
+ }
+ };
+
+ /**
* An XML file in this package containing a projected CRS definition.
*/
private static final String XML_FILE = "NTF.xml";
@@ -172,6 +192,43 @@ public final strictfp class DefaultProje
}
/**
+ * Tests WKT formatting in "internal" mode.
+ * This mode is similar to WKT 2 but shall include the axes of the base CRS.
+ *
+ * @throws FactoryException if the CRS creation failed.
+ */
+ @Test
+ @DependsOnMethod("testWKT1")
+ public void testInternal() throws FactoryException {
+ ProjectedCRS crs = create(HardCodedCRS.NTF);
+ assertWktEquals(Convention.INTERNAL,
+ "ProjectedCRS[“NTF (Paris) / Lambert zone II”,\n" +
+ " BaseGeodCRS[“NTF (Paris)”,\n" +
+ " Datum[“Nouvelle Triangulation Française”,\n" +
+ " Ellipsoid[“NTF”, 6378249.2, 293.4660212936269],\n" +
+ " Scope[“Topographic mapping.”],\n" +
+ " Id[“EPSG”, 6807]],\n" +
+ " PrimeMeridian[“Paris”, 2.5969213, Id[“EPSG”, 8903]],\n" +
+ " CS[ellipsoidal, 2],\n" +
+ " Axis[“Longitude (λ)”, east],\n" +
+ " Axis[“Latitude (φ)”, north],\n" +
+ " Unit[“grade”, 0.015707963267948967, Id[“EPSG”, 9105]]],\n" +
+ " Conversion[“Lambert zone II”,\n" +
+ " Method[“Lambert Conic Conformal (1SP)”, Id[“EPSG”, 9801], Id[“GeoTIFF”, 9]],\n" +
+ " Parameter[“Latitude of natural origin”, 52.0, Id[“EPSG”, 8801]],\n" +
+ " Parameter[“Longitude of natural origin”, 0.0, Id[“EPSG”, 8802]],\n" +
+ " Parameter[“Scale factor at natural origin”, 0.99987742, Id[“EPSG”, 8805]],\n" +
+ " Parameter[“False easting”, 600000.0, Id[“EPSG”, 8806]],\n" +
+ " Parameter[“False northing”, 2200000.0, Id[“EPSG”, 8807]]],\n" +
+ " CS[Cartesian, 2],\n" +
+ " Axis[“Easting (E)”, east],\n" +
+ " Axis[“Northing (N)”, north],\n" +
+ " Unit[“metre”, 1, Id[“EPSG”, 9001]],\n" +
+ " Id[“EPSG”, 27572]]",
+ crs);
+ }
+
+ /**
* Tests WKT 2 formatting in simplified mode.
*
* @throws FactoryException if the CRS creation failed.
@@ -270,6 +327,7 @@ public final strictfp class DefaultProje
@Test
@DependsOnMethod("testWKT1")
public void testWKT1_WithExplicitAxisLength() throws FactoryException {
+ listener.maximumLogCount = 1;
final ProjectedCRS crs = new GeodeticObjectBuilder()
.setConversionMethod("Mercator (variant A)")
.setConversionName("Popular Visualisation Pseudo-Mercator")
@@ -298,6 +356,8 @@ public final strictfp class DefaultProje
" AXIS[“Easting”, EAST],\n" +
" AXIS[“Northing”, NORTH]]",
crs);
+
+ assertEquals("A warning should have been logged.", 0, listener.maximumLogCount);
}
/**
Modified: sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/HardCodedCRS.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/HardCodedCRS.java?rev=1690101&r1=1690100&r2=1690101&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/HardCodedCRS.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/HardCodedCRS.java [UTF-8] Thu Jul 9 13:31:00 2015
@@ -22,7 +22,9 @@ import java.util.Collections;
import org.opengis.referencing.datum.PixelInCell;
import org.apache.sis.referencing.cs.HardCodedCS;
import org.apache.sis.referencing.datum.HardCodedDatum;
+import org.apache.sis.referencing.NamedIdentifier;
import org.apache.sis.metadata.iso.extent.Extents;
+import org.apache.sis.metadata.iso.citation.HardCodedCitations;
import static org.opengis.referencing.IdentifiedObject.*;
import static org.opengis.referencing.ReferenceSystem.DOMAIN_OF_VALIDITY_KEY;
@@ -47,7 +49,7 @@ public final strictfp class HardCodedCRS
* <p>This CRS is equivalent to {@code EPSG:4326}.</p>
*/
public static final DefaultGeographicCRS WGS84_φλ = new DefaultGeographicCRS(
- properties("WGS 84 (φ,λ)"), HardCodedDatum.WGS84, HardCodedCS.GEODETIC_φλ);
+ properties("WGS 84 (φ,λ)", "4326"), HardCodedDatum.WGS84, HardCodedCS.GEODETIC_φλ);
/**
* A two-dimensional geographic coordinate reference system using the WGS84 datum.
@@ -59,7 +61,7 @@ public final strictfp class HardCodedCRS
* since EPSG puts latitude before longitude.</p>
*/
public static final DefaultGeographicCRS WGS84 = new DefaultGeographicCRS(
- properties("WGS 84"), HardCodedDatum.WGS84, HardCodedCS.GEODETIC_2D);
+ properties("WGS 84", null), HardCodedDatum.WGS84, HardCodedCS.GEODETIC_2D);
/**
* A three-dimensional geographic coordinate reference system using the WGS84 datum.
@@ -71,7 +73,7 @@ public final strictfp class HardCodedCRS
* to {@code EPSG:4327}) except for axis order, since EPSG puts latitude before longitude.</p>
*/
public static final DefaultGeographicCRS WGS84_3D = new DefaultGeographicCRS(
- properties("WGS 84 (3D)"), HardCodedDatum.WGS84, HardCodedCS.GEODETIC_3D);
+ properties("WGS 84 (3D)", null), HardCodedDatum.WGS84, HardCodedCS.GEODETIC_3D);
/**
* A two-dimensional geographic coordinate reference system using the Paris prime meridian.
@@ -162,7 +164,7 @@ public final strictfp class HardCodedCRS
* A vertical coordinate reference system using Mean Sea Level datum.
*/
public static final DefaultVerticalCRS GRAVITY_RELATED_HEIGHT = new DefaultVerticalCRS(
- getProperties(HardCodedCS.GRAVITY_RELATED_HEIGHT), HardCodedDatum.MEAN_SEA_LEVEL, HardCodedCS.GRAVITY_RELATED_HEIGHT);
+ properties("MSL height", "5714"), HardCodedDatum.MEAN_SEA_LEVEL, HardCodedCS.GRAVITY_RELATED_HEIGHT);
/**
* A vertical coordinate reference system using Mean Sea Level datum.
@@ -181,14 +183,14 @@ public final strictfp class HardCodedCRS
* This constant uses the "geoid" term as an approximation for the gravity related height.
*/
public static final DefaultCompoundCRS GEOID_3D = new DefaultCompoundCRS(
- properties("WGS 84 + height"), WGS84, GRAVITY_RELATED_HEIGHT);
+ properties("WGS 84 + height", null), WGS84, GRAVITY_RELATED_HEIGHT);
/**
* A (λ,φ,H,t) CRS where <var>H</var> is the {@link #GRAVITY_RELATED_HEIGHT} and <var>t</var> is {@link #TIME}.
* This constant uses the "geoid" term as an approximation for the gravity related height.
*/
public static final DefaultCompoundCRS GEOID_4D = new DefaultCompoundCRS(
- properties("WGS 84 + height + time"), WGS84, GRAVITY_RELATED_HEIGHT, TIME);
+ properties("WGS 84 + height + time", null), WGS84, GRAVITY_RELATED_HEIGHT, TIME);
/**
* A two-dimensional Cartesian coordinate reference system with (column, row) axes.
@@ -202,12 +204,15 @@ public final strictfp class HardCodedCRS
getProperties(HardCodedDatum.IMAGE), HardCodedDatum.IMAGE, HardCodedCS.GRID);
/**
- * Creates a map of properties for the given name.
+ * Creates a map of properties for the given name and code with world extent.
*/
- private static Map<String,?> properties(final String name) {
+ private static Map<String,?> properties(final String name, final String code) {
final Map<String,Object> properties = new HashMap<>(4);
properties.put(NAME_KEY, name);
properties.put(DOMAIN_OF_VALIDITY_KEY, Extents.WORLD);
+ if (code != null) {
+ properties.put(IDENTIFIERS_KEY, new NamedIdentifier(HardCodedCitations.EPSG, code));
+ }
return properties;
}
Modified: sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/datum/HardCodedDatum.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/datum/HardCodedDatum.java?rev=1690101&r1=1690100&r2=1690101&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/datum/HardCodedDatum.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/datum/HardCodedDatum.java [UTF-8] Thu Jul 9 13:31:00 2015
@@ -26,7 +26,7 @@ import org.opengis.referencing.datum.Ver
import org.apache.sis.test.mock.GeodeticDatumMock;
import org.apache.sis.referencing.NamedIdentifier;
import org.apache.sis.internal.metadata.VerticalDatumTypes;
-import org.apache.sis.metadata.iso.citation.Citations;
+import org.apache.sis.metadata.iso.citation.HardCodedCitations;
import static org.opengis.referencing.datum.Datum.*;
@@ -174,7 +174,7 @@ public final strictfp class HardCodedDat
final Map<String,Object> properties = new HashMap<>(4);
properties.put(NAME_KEY, name);
if (code != null) {
- properties.put(IDENTIFIERS_KEY, new NamedIdentifier(Citations.EPSG, code));
+ properties.put(IDENTIFIERS_KEY, new NamedIdentifier(HardCodedCitations.EPSG, code));
}
if (scope != null) {
properties.put(SCOPE_KEY, scope);
Modified: sis/branches/JDK7/core/sis-utility/pom.xml
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-utility/pom.xml?rev=1690101&r1=1690100&r2=1690101&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-utility/pom.xml (original)
+++ sis/branches/JDK7/core/sis-utility/pom.xml Thu Jul 9 13:31:00 2015
@@ -134,7 +134,7 @@ Miscellaneous utilities.
<artifactId>maven-bundle-plugin</artifactId>
<configuration>
<instructions>
- <Bundle-SymbolicName>org.apache.sis.utility</Bundle-SymbolicName>
+ <Bundle-SymbolicName>org.apache.sis.util</Bundle-SymbolicName>
<Bundle-Activator>org.apache.sis.internal.system.OSGiActivator</Bundle-Activator>
</instructions>
</configuration>
Modified: sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/Context.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/Context.java?rev=1690101&r1=1690100&r2=1690101&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/Context.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/Context.java [UTF-8] Thu Jul 9 13:31:00 2015
@@ -30,6 +30,7 @@ import org.apache.sis.util.resources.Err
import org.apache.sis.util.resources.Messages;
import org.apache.sis.util.resources.IndexedResourceBundle;
import org.apache.sis.internal.system.Semaphores;
+import org.apache.sis.internal.system.Loggers;
import org.apache.sis.xml.MarshalContext;
import org.apache.sis.xml.ValueConverter;
import org.apache.sis.xml.ReferenceResolver;
@@ -103,7 +104,7 @@ public final class Context extends Marsh
*
* @see org.apache.sis.metadata.iso.ISOMetadata#LOGGER
*/
- public static final Logger LOGGER = Logging.getLogger("org.apache.sis.xml");
+ public static final Logger LOGGER = Logging.getLogger(Loggers.XML);
/**
* Various boolean attributes determines by the above static constants.
@@ -390,7 +391,6 @@ public final class Context extends Marsh
* message from the {@code exception}.</p>
*
* @param context The current context, or {@code null} if none.
- * @param logger The logger where to send the warning.
* @param level The logging level.
* @param classe The class to declare as the warning source.
* @param method The name of the method to declare as the warning source.
@@ -401,7 +401,7 @@ public final class Context extends Marsh
*
* @since 0.5
*/
- public static void warningOccured(final Context context, final Logger logger,
+ public static void warningOccured(final Context context,
final Level level, final Class<?> classe, final String method, final Throwable exception,
final Class<? extends IndexedResourceBundle> resources, final short key, final Object... arguments)
{
@@ -422,7 +422,7 @@ public final class Context extends Marsh
}
record.setSourceClassName(classe.getCanonicalName());
record.setSourceMethodName(method);
- record.setLoggerName(logger.getName());
+ record.setLoggerName(Loggers.XML);
if (context != null) {
final WarningListener<?> warningListener = context.warningListener;
if (warningListener != null) {
@@ -435,7 +435,7 @@ public final class Context extends Marsh
* Log the warning without stack-trace, since this method shall be used
* only for non-fatal warnings and we want to avoid polluting the logs.
*/
- logger.log(record);
+ LOGGER.log(record);
}
/**
@@ -443,7 +443,6 @@ public final class Context extends Marsh
* resources. The message will be logged at {@link Level#WARNING}.
*
* @param context The current context, or {@code null} if none.
- * @param logger The logger where to send the warning.
* @param classe The class to declare as the warning source.
* @param method The name of the method to declare as the warning source.
* @param resources Either {@code Errors.class} or {@code Messages.class}.
@@ -452,11 +451,10 @@ public final class Context extends Marsh
*
* @since 0.5
*/
- public static void warningOccured(final Context context, final Logger logger,
- final Class<?> classe, final String method,
+ public static void warningOccured(final Context context, final Class<?> classe, final String method,
final Class<? extends IndexedResourceBundle> resources, final short key, final Object... arguments)
{
- warningOccured(context, logger, Level.WARNING, classe, method, null, resources, key, arguments);
+ warningOccured(context, Level.WARNING, classe, method, null, resources, key, arguments);
}
/**
@@ -472,7 +470,7 @@ public final class Context extends Marsh
public static void warningOccured(final Context context, final Class<?> classe,
final String method, final Exception cause, final boolean warning)
{
- warningOccured(context, LOGGER, warning ? Level.WARNING : Level.FINE, classe, method, cause,
+ warningOccured(context, warning ? Level.WARNING : Level.FINE, classe, method, cause,
null, (short) 0, (Object[]) null);
}
Modified: sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/SpecializedIdentifier.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/SpecializedIdentifier.java?rev=1690101&r1=1690100&r2=1690101&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/SpecializedIdentifier.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/SpecializedIdentifier.java [UTF-8] Thu Jul 9 13:31:00 2015
@@ -151,7 +151,7 @@ public final class SpecializedIdentifier
* @param cause The exception that occurred during the parsing process.
*/
static void parseFailure(final Context context, final String value, final Class<?> type, final Exception cause) {
- Context.warningOccured(context, Context.LOGGER, Level.WARNING, IdentifierMap.class, "put", cause,
+ Context.warningOccured(context, Level.WARNING, IdentifierMap.class, "put", cause,
Messages.class, Messages.Keys.UnparsableValueStoredAsText_2, type, value);
}
Modified: sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/GO_CharacterString.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/GO_CharacterString.java?rev=1690101&r1=1690100&r2=1690101&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/GO_CharacterString.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/GO_CharacterString.java [UTF-8] Thu Jul 9 13:31:00 2015
@@ -139,7 +139,7 @@ public class GO_CharacterString {
property = type;
noset = true;
}
- Context.warningOccured(Context.current(), Context.LOGGER, getClass(), "setText", Messages.class,
+ Context.warningOccured(Context.current(), getClass(), "setText", Messages.class,
Messages.Keys.DiscardedExclusiveProperty_2, nameOf(discarded), nameOf(property));
if (noset) {
return;
Modified: sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/Measure.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/Measure.java?rev=1690101&r1=1690100&r2=1690101&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/Measure.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/Measure.java [UTF-8] Thu Jul 9 13:31:00 2015
@@ -206,7 +206,7 @@ public final class Measure {
* @param methodName The name of the method invoking this method.
*/
public static void missingUOM(final Class<?> caller, final String methodName) {
- Context.warningOccured(Context.current(), Context.LOGGER, caller, methodName,
+ Context.warningOccured(Context.current(), caller, methodName,
Errors.class, Errors.Keys.MandatoryAttribute_2, "uom", "Measure");
}
}
Modified: sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/ObjectReference.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/ObjectReference.java?rev=1690101&r1=1690100&r2=1690101&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/ObjectReference.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/ObjectReference.java [UTF-8] Thu Jul 9 13:31:00 2015
@@ -148,7 +148,7 @@ final class ObjectReference {
if (value != null) {
final T previous = map.putSpecialized(authority, value);
if (previous != null && !previous.equals(value)) {
- Context.warningOccured(context, Context.LOGGER, IdentifierMap.class, "putSpecialized",
+ Context.warningOccured(context, IdentifierMap.class, "putSpecialized",
Errors.class, Errors.Keys.InconsistentAttribute_2, authority.getName(), value);
map.putSpecialized(authority, previous);
}
Modified: sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gmd/Country.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gmd/Country.java?rev=1690101&r1=1690100&r2=1690101&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gmd/Country.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gmd/Country.java [UTF-8] Thu Jul 9 13:31:00 2015
@@ -148,7 +148,7 @@ public final class Country extends GO_Ch
if (++i == code.length() || code.charAt(i) == '_') {
code = new StringBuilder().append(code, 0, i).append(c).append(code, i, length).toString();
} else if (!c.equals(CharSequences.token(code, i))) {
- Context.warningOccured(context, Context.LOGGER, caller, "unmarshal", Errors.class,
+ Context.warningOccured(context, caller, "unmarshal", Errors.class,
Errors.Keys.IncompatiblePropertyValue_1, "country");
}
}