sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject svn commit: r1807236 - in /sis/branches/JDK8/storage: sis-earth-observation/src/main/java/org/apache/sis/storage/earthobservation/ sis-geotiff/src/main/java/org/apache/sis/storage/geotiff/ sis-netcdf/src/main/java/org/apache/sis/storage/netcdf/ sis-sto...
Date Mon, 04 Sep 2017 14:39:43 GMT
Author: desruisseaux
Date: Mon Sep  4 14:39:42 2017
New Revision: 1807236

URL: http://svn.apache.org/viewvc?rev=1807236&view=rev
Log:
Partial commit review and javadoc completion.

Modified:
    sis/branches/JDK8/storage/sis-earth-observation/src/main/java/org/apache/sis/storage/earthobservation/LandsatStore.java
    sis/branches/JDK8/storage/sis-earth-observation/src/main/java/org/apache/sis/storage/earthobservation/LandsatStoreProvider.java
    sis/branches/JDK8/storage/sis-geotiff/src/main/java/org/apache/sis/storage/geotiff/GeoTiffStore.java
    sis/branches/JDK8/storage/sis-geotiff/src/main/java/org/apache/sis/storage/geotiff/GeoTiffStoreProvider.java
    sis/branches/JDK8/storage/sis-netcdf/src/main/java/org/apache/sis/storage/netcdf/NetcdfStore.java
    sis/branches/JDK8/storage/sis-netcdf/src/main/java/org/apache/sis/storage/netcdf/NetcdfStoreProvider.java
    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/csv/StoreProvider.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/wkt/StoreProvider.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/internal/storage/xml/StoreProvider.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/DataStoreProvider.java
    sis/branches/JDK8/storage/sis-storage/src/main/java/org/apache/sis/storage/IllegalOpenParameterException.java
    sis/branches/JDK8/storage/sis-storage/src/main/java/org/apache/sis/storage/UnsupportedStorageException.java
    sis/branches/JDK8/storage/sis-storage/src/test/java/org/apache/sis/storage/DataStoreMock.java

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=1807236&r1=1807235&r2=1807236&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] Mon Sep  4 14:39:42 2017
@@ -21,18 +21,18 @@ import java.io.BufferedReader;
 import java.io.LineNumberReader;
 import java.io.IOException;
 import java.net.URI;
-import org.apache.sis.parameter.Parameters;
 import org.opengis.metadata.Metadata;
 import org.opengis.util.FactoryException;
+import org.opengis.parameter.ParameterValueGroup;
 import org.apache.sis.storage.DataStore;
 import org.apache.sis.storage.DataStoreException;
 import org.apache.sis.storage.DataStoreReferencingException;
 import org.apache.sis.storage.UnsupportedStorageException;
 import org.apache.sis.storage.StorageConnector;
-import org.apache.sis.setup.OptionKey;
 import org.apache.sis.storage.Resource;
+import org.apache.sis.parameter.Parameters;
+import org.apache.sis.setup.OptionKey;
 import org.apache.sis.util.Debug;
