sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject svn commit: r1759517 - in /sis/branches/JDK8: core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/ core/sis-utility/src/main/java/org/apache/sis/internal/util/ storage/sis-earth-observation/src/main/java/org/apache/sis/storage/eartho...
Date Tue, 06 Sep 2016 21:32:15 GMT
Author: desruisseaux
Date: Tue Sep  6 21:32:15 2016
New Revision: 1759517

URL: http://svn.apache.org/viewvc?rev=1759517&view=rev
Log:
Construct the map projection (UTM or Polar Stereographic) from Landsat metadata.

Added:
    sis/branches/JDK8/storage/sis-storage/src/main/java/org/apache/sis/storage/DataStoreReferencingException.java
  (with props)
Modified:
    sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/ReferencingUtilities.java
    sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/internal/util/Constants.java
    sis/branches/JDK8/storage/sis-earth-observation/src/main/java/org/apache/sis/storage/earthobservation/LandsatReader.java
    sis/branches/JDK8/storage/sis-earth-observation/src/main/java/org/apache/sis/storage/earthobservation/LandsatStore.java
    sis/branches/JDK8/storage/sis-earth-observation/src/main/java/org/apache/sis/storage/earthobservation/doc-files/LandsatMetadata.html
    sis/branches/JDK8/storage/sis-earth-observation/src/test/java/org/apache/sis/storage/earthobservation/LandsatReaderTest.java
    sis/branches/JDK8/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/MetadataBuilder.java
    sis/branches/JDK8/storage/sis-storage/src/main/java/org/apache/sis/storage/DataStoreClosedException.java
    sis/branches/JDK8/storage/sis-storage/src/main/java/org/apache/sis/storage/DataStoreContentException.java

Modified: sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/ReferencingUtilities.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/ReferencingUtilities.java?rev=1759517&r1=1759516&r2=1759517&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/ReferencingUtilities.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/ReferencingUtilities.java
[UTF-8] Tue Sep  6 21:32:15 2016
@@ -24,11 +24,15 @@ import javax.measure.quantity.Angle;
 import org.opengis.annotation.UML;
 import org.opengis.annotation.Specification;
 import org.opengis.metadata.Identifier;
+import org.opengis.parameter.ParameterValueGroup;
 import org.opengis.referencing.cs.*;
 import org.opengis.referencing.crs.*;
 import org.opengis.referencing.IdentifiedObject;
 import org.opengis.referencing.datum.Ellipsoid;
 import org.opengis.referencing.datum.PrimeMeridian;
+import org.opengis.referencing.operation.CoordinateOperationFactory;
+import org.opengis.util.FactoryException;
+import org.apache.sis.internal.system.DefaultFactories;
 import org.apache.sis.util.Static;
 import org.apache.sis.util.Utilities;
 import org.apache.sis.util.CharSequences;
@@ -51,7 +55,7 @@ import static java.util.Collections.sing
  *
  * @author  Martin Desruisseaux (IRD, Geomatys)
  * @since   0.5
- * @version 0.7
+ * @version 0.8
  * @module
  */
 public final class ReferencingUtilities extends Static {
@@ -370,4 +374,26 @@ public final class ReferencingUtilities
         }
         return context;
     }
+
+    /**
+     * Creates a projected CRS from the given parameters using the default factories.
+     *
+     * @param  properties   the name and other properties, to be given both to the conversion
and the CRS.
+     * @param  baseCRS      the base geographic CRS.
+     * @param  parameters   the map projection parameters.
+     * @param  cs           the projected coordinate system.
+     * @return the projected coordinate reference system.
+     * @throws FactoryException if an error occurred while creating the CRS.
+     *
+     * @since 0.8
+     */
+    public static ProjectedCRS createProjectedCRS(final Map<String,String> properties,
+            final GeographicCRS baseCRS, final ParameterValueGroup parameters, final CartesianCS
cs)
+            throws FactoryException
+    {
+        final CoordinateOperationFactory factory = DefaultFactories.forBuildin(CoordinateOperationFactory.class);
+        return DefaultFactories.forBuildin(CRSFactory.class).createProjectedCRS(properties,
baseCRS,
+                factory.createDefiningConversion(properties,
+                        factory.getOperationMethod(parameters.getDescriptor().getName().getCode()),
parameters), cs);
+    }
 }

