sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject svn commit: r1817597 [14/19] - in /sis/branches/ISO-19115-3: ./ application/ application/sis-console/ application/sis-console/src/main/artifact/ application/sis-console/src/main/artifact/lib/ application/sis-console/src/main/artifact/lib/darwin/ applic...
Date Sat, 09 Dec 2017 10:57:47 GMT
Modified: sis/branches/ISO-19115-3/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/NamedElement.java
URL: http://svn.apache.org/viewvc/sis/branches/ISO-19115-3/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/NamedElement.java?rev=1817597&r1=1817596&r2=1817597&view=diff
==============================================================================
--- sis/branches/ISO-19115-3/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/NamedElement.java [UTF-8] (original)
+++ sis/branches/ISO-19115-3/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/NamedElement.java [UTF-8] Sat Dec  9 10:57: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/ISO-19115-3/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/Resources.java
URL: http://svn.apache.org/viewvc/sis/branches/ISO-19115-3/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/Resources.java?rev=1817597&r1=1817596&r2=1817597&view=diff
==============================================================================
--- sis/branches/ISO-19115-3/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/Resources.java [UTF-8] (original)
+++ sis/branches/ISO-19115-3/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/Resources.java [UTF-8] Sat Dec  9 10:57: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/ISO-19115-3/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/Resources.properties
URL: http://svn.apache.org/viewvc/sis/branches/ISO-19115-3/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/Resources.properties?rev=1817597&r1=1817596&r2=1817597&view=diff
==============================================================================
--- sis/branches/ISO-19115-3/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/Resources.properties [ISO-8859-1] (original)
+++ sis/branches/ISO-19115-3/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/Resources.properties [ISO-8859-1] Sat Dec  9 10:57: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/ISO-19115-3/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/Resources_fr.properties
URL: http://svn.apache.org/viewvc/sis/branches/ISO-19115-3/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/Resources_fr.properties?rev=1817597&r1=1817596&r2=1817597&view=diff
==============================================================================
--- sis/branches/ISO-19115-3/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/Resources_fr.properties [ISO-8859-1] (original)
+++ sis/branches/ISO-19115-3/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/Resources_fr.properties [ISO-8859-1] Sat Dec  9 10:57: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/ISO-19115-3/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/Variable.java
URL: http://svn.apache.org/viewvc/sis/branches/ISO-19115-3/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/Variable.java?rev=1817597&r1=1817596&r2=1817597&view=diff
==============================================================================
--- sis/branches/ISO-19115-3/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/Variable.java [UTF-8] (original)
+++ sis/branches/ISO-19115-3/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/Variable.java [UTF-8] Sat Dec  9 10:57: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/ISO-19115-3/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/impl/ChannelDecoder.java
URL: http://svn.apache.org/viewvc/sis/branches/ISO-19115-3/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/impl/ChannelDecoder.java?rev=1817597&r1=1817596&r2=1817597&view=diff
==============================================================================
--- sis/branches/ISO-19115-3/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/impl/ChannelDecoder.java [UTF-8] (original)
+++ sis/branches/ISO-19115-3/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/impl/ChannelDecoder.java [UTF-8] Sat Dec  9 10:57: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;
 
@@ -63,7 +66,7 @@ import java.time.DateTimeException;
 
 
 /**
- * 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}.
  *
@@ -78,7 +81,7 @@ import java.time.DateTimeException;
  */
 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
@@ -94,13 +97,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
@@ -120,7 +123,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.
      */
 
@@ -159,21 +162,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()
      */
@@ -185,7 +188,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)
@@ -193,7 +196,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)
@@ -212,31 +215,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.
@@ -245,7 +251,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();
@@ -307,7 +313,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.
      */
@@ -317,10 +323,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);
     }
 
     /**
@@ -337,7 +343,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.
@@ -360,7 +366,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 {
@@ -452,7 +458,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>
@@ -460,7 +466,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];
@@ -480,8 +486,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>
@@ -508,7 +514,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:
      *
@@ -549,7 +555,7 @@ public final class ChannelDecoder extend
              * Following block is almost a copy-and-paste of similar block in the contructor,
              * but with less cases in the "switch" statements.
              */