-import org.opengis.parameter.ParameterValueGroup;
 
 
 /**
@@ -99,7 +99,7 @@ public class LandsatStore extends DataSt
         }
         connector.closeAllExcept(source);
         if (source == null) {
-            throw new UnsupportedStorageException(super.getLocale(), "Landsat",
+            throw new UnsupportedStorageException(super.getLocale(), LandsatStoreProvider.NAME,
                     connector.getStorage(), connector.getOption(OptionKey.OPEN_OPTIONS));
         }
     }

Modified: sis/branches/JDK8/storage/sis-earth-observation/src/main/java/org/apache/sis/storage/earthobservation/LandsatStoreProvider.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/storage/sis-earth-observation/src/main/java/org/apache/sis/storage/earthobservation/LandsatStoreProvider.java?rev=1807236&r1=1807235&r2=1807236&view=diff
==============================================================================
--- sis/branches/JDK8/storage/sis-earth-observation/src/main/java/org/apache/sis/storage/earthobservation/LandsatStoreProvider.java
[UTF-8] (original)
+++ sis/branches/JDK8/storage/sis-earth-observation/src/main/java/org/apache/sis/storage/earthobservation/LandsatStoreProvider.java
[UTF-8] Mon Sep  4 14:39:42 2017
@@ -17,6 +17,8 @@
 package org.apache.sis.storage.earthobservation;
 
 import java.net.URI;
+import org.opengis.parameter.ParameterDescriptor;
+import org.opengis.parameter.ParameterDescriptorGroup;
 import org.apache.sis.storage.DataStore;
 import org.apache.sis.storage.DataStoreProvider;
 import org.apache.sis.storage.DataStoreException;
@@ -26,9 +28,6 @@ import org.apache.sis.internal.storage.C
 import org.apache.sis.internal.storage.Capabilities;
 import org.apache.sis.internal.storage.wkt.FirstKeywordPeek;
 import org.apache.sis.parameter.ParameterBuilder;
-import static org.apache.sis.storage.DataStoreProvider.LOCATION;
-import org.opengis.parameter.ParameterDescriptor;
-import org.opengis.parameter.ParameterDescriptorGroup;
 
 
 /**
@@ -46,6 +45,10 @@ import org.opengis.parameter.ParameterDe
  */
 @Capabilities(Capability.READ)
 public class LandsatStoreProvider extends DataStoreProvider {
+    /**
+     * The format name.
+     */
+    static final String NAME = "Landsat";
 
     /**
      * Landsat location.
@@ -56,7 +59,7 @@ public class LandsatStoreProvider extend
             .create(URI.class, null);
 
     static final ParameterDescriptorGroup OPEN_DESCRIPTOR =
-            new ParameterBuilder().addName("Landsat").createGroup(PARAM_LOCATION);
+            new ParameterBuilder().addName(NAME).createGroup(PARAM_LOCATION);
 
     /**
      * The object to use for verifying if the first keyword is the expected one.
@@ -149,7 +152,7 @@ public class LandsatStoreProvider extend
      */
     @Override
     public String getShortName() {
-        return "Landsat";
+        return NAME;
     }
 
     /**

Modified: sis/branches/JDK8/storage/sis-geotiff/src/main/java/org/apache/sis/storage/geotiff/GeoTiffStore.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/storage/sis-geotiff/src/main/java/org/apache/sis/storage/geotiff/GeoTiffStore.java?rev=1807236&r1=1807235&r2=1807236&view=diff
==============================================================================
--- sis/branches/JDK8/storage/sis-geotiff/src/main/java/org/apache/sis/storage/geotiff/GeoTiffStore.java
[UTF-8] (original)
+++ sis/branches/JDK8/storage/sis-geotiff/src/main/java/org/apache/sis/storage/geotiff/GeoTiffStore.java
[UTF-8] Mon Sep  4 14:39:42 2017
@@ -26,6 +26,7 @@ import java.nio.file.StandardOpenOption;
 import org.opengis.util.FactoryException;
 import org.opengis.metadata.Metadata;
 import org.opengis.metadata.maintenance.ScopeCode;
+import org.opengis.parameter.ParameterValueGroup;
 import org.apache.sis.setup.OptionKey;
 import org.apache.sis.storage.DataStore;
 import org.apache.sis.storage.StorageConnector;
@@ -40,7 +41,6 @@ import org.apache.sis.parameter.Paramete
 import org.apache.sis.storage.DataStoreClosedException;
 import org.apache.sis.storage.Resource;
 import org.apache.sis.util.resources.Errors;
-import org.opengis.parameter.ParameterValueGroup;
 
 
 /**
@@ -88,7 +88,7 @@ public class GeoTiffStore extends DataSt
         this.encoding = (encoding != null) ? encoding : StandardCharsets.US_ASCII;
         final ChannelDataInput input = connector.getStorageAs(ChannelDataInput.class);
         if (input == null) {
-            throw new UnsupportedStorageException(super.getLocale(), "TIFF",
+            throw new UnsupportedStorageException(super.getLocale(), Constants.GEOTIFF,
                     connector.getStorage(), connector.getOption(OptionKey.OPEN_OPTIONS));
         }
         connector.closeAllExcept(input);
@@ -135,7 +135,7 @@ public class GeoTiffStore extends DataSt
             } catch (IOException e) {
                 throw new DataStoreException(errors().getString(Errors.Keys.CanNotRead_1,
reader.input.filename), e);
             } catch (FactoryException | ArithmeticException e) {
-                throw new DataStoreContentException(getLocale(), "TIFF", reader.input.filename,
null).initCause(e);
+                throw new DataStoreContentException(getLocale(), Constants.GEOTIFF, reader.input.filename,
null).initCause(e);
             }
         }
         return metadata;

Modified: sis/branches/JDK8/storage/sis-geotiff/src/main/java/org/apache/sis/storage/geotiff/GeoTiffStoreProvider.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/storage/sis-geotiff/src/main/java/org/apache/sis/storage/geotiff/GeoTiffStoreProvider.java?rev=1807236&r1=1807235&r2=1807236&view=diff
==============================================================================
--- sis/branches/JDK8/storage/sis-geotiff/src/main/java/org/apache/sis/storage/geotiff/GeoTiffStoreProvider.java
[UTF-8] (original)
+++ sis/branches/JDK8/storage/sis-geotiff/src/main/java/org/apache/sis/storage/geotiff/GeoTiffStoreProvider.java
[UTF-8] Mon Sep  4 14:39:42 2017
@@ -19,6 +19,8 @@ package org.apache.sis.storage.geotiff;
 import java.net.URI;
 import java.nio.ByteBuffer;
 import java.nio.ByteOrder;
+import org.opengis.parameter.ParameterDescriptor;
+import org.opengis.parameter.ParameterDescriptorGroup;
 import org.apache.sis.util.Version;
 import org.apache.sis.storage.DataStore;
 import org.apache.sis.storage.DataStoreException;
@@ -29,9 +31,6 @@ import org.apache.sis.internal.storage.C
 import org.apache.sis.internal.storage.Capability;
 import org.apache.sis.internal.util.Constants;
 import org.apache.sis.parameter.ParameterBuilder;
-import static org.apache.sis.storage.DataStoreProvider.LOCATION;
-import org.opengis.parameter.ParameterDescriptor;
-import org.opengis.parameter.ParameterDescriptorGroup;
 
 
 /**
@@ -52,6 +51,15 @@ import org.opengis.parameter.ParameterDe
  */
 @Capabilities(Capability.READ)
 public class GeoTiffStoreProvider extends DataStoreProvider {
+    /**
+     * The MIME type for GeoTIFF files.
+     */
+    private static final String MIME_TYPE = "image/tiff";
+
+    /**
+     * The TIFF version.
+     */
+    private static final Version VERSION = new Version("6.0");
 
     /**
      * Geotiff location.
@@ -65,16 +73,6 @@ public class GeoTiffStoreProvider extend
             new ParameterBuilder().addName(Constants.GEOTIFF).createGroup(PARAM_LOCATION);
 
     /**
-     * The MIME type for GeoTIFF files.
-     */
-    private static final String MIME_TYPE = "image/tiff";
-
-    /**
-     * The TIFF version.
-     */
-    private static final Version VERSION = new Version("6.0");
-
-    /**
      * Creates a new provider.
      */
     public GeoTiffStoreProvider() {

Modified: sis/branches/JDK8/storage/sis-netcdf/src/main/java/org/apache/sis/storage/netcdf/NetcdfStore.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/storage/sis-netcdf/src/main/java/org/apache/sis/storage/netcdf/NetcdfStore.java?rev=1807236&r1=1807235&r2=1807236&view=diff
==============================================================================
--- sis/branches/JDK8/storage/sis-netcdf/src/main/java/org/apache/sis/storage/netcdf/NetcdfStore.java
[UTF-8] (original)
+++ sis/branches/JDK8/storage/sis-netcdf/src/main/java/org/apache/sis/storage/netcdf/NetcdfStore.java
[UTF-8] Mon Sep  4 14:39:42 2017
@@ -19,6 +19,7 @@ package org.apache.sis.storage.netcdf;
 import java.io.IOException;
 import java.net.URI;
 import org.opengis.metadata.Metadata;
+import org.opengis.parameter.ParameterValueGroup;
 import org.apache.sis.util.Debug;
 import org.apache.sis.storage.DataStore;
 import org.apache.sis.storage.DataStoreException;
@@ -31,7 +32,6 @@ import org.apache.sis.setup.OptionKey;
 import org.apache.sis.storage.Resource;
 import org.apache.sis.util.CharSequences;
 import org.apache.sis.util.Version;
-import org.opengis.parameter.ParameterValueGroup;
 import ucar.nc2.constants.CDM;
 
 
@@ -99,7 +99,7 @@ public class NetcdfStore extends DataSto
             throw new DataStoreException(e);
         }
         if (decoder == null) {
-            throw new UnsupportedStorageException(super.getLocale(), "NetCDF",
+            throw new UnsupportedStorageException(super.getLocale(), NetcdfStoreProvider.NAME,
                     connector.getStorage(), connector.getOption(OptionKey.OPEN_OPTIONS));
         }
     }

Modified: sis/branches/JDK8/storage/sis-netcdf/src/main/java/org/apache/sis/storage/netcdf/NetcdfStoreProvider.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/storage/sis-netcdf/src/main/java/org/apache/sis/storage/netcdf/NetcdfStoreProvider.java?rev=1807236&r1=1807235&r2=1807236&view=diff
==============================================================================
--- sis/branches/JDK8/storage/sis-netcdf/src/main/java/org/apache/sis/storage/netcdf/NetcdfStoreProvider.java
[UTF-8] (original)
+++ sis/branches/JDK8/storage/sis-netcdf/src/main/java/org/apache/sis/storage/netcdf/NetcdfStoreProvider.java
[UTF-8] Mon Sep  4 14:39:42 2017
@@ -27,6 +27,8 @@ import java.lang.reflect.Constructor;
 import java.lang.reflect.InvocationTargetException;
 import java.lang.reflect.UndeclaredThrowableException;
 import java.net.URI;
+import org.opengis.parameter.ParameterDescriptor;
+import org.opengis.parameter.ParameterDescriptorGroup;
 import org.apache.sis.internal.netcdf.Decoder;
 import org.apache.sis.internal.netcdf.Resources;
 import org.apache.sis.internal.netcdf.impl.ChannelDecoder;
@@ -45,8 +47,6 @@ import org.apache.sis.storage.ProbeResul
 import org.apache.sis.util.logging.WarningListeners;
 import org.apache.sis.util.logging.Logging;
 import org.apache.sis.util.Version;
-import org.opengis.parameter.ParameterDescriptor;
-import org.opengis.parameter.ParameterDescriptorGroup;
 
 
 /**
@@ -70,6 +70,15 @@ import org.opengis.parameter.ParameterDe
  */
 @Capabilities(Capability.READ)
 public class NetcdfStoreProvider extends DataStoreProvider {
+    /**
+     * The format name.
+     */
+    static final String NAME = "NetCDF";
+
+    /**
+     * The MIME type for NetCDF files.
+     */
+    static final String MIME_TYPE = "application/x-netcdf";
 
     /**
      * NetCDF location.
@@ -80,12 +89,7 @@ public class NetcdfStoreProvider extends
             .create(URI.class, null);
 
     static final ParameterDescriptorGroup OPEN_DESCRIPTOR =
-            new ParameterBuilder().addName("NetCDF").createGroup(PARAM_LOCATION);
-
-    /**
-     * The MIME type for NetCDF files.
-     */
-    static final String MIME_TYPE = "application/x-netcdf";
+            new ParameterBuilder().addName(NAME).createGroup(PARAM_LOCATION);
 
     /**
      * The name of the {@link ucar.nc2.NetcdfFile} class, which is {@value}.
@@ -142,7 +146,7 @@ public class NetcdfStoreProvider extends
      */
     @Override
     public String getShortName() {
-        return "NetCDF";
+        return NAME;
     }
 
     /**

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=1807236&r1=1807235&r2=1807236&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] Mon Sep  4 14:39:42 2017
@@ -31,12 +31,13 @@ import java.net.URI;
 import java.nio.charset.Charset;
 import javax.measure.Unit;
 import javax.measure.quantity.Time;
-import org.opengis.metadata.Metadata;
 import org.opengis.util.FactoryException;
+import org.opengis.metadata.Metadata;
 import org.opengis.metadata.maintenance.ScopeCode;
 import org.opengis.referencing.crs.CoordinateReferenceSystem;
 import org.opengis.referencing.crs.TemporalCRS;
 import org.opengis.referencing.operation.TransformException;
+import org.opengis.parameter.ParameterValueGroup;
 import org.apache.sis.feature.DefaultAttributeType;
 import org.apache.sis.feature.DefaultFeatureType;
 import org.apache.sis.referencing.CRS;
@@ -58,6 +59,7 @@ import org.apache.sis.storage.DataStoreC
 import org.apache.sis.storage.DataStoreReferencingException;
 import org.apache.sis.storage.UnsupportedStorageException;
 import org.apache.sis.storage.StorageConnector;
+import org.apache.sis.parameter.Parameters;
 import org.apache.sis.setup.OptionKey;
 import org.apache.sis.util.ArraysExt;
 import org.apache.sis.util.CharSequences;
@@ -69,12 +71,10 @@ import java.time.Instant;
 import java.time.DateTimeException;
 import java.util.stream.Stream;
 import java.util.stream.StreamSupport;
-import org.apache.sis.parameter.Parameters;
 import org.opengis.feature.Feature;
 import org.opengis.feature.FeatureType;
 import org.opengis.feature.PropertyType;
 import org.opengis.feature.AttributeType;
-import org.opengis.parameter.ParameterValueGroup;
 
 
 /**
@@ -240,7 +240,7 @@ public final class Store extends DataSto
         }
         connector.closeAllExcept(r);
         if (r == null) {
-            throw new UnsupportedStorageException(super.getLocale(), "CSV",
+            throw new UnsupportedStorageException(super.getLocale(), StoreProvider.NAME,
                     connector.getStorage(), connector.getOption(OptionKey.OPEN_OPTIONS));
         }
         source = (r instanceof BufferedReader) ? (BufferedReader) r : new LineNumberReader(r);

Modified: sis/branches/JDK8/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/csv/StoreProvider.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/csv/StoreProvider.java?rev=1807236&r1=1807235&r2=1807236&view=diff
==============================================================================
--- sis/branches/JDK8/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/csv/StoreProvider.java
[UTF-8] (original)
+++ sis/branches/JDK8/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/csv/StoreProvider.java
[UTF-8] Mon Sep  4 14:39:42 2017
@@ -17,6 +17,8 @@
 package org.apache.sis.internal.storage.csv;
 
 import java.net.URI;
+import org.opengis.parameter.ParameterDescriptor;
+import org.opengis.parameter.ParameterDescriptorGroup;
 import org.apache.sis.storage.DataStore;
 import org.apache.sis.storage.DataStoreException;
 import org.apache.sis.storage.DataStoreProvider;
@@ -26,9 +28,6 @@ import org.apache.sis.internal.storage.C
 import org.apache.sis.internal.storage.Capabilities;
 import org.apache.sis.internal.storage.wkt.FirstKeywordPeek;
 import org.apache.sis.parameter.ParameterBuilder;
-import static org.apache.sis.storage.DataStoreProvider.LOCATION;
-import org.opengis.parameter.ParameterDescriptor;
-import org.opengis.parameter.ParameterDescriptorGroup;
 
 
 /**
@@ -46,6 +45,10 @@ import org.opengis.parameter.ParameterDe
  */
 @Capabilities(Capability.READ)
 public final class StoreProvider extends DataStoreProvider {
+    /**
+     * The format names for static features and moving features.
+     */
+    static final String NAME = "CSV", MOVING = "CSV-MF";
 
     /**
      * CSV source.
@@ -56,12 +59,7 @@ public final class StoreProvider extends
             .create(URI.class, null);
 
     static final ParameterDescriptorGroup OPEN_DESCRIPTOR =
-            new ParameterBuilder().addName("CSV").createGroup(PARAM_LOCATION);
-
-    /**
-     * The format names for static features and moving features.
-     */
-    static final String NAME = "CSV", MOVING = "CSV-MF";
+            new ParameterBuilder().addName(NAME).createGroup(PARAM_LOCATION);
 
     /**
      * The object to use for verifying if the first keyword is the expected one.

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=1807236&r1=1807235&r2=1807236&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] Mon Sep  4 14:39:42 2017
@@ -99,7 +99,7 @@ final class Store extends DataStore {
         }
         connector.closeAllExcept(source);
         if (source == null) {
-            throw new UnsupportedStorageException(super.getLocale(), "WKT",
+            throw new UnsupportedStorageException(super.getLocale(), StoreProvider.NAME,
                     connector.getStorage(), connector.getOption(OptionKey.OPEN_OPTIONS));
         }
     }

Modified: sis/branches/JDK8/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/wkt/StoreProvider.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/wkt/StoreProvider.java?rev=1807236&r1=1807235&r2=1807236&view=diff
==============================================================================
--- sis/branches/JDK8/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/wkt/StoreProvider.java
[UTF-8] (original)
+++ sis/branches/JDK8/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/wkt/StoreProvider.java
[UTF-8] Mon Sep  4 14:39:42 2017
@@ -20,6 +20,8 @@ import java.net.URI;
 import java.util.Collections;
 import java.util.HashSet;
 import java.util.Set;
+import org.opengis.parameter.ParameterDescriptor;
+import org.opengis.parameter.ParameterDescriptorGroup;
 import org.apache.sis.storage.DataStore;
 import org.apache.sis.storage.DataStoreProvider;
 import org.apache.sis.storage.DataStoreException;
@@ -30,8 +32,6 @@ import org.apache.sis.internal.storage.C
 import org.apache.sis.internal.metadata.WKTKeywords;
 import org.apache.sis.parameter.ParameterBuilder;
 import org.apache.sis.util.Version;
-import org.opengis.parameter.ParameterDescriptor;
-import org.opengis.parameter.ParameterDescriptorGroup;
 
 
 /**
@@ -44,6 +44,15 @@ import org.opengis.parameter.ParameterDe
  */
 @Capabilities(Capability.READ)
 public final class StoreProvider extends DataStoreProvider {
+    /**
+     * The format name.
+     */
+    static final String NAME = "WKT";
+
+    /**
+     * The {@value} MIME type.
+     */
+    public static final String MIME_TYPE = "application/wkt";
 
     /**
      * WKT source.
@@ -54,12 +63,7 @@ public final class StoreProvider extends
             .create(URI.class, null);
 
     static final ParameterDescriptorGroup OPEN_DESCRIPTOR =
-            new ParameterBuilder().addName("WKT").createGroup(PARAM_LOCATION);
-
-    /**
-     * The {@value} MIME type.
-     */
-    public static final String MIME_TYPE = "application/wkt";
+            new ParameterBuilder().addName(NAME).createGroup(PARAM_LOCATION);
 
     /**
      * The object to use for verifying if the first keyword is a WKT one.
@@ -168,7 +172,7 @@ public final class StoreProvider extends
      */
     @Override
     public String getShortName() {
-        return "WKT";
+        return NAME;
     }
 
     /**

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=1807236&r1=1807235&r2=1807236&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] Mon Sep  4 14:39:42 2017
@@ -108,7 +108,7 @@ final class Store extends DataStore {
         final Closeable c = input(source);
         connector.closeAllExcept(c);
         if (c == null) {
-            throw new UnsupportedStorageException(super.getLocale(), "XML",
+            throw new UnsupportedStorageException(super.getLocale(), StoreProvider.NAME,
                     connector.getStorage(), connector.getOption(OptionKey.OPEN_OPTIONS));
         }
     }

Modified: sis/branches/JDK8/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/xml/StoreProvider.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/xml/StoreProvider.java?rev=1807236&r1=1807235&r2=1807236&view=diff
==============================================================================
--- sis/branches/JDK8/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/xml/StoreProvider.java
[UTF-8] (original)
+++ sis/branches/JDK8/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/xml/StoreProvider.java
[UTF-8] Mon Sep  4 14:39:42 2017
@@ -17,6 +17,8 @@
 package org.apache.sis.internal.storage.xml;
 
 import java.net.URI;
+import org.opengis.parameter.ParameterDescriptor;
+import org.opengis.parameter.ParameterDescriptorGroup;
 import org.apache.sis.xml.Namespaces;
 import org.apache.sis.storage.DataStore;
 import org.apache.sis.storage.DataStoreException;
@@ -24,8 +26,6 @@ import org.apache.sis.storage.StorageCon
 import org.apache.sis.internal.storage.Capabilities;
 import org.apache.sis.internal.storage.Capability;
 import org.apache.sis.parameter.ParameterBuilder;
-import org.opengis.parameter.ParameterDescriptor;
-import org.opengis.parameter.ParameterDescriptorGroup;
 
 
 /**
@@ -38,6 +38,10 @@ import org.opengis.parameter.ParameterDe
  */
 @Capabilities(Capability.READ)
 public final class StoreProvider extends AbstractProvider {
+    /**
+     * The format name.
+     */
+    static final String NAME = "XML";
 
     /**
      * XML source.
@@ -48,7 +52,7 @@ public final class StoreProvider extends
             .create(URI.class, null);
 
     static final ParameterDescriptorGroup OPEN_DESCRIPTOR =
-            new ParameterBuilder().addName("XML").createGroup(PARAM_LOCATION);
+            new ParameterBuilder().addName(NAME).createGroup(PARAM_LOCATION);
 
     /**
      * Creates a new provider.
@@ -68,7 +72,7 @@ public final class StoreProvider extends
      */
     @Override
     public String getShortName() {
-        return "XML";
+        return NAME;
     }
 
     /**

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=1807236&r1=1807235&r2=1807236&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] Mon Sep  4 14:39:42 2017
@@ -22,13 +22,13 @@ import java.util.IdentityHashMap;
 import java.util.NoSuchElementException;
 import org.opengis.metadata.Metadata;
 import org.opengis.metadata.identification.Identification;
+import org.opengis.parameter.ParameterValueGroup;
 import org.apache.sis.util.Localized;
 import org.apache.sis.util.ArgumentChecks;
 import org.apache.sis.util.logging.WarningListener;
 import org.apache.sis.util.logging.WarningListeners;
 import org.apache.sis.internal.storage.Resources;
 import org.apache.sis.internal.util.Citations;
-import org.opengis.parameter.ParameterValueGroup;
 
 
 /**
@@ -54,6 +54,8 @@ public abstract class DataStore implemen
      * instances of the same class.
      *
      * @since 0.8
+     *
+     * @see #getProvider()
      */
     protected final DataStoreProvider provider;
 
@@ -113,6 +115,21 @@ public abstract class DataStore implemen
     }
 
     /**
+     * Returns the factory that created this {@code DataStore} instance.
+     * The provider gives additional information on this {@code DataStore} such as a format
description
+     * and a list of parameters that can be used for opening data stores of the same class.
+     *
+     * @return the factory that created this {@code DataStore} instance, or {@code null}
if unspecified.
+     *
+     * @see #provider
+     *
+     * @since 0.8
+     */
+    public DataStoreProvider getProvider() {
+        return provider;
+    }
+
+    /**
      * 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.
@@ -170,30 +187,25 @@ public abstract class DataStore implemen
     }
 
     /**
-     * Returns the factory that created this {@code DataStore} instance, or {@code null}
if unspecified.
-     *
-     * <p>The provider provide additional informations on this {@code DataStore} such
as
-     * a format description and the possible parameters usable to configure this store.
-     * </p>
-     *
-     * @return provider parent, can be null
-     */
-    public DataStoreProvider getProvider() {
-        return provider;
-    }
-
-    /**
      * Returns the parameters used to open this data store.
-     * The description of those parameters are defined by {@link DataStoreProvider#getOpenParameters()
}.
+     * The collection of legal parameters is implementation-dependent
+     * ({@linkplain org.apache.sis.parameter.DefaultParameterValue#getDescriptor() their
description}
+     * is given by {@link DataStoreProvider#getOpenParameters()}),
+     * but should contain at least a parameter named {@value DataStoreProvider#LOCATION}
+     * with a {@link java.net.URI}, {@link java.nio.file.Path} or {@link javax.sql.DataSource}
value.
+     *
+     * <p>In the event a data store must be closed and reopened later, those parameters
can be stored in a file or
+     * database and used for {@linkplain DataStoreProvider#open(ParameterValueGroup) creating
a new store} later.</p>
+     *
+     * <p>In some cases, for stores reading in-memory data or other inputs that can
not fit with
+     * {@code ParameterDescriptorGroup} requirements (for example an {@link java.io.InputStream}
+     * connected to unknown or no {@link java.net.URL}), this method may return null.</p>
      *
-     * <p>In the event a store must be closed and reopened later. Those parameters
-     * can be stored in a file or database and used to create a new store later.</p>
+     * @return parameters used for opening this {@code DataStore}, or {@code null} if not
available.
      *
-     * <p>In some cases, for store created with data in memory or with initialization
-     * parameters to complex to be expressed as a ParameterValueGroup, this methid may
-     * return null.</p>
+     * @see DataStoreProvider#getOpenParameters()
      *
-     * @return parameters used when opening this {@link org.apache.sis.storage.DataStore}
or null.
+     * @since 0.8
      */
     public abstract ParameterValueGroup getOpenParameters();
 

Modified: sis/branches/JDK8/storage/sis-storage/src/main/java/org/apache/sis/storage/DataStoreProvider.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/storage/sis-storage/src/main/java/org/apache/sis/storage/DataStoreProvider.java?rev=1807236&r1=1807235&r2=1807236&view=diff
==============================================================================
--- sis/branches/JDK8/storage/sis-storage/src/main/java/org/apache/sis/storage/DataStoreProvider.java
[UTF-8] (original)
+++ sis/branches/JDK8/storage/sis-storage/src/main/java/org/apache/sis/storage/DataStoreProvider.java
[UTF-8] Mon Sep  4 14:39:42 2017
@@ -177,6 +177,8 @@ public abstract class DataStoreProvider
      *
      * @see #open(ParameterValueGroup)
      * @see DataStore#getOpenParameters()
+     *
+     * @since 0.8
      */
     public abstract ParameterDescriptorGroup getOpenParameters();
 
@@ -280,6 +282,8 @@ public abstract class DataStoreProvider
      * @throws DataStoreException if an error occurred while creating the data store instance.
      *
      * @see #getOpenParameters()
+     *
+     * @since 0.8
      */
     public DataStore open(final ParameterValueGroup parameters) throws DataStoreException
{
         ArgumentChecks.ensureNonNull("parameter", parameters);

Modified: sis/branches/JDK8/storage/sis-storage/src/main/java/org/apache/sis/storage/IllegalOpenParameterException.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/storage/sis-storage/src/main/java/org/apache/sis/storage/IllegalOpenParameterException.java?rev=1807236&r1=1807235&r2=1807236&view=diff
==============================================================================
--- sis/branches/JDK8/storage/sis-storage/src/main/java/org/apache/sis/storage/IllegalOpenParameterException.java
[UTF-8] (original)
+++ sis/branches/JDK8/storage/sis-storage/src/main/java/org/apache/sis/storage/IllegalOpenParameterException.java
[UTF-8] Mon Sep  4 14:39:42 2017
@@ -16,9 +16,13 @@
  */
 package org.apache.sis.storage;
 
+import java.util.Locale;
+
 
 /**
  * Thrown when a {@code DataStore} can not be opened because of invalid parameters.
+ * This may be a missing {@value DataStoreProvider#LOCATION} parameter value,
+ * or an unsupported object given to {@link StorageConnector} constructor.
  *
  * @author  Martin Desruisseaux (Geomatys)
  * @version 0.8
@@ -64,4 +68,15 @@ public class IllegalOpenParameterExcepti
     public IllegalOpenParameterException(final String message, final Throwable cause) {
         super(message, cause);
     }
+
+    /**
+     * 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 org.apache.sis.internal.storage.Resources.Keys} constants.
+     * @param parameters  parameters to use for formatting the messages.
+     */
+    IllegalOpenParameterException(final Locale locale, final short key, final Object... parameters)
{
+        super(locale, key, parameters);
+    }
 }

Modified: sis/branches/JDK8/storage/sis-storage/src/main/java/org/apache/sis/storage/UnsupportedStorageException.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/storage/sis-storage/src/main/java/org/apache/sis/storage/UnsupportedStorageException.java?rev=1807236&r1=1807235&r2=1807236&view=diff
==============================================================================
--- sis/branches/JDK8/storage/sis-storage/src/main/java/org/apache/sis/storage/UnsupportedStorageException.java
[UTF-8] (original)
+++ sis/branches/JDK8/storage/sis-storage/src/main/java/org/apache/sis/storage/UnsupportedStorageException.java
[UTF-8] Mon Sep  4 14:39:42 2017
@@ -33,7 +33,7 @@ import org.apache.sis.internal.storage.i
  * @since   0.4
  * @module
  */
-public class UnsupportedStorageException extends DataStoreException {
+public class UnsupportedStorageException extends IllegalOpenParameterException {
     /**
      * For cross-version compatibility.
      */

Modified: 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=1807236&r1=1807235&r2=1807236&view=diff
==============================================================================
--- sis/branches/JDK8/storage/sis-storage/src/test/java/org/apache/sis/storage/DataStoreMock.java
[UTF-8] (original)
+++ sis/branches/JDK8/storage/sis-storage/src/test/java/org/apache/sis/storage/DataStoreMock.java
[UTF-8] Mon Sep  4 14:39:42 2017
@@ -50,17 +50,17 @@ final strictfp class DataStoreMock exten
     }
 
     @Override
-    public Metadata getMetadata() {
+    public ParameterValueGroup getOpenParameters() {
         return null;
     }
 
     @Override
-    public Resource getRootResource() throws DataStoreException {
+    public Metadata getMetadata() {
         return null;
     }
 
     @Override
-    public ParameterValueGroup getOpenParameters() {
+    public Resource getRootResource() throws DataStoreException {
         return null;
     }
 



Mime
View raw message