sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject svn commit: r1809390 [2/4] - in /sis/branches/JDK7: ./ application/ application/sis-console/ application/sis-console/src/main/artifact/ application/sis-console/src/main/artifact/lib/ application/sis-console/src/test/java/org/apache/sis/console/ core/si...
Date Sat, 23 Sep 2017 10:56:45 GMT
Modified: sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/logging/Logging.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/logging/Logging.java?rev=1809390&r1=1809389&r2=1809390&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/logging/Logging.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/logging/Logging.java [UTF-8] Sat Sep 23 10:56:44 2017
@@ -360,7 +360,7 @@ public final class Logging extends Stati
         }
         /*
          * Now prepare the log message. If we have been unable to figure out a source class and
-         * method name, we will fallback on JDK logging default mechanism, which may returns a
+         * method name, we will fallback on JDK logging default mechanism, which may return a
          * less relevant name than our attempt to use the logger name as the package name.
          *
          * The message is fetched using Exception.getMessage() instead than getLocalizedMessage()

Modified: sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/logging/QuietLogRecord.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/logging/QuietLogRecord.java?rev=1809390&r1=1809389&r2=1809390&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/logging/QuietLogRecord.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/logging/QuietLogRecord.java [UTF-8] Sat Sep 23 10:56:44 2017
@@ -24,7 +24,7 @@ import java.util.logging.LogRecord;
  * A log record to be logged without stack trace, unless the user specified it explicitely.
  *
  * @author  Martin Desruisseaux (Geomatys)
- * @version 0.3
+ * @version 0.8
  * @since   0.3
  * @module
  */
@@ -43,8 +43,8 @@ final class QuietLogRecord extends LogRe
     /**
      * Creates a new log record for the given message and exception.
      */
-    QuietLogRecord(final String message, final Exception exception) {
-        super(Level.WARNING, message);
+    QuietLogRecord(final Level level, final String message, final Exception exception) {
+        super(level, message);
         super.setThrown(exception);
     }
 

Modified: sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/logging/WarningListeners.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/logging/WarningListeners.java?rev=1809390&r1=1809389&r2=1809390&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/logging/WarningListeners.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/logging/WarningListeners.java [UTF-8] Sat Sep 23 10:56:44 2017
@@ -120,6 +120,18 @@ public class WarningListeners<S> impleme
     }
 
     /**
+     * Returns the source declared source of warnings.
+     * This value is specified at construction time.
+     *
+     * @return the declared source of warnings.
+     *
+     * @since 0.8
+     */
+    public S getSource() {
+        return source;
+    }
+
+    /**
      * The locale to use for formatting warning messages, or {@code null} for the default locale.
      * If the {@code source} object given to the constructor implements the {@link Localized} interface,
      * then this method delegates to its {@code getLocale()} method. Otherwise this method returns {@code null}.
@@ -191,6 +203,24 @@ public class WarningListeners<S> impleme
      * Reports a warning represented by the given message and exception.
      * At least one of {@code message} and {@code exception} shall be non-null.
      * If both are non-null, then the exception message will be concatenated after the given message.
+     * If the exception is non-null, its stack trace will be omitted at logging time for avoiding to
+     * pollute console output (keeping in mind that this method should be invoked only for non-fatal
+     * warnings). See {@linkplain #warning(Level, String, Exception) below} for more explanation.
+     *
+     * <p>This method is a shortcut for <code>{@linkplain #warning(Level, String, Exception)
+     * warning}({@linkplain Level#WARNING}, message, exception)</code>.
+     *
+     * @param message    the message to log, or {@code null} if none.
+     * @param exception  the exception to log, or {@code null} if none.
+     */
+    public void warning(String message, Exception exception) {
+        warning(Level.WARNING, message, exception);
+    }
+
+    /**
+     * Reports a warning at the given level represented by the given message and exception.
+     * At least one of {@code message} and {@code exception} shall be non-null.
+     * If both are non-null, then the exception message will be concatenated after the given message.
      *
      * <div class="section">Stack trace omission</div>
      * If there is no registered listener, then the {@link #warning(LogRecord)} method will send the record to the
@@ -204,10 +234,12 @@ public class WarningListeners<S> impleme
      *   <li>register a listener which will log the record itself.</li>
      * </ul>
      *
+     * @param level      the warning level.
      * @param message    the message to log, or {@code null} if none.
      * @param exception  the exception to log, or {@code null} if none.
      */