-            Map<String,Object> attributes = null;
+            Map<String,Object> attributes = Collections.emptyMap();
             final long tn = input.readLong();
             if (tn != 0) {
                 final int tag = (int) (tn >>> Integer.SIZE);
@@ -570,11 +576,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.
      */
@@ -587,7 +594,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>
      */
@@ -598,7 +605,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}
      */
@@ -609,7 +616,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.
@@ -627,7 +634,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.
@@ -645,7 +652,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.
      *
@@ -748,7 +755,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}
@@ -768,14 +775,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}
@@ -788,7 +797,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/ISO-19115-3/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/impl/Dimension.java
URL: http://svn.apache.org/viewvc/sis/branches/ISO-19115-3/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/impl/Dimension.java?rev=1817597&r1=1817596&r2=1817597&view=diff
==============================================================================
--- sis/branches/ISO-19115-3/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/impl/Dimension.java [UTF-8] (original)
+++ sis/branches/ISO-19115-3/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/impl/Dimension.java [UTF-8] Sat Dec  9 10:57: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/ISO-19115-3/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/impl/FeaturesInfo.java
URL: http://svn.apache.org/viewvc/sis/branches/ISO-19115-3/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/impl/FeaturesInfo.java?rev=1817597&r1=1817596&r2=1817597&view=diff
==============================================================================
--- sis/branches/ISO-19115-3/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/impl/FeaturesInfo.java [UTF-8] (original)
+++ sis/branches/ISO-19115-3/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/impl/FeaturesInfo.java [UTF-8] Sat Dec  9 10:57: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
@@ -48,7 +51,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
@@ -88,18 +91,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()]);
@@ -129,8 +135,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;
@@ -154,6 +161,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.
@@ -266,7 +275,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));
                     }
                 }
             }
@@ -275,15 +285,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> {
         /**
@@ -316,7 +336,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);
@@ -324,7 +344,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);
@@ -365,23 +396,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/ISO-19115-3/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/impl/GridGeometryInfo.java
URL: http://svn.apache.org/viewvc/sis/branches/ISO-19115-3/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/impl/GridGeometryInfo.java?rev=1817597&r1=1817596&r2=1817597&view=diff
==============================================================================
--- sis/branches/ISO-19115-3/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/impl/GridGeometryInfo.java [UTF-8] (original)
+++ sis/branches/ISO-19115-3/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/impl/GridGeometryInfo.java [UTF-8] Sat Dec  9 10:57: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/ISO-19115-3/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/impl/VariableInfo.java
URL: http://svn.apache.org/viewvc/sis/branches/ISO-19115-3/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/impl/VariableInfo.java?rev=1817597&r1=1817596&r2=1817597&view=diff
==============================================================================
--- sis/branches/ISO-19115-3/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/impl/VariableInfo.java [UTF-8] (original)
+++ sis/branches/ISO-19115-3/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/impl/VariableInfo.java [UTF-8] Sat Dec  9 10:57: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,20 @@ 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.
+         */
+        if (!attributes.isEmpty()) {    // For avoiding UnsupportedOperationException if unmodifiable map.
+            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;
+        } else {
+            meanings = null;
+        }
     }
 
     /**
@@ -228,8 +252,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 +416,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 +488,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 +507,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/ISO-19115-3/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/impl/package-info.java
URL: http://svn.apache.org/viewvc/sis/branches/ISO-19115-3/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/impl/package-info.java?rev=1817597&r1=1817596&r2=1817597&view=diff
==============================================================================
--- sis/branches/ISO-19115-3/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/impl/package-info.java [UTF-8] (original)
+++ sis/branches/ISO-19115-3/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/impl/package-info.java [UTF-8] Sat Dec  9 10:57: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/ISO-19115-3/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/package-info.java
URL: http://svn.apache.org/viewvc/sis/branches/ISO-19115-3/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/package-info.java?rev=1817597&r1=1817596&r2=1817597&view=diff
==============================================================================
--- sis/branches/ISO-19115-3/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/package-info.java [UTF-8] (original)
+++ sis/branches/ISO-19115-3/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/package-info.java [UTF-8] Sat Dec  9 10:57: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>
  *

Modified: sis/branches/ISO-19115-3/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/ucar/DecoderWrapper.java
URL: http://svn.apache.org/viewvc/sis/branches/ISO-19115-3/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/ucar/DecoderWrapper.java?rev=1817597&r1=1817596&r2=1817597&view=diff
==============================================================================
--- sis/branches/ISO-19115-3/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/ucar/DecoderWrapper.java [UTF-8] (original)
+++ sis/branches/ISO-19115-3/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/ucar/DecoderWrapper.java [UTF-8] Sat Dec  9 10:57:44 2017
@@ -16,6 +16,7 @@
  */
 package org.apache.sis.internal.netcdf.ucar;
 
