sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject svn commit: r1777066 - in /sis/branches/JDK8: core/sis-feature/src/main/java/org/apache/sis/feature/ storage/sis-earth-observation/src/main/java/org/apache/sis/storage/earthobservation/ storage/sis-storage/src/main/java/org/apache/sis/internal/storage/...
Date Tue, 03 Jan 2017 05:14:47 GMT
Author: desruisseaux
Date: Tue Jan  3 05:14:46 2017
New Revision: 1777066

URL: http://svn.apache.org/viewvc?rev=1777066&view=rev
Log:
Add a DataStore.getDisplayName() method in the parent class and remove the private 'name' field in the subclasses that managed their own display name.
Add a FeatureStore.getFeatureType(String) method and move the GenericNameMap in public API for making easier the task of DataStore implementations.
Renamed GenericNameMap as FeatureNaming and provide more localization support for IllegalNameException.

Added:
    sis/branches/JDK8/storage/sis-storage/src/main/java/org/apache/sis/storage/FeatureNaming.java
      - copied, changed from r1777065, sis/branches/JDK8/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/GenericNameMap.java
    sis/branches/JDK8/storage/sis-storage/src/test/java/org/apache/sis/storage/DataStoreMock.java   (with props)
    sis/branches/JDK8/storage/sis-storage/src/test/java/org/apache/sis/storage/FeatureNamingTest.java
      - copied, changed from r1777065, sis/branches/JDK8/storage/sis-storage/src/test/java/org/apache/sis/internal/storage/GenericNameMapTest.java
Removed:
    sis/branches/JDK8/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/GenericNameMap.java
    sis/branches/JDK8/storage/sis-storage/src/test/java/org/apache/sis/internal/storage/GenericNameMapTest.java
Modified:
    sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/feature/DefaultFeatureType.java
    sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/feature/Features.java
    sis/branches/JDK8/storage/sis-earth-observation/src/main/java/org/apache/sis/storage/earthobservation/LandsatStore.java
    sis/branches/JDK8/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/FeatureStore.java
    sis/branches/JDK8/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/Resources.java
    sis/branches/JDK8/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/Resources.properties
    sis/branches/JDK8/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/Resources_fr.properties
    sis/branches/JDK8/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/csv/Store.java
    sis/branches/JDK8/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/wkt/Store.java
    sis/branches/JDK8/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/xml/Store.java
    sis/branches/JDK8/storage/sis-storage/src/main/java/org/apache/sis/storage/DataStore.java
    sis/branches/JDK8/storage/sis-storage/src/main/java/org/apache/sis/storage/IllegalNameException.java
    sis/branches/JDK8/storage/sis-storage/src/test/java/org/apache/sis/test/suite/StorageTestSuite.java
    sis/branches/JDK8/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/gpx/Store.java
    sis/branches/JDK8/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/xml/StaxDataStore.java
    sis/branches/JDK8/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/xml/StaxStreamReader.java
    sis/branches/JDK8/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/xml/StaxStreamWriter.java
    sis/branches/JDK8/storage/sis-xmlstore/src/test/java/org/apache/sis/internal/gpx/ReaderTest.java

Modified: sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/feature/DefaultFeatureType.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/feature/DefaultFeatureType.java?rev=1777066&r1=1777065&r2=1777066&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/feature/DefaultFeatureType.java [UTF-8] (original)
+++ sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/feature/DefaultFeatureType.java [UTF-8] Tue Jan  3 05:14:46 2017
@@ -104,6 +104,8 @@ import org.opengis.feature.PropertyNotFo
  * @see DefaultAttributeType
  * @see DefaultAssociationRole
  * @see AbstractFeature
