Author: desruisseaux
Date: Sat Feb 24 15:07:28 2018
New Revision: 1825247
URL: http://svn.apache.org/viewvc?rev=1825247&view=rev
Log:
Replaced URIDataStore.Provider.getSuffix() by an annotation to be put on
DataStoreProvider implementations.
Added:
sis/branches/JDK8/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/StoreMetadata.java
- copied, changed from r1825246,
sis/branches/JDK8/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/Capabilities.java
Removed:
sis/branches/JDK8/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/Capabilities.java
Modified:
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/GeoTiffStoreProvider.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/Capability.java
sis/branches/JDK8/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/StoreUtilities.java
sis/branches/JDK8/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/URIDataStore.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/folder/FolderStoreProvider.java
sis/branches/JDK8/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/folder/Store.java
sis/branches/JDK8/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/folder/WritableStore.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/AbstractProvider.java
sis/branches/JDK8/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/xml/StoreProvider.java
sis/branches/JDK8/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/storage/gpx/StoreProvider.java
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=1825247&r1=1825246&r2=1825247&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] Sat Feb 24 15:07:28 2018
@@ -23,7 +23,7 @@ import org.apache.sis.storage.DataStoreE
import org.apache.sis.storage.StorageConnector;
import org.apache.sis.storage.ProbeResult;
import org.apache.sis.internal.storage.Capability;
-import org.apache.sis.internal.storage.Capabilities;
+import org.apache.sis.internal.storage.StoreMetadata;
import org.apache.sis.internal.storage.URIDataStore;
import org.apache.sis.internal.storage.wkt.FirstKeywordPeek;
@@ -37,11 +37,13 @@ import org.apache.sis.internal.storage.w
* the part of the caller. However the {@link LandsatStore} instances created
by this factory are not thread-safe.
*
* @author Martin Desruisseaux (Geomatys)
- * @version 0.8
+ * @version 1.0
* @since 0.8
* @module
*/
-@Capabilities(Capability.READ)
+@StoreMetadata(formatName = LandsatStoreProvider.NAME,
+ fileSuffixes = "txt",
+ capabilities = Capability.READ)
public class LandsatStoreProvider extends DataStoreProvider {
/**
* The format name.
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=1825247&r1=1825246&r2=1825247&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] Sat Feb 24 15:07:28 2018
@@ -25,7 +25,7 @@ import org.apache.sis.storage.DataStoreE
import org.apache.sis.storage.DataStoreProvider;
import org.apache.sis.storage.ProbeResult;
import org.apache.sis.storage.StorageConnector;
-import org.apache.sis.internal.storage.Capabilities;
+import org.apache.sis.internal.storage.StoreMetadata;
import org.apache.sis.internal.storage.Capability;
import org.apache.sis.internal.storage.URIDataStore;
import org.apache.sis.internal.util.Constants;
@@ -40,14 +40,16 @@ import org.apache.sis.internal.util.Cons
* the part of the caller. However the {@link GeoTiffStore} instances created
by this factory are not thread-safe.
*
* @author Martin Desruisseaux (Geomatys)
- * @version 0.8
+ * @version 1.0
*
* @see GeoTiffStore
*
* @since 0.8
* @module
*/
-@Capabilities(Capability.READ)
+@StoreMetadata(formatName = "GeoTIFF",
+ fileSuffixes = {"tiff", "tif"},
+ capabilities = Capability.READ)
public class GeoTiffStoreProvider extends DataStoreProvider {
/**
* The MIME type for GeoTIFF files.
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=1825247&r1=1825246&r2=1825247&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] Sat Feb 24 15:07:28 2018
@@ -32,7 +32,7 @@ import org.apache.sis.internal.netcdf.Re
import org.apache.sis.internal.netcdf.impl.ChannelDecoder;
import org.apache.sis.internal.netcdf.ucar.DecoderWrapper;
import org.apache.sis.internal.storage.io.ChannelDataInput;
-import org.apache.sis.internal.storage.Capabilities;
+import org.apache.sis.internal.storage.StoreMetadata;
import org.apache.sis.internal.storage.Capability;
import org.apache.sis.internal.storage.URIDataStore;
import org.apache.sis.internal.system.SystemListener;
@@ -61,14 +61,16 @@ import org.apache.sis.util.Version;
* the part of the caller. However the {@link NetcdfStore} instances created
by this factory are not thread-safe.
*
* @author Martin Desruisseaux (Geomatys)
- * @version 0.8
+ * @version 1.0
*
* @see NetcdfStore
*
* @since 0.3
* @module
*/
-@Capabilities(Capability.READ)
+@StoreMetadata(formatName = NetcdfStoreProvider.NAME,
+ fileSuffixes = "nc",
+ capabilities = Capability.READ)
public class NetcdfStoreProvider extends DataStoreProvider {
/**
* The format name.
Modified:
sis/branches/JDK8/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/Capability.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK8/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/Capability.java?rev=1825247&r1=1825246&r2=1825247&view=diff
==============================================================================
---
sis/branches/JDK8/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/Capability.java
[UTF-8] (original)
+++
sis/branches/JDK8/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/Capability.java
[UTF-8] Sat Feb 24 15:07:28 2018
@@ -30,7 +30,7 @@ import org.opengis.metadata.citation.Cit
/**
- * One aspect in the set of capabilities of a class annotated by {@link
Capabilities}.
+ * Capabilities of a class annotated by {@link StoreMetadata}.
*
* <p>This is not a committed API since the way to represent data store
capabilities is likely to change.</p>
*
@@ -83,10 +83,10 @@ public enum Capability {
/*
* Build a slash-separated list of capabilities. Example: "Read /
write".
*/
- final Capabilities annotation =
provider.getClass().getAnnotation(Capabilities.class);
+ final StoreMetadata metadata =
provider.getClass().getAnnotation(StoreMetadata.class);
String capabilities = null;
- if (annotation != null) {
- for (final Capability c : annotation.value()) {
+ if (metadata != null) {
+ for (final Capability c : metadata.capabilities()) {
final String e = resources.getString(c.resourceKey);
capabilities = (capabilities == null) ? e :
resources.getString(
Vocabulary.Keys.SlashSeparatedList_2,
capabilities, e.toLowerCase(locale));
Copied:
sis/branches/JDK8/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/StoreMetadata.java
(from r1825246,
sis/branches/JDK8/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/Capabilities.java)
URL:
http://svn.apache.org/viewvc/sis/branches/JDK8/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/StoreMetadata.java?p2=sis/branches/JDK8/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/StoreMetadata.java&p1=sis/branches/JDK8/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/Capabilities.java&r1=1825246&r2=1825247&rev=1825247&view=diff
==============================================================================
---
sis/branches/JDK8/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/Capabilities.java
[UTF-8] (original)
+++
sis/branches/JDK8/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/StoreMetadata.java
[UTF-8] Sat Feb 24 15:07:28 2018
@@ -16,27 +16,67 @@
*/
package org.apache.sis.internal.storage;
+import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+import org.apache.sis.storage.DataStoreProvider;
/**
- * Capabilities of a {@link org.apache.sis.storage.DataStore} or similar
objects.
+ * Metadata about of {@link DataStoreProvider}.
* Some data stores can only read data while other can read and write.
*
* <p>This is not a committed API since the way to represent data store
capabilities is likely to change.</p>
*
* @author Martin Desruisseaux (Geomatys)
- * @version 0.8
+ * @version 1.0
* @since 0.8
* @module
*/
+@Target(ElementType.TYPE)
@Retention(RetentionPolicy.RUNTIME)
-public @interface Capabilities {
+public @interface StoreMetadata {
+ /**
+ * Returns a name for the data store format.
+ * <b>This is not guaranteed to be a unique identifier!</b>
+ * Should not be used as a way to uniquely identify a provider.
+ * In many cases, this is the same than {@link
DataStoreProvider#getShortName()}.
+ *
+ * @return a name for the data store format.
+ *
+ * @see StoreUtilities#getFormatName(DataStoreProvider)
+ * @see DataStoreProvider#getShortName()
+ */
+ String formatName();
+
/**
* Indicates whether the data store created by the {@code open(…)} method
can read and/or write data.
*
* @return information about whether the data store implementation can
read and/or write data.
*/
- Capability[] value();
+ Capability[] capabilities();
+
+ /**
+ * Returns the suffixes that may be used with the name of the "main" file.
+ * The "main" file is the file that users specify when opening the dataset.
+ * The returned array should <em>not</em> include the suffixes of
auxiliary files.
+ *
+ * <div class="note"><b>Example:</b>
+ * GeoTIFF data are contained in files with the {@code ".tif"} or {@code
".tiff"} suffix,
+ * sometime accompanied by auxiliary files with {@code ".prj"} and {@code
".tfw"} suffixes.
+ * This method should return an array containing only {@code "tif"} or
{@code "tiff"} strings,
+ * without the leading dot.</div>
+ *
+ * The suffixes are case-insensitive (no need to declare both lower-case
and upper-case variants)
+ * and shall not contain the leading dot. The first element in the list is
the preferred suffix
+ * to use for new files.
+ *
+ * <p>The same suffixes may be used by many different formats. For example
the {@code ".xml"} suffix
+ * is used for files in many mutually incompatible formats. Consequently
the file suffixes shall not
+ * be used as format identifiers.</p>
+ *
+ * @return the filename suffixes, case insensitive. Never null but can be
empty.
+ */
+ String[] fileSuffixes() default {};
}
Modified:
sis/branches/JDK8/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/StoreUtilities.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK8/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/StoreUtilities.java?rev=1825247&r1=1825246&r2=1825247&view=diff
==============================================================================
---
sis/branches/JDK8/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/StoreUtilities.java
[UTF-8] (original)
+++
sis/branches/JDK8/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/StoreUtilities.java
[UTF-8] Sat Feb 24 15:07:28 2018
@@ -34,6 +34,7 @@ import org.apache.sis.storage.WritableFe
import org.apache.sis.storage.UnsupportedStorageException;
import org.apache.sis.internal.util.Citations;
import org.apache.sis.util.resources.Errors;
+import org.apache.sis.util.CharSequences;
import org.apache.sis.util.Classes;
// Branch-dependent imports
@@ -69,8 +70,15 @@ public final class StoreUtilities extend
* @param provider the provider for which to get an identifier, or
{@code null}.
* @return an identifier for the given data store, or {@code null}.
*/
- public static String getIdentifier(final DataStoreProvider provider) {
- return (provider != null) ? provider.getShortName() : null;
+ public static String getFormatName(final DataStoreProvider provider) {
+ if (provider != null) {
+ final StoreMetadata md =
provider.getClass().getAnnotation(StoreMetadata.class);
+ if (md != null) {
+ return md.formatName();
+ }
+ return provider.getShortName();
+ }
+ return null;
}
/**
@@ -150,6 +158,47 @@ public final class StoreUtilities extend
}
/**
+ * Returns the possible suffixes of the files written by the data store
created by the given provider.
+ * If the file suffixes are unknown, returns an empty array.
+ *
+ * @param provider class of the provider for which to determine if it
has write capability, or {@code null}.
+ * @return the file suffixes, or an empty array if none or if the suffixes
can not be determined.
+ *
+ * @see StoreMetadata#fileSuffixes()
+ */
+ public static String[] getFileSuffixes(final Class<? extends
DataStoreProvider> provider) {
+ if (provider != null) {
+ final StoreMetadata md =
provider.getAnnotation(StoreMetadata.class);
+ if (md != null) return md.fileSuffixes();
+ }
+ return CharSequences.EMPTY_ARRAY;
+ }
+
+ /**
+ * Returns whether the given store has write capability.
+ * In case of doubt, this method returns {@code null}.
+ *
+ * @param provider class of the provider for which to determine if it
has write capability, or {@code null}.
+ * @return whether the data store has write capability, or {@code null} if
it can not be determined.
+ *
+ * @see StoreMetadata#capabilities()
+ */
+ public static Boolean canWrite(final Class<? extends DataStoreProvider>
provider) {
+ if (provider != null) {
+ StoreMetadata md = provider.getAnnotation(StoreMetadata.class);
+ if (md != null) {
+ for (Capability c : md.capabilities()) {
+ if (Capability.WRITE.equals(c)) {
+ return Boolean.TRUE;
+ }
+ }
+ return Boolean.FALSE;
+ }
+ }
+ return null;
+ }
+
+ /**
* Converts the given sequence of options into a simplified set of
standard options.
* The returned set can contain combinations of
* {@link StandardOpenOption#WRITE},
@@ -217,10 +266,12 @@ public final class StoreUtilities extend
* @param format name of the format for which to get a provider.
* @return first provider found for the given format name.
* @throws UnsupportedStorageException if no provider is found for the
specified format.
+ *
+ * @see StoreMetadata#formatName()
*/
public static DataStoreProvider providerByFormatName(final String format)
throws UnsupportedStorageException {
for (DataStoreProvider provider : DataStores.providers()) {
- if (format.equalsIgnoreCase(getIdentifier(provider))) {
+ if (format.equalsIgnoreCase(getFormatName(provider))) {
return provider;
}
}
@@ -228,28 +279,6 @@ public final class StoreUtilities extend
}
/**
- * Returns whether the given store has write capability.
- * In case of doubt, this method returns {@code null}.
- *
- * @param store class of the store for which to determine if it has
write capability, or {@code null}.
- * @return whether the data store has write capability, or {@code null} if
it can not be determined.
- */
- public static Boolean canWrite(final Class<? extends DataStoreProvider>
store) {
- if (store != null) {
- Capabilities caps = store.getAnnotation(Capabilities.class);
- if (caps != null) {
- for (Capability c : caps.value()) {
- if (Capability.WRITE.equals(c)) {
- return Boolean.TRUE;
- }
- }
- return Boolean.FALSE;
- }
- }
- return null;
- }
-
- /**
* Copies all feature from the given source to the given target.
* We use this method as central point where such copy occur, in case we
want to implement
* a more efficient algorithm in some future Apache SIS version. For
example we could copy
@@ -258,6 +287,8 @@ public final class StoreUtilities extend
* @param source the source set of features.
* @param target where to copy the features.
* @throws DataStoreException if an error occurred during the copy
operation.
+ *
+ * @see #canWrite(Class)
*/
public static void copy(final FeatureSet source, final WritableFeatureSet
target) throws DataStoreException {
target.updateType(source.getType());
Modified:
sis/branches/JDK8/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/URIDataStore.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK8/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/URIDataStore.java?rev=1825247&r1=1825246&r2=1825247&view=diff
==============================================================================
---
sis/branches/JDK8/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/URIDataStore.java
[UTF-8] (original)
+++
sis/branches/JDK8/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/URIDataStore.java
[UTF-8] Sat Feb 24 15:07:28 2018
@@ -18,9 +18,6 @@ package org.apache.sis.internal.storage;
import java.net.URI;
import java.nio.charset.Charset;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
import org.opengis.parameter.ParameterValueGroup;
import org.opengis.parameter.ParameterDescriptor;
import org.opengis.parameter.ParameterDescriptorGroup;
@@ -134,12 +131,6 @@ public abstract class URIDataStore exten
private volatile ParameterDescriptorGroup openDescriptor;
/**
- * The suffixes that may be used with the name of the "main" file.
- * This is the collection to be returned by {@link #getSuffix()}.
- */
- protected final List<String> suffix = new ArrayList<>();
-
- /**
* Creates a new provider.
*/
protected Provider() {
@@ -162,27 +153,6 @@ public abstract class URIDataStore exten
}
/**
- * Returns the suffixes that may be used with the name of the "main"
file.
- * The "main" file is the file that users specify when opening the
dataset.
- * The returned collection should <em>not</em> include the suffixes of
auxiliary files.
- *
- * <div class="note"><b>Example:</b>
- * GeoTIFF data are contained in files with the {@code ".tif"} or
{@code ".tiff"} suffix,
- * sometime accompanied by auxiliary files with {@code ".prj"} and
{@code ".tfw"} suffixes.
- * This method should return a collection containing only {@code
"tif"} or {@code "tiff"}
- * strings, without the leading dot.</div>
- *
- * The suffixes are case-insensitive (no need to declare both
lower-case and upper-case variants)
- * and shall not contain the leading dot. The first element in the
list is the preferred suffix
- * to use for new files.
- *
- * @return the filename suffixes, case insensitive. Never null but can
be empty.
- */
- public final List<String> getSuffix() {
- return Collections.unmodifiableList(suffix);
- }
-
- /**
* Invoked by {@link #getOpenParameters()} the first time that a
parameter descriptor needs
* to be created. When invoked, the parameter group name is set to a
name derived from the
* {@link #getShortName()} value. The default implementation creates a
group containing only
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=1825247&r1=1825246&r2=1825247&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] Sat Feb 24 15:07:28 2018
@@ -29,7 +29,7 @@ import org.apache.sis.storage.StorageCon
import org.apache.sis.feature.FoliationRepresentation;
import org.apache.sis.internal.storage.Resources;
import org.apache.sis.internal.storage.Capability;
-import org.apache.sis.internal.storage.Capabilities;
+import org.apache.sis.internal.storage.StoreMetadata;
import org.apache.sis.internal.storage.URIDataStore;
import org.apache.sis.internal.storage.wkt.FirstKeywordPeek;
import org.apache.sis.util.ArgumentChecks;
@@ -48,7 +48,9 @@ import org.apache.sis.util.ArgumentCheck
* @since 0.8
* @module
*/
-@Capabilities(Capability.READ)
+@StoreMetadata(formatName = StoreProvider.NAME,
+ fileSuffixes = "csv",
+ capabilities = Capability.READ)
public final class StoreProvider extends URIDataStore.Provider {
/**
* The format names for static features and moving features.
@@ -126,7 +128,6 @@ public final class StoreProvider extends
* Creates a new provider.
*/
public StoreProvider() {
- suffix.add("csv");
}
/**
Modified:
sis/branches/JDK8/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/folder/FolderStoreProvider.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK8/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/folder/FolderStoreProvider.java?rev=1825247&r1=1825246&r2=1825247&view=diff
==============================================================================
---
sis/branches/JDK8/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/folder/FolderStoreProvider.java
[UTF-8] (original)
+++
sis/branches/JDK8/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/folder/FolderStoreProvider.java
[UTF-8] Sat Feb 24 15:07:28 2018
@@ -43,6 +43,8 @@ import org.apache.sis.util.logging.Loggi
import org.apache.sis.internal.system.Modules;
import org.apache.sis.internal.storage.Resources;
import org.apache.sis.internal.storage.URIDataStore;
+import org.apache.sis.internal.storage.Capability;
+import org.apache.sis.internal.storage.StoreMetadata;
import org.apache.sis.internal.storage.StoreUtilities;
import org.apache.sis.setup.OptionKey;
@@ -58,6 +60,7 @@ import org.apache.sis.setup.OptionKey;
* @since 0.8
* @module
*/
+@StoreMetadata(formatName=FolderStoreProvider.NAME,
capabilities={Capability.READ, Capability.WRITE})
public final class FolderStoreProvider extends DataStoreProvider {
/**
* A short name or abbreviation for the data format.
Modified:
sis/branches/JDK8/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/folder/Store.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK8/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/folder/Store.java?rev=1825247&r1=1825246&r2=1825247&view=diff
==============================================================================
---
sis/branches/JDK8/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/folder/Store.java
[UTF-8] (original)
+++
sis/branches/JDK8/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/folder/Store.java
[UTF-8] Sat Feb 24 15:07:28 2018
@@ -176,7 +176,7 @@ class Store extends DataStore implements
*/
@Override
public ParameterValueGroup getOpenParameters() {
- final String format = StoreUtilities.getIdentifier(componentProvider);
+ final String format = StoreUtilities.getFormatName(componentProvider);
final ParameterValueGroup pg = (provider != null ?
provider.getOpenParameters() : FolderStoreProvider.PARAMETERS).createValue();
pg.parameter(DataStoreProvider.LOCATION).setValue(location);
if (locale != null) pg.parameter("locale" ).setValue(locale );
Modified:
sis/branches/JDK8/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/folder/WritableStore.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK8/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/folder/WritableStore.java?rev=1825247&r1=1825246&r2=1825247&view=diff
==============================================================================
---
sis/branches/JDK8/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/folder/WritableStore.java
[UTF-8] (original)
+++
sis/branches/JDK8/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/folder/WritableStore.java
[UTF-8] Sat Feb 24 15:07:28 2018
@@ -23,7 +23,6 @@ import java.nio.file.SimpleFileVisitor;
import java.nio.file.StandardOpenOption;
import java.nio.file.attribute.BasicFileAttributes;
import java.io.IOException;
-import java.util.Iterator;
import org.apache.sis.setup.OptionKey;
import org.apache.sis.storage.Resource;
import org.apache.sis.storage.DataStore;
@@ -37,7 +36,6 @@ import org.apache.sis.internal.storage.S
import org.apache.sis.internal.storage.Resources;
import org.apache.sis.util.ArgumentChecks;
import org.apache.sis.internal.storage.ResourceOnFileSystem;
-import org.apache.sis.internal.storage.URIDataStore;
import org.apache.sis.storage.ReadOnlyStorageException;
@@ -98,11 +96,9 @@ final class WritableStore extends Store
if (filename == null) {
throw new
DataStoreException(message(Resources.Keys.MissingResourceIdentifier_1,
StoreUtilities.getLabel(resource)));
}
- if (componentProvider instanceof URIDataStore.Provider) {
- final Iterator<String> suffixes = ((URIDataStore.Provider)
componentProvider).getSuffix().iterator();
- if (suffixes.hasNext()) {
- filename += '.' + suffixes.next();
- }
+ final String[] suffixes =
StoreUtilities.getFileSuffixes(componentProvider.getClass());
+ if (suffixes.length != 0) {
+ filename += '.' + suffixes[0];
}
/*
* Create new store/resource for write access, provided that no store
already exist for the path.
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=1825247&r1=1825246&r2=1825247&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] Sat Feb 24 15:07:28 2018
@@ -24,7 +24,7 @@ import org.apache.sis.storage.DataStoreE
import org.apache.sis.storage.StorageConnector;
import org.apache.sis.storage.ProbeResult;
import org.apache.sis.internal.storage.Capability;
-import org.apache.sis.internal.storage.Capabilities;
+import org.apache.sis.internal.storage.StoreMetadata;
import org.apache.sis.internal.storage.URIDataStore;
import org.apache.sis.internal.metadata.WKTKeywords;
import org.apache.sis.util.Version;
@@ -34,11 +34,13 @@ import org.apache.sis.util.Version;
* The provider of WKT {@link Store} instances.
*
* @author Martin Desruisseaux (Geomatys)
- * @version 0.8
+ * @version 1.0
* @since 0.7
* @module
*/
-@Capabilities(Capability.READ)
+@StoreMetadata(formatName = StoreProvider.NAME,
+ fileSuffixes = "prj",
+ capabilities = Capability.READ)
public final class StoreProvider extends URIDataStore.Provider {
/**
* The format name.
Modified:
sis/branches/JDK8/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/xml/AbstractProvider.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK8/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/xml/AbstractProvider.java?rev=1825247&r1=1825246&r2=1825247&view=diff
==============================================================================
---
sis/branches/JDK8/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/xml/AbstractProvider.java
[UTF-8] (original)
+++
sis/branches/JDK8/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/xml/AbstractProvider.java
[UTF-8] Sat Feb 24 15:07:28 2018
@@ -80,7 +80,6 @@ public abstract class AbstractProvider e
protected AbstractProvider(final String name, final int initialCapacity) {
super(name);
types = new HashMap<>(initialCapacity);
- suffix.add("xml");
}
/**
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=1825247&r1=1825246&r2=1825247&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] Sat Feb 24 15:07:28 2018
@@ -20,7 +20,7 @@ import org.apache.sis.xml.Namespaces;
import org.apache.sis.storage.DataStore;
import org.apache.sis.storage.DataStoreException;
import org.apache.sis.storage.StorageConnector;
-import org.apache.sis.internal.storage.Capabilities;
+import org.apache.sis.internal.storage.StoreMetadata;
import org.apache.sis.internal.storage.Capability;
@@ -28,11 +28,13 @@ import org.apache.sis.internal.storage.C
* The provider of {@link Store} instances.
*
* @author Martin Desruisseaux (Geomatys)
- * @version 0.8
+ * @version 1.0
* @since 0.4
* @module
*/
-@Capabilities(Capability.READ)
+@StoreMetadata(formatName = StoreProvider.NAME,
+ fileSuffixes = "xml",
+ capabilities = Capability.READ)
public final class StoreProvider extends AbstractProvider {
/**
* The format name.
Modified:
sis/branches/JDK8/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/storage/gpx/StoreProvider.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK8/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/storage/gpx/StoreProvider.java?rev=1825247&r1=1825246&r2=1825247&view=diff
==============================================================================
---
sis/branches/JDK8/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/storage/gpx/StoreProvider.java
[UTF-8] (original)
+++
sis/branches/JDK8/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/storage/gpx/StoreProvider.java
[UTF-8] Sat Feb 24 15:07:28 2018
@@ -22,7 +22,7 @@ import org.apache.sis.storage.DataStore;
import org.apache.sis.storage.DataStoreException;
import org.apache.sis.storage.StorageConnector;
import org.apache.sis.internal.storage.Capability;
-import org.apache.sis.internal.storage.Capabilities;
+import org.apache.sis.internal.storage.StoreMetadata;
import org.apache.sis.internal.storage.xml.stream.StaxDataStoreProvider;
import org.apache.sis.measure.Range;
import org.apache.sis.util.Version;
@@ -34,11 +34,13 @@ import org.apache.sis.util.Version;
*
* @author Johann Sorel (Geomatys)
* @author Martin Desruisseaux (Geomatys)
- * @version 0.8
+ * @version 1.0
* @since 0.8
* @module
*/
-@Capabilities({Capability.READ, Capability.WRITE})
+@StoreMetadata(formatName = "GPX",
+ fileSuffixes = "xml",
+ capabilities = {Capability.READ, Capability.WRITE})
public final class StoreProvider extends StaxDataStoreProvider {
/**
* The "1.0" version.