-    public void warning(String message, final Exception exception) {
+    public void warning(final Level level, String message, final Exception exception) {
+        ArgumentChecks.ensureNonNull("level", level);
         final LogRecord record;
         final StackTraceElement[] trace;
         if (exception != null) {
@@ -216,11 +248,11 @@ public class WarningListeners<S> impleme
             if (message == null) {
                 message = exception.toString();
             }
-            record = new QuietLogRecord(message, exception);
+            record = new QuietLogRecord(level, message, exception);
         } else {
             ArgumentChecks.ensureNonEmpty("message", message);
             trace = Thread.currentThread().getStackTrace();
-            record = new LogRecord(Level.WARNING, message);
+            record = new LogRecord(level, message);
         }
         for (final StackTraceElement e : trace) {
             if (isPublic(e)) {

Modified: sis/branches/JDK7/core/sis-utility/src/test/java/org/apache/sis/measure/UnitsTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-utility/src/test/java/org/apache/sis/measure/UnitsTest.java?rev=1809390&r1=1809389&r2=1809390&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-utility/src/test/java/org/apache/sis/measure/UnitsTest.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-utility/src/test/java/org/apache/sis/measure/UnitsTest.java [UTF-8] Sat Sep 23 10:56:44 2017
@@ -276,7 +276,7 @@ public final strictfp class UnitsTest ex
 
     /**
      * Tests {@link Units#valueOf(String)} with more advanced units.
-     * Those units are found in NetCDF files among others.
+     * Those units are found in netCDF files among others.
      */
     @Test
     public void testAdvancedValueOf() {

Modified: sis/branches/JDK7/ide-project/NetBeans/build.xml
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/ide-project/NetBeans/build.xml?rev=1809390&r1=1809389&r2=1809390&view=diff
==============================================================================
--- sis/branches/JDK7/ide-project/NetBeans/build.xml (original)
+++ sis/branches/JDK7/ide-project/NetBeans/build.xml Sat Sep 23 10:56:44 2017
@@ -228,6 +228,7 @@
       </fileset>
       <fileset dir="${project.root}/storage/sis-storage/src/test/resources">
         <include name="**/*.txt"/>
+        <include name="**/*.xml"/>
       </fileset>
       <fileset dir="${project.root}/storage/sis-xmlstore/src/test/resources">
         <include name="**/*.gpx"/>

Modified: sis/branches/JDK7/ide-project/NetBeans/nbproject/project.properties
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/ide-project/NetBeans/nbproject/project.properties?rev=1809390&r1=1809389&r2=1809390&view=diff
==============================================================================
--- sis/branches/JDK7/ide-project/NetBeans/nbproject/project.properties [ISO-8859-1] (original)
+++ sis/branches/JDK7/ide-project/NetBeans/nbproject/project.properties [ISO-8859-1] Sat Sep 23 10:56:44 2017
@@ -113,6 +113,7 @@ hamcrest.version     = 1.3
 jaxb-ns-mapper       = 2.2.4
 hsqldb.version       = 2.3.5
 postgresql.version   = 42.1.1.jre7
+icons.version        = 3.0.1
 
 #
 # Classpaths for compilation, execution and tests.

Modified: sis/branches/JDK7/pom.xml
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/pom.xml?rev=1809390&r1=1809389&r2=1809390&view=diff
==============================================================================
--- sis/branches/JDK7/pom.xml (original)
+++ sis/branches/JDK7/pom.xml Sat Sep 23 10:56:44 2017
@@ -459,7 +459,7 @@ Apache SIS is a free software, Java lang
       <dependency>
         <groupId>org.slf4j</groupId>
         <artifactId>slf4j-jdk14</artifactId>
-        <version>1.7.7</version>                <!-- Must matches the version used by NetCDF. -->
+        <version>1.7.7</version>                <!-- Must matches the version used by netCDF. -->
         <scope>runtime</scope>                  <!-- Should never be needed at compile time.  -->
       </dependency>
     </dependencies>

Modified: sis/branches/JDK7/storage/sis-earth-observation/src/main/java/org/apache/sis/storage/earthobservation/LandsatReader.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/storage/sis-earth-observation/src/main/java/org/apache/sis/storage/earthobservation/LandsatReader.java?rev=1809390&r1=1809389&r2=1809390&view=diff
==============================================================================
--- sis/branches/JDK7/storage/sis-earth-observation/src/main/java/org/apache/sis/storage/earthobservation/LandsatReader.java [UTF-8] (original)
+++ sis/branches/JDK7/storage/sis-earth-observation/src/main/java/org/apache/sis/storage/earthobservation/LandsatReader.java [UTF-8] Sat Sep 23 10:56:44 2017
@@ -465,7 +465,7 @@ final class LandsatReader {
              * Example: "LC81230522014071LGN00".
              */
             case "LANDSAT_SCENE_ID": {
-                metadata.addIdentifier(null, value, MetadataBuilder.Scope.ALL);
+                metadata.addTitleOrIdentifier(value, MetadataBuilder.Scope.ALL);
                 break;
             }
             /*

Modified: sis/branches/JDK7/storage/sis-earth-observation/src/test/java/org/apache/sis/storage/earthobservation/LandsatReaderTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/storage/sis-earth-observation/src/test/java/org/apache/sis/storage/earthobservation/LandsatReaderTest.java?rev=1809390&r1=1809389&r2=1809390&view=diff
==============================================================================
--- sis/branches/JDK7/storage/sis-earth-observation/src/test/java/org/apache/sis/storage/earthobservation/LandsatReaderTest.java [UTF-8] (original)
+++ sis/branches/JDK7/storage/sis-earth-observation/src/test/java/org/apache/sis/storage/earthobservation/LandsatReaderTest.java [UTF-8] Sat Sep 23 10:56:44 2017
@@ -114,10 +114,9 @@ public class LandsatReaderTest extends T
                 + "  │   └─Check point availability……………………………………… false\n"
                 + "  ├─Reference system info………………………………………………………… EPSG:WGS 84 / UTM zone 49N\n"
                 + "  ├─Identification info\n"
-                + "  │   ├─Citation\n"
-                + "  │   │   ├─Date………………………………………………………………………………… 2016-06-27 16:48:12\n"
-                + "  │   │   │   └─Date type………………………………………………………… Creation\n"
-                + "  │   │   └─Identifier………………………………………………………………… LandsatTest\n"
+                + "  │   ├─Citation………………………………………………………………………………… LandsatTest\n"
+                + "  │   │   └─Date………………………………………………………………………………… 2016-06-27 16:48:12\n"
+                + "  │   │       └─Date type………………………………………………………… Creation\n"
                 + "  │   ├─Credit……………………………………………………………………………………… Derived from U.S. Geological Survey data\n"
                 + "  │   ├─Resource format\n"
                 + "  │   │   └─Format specification citation……………… GeoTIFF Coverage Encoding Profile\n"

Modified: sis/branches/JDK7/storage/sis-gdal/src/main/java/org/apache/sis/storage/gdal/Proj4.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/storage/sis-gdal/src/main/java/org/apache/sis/storage/gdal/Proj4.java?rev=1809390&r1=1809389&r2=1809390&view=diff
==============================================================================
--- sis/branches/JDK7/storage/sis-gdal/src/main/java/org/apache/sis/storage/gdal/Proj4.java [UTF-8] (original)
+++ sis/branches/JDK7/storage/sis-gdal/src/main/java/org/apache/sis/storage/gdal/Proj4.java [UTF-8] Sat Sep 23 10:56:44 2017
@@ -188,9 +188,9 @@ public final class Proj4 extends Static
                         }
                     }
                     final String pn = name(parameter.getDescriptor());
-                    hasSemiMajor |= pn.equals("+a");
-                    hasSemiMinor |= pn.equals("+b");
-                    definition.append(' ').append(pn).append('=').append(value);
+                    hasSemiMajor |= pn.equals("a");
+                    hasSemiMinor |= pn.equals("b");
+                    definition.append(" +").append(pn).append('=').append(value);
                 }
             }
         }

Modified: sis/branches/JDK7/storage/sis-geotiff/src/main/java/org/apache/sis/storage/geotiff/GeoTiffStore.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/storage/sis-geotiff/src/main/java/org/apache/sis/storage/geotiff/GeoTiffStore.java?rev=1809390&r1=1809389&r2=1809390&view=diff
==============================================================================
--- sis/branches/JDK7/storage/sis-geotiff/src/main/java/org/apache/sis/storage/geotiff/GeoTiffStore.java [UTF-8] (original)
+++ sis/branches/JDK7/storage/sis-geotiff/src/main/java/org/apache/sis/storage/geotiff/GeoTiffStore.java [UTF-8] Sat Sep 23 10:56:44 2017
@@ -34,6 +34,7 @@ import org.apache.sis.storage.DataStoreE
 import org.apache.sis.storage.DataStoreContentException;
 import org.apache.sis.storage.UnsupportedStorageException;
 import org.apache.sis.internal.storage.io.ChannelDataInput;
+import org.apache.sis.internal.storage.io.IOUtilities;
 import org.apache.sis.internal.storage.MetadataBuilder;
 import org.apache.sis.internal.storage.URIDataStore;
 import org.apache.sis.internal.util.Constants;
@@ -130,12 +131,21 @@ public class GeoTiffStore extends DataSt
                 while ((dir = reader.getImageFileDirectory(n++)) != null) {
                     dir.completeMetadata(builder, locale);
                 }
-                metadata = builder.build(true);
             } catch (IOException e) {
                 throw new DataStoreException(errors().getString(Errors.Keys.CanNotRead_1, reader.input.filename), e);
             } catch (FactoryException | ArithmeticException e) {
                 throw new DataStoreContentException(getLocale(), Constants.GEOTIFF, reader.input.filename, null).initCause(e);
             }
+            /*
+             * Add the filename as an identifier only if the input was something convertible to URI (URL, File or Path),
+             * otherwise reader.input.filename may not be useful; it may be just the InputStream classname. If the TIFF
+             * file did not specified any ImageDescription tag, then we will had the filename as a title instead than an
+             * identifier because the title is mandatory in ISO 19115 metadata.
+             */
+            if (location != null) {
+                builder.addTitleOrIdentifier(IOUtilities.filenameWithoutExtension(reader.input.filename), MetadataBuilder.Scope.ALL);
+            }
+            metadata = builder.build(true);
         }
         return metadata;
     }

Modified: sis/branches/JDK7/storage/sis-geotiff/src/test/java/org/apache/sis/storage/geotiff/CRSBuilderTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/storage/sis-geotiff/src/test/java/org/apache/sis/storage/geotiff/CRSBuilderTest.java?rev=1809390&r1=1809389&r2=1809390&view=diff
==============================================================================
--- sis/branches/JDK7/storage/sis-geotiff/src/test/java/org/apache/sis/storage/geotiff/CRSBuilderTest.java [UTF-8] (original)
+++ sis/branches/JDK7/storage/sis-geotiff/src/test/java/org/apache/sis/storage/geotiff/CRSBuilderTest.java [UTF-8] Sat Sep 23 10:56:44 2017
@@ -41,9 +41,9 @@ public final strictfp class CRSBuilderTe
     @Test
     public void testSplitName() {
         final String[] names = CRSBuilder.splitName("GCS Name = wgs84|Datum = unknown|Ellipsoid = WGS_1984|Primem = Greenwich|");
-        assertEquals("GCRS",      "wgs84",    names[CRSBuilder.GCRS]);
-        assertEquals("DATUM",     "unknown",  names[CRSBuilder.DATUM]);
-        assertEquals("ELLIPSOID", "WGS_1984", names[CRSBuilder.ELLIPSOID]);
+        assertEquals("GCRS",      "wgs84",     names[CRSBuilder.GCRS]);
+        assertEquals("DATUM",     "unknown",   names[CRSBuilder.DATUM]);
+        assertEquals("ELLIPSOID", "WGS_1984",  names[CRSBuilder.ELLIPSOID]);
         assertEquals("PRIMEM",    "Greenwich", names[CRSBuilder.PRIMEM]);
     }
 

Modified: sis/branches/JDK7/storage/sis-netcdf/pom.xml
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/storage/sis-netcdf/pom.xml?rev=1809390&r1=1809389&r2=1809390&view=diff
==============================================================================
--- sis/branches/JDK7/storage/sis-netcdf/pom.xml (original)
+++ sis/branches/JDK7/storage/sis-netcdf/pom.xml Sat Sep 23 10:56:44 2017
@@ -38,11 +38,11 @@
   <groupId>org.apache.sis.storage</groupId>
   <artifactId>sis-netcdf</artifactId>
   <packaging>bundle</packaging>
-  <name>Apache SIS NetCDF storage</name>
+  <name>Apache SIS netCDF storage</name>
   <description>
   <!-- Left alignment because this description will be copied in META-INF/MANIFEST.MF
        The leading space after the first line is necessary for proper formatting. -->
-Bridge between NetCDF Climate and Forecast (CF) convention and ISO 19115 metadata.
+Bridge between netCDF Climate and Forecast (CF) convention and ISO 19115 metadata.
   </description>
 
 
@@ -153,7 +153,7 @@ Bridge between NetCDF Climate and Foreca
     </dependency>
   </dependencies>
 
-  <!--  UCAR repository from which to download the NetCDF library. -->
+  <!--  UCAR repository from which to download the netCDF library. -->
   <repositories>
     <repository>
       <id>UCAR</id>

Modified: sis/branches/JDK7/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/Axis.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/Axis.java?rev=1809390&r1=1809389&r2=1809390&view=diff
==============================================================================
--- sis/branches/JDK7/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/Axis.java [UTF-8] (original)
+++ sis/branches/JDK7/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/Axis.java [UTF-8] Sat Sep 23 10:56:44 2017
@@ -23,9 +23,9 @@ import org.apache.sis.storage.DataStoreE
 
 
 /**
- * Information about a coordinate system axes. In NetCDF files, all axes can be related to 1 or more dimensions
+ * Information about a coordinate system axes. In netCDF files, all axes can be related to 1 or more dimensions
  * of the grid domain. Those grid domain dimensions are specified by the {@link #sourceDimensions} array.
- * Whether the array length is 1 or 2 depends on whether the wrapped NetCDF axis is an instance of
+ * Whether the array length is 1 or 2 depends on whether the wrapped netCDF axis is an instance of
  * {@link ucar.nc2.dataset.CoordinateAxis1D} or {@link ucar.nc2.dataset.CoordinateAxis2D} respectively.
  *
  * @author  Martin Desruisseaux (Geomatys)
@@ -44,7 +44,7 @@ public final class Axis {
 
     /**
      * The indices of the grid dimension associated to this axis. The length of this array is often 1.
-     * But if more than one grid dimension is associated to this axis (i.e. if the wrapped NetCDF axis
+     * But if more than one grid dimension is associated to this axis (i.e. if the wrapped netCDF axis
      * is an instance of {@link ucar.nc2.dataset.CoordinateAxis2D}),  then the first value is the grid
      * dimension which seems most closely oriented toward this axis direction. We do that for allowing
      * {@code MetadataReader.addSpatialRepresentationInfo(…)} method to get the most appropriate value

Modified: sis/branches/JDK7/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/DataType.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/DataType.java?rev=1809390&r1=1809389&r2=1809390&view=diff
==============================================================================
--- sis/branches/JDK7/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/DataType.java [UTF-8] (original)
+++ sis/branches/JDK7/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/DataType.java [UTF-8] Sat Sep 23 10:56:44 2017
@@ -21,17 +21,17 @@ import org.apache.sis.util.Numbers;
 
 
 /**
- * The NetCDF type of data. Number of bits and endianness are same as in the Java language
+ * The netCDF type of data. Number of bits and endianness are same as in the Java language
  * except {@link #CHAR}, which is defined as an unsigned 8-bits value. This enumeration is
- * related to the NetCDF standard as below:
+ * related to the netCDF standard as below:
  *
  * <ul>
- *   <li>The NetCDF numerical code is the {@link #ordinal()}.</li>
+ *   <li>The netCDF numerical code is the {@link #ordinal()}.</li>
  *   <li>The CDL reserved word is the {@link #name()} is lower case,
  *       except for {@link #UNKNOWN} which is not a valid CDL type.</li>
  * </ul>
  *
- * The unsigned data types are not defined in NetCDF classical version. However those data types
+ * The unsigned data types are not defined in netCDF classical version. However those data types
  * can be inferred from their signed counterpart if the later have a {@code "_Unsigned = true"}
  * attribute associated to the variable.
  *
@@ -43,82 +43,82 @@ import org.apache.sis.util.Numbers;
  */
 public enum DataType {
     /**
-     * The enumeration for unknown data type. This is not a valid NetCDF type.
+     * The enumeration for unknown data type. This is not a valid netCDF type.
      */
     UNKNOWN(Numbers.OTHER, false, false, (byte) 0, DataBuffer.TYPE_UNDEFINED),
 
     /**
-     * 8 bits signed integer (NetCDF type 1).
-     * Can be made unsigned by assigning the “_Unsigned” attribute to a NetCDF variable.
+     * 8 bits signed integer (netCDF type 1).
+     * Can be made unsigned by assigning the “_Unsigned” attribute to a netCDF variable.
      */
     BYTE(Numbers.BYTE, true, false, (byte) 7, DataBuffer.TYPE_BYTE),
 
     /**
-     * Character type as unsigned 8 bits (NetCDF type 2).
-     * Encoding can be specified by assigning the “_Encoding” attribute to a NetCDF variable.
+     * Character type as unsigned 8 bits (netCDF type 2).
+     * Encoding can be specified by assigning the “_Encoding” attribute to a netCDF variable.
      */
     CHAR(Numbers.BYTE, false, true, (byte) 2, DataBuffer.TYPE_UNDEFINED),        // NOT Numbers.CHARACTER
 
     /**
-     * 16 bits signed integer (NetCDF type 3).
+     * 16 bits signed integer (netCDF type 3).
      */
     SHORT(Numbers.SHORT, true, false, (byte) 8, DataBuffer.TYPE_SHORT),
 
     /**
-     * 32 bits signed integer (NetCDF type 4).
+     * 32 bits signed integer (netCDF type 4).
      * This is also called "long", but that name is deprecated.
      */
     INT(Numbers.INTEGER, true, false, (byte) 9, DataBuffer.TYPE_INT),
 
     /**
-     * 32 bits floating point number (NetCDF type 5)
+     * 32 bits floating point number (netCDF type 5)
      * This is also called "real".
      */
     FLOAT(Numbers.FLOAT, false, false, (byte) 5, DataBuffer.TYPE_FLOAT),
 
     /**
-     * 64 bits floating point number (NetCDF type 6).
+     * 64 bits floating point number (netCDF type 6).
      */
     DOUBLE(Numbers.DOUBLE, false, false, (byte) 6, DataBuffer.TYPE_DOUBLE),
 
     /**
-     * 8 bits unsigned integer (NetCDF type 7).
-     * Not available in NetCDF classic format.
+     * 8 bits unsigned integer (netCDF type 7).
+     * Not available in netCDF classic format.
      */
     UBYTE(Numbers.BYTE, true, true, (byte) 1, DataBuffer.TYPE_BYTE),
 
     /**
-     * 16 bits unsigned integer (NetCDF type 8).
-     * Not available in NetCDF classic format.
+     * 16 bits unsigned integer (netCDF type 8).
+     * Not available in netCDF classic format.
      */
     USHORT(Numbers.SHORT, true, true, (byte) 3, DataBuffer.TYPE_USHORT),
 
     /**
-     * 43 bits unsigned integer (NetCDF type 9).
-     * Not available in NetCDF classic format.
+     * 43 bits unsigned integer (netCDF type 9).
+     * Not available in netCDF classic format.
      */
     UINT(Numbers.INTEGER, true, true, (byte) 4, DataBuffer.TYPE_INT),
 
     /**
-     * 64 bits signed integer (NetCDF type 10).
-     * Not available in NetCDF classic format.
+     * 64 bits signed integer (netCDF type 10).
+     * Not available in netCDF classic format.
      */
     INT64(Numbers.LONG, true, false, (byte) 11, DataBuffer.TYPE_UNDEFINED),
 
     /**
-     * 64 bits unsigned integer (NetCDF type 11).
-     * Not available in NetCDF classic format.
+     * 64 bits unsigned integer (netCDF type 11).
+     * Not available in netCDF classic format.
      */
     UINT64(Numbers.LONG, true, true, (byte) 10, DataBuffer.TYPE_UNDEFINED),
 
     /**
-     * Character string (NetCDF type 12).
-     * Not available in NetCDF classic format.
+     * Character string (netCDF type 12).
+     * Not available in netCDF classic format.
      */
     STRING(Numbers.OTHER, false, false, (byte) 12, DataBuffer.TYPE_UNDEFINED);
 
     /**
-     * Mapping from the NetCDF data type to the enumeration used by our {@link Numbers} class.
+     * Mapping from the netCDF data type to the enumeration used by our {@link Numbers} class.
      */
     public final byte number;
 
@@ -129,14 +129,14 @@ public enum DataType {
 
     /**
      * {@code false} for signed data type (the default), or {@code true} for unsigned data type.
-     * The OGC NetCDF standard version 1.0 does not define unsigned data types. However some data
+     * The OGC netCDF standard version 1.0 does not define unsigned data types. However some data
      * providers attach an {@code "_Unsigned = true"} attribute to the variable.
      */
     public final boolean isUnsigned;
 
     /**
-     * The NetCDF code of the data type of opposite sign convention.
-     * For example for the {@link #BYTE} data type, this is the NetCDF code of {@link #UBYTE}.
+     * The netCDF code of the data type of opposite sign convention.
+     * For example for the {@link #BYTE} data type, this is the netCDF code of {@link #UBYTE}.
      */
     private final byte opposite;
 
@@ -173,16 +173,16 @@ public enum DataType {
     }
 
     /**
-     * An array of all supported NetCDF data types ordered in such a way that
-     * {@code VALUES[codeNetCDF - 1]} is the enumeration value for a given NetCDF code.
+     * An array of all supported netCDF data types ordered in such a way that
+     * {@code VALUES[codeNetCDF - 1]} is the enumeration value for a given netCDF code.
      */
     private static final DataType[] VALUES = values();
 
     /**
-     * Returns the enumeration value for the given NetCDF code, or {@link #UNKNOWN} if the given code is unknown.
+     * Returns the enumeration value for the given netCDF code, or {@link #UNKNOWN} if the given code is unknown.
      *
-     * @param  code  the NetCDF code.
-     * @return enumeration value for the give NetCDF code.
+     * @param  code  the netCDF code.
+     * @return enumeration value for the give netCDF code.
      */
     public static DataType valueOf(final int code) {
         return (code >= 0 && code < VALUES.length) ? VALUES[code] : UNKNOWN;

Modified: sis/branches/JDK7/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/Decoder.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/Decoder.java?rev=1809390&r1=1809389&r2=1809390&view=diff
==============================================================================
--- sis/branches/JDK7/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/Decoder.java [UTF-8] (original)
+++ sis/branches/JDK7/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/Decoder.java [UTF-8] Sat Sep 23 10:56:44 2017
@@ -24,13 +24,14 @@ import java.io.IOException;
 import javax.measure.Unit;
 import javax.measure.format.ParserException;
 import org.apache.sis.measure.Units;
+import org.apache.sis.setup.GeometryLibrary;
 import org.apache.sis.storage.DataStore;
 import org.apache.sis.storage.DataStoreException;
 import org.apache.sis.util.logging.WarningListeners;
 
 
 /**
- * The API used internally by Apache SIS for fetching variables and attribute values from a NetCDF file.
+ * The API used internally by Apache SIS for fetching variables and attribute values from a netCDF file.
  *
  * <p>This {@code Decoder} class and subclasses are <strong>not</strong> thread-safe.
  * Synchronizations are caller's responsibility.</p>
@@ -42,6 +43,13 @@ import org.apache.sis.util.logging.Warni
  */
 public abstract class Decoder implements Closeable {
     /**
+     * The library for geometric objects, or {@code null} for the default.
+     * This will be used only if there is geometric objects to create.
+     * If the netCDF file contains only raster data, this value is ignored.
+     */
+    public final GeometryLibrary geomlib;
+
+    /**
      * Where to send the warnings.
      */
     public final WarningListeners<DataStore> listeners;
@@ -55,15 +63,18 @@ public abstract class Decoder implements
     /**
      * Creates a new decoder.
      *
+     * @param  geomlib    the library for geometric objects, or {@code null} for the default.
      * @param  listeners  where to send the warnings.
      */
-    protected Decoder(final WarningListeners<DataStore> listeners) {
+    protected Decoder(final GeometryLibrary geomlib, final WarningListeners<DataStore> listeners) {
         Objects.requireNonNull(listeners);
+        this.geomlib   = geomlib;
         this.listeners = listeners;
     }
 
     /**
-     * Returns a filename for information purpose only. This is used for formatting error messages.
+     * Returns a filename for formatting error message and for information purpose.
+     * The filename should not contain path.
      *
      * @return a filename to report in warning or error messages.
      */
@@ -80,7 +91,7 @@ public abstract class Decoder implements
     /**
      * Returns the path which is currently set. The array returned by this method may be only
      * a subset of the array given to {@link #setSearchPath(String[])} since only the name of
-     * groups which have been found in the NetCDF file are returned by this method.
+     * groups which have been found in the netCDF file are returned by this method.
      *
      * @return the current search path.
      */
@@ -201,7 +212,7 @@ public abstract class Decoder implements
     }
 
     /**
-     * Returns all variables found in the NetCDF file.
+     * Returns all variables found in the netCDF file.
      * This method may return a direct reference to an internal array - do not modify.
      *
      * @return all variables, or an empty array if none.
@@ -220,7 +231,7 @@ public abstract class Decoder implements
     public abstract DiscreteSampling[] getDiscreteSampling() throws IOException, DataStoreException;
 
     /**
-     * Returns all grid geometries (related to coordinate systems) found in the NetCDF file.
+     * Returns all grid geometries (related to coordinate systems) found in the netCDF file.
      * This method may return a direct reference to an internal array - do not modify.
      *
      * @return all grid geometries, or an empty array if none.

Modified: sis/branches/JDK7/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/DiscreteSampling.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/DiscreteSampling.java?rev=1809390&r1=1809389&r2=1809390&view=diff
==============================================================================
--- sis/branches/JDK7/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/DiscreteSampling.java [UTF-8] (original)
+++ sis/branches/JDK7/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/DiscreteSampling.java [UTF-8] Sat Sep 23 10:56:44 2017
@@ -17,13 +17,18 @@
 package org.apache.sis.internal.netcdf;
 
 // Branch-dependent imports
-import org.apache.sis.internal.jdk8.Stream;
-import org.opengis.feature.Feature;
+import org.opengis.metadata.Metadata;
+import org.apache.sis.storage.DataStore;
+import org.apache.sis.setup.GeometryLibrary;
+import org.apache.sis.internal.feature.Geometries;
+import org.apache.sis.internal.storage.AbstractFeatureSet;
+import org.apache.sis.util.logging.WarningListeners;
+import org.apache.sis.util.resources.Errors;
 
 
 /**
- * Returns the features encoded in the NetCDF files when they are encoded as discrete sampling.
- * The NetCDF attributes shall be conform to the "Discrete Sampling Geometries" chapter of
+ * Returns the features encoded in the netCDF files when they are encoded as discrete sampling.
+ * The netCDF attributes shall be conform to the "Discrete Sampling Geometries" chapter of
  * <a href="http://cfconventions.org/">CF conventions</a>. Some examples are trajectories
  * and profiles.
  *
@@ -32,17 +37,42 @@ import org.opengis.feature.Feature;
  * @since   0.8
  * @module
  */
-public abstract class DiscreteSampling {
+public abstract class DiscreteSampling extends AbstractFeatureSet {
+    /**
+     * The factory to use for creating geometries.
+     */
+    protected final Geometries<?> factory;
+
     /**
      * Creates a new discrete sampling parser.
+     *
+     * @param  library    the library for geometric objects, or {@code null} for the default.
+     * @param  listeners  the set of registered warning listeners for the data store.
+     * @throws IllegalArgumentException if the given library is non-null but not available.
      */
-    protected DiscreteSampling() {
+    protected DiscreteSampling(final GeometryLibrary library, final WarningListeners<DataStore> listeners) {
+        super(listeners);
+        factory = Geometries.implementation(library);
     }
 
     /**
-     * Returns the stream of features.
+     * Returns information about this resource.
+     *
+     * @return information about this resource, or {@code null} if none.
      *
-     * @return the stream of features.
+     * @todo Not yet implemented.
      */
-    public abstract Stream<Feature> features();
+    @Override
+    public Metadata getMetadata() {
+        return null;
+    }
+
+    /**
+     * Returns the error message for a file that can not be read.
+     *
+     * @return default error message to use in exceptions.
+     */
+    protected final String canNotReadFile() {
+        return Errors.getResources(getLocale()).getString(Errors.Keys.CanNotRead_1, getStoreName());
+    }
 }

Modified: sis/branches/JDK7/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/GridGeometry.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/GridGeometry.java?rev=1809390&r1=1809389&r2=1809390&view=diff
==============================================================================
--- sis/branches/JDK7/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/GridGeometry.java [UTF-8] (original)
+++ sis/branches/JDK7/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/GridGeometry.java [UTF-8] Sat Sep 23 10:56:44 2017
@@ -59,7 +59,7 @@ public abstract class GridGeometry {
      *
      * <p>This method is used mostly for producing ISO 19115 metadata. It is typically invoked only once.</p>
      *
-     * @return the CRS axes, in NetCDF order (reverse of "natural" order).
+     * @return the CRS axes, in netCDF order (reverse of "natural" order).
      * @throws IOException if an I/O operation was necessary but failed.
      * @throws DataStoreException if a logical error occurred.
      */
@@ -68,7 +68,7 @@ public abstract class GridGeometry {
     /**
      * Returns a coordinate for the given two-dimensional grid coordinate axis. This is (indirectly) a callback
      * method for {@link #getAxes()}. The (<var>i</var>, <var>j</var>) indices are grid indices <em>before</em>
-     * they get reordered by the {@link Axis} constructor. In the NetCDF UCAR API, this method maps directly to
+     * they get reordered by the {@link Axis} constructor. In the netCDF UCAR API, this method maps directly to
      * {@link ucar.nc2.dataset.CoordinateAxis2D#getCoordValue(int, int)}.
      *
      * @param  axis  an implementation-dependent object representing the two-dimensional axis, or {@code null} if none.

Modified: sis/branches/JDK7/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/NamedElement.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/NamedElement.java?rev=1809390&r1=1809389&r2=1809390&view=diff
==============================================================================
--- sis/branches/JDK7/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/NamedElement.java [UTF-8] (original)
+++ sis/branches/JDK7/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/NamedElement.java [UTF-8] Sat Sep 23 10:56:44 2017
@@ -25,7 +25,7 @@ import org.opengis.parameter.InvalidPara
 
 
 /**
- * Base class of NetCDF dimension, variable or attribute.
+ * Base class of netCDF dimension, variable or attribute.
  * All those objects share in common a {@link #getName()} method.
  *
  * @author  Martin Desruisseaux (Geomatys)

Modified: sis/branches/JDK7/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/Resources.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/Resources.java?rev=1809390&r1=1809389&r2=1809390&view=diff
==============================================================================
--- sis/branches/JDK7/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/Resources.java [UTF-8] (original)
+++ sis/branches/JDK7/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/Resources.java [UTF-8] Sat Sep 23 10:56:44 2017
@@ -59,7 +59,7 @@ public final class Resources extends Ind
         }
 
         /**
-         * Can not use UCAR library for NetCDF format. Fallback on Apache SIS implementation.
+         * Can not use UCAR library for netCDF format. Fallback on Apache SIS implementation.
          */
         public static final short CanNotUseUCAR = 4;
 

Modified: sis/branches/JDK7/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/Resources.properties
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/Resources.properties?rev=1809390&r1=1809389&r2=1809390&view=diff
==============================================================================
--- sis/branches/JDK7/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/Resources.properties [ISO-8859-1] (original)
+++ sis/branches/JDK7/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/Resources.properties [ISO-8859-1] Sat Sep 23 10:56:44 2017
@@ -19,7 +19,7 @@
 # Resources in this file are for "sis-netcdf" usage only and should not be used by any other module.
 # For resources shared by all modules in the Apache SIS project, see "org.apache.sis.util.resources" package.
 #
-CanNotUseUCAR                     = Can not use UCAR library for NetCDF format. Fallback on Apache SIS implementation.
+CanNotUseUCAR                     = Can not use UCAR library for netCDF format. Fallback on Apache SIS implementation.
 DimensionNotFound_3               = Dimension \u201c{2}\u201d declared by attribute \u201c{1}\u201d is not found in the \u201c{0}\u201d file.
 UnexpectedDimensionForVariable_4  = Variable \u201c{1}\u201d in file \u201c{0}\u201d has a dimension \u201c{3}\u201d while we expected \u201c{2}\u201d.
 VariableNotFound_2                = Variable \u201c{1}\u201d is not found in the \u201c{0}\u201d file.

Modified: sis/branches/JDK7/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/Resources_fr.properties
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/Resources_fr.properties?rev=1809390&r1=1809389&r2=1809390&view=diff
==============================================================================
--- sis/branches/JDK7/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/Resources_fr.properties [ISO-8859-1] (original)
+++ sis/branches/JDK7/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/Resources_fr.properties [ISO-8859-1] Sat Sep 23 10:56:44 2017
@@ -24,7 +24,7 @@
 #   U+202F NARROW NO-BREAK SPACE  before  ; ! and ?
 #   U+00A0 NO-BREAK SPACE         before  :
 #
-CanNotUseUCAR                     = Ne peut pas utiliser la biblioth\u00e8que de l\u2019UCAR pour le format NetCDF. L\u2019impl\u00e9mentation de Apache SIS sera utilis\u00e9e \u00e0 la place.
+CanNotUseUCAR                     = Ne peut pas utiliser la biblioth\u00e8que de l\u2019UCAR pour le format netCDF. L\u2019impl\u00e9mentation de Apache SIS sera utilis\u00e9e \u00e0 la place.
 DimensionNotFound_3               = La dimension \u00ab\u202f{2}\u202f\u00bb d\u00e9clar\u00e9e par l\u2019attribut \u00ab\u202f{1}\u202f\u00bb n\u2019a pas \u00e9t\u00e9 trouv\u00e9e dans le fichier \u00ab\u202f{0}\u202f\u00bb.
 UnexpectedDimensionForVariable_4  = La variable \u00ab\u202f{1}\u202f\u00bb dans le fichier \u00ab\u202f{0}\u202f\u00bb a une dimension \u00ab\u202f{3}\u202f\u00bb alors qu\u2019on attendait \u00ab\u202f{2}\u202f\u00bb.
 VariableNotFound_2                = La variable \u00ab\u202f{1}\u202f\u00bb n\u2019a pas \u00e9t\u00e9 trouv\u00e9e dans le fichier \u00ab\u202f{0}\u202f\u00bb.

Modified: sis/branches/JDK7/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/Variable.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/Variable.java?rev=1809390&r1=1809389&r2=1809390&view=diff
==============================================================================
--- sis/branches/JDK7/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/Variable.java [UTF-8] (original)
+++ sis/branches/JDK7/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/Variable.java [UTF-8] Sat Sep 23 10:56:44 2017
@@ -25,7 +25,7 @@ import org.apache.sis.util.Debug;
 
 
 /**
- * A NetCDF variable created by {@link Decoder}.
+ * A netCDF variable created by {@link Decoder}.
  *
  * @author  Martin Desruisseaux (Geomatys)
  * @author  Johann Sorel (Geomatys)
@@ -129,28 +129,28 @@ public abstract class Variable extends N
 
     /**
      * Returns {@code true} if this variable seems to be a coordinate system axis instead than the actual data.
-     * By NetCDF convention, coordinate system axes have the name of one of the dimensions defined in the NetCDF header.
+     * By netCDF convention, coordinate system axes have the name of one of the dimensions defined in the netCDF header.
      *
      * @return {@code true} if this variable seems to be a coordinate system axis.
      */
     public abstract boolean isCoordinateSystemAxis();
 
     /**
-     * Returns the names of the dimensions of this variable, in the order they are declared in the NetCDF file.
+     * Returns the names of the dimensions of this variable, in the order they are declared in the netCDF file.
      * The dimensions are those of the grid, not the dimensions of the coordinate system.
      *
-     * @return the names of all dimension of the grid, in NetCDF order (reverse of "natural" order).
+     * @return the names of all dimension of the grid, in netCDF order (reverse of "natural" order).
      */
     public abstract String[] getGridDimensionNames();
 
     /**
-     * Returns the length (number of cells) of each grid dimension, in the order they are declared in the NetCDF file.
+     * Returns the length (number of cells) of each grid dimension, in the order they are declared in the netCDF file.
      * The length of this array shall be equals to the length of the {@link #getGridDimensionNames()} array.
      *
      * <p>In ISO 19123 terminology, this method returns the upper corner of the grid envelope plus one.
      * The lower corner is always (0, 0, …, 0).</p>
      *
-     * @return the number of grid cells for each dimension, in NetCDF order (reverse of "natural" order).
+     * @return the number of grid cells for each dimension, in netCDF order (reverse of "natural" order).
      */
     public abstract int[] getGridEnvelope();
 

Modified: sis/branches/JDK7/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/impl/ChannelDecoder.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/impl/ChannelDecoder.java?rev=1809390&r1=1809389&r2=1809390&view=diff
==============================================================================
--- sis/branches/JDK7/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/impl/ChannelDecoder.java [UTF-8] (original)
+++ sis/branches/JDK7/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/impl/ChannelDecoder.java [UTF-8] Sat Sep 23 10:56:44 2017
@@ -32,6 +32,8 @@ import java.util.Locale;
 import java.util.regex.Pattern;
 import java.io.IOException;
 import java.nio.ByteBuffer;
+import java.nio.charset.Charset;
+import java.nio.charset.StandardCharsets;
 import java.nio.channels.ReadableByteChannel;
 import javax.measure.UnitConverter;
 import javax.measure.IncommensurableException;
@@ -55,6 +57,7 @@ import org.apache.sis.util.resources.Err
 import org.apache.sis.util.resources.Vocabulary;
 import org.apache.sis.util.logging.WarningListeners;
 import org.apache.sis.util.Debug;
+import org.apache.sis.setup.GeometryLibrary;
 import org.apache.sis.measure.Units;
 import ucar.nc2.constants.CF;
 
@@ -64,7 +67,7 @@ import org.apache.sis.internal.jdk8.Date
 
 
 /**
- * Provides NetCDF decoding services as a standalone library.
+ * Provides netCDF decoding services as a standalone library.
  * The javadoc in this class uses the "file" word for the source of data, but
  * this implementation actually works with arbitrary {@link ReadableByteChannel}.
  *
@@ -79,7 +82,7 @@ import org.apache.sis.internal.jdk8.Date
  */
 public final class ChannelDecoder extends Decoder {
     /**
-     * The NetCDF magic number expected in the first integer of the stream.
+     * The netCDF magic number expected in the first integer of the stream.
      * The comparison shall ignore the 8 lowest bits, as in the following example:
      *
      * {@preformat java
@@ -95,13 +98,13 @@ public final class ChannelDecoder extend
     public static final int MAX_VERSION = 2;
 
     /**
-     * The encoding of dimension, variable and attribute names. This is fixed to {@value} by the
-     * NetCDF specification. Note however that the encoding of attribute values may be different.
+     * The encoding of dimension, variable and attribute names. This is fixed to UTF-8 by the netCDF specification.
+     * Note however that the encoding of attribute values may be different.
      *
      * @see #encoding
      * @see #readName()
      */
-    private static final String NAME_ENCODING = "UTF-8";
+    private static final Charset NAME_ENCODING = StandardCharsets.UTF_8;
 
     /**
      * The locale of dimension, variable and attribute names. This is used for the conversion to
@@ -121,7 +124,7 @@ public final class ChannelDecoder extend
 
     /*
      * NOTE: the names of the static constants below this point match the names used in the Backus-Naur Form (BNF)
-     *       definitions in the NetCDF Classic and 64-bit Offset Format (1.0) specification (link in class javdoc),
+     *       definitions in the netCDF Classic and 64-bit Offset Format (1.0) specification (link in class javdoc),
      *       with NC_ prefix omitted. The types of those constants match the expected type in the file.
      */
 
@@ -160,21 +163,21 @@ public final class ChannelDecoder extend
 
     /**
      * The character encoding of attribute values. This encoding does <strong>not</strong> apply to
-     * dimension, variable and attribute names, which are fixed to UTF-8 as of NetCDF specification.
+     * dimension, variable and attribute names, which are fixed to UTF-8 as of netCDF specification.
      *
      * The specification said: "Although the characters used in netCDF names must be encoded as UTF-8,
      * character data may use other encodings. The variable attribute “_Encoding” is reserved for this
      * purpose in future implementations."
      *
-     * @todo Fixed to ISO-LATIN-1 for now, needs to be determined in a better way.
+     * @todo "_Encoding" attribute not yet parsed.
      *
      * @see #NAME_ENCODING
      * @see #readValues(DataType, int)
      */
-    private final String encoding = "ISO-8859-1";
+    private final Charset encoding;
 
     /**
-     * The variables found in the NetCDF file.
+     * The variables found in the netCDF file.
      *
      * @see #getVariables()
      */
@@ -186,7 +189,7 @@ public final class ChannelDecoder extend
     private final Map<String,VariableInfo> variableMap;
 
     /**
-     * The attributes found in the NetCDF file.
+     * The attributes found in the netCDF file.
      * Values in this map give directly the attribute value (there is no {@code Attribute} object).
      *
      * @see #findAttribute(String)
@@ -194,7 +197,7 @@ public final class ChannelDecoder extend
     private final Map<String,Object> attributeMap;
 
     /**
-     * All dimensions in the NetCDF files.
+     * All dimensions in the netCDF files.
      *
      * @see #readDimensions(int)
      * @see #findDimension(String)
@@ -213,31 +216,34 @@ public final class ChannelDecoder extend
      * This constructor parses immediately the header, which shall have the following structure:
      *
      * <ul>
-     *   <li>Magic number:   'C','D','F'</li>
+     *   <li>Magic number: 'C','D','F'</li>
      *   <li>Version number: 1 or 2</li>
      *   <li>Number of records</li>
-     *   <li>List of NetCDF dimensions  (see {@link #readDimensions(int)})</li>
+     *   <li>List of netCDF dimensions  (see {@link #readDimensions(int)})</li>
      *   <li>List of global attributes  (see {@link #readAttributes(int)})</li>
      *   <li>List of variables          (see {@link #readVariables(int, Dimension[])})</li>
      * </ul>
      *
-     * @param  listeners  where to send the warnings.
      * @param  input      the channel and the buffer from where data are read.
+     * @param  encoding   the encoding of attribute value, or {@code null} for the default value.
+     * @param  geomlib    the library for geometric objects, or {@code null} for the default.
+     * @param  listeners  where to send the warnings.
      * @throws IOException if an error occurred while reading the channel.
-     * @throws DataStoreException if the content of the given channel is not a NetCDF file.
+     * @throws DataStoreException if the content of the given channel is not a netCDF file.
      */
-    public ChannelDecoder(final WarningListeners<DataStore> listeners, final ChannelDataInput input)
-            throws IOException, DataStoreException
+    public ChannelDecoder(final ChannelDataInput input, final Charset encoding, final GeometryLibrary geomlib,
+            final WarningListeners<DataStore> listeners) throws IOException, DataStoreException
     {
-        super(listeners);
+        super(geomlib, listeners);
         this.input = input;
+        this.encoding = (encoding != null) ? encoding : StandardCharsets.UTF_8;
         /*
          * Check the magic number, which is expected to be exactly 3 bytes forming the "CDF" string.
          * The 4th byte is the version number, which we opportunistically use after the magic number check.
          */
         int version = input.readInt();
         if ((version & 0xFFFFFF00) != MAGIC_NUMBER) {
-            throw new DataStoreContentException(errors().getString(Errors.Keys.UnexpectedFileFormat_2, "NetCDF", getFilename()));
+            throw new DataStoreContentException(errors().getString(Errors.Keys.UnexpectedFileFormat_2, "netCDF", getFilename()));
         }
         /*
          * Check the version number.
@@ -246,7 +252,7 @@ public final class ChannelDecoder extend
         switch (version) {
             case 1:  is64bits = false; break;
             case 2:  is64bits = true;  break;
-            default: throw new DataStoreContentException(errors().getString(Errors.Keys.UnsupportedFormatVersion_2, "NetCDF", version));
+            default: throw new DataStoreContentException(errors().getString(Errors.Keys.UnsupportedFormatVersion_2, "netCDF", version));
             // If more cases are added, remember to increment the MAX_VERSION constant.
         }
         numrecs = input.readInt();
@@ -308,7 +314,7 @@ public final class ChannelDecoder extend
     }
 
     /**
-     * Returns the NetCDF-specific resource bundle for the locale given by {@link WarningListeners#getLocale()}.
+     * Returns the netCDF-specific resource bundle for the locale given by {@link WarningListeners#getLocale()}.
      *
      * @return the localized error resource bundle.
      */
@@ -318,10 +324,10 @@ public final class ChannelDecoder extend
 
     /**
      * Returns an exception for a malformed header. This is used only after we have determined
-     * that the file should be a NetCDF one, but we found some inconsistency or unknown tags.
+     * that the file should be a netCDF one, but we found some inconsistency or unknown tags.
      */
     private DataStoreException malformedHeader() {
-        return new DataStoreContentException(listeners.getLocale(), "NetCDF", getFilename(), null);
+        return new DataStoreContentException(listeners.getLocale(), "netCDF", getFilename(), null);
     }
 
     /**
@@ -338,7 +344,7 @@ public final class ChannelDecoder extend
      * Aligns position in the stream after reading the given amount of bytes.
      * This method should be invoked only for {@link DataType#BYTE} and {@link DataType#CHAR}.
      *
-     * <p>The NetCDF format adds padding after bytes, characters and short integers in order to align the data
+     * <p>The netCDF format adds padding after bytes, characters and short integers in order to align the data
      * on multiple of 4 bytes. This method is used for adding such padding to the number of bytes to read.</p>
      *
      * @param  length   number of byte reads.
@@ -361,7 +367,7 @@ public final class ChannelDecoder extend
     }
 
     /**
-     * Reads a string from the channel in the {@value #NAME_ENCODING}. This is suitable for the dimension,
+     * Reads a string from the channel in the {@link #NAME_ENCODING}. This is suitable for the dimension,
      * variable and attribute names in the header. Note that attribute value may have a different encoding.
      */
     private String readName() throws IOException, DataStoreException {
@@ -453,7 +459,7 @@ public final class ChannelDecoder extend
     }
 
     /**
-     * Reads dimensions from the NetCDF file header. The record structure is:
+     * Reads dimensions from the netCDF file header. The record structure is:
      *
      * <ul>
      *   <li>The dimension name     (use {@link #readName()})</li>
@@ -461,7 +467,7 @@ public final class ChannelDecoder extend
      * </ul>
      *
      * @param  nelems  the number of dimensions to read.
-     * @return the dimensions in the order they are declared in the NetCDF file.
+     * @return the dimensions in the order they are declared in the netCDF file.
      */
     private Dimension[] readDimensions(final int nelems) throws IOException, DataStoreException {
         final Dimension[] dimensions = new Dimension[nelems];
@@ -481,8 +487,8 @@ public final class ChannelDecoder extend
     }
 
     /**
-     * Reads attribute values from the NetCDF file header. Current implementation has no restriction on
-     * the location in the header where the NetCDF attribute can be declared. The record structure is:
+     * Reads attribute values from the netCDF file header. Current implementation has no restriction on
+     * the location in the header where the netCDF attribute can be declared. The record structure is:
      *
      * <ul>
      *   <li>The attribute name                             (use {@link #readName()})</li>
@@ -509,7 +515,7 @@ public final class ChannelDecoder extend
     }
 
     /**
-     * Reads information (not data) about all variables from the NetCDF file header.
+     * Reads information (not data) about all variables from the netCDF file header.
      * The current implementation requires the dimensions to be read before the variables.
      * The record structure is:
      *
@@ -571,11 +577,12 @@ public final class ChannelDecoder extend
 
 
     // --------------------------------------------------------------------------------------------
-    //  Decoder API begins below this point. Above code was specific to parsing of NetCDF header.
+    //  Decoder API begins below this point. Above code was specific to parsing of netCDF header.
     // --------------------------------------------------------------------------------------------
 
     /**
-     * Returns a filename for information purpose only. This is used for formatting error messages.
+     * Returns a filename for formatting error message and for information purpose.
+     * The filename does not contain path.
      *
      * @return a filename to report in warning or error messages.
      */
@@ -588,7 +595,7 @@ public final class ChannelDecoder extend
      * Defines the groups where to search for named attributes, in preference order.
      * The {@code null} group name stands for the global attributes.
      *
-     * <p>Current implementation does nothing, since the NetCDF binary files that {@code ChannelDecoder}
+     * <p>Current implementation does nothing, since the netCDF binary files that {@code ChannelDecoder}
      * can read do not have groups anyway. Future SIS implementations may honor the given group names if
      * groups support is added.</p>
      */
@@ -599,7 +606,7 @@ public final class ChannelDecoder extend
     /**
      * Returns the path which is currently set. The array returned by this method may be only
      * a subset of the array given to {@link #setSearchPath(String[])} since only the name of
-     * groups which have been found in the NetCDF file are returned by this method.
+     * groups which have been found in the netCDF file are returned by this method.
      *
      * @return {@inheritDoc}
      */
@@ -610,7 +617,7 @@ public final class ChannelDecoder extend
 
     /**
      * Returns the dimension of the given name (eventually ignoring case), or {@code null} if none.
-     * This method searches in all dimensions found in the NetCDF file, regardless of variables.
+     * This method searches in all dimensions found in the netCDF file, regardless of variables.
      * The search will ignore case only if no exact match is found for the given name.
      *
      * @param  dimName  the name of the dimension to search.
@@ -628,7 +635,7 @@ public final class ChannelDecoder extend
     }
 
     /**
-     * Returns the NetCDF variable of the given name, or {@code null} if none.
+     * Returns the netCDF variable of the given name, or {@code null} if none.
      *
      * @param  name  the name of the variable to search, or {@code null}.
      * @return the attribute value, or {@code null} if none.
@@ -646,7 +653,7 @@ public final class ChannelDecoder extend
     }
 
     /**
-     * Returns the NetCDF attribute of the given name, or {@code null} if none.
+     * Returns the netCDF attribute of the given name, or {@code null} if none.
      * The {@code name} argument is typically (but is not restricted to) one of the constants
      * defined in the {@link org.apache.sis.storage.netcdf.AttributeNames} class.
      *
@@ -749,7 +756,7 @@ public final class ChannelDecoder extend
     }
 
     /**
-     * Returns all variables found in the NetCDF file.
+     * Returns all variables found in the netCDF file.
      * This method returns a direct reference to an internal array - do not modify.
      *
      * @return {@inheritDoc}
@@ -769,14 +776,16 @@ public final class ChannelDecoder extend
      */
     @Override
     public DiscreteSampling[] getDiscreteSampling() throws IOException, DataStoreException {
-        if ("trajectory".equalsIgnoreCase(stringValue(CF.FEATURE_TYPE))) {
+        if ("trajectory".equalsIgnoreCase(stringValue(CF.FEATURE_TYPE))) try {
             return FeaturesInfo.create(this);
+        } catch (IllegalArgumentException e) {
+            throw new DataStoreException(e.getLocalizedMessage(), e);
         }
         return new FeaturesInfo[0];
     }
 
     /**
-     * Returns all grid geometries found in the NetCDF file.
+     * Returns all grid geometries found in the netCDF file.
      * This method returns a direct reference to an internal array - do not modify.
      *
      * @return {@inheritDoc}
@@ -789,7 +798,7 @@ public final class ChannelDecoder extend
              * First, find all variables which are used as coordinate system axis. The keys in the map are
              * the grid dimensions which are the domain of the variable (i.e. the sources of the conversion
              * from grid coordinates to CRS coordinates). For each key there is usually only one value, but
-             * we try to make this code robust to unusual NetCDF files.
+             * we try to make this code robust to unusual netCDF files.
              */
             final Map<Dimension, List<VariableInfo>> dimToAxes = new IdentityHashMap<>();
             for (final VariableInfo variable : variables) {

Modified: sis/branches/JDK7/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/impl/Dimension.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/impl/Dimension.java?rev=1809390&r1=1809389&r2=1809390&view=diff
==============================================================================
--- sis/branches/JDK7/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/impl/Dimension.java [UTF-8] (original)
+++ sis/branches/JDK7/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/impl/Dimension.java [UTF-8] Sat Sep 23 10:56:44 2017
@@ -21,9 +21,9 @@ import org.apache.sis.util.Debug;
 
 
 /**
- * A dimension in a NetCDF file. A dimension can been seen as an axis in the grid space
+ * A dimension in a netCDF file. A dimension can been seen as an axis in the grid space
  * (not the geodetic space). Dimension are referenced by their index in other parts of
- * the NetCDF file header.
+ * the netCDF file header.
  *
  * @author  Johann Sorel (Geomatys)
  * @author  Martin Desruisseaux (Geomatys)
@@ -54,7 +54,7 @@ final class Dimension extends NamedEleme
     }
 
     /**
-     * Returns the name of this NetCDF dimension.
+     * Returns the name of this netCDF dimension.
      */
     @Override
     public String getName() {

Modified: sis/branches/JDK7/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/impl/FeaturesInfo.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/impl/FeaturesInfo.java?rev=1809390&r1=1809389&r2=1809390&view=diff
==============================================================================
--- sis/branches/JDK7/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/impl/FeaturesInfo.java [UTF-8] (original)
+++ sis/branches/JDK7/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/impl/FeaturesInfo.java [UTF-8] Sat Sep 23 10:56:44 2017
@@ -20,6 +20,7 @@ import java.util.Map;
 import java.util.List;
 import java.util.Collection;
 import java.util.ArrayList;
+import java.util.Arrays;
 import java.util.HashMap;
 import java.util.LinkedHashMap;
 import java.io.IOException;
@@ -27,12 +28,14 @@ import org.apache.sis.math.Vector;
 import org.apache.sis.internal.netcdf.DataType;
 import org.apache.sis.internal.netcdf.DiscreteSampling;
 import org.apache.sis.internal.netcdf.Resources;
-import org.apache.sis.internal.feature.Geometries;
 import org.apache.sis.internal.feature.MovingFeature;
+import org.apache.sis.storage.DataStore;
 import org.apache.sis.storage.DataStoreException;
 import org.apache.sis.feature.DefaultFeatureType;
 import org.apache.sis.feature.DefaultAttributeType;
 import org.apache.sis.util.collection.BackingStoreException;
+import org.apache.sis.util.logging.WarningListeners;
+import org.apache.sis.setup.GeometryLibrary;
 import ucar.nc2.constants.CF;
 
 // Branch-dependent imports
@@ -49,7 +52,7 @@ import org.opengis.feature.AttributeType
 
 /**
  * Implementations of the discrete sampling features decoder. This implementation shall be able to decode at least the
- * NetCDF files encoded as specified in the OGC 16-114 (OGC Moving Features Encoding Extension: NetCDF) specification.
+ * netCDF files encoded as specified in the OGC 16-114 (OGC Moving Features Encoding Extension: netCDF) specification.
  *
  * @author  Martin Desruisseaux (Geomatys)
  * @version 0.8
@@ -89,18 +92,21 @@ final class FeaturesInfo extends Discret
      */
     private final FeatureType type;
 
-    private final Geometries<?> factory = Geometries.implementation(null);          // TODO: shall be given by the store.
-
     /**
      * Creates a new discrete sampling parser for features identified by the given variable.
      *
      * @param  counts       the count of instances per feature.
      * @param  identifiers  the feature identifiers.
+     * @param  library      the library for geometric objects, or {@code null} for the default.
+     * @param  listeners    the set of registered warning listeners for the data store.
+     * @throws IllegalArgumentException if the given library is non-null but not available.
      */
     @SuppressWarnings("rawtypes")                               // Because of generic array creation.
     private FeaturesInfo(final Vector counts, final VariableInfo identifiers, final VariableInfo time,
-            final Collection<VariableInfo> coordinates, final Collection<VariableInfo> properties)
+            final Collection<VariableInfo> coordinates, final Collection<VariableInfo> properties,
+            final GeometryLibrary library, final WarningListeners<DataStore> listeners)
     {
+        super(library, listeners);
         this.counts      = counts;
         this.identifiers = identifiers;
         this.coordinates = coordinates.toArray(new VariableInfo[coordinates.size()]);
@@ -130,8 +136,9 @@ final class FeaturesInfo extends Discret
                     break;
                 }
                 default: {
+                    // TODO: use more accurate Number subtype for value class.
                     variable        = this.properties[i-2];
-                    valueClass      = Number.class;           // TODO: use more accurate value class.
+                    valueClass      = (variable.meaning(0) != null) ? String.class : Number.class;
                     minOccurs       = 0;
                     maxOccurs       = Integer.MAX_VALUE;
                     break;
@@ -155,6 +162,8 @@ final class FeaturesInfo extends Discret
 
     /**
      * Creates new discrete sampling parsers from the attribute values found in the given decoder.
+     *
+     * @throws IllegalArgumentException if the geometric object library is not available.
      */
     static FeaturesInfo[] create(final ChannelDecoder decoder) throws IOException, DataStoreException {
         final List<FeaturesInfo> features = new ArrayList<>(3);     // Will usually contain at most one element.
@@ -267,7 +276,8 @@ search: for (final VariableInfo counts :
                     }
                     final VariableInfo time = coordinates.remove("T");
                     if (time != null) {
-                        features.add(new FeaturesInfo(counts.read().compress(0), identifiers, time, coordinates.values(), properties));
+                        features.add(new FeaturesInfo(counts.read(), identifiers, time, coordinates.values(),
+                                properties, decoder.geomlib, decoder.listeners));
                     }
                 }
             }
@@ -276,15 +286,25 @@ search: for (final VariableInfo counts :
     }
 
     /**
+     * Returns the type of all features to be read by this {@code FeaturesInfo}.
+     */
+    @Override
+    public FeatureType getType() {
+        return type;
+    }
+
+    /**
      * Returns the stream of features.
+     *
+     * @param  parallel  ignored, since current version does not support parallelism.
      */
     @Override
-    public Stream<Feature> features() {
+    public Stream<Feature> features(boolean parallel) {
         return StreamSupport.stream(new Iter(), false);
     }
 
     /**
-     * Implementation of the iterator returned by {@link #features()}.
+     * Implementation of the iterator returned by {@link #features(boolean)}.
      */
     private final class Iter implements Spliterator<Feature> {
         /**
@@ -322,7 +342,7 @@ search: for (final VariableInfo counts :
             final int[] step   = {1};
             final Vector   id, t;
             final Vector[] coords = new Vector[coordinates.length];
-            final Vector[] props  = new Vector[properties.length];
+            final Object[] props  = new Object[properties.length];
             try {
                 id = identifiers.read();                    // Efficiency should be okay because of cached value.
                 t = time.read(lower, upper, step);
@@ -330,7 +350,18 @@ search: for (final VariableInfo counts :
                     coords[i] = coordinates[i].read(lower, upper, step);
                 }
                 for (int i=0; i<properties.length; i++) {
-                    props[i] = properties[i].read(lower, upper, step);
+                    final VariableInfo p = properties[i];
+                    final Vector data = p.read(lower, upper, step);
+                    if (p.isEnumeration()) {
+                        final String[] meanings = new String[data.size()];
+                        for (int j=0; j<meanings.length; j++) {
+                            String m = p.meaning(data.intValue(j));
+                            meanings[j] = (m != null) ? m : "";
+                        }
+                        props[i] = Arrays.asList(meanings);
+                    } else {
+                        props[i] = data;
+                    }
                 }
             } catch (IOException | DataStoreException e) {
                 throw new BackingStoreException(canNotReadFile(), e);
@@ -371,23 +402,16 @@ search: for (final VariableInfo counts :
 
         /**
          * Returns the characteristics of the iteration over feature instances.
-         * The iteration is assumed {@link #ORDERED} in the declaration order in the NetCDF file.
+         * The iteration is assumed {@link #ORDERED} in the declaration order in the netCDF file.
          * The iteration is {@link #NONNULL} (i.e. {@link #tryAdvance(Consumer)} is not allowed
          * to return null value) and {@link #IMMUTABLE} (i.e. we do not support modification of
-         * the NetCDF file while an iteration is in progress).
+         * the netCDF file while an iteration is in progress).
          *
-         * @return characteristics of iteration over the features in the NetCDF file.
+         * @return characteristics of iteration over the features in the netCDF file.
          */
         @Override
         public int characteristics() {
             return ORDERED | NONNULL | IMMUTABLE | SIZED;
         }
     }
-
-    /**
-     * Returns the error message for a file that can not be read.
-     */
-    final String canNotReadFile() {
-        return null;    // TODO
-    }
 }

Modified: sis/branches/JDK7/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/impl/GridGeometryInfo.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/impl/GridGeometryInfo.java?rev=1809390&r1=1809389&r2=1809390&view=diff
==============================================================================
--- sis/branches/JDK7/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/impl/GridGeometryInfo.java [UTF-8] (original)
+++ sis/branches/JDK7/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/impl/GridGeometryInfo.java [UTF-8] Sat Sep 23 10:56:44 2017
@@ -28,9 +28,9 @@ import org.apache.sis.util.resources.Err
 
 
 /**
- * Description of a grid geometry found in a NetCDF file.
+ * Description of a grid geometry found in a netCDF file.
  *
- * <p>In this class, the words "domain" and "range" are used in the NetCDF sense: they are the input
+ * <p>In this class, the words "domain" and "range" are used in the netCDF sense: they are the input
  * (domain) and output (range) of the function that convert grid indices to geodetic coordinates.</p>
  *
  * @author  Martin Desruisseaux (Geomatys)
@@ -96,25 +96,25 @@ final class GridGeometryInfo extends Gri
     }
 
     /**
-     * Returns all axes of the NetCDF coordinate system, together with the grid dimension to which the axis
+     * Returns all axes of the netCDF coordinate system, together with the grid dimension to which the axis
      * is associated. See {@code org.apache.sis.internal.netcdf.ucar.GridGeometryWrapper.getAxes()} for a
      * closer look on the relationship between this algorithm and the UCAR library.
      *
-     * <p>In this method, the words "domain" and "range" are used in the NetCDF sense: they are the input
+     * <p>In this method, the words "domain" and "range" are used in the netCDF sense: they are the input
      * (domain) and output (range) of the function that convert grid indices to geodetic coordinates.</p>
      *
      * <p>The domain of all axes is often the same than the domain of the variable, but not necessarily.
      * In particular, the relationship is not straightforward when the coordinate system contains
      * "two-dimensional axes" (in {@link ucar.nc2.dataset.CoordinateAxis2D} sense).</p>
      *
-     * @return the CRS axes, in NetCDF order (reverse of "natural" order).
+     * @return the CRS axes, in netCDF order (reverse of "natural" order).
      * @throws IOException if an I/O operation was necessary but failed.
      * @throws DataStoreException if a logical error occurred.
      */
     @Override
     public Axis[] getAxes() throws IOException, DataStoreException {
         /*
-         * Process the variables in the order the appear in the sequence of bytes that make the NetCDF files.
+         * Process the variables in the order the appear in the sequence of bytes that make the netCDF files.
          * This is often the same order than the indices, but not necessarily. The intend is to reduce the
          * amount of disk seek operations.
          */
@@ -150,7 +150,7 @@ final class GridGeometryInfo extends Gri
             /*
              * Get the grid dimensions (part of the "domain" in UCAR terminology) used for computing
              * the ordinate values along the current axis. There is exactly 1 such grid dimension in
-             * straightforward NetCDF files. However some more complex files may have 2 dimensions.
+             * straightforward netCDF files. However some more complex files may have 2 dimensions.
              */
             int i = 0;
             final Dimension[] axisDomain = axis.dimensions;

Modified: sis/branches/JDK7/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/impl/VariableInfo.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/impl/VariableInfo.java?rev=1809390&r1=1809389&r2=1809390&view=diff
==============================================================================
--- sis/branches/JDK7/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/impl/VariableInfo.java [UTF-8] (original)
+++ sis/branches/JDK7/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/impl/VariableInfo.java [UTF-8] Sat Sep 23 10:56:44 2017
@@ -31,6 +31,7 @@ import org.apache.sis.internal.storage.i
 import org.apache.sis.internal.storage.io.Region;
 import org.apache.sis.storage.DataStoreException;
 import org.apache.sis.storage.DataStoreContentException;
+import org.apache.sis.storage.netcdf.AttributeNames;
 import org.apache.sis.util.resources.Errors;
 import org.apache.sis.util.CharSequences;
 import org.apache.sis.util.Numbers;
@@ -38,9 +39,9 @@ import org.apache.sis.math.Vector;
 
 
 /**
- * Description of a variable found in a NetCDF file.
+ * Description of a variable found in a netCDF file.
  * The natural ordering of {@code VariableInfo} is the order in which the variables appear in the stream of bytes
- * that make the NetCDF file. Reading variables in natural order reduces the amount of channel seek operations.
+ * that make the netCDF file. Reading variables in natural order reduces the amount of channel seek operations.
  *
  * @author  Johann Sorel (Geomatys)
  * @author  Martin Desruisseaux (Geomatys)
@@ -103,7 +104,7 @@ final class VariableInfo extends Variabl
     private final Map<String,Object> attributes;
 
     /**
-     * The NetCDF type of data, or {@code null} if unknown.
+     * The netCDF type of data, or {@code null} if unknown.
      */
     private final DataType dataType;
 
@@ -115,7 +116,7 @@ final class VariableInfo extends Variabl
 
     /**
      * {@code true} if this variable seems to be a coordinate system axis, as determined by comparing its name
-     * with the name of all dimensions in the NetCDF file. This information is computed at construction time
+     * with the name of all dimensions in the netCDF file. This information is computed at construction time
      * because requested more than once.
      *
      * @see #isCoordinateSystemAxis()
@@ -130,15 +131,24 @@ final class VariableInfo extends Variabl
     private transient Vector values;
 
     /**
+     * The {@code flag_meanings} values (used for enumeration values), or {@code null} if this variable is not
+     * an enumeration.
+     *
+     * @see #isEnumeration()
+     * @see #meaning(int)
+     */
+    private final String[] meanings;
+
+    /**
      * Creates a new variable.
      *
      * @param  input       the channel together with a buffer for reading the variable data.
      * @param  name        the variable name.
      * @param  dimensions  the dimensions of this variable.
      * @param  attributes  the attributes associates to the variable, or an empty map if none.
-     * @param  dataType    the NetCDF type of data, or {@code null} if unknown.
+     * @param  dataType    the netCDF type of data, or {@code null} if unknown.
      * @param  size        the variable size, used for verification purpose only.
-     * @param  offset      the offset where the variable data begins in the NetCDF file.
+     * @param  offset      the offset where the variable data begins in the netCDF file.
      */
     VariableInfo(final ChannelDataInput      input,
                  final String                name,
@@ -157,7 +167,7 @@ final class VariableInfo extends Variabl
         this.attributes = attributes;
         this.dataType   = dataType;
         /*
-         * The 'size' value is provided in the NetCDF files, but doesn't need to be stored since it
+         * The 'size' value is provided in the netCDF files, but doesn't need to be stored since it
          * is redundant with the dimension lengths and is not large enough for big variables anyway.
          */
         if (dataType != null && dataType.number >= Numbers.BYTE && dataType.number <= Numbers.DOUBLE) {
@@ -182,6 +192,16 @@ final class VariableInfo extends Variabl
         } else {
             isCoordinateSystemAxis = false;
         }
+        /*
+         * Verify if this variable is an enumeration. If yes, we remove the attributes that define the
+         * enumeration since those attributes may be verbose and "pollute" the variable definition.
+         */
+        String[] meanings = stringValues(attributes.remove(AttributeNames.FLAG_MEANINGS));
+        switch (meanings.length) {
+            case 0: meanings = null; break;
+            case 1: meanings = (String[]) CharSequences.split(meanings[0], ' '); break;
+        }
+        this.meanings = meanings;
     }
 
     /**
@@ -228,8 +248,15 @@ final class VariableInfo extends Variabl
     }
 
     /**
+     * Returns {@code true} if this variable is an enumeration.
+     */
+    public boolean isEnumeration() {
+        return meanings != null;
+    }
+
+    /**
      * Returns {@code true} if this variable seems to be a coordinate system axis,
-     * determined by comparing its name with the name of all dimensions in the NetCDF file.
+     * determined by comparing its name with the name of all dimensions in the netCDF file.
      */
     @Override
     public boolean isCoordinateSystemAxis() {
@@ -385,10 +412,14 @@ final class VariableInfo extends Variabl
                 throw new DataStoreContentException(unknownType());
             }
             long length = 1;
+            boolean overflow = false;
             for (final Dimension dimension : dimensions) {
                 length *= dimension.length();
+                if (length > Integer.MAX_VALUE) {
+                    overflow = true;
+                }
             }
-            if (length > Integer.MAX_VALUE) {
+            if (overflow) {
                 throw new DataStoreContentException(Errors.format(Errors.Keys.ExcessiveListSize_2, name, length));
             }
             final int dimension = dimensions.length;
@@ -453,6 +484,18 @@ final class VariableInfo extends Variabl
     }
 
     /**
+     * Returns the meaning of the given ordinal value, or {@code null} if none.
+     * Callers must have verified that {@link #isEnumeration()} returned {@code true}
+     * before to invoke this method
+     *
+     * @param  ordinal  the ordinal of the enumeration for which to get the value.
+     * @return the value associated to the given ordinal, or {@code null} if none.
+     */
+    public String meaning(final int ordinal) {
+        return (ordinal >= 0 && ordinal < meanings.length) ? meanings[ordinal] : null;
+    }
+
+    /**
      * Returns the error message for an unknown data type.
      */
     private String unknownType() {
@@ -460,8 +503,8 @@ final class VariableInfo extends Variabl
     }
 
     /**
-     * Returns -1 if this variable is located before the other variable in the streal of bytes that make
-     * the NetCDF file, or +1 if it is located after.
+     * Returns -1 if this variable is located before the other variable in the stream of bytes that make
+     * the netCDF file, or +1 if it is located after.
      */
     @Override
     public int compareTo(final VariableInfo other) {

Modified: sis/branches/JDK7/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/impl/package-info.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/impl/package-info.java?rev=1809390&r1=1809389&r2=1809390&view=diff
==============================================================================
--- sis/branches/JDK7/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/impl/package-info.java [UTF-8] (original)
+++ sis/branches/JDK7/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/impl/package-info.java [UTF-8] Sat Sep 23 10:56:44 2017
@@ -17,7 +17,7 @@
 
 /**
  * Implementation of the {@link org.apache.sis.internal.netcdf} API as a standalone library.
- * This is useful only for the NetCDF binary format (no NcML, no GRIB, no BUFR).
+ * This is useful only for the netCDF binary format (no NcML, no GRIB, no BUFR).
  * This package works with channels instead than files, which is a little bit easier to use
  * in some environments.
  *

Modified: sis/branches/JDK7/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/package-info.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/package-info.java?rev=1809390&r1=1809389&r2=1809390&view=diff
==============================================================================
--- sis/branches/JDK7/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/package-info.java [UTF-8] (original)
+++ sis/branches/JDK7/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/package-info.java [UTF-8] Sat Sep 23 10:56:44 2017
@@ -16,9 +16,9 @@
  */
 
 /**
- * The API used internally by Apache SIS for fetching all data from NetCDF files.
+ * The API used internally by Apache SIS for fetching all data from netCDF files.
  * We use this API for isolating Apache SIS from the library used for reading the
- * NetCDF file: it can be either the UCAR library, or our own internal library.
+ * netCDF file: it can be either the UCAR library, or our own internal library.
  *
  * <p>We do not use systematically the UCAR library because it is quite large (especially when including
  * all dependencies) while SIS uses only a fraction of it. This is because the UCAR library provides some
@@ -27,13 +27,13 @@
  * its raw format, while the UCAR high level API provides the values converted by the offset and scale
  * factors.</p>
  *
- * <p>A side effect of this isolation layer is also to adapt NetCDF vocabulary to Apache SIS one.
- * For example what NetCDF calls <cite>"coordinate system"</cite> is actually a mix of what OGC/ISO
+ * <p>A side effect of this isolation layer is also to adapt netCDF vocabulary to Apache SIS one.
+ * For example what netCDF calls <cite>"coordinate system"</cite> is actually a mix of what OGC/ISO
  * specifications call <cite>"coordinate system"</cite>, <cite>"coordinate reference system"</cite>
- * and <cite>"grid geometry"</cite>. The NetCDF coordinate system <cite>"range"</cite> is closer to
- * ISO 19123 <cite>"domain"</cite>, the NetCDF coordinate system <cite>"domain"</cite> is closer to
+ * and <cite>"grid geometry"</cite>. The netCDF coordinate system <cite>"range"</cite> is closer to
+ * ISO 19123 <cite>"domain"</cite>, the netCDF coordinate system <cite>"domain"</cite> is closer to
  * ISO 19123 <cite>"grid envelope"</cite> and the ISO 19123 <cite>"range"</cite> is rather related
- * to the NetCDF variable minimum and maximum values. Trying to use OGC/ISO and NetCDF objects in
+ * to the netCDF variable minimum and maximum values. Trying to use OGC/ISO and netCDF objects in
  * the same code appears to be <strong>very</strong> confusing. This isolation layer allows our code
  * to use a more consistent vocabulary (compared to the rest of Apache SIS).</p>
  *



Mime
View raw message