+ * @see org.apache.sis.metadata.iso.content.DefaultFeatureTypeInfo
+ * @see org.apache.sis.storage.FeatureNaming
  */
 public class DefaultFeatureType extends AbstractIdentifiedType implements FeatureType {
     /**

Modified: sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/feature/Features.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/feature/Features.java?rev=1777066&r1=1777065&r2=1777066&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/feature/Features.java [UTF-8] (original)
+++ sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/feature/Features.java [UTF-8] Tue Jan  3 05:14:46 2017
@@ -61,10 +61,10 @@ public final class Features extends Stat
      * An exception is thrown immediately if the given type does not have the expected
      * {@linkplain DefaultAttributeType#getValueClass() value class}.
      *
-     * @param  <V>        The expected value class.
-     * @param  type       The attribute type to cast, or {@code null}.
-     * @param  valueClass The expected value class.
-     * @return The attribute type casted to the given value class, or {@code null} if the given type was null.
+     * @param  <V>         the expected value class.
+     * @param  type        the attribute type to cast, or {@code null}.
+     * @param  valueClass  the expected value class.
+     * @return the attribute type casted to the given value class, or {@code null} if the given type was null.
      * @throws ClassCastException if the given attribute type does not have the expected value class.
      *
      * @category verification
@@ -90,10 +90,10 @@ public final class Features extends Stat
      * An exception is thrown immediately if the given instance does not have the expected
      * {@linkplain DefaultAttributeType#getValueClass() value class}.
      *
-     * @param  <V>        The expected value class.
-     * @param  attribute  The attribute instance to cast, or {@code null}.
-     * @param  valueClass The expected value class.
-     * @return The attribute instance casted to the given value class, or {@code null} if the given instance was null.
+     * @param  <V>         the expected value class.
+     * @param  attribute   the attribute instance to cast, or {@code null}.
+     * @param  valueClass  the expected value class.
+     * @return the attribute instance casted to the given value class, or {@code null} if the given instance was null.
      * @throws ClassCastException if the given attribute instance does not have the expected value class.
      *
      * @category verification

Modified: sis/branches/JDK8/storage/sis-earth-observation/src/main/java/org/apache/sis/storage/earthobservation/LandsatStore.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/storage/sis-earth-observation/src/main/java/org/apache/sis/storage/earthobservation/LandsatStore.java?rev=1777066&r1=1777065&r2=1777066&view=diff
==============================================================================
--- sis/branches/JDK8/storage/sis-earth-observation/src/main/java/org/apache/sis/storage/earthobservation/LandsatStore.java [UTF-8] (original)
+++ sis/branches/JDK8/storage/sis-earth-observation/src/main/java/org/apache/sis/storage/earthobservation/LandsatStore.java [UTF-8] Tue Jan  3 05:14:46 2017
@@ -66,11 +66,6 @@ import org.apache.sis.util.Debug;
  */
 public class LandsatStore extends DataStore {
     /**
-     * The file name.
-     */
-    private final String name;
-
-    /**
      * The reader, or {@code null} if closed.
      */
     private Reader source;
@@ -91,7 +86,6 @@ public class LandsatStore extends DataSt
      */
     public LandsatStore(final LandsatStoreProvider provider, final StorageConnector connector) throws DataStoreException {
         super(provider, connector);
-        name = connector.getStorageName();
         source = connector.getStorageAs(Reader.class);
         connector.closeAllExcept(source);
         if (source == null) {
@@ -113,7 +107,7 @@ public class LandsatStore extends DataSt
         if (metadata == null && source != null) try {
             try (BufferedReader reader = (source instanceof BufferedReader) ? (BufferedReader) source : new LineNumberReader(source)) {
                 source = null;      // Will be closed at the end of this try-catch block.
-                final LandsatReader parser = new LandsatReader(name, listeners);
+                final LandsatReader parser = new LandsatReader(getDisplayName(), listeners);
                 parser.read(reader);
                 metadata = parser.getMetadata();
             }
@@ -144,6 +138,6 @@ public class LandsatStore extends DataSt
     @Debug
     @Override
     public String toString() {
-        return getClass().getSimpleName() + '[' + name + ']';
+        return getClass().getSimpleName() + '[' + getDisplayName() + ']';
     }
 }

Modified: sis/branches/JDK8/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/FeatureStore.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/FeatureStore.java?rev=1777066&r1=1777065&r2=1777066&view=diff
==============================================================================
--- sis/branches/JDK8/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/FeatureStore.java [UTF-8] (original)
+++ sis/branches/JDK8/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/FeatureStore.java [UTF-8] Tue Jan  3 05:14:46 2017
@@ -19,10 +19,12 @@ import org.apache.sis.storage.DataStore;
 import org.apache.sis.storage.StorageConnector;
 import org.apache.sis.storage.DataStoreProvider;
 import org.apache.sis.storage.DataStoreException;
+import org.apache.sis.storage.IllegalNameException;
 
 // Branch-dependent imports
 import java.util.stream.Stream;
 import org.opengis.feature.Feature;
+import org.opengis.feature.FeatureType;
 
 
 /**
@@ -49,9 +51,38 @@ public abstract class FeatureStore exten
     }
 
     /**
-     * Returns the stream of features.
+     * Returns the feature type for the given name. The {@code name} argument should be the result of calling
+     * {@link org.opengis.util.GenericName#toString()} on the name of one of the feature types in this data store.
+     * The list of feature type names can be obtained from the {@linkplain #getMetadata() metadata} like below:
      *
-     * @return a stream over all features in the file.
+     * {@preformat java
+     *     for (ContentInformation c : metadata.getContentInfo()) {
+     *         if (c instanceof FeatureCatalogueDescription) {
+     *             for (FeatureTypeInfo info : ((FeatureCatalogueDescription) c).getFeatureTypeInfo()) {
+     *                 GenericName name = info.getFeatureTypeName();
+     *                 // ... add the name to some list ...
+     *             }
+     *         }
+     *     }
+     * }
+     *
+     * Implementation may also accept aliases for convenience. For example if the full name of a feature type
+     * is {@code "foo:bar"}, then this method may accept {@code "bar"} as a synonymous of {@code "foo:bar"}
+     * provided that it does not introduce ambiguity.
+     *
+     * @param  name  the name or alias of the feature type to get.
+     * @return the feature type of the given name or alias (never {@code null}).
+     * @throws IllegalNameException if the given name was not found or is ambiguous.
+     * @throws DataStoreException if another kind of error occurred while searching for feature types.
+     */
+    public abstract FeatureType getFeatureType(String name) throws DataStoreException;
+
+    /**
+     * Returns the stream of all features found in the data store.
+     * If a checked exception occurs during consumption of the returned stream, that exception will
+     * be wrapped in a unchecked {@link org.apache.sis.util.collection.BackingStoreException}.
+     *
+     * @return a stream over all features in the data store.
      * @throws DataStoreException if an error occurred while creating the feature stream.
      */
     public abstract Stream<Feature> getFeatures() throws DataStoreException;

Modified: sis/branches/JDK8/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/Resources.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/Resources.java?rev=1777066&r1=1777065&r2=1777066&view=diff
==============================================================================
--- sis/branches/JDK8/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/Resources.java [UTF-8] (original)
+++ sis/branches/JDK8/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/Resources.java [UTF-8] Tue Jan  3 05:14:46 2017
@@ -61,6 +61,12 @@ public final class Resources extends Ind
         }
 
         /**
+         * Name “{3}” is ambiguous because it can be understood as either “{1}” or “{2}” in the context
+         * of “{0}” data.
+         */
+        public static final short AmbiguousName_4 = 15;
+
+        /**
          * Can not read “{1}” as a file in the {0} format.
          */
         public static final short CanNotReadFile_2 = 1;
@@ -92,6 +98,16 @@ public final class Resources extends Ind
         public static final short ExcessiveStringSize_3 = 6;
 
         /**
+         * A feature named “{1}” is already present in the “{0}” data store.
+         */
+        public static final short FeatureAlreadyPresent_2 = 16;
+
+        /**
+         * Feature “{1}” has not been found in the “{0}” data store.
+         */
+        public static final short FeatureNotFound_2 = 17;
+
+        /**
          * The {0} data store does not accept features of type “{1}”.
          */
         public static final short IllegalFeatureType_2 = 7;
@@ -107,9 +123,10 @@ public final class Resources extends Ind
         public static final short IllegalOutputTypeForWriter_2 = 9;
 
         /**
-         * Components of the “{0}” name are inconsistent with those of the name that was added.
+         * Components of the “{1}” name are inconsistent with those of the name previously binded in
+         * “{0}” data store.
          */
-        public static final short InconsistentNameComponents_1 = 10;
+        public static final short InconsistentNameComponents_2 = 10;
 
         /**
          * Missing scheme in “{0}” URI.

Modified: sis/branches/JDK8/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/Resources.properties
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/Resources.properties?rev=1777066&r1=1777065&r2=1777066&view=diff
==============================================================================
--- sis/branches/JDK8/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/Resources.properties [ISO-8859-1] (original)
+++ sis/branches/JDK8/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/Resources.properties [ISO-8859-1] Tue Jan  3 05:14:46 2017
@@ -19,16 +19,19 @@
 # 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.
 #
+AmbiguousName_4                   = Name \u201c{3}\u201d is ambiguous because it can be understood as either \u201c{1}\u201d or \u201c{2}\u201d in the context of \u201c{0}\u201d data.
 CanNotReadFile_2                  = Can not read \u201c{1}\u201d as a file in the {0} format.
 CanNotReadFile_3                  = Can not read line {2} of \u201c{1}\u201d as part of a file in the {0} format.
 CanNotReadFile_4                  = Can not read line {2} (after column {3}) of \u201c{1}\u201d as part of a file in the {0} format.
 ClosedReader_1                    = This {0} reader is closed.
 ClosedWriter_1                    = This {0} writer is closed.
+FeatureAlreadyPresent_2           = A feature named \u201c{1}\u201d is already present in the \u201c{0}\u201d data store.
+FeatureNotFound_2                 = Feature \u201c{1}\u201d has not been found in the \u201c{0}\u201d data store.
 ExcessiveStringSize_3             = Character string in the \u201c{0}\u201d file is too long. The string has {2} characters while the limit is {1}.
 IllegalFeatureType_2              = The {0} data store does not accept features of type \u201c{1}\u201d.
 IllegalInputTypeForReader_2       = The {0} reader does not accept inputs of type \u2018{1}\u2019.
 IllegalOutputTypeForWriter_2      = The {0} writer does not accept outputs of type \u2018{1}\u2019.
-InconsistentNameComponents_1      = Components of the \u201c{0}\u201d name are inconsistent with those of the name that was added.
+InconsistentNameComponents_2      = Components of the \u201c{1}\u201d name are inconsistent with those of the name previously binded in \u201c{0}\u201d data store.
 MissingSchemeInURI_1              = Missing scheme in \u201c{0}\u201d URI.
 ProcessingExecutedOn_1            = Processing executed on {0}.
 StreamIsForwardOnly_1             = Can not move backward in the \u201c{0}\u201d stream.

Modified: sis/branches/JDK8/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/Resources_fr.properties
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/Resources_fr.properties?rev=1777066&r1=1777065&r2=1777066&view=diff
==============================================================================
--- sis/branches/JDK8/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/Resources_fr.properties [ISO-8859-1] (original)
+++ sis/branches/JDK8/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/Resources_fr.properties [ISO-8859-1] Tue Jan  3 05:14:46 2017
@@ -24,16 +24,19 @@
 #   U+202F NARROW NO-BREAK SPACE  before  ; ! and ?
 #   U+00A0 NO-BREAK SPACE         before  :
 #
+AmbiguousName_4                   = Le nom \u00ab\u202f{3}\u202f\u00bb est ambigu\u00eb car il peut \u00eatre interpr\u00e9t\u00e9 aussi bien comme \u00ab\u202f{1}\u202f\u00bb ou \u00ab\u202f{2}\u202f\u00bb dans le contexte des donn\u00e9es de \u00ab\u202f{0}\u202f\u00bb.
 CanNotReadFile_2                  = Ne peut pas lire \u00ab\u202f{1}\u202f\u00bb comme un fichier au format {0}.
 CanNotReadFile_3                  = Ne peut pas lire la ligne {2} de \u00ab\u202f{1}\u202f\u00bb comme une partie d\u2019un fichier au format {0}.
 CanNotReadFile_4                  = Ne peut pas lire la ligne {2} (apr\u00e8s la colonne {3}) de \u00ab\u202f{1}\u202f\u00bb comme une partie d\u2019un fichier au format {0}.
 ClosedReader_1                    = Ce lecteur {0} est ferm\u00e9.
 ClosedWriter_1                    = Cet encodeur {0} est ferm\u00e9.
 ExcessiveStringSize_3             = La cha\u00eene de caract\u00e8res dans le fichier \u00ab\u202f{0}\u202f\u00bb est trop longue. La cha\u00eene fait {2} caract\u00e8res alors que la limite est {1}.
+FeatureAlreadyPresent_2           = Une entit\u00e9 nomm\u00e9e \u00ab\u202f{1}\u202f\u00bb est d\u00e9j\u00e0 pr\u00e9sente dans les donn\u00e9es de \u00ab\u202f{0}\u202f\u00bb.
+FeatureNotFound_2                 = L\u2019entit\u00e9 \u00ab\u202f{1}\u202f\u00bb n\u2019est pas \u00e9t\u00e9 trouv\u00e9e dans les donn\u00e9es de \u00ab\u202f{0}\u202f\u00bb.
 IllegalFeatureType_2              = Le format {0} ne stocke pas de donn\u00e9es de type \u00ab\u202f{1}\u202f\u00bb.
 IllegalInputTypeForReader_2       = Le lecteur {0} n\u2019accepte pas des entr\u00e9s de type \u2018{1}\u2019.
 IllegalOutputTypeForWriter_2      = Le l\u2019encodeur {0} n\u2019accepte pas des sorties de type \u2018{1}\u2019.
-InconsistentNameComponents_1      = Les \u00e9l\u00e9ments qui composent le nom \u00ab\u202f{0}\u202f\u00bb ne sont pas coh\u00e9rents avec ceux du nom qui avait \u00e9t\u00e9 ajout\u00e9.
+InconsistentNameComponents_2      = Les \u00e9l\u00e9ments qui composent le nom \u00ab\u202f{1}\u202f\u00bb ne sont pas coh\u00e9rents avec ceux du nom qui avait \u00e9t\u00e9 pr\u00e9c\u00e9demment li\u00e9 dans les donn\u00e9es de \u00ab\u202f{0}\u202f\u00bb.
 MissingSchemeInURI_1              = Il manque le sch\u00e9ma dans l\u2019URI \u00ab\u202f{0}\u202f\u00bb.
 ProcessingExecutedOn_1            = Traitement ex\u00e9cut\u00e9 sur {0}.
 StreamIsForwardOnly_1             = Ne peut pas reculer dans le flux de donn\u00e9es \u00ab\u202f{0}\u202f\u00bb.

Modified: sis/branches/JDK8/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/csv/Store.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/csv/Store.java?rev=1777066&r1=1777065&r2=1777066&view=diff
==============================================================================
--- sis/branches/JDK8/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/csv/Store.java [UTF-8] (original)
+++ sis/branches/JDK8/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/csv/Store.java [UTF-8] Tue Jan  3 05:14:46 2017
@@ -52,6 +52,7 @@ import org.apache.sis.internal.storage.F
 import org.apache.sis.storage.DataStoreException;
 import org.apache.sis.storage.DataStoreContentException;
 import org.apache.sis.storage.DataStoreReferencingException;
+import org.apache.sis.storage.IllegalNameException;
 import org.apache.sis.storage.StorageConnector;
 import org.apache.sis.setup.OptionKey;
 import org.apache.sis.util.ArraysExt;
@@ -118,11 +119,6 @@ public final class Store extends Feature
     private static final String TYPE_PREFIX = "xsd:";
 
     /**
-     * The file name, used for reporting error messages.
-     */
-    private final String filename;
-
-    /**
      * The reader, set by the constructor and cleared when no longer needed.
      */
     private BufferedReader source;
@@ -184,11 +180,10 @@ public final class Store extends Feature
      */
     public Store(final StoreProvider provider, final StorageConnector connector) throws DataStoreException {
         super(provider, connector);
-        filename = connector.getStorageName();
         final Reader r = connector.getStorageAs(Reader.class);
         connector.closeAllExcept(r);
         if (r == null) {
-            throw new DataStoreException(Errors.format(Errors.Keys.CanNotOpen_1, filename));
+            throw new DataStoreException(Errors.format(Errors.Keys.CanNotOpen_1, super.getDisplayName()));
         }
         source = (r instanceof BufferedReader) ? (BufferedReader) r : new LineNumberReader(r);
         GeneralEnvelope envelope    = null;
@@ -241,11 +236,11 @@ public final class Store extends Feature
             }
             source.reset();
         } catch (IOException e) {
-            throw new DataStoreException(getLocale(), "CSV", filename, source).initCause(e);
+            throw new DataStoreException(getLocale(), "CSV", super.getDisplayName(), source).initCause(e);
         } catch (FactoryException e) {
-            throw new DataStoreReferencingException(getLocale(), "CSV", filename, source).initCause(e);
+            throw new DataStoreReferencingException(getLocale(), "CSV", super.getDisplayName(), source).initCause(e);
         } catch (IllegalArgumentException | DateTimeException e) {
-            throw new DataStoreContentException(getLocale(), "CSV", filename, source).initCause(e);
+            throw new DataStoreContentException(getLocale(), "CSV", super.getDisplayName(), source).initCause(e);
         }
         this.encoding    = connector.getOption(OptionKey.ENCODING);
         this.envelope    = envelope;
@@ -448,7 +443,7 @@ public final class Store extends Feature
             }
             properties.add(createProperty(name, type, minOccurrence));
         }