+import java.io.File;
 import java.util.Date;
 import java.util.List;
 import java.util.EnumSet;
@@ -44,11 +45,13 @@ import org.apache.sis.internal.netcdf.De
 import org.apache.sis.internal.netcdf.Variable;
 import org.apache.sis.internal.netcdf.GridGeometry;
 import org.apache.sis.internal.netcdf.DiscreteSampling;
+import org.apache.sis.setup.GeometryLibrary;
 import org.apache.sis.storage.DataStore;
+import org.apache.sis.storage.DataStoreException;
 
 
 /**
- * Provides NetCDF decoding services based on the NetCDF library.
+ * Provides netCDF decoding services based on the netCDF library.
  *
  * @author  Martin Desruisseaux (Geomatys)
  * @version 0.8
@@ -57,7 +60,7 @@ import org.apache.sis.storage.DataStore;
  */
 public final class DecoderWrapper extends Decoder implements CancelTask {
     /**
-     * The NetCDF file to read.
+     * The netCDF file to read.
      * This file is set at construction time.
      *
      * <p>This {@code DecoderWrapper} class does <strong>not</strong> close this file.
@@ -95,39 +98,54 @@ public final class DecoderWrapper extend
     private transient GridGeometry[] geometries;
 
     /**
-     * Creates a new decoder for the given NetCDF file. While this constructor accepts arbitrary
+     * Creates a new decoder for the given netCDF file. While this constructor accepts arbitrary
      * {@link NetcdfFile} instance, the {@link NetcdfDataset} subclass is necessary in order to
      * get coordinate system information.
      *
+     * @param geomlib    the library for geometric objects, or {@code null} for the default.
+     * @param file       the netCDF file from which to read data.
      * @param listeners  where to send the warnings.
-     * @param file       the NetCDF file from which to read data.
      */
-    public DecoderWrapper(final WarningListeners<DataStore> listeners, final NetcdfFile file) {
-        super(listeners);
+    public DecoderWrapper(final NetcdfFile file, final GeometryLibrary geomlib, final WarningListeners<DataStore> listeners) {
+        super(geomlib, listeners);
         this.file = file;
     }
 
     /**
      * Creates a new decoder for the given filename.
      *
+     * @param  geomlib    the library for geometric objects, or {@code null} for the default.
+     * @param  filename   the name of the netCDF file from which to read data.
      * @param  listeners  where to send the warnings.
-     * @param  filename   the name of the NetCDF file from which to read data.
-     * @throws IOException if an error occurred while opening the NetCDF file.
+     * @throws IOException if an error occurred while opening the netCDF file.
      */
     @SuppressWarnings("ThisEscapedInObjectConstruction")
-    public DecoderWrapper(final WarningListeners<DataStore> listeners, final String filename) throws IOException {
-        super(listeners);
+    public DecoderWrapper(final String filename, final GeometryLibrary geomlib, final WarningListeners<DataStore> listeners)
+            throws IOException
+    {
+        super(geomlib, listeners);
         file = NetcdfDataset.openDataset(filename, false, this);
     }
 
     /**
-     * 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.
      */
     @Override
     public String getFilename() {
-        return file.getLocation();
+        String filename = file.getLocation();
+        if (filename != null) {
+            int s = filename.lastIndexOf(File.separatorChar);
+            if (s < 0 && File.separatorChar != '/') {
+                s = filename.lastIndexOf('/');
+            }
+            if (s >= 0) {
+                filename = filename.substring(s+1);
+            }
+        }
+        return filename;
     }
 
     /**
@@ -154,7 +172,7 @@ public final class DecoderWrapper 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 the current search path.
      */
@@ -181,7 +199,7 @@ public final class DecoderWrapper extend
     }
 
     /**
-     * Returns the NetCDF attribute of the given name in the given group, or {@code null} if none.
+     * Returns the netCDF attribute of the given name in the given group, or {@code null} if none.
      * This method is invoked for every global and group attributes to be read by this class (but
      * not {@linkplain ucar.nc2.VariableSimpleIF variable} attributes), thus providing a single point
      * where we can filter the attributes to be read - if we want to do that in a future version.
@@ -323,7 +341,7 @@ public final class DecoderWrapper 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 all variables, or an empty array if none.
@@ -346,10 +364,11 @@ public final class DecoderWrapper extend
      *
      * @return {@inheritDoc}
      * @throws IOException if an I/O operation was necessary but failed.
+     * @throws DataStoreException if the library of geometric objects is not available.
      */
     @Override
     @SuppressWarnings("null")
-    public DiscreteSampling[] getDiscreteSampling() throws IOException {
+    public DiscreteSampling[] getDiscreteSampling() throws IOException, DataStoreException {
         if (features == null && file instanceof NetcdfDataset) {
             features = FeatureDatasetFactoryManager.wrap(null, (NetcdfDataset) file, this,
                     new Formatter(new LogAdapter(listeners), listeners.getLocale()));
@@ -359,14 +378,18 @@ public final class DecoderWrapper extend
             fc = ((FeatureDatasetPoint) features).getPointFeatureCollectionList();
         }
         final FeaturesWrapper[] wrappers = new FeaturesWrapper[(fc != null) ? fc.size() : 0];
-        for (int i=0; i<wrappers.length; i++) {
-            wrappers[i] = new FeaturesWrapper(fc.get(i));
+        try {
+            for (int i=0; i<wrappers.length; i++) {
+                wrappers[i] = new FeaturesWrapper(fc.get(i), geomlib, listeners);
+            }
+        } catch (IllegalArgumentException e) {
+            throw new DataStoreException(e.getLocalizedMessage(), e);
         }
         return wrappers;
     }
 
     /**
-     * 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 returns a direct reference to an internal array - do not modify.
      *
      * @return all grid geometries, or an empty array if none.
@@ -394,7 +417,7 @@ public final class DecoderWrapper extend
     }
 
     /**
-     * Invoked by the UCAR NetCDF library for checking if the reading process has been canceled.
+     * Invoked by the UCAR netCDF library for checking if the reading process has been canceled.
      * This method returns the {@link #canceled} flag.
      *
      * @return the {@link #canceled} flag.
@@ -415,7 +438,7 @@ public final class DecoderWrapper extend
     }
 
     /**
-     * Invoked by the UCAR NetCDF library when an error occurred.
+     * Invoked by the UCAR netCDF library when an error occurred.
      *
      * @param  message  the error message.
      */
@@ -425,7 +448,7 @@ public final class DecoderWrapper extend
     }
 
     /**
-     * Closes the NetCDF file.
+     * Closes the netCDF file.
      *
      * @throws IOException if an error occurred while closing the file.
      */

Modified: sis/branches/ISO-19115-3/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/ucar/FeaturesWrapper.java
URL: http://svn.apache.org/viewvc/sis/branches/ISO-19115-3/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/ucar/FeaturesWrapper.java?rev=1817597&r1=1817596&r2=1817597&view=diff
==============================================================================
--- sis/branches/ISO-19115-3/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/ucar/FeaturesWrapper.java [UTF-8] (original)
+++ sis/branches/ISO-19115-3/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/ucar/FeaturesWrapper.java [UTF-8] Sat Dec  9 10:57:44 2017
@@ -16,12 +16,16 @@
  */
 package org.apache.sis.internal.netcdf.ucar;
 
+import org.apache.sis.storage.DataStore;
+import org.apache.sis.setup.GeometryLibrary;
 import org.apache.sis.internal.netcdf.DiscreteSampling;
+import org.apache.sis.util.logging.WarningListeners;
 import ucar.nc2.ft.FeatureCollection;
 
 // Branch-dependent imports
 import java.util.stream.Stream;
 import org.opengis.feature.Feature;
+import org.opengis.feature.FeatureType;
 
 
 /**
@@ -40,17 +44,26 @@ final class FeaturesWrapper extends Disc
 
     /**
      * Creates a new discrete sampling parser.
+     *
+     * @param  factory    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.
      */
-    FeaturesWrapper(final FeatureCollection features) {
+    FeaturesWrapper(final FeatureCollection features, final GeometryLibrary factory, final WarningListeners<DataStore> listeners) {
+        super(factory, listeners);
         this.features = features;
     }
 
+    @Override
+    public FeatureType getType() {
+        throw new UnsupportedOperationException();      // TODO
+    }
 
     /**
      * Returns the stream of features.
      */
     @Override
-    public Stream<Feature> features() {
+    public Stream<Feature> features(boolean parallel) {
         throw new UnsupportedOperationException();      // TODO
     }
 }

Modified: sis/branches/ISO-19115-3/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/ucar/GridGeometryWrapper.java
URL: http://svn.apache.org/viewvc/sis/branches/ISO-19115-3/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/ucar/GridGeometryWrapper.java?rev=1817597&r1=1817596&r2=1817597&view=diff
==============================================================================
--- sis/branches/ISO-19115-3/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/ucar/GridGeometryWrapper.java [UTF-8] (original)
+++ sis/branches/ISO-19115-3/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/ucar/GridGeometryWrapper.java [UTF-8] Sat Dec  9 10:57:44 2017
@@ -31,7 +31,7 @@ import org.apache.sis.util.ArraysExt;
 
 
 /**
- * Information about NetCDF coordinate system, which include information about grid geometries.
+ * Information about netCDF coordinate system, which include information about grid geometries.
  * In OGC/ISO specifications, the coordinate system and the grid geometries are distinct entities.
  * However the UCAR model takes a different point of view where the coordinate system holds some
  * of the grid geometry information.
@@ -43,14 +43,14 @@ import org.apache.sis.util.ArraysExt;
  */
 final class GridGeometryWrapper extends GridGeometry {
     /**
-     * The NetCDF coordinate system to wrap.
+     * The netCDF coordinate system to wrap.
      */
     private final CoordinateSystem netcdfCS;
 
     /**
-     * Creates a new grid geometry for the given NetCDF coordinate system.
+     * Creates a new grid geometry for the given netCDF coordinate system.
      *
-     * @param  cs  the NetCDF coordinate system, or {@code null} if none.
+     * @param  cs  the netCDF coordinate system, or {@code null} if none.
      */
     GridGeometryWrapper(final CoordinateSystem cs) {
         netcdfCS = cs;
@@ -77,10 +77,10 @@ final class GridGeometryWrapper extends
     }
 
     /**
-     * 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.
      *
-     * <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 (or the {@linkplain CoordinateSystem#getDomain() coordinate system domain})
@@ -88,7 +88,7 @@ final class GridGeometryWrapper extends
      * In particular, the relationship is not straightforward when the coordinate system contains instances
      * of {@link CoordinateAxis2D}.</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.
      */
@@ -121,7 +121,7 @@ final class GridGeometryWrapper extends
             /*
              * 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 List<Dimension> axisDomain = axis.getDimensions();
@@ -135,7 +135,7 @@ final class GridGeometryWrapper extends
                 }
                 /*
                  * If the axis dimension has not been found in the coordinate system (sourceDim < 0),
-                 * then there is maybe a problem with the NetCDF file. However for the purpose of this
+                 * then there is maybe a problem with the netCDF file. However for the purpose of this
                  * package, we can proceed as if the dimension does not exist ('i' not incremented).
                  */
             }

Modified: sis/branches/ISO-19115-3/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/ucar/LogAdapter.java
URL: http://svn.apache.org/viewvc/sis/branches/ISO-19115-3/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/ucar/LogAdapter.java?rev=1817597&r1=1817596&r2=1817597&view=diff
==============================================================================
--- sis/branches/ISO-19115-3/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/ucar/LogAdapter.java [UTF-8] (original)
+++ sis/branches/ISO-19115-3/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/ucar/LogAdapter.java [UTF-8] Sat Dec  9 10:57:44 2017
@@ -22,7 +22,7 @@ import org.apache.sis.util.logging.Warni
 
 
 /**
- * Forwards NetCDF logging to the Apache SIS warning listeners.
+ * Forwards netCDF logging to the Apache SIS warning listeners.
  * NetCDF sends message to a user-specified {@link java.util.Formatter} with one message per line.
  * This class intercepts the characters and send them to the {@link WarningListeners} every time
  * that a complete line has been received.
@@ -34,7 +34,7 @@ import org.apache.sis.util.logging.Warni
  */
 final class LogAdapter implements Appendable {
     /**
-     * Temporary buffer where to append the NetCDF logging messages.
+     * Temporary buffer where to append the netCDF logging messages.
      */
     private final StringBuilder buffer = new StringBuilder();
 

Modified: sis/branches/ISO-19115-3/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/ucar/VariableWrapper.java
URL: http://svn.apache.org/viewvc/sis/branches/ISO-19115-3/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/ucar/VariableWrapper.java?rev=1817597&r1=1817596&r2=1817597&view=diff
==============================================================================
--- sis/branches/ISO-19115-3/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/ucar/VariableWrapper.java [UTF-8] (original)
+++ sis/branches/ISO-19115-3/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/ucar/VariableWrapper.java [UTF-8] Sat Dec  9 10:57:44 2017
@@ -34,7 +34,7 @@ import org.apache.sis.storage.DataStoreC
 
 
 /**
- * A {@link Variable} backed by the UCAR NetCDF library.
+ * A {@link Variable} backed by the UCAR netCDF library.
  *
  * @author  Martin Desruisseaux (Geomatys)
  * @author  Johann Sorel (Geomatys)
@@ -44,12 +44,12 @@ import org.apache.sis.storage.DataStoreC
  */
 final class VariableWrapper extends Variable {
     /**
-     * The NetCDF variable.
+     * The netCDF variable.
      */
     private final VariableIF variable;
 
     /**
-     * Creates a new variable wrapping the given NetCDF interface.
+     * Creates a new variable wrapping the given netCDF interface.
      */
     VariableWrapper(final VariableIF variable) {
         this.variable = variable;

Modified: sis/branches/ISO-19115-3/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/ucar/package-info.java
URL: http://svn.apache.org/viewvc/sis/branches/ISO-19115-3/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/ucar/package-info.java?rev=1817597&r1=1817596&r2=1817597&view=diff
==============================================================================
--- sis/branches/ISO-19115-3/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/ucar/package-info.java [UTF-8] (original)
+++ sis/branches/ISO-19115-3/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/ucar/package-info.java [UTF-8] Sat Dec  9 10:57:44 2017
@@ -17,7 +17,7 @@
 
 /**
  * Implementation of the {@link org.apache.sis.internal.netcdf} API
- * as wrappers around the UCAR NetCDF library.
+ * as wrappers around the UCAR netCDF library.
  *
  * @author  Martin Desruisseaux (IRD, Geomatys)
  * @version 0.8



Mime
View raw message