Modified: sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/internal/util/Constants.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/internal/util/Constants.java?rev=1759517&r1=1759516&r2=1759517&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/internal/util/Constants.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/internal/util/Constants.java
[UTF-8] Tue Sep  6 21:32:15 2016
@@ -199,6 +199,18 @@ public final class Constants extends Sta
     public static final short EPSG_AXIS_DEGREES = 9122;
 
     /**
+     * EPSG code of "WGS 84 / Arctic Polar Stereographic" projection.
+     * Latitude of standard parallel is 71°N. All other parameters are zero.
+     */
+    public static final short EPSG_ARCTIC_POLAR_STEREOGRAPHIC = 3995;
+
+    /**
+     * EPSG code of "WGS 84 / Antarctic Polar Stereographic" projection.
+     * Latitude of standard parallel is 71°S. All other parameters are zero.
+     */
+    public static final short EPSG_ANTARCTIC_POLAR_STEREOGRAPHIC = 3031;
+
+    /**
      * Do not allow instantiation of this class.
      */
     private Constants() {

Modified: sis/branches/JDK8/storage/sis-earth-observation/src/main/java/org/apache/sis/storage/earthobservation/LandsatReader.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/storage/sis-earth-observation/src/main/java/org/apache/sis/storage/earthobservation/LandsatReader.java?rev=1759517&r1=1759516&r2=1759517&view=diff
==============================================================================
--- sis/branches/JDK8/storage/sis-earth-observation/src/main/java/org/apache/sis/storage/earthobservation/LandsatReader.java
[UTF-8] (original)
+++ sis/branches/JDK8/storage/sis-earth-observation/src/main/java/org/apache/sis/storage/earthobservation/LandsatReader.java
[UTF-8] Tue Sep  6 21:32:15 2016
@@ -19,12 +19,14 @@ package org.apache.sis.storage.earthobse
 import java.io.BufferedReader;
 import java.io.IOException;
 import java.util.Arrays;
+import java.util.Collections;
 import java.util.Date;
 import java.util.Locale;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 import java.io.LineNumberReader;
 import javax.measure.unit.SI;
+import javax.measure.unit.NonSI;
 
 import org.opengis.metadata.Metadata;
 import org.opengis.metadata.citation.Citation;
@@ -34,6 +36,11 @@ import org.opengis.metadata.content.Cove
 import org.opengis.metadata.content.TransferFunctionType;
 import org.opengis.metadata.identification.Identification;
 import org.opengis.metadata.maintenance.ScopeCode;
+import org.opengis.parameter.ParameterValueGroup;
+import org.opengis.referencing.crs.ProjectedCRS;
+import org.opengis.referencing.operation.MathTransformFactory;
+import org.opengis.util.NoSuchIdentifierException;
+import org.opengis.util.FactoryException;
 
 import org.apache.sis.metadata.iso.DefaultMetadata;
 import org.apache.sis.metadata.iso.DefaultIdentifier;
@@ -41,14 +48,23 @@ import org.apache.sis.metadata.iso.citat
 import org.apache.sis.metadata.iso.content.DefaultAttributeGroup;
 import org.apache.sis.metadata.iso.content.DefaultBand;
 import org.apache.sis.metadata.iso.content.DefaultCoverageDescription;
+import org.apache.sis.referencing.CRS;
+import org.apache.sis.referencing.CommonCRS;
 import org.apache.sis.storage.DataStoreException;
+import org.apache.sis.storage.DataStoreReferencingException;
+import org.apache.sis.util.Characters;
 import org.apache.sis.util.CharSequences;
 import org.apache.sis.util.resources.Errors;
 import org.apache.sis.util.resources.Vocabulary;
 import org.apache.sis.util.logging.WarningListeners;
 import org.apache.sis.util.iso.SimpleInternationalString;
+import org.apache.sis.internal.referencing.ReferencingUtilities;
+import org.apache.sis.internal.referencing.provider.PolarStereographicB;
+import org.apache.sis.internal.referencing.provider.TransverseMercator;
 import org.apache.sis.internal.storage.MetadataBuilder;
+import org.apache.sis.internal.system.DefaultFactories;
 import org.apache.sis.internal.util.StandardDateFormat;
+import org.apache.sis.internal.util.Constants;
 
 import static java.util.Collections.singleton;
 import static org.apache.sis.internal.util.CollectionsExt.singletonOrNull;
@@ -263,6 +279,23 @@ final class LandsatReader {
     private final DefaultBand[] bands;
 
     /**
+     * The enumeration for the {@code "DATUM"} element, to be used for creating the Coordinate
Reference System.
+     */
+    private CommonCRS datum;
+
+    /**
+     * The Universal Transverse Mercator (UTM) zone as a number from 1 to 60 inclusive, or
0 if the zone has not
+     * yet been determined. If the parser determined that the projection is Polar Stereographic,
then this field
+     * is set to -1.
+     */
+    private short utmZone;
+
+    /**
+     * The map projection parameters. This is used only for the polar stereographic case.
+     */
+    private ParameterValueGroup projection;
+
+    /**
      * Creates a new metadata parser.
      *
      * @param  filename   an identifier of the file being read, or {@code null} if unknown.
@@ -353,6 +386,17 @@ final class LandsatReader {
     }
 
     /**
+     * Parses the given string as a {@code double} value, returning a shared instance if
possible.
+     *
+     * @param   value  the string value to parse.
+     * @return  the parsed value.
+     * @throws  NumberFormatException if the given value can not be parsed.
+     */
+    private Double parseDouble(final String value) throws NumberFormatException {
+        return metadata.shared(Double.valueOf(value));
+    }
+
+    /**
      * Parses the given value and stores it at the given index in the {@link #corners} array.
      * The given index must be one of the {@link #PROJECTED} or {@link #GEOGRAPHIC} constants
      * plus the ordinate index.
@@ -385,7 +429,7 @@ final class LandsatReader {
      * @throws IllegalArgumentException if the value is out of range.
      */
     private void parseKeyValuePair(final String key, final int band, final String value)
-            throws IllegalArgumentException, DateTimeException
+            throws IllegalArgumentException, DateTimeException, DataStoreException
     {
         switch (key) {
             case "GROUP": {
@@ -630,7 +674,7 @@ final class LandsatReader {
              * This parameter is only present if this band is included in the product.
              */
             case "QUANTIZE_CAL_MIN_BAND_": {
-                final Double v = metadata.parseDouble(value);       // Done first in case
an exception is thrown.
+                final Double v = parseDouble(value);        // Done first in case an exception
is thrown.
                 final DefaultBand db = band(key, band);
                 if (db != null) {
                     db.setMinValue(v);
@@ -642,7 +686,7 @@ final class LandsatReader {
              * This parameter is only present if this band is included in the product.
              */
             case "QUANTIZE_CAL_MAX_BAND_": {
-                final Double v = metadata.parseDouble(value);       // Done first in case
an exception is thrown.
+                final Double v = parseDouble(value);        // Done first in case an exception
is thrown.
                 final DefaultBand db = band(key, band);
                 if (db != null) {
                     db.setMaxValue(v);
@@ -670,6 +714,62 @@ final class LandsatReader {
                 setTransferFunction(key, band, false, value);
                 break;
             }
+
+            ////
+            //// GROUP = PROJECTION_PARAMETERS
+            ////
+
+            /*
+             * The map projection used in creating the image.
+             * Universal Transverse Mercator (UTM) or Polar Stereographic (PS).
+             */
+            case "MAP_PROJECTION": {
+                if ("UTM".equalsIgnoreCase(value)) {
+                    projection = null;
+                } else if ("PS".equalsIgnoreCase(value)) try {
+                    projection = DefaultFactories.forBuildin(MathTransformFactory.class)
+                                    .getDefaultParameters(Constants.EPSG + ':' + PolarStereographicB.IDENTIFIER);
+                    utmZone = -1;
+                } catch (NoSuchIdentifierException e) {
+                    // Should never happen with Apache SIS implementation of MathTransformFactory.
+                    throw new DataStoreReferencingException(e);
+                }
+                break;
+            }
+            /*
+             * The datum used in creating the image. This is usually "WGS84".
+             * We ignore the "ELLIPSOID" attribute because it is implied by the datum.
+             */
+            case "DATUM": {
+                for (final CommonCRS c : CommonCRS.values()) {
+                    if (CharSequences.equalsFiltered(c.name(), value, Characters.Filter.LETTERS_AND_DIGITS,
true)) {
+                        datum = c;
+                        return;
+                    }
+                }
+                listeners.warning(errors().getString(Errors.Keys.UnexpectedValueInElement_2,
value, key), null);
+                break;
+            }
+            /*
+             * The value used to indicate the zone number. This parameter is only included
for the UTM projection.
+             * If this parameter is defined more than once (which should be illegal), only
the first occurrence is
+             * retained. If the projection is polar stereographic, the parameter is ignored.
+             */
+            case "UTM_ZONE": {
+                if (utmZone == 0) {
+                    utmZone = Short.parseShort(value);
+                }
+                break;
+            }
+            /*
+             * Polar Stereographic projection parameters. Most parameters do not vary, except
the latitude of
+             * true scale which is -71 for scenes over Antarctica and 71 for off-nadir scenes
at the North Pole.
+             * If the datum is WGS84, then this is equivalent to EPSG:3031 and EPSG:3995
respectively.
+             */
+            case "VERTICAL_LON_FROM_POLE": setProjectionParameter(key, Constants.CENTRAL_MERIDIAN,
   value, false); break;
+            case "TRUE_SCALE_LAT":         setProjectionParameter(key, Constants.STANDARD_PARALLEL_1,
value, false); break;
+            case "FALSE_EASTING":          setProjectionParameter(key, Constants.FALSE_EASTING,
      value, true);  break;
+            case "FALSE_NORTHING":         setProjectionParameter(key, Constants.FALSE_NORTHING,
     value, true);  break;
         }
     }
 
@@ -682,7 +782,7 @@ final class LandsatReader {
      * @param  value    the value to set.
      */
     private void setTransferFunction(final String key, final int band, final boolean isScale,
final String value) {
-        final Double v = metadata.parseDouble(value);       // Done first in case an exception
is thrown.
+        final Double v = parseDouble(value);            // Done first in case an exception
is thrown.
         final DefaultBand db = band(key, band);
         if (db != null) {
             db.setTransferFunctionType(TransferFunctionType.LINEAR);
@@ -718,6 +818,22 @@ final class LandsatReader {
     }
 
     /**
+     * Sets a map projection parameter. The parameter is ignored if the projection has not
been set.
+     *
+     * @param key       the Landsat key, for formatting error message if needed.
+     * @param name      the projection parameter name.
+     * @param value     the parameter value.
+     * @param isLinear  {@code true} for value in metres, or {@code false} for value in degrees.
+     */
+    private void setProjectionParameter(final String key, final String name, final String
value, final boolean isLinear) {
+        if (projection != null) {
+            projection.parameter(name).setValue(Double.parseDouble(value), isLinear ? SI.METRE
: NonSI.DEGREE_ANGLE);
+        } else {
+            listeners.warning(errors().getString(Errors.Keys.UnexpectedParameter_1, key),
null);
+        }
+    }
+
+    /**
      * Writes the value of {@link #sceneTime} into the metadata object as a temporal extent.
      *
      * @throws DateTimeException if {@link #sceneTime} is an instance of {@link OffsetTime}.
This may
@@ -771,8 +887,10 @@ final class LandsatReader {
     /**
      * Returns the metadata about the resources described in the Landsat file.
      * The {@link #read(BufferedReader)} method must be invoked at least once before.
+     *
+     * @throws FactoryException if an error occurred while creating the Coordinate Reference
System.
      */
-    final Metadata getMetadata() {
+    final Metadata getMetadata() throws FactoryException {
         metadata.add(Locale.ENGLISH);
         metadata.add(ScopeCode.DATASET);
         try {
@@ -782,6 +900,32 @@ final class LandsatReader {
             warning(null, null, e);
         }
         /*
+         * Create the Coordinate Reference System. We normally have only one of UTM or Polar
Stereographic,
+         * but this block is nevertheless capable to take both (such metadata are likely
to be invalid, but
+         * we can not guess which of the two CRS is correct).
+         */
+        if (datum != null) {
+            if (utmZone > 0) {
+                metadata.add(datum.UTM(1, TransverseMercator.centralMeridian(utmZone)));
+            }
+            if (projection != null) {
+                final double sp = projection.parameter(Constants.STANDARD_PARALLEL_1).doubleValue();
+                ProjectedCRS crs = (ProjectedCRS) CRS.forCode(Constants.EPSG + ":" +
+                        (sp >= 0 ? Constants.EPSG_ARCTIC_POLAR_STEREOGRAPHIC         //
Standard parallel = 71°N
+                                 : Constants.EPSG_ANTARCTIC_POLAR_STEREOGRAPHIC));   // Standard
parallel = 71°S
+                if (datum != CommonCRS.WGS84 || Math.abs(sp) != 71
+                        || projection.parameter(Constants.FALSE_EASTING)   .doubleValue()
!= 0
+                        || projection.parameter(Constants.FALSE_NORTHING)  .doubleValue()
!= 0
+                        || projection.parameter(Constants.CENTRAL_MERIDIAN).doubleValue()
!= 0)
+                {
+                    crs = ReferencingUtilities.createProjectedCRS(
+                            Collections.singletonMap(ProjectedCRS.NAME_KEY, "Polar stereographic"),
+                            datum.geographic(), projection, crs.getCoordinateSystem());
+                }
+                metadata.add(crs);
+            }
+        }
+        /*
          * Set information about envelope (or geographic area) and grid size.
          */
         if (toBoundingBox(GEOGRAPHIC)) {

Modified: sis/branches/JDK8/storage/sis-earth-observation/src/main/java/org/apache/sis/storage/earthobservation/LandsatStore.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/storage/sis-earth-observation/src/main/java/org/apache/sis/storage/earthobservation/LandsatStore.java?rev=1759517&r1=1759516&r2=1759517&view=diff
==============================================================================
--- sis/branches/JDK8/storage/sis-earth-observation/src/main/java/org/apache/sis/storage/earthobservation/LandsatStore.java
[UTF-8] (original)
+++ sis/branches/JDK8/storage/sis-earth-observation/src/main/java/org/apache/sis/storage/earthobservation/LandsatStore.java
[UTF-8] Tue Sep  6 21:32:15 2016
@@ -21,8 +21,10 @@ import java.io.BufferedReader;
 import java.io.LineNumberReader;
 import java.io.IOException;
 import org.opengis.metadata.Metadata;
+import org.opengis.util.FactoryException;
 import org.apache.sis.storage.DataStore;
 import org.apache.sis.storage.DataStoreException;
+import org.apache.sis.storage.DataStoreReferencingException;
 import org.apache.sis.storage.StorageConnector;
 import org.apache.sis.util.resources.Errors;
 import org.apache.sis.util.ArgumentChecks;
@@ -115,6 +117,8 @@ public class LandsatStore extends DataSt
             }
         } catch (IOException e) {
             throw new DataStoreException(e);
+        } catch (FactoryException e) {
+            throw new DataStoreReferencingException(e);
         }
         return metadata;
     }

Modified: sis/branches/JDK8/storage/sis-earth-observation/src/main/java/org/apache/sis/storage/earthobservation/doc-files/LandsatMetadata.html
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/storage/sis-earth-observation/src/main/java/org/apache/sis/storage/earthobservation/doc-files/LandsatMetadata.html?rev=1759517&r1=1759516&r2=1759517&view=diff
==============================================================================
--- sis/branches/JDK8/storage/sis-earth-observation/src/main/java/org/apache/sis/storage/earthobservation/doc-files/LandsatMetadata.html
(original)
+++ sis/branches/JDK8/storage/sis-earth-observation/src/main/java/org/apache/sis/storage/earthobservation/doc-files/LandsatMetadata.html
Tue Sep  6 21:32:15 2016
@@ -134,6 +134,7 @@
       <tr><td><code>  │   └─</code>Axis
dimension properties (2 of 2)</td><td></td>                            
                    <td></td></tr>
       <tr><td><code>  │       ├─</code>Dimension
name</td>                <td>Line</td>                                 
           <td></td></tr>
       <tr><td><code>  │       └─</code>Dimension
size</td>                <td><code class="rf">THERMAL_LINES</code></td>
           <td></td></tr>
+      <tr><td><code>  ├─</code>Reference system info</td>
                <td><code class="rf">MAP_PROJECTION</code>, <i>etc.</i></td><td>UTM
or polar stereographic projection built from up to 8 elements.</td></tr>
       <tr><td><code>  ├─</code>Identification info</td>
                  <td></td>                                                 <td></td></tr>
       <tr><td><code>  │   ├─</code>Citation</td>
                         <td></td>                                           
     <td></td></tr>
       <tr><td><code>  │   │   ├─</code>Date:</td>
                        <td><code class="rf">FILE_DATE</code></td>
               <td>The date when metadata file product set was created.</td></tr>

Modified: sis/branches/JDK8/storage/sis-earth-observation/src/test/java/org/apache/sis/storage/earthobservation/LandsatReaderTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/storage/sis-earth-observation/src/test/java/org/apache/sis/storage/earthobservation/LandsatReaderTest.java?rev=1759517&r1=1759516&r2=1759517&view=diff
==============================================================================
--- sis/branches/JDK8/storage/sis-earth-observation/src/test/java/org/apache/sis/storage/earthobservation/LandsatReaderTest.java
[UTF-8] (original)
+++ sis/branches/JDK8/storage/sis-earth-observation/src/test/java/org/apache/sis/storage/earthobservation/LandsatReaderTest.java
[UTF-8] Tue Sep  6 21:32:15 2016
@@ -22,6 +22,7 @@ import java.io.BufferedReader;
 import java.io.IOException;
 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.DataStoreException;
 import org.apache.sis.util.logging.EmptyWarningListeners;
@@ -77,9 +78,10 @@ public class LandsatReaderTest extends T
      *
      * @throws IOException if an error occurred while reading the test file.
      * @throws DataStoreException if a property value can not be parsed as a number or a
date.
+     * @throws FactoryException if an error occurred while creating the Coordinate Reference
System.
      */
     @Test
-    public void testRead() throws IOException, DataStoreException {
+    public void testRead() throws IOException, DataStoreException, FactoryException {
         final Metadata actual;
         try (BufferedReader in = new BufferedReader(new InputStreamReader(
                 LandsatReaderTest.class.getResourceAsStream("LandsatTest.txt"), "UTF-8")))
@@ -120,6 +122,7 @@ public class LandsatReaderTest extends T
                 + "  │   │   ├─Dimension name………………………………………………………
Line\n"
                 + "  │   │   └─Dimension size………………………………………………………
7800\n"
                 + "  │   └─Transformation parameter availability…… false\n"
+                + "  ├─Reference system info…………………………………………………………
EPSG:WGS 84 / UTM zone 49N\n"
                 + "  ├─Identification info\n"
                 + "  │   ├─Citation\n"
                 + "  │   │   ├─Date\n"

Modified: sis/branches/JDK8/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/MetadataBuilder.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/MetadataBuilder.java?rev=1759517&r1=1759516&r2=1759517&view=diff
==============================================================================
--- sis/branches/JDK8/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/MetadataBuilder.java
[UTF-8] (original)
+++ sis/branches/JDK8/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/MetadataBuilder.java
[UTF-8] Tue Sep  6 21:32:15 2016
@@ -1243,30 +1243,27 @@ parse:      for (int i = 0; i < length;)
     }
 
     /**
-     * Parses the given {@code double} value, returning a shared instance if possible.
+     * Returns a shared instance of the given value.
      * This is a helper method for callers who want to set themselves some additional
      * metadata values on the instance returned by {@link #build(boolean)}.
      *
-     * @param   value  the string value to parse.
-     * @return  the parsed value.
-     * @throws  NumberFormatException if the given value can not be parsed.
+     * @param   value  a double value.
+     * @return  the same value, but as an existing instance if possible.
      */
-    public final Double parseDouble(final String value) throws NumberFormatException {
-        return shared(Double.valueOf(value));
-    }
-
-    /**
-     * Returns a shared instance of the given value.
-     */
-    private Double shared(final Double value) {
+    public final Double shared(final Double value) {
         final Number existing = sharedNumbers.putIfAbsent(value, value);
         return (existing != null) ? (Double) existing : value;
     }
 
     /**
      * Returns a shared instance of the given value.
+     * This is a helper method for callers who want to set themselves some additional
+     * metadata values on the instance returned by {@link #build(boolean)}.
+     *
+     * @param   value  an integer value.
+     * @return  the same value, but as an existing instance if possible.
      */
-    private Integer shared(final Integer value) {
+    public final Integer shared(final Integer value) {
         final Number existing = sharedNumbers.putIfAbsent(value, value);
         return (existing != null) ? (Integer) existing : value;
     }

Modified: sis/branches/JDK8/storage/sis-storage/src/main/java/org/apache/sis/storage/DataStoreClosedException.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/storage/sis-storage/src/main/java/org/apache/sis/storage/DataStoreClosedException.java?rev=1759517&r1=1759516&r2=1759517&view=diff
==============================================================================
--- sis/branches/JDK8/storage/sis-storage/src/main/java/org/apache/sis/storage/DataStoreClosedException.java
[UTF-8] (original)
+++ sis/branches/JDK8/storage/sis-storage/src/main/java/org/apache/sis/storage/DataStoreClosedException.java
[UTF-8] Tue Sep  6 21:32:15 2016
@@ -18,7 +18,7 @@ package org.apache.sis.storage;
 
 
 /**
- * Thrown when a Data store is closed and can no more return data.
+ * Thrown when a data store is closed and can no more return data.
  *
  * @author  Marc Le Bihan
  * @version 0.6
@@ -26,23 +26,25 @@ package org.apache.sis.storage;
  * @module
  */
 public class DataStoreClosedException extends DataStoreException {
-    /** Serial UID. */
+    /**
+     * For cross-version compatibility.
+     */
     private static final long serialVersionUID = 7205119080377665796L;
 
     /**
-     * Constructs an exception with the specified details message.
+     * Creates an exception with the specified details message.
      *
-     * @param message Message of the exception.
+     * @param message  the detail message of the exception.
      */
     public DataStoreClosedException(String message) {
         super(message);
     }
 
     /**
-     * Constructs an exception with the specified details message and cause.
+     * Creates an exception with the specified details message and cause.
      *
-     * @param message Message of the exception.
-     * @param cause Root cause of the exception.
+     * @param message  the detail message of the exception.
+     * @param cause    the cause root for the exception.
      */
     public DataStoreClosedException(String message, Throwable cause) {
         super(message, cause);

Modified: sis/branches/JDK8/storage/sis-storage/src/main/java/org/apache/sis/storage/DataStoreContentException.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/storage/sis-storage/src/main/java/org/apache/sis/storage/DataStoreContentException.java?rev=1759517&r1=1759516&r2=1759517&view=diff
==============================================================================
--- sis/branches/JDK8/storage/sis-storage/src/main/java/org/apache/sis/storage/DataStoreContentException.java
[UTF-8] (original)
+++ sis/branches/JDK8/storage/sis-storage/src/main/java/org/apache/sis/storage/DataStoreContentException.java
[UTF-8] Tue Sep  6 21:32:15 2016
@@ -49,7 +49,7 @@ public class DataStoreContentException e
     }
 
     /**
-     * Creates an exception with the specified cause.
+     * Creates an exception with the specified cause and no details message.
      *
      * @param cause  the cause for this exception.
      */

Added: sis/branches/JDK8/storage/sis-storage/src/main/java/org/apache/sis/storage/DataStoreReferencingException.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/storage/sis-storage/src/main/java/org/apache/sis/storage/DataStoreReferencingException.java?rev=1759517&view=auto
==============================================================================
--- sis/branches/JDK8/storage/sis-storage/src/main/java/org/apache/sis/storage/DataStoreReferencingException.java
(added)
+++ sis/branches/JDK8/storage/sis-storage/src/main/java/org/apache/sis/storage/DataStoreReferencingException.java
[UTF-8] Tue Sep  6 21:32:15 2016
@@ -0,0 +1,71 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.sis.storage;
+
+
+/**
+ * Thrown when a data store failed to construct the coordinate reference system (CRS)
+ * or other positioning information. This exception is typically (but not necessarily)
+ * caused by {@link org.opengis.referencing.FactoryException} or
+ * {@link org.opengis.referencing.operation.TransformException}.
+ *
+ * @author  Martin Desruisseaux (Geomatys)
+ * @since   0.8
+ * @version 0.8
+ * @module
+ */
+public class DataStoreReferencingException extends DataStoreException {
+    /**
+     * For cross-version compatibility.
+     */
+    private static final long serialVersionUID = 2671737996817267335L;
+
+    /**
+     * Creates an exception with no cause and no details message.
+     */
+    public DataStoreReferencingException() {
+        super();
+    }
+
+    /**
+     * Creates an exception with the specified details message.
+     *
+     * @param message  the detail message.
+     */
+    public DataStoreReferencingException(final String message) {
+        super(message);
+    }
+
+    /**
+     * Creates an exception with the specified cause and no details message.
+     *
+     * @param cause  the cause for this exception.
+     */
+    public DataStoreReferencingException(final Throwable cause) {
+        super(cause);
+    }
+
+    /**
+     * Creates an exception with the specified details message and cause.
+     *
+     * @param message  the detail message.
+     * @param cause    the cause for this exception.
+     */
+    public DataStoreReferencingException(final String message, final Throwable cause) {
+        super(message, cause);
+    }
+}

Propchange: sis/branches/JDK8/storage/sis-storage/src/main/java/org/apache/sis/storage/DataStoreReferencingException.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: sis/branches/JDK8/storage/sis-storage/src/main/java/org/apache/sis/storage/DataStoreReferencingException.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain;charset=UTF-8



Mime
View raw message