-        String name = filename;
+        String name = super.getDisplayName();
         final int s = name.lastIndexOf('.');
         if (s > 0) {                            // Exclude 0 because shall not be the first character.
             name = name.substring(0, s);
@@ -503,7 +498,7 @@ public final class Store extends Feature
             try {
                 builder.addExtent(envelope);
             } catch (TransformException e) {
-                throw new DataStoreReferencingException(getLocale(), "CSV", filename, source).initCause(e);
+                throw new DataStoreReferencingException(getLocale(), "CSV", getDisplayName(), source).initCause(e);
             } catch (UnsupportedOperationException e) {
                 // Failed to set the temporal components if the sis-temporal module was
                 // not on the classpath, but the other dimensions still have been set.
@@ -516,6 +511,31 @@ public final class Store extends Feature
     }
 
     /**
+     * Returns the feature type for the given name. The {@code name} argument should be the
+     * value specified at the following path (only one such value exists for a CSV data store):
+     *
+     * <blockquote>
+     * {@link #getMetadata()} /
+     * {@link org.apache.sis.metadata.iso.DefaultMetadata#getContentInfo() contentInfo} /
+     * {@link org.apache.sis.metadata.iso.content.DefaultFeatureCatalogueDescription#getFeatureTypeInfo() featureTypes} /
+     * {@link org.apache.sis.metadata.iso.content.DefaultFeatureTypeInfo#getFeatureTypeName() featureTypeName}
+     * </blockquote>
+     *
+     * @param  name  the name of the feature type to get.
+     * @return the feature type of the given name (never {@code null}).
+     * @throws IllegalNameException if the given name was not found.
+     *
+     * @since 0.8
+     */
+    @Override
+    public FeatureType getFeatureType(String name) throws IllegalNameException {
+        if (featureType.getName().toString().equals(name)) {
+            return featureType;
+        }
+        throw new IllegalNameException(getLocale(), getDisplayName(), name);
+    }
+
+    /**
      * Returns the stream of features.
      *
      * @return a stream over all features in the CSV file.
@@ -769,7 +789,7 @@ public final class Store extends Feature
      * The error message will contain the line number if available.
      */
     final String canNotParseFile() {
-        final Object[] parameters = IOUtilities.errorMessageParameters("CSV", filename, source);
+        final Object[] parameters = IOUtilities.errorMessageParameters("CSV", getDisplayName(), source);
         return errors().getString(IOUtilities.errorMessageKey(parameters), parameters);
     }
 

Modified: sis/branches/JDK8/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/wkt/Store.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/wkt/Store.java?rev=1777066&r1=1777065&r2=1777066&view=diff
==============================================================================
--- sis/branches/JDK8/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/wkt/Store.java [UTF-8] (original)
+++ sis/branches/JDK8/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/wkt/Store.java [UTF-8] Tue Jan  3 05:14:46 2017
@@ -58,11 +58,6 @@ final class Store extends DataStore {
     private static final int SIZE_LIMIT = 1000000;
 
     /**
-     * The file name.
-     */
-    private final String name;
-
-    /**
      * The reader, set by the constructor and cleared when no longer needed.
      */
     private Reader source;
@@ -88,11 +83,10 @@ final class Store extends DataStore {
     public Store(final StoreProvider provider, final StorageConnector connector) throws DataStoreException {
         super(provider, connector);
         objects = new ArrayList<>();
-        name    = connector.getStorageName();
         source  = connector.getStorageAs(Reader.class);
         connector.closeAllExcept(source);
         if (source == null) {
-            throw new DataStoreException(Errors.format(Errors.Keys.CanNotOpen_1, name));
+            throw new DataStoreException(Errors.format(Errors.Keys.CanNotOpen_1, super.getDisplayName()));
         }
     }
 
@@ -115,7 +109,7 @@ final class Store extends DataStore {
                     if ((length += n) >= buffer.length) {
                         if (n >= SIZE_LIMIT) {
                             throw new DataStoreContentException(Resources.format(
-                                    Resources.Keys.ExcessiveStringSize_3, name, SIZE_LIMIT, n));
+                                    Resources.Keys.ExcessiveStringSize_3, getDisplayName(), SIZE_LIMIT, n));
                         }
                         buffer = Arrays.copyOf(buffer, n << 1);
                     }
@@ -138,9 +132,9 @@ final class Store extends DataStore {
                 }
             } while (pos.getIndex() < wkt.length());
         } catch (ParseException e) {
-            throw new DataStoreContentException(getLocale(), "WKT", name, in).initCause(e);
+            throw new DataStoreContentException(getLocale(), "WKT", getDisplayName(), in).initCause(e);
         } catch (IOException e) {
-            throw new DataStoreException(getLocale(), "WKT", name, in).initCause(e);
+            throw new DataStoreException(getLocale(), "WKT", getDisplayName(), in).initCause(e);
         }
     }
 

Modified: sis/branches/JDK8/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/xml/Store.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/xml/Store.java?rev=1777066&r1=1777065&r2=1777066&view=diff
==============================================================================
--- sis/branches/JDK8/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/xml/Store.java [UTF-8] (original)
+++ sis/branches/JDK8/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/xml/Store.java [UTF-8] Tue Jan  3 05:14:46 2017
@@ -57,11 +57,6 @@ import static java.util.Collections.sing
  */
 final class Store extends DataStore {
     /**
-     * The file name.
-     */
-    private final String name;
-
-    /**
      * The input stream or reader, set by the constructor and cleared when no longer needed.
      */
     private StreamSource source;
@@ -86,7 +81,6 @@ final class Store extends DataStore {
      */
     public Store(final StoreProvider provider, final StorageConnector connector) throws DataStoreException {
         super(provider, connector);
-        name = connector.getStorageName();
         final InputStream in = connector.getStorageAs(InputStream.class);
         if (in != null) {
             source = new StreamSource(in);
@@ -99,7 +93,7 @@ final class Store extends DataStore {
         final Closeable c = input(source);
         connector.closeAllExcept(c);
         if (c == null) {
-            throw new DataStoreException(Errors.format(Errors.Keys.CanNotOpen_1, name));
+            throw new DataStoreException(Errors.format(Errors.Keys.CanNotOpen_1, super.getDisplayName()));
         }
     }
 
@@ -154,7 +148,7 @@ final class Store extends DataStore {
                 in.close();
             }
         } catch (JAXBException | IOException e) {
-            throw new DataStoreException(Errors.format(Errors.Keys.CanNotRead_1, name), e);
+            throw new DataStoreException(Errors.format(Errors.Keys.CanNotRead_1, getDisplayName()), e);
         }
     }
 

Modified: sis/branches/JDK8/storage/sis-storage/src/main/java/org/apache/sis/storage/DataStore.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/storage/sis-storage/src/main/java/org/apache/sis/storage/DataStore.java?rev=1777066&r1=1777065&r2=1777066&view=diff
==============================================================================
--- sis/branches/JDK8/storage/sis-storage/src/main/java/org/apache/sis/storage/DataStore.java [UTF-8] (original)
+++ sis/branches/JDK8/storage/sis-storage/src/main/java/org/apache/sis/storage/DataStore.java [UTF-8] Tue Jan  3 05:14:46 2017
@@ -51,6 +51,14 @@ public abstract class DataStore implemen
     protected final DataStoreProvider provider;
 
     /**
+     * The store name (typically filename) for formatting error messages, or {@code null} if unknown.
+     * Shall <strong>not</strong> be used as an identifier.
+     *
+     * @see #getDisplayName()
+     */
+    private final String name;
+
+    /**
      * The locale to use for formatting warnings.
      * This is not the locale for formatting data in the storage.
      *
@@ -69,6 +77,7 @@ public abstract class DataStore implemen
      */
     protected DataStore() {
         provider  = null;
+        name      = null;
         locale    = Locale.getDefault(Locale.Category.DISPLAY);
         listeners = new WarningListeners<>(this);
     }
@@ -87,17 +96,44 @@ public abstract class DataStore implemen
     protected DataStore(final DataStoreProvider provider, final StorageConnector connector) throws DataStoreException {
         ArgumentChecks.ensureNonNull("connector", connector);
         this.provider  = provider;
+        this.name      = connector.getStorageName();
         this.locale    = Locale.getDefault(Locale.Category.DISPLAY);
         this.listeners = new WarningListeners<>(this);
         /*
-         * A future version could fetch some information from the StorageConnector.
-         * For now we do not, not even OptionKey.LOCALE because we are not talking
-         * about the same locale (the one in this DataStore is for warning messages,
-         * not for data).
+         * Above locale is NOT OptionKey.LOCALE because we are not talking about the same locale.
+         * The one in this DataStore is for warning and exception messages, not for parsing data.
          */
     }
 
     /**
+     * Returns a short name or label for this data store.
+     * The returned name can be used in user interfaces or in error messages.
+     * It may be a title in natural language, but should be relatively short.
+     * The name may be localized in the language specified by the value of {@link #getLocale()}
+     * if this data store is capable to produce a name in various languages.
+     *
+     * <p>This name should not be used as an identifier since there is no guarantee that the name
+     * is unique among data stores, and no guarantee that the name is the same in all locales.
+     * The name may also contain any Unicode characters, including characters usually not allowed
+     * in identifiers like white spaces.</p>
+     *
+     * <p>This method should never throw an exception since it may be invoked for producing error
+     * messages, in which case throwing an exception here would mask the original exception.</p>
+     *
+     * <p>Default implementation returns the {@link StorageConnector#getStorageName()} value,
+     * or {@code null} if this data store has been created by the no-argument constructor.
+     * Note that this default value may change in any future SIS version. Subclasses should
+     * override this method if they can provide a better name.</p>
+     *
+     * @return a short name of label for this data store, or {@code null} if unknown.
+     *
+     * @since 0.8
+     */
+    public String getDisplayName() {
+        return name;
+    }
+
+    /**
      * The locale to use for formatting warnings and other messages. This locale if for user interfaces
      * only – it has no effect on the data to be read or written from/to the data store.
      *

Copied: sis/branches/JDK8/storage/sis-storage/src/main/java/org/apache/sis/storage/FeatureNaming.java (from r1777065, sis/branches/JDK8/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/GenericNameMap.java)
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/storage/sis-storage/src/main/java/org/apache/sis/storage/FeatureNaming.java?p2=sis/branches/JDK8/storage/sis-storage/src/main/java/org/apache/sis/storage/FeatureNaming.java&p1=sis/branches/JDK8/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/GenericNameMap.java&r1=1777065&r2=1777066&rev=1777066&view=diff
==============================================================================
--- sis/branches/JDK8/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/GenericNameMap.java [UTF-8] (original)
+++ sis/branches/JDK8/storage/sis-storage/src/main/java/org/apache/sis/storage/FeatureNaming.java [UTF-8] Tue Jan  3 05:14:46 2017
@@ -14,28 +14,76 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.sis.internal.storage;
+package org.apache.sis.storage;
 
 import java.util.Map;
 import java.util.HashMap;
 import java.util.List;
 import java.util.ConcurrentModificationException;
+import java.util.Locale;
 import org.opengis.util.GenericName;
 import org.opengis.util.ScopedName;
 import org.apache.sis.util.ArgumentChecks;
-import org.apache.sis.util.resources.Errors;
+import org.apache.sis.util.resources.Vocabulary;
 import org.apache.sis.internal.util.CollectionsExt;
-import org.apache.sis.storage.IllegalNameException;
+import org.apache.sis.internal.storage.Resources;
 
 
 /**
- * Helper class for mapping {@link GenericName} instances and their aliases to arbitrary objects.
- * The objects can be read and written using a {@link String} representation of their name,
- * or an alias when there is no ambiguity.
- *
- * <div class="section">Synchronization</div>
- * This class is not thread-safe. Synchronization, if desired, shall be done by the caller.
- * The caller is typically a {@link org.apache.sis.storage.DataStore} implementation.
+ * Helper class for mapping {@link GenericName} instances and their shortened names to features.
+ * The features are typically represented by instances of {@link org.opengis.feature.FeatureType}
+ * or {@link org.opengis.coverage.Coverage} (sometime seen as a kind of features), but this class
+ * actually puts no restriction on the kind of object associated to {@code GenericName}s;
+ * {@link DataStore} implementations are free to choose their internal object.
+ * Those objects can be stored and fetched using the {@code String} representation of their name
+ * as given by {@link GenericName#toString()}, or a shortened name when there is no ambiguity.
+ *
+ * <div class="note"><b>Example:</b>
+ * a data store may contain a {@code FeatureType} named {@code "foo:bar"}.
+ * If that feature type has been binded like below:
+ *
+ * {@preformat java
+ *     FeatureNaming<FeatureType> binding = new FeatureNaming<>();
+ *     FeatureType myFooBar = ...;                                  // Some type named "foo:bar" for this example.
+ *     binding.add(null, myFooBar.getName(), myFooBar);
+ * }
+ *
+ * Then the two following lines return the same instance:
+ *
+ * {@preformat java
+ *     assert binding.get(null, "foo:bar") == myFooBar;
+ *     assert binding.get(null,     "bar") == myFooBar;    // Allowed only if there is no ambiguity.
+ * }
+ * </div>
+ *
+ * Note that contrarily to the standard {@link java.util.Map#get(Object)} method contract, the {@link #get get(…)}
+ * method defined in this class throws an exception instead than returning {@code null} if no unambiguous mapping
+ * can be established for the given name. This behavior allows {@code FeatureNaming} to produce an error message
+ * telling why the operation can not succeed.
+ *
+ * <div class="section">Managing the list of generic names</div>
+ * This class does not memorize the list of {@linkplain #add added} {@code GenericName} instances. Instead this
+ * class memorizes only their string representations, thus protecting the binding from any change in the original
+ * {@code GenericName} instances. The list of feature names should instead be included in the ISO 19115 metadata
+ * returned by {@link DataStore#getMetadata()}. The path to feature names is:
+ *
+ * <blockquote>{@code metadata} /
+ * {@link org.apache.sis.metadata.iso.DefaultMetadata#getContentInfo() contentInfo} /
+ * {@link org.apache.sis.metadata.iso.content.DefaultFeatureCatalogueDescription#getFeatureTypeInfo() featureTypes} /
+ * {@link org.apache.sis.metadata.iso.content.DefaultFeatureTypeInfo#getFeatureTypeName() featureTypeName}
+ * </blockquote>
+ *
+ * Note that above metadata information are not necessarily structured as a flat list; a {@code DataStore} may group
+ * some feature information in different {@link org.opengis.metadata.content.FeatureCatalogueDescription} instances.
+ * This is one reason why we let the data store manages {@code GenericName} lists itself.
+ *
+ * <div class="section">Thread safety</div>
+ * A {@code FeatureNaming} instance is thread-safe only if constructed once and never modified after publication.
+ * For example it is safe to initialize a {@code FeatureNaming} in a {@link DataStore} or {@link DataStoreProvider}
+ * constructor if the result is stored in a private final field with no public accessor
+ * and no call to {@link #add add(…)} or {@link #remove remove(…)} methods after construction.
+ * If this condition does not hold, then synchronization (if desired) is caller's responsibility.
+ * The caller is typically the {@code DataStore} implementation which contains this {@code FeatureNaming} instance.
  *
  * @param <E> the type of elements associated with the names.
  *
@@ -43,10 +91,14 @@ import org.apache.sis.storage.IllegalNam
  * @since   0.8
  * @version 0.8
  * @module
+ *
+ * @see org.apache.sis.util.iso.AbstractName
+ * @see org.apache.sis.feature.DefaultFeatureType
+ * @see org.apache.sis.metadata.iso.content.DefaultFeatureTypeInfo
  */
-public class GenericNameMap<E> {
+public class FeatureNaming<E> {
     /**
-     * All aliases found for all names given to the {@link #add(GenericName, Object)} method.
+     * All aliases found for all names given to the {@link #add(DataStore, GenericName, Object)} method.
      * Keys are aliases (never the explicitely given names) and values are names for which the key is an alias.
      * Each {@code List<String>} instance contains exactly one name if there is no ambiguity.
      * If the list contains more than one name, this means that the alias is ambiguous.
@@ -65,49 +117,75 @@ public class GenericNameMap<E> {
     /**
      * Creates a new "{@code GenericName} to object" mapping.
      */
-    public GenericNameMap() {
+    public FeatureNaming() {
         aliases = new HashMap<>();
         values  = new HashMap<>();
     }
 
     /**
+     * Returns the display name for the given data store, or the localizable "unnamed" string
+     * if the given data store is null or does not have a display name.
+     */
+    private static CharSequence name(final DataStore store) {
+        if (store != null) {
+            final String name = store.getDisplayName();
+            if (name != null) {
+                return name;
+            }
+        }
+        return Vocabulary.formatInternational(Vocabulary.Keys.Unnamed);
+    }
+
+    /**
+     * Returns the locale for the given store, or {@code null} if none.
+     */
+    private static Locale locale(final DataStore store) {
+        return (store != null) ? store.getLocale() : null;
+    }
+
+    /**
      * Returns the value associated to the given name.
      *
-     * @param  name  the name for which to get a value.
+     * @param  store  the data store for which to get a value, or {@code null} if unknown.
+     * @param  name   the name for which to get a value.
      * @return value associated to the given object.
      * @throws IllegalNameException if the given name was not found or is ambiguous.
      */
-    public E get(final String name) throws IllegalNameException {
+    public E get(final DataStore store, final String name) throws IllegalNameException {
         final E value = values.get(name);
         if (value != null) {
             return value;
         }
+        final short key;
+        final Object[] params;
         final List<String> nc = aliases.get(name);
-        final String message;
         if (nc == null) {
-            message = Errors.format(Errors.Keys.ElementNotFound_1, name);
+            key = Resources.Keys.FeatureNotFound_2;
+            params = new CharSequence[] {name(store), name};
         } else if (nc.size() >= 2) {
-            message = Errors.format(Errors.Keys.AmbiguousName_3, nc.get(0), nc.get(1), name);
+            key = Resources.Keys.AmbiguousName_4;
+            params = new CharSequence[] {name(store), nc.get(0), nc.get(1), name};
         } else {
             return null;    // Name was explicitely associated to null value (actually not allowed by current API).
         }
-        throw new IllegalNameException(message);
+        throw new IllegalNameException(locale(store), key, params);
     }
 
     /**
      * Adds a value for the given name if none exist.
      * If a previous value already exists for the given name, then an exception is thrown.
      *
+     * @param  store  the data store for which to add a value, or {@code null} if unknown.
      * @param  name   the name for which to add a value.
      * @param  value  the value to add (can not be null).
      * @throws IllegalNameException if another element is already registered for the given name.
      */
-    public void add(GenericName name, final E value) throws IllegalNameException {
+    public void add(final DataStore store, GenericName name, final E value) throws IllegalNameException {
         ArgumentChecks.ensureNonNull("name",  name);
         ArgumentChecks.ensureNonNull("value", value);
         final String key = name.toString();
         if (values.putIfAbsent(key, value) != null) {
-            throw new IllegalNameException(Errors.format(Errors.Keys.ElementAlreadyPresent_1, key));
+            throw new IllegalNameException(locale(store), Resources.Keys.FeatureAlreadyPresent_2, name(store), key);
         }
         while (name instanceof ScopedName) {
             name = ((ScopedName) name).tail();
@@ -126,7 +204,7 @@ public class GenericNameMap<E> {
                  * object changed in a concurrent thread during this method execution.  We do not try to detect
                  * all such errors, but this check is an easy one to perform opportunistically.
                  */
-                throw new ConcurrentModificationException();
+                throw new ConcurrentModificationException(name(store).toString());
             }
         }
     }
@@ -135,13 +213,14 @@ public class GenericNameMap<E> {
      * Removes the value associated to the given name.
      * If no value is associated to the given name, then this method does nothing.
      *
-     * @param  name  the name for which to remove value.
+     * @param  store  the data store for which to remove a value, or {@code null} if unknown.
+     * @param  name   the name for which to remove value.
      * @return {@code true} if the value was removed, or {@code false} if no value was defined for the given name.
      * @throws IllegalNameException if inconsistency are found between the given name and the one which was given
-     *         to the {@link #add(GenericName, Object)} method. An example of inconsistency is a name having the
-     *         same string representation, but for which {@link ScopedName#tail()} returns different values.
+     *         to the {@link #add add(…)} method. An example of inconsistency is a name having the same string
+     *         representation, but for which {@link ScopedName#tail()} returns different values.
      */
-    public boolean remove(GenericName name) throws IllegalNameException {
+    public boolean remove(final DataStore store, GenericName name) throws IllegalNameException {
         ArgumentChecks.ensureNonNull("name",  name);
         final String key = name.toString();
         if (values.remove(key) == null) {
@@ -153,9 +232,9 @@ public class GenericNameMap<E> {
             final String alias = name.toString();
             final List<String> remaining = CollectionsExt.removeFromMultiValuesMap(aliases, alias, key);
             /*
-             * The list of remaining GenericNames may be empty, but should never be null unless the tail is
-             * inconsistent with the one found by the 'add(GenericName, Object) method.  Otherwise if there
-             * is exactly one remaining GenericName, then the alias is not ambiguous anymore for that name.
+             * The list of remaining GenericNames may be empty but should never be null unless the tail
+             * is inconsistent with the one found by the 'add(…) method.  Otherwise if there is exactly
+             * one remaining GenericName, then the alias is not ambiguous anymore for that name.
              */
             error |= (remaining == null);
             if (remaining == null || remaining.isEmpty()) {
@@ -167,7 +246,7 @@ public class GenericNameMap<E> {
             }
         }
         if (error) {
-            throw new IllegalNameException(Resources.format(Resources.Keys.InconsistentNameComponents_1, key));
+            throw new IllegalNameException(locale(store), Resources.Keys.InconsistentNameComponents_2, name(store), key);
         }
         return true;
     }

Modified: sis/branches/JDK8/storage/sis-storage/src/main/java/org/apache/sis/storage/IllegalNameException.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/storage/sis-storage/src/main/java/org/apache/sis/storage/IllegalNameException.java?rev=1777066&r1=1777065&r2=1777066&view=diff
==============================================================================
--- sis/branches/JDK8/storage/sis-storage/src/main/java/org/apache/sis/storage/IllegalNameException.java [UTF-8] (original)
+++ sis/branches/JDK8/storage/sis-storage/src/main/java/org/apache/sis/storage/IllegalNameException.java [UTF-8] Tue Jan  3 05:14:46 2017
@@ -16,6 +16,10 @@
  */
 package org.apache.sis.storage;
 
+import java.util.Locale;
+import org.apache.sis.internal.storage.Resources;
+import org.apache.sis.util.resources.Vocabulary;
+
 
 /**
  * Thrown when an invalid name is used for identifying a coverage, a feature or other kind of element in a data store.
@@ -70,4 +74,27 @@ public class IllegalNameException extend
     public IllegalNameException(final String message, final Throwable cause) {
         super(message, cause);
     }
+
+    /**
+     * Creates a new exception with a message saying that the feature of the given name has not been found.
+     *
+     * @param locale   the locale for the message to be returned by {@link #getLocalizedMessage()}.
+     * @param store    name of the data store for which the feature has not been found, or {@code null} if unknown.
+     * @param feature  name of the feature that has not been found.
+     */
+    public IllegalNameException(final Locale locale, final String store, final String feature) {
+        super(locale, Resources.Keys.FeatureNotFound_2, (store != null) ? store
+                : Vocabulary.formatInternational(Vocabulary.Keys.Unnamed), feature);
+    }
+
+    /**
+     * Creates a new exception which will format a localized message in the given locale.
+     *
+     * @param locale      the locale for the message to be returned by {@link #getLocalizedMessage()}.
+     * @param key         one of {@link Resources.Keys} constants.
+     * @param parameters  parameters to use for formatting the messages.
+     */
+    IllegalNameException(final Locale locale, final short key, final Object... parameters) {
+        super(locale, key, parameters);
+    }
 }

Added: sis/branches/JDK8/storage/sis-storage/src/test/java/org/apache/sis/storage/DataStoreMock.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/storage/sis-storage/src/test/java/org/apache/sis/storage/DataStoreMock.java?rev=1777066&view=auto
==============================================================================
--- sis/branches/JDK8/storage/sis-storage/src/test/java/org/apache/sis/storage/DataStoreMock.java (added)
+++ sis/branches/JDK8/storage/sis-storage/src/test/java/org/apache/sis/storage/DataStoreMock.java [UTF-8] Tue Jan  3 05:14:46 2017
@@ -0,0 +1,59 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.sis.storage;
+
+import org.opengis.metadata.Metadata;
+
+
+/**
+ * A dummy data store
+ *
+ * @author  Martin Desruisseaux (Geomatys)
+ * @since   0.8
+ * @version 0.8
+ * @module
+ */
+final strictfp class DataStoreMock extends DataStore {
+    /**
+     * The display name.
+     */
+    private final String name;
+
+    /**
+     * Creates a new data store mock with the given display name.
+     */
+    DataStoreMock(final String name) {
+        this.name = name;
+    }
+
+    /**
+     * Returns the display name specified at construction time.
+     */
+    @Override
+    public String getDisplayName() {
+        return name;
+    }
+
+    @Override
+    public Metadata getMetadata() {
+        return null;
+    }
+
+    @Override
+    public void close() {
+    }
+}

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

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

Copied: sis/branches/JDK8/storage/sis-storage/src/test/java/org/apache/sis/storage/FeatureNamingTest.java (from r1777065, sis/branches/JDK8/storage/sis-storage/src/test/java/org/apache/sis/internal/storage/GenericNameMapTest.java)
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/storage/sis-storage/src/test/java/org/apache/sis/storage/FeatureNamingTest.java?p2=sis/branches/JDK8/storage/sis-storage/src/test/java/org/apache/sis/storage/FeatureNamingTest.java&p1=sis/branches/JDK8/storage/sis-storage/src/test/java/org/apache/sis/internal/storage/GenericNameMapTest.java&r1=1777065&r2=1777066&rev=1777066&view=diff
==============================================================================
--- sis/branches/JDK8/storage/sis-storage/src/test/java/org/apache/sis/internal/storage/GenericNameMapTest.java [UTF-8] (original)
+++ sis/branches/JDK8/storage/sis-storage/src/test/java/org/apache/sis/storage/FeatureNamingTest.java [UTF-8] Tue Jan  3 05:14:46 2017
@@ -14,10 +14,9 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.sis.internal.storage;
+package org.apache.sis.storage;
 
 import org.opengis.util.GenericName;
-import org.apache.sis.storage.IllegalNameException;
 import org.apache.sis.test.DependsOnMethod;
 import org.apache.sis.test.TestCase;
 import org.apache.sis.util.iso.Names;
@@ -27,14 +26,14 @@ import static org.junit.Assert.*;
 
 
 /**
- * Tests {@link GenericNameMap}.
+ * Tests {@link FeatureNaming}.
  *
  * @author  Martin Desruisseaux (Geomatys)
  * @since   0.8
  * @version 0.8
  * @module
  */
-public final strictfp class GenericNameMapTest extends TestCase {
+public final strictfp class FeatureNamingTest extends TestCase {
     /**
      * Name for the tests.
      */
@@ -43,51 +42,54 @@ public final strictfp class GenericNameM
     /**
      * Creates a new test case.
      */
-    public GenericNameMapTest() {
+    public FeatureNamingTest() {
         A      = Names.parseGenericName(null, null, "myNS:A");
         B      = Names.createLocalName (null, null, "B");
         otherA = Names.parseGenericName(null, null, "other:A");
     }
 
     /**
-     * Tests {@link GenericNameMap#add(GenericName, Object)} followed by {@link GenericNameMap#get(String)}
+     * Tests {@link FeatureNaming#add(GenericName, Object)} followed by {@link FeatureNaming#get(String)}
      * in a simple case where there is no ambiguity.
      *
      * @throws IllegalNameException if an unexpected error occurred while adding or getting an element.
      */
     @Test
     public void testSimple() throws IllegalNameException {
-        final GenericNameMap<Integer> map = new GenericNameMap<>();
-        map.add(A, 1);
-        map.add(B, 2);
-        assertEquals("A", Integer.valueOf(1), map.get("myNS:A"));
-        assertEquals("A", Integer.valueOf(1), map.get("A"));
-        assertEquals("B", Integer.valueOf(2), map.get("B"));
+        final DataStoreMock store = new DataStoreMock("testDataStore");
+        final FeatureNaming<Integer> map = new FeatureNaming<>();
+        map.add(store, A, 1);
+        map.add(store, B, 2);
+        assertEquals("A", Integer.valueOf(1), map.get(store, "myNS:A"));
+        assertEquals("A", Integer.valueOf(1), map.get(store, "A"));
+        assertEquals("B", Integer.valueOf(2), map.get(store, "B"));
         /*
          * Above code tested normal usage. Now test error conditions.
          * First, searching a non-existent entry should raise an exception.
          */
         try {
-            map.get("C");
+            map.get(store, "C");
             fail("Should not find a non-existent entry.");
         } catch (IllegalNameException e) {
             // This is the expected exception.
             final String message = e.getMessage();
             assertTrue(message, message.contains("C"));
+            assertTrue(message, message.contains("testDataStore"));
         }
         /*
          * Attempt to overwrite an existing entry should raise an exception
          * without modifying the existing value.
          */
         try {
-            map.add(B, 3);
+            map.add(store, B, 3);
             fail("Should not overwrite an existing entry.");
         } catch (IllegalNameException e) {
             // This is the expected exception.
             final String message = e.getMessage();
             assertTrue(message, message.contains("B"));
         }
-        assertEquals("Existing value should not have been modified.", Integer.valueOf(2), map.get("B"));
+        assertEquals("Existing value should not have been modified.",
+                     Integer.valueOf(2), map.get(store, "B"));
     }
 
     /**
@@ -98,25 +100,27 @@ public final strictfp class GenericNameM
     @Test
     @DependsOnMethod("testSimple")
     public void testAmbiguity() throws IllegalNameException {
-        final GenericNameMap<Integer> map = new GenericNameMap<>();
-        map.add(A, 1);
-        map.add(B, 2);
-        map.add(otherA, 3);
-        assertEquals("A",      Integer.valueOf(1), map.get("myNS:A"));
-        assertEquals("B",      Integer.valueOf(2), map.get("B"));
-        assertEquals("otherA", Integer.valueOf(3), map.get("other:A"));
+        final DataStoreMock store = new DataStoreMock("testDataStore");
+        final FeatureNaming<Integer> map = new FeatureNaming<>();
+        map.add(store, A, 1);
+        map.add(store, B, 2);
+        map.add(store, otherA, 3);
+        assertEquals("A",      Integer.valueOf(1), map.get(store, "myNS:A"));
+        assertEquals("B",      Integer.valueOf(2), map.get(store, "B"));
+        assertEquals("otherA", Integer.valueOf(3), map.get(store, "other:A"));
         /*
          * Attempt to query using only the "A" value was used to succeed in 'testSimple()' but
          * should now fail because this shortcut could apply to "other:A" as well as "myNS:A".
          */
         try {
-            map.get("A");
+            map.get(store, "A");
             fail("Should not find an ambiguous entry.");
         } catch (IllegalNameException e) {
             // This is the expected exception.
             final String message = e.getMessage();
             assertTrue(message, message.contains("myNS:A"));
             assertTrue(message, message.contains("other:A"));
+            assertTrue(message, message.contains("testDataStore"));
         }
     }
 
@@ -128,30 +132,32 @@ public final strictfp class GenericNameM
     @Test
     @DependsOnMethod("testAmbiguity")
     public void testRemove() throws IllegalNameException {
-        final GenericNameMap<Integer> map = new GenericNameMap<>();
-        map.add(A, 1);
-        map.add(B, 2);
-        map.add(otherA, 3);
+        final DataStoreMock store = new DataStoreMock("testDataStore");
+        final FeatureNaming<Integer> map = new FeatureNaming<>();
+        map.add(store, A, 1);
+        map.add(store, B, 2);
+        map.add(store, otherA, 3);
         /*
          * Verify that "myNS:A" exists before the removal, then does not exist anymore after the removal.
          */
-        assertEquals("otherA", Integer.valueOf(3), map.get("other:A"));
-        assertEquals("myNS:A", Integer.valueOf(1), map.get("myNS:A"));
-        assertTrue("remove", map.remove(A));
+        assertEquals("otherA", Integer.valueOf(3), map.get(store, "other:A"));
+        assertEquals("myNS:A", Integer.valueOf(1), map.get(store, "myNS:A"));
+        assertTrue("remove", map.remove(store, A));
         try {
-            map.get("myNS:A");
+            map.get(store, "myNS:A");
             fail("Should not find a non-existent entry.");
         } catch (IllegalNameException e) {
             // This is the expected exception.
             final String message = e.getMessage();
             assertTrue(message, message.contains("myNS:A"));
+            assertTrue(message, message.contains("testDataStore"));
         }
         /*
          * The "A" shortcut should not be ambiguous anymore at this point since we removed the other name
          * ("myNS:A") which was causing the ambiguity;
          */
-        assertEquals("A",      Integer.valueOf(3), map.get("A"));
-        assertEquals("B",      Integer.valueOf(2), map.get("B"));
-        assertEquals("otherA", Integer.valueOf(3), map.get("other:A"));
+        assertEquals("A",      Integer.valueOf(3), map.get(store, "A"));
+        assertEquals("B",      Integer.valueOf(2), map.get(store, "B"));
+        assertEquals("otherA", Integer.valueOf(3), map.get(store, "other:A"));
     }
 }

Modified: sis/branches/JDK8/storage/sis-storage/src/test/java/org/apache/sis/test/suite/StorageTestSuite.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/storage/sis-storage/src/test/java/org/apache/sis/test/suite/StorageTestSuite.java?rev=1777066&r1=1777065&r2=1777066&view=diff
==============================================================================
--- sis/branches/JDK8/storage/sis-storage/src/test/java/org/apache/sis/test/suite/StorageTestSuite.java [UTF-8] (original)
+++ sis/branches/JDK8/storage/sis-storage/src/test/java/org/apache/sis/test/suite/StorageTestSuite.java [UTF-8] Tue Jan  3 05:14:46 2017
@@ -30,7 +30,6 @@ import org.junit.BeforeClass;
  * @module
  */
 @Suite.SuiteClasses({
-    org.apache.sis.internal.storage.GenericNameMapTest.class,
     org.apache.sis.internal.storage.CodeTypeTest.class,
     org.apache.sis.internal.storage.IOUtilitiesTest.class,
     org.apache.sis.internal.storage.ChannelDataInputTest.class,
@@ -39,6 +38,7 @@ import org.junit.BeforeClass;
     org.apache.sis.internal.storage.ChannelImageOutputStreamTest.class,
     org.apache.sis.internal.storage.HyperRectangleReaderTest.class,
     org.apache.sis.internal.storage.MetadataBuilderTest.class,
+    org.apache.sis.storage.FeatureNamingTest.class,
     org.apache.sis.storage.ProbeResultTest.class,
     org.apache.sis.storage.StorageConnectorTest.class,
     org.apache.sis.internal.storage.xml.MimeTypeDetectorTest.class,

Modified: sis/branches/JDK8/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/gpx/Store.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/gpx/Store.java?rev=1777066&r1=1777065&r2=1777066&view=diff
==============================================================================
--- sis/branches/JDK8/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/gpx/Store.java [UTF-8] (original)
+++ sis/branches/JDK8/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/gpx/Store.java [UTF-8] Tue Jan  3 05:14:46 2017
@@ -24,6 +24,7 @@ import org.apache.sis.internal.xml.StaxD
 import org.apache.sis.storage.StorageConnector;
 import org.apache.sis.storage.DataStoreException;
 import org.apache.sis.storage.DataStoreContentException;
+import org.apache.sis.storage.IllegalNameException;
 import org.apache.sis.util.collection.BackingStoreException;
 import org.apache.sis.util.ArgumentChecks;
 import org.apache.sis.util.Version;
@@ -34,6 +35,7 @@ import java.util.stream.Stream;
 import java.util.stream.StreamSupport;
 import java.io.UncheckedIOException;
 import org.opengis.feature.Feature;
+import org.opengis.feature.FeatureType;
 
 
 /**
@@ -147,6 +149,19 @@ public final class Store extends StaxDat
     }
 
     /**
+     * Returns the feature type for the given name. The {@code name} argument should be the result of calling
+     * {@link org.opengis.util.GenericName#toString()} on the name of one of the feature types in this data store.
+     *
+     * @param  name  the name or alias of the feature type to get.
+     * @return the feature type of the given name or alias (never {@code null}).
+     * @throws IllegalNameException if the given name was not found or is ambiguous.
+     */
+    @Override
+    public FeatureType getFeatureType(String name) throws IllegalNameException {
+        throw new UnsupportedOperationException();  // TODO
+    }
+
+    /**
      * Returns the stream of features.
      *
      * @return a stream over all features in the CSV file.

Modified: sis/branches/JDK8/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/xml/StaxDataStore.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/xml/StaxDataStore.java?rev=1777066&r1=1777065&r2=1777066&view=diff
==============================================================================
--- sis/branches/JDK8/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/xml/StaxDataStore.java [UTF-8] (original)
+++ sis/branches/JDK8/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/xml/StaxDataStore.java [UTF-8] Tue Jan  3 05:14:46 2017
@@ -43,7 +43,6 @@ import org.apache.sis.internal.util.Abst
 import org.apache.sis.storage.DataStoreClosedException;
 import org.apache.sis.storage.UnsupportedStorageException;
 import org.apache.sis.util.logging.WarningListener;
-import org.apache.sis.util.resources.Errors;
 
 
 /**
@@ -57,11 +56,6 @@ import org.apache.sis.util.resources.Err
  */
 public abstract class StaxDataStore extends FeatureStore {
     /**
-     * The store name (typically filename) for formatting error messages.
-     */
-    protected final String name;
-
-    /**
      * The locale to use for locale-sensitive data (<strong>not</strong> for logging or warning messages),
      * or {@code null} if unspecified.
      *
@@ -175,7 +169,6 @@ public abstract class StaxDataStore exte
      */
     protected StaxDataStore(final StaxDataStoreProvider provider, final StorageConnector connector) throws DataStoreException {
         super(provider, connector);
-        name            = connector.getStorageName();
         storage         = connector.getStorage();
         locale          = connector.getOption(OptionKey.LOCALE);
         timezone        = connector.getOption(OptionKey.TIMEZONE);
@@ -456,13 +449,6 @@ reset:  switch (state) {
     }
 
     /**
-     * Returns the error resources in the current locale.
-     */
-    private Errors errors() {
-        return Errors.getResources(getLocale());
-    }
-
-    /**
      * Closes the input or output stream and releases any resources used by this XML data store.
      * This data store can not be used anymore after this method has been invoked.
      *

Modified: sis/branches/JDK8/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/xml/StaxStreamReader.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/xml/StaxStreamReader.java?rev=1777066&r1=1777065&r2=1777066&view=diff
==============================================================================
--- sis/branches/JDK8/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/xml/StaxStreamReader.java [UTF-8] (original)
+++ sis/branches/JDK8/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/xml/StaxStreamReader.java [UTF-8] Tue Jan  3 05:14:46 2017
@@ -249,7 +249,7 @@ public abstract class StaxStreamReader e
         }
         if (!isNamespace.test(reader.getNamespaceURI()) || !localName.equals(reader.getLocalName())) {
             throw new DataStoreContentException(errors().getString(
-                    Errors.Keys.UnexpectedFileFormat_2, owner.getFormatName(), owner.name));
+                    Errors.Keys.UnexpectedFileFormat_2, owner.getFormatName(), owner.getDisplayName()));
         }
     }
 
@@ -511,7 +511,7 @@ parse:  switch (value.length()) {
      * @return a localized error message for end of file error.
      */
     protected final String endOfFile() {
-        return errors().getString(Errors.Keys.UnexpectedEndOfFile_1, owner.name);
+        return errors().getString(Errors.Keys.UnexpectedEndOfFile_1, owner.getDisplayName());
     }
 
     /**
@@ -522,7 +522,7 @@ parse:  switch (value.length()) {
      * @return a localized error message for a file that can not be parsed.
      */
     protected final String canNotParseFile() {
-        final Object[] parameters = IOUtilities.errorMessageParameters(owner.getFormatName(), owner.name, reader);
+        final Object[] parameters = IOUtilities.errorMessageParameters(owner.getFormatName(), owner.getDisplayName(), reader);
         return errors().getString(IOUtilities.errorMessageKey(parameters), parameters);
     }
 

Modified: sis/branches/JDK8/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/xml/StaxStreamWriter.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/xml/StaxStreamWriter.java?rev=1777066&r1=1777065&r2=1777066&view=diff
==============================================================================
--- sis/branches/JDK8/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/xml/StaxStreamWriter.java [UTF-8] (original)
+++ sis/branches/JDK8/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/xml/StaxStreamWriter.java [UTF-8] Tue Jan  3 05:14:46 2017
@@ -187,7 +187,7 @@ public abstract class StaxStreamWriter e
                 e = ((UncheckedIOException) e).getCause();
             }
             throw new BackingStoreException(errors().getString(Errors.Keys.CanNotWriteFile_2,
-                                                               owner.getFormatName(), owner.name), e);
+                    owner.getFormatName(), owner.getDisplayName()), e);
         }
     }
 

Modified: sis/branches/JDK8/storage/sis-xmlstore/src/test/java/org/apache/sis/internal/gpx/ReaderTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/storage/sis-xmlstore/src/test/java/org/apache/sis/internal/gpx/ReaderTest.java?rev=1777066&r1=1777065&r2=1777066&view=diff
==============================================================================
--- sis/branches/JDK8/storage/sis-xmlstore/src/test/java/org/apache/sis/internal/gpx/ReaderTest.java [UTF-8] (original)
+++ sis/branches/JDK8/storage/sis-xmlstore/src/test/java/org/apache/sis/internal/gpx/ReaderTest.java [UTF-8] Tue Jan  3 05:14:46 2017
@@ -21,6 +21,7 @@ import java.util.Iterator;
 import java.util.List;
 import java.time.Instant;
 import com.esri.core.geometry.Point;
+import com.esri.core.geometry.Polyline;
 import org.opengis.geometry.Envelope;
 import org.apache.sis.storage.gps.Fix;
 import org.apache.sis.storage.StorageConnector;
@@ -301,6 +302,11 @@ public final strictfp class ReaderTest e
         verifyPoint((Feature) points.get(1), 1, v11);
         verifyPoint((Feature) points.get(2), 2, v11);
 
+        final Polyline p = (Polyline) f.getPropertyValue("@geometry");
+        assertEquals("pointCount", 3, p.getPointCount());
+        assertEquals("point(0)", new Point(15, 10), p.getPoint(0));
+        assertEquals("point(1)", new Point(25, 20), p.getPoint(1));
+        assertEquals("point(2)", new Point(35, 30), p.getPoint(2));
         assertEnvelopeEquals(15, 35, 10, 30, (Envelope) f.getPropertyValue("@envelope"));
     }
 
@@ -395,6 +401,12 @@ public final strictfp class ReaderTest e
         verifyPoint((Feature) points.get(1), 1, v11);
         verifyPoint((Feature) points.get(2), 2, v11);
         assertTrue(((Collection<?>) seg2.getPropertyValue("trkpt")).isEmpty());
+
+        final Polyline p = (Polyline) f.getPropertyValue("@geometry");
+        assertEquals("pointCount", 3, p.getPointCount());
+        assertEquals("point(0)", new Point(15, 10), p.getPoint(0));
+        assertEquals("point(1)", new Point(25, 20), p.getPoint(1));
+        assertEquals("point(2)", new Point(35, 30), p.getPoint(2));
         assertEnvelopeEquals(15, 35, 10, 30, (Envelope) f.getPropertyValue("@envelope"));
     }
 



Mime
View raw message