You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sis.apache.org by de...@apache.org on 2017/01/13 07:41:23 UTC
svn commit: r1778501 - in /sis/trunk: ./ application/sis-console/
application/sis-console/src/test/java/org/apache/sis/console/
core/sis-utility/src/main/java/org/apache/sis/internal/simple/
core/sis-utility/src/main/java/org/apache/sis/setup/ core/sis...
Author: desruisseaux
Date: Fri Jan 13 07:41:23 2017
New Revision: 1778501
URL: http://svn.apache.org/viewvc?rev=1778501&view=rev
Log:
Merge from JDK7 branch.
Added:
sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/simple/SimpleFormat.java
- copied, changed from r1778499, sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/simple/SimpleFormat.java
sis/trunk/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/Capabilities.java
- copied unchanged from r1778499, sis/branches/JDK7/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/Capabilities.java
sis/trunk/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/Capability.java
- copied, changed from r1778499, sis/branches/JDK7/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/Capability.java
sis/trunk/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/DocumentedStoreProvider.java
- copied unchanged from r1778499, sis/branches/JDK7/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/DocumentedStoreProvider.java
Modified:
sis/trunk/ (props changed)
sis/trunk/application/sis-console/pom.xml
sis/trunk/application/sis-console/src/test/java/org/apache/sis/console/MimeTypeCommandTest.java
sis/trunk/core/sis-utility/src/main/java/org/apache/sis/setup/About.java
sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/resources/Vocabulary.java
sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/resources/Vocabulary.properties
sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/resources/Vocabulary_fr.properties
sis/trunk/storage/sis-earth-observation/src/main/java/org/apache/sis/storage/earthobservation/LandsatStoreProvider.java
sis/trunk/storage/sis-geotiff/src/main/java/org/apache/sis/storage/geotiff/GeoTiffStoreProvider.java
sis/trunk/storage/sis-netcdf/src/main/java/org/apache/sis/storage/netcdf/NetcdfStoreProvider.java
sis/trunk/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/csv/StoreProvider.java
sis/trunk/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/wkt/StoreProvider.java
sis/trunk/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/xml/AbstractProvider.java
sis/trunk/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/xml/MimeTypeDetector.java
sis/trunk/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/xml/StoreProvider.java
sis/trunk/storage/sis-storage/src/main/java/org/apache/sis/storage/DataStoreProvider.java
sis/trunk/storage/sis-storage/src/main/java/org/apache/sis/storage/DataStoreRegistry.java
sis/trunk/storage/sis-storage/src/main/java/org/apache/sis/storage/DataStores.java
sis/trunk/storage/sis-storage/src/test/java/org/apache/sis/internal/storage/xml/MimeTypeDetectorTest.java
sis/trunk/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/storage/gpx/Metadata.java
sis/trunk/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/storage/gpx/Store.java
sis/trunk/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/storage/gpx/StoreProvider.java
sis/trunk/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/storage/xml/stream/StaxDataStore.java
sis/trunk/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/storage/xml/stream/StaxDataStoreProvider.java
Propchange: sis/trunk/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Fri Jan 13 07:41:23 2017
@@ -1,5 +1,5 @@
/sis/branches/Android:1430670-1480699
/sis/branches/JDK6:1394364-1758914
-/sis/branches/JDK7:1394913-1778364
-/sis/branches/JDK8:1584960-1778247
+/sis/branches/JDK7:1394913-1778499
+/sis/branches/JDK8:1584960-1778497
/sis/branches/JDK9:1773327-1773512
Modified: sis/trunk/application/sis-console/pom.xml
URL: http://svn.apache.org/viewvc/sis/trunk/application/sis-console/pom.xml?rev=1778501&r1=1778500&r2=1778501&view=diff
==============================================================================
--- sis/trunk/application/sis-console/pom.xml (original)
+++ sis/trunk/application/sis-console/pom.xml Fri Jan 13 07:41:23 2017
@@ -107,6 +107,12 @@ Console application.
<dependencies>
<dependency>
<groupId>org.apache.sis.storage</groupId>
+ <artifactId>sis-xmlstore</artifactId>
+ <version>${project.version}</version>
+ <scope>runtime</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.sis.storage</groupId>
<artifactId>sis-netcdf</artifactId>
<version>${project.version}</version>
<scope>runtime</scope>
@@ -131,6 +137,13 @@ Console application.
<version>${project.version}</version>
<type>test-jar</type>
<scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.sis.storage</groupId>
+ <artifactId>sis-xmlstore</artifactId>
+ <version>${project.version}</version>
+ <type>test-jar</type>
+ <scope>test</scope>
</dependency>
</dependencies>
Modified: sis/trunk/application/sis-console/src/test/java/org/apache/sis/console/MimeTypeCommandTest.java
URL: http://svn.apache.org/viewvc/sis/trunk/application/sis-console/src/test/java/org/apache/sis/console/MimeTypeCommandTest.java?rev=1778501&r1=1778500&r2=1778501&view=diff
==============================================================================
--- sis/trunk/application/sis-console/src/test/java/org/apache/sis/console/MimeTypeCommandTest.java [UTF-8] (original)
+++ sis/trunk/application/sis-console/src/test/java/org/apache/sis/console/MimeTypeCommandTest.java [UTF-8] Fri Jan 13 07:41:23 2017
@@ -17,6 +17,7 @@
package org.apache.sis.console;
import java.net.URL;
+import org.apache.sis.internal.storage.gpx.MetadataTest;
import org.apache.sis.metadata.iso.extent.DefaultExtentTest;
import org.apache.sis.test.DependsOn;
import org.apache.sis.test.TestCase;
@@ -30,7 +31,7 @@ import static org.junit.Assert.*;
*
* @author Martin Desruisseaux (Geomatys)
* @since 0.4
- * @version 0.4
+ * @version 0.8
* @module
*/
@DependsOn(CommandRunnerTest.class)
@@ -38,7 +39,7 @@ public final strictfp class MimeTypeComm
/**
* Tests the sub-command on a metadata file.
*
- * @throws Exception Should never happen.
+ * @throws Exception if an error occurred while reading the test file.
*/
@Test
public void testWithMetadataXML() throws Exception {
@@ -47,6 +48,21 @@ public final strictfp class MimeTypeComm
final MimeTypeCommand test = new MimeTypeCommand(0, CommandRunner.TEST, url.toString());
test.run();
final String output = test.outputBuffer.toString().trim();
- assertTrue(output, output.endsWith("org/apache/sis/metadata/iso/extent/Extent.xml: application/vnd.iso.19139+xml"));
+ assertTrue(output, output.endsWith("Extent.xml: application/vnd.iso.19139+xml"));
+ }
+
+ /**
+ * Tests the sub-command on a GPX file.
+ *
+ * @throws Exception if an error occurred while reading the test file.
+ */
+ @Test
+ public void testWithMetadataGPX() throws Exception {
+ final URL url = MetadataTest.class.getResource("1.1/metadata.xml");
+ assertNotNull("1.1/metadata.xml", url);
+ final MimeTypeCommand test = new MimeTypeCommand(0, CommandRunner.TEST, url.toString());
+ test.run();
+ final String output = test.outputBuffer.toString().trim();
+ assertTrue(output, output.endsWith("metadata.xml: application/gpx+xml"));
}
}
Copied: sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/simple/SimpleFormat.java (from r1778499, sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/simple/SimpleFormat.java)
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/simple/SimpleFormat.java?p2=sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/simple/SimpleFormat.java&p1=sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/simple/SimpleFormat.java&r1=1778499&r2=1778501&rev=1778501&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/simple/SimpleFormat.java [UTF-8] (original)
+++ sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/simple/SimpleFormat.java [UTF-8] Fri Jan 13 07:41:23 2017
@@ -20,10 +20,8 @@ import java.util.Collection;
import java.util.Collections;
import org.apache.sis.util.Debug;
import org.opengis.util.InternationalString;
-import org.opengis.metadata.citation.Citation;
import org.opengis.metadata.distribution.Distributor;
import org.opengis.metadata.distribution.Format;
-import org.opengis.metadata.distribution.Medium;
/**
@@ -70,16 +68,6 @@ public class SimpleFormat extends Simple
}
/**
- * Citation / URL of the specification format.
- *
- * @return citation / URL of the specification format.
- */
- @Override
- public Citation getFormatSpecificationCitation() {
- return this;
- }
-
- /**
* @deprecated Replaced by {@link #getTitle()}
*
* @return name of a subset, profile, or product specification of the format, or {@code null}.
@@ -135,16 +123,6 @@ public class SimpleFormat extends Simple
}
/**
- * Media used by the format.
- *
- * @return media used by the format.
- */
- @Override
- public Collection<? extends Medium> getMedia() {
- return Collections.emptyList();
- }
-
- /**
* Provides information about the distributor's format.
*
* @return information about the distributor's format.
Modified: sis/trunk/core/sis-utility/src/main/java/org/apache/sis/setup/About.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/main/java/org/apache/sis/setup/About.java?rev=1778501&r1=1778500&r2=1778501&view=diff
==============================================================================
--- sis/trunk/core/sis-utility/src/main/java/org/apache/sis/setup/About.java [UTF-8] (original)
+++ sis/trunk/core/sis-utility/src/main/java/org/apache/sis/setup/About.java [UTF-8] Fri Jan 13 07:41:23 2017
@@ -37,6 +37,7 @@ import java.io.IOException;
import java.text.Format;
import java.text.DateFormat;
import java.text.FieldPosition;
+import java.nio.file.Path;
import java.nio.charset.Charset;
import java.security.AccessController;
import java.security.PrivilegedAction;
@@ -62,9 +63,6 @@ import static org.apache.sis.util.collec
import static org.apache.sis.util.collection.TableColumn.VALUE_AS_TEXT;
import static org.apache.sis.internal.util.StandardDateFormat.UTC;
-// Branch-dependent imports
-import java.nio.file.Path;
-
/**
* Provides information about the Apache SIS running environment.
@@ -83,7 +81,7 @@ import java.nio.file.Path;
*
* @author Martin Desruisseaux (Geomatys)
* @since 0.3
- * @version 0.7
+ * @version 0.8
* @module
*/
public enum About {
@@ -95,6 +93,7 @@ public enum About {
* <li>Apache SIS version</li>
* <li>Java runtime version and vendor</li>
* <li>Operation system name and version</li>
+ * <li>EPSG geodetic dataset in use</li>
* </ul>
*/
VERSIONS(Vocabulary.Keys.Versions),
@@ -113,6 +112,18 @@ public enum About {
LOCALIZATION(Vocabulary.Keys.Localization),
/**
+ * Information about available plugins.
+ * This section includes:
+ *
+ * <ul>
+ * <li>List of data store implementations</li>
+ * </ul>
+ *
+ * @since 0.8
+ */
+ PLUGINS(Vocabulary.Keys.Plugins),
+
+ /**
* Information about logging.
*/
LOGGING(Vocabulary.Keys.Logging),
@@ -312,6 +323,20 @@ fill: for (int i=0; ; i++) {
break;
}
case 9: {
+ newSection = PLUGINS;
+ if (sections.contains(PLUGINS)) try {
+ children = (String[]) Class.forName("org.apache.sis.internal.storage.Capability")
+ .getMethod("providers", Locale.class, Vocabulary.class).invoke(null, locale, resources);
+ value = resources.getString(Vocabulary.Keys.EntryCount_1, children.length / 2);
+ } catch (ClassNotFoundException e) {
+ recoverableException(Modules.STORAGE, e); // sis-storage module not in the classpath.
+ } catch (ReflectiveOperationException e) {
+ value = e.toString();
+ }
+ nameKey = Vocabulary.Keys.DataFormats;
+ break;
+ }
+ case 10: {
newSection = LOGGING;
if (sections.contains(LOGGING)) {
nameKey = Vocabulary.Keys.Implementation;
@@ -320,7 +345,7 @@ fill: for (int i=0; ; i++) {
}
break;
}
- case 10: {
+ case 11: {
if (sections.contains(LOGGING)) {
nameKey = Vocabulary.Keys.Level;
final Level level = Logging.getLogger("").getLevel(); // Root logger level.
@@ -337,7 +362,7 @@ fill: for (int i=0; ; i++) {
}
break;
}
- case 11: {
+ case 12: {
newSection = PATHS;
if (sections.contains(PATHS)) {
nameKey = Vocabulary.Keys.UserHome;
@@ -345,14 +370,14 @@ fill: for (int i=0; ; i++) {
}
break;
}
- case 12: {
+ case 13: {
if (sections.contains(PATHS)) {
nameKey = Vocabulary.Keys.CurrentDirectory;
value = getProperty("user.dir");
}
break;
}
- case 13: {
+ case 14: {
if (sections.contains(PATHS)) {
nameKey = Vocabulary.Keys.DataDirectory;
try {
@@ -377,28 +402,28 @@ fill: for (int i=0; ; i++) {
}
break;
}
- case 14: {
+ case 15: {
if (sections.contains(PATHS)) {
nameKey = Vocabulary.Keys.DataBase;
value = MetadataServices.getInstance().getInformation("DataSource", locale);
}
break;
}
- case 15: {
+ case 16: {
if (sections.contains(PATHS)) {
nameKey = Vocabulary.Keys.TemporaryFiles;
value = getProperty("java.io.tmpdir");
}
break;
}
- case 16: {
+ case 17: {
if (sections.contains(PATHS)) {
nameKey = Vocabulary.Keys.JavaHome;
value = javaHome = getProperty("java.home");
}
break;
}
- case 17: {
+ case 18: {
newSection = LIBRARIES;
if (sections.contains(LIBRARIES)) {
nameKey = Vocabulary.Keys.JavaExtensions;
@@ -406,7 +431,7 @@ fill: for (int i=0; ; i++) {
}
break;
}
- case 18: {
+ case 19: {
if (sections.contains(LIBRARIES)) {
nameKey = Vocabulary.Keys.Classpath;
value = classpath(getProperty("java.class.path"), false);
@@ -452,8 +477,7 @@ fill: for (int i=0; ; i++) {
* Special case for values of kind Map<File,String>.
* They are extension paths or application class paths.
*/
- @SuppressWarnings("unchecked")
- final Map<File,String> paths = (Map<File,String>) value;
+ final Map<?,?> paths = (Map<?,?>) value;
pathTree: for (int j=0; ; j++) {
TreeTable.Node directory = null;
final String home;
@@ -470,9 +494,9 @@ pathTree: for (int j=0; ; j++) {
continue;
}
final File homeDirectory = home.isEmpty() ? null : new File(home);
- for (final Iterator<Map.Entry<File,String>> it=paths.entrySet().iterator(); it.hasNext();) {
- final Map.Entry<File,String> entry = it.next();
- File file = entry.getKey();
+ for (final Iterator<? extends Map.Entry<?,?>> it=paths.entrySet().iterator(); it.hasNext();) {
+ final Map.Entry<?,?> entry = it.next();
+ File file = (File) entry.getKey();
if (homeDirectory != null) {
file = relativize(homeDirectory, file);
if (file == null) continue;
@@ -481,9 +505,9 @@ pathTree: for (int j=0; ; j++) {
directory = node.newChild();
directory.setValue(NAME, parenthesis(resources.getString(homeKey)));
}
- CharSequence title = entry.getValue();
+ CharSequence title = (CharSequence) entry.getValue();
if (title == null || title.length() == 0) {
- title = parenthesis(resources.getString(entry.getKey().isDirectory() ?
+ title = parenthesis(resources.getString(file.isDirectory() ?
Vocabulary.Keys.Directory : Vocabulary.Keys.Untitled).toLowerCase(locale));
}
TreeTables.nodeForPath(directory, NAME, file).setValue(VALUE_AS_TEXT, title);
@@ -720,7 +744,7 @@ pathTree: for (int j=0; ; j++) {
try {
return country ? locale.getCountry() : locale.getISO3Language();
} catch (MissingResourceException e) {
- Logging.recoverableException(Logging.getLogger(Loggers.LOCALIZATION), About.class, "configuration", e);
+ recoverableException(Loggers.LOCALIZATION, e);
return null;
}
}
@@ -770,4 +794,11 @@ pathTree: for (int j=0; ; j++) {
}
return new File(parent, file.getName());
}
+
+ /**
+ * Logs a recoverable exception that happened (directly or indirectly) in the {@link #configuration()} method.
+ */
+ private static void recoverableException(final String logger, final Exception e) {
+ Logging.recoverableException(Logging.getLogger(logger), About.class, "configuration", e);
+ }
}
Modified: sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/resources/Vocabulary.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/resources/Vocabulary.java?rev=1778501&r1=1778500&r2=1778501&view=diff
==============================================================================
--- sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/resources/Vocabulary.java [UTF-8] (original)
+++ sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/resources/Vocabulary.java [UTF-8] Fri Jan 13 07:41:23 2017
@@ -177,6 +177,11 @@ public final class Vocabulary extends In
public static final short DataDirectory = 24;
/**
+ * Data formats
+ */
+ public static final short DataFormats = 119;
+
+ /**
* Datum
*/
public static final short Datum = 25;
@@ -262,6 +267,11 @@ public final class Vocabulary extends In
public static final short EllipsoidalHeight = 41;
/**
+ * {0} entr{0,choice,0#y|2#ies}
+ */
+ public static final short EntryCount_1 = 121;
+
+ /**
* Geocentric
*/
public static final short Geocentric = 42;
@@ -482,16 +492,31 @@ public final class Vocabulary extends In
public static final short Others = 85;
/**
+ * {0} ({1})
+ */
+ public static final short Parenthesis_2 = 126;
+
+ /**
* Paths
*/
public static final short Paths = 86;
/**
+ * Plug-ins
+ */
+ public static final short Plugins = 120;
+
+ /**
* \u201c{0}\u201d
*/
public static final short Quoted_1 = 87;
/**
+ * Read
+ */
+ public static final short Read = 122;
+
+ /**
* Remarks
*/
public static final short Remarks = 88;
@@ -517,6 +542,11 @@ public final class Vocabulary extends In
public static final short Scale = 92;
/**
+ * {0}/{1}
+ */
+ public static final short SlashSeparatedList_2 = 124;
+
+ /**
* Source
*/
public static final short Source = 93;
@@ -592,6 +622,11 @@ public final class Vocabulary extends In
public static final short Units = 107;
/**
+ * Unknown
+ */
+ public static final short Unknown = 125;
+
+ /**
* Unnamed
*/
public static final short Unnamed = 108;
@@ -645,6 +680,11 @@ public final class Vocabulary extends In
* World
*/
public static final short World = 118;
+
+ /**
+ * Write
+ */
+ public static final short Write = 123;
}
/**
Modified: sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/resources/Vocabulary.properties
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/resources/Vocabulary.properties?rev=1778501&r1=1778500&r2=1778501&view=diff
==============================================================================
--- sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/resources/Vocabulary.properties [ISO-8859-1] (original)
+++ sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/resources/Vocabulary.properties [ISO-8859-1] Fri Jan 13 07:41:23 2017
@@ -38,6 +38,7 @@ CurrentDirectory = Current direct
CycleOmitted = Cycle omitted
DataBase = Database
DataDirectory = Data directory
+DataFormats = Data formats
Datum = Datum
DatumShift = Datum shift
DaylightTime = Daylight time
@@ -55,6 +56,7 @@ DublinJulian = Dublin Julian
Ellipsoid = Ellipsoid
EllipsoidChange = Ellipsoid change
EllipsoidalHeight = Ellipsoidal height
+EntryCount_1 = {0} entr{0,choice,0#y|2#ies}
Geocentric = Geocentric
GeocentricRadius = Geocentric radius
GeocentricConversion = Geocentric conversion
@@ -99,13 +101,17 @@ Optional = Optional
Options = Options
Others = Others
OtherSurface = Other surface
+Parenthesis_2 = {0} ({1})
Paths = Paths
+Plugins = Plug-ins
Quoted_1 = \u201c{0}\u201d
+Read = Read
Remarks = Remarks
RemoteConfiguration = Remote configuration
Root = Root
RootMeanSquare = Root Mean Square
Scale = Scale
+SlashSeparatedList_2 = {0}/{1}
Source = Source
StandardDeviation = Standard deviation
SubsetOf_1 = Subset of {0}
@@ -119,6 +125,7 @@ Transformation = Transformation
TransformationAccuracy = Transformation accuracy
TruncatedJulian = Truncated Julian
Type = Type
+Unknown = Unknown
Unnamed = Unnamed
Untitled = Untitled
UnavailableContent = Unavailable content.
@@ -132,3 +139,4 @@ Versions = Versions
Vertical = Vertical
Warnings = Warnings
World = World
+Write = Write
Modified: sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/resources/Vocabulary_fr.properties
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/resources/Vocabulary_fr.properties?rev=1778501&r1=1778500&r2=1778501&view=diff
==============================================================================
--- sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/resources/Vocabulary_fr.properties [ISO-8859-1] (original)
+++ sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/resources/Vocabulary_fr.properties [ISO-8859-1] Fri Jan 13 07:41:23 2017
@@ -45,6 +45,7 @@ CurrentDirectory = R\u00e9pertoir
CycleOmitted = Cycle omit
DataBase = Base de donn\u00e9es
DataDirectory = R\u00e9pertoire des donn\u00e9es
+DataFormats = Formats de donn\u00e9es
Datum = R\u00e9f\u00e9rentiel
DatumShift = Changement de r\u00e9f\u00e9rentiel
DaylightTime = Heure normale
@@ -62,6 +63,7 @@ DublinJulian = Julien Dublin
Ellipsoid = Ellipso\u00efde
EllipsoidChange = Changement d\u2019ellipso\u00efde
EllipsoidalHeight = Hauteur ellipso\u00efdale
+EntryCount_1 = {0} entr\u00e9e{0,choice,0#|2#s}
Geocentric = G\u00e9ocentrique
GeocentricRadius = Rayon g\u00e9ocentrique
GeocentricConversion = Conversion g\u00e9ocentrique
@@ -106,13 +108,17 @@ Optional = Optionnel
Options = Options
Others = Autres
OtherSurface = Autre surface
+Parenthesis_2 = {0} ({1})
Paths = Chemins
+Plugins = Modules d\u2019extension
Quoted_1 = \u00ab\u202f{0}\u202f\u00bb
+Read = Lecture
Remarks = Remarques
RemoteConfiguration = Configuration distante
Root = Racine
RootMeanSquare = Moyenne quadratique
Scale = \u00c9chelle
+SlashSeparatedList_2 = {0}/{1}
Source = Source
StandardDeviation = \u00c9cart type
SubsetOf_1 = Sous-ensemble de {0}
@@ -126,6 +132,7 @@ Transformation = Transformation
TransformationAccuracy = Pr\u00e9cision de la transformation
TruncatedJulian = Julien tronqu\u00e9
Type = Type
+Unknown = Inconnu
Unnamed = Sans nom
Untitled = Sans titre
UnavailableContent = Contenu non-disponible.
@@ -139,3 +146,4 @@ Versions = Versions
Vertical = Vertical
Warnings = Avertissements
World = Monde
+Write = \u00c9criture
Modified: sis/trunk/storage/sis-earth-observation/src/main/java/org/apache/sis/storage/earthobservation/LandsatStoreProvider.java
URL: http://svn.apache.org/viewvc/sis/trunk/storage/sis-earth-observation/src/main/java/org/apache/sis/storage/earthobservation/LandsatStoreProvider.java?rev=1778501&r1=1778500&r2=1778501&view=diff
==============================================================================
--- sis/trunk/storage/sis-earth-observation/src/main/java/org/apache/sis/storage/earthobservation/LandsatStoreProvider.java [UTF-8] (original)
+++ sis/trunk/storage/sis-earth-observation/src/main/java/org/apache/sis/storage/earthobservation/LandsatStoreProvider.java [UTF-8] Fri Jan 13 07:41:23 2017
@@ -21,6 +21,8 @@ import org.apache.sis.storage.DataStoreP
import org.apache.sis.storage.DataStoreException;
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.wkt.FirstKeywordPeek;
@@ -37,6 +39,7 @@ import org.apache.sis.internal.storage.w
* @version 0.8
* @module
*/
+@Capabilities(Capability.READ)
public class LandsatStoreProvider extends DataStoreProvider {
/**
* The object to use for verifying if the first keyword is the expected one.
@@ -123,6 +126,16 @@ public class LandsatStoreProvider extend
}
/**
+ * Returns a generic name for this data store, used mostly in warnings or error messages.
+ *
+ * @return a short name or abbreviation for the data format.
+ */
+ @Override
+ public String getShortName() {
+ return "Landsat";
+ }
+
+ /**
* Returns {@link ProbeResult#SUPPORTED} if the given storage appears to be supported by {@link LandsatStore}.
* Returning {@code SUPPORTED} from this method does not guarantee that reading or writing will succeed, only
* that there appears to be a reasonable chance of success based on a brief inspection of the storage header.
Modified: sis/trunk/storage/sis-geotiff/src/main/java/org/apache/sis/storage/geotiff/GeoTiffStoreProvider.java
URL: http://svn.apache.org/viewvc/sis/trunk/storage/sis-geotiff/src/main/java/org/apache/sis/storage/geotiff/GeoTiffStoreProvider.java?rev=1778501&r1=1778500&r2=1778501&view=diff
==============================================================================
--- sis/trunk/storage/sis-geotiff/src/main/java/org/apache/sis/storage/geotiff/GeoTiffStoreProvider.java [UTF-8] (original)
+++ sis/trunk/storage/sis-geotiff/src/main/java/org/apache/sis/storage/geotiff/GeoTiffStoreProvider.java [UTF-8] Fri Jan 13 07:41:23 2017
@@ -24,6 +24,8 @@ 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.Capability;
/**
@@ -41,6 +43,7 @@ import org.apache.sis.storage.StorageCon
*
* @see GeoTiffStore
*/
+@Capabilities(Capability.READ)
public class GeoTiffStoreProvider extends DataStoreProvider {
/**
* The MIME type for GeoTIFF files.
@@ -59,6 +62,16 @@ public class GeoTiffStoreProvider extend
}
/**
+ * Returns a generic name for this data store, used mostly in warnings or error messages.
+ *
+ * @return a short name or abbreviation for the data format.
+ */
+ @Override
+ public String getShortName() {
+ return "GeoTIFF";
+ }
+
+ /**
* Returns {@link ProbeResult#SUPPORTED} if the given storage appears to be supported by {@link GeoTiffStore}.
* Returning {@code SUPPORTED} from this method does not guarantee that reading or writing will succeed,
* only that there appears to be a reasonable chance of success based on a brief inspection of the
Modified: sis/trunk/storage/sis-netcdf/src/main/java/org/apache/sis/storage/netcdf/NetcdfStoreProvider.java
URL: http://svn.apache.org/viewvc/sis/trunk/storage/sis-netcdf/src/main/java/org/apache/sis/storage/netcdf/NetcdfStoreProvider.java?rev=1778501&r1=1778500&r2=1778501&view=diff
==============================================================================
--- sis/trunk/storage/sis-netcdf/src/main/java/org/apache/sis/storage/netcdf/NetcdfStoreProvider.java [UTF-8] (original)
+++ sis/trunk/storage/sis-netcdf/src/main/java/org/apache/sis/storage/netcdf/NetcdfStoreProvider.java [UTF-8] Fri Jan 13 07:41:23 2017
@@ -28,6 +28,8 @@ import org.apache.sis.internal.netcdf.De
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.Capability;
import org.apache.sis.internal.system.SystemListener;
import org.apache.sis.internal.system.Modules;
import org.apache.sis.storage.DataStore;
@@ -53,11 +55,12 @@ import org.apache.sis.util.Version;
*
* @author Martin Desruisseaux (Geomatys)
* @since 0.3
- * @version 0.4
+ * @version 0.8
* @module
*
* @see NetcdfStore
*/
+@Capabilities(Capability.READ)
public class NetcdfStoreProvider extends DataStoreProvider {
/**
* The MIME type for NetCDF files.
@@ -113,6 +116,16 @@ public class NetcdfStoreProvider extends
}
/**
+ * Returns a generic name for this data store, used mostly in warnings or error messages.
+ *
+ * @return a short name or abbreviation for the data format.
+ */
+ @Override
+ public String getShortName() {
+ return "NetCDF";
+ }
+
+ /**
* Returns {@link ProbeResult#SUPPORTED} if the given storage appears to be supported by {@link NetcdfStore}.
* Returning {@code SUPPORTED} from this method does not guarantee that reading or writing will succeed,
* only that there appears to be a reasonable chance of success based on a brief inspection of the
Copied: sis/trunk/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/Capability.java (from r1778499, sis/branches/JDK7/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/Capability.java)
URL: http://svn.apache.org/viewvc/sis/trunk/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/Capability.java?p2=sis/trunk/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/Capability.java&p1=sis/branches/JDK7/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/Capability.java&r1=1778499&r2=1778501&rev=1778501&view=diff
==============================================================================
--- sis/branches/JDK7/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/Capability.java [UTF-8] (original)
+++ sis/trunk/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/Capability.java [UTF-8] Fri Jan 13 07:41:23 2017
@@ -21,8 +21,10 @@ import java.util.Collection;
import org.apache.sis.storage.DataStores;
import org.apache.sis.storage.DataStoreProvider;
import org.apache.sis.util.resources.Vocabulary;
-import org.opengis.metadata.citation.Citation;
-import org.opengis.util.InternationalString;
+
+// Branch-dependent imports
+import org.opengis.metadata.distribution.Format;
+import org.apache.sis.util.iso.Types;
/**
@@ -95,30 +97,19 @@ public enum Capability {
* Get a title for the format, followed by the short name between parenthesis
* if it does not repeat the main title.
*/
- final Citation spec = provider.getFormat().getFormatSpecificationCitation();
- String title = title(spec, true).toString(locale);
- final String abbreviation = title(spec, false).toString(locale);
- if (!abbreviation.equals(title)) {
- title = resources.getString(Vocabulary.Keys.Parenthesis_2, title, abbreviation);
+ final Format format = provider.getFormat();
+ String title = Types.toString(format.getSpecification(), locale);
+ final String abbreviation = Types.toString(format.getName(), locale);
+ if (abbreviation != null) {
+ if (title == null) {
+ title = abbreviation;
+ } else if (!abbreviation.equals(title)) {
+ title = resources.getString(Vocabulary.Keys.Parenthesis_2, title, abbreviation);
+ }
}
list[i++] = capabilities;
list[i++] = title;
}
return list;
}
-
- /**
- * Returns the title or alternate title of the given citation, or "untitled" if none.
- *
- * @param preferTitle {@code true} for preferring the title over alternate titles, or {@code false} for the opposite.
- */
- private static InternationalString title(final Citation spec, final boolean preferTitle) {
- final InternationalString title = spec.getTitle();
- if (preferTitle && title != null) return title;
- for (final InternationalString t : spec.getAlternateTitles()) {
- if (t != null) return t;
- }
- if (title != null) return title;
- return Vocabulary.formatInternational(Vocabulary.Keys.Untitled);
- }
}
Modified: sis/trunk/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/csv/StoreProvider.java
URL: http://svn.apache.org/viewvc/sis/trunk/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/csv/StoreProvider.java?rev=1778501&r1=1778500&r2=1778501&view=diff
==============================================================================
--- sis/trunk/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/csv/StoreProvider.java [UTF-8] (original)
+++ sis/trunk/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/csv/StoreProvider.java [UTF-8] Fri Jan 13 07:41:23 2017
@@ -21,6 +21,8 @@ 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.Capability;
+import org.apache.sis.internal.storage.Capabilities;
import org.apache.sis.internal.storage.wkt.FirstKeywordPeek;
@@ -37,6 +39,7 @@ import org.apache.sis.internal.storage.w
* @version 0.8
* @module
*/
+@Capabilities(Capability.READ)
public final class StoreProvider extends DataStoreProvider {
/**
* The object to use for verifying if the first keyword is the expected one.
@@ -99,6 +102,16 @@ public final class StoreProvider extends
}
/**
+ * Returns a generic name for this data store, used mostly in warnings or error messages.
+ *
+ * @return a short name or abbreviation for the data format.
+ */
+ @Override
+ public String getShortName() {
+ return "CSV";
+ }
+
+ /**
* Returns {@link ProbeResult#SUPPORTED} if the given storage appears to be supported by CSV {@link Store}.
* Returning {@code SUPPORTED} from this method does not guarantee that reading or writing will succeed, only
* that there appears to be a reasonable chance of success based on a brief inspection of the storage header.
Modified: sis/trunk/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/wkt/StoreProvider.java
URL: http://svn.apache.org/viewvc/sis/trunk/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/wkt/StoreProvider.java?rev=1778501&r1=1778500&r2=1778501&view=diff
==============================================================================
--- sis/trunk/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/wkt/StoreProvider.java [UTF-8] (original)
+++ sis/trunk/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/wkt/StoreProvider.java [UTF-8] Fri Jan 13 07:41:23 2017
@@ -24,6 +24,8 @@ import org.apache.sis.storage.DataStoreP
import org.apache.sis.storage.DataStoreException;
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.metadata.WKTKeywords;
import org.apache.sis.util.Version;
@@ -36,6 +38,7 @@ import org.apache.sis.util.Version;
* @version 0.8
* @module
*/
+@Capabilities(Capability.READ)
public final class StoreProvider extends DataStoreProvider {
/**
* The {@value} MIME type.
@@ -143,6 +146,16 @@ public final class StoreProvider extends
}
/**
+ * Returns a generic name for this data store, used mostly in warnings or error messages.
+ *
+ * @return a short name or abbreviation for the data format.
+ */
+ @Override
+ public String getShortName() {
+ return "WKT";
+ }
+
+ /**
* Returns {@link ProbeResult#SUPPORTED} if the given storage appears to be supported by WKT {@link Store}.
* Returning {@code SUPPORTED} from this method does not guarantee that reading or writing will succeed,
* only that there appears to be a reasonable chance of success based on a brief inspection of the storage
Modified: sis/trunk/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/xml/AbstractProvider.java
URL: http://svn.apache.org/viewvc/sis/trunk/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/xml/AbstractProvider.java?rev=1778501&r1=1778500&r2=1778501&view=diff
==============================================================================
--- sis/trunk/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/xml/AbstractProvider.java [UTF-8] (original)
+++ sis/trunk/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/xml/AbstractProvider.java [UTF-8] Fri Jan 13 07:41:23 2017
@@ -22,10 +22,10 @@ import java.io.Reader;
import java.io.IOException;
import java.nio.ByteBuffer;
import org.apache.sis.storage.DataStore;
-import org.apache.sis.storage.DataStoreProvider;
import org.apache.sis.storage.DataStoreException;
import org.apache.sis.storage.StorageConnector;
import org.apache.sis.storage.ProbeResult;
+import org.apache.sis.internal.storage.DocumentedStoreProvider;
/**
@@ -38,7 +38,7 @@ import org.apache.sis.storage.ProbeResul
* @version 0.8
* @module
*/
-public abstract class AbstractProvider extends DataStoreProvider {
+public abstract class AbstractProvider extends DocumentedStoreProvider {
/**
* The {@value} MIME type, used only if {@link #probeContent(StorageConnector)} can not determine
* a more accurate type.
@@ -73,9 +73,11 @@ public abstract class AbstractProvider e
* Creates a new provider. Subclasses shall populate the {@link #types} map with a mapping
* from their namespace to the MIME type to declare.
*
+ * @param name the primary key to use for searching in the {@code MD_Format} table, or {@code null} if none.
* @param initialCapacity initial capacity of the hash map to create.
*/
- protected AbstractProvider(final int initialCapacity) {
+ protected AbstractProvider(final String name, final int initialCapacity) {
+ super(name);
types = new HashMap<>(initialCapacity);
}
Modified: sis/trunk/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/xml/MimeTypeDetector.java
URL: http://svn.apache.org/viewvc/sis/trunk/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/xml/MimeTypeDetector.java?rev=1778501&r1=1778500&r2=1778501&view=diff
==============================================================================
--- sis/trunk/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/xml/MimeTypeDetector.java [UTF-8] (original)
+++ sis/trunk/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/xml/MimeTypeDetector.java [UTF-8] Fri Jan 13 07:41:23 2017
@@ -88,7 +88,7 @@ abstract class MimeTypeDetector {
/**
* Adds the given byte in the {@link #buffer}, increasing its capacity if needed.
*/
- private void add(final int c) {
+ private void remember(final int c) {
if (length == buffer.length) {
buffer = Arrays.copyOf(buffer, length*2);
}
@@ -132,7 +132,7 @@ abstract class MimeTypeDetector {
*
* <p>For the purpose of this method, a "space" is considered to be the {@code ' '} character
* and all control characters (character below 32, which include tabulations and line feeds).
- * This is the same criterion than {@link String#trim()}, but is not Unicode spaces.</p>
+ * This is the same criterion than {@link String#trim()}, but does not include Unicode spaces.</p>
*
* @return the first non-space character, or -1 on EOF.
* @throws IOException if an error occurred while reading the bytes or characters.
@@ -151,20 +151,25 @@ abstract class MimeTypeDetector {
*
* @param word the word to search, as US-ASCII characters.
* @param n number of valid characters in {@code word}.
+ * @param c value of {@code afterSpaces(read())}.
* @param separator the {@code ':'} or {@code '='} character.
* @return 1 if a match is found, 0 if no match, or -1 on EOF.
* @throws IOException if an error occurred while reading the bytes or characters.
*/
- private int matches(final byte[] word, final int n, final char separator) throws IOException {
- int c = afterSpaces(read());
- for (int i=0; i<n; i++) {
- if (c != word[i]) {
- return (c >= 0) ? 0 : -1;
+ private int matches(final byte[] word, final int n, int c, final char separator) throws IOException {
+ if (c >= 0) {
+ for (int i=0; i<n; i++) {
+ if (c != word[i]) {
+ return (c >= 0) ? 0 : -1;
+ }
+ c = read();
+ }
+ c = afterSpaces(c);
+ if (c >= 0) {
+ return (c == separator) ? 1 : 0;
}
- c = read();
}
- c = afterSpaces(c);
- return (c == separator) ? 1 : (c >= 0) ? 0 : -1;
+ return -1;
}
/**
@@ -177,8 +182,13 @@ abstract class MimeTypeDetector {
return null;
}
/*
- * At this point, we skipped the "<?xml ...?>" header.
- * Find the first < character, skipping comment (if any).
+ * At this point, we skipped the "<?xml ...?>" header. Skip the "<!-- -->" comments (if any),
+ * then find the first '<' character. For example:
+ *
+ * <?xml version="1.0" encoding="UTF-8"?>
+ * (we are here) \u2192 <!-- Licensed to the Apache Software Foundation (ASF) -->
+ * <gmd:MD_Metadata xmlns:gmd = "http://www.isotc211.org/2005/gmd"/>
+ * (we want to go there) \u2191
*/
int c;
while ((c = readAfter('<')) == '!') {
@@ -194,40 +204,50 @@ abstract class MimeTypeDetector {
}
/*
* At this point, we are after the opening bracket of root element.
- * Skip spaces and read the prefix, which is assumed mandatory.
+ * Skip spaces and read the prefix, which may be absent (we will detect that later).
+ * For example if the line is "<gmd:MD_Metadata \u2026 >", we will remember "gmd" here.
*/
c = afterSpaces(c);
while (c > ' ' && c != ':') {
if (c == '>' || c > MAX_ASCII) {
return null;
}
- add(c);
+ remember(c);
c = read();
}
/*
- * At this point, we got the prefix of the root element. Skip the ':'
- * character and find the "xmlns" attribute following spaces.
+ * At this point, we got what we think is the prefix of the root element. If we find the ':' character,
+ * we consider that this was indeed the prefix (e.g. "gmd" in "<gmd:MD_Metadata \u2026 >"). But if we do not
+ * find the ':' character, then we will consider that the element is in the default namespace, in which
+ * case there is no prefix (length == 0). Exemple: "<MD_Metadata xmlns = \u2026 >"
*/
c = afterSpaces(c);
if (c != ':') {
- return null;
+ length = 0; // XML element in the default namespace: it has no prefix.
+ } else {
+ c = afterSpaces(read());
}
+ /*
+ * Search for "xmlns" keyword, ignoring anything before it. If we find a prefix in the previous step,
+ * we will require that "xmlns" is followed by ":prefix" where "prefix" is the prefix that we found.
+ */
while (true) {
- int m = matches(XMLNS, XMLNS.length, ':');
+ int m = matches(XMLNS, XMLNS.length, c, (length == 0) ? '=' : ':');
if (m != 0) {
if (m < 0) {
- return null;
+ return null; // End of file.
}
- m = matches(buffer, length, '=');
+ if (length == 0) break; // Found match for default namespace.
+ m = matches(buffer, length, afterSpaces(read()), '=');
if (m != 0) {
if (m < 0) {
- return null;
+ return null; // End of file.
}
- break;
+ break; // Found match for prefix.
}
}
// Skip everything up to the next space, and check again.
- while ((c = read()) >= ' ');
+ c = afterSpaces(read());
if (c < 0) return null;
}
/*
@@ -244,7 +264,7 @@ abstract class MimeTypeDetector {
if (c < 0 || c > MAX_ASCII) {
return null;
}
- add(c);
+ remember(c);
c = read();
} while (c != '"');
/*
@@ -258,6 +278,7 @@ abstract class MimeTypeDetector {
* instantiating the {@link ProbeResult}.
*/
final ProbeResult probeContent() throws DataStoreException {
+ boolean isSupported = true;
String mimeType;
try {
mimeType = getMimeType();
@@ -268,8 +289,9 @@ abstract class MimeTypeDetector {
if (insufficientBytes) {
return ProbeResult.INSUFFICIENT_BYTES;
}
+ isSupported = false;
mimeType = StoreProvider.MIME_TYPE;
}
- return new ProbeResult(true, mimeType, null);
+ return new ProbeResult(isSupported, mimeType, null);
}
}
Modified: sis/trunk/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/xml/StoreProvider.java
URL: http://svn.apache.org/viewvc/sis/trunk/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/xml/StoreProvider.java?rev=1778501&r1=1778500&r2=1778501&view=diff
==============================================================================
--- sis/trunk/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/xml/StoreProvider.java [UTF-8] (original)
+++ sis/trunk/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/xml/StoreProvider.java [UTF-8] Fri Jan 13 07:41:23 2017
@@ -20,6 +20,8 @@ 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.Capability;
/**
@@ -30,12 +32,13 @@ import org.apache.sis.storage.StorageCon
* @version 0.8
* @module
*/
+@Capabilities(Capability.READ)
public final class StoreProvider extends AbstractProvider {
/**
* Creates a new provider.
*/
public StoreProvider() {
- super(8);
+ super(null, 8);
types.put(Namespaces.GML, "application/gml+xml");
types.put(Namespaces.GMD, "application/vnd.iso.19139+xml");
types.put(Namespaces.CSW, "application/vnd.ogc.csw_xml");
@@ -43,6 +46,16 @@ public final class StoreProvider extends
}
/**
+ * Returns a generic name for this data store, used mostly in warnings or error messages.
+ *
+ * @return a short name or abbreviation for the data format.
+ */
+ @Override
+ public String getShortName() {
+ return "XML";
+ }
+
+ /**
* Returns a {@link Store} implementation associated with this provider.
*
* @param connector information about the storage (URL, stream, <i>etc</i>).
Modified: sis/trunk/storage/sis-storage/src/main/java/org/apache/sis/storage/DataStoreProvider.java
URL: http://svn.apache.org/viewvc/sis/trunk/storage/sis-storage/src/main/java/org/apache/sis/storage/DataStoreProvider.java?rev=1778501&r1=1778500&r2=1778501&view=diff
==============================================================================
--- sis/trunk/storage/sis-storage/src/main/java/org/apache/sis/storage/DataStoreProvider.java [UTF-8] (original)
+++ sis/trunk/storage/sis-storage/src/main/java/org/apache/sis/storage/DataStoreProvider.java [UTF-8] Fri Jan 13 07:41:23 2017
@@ -16,6 +16,11 @@
*/
package org.apache.sis.storage;
+import org.opengis.metadata.distribution.Format;
+import org.apache.sis.internal.simple.SimpleFormat;
+import org.apache.sis.metadata.iso.citation.DefaultCitation;
+import org.apache.sis.metadata.iso.distribution.DefaultFormat;
+
/**
* Provides information about a specific {@link DataStore} implementation.
@@ -46,7 +51,7 @@ package org.apache.sis.storage;
*
* @author Martin Desruisseaux (Geomatys)
* @since 0.3
- * @version 0.4
+ * @version 0.8
* @module
*/
public abstract class DataStoreProvider {
@@ -57,6 +62,61 @@ public abstract class DataStoreProvider
}
/**
+ * Returns a short name or abbreviation for the data format.
+ * This name is used in some warnings or exception messages.
+ * It may contain any characters, including white spaces
+ * (i.e. this short name is <strong>not</strong> a format identifier).
+ *
+ * <div class="note"><b>Examples:</b>
+ * {@code "CSV"}, {@code "GeoTIFF"}, {@code "GML"}, {@code "GPX"}, {@code "JPEG"}, {@code "JPEG 2000"},
+ * {@code "NetCDF"}, {@code "PNG"}, {@code "Shapefile"}.
+ * </div>
+ *
+ * For a more comprehensive format name, see {@link #getFormat()}.
+ *
+ * @return a short name or abbreviation for the data format.
+ *
+ * @see #getFormat()
+ *
+ * @since 0.8
+ */
+ public abstract String getShortName();
+
+ /**
+ * Returns a description of the data format. The description should contain (if available):
+ *
+ * <ul>
+ * <li>A reference to the {@linkplain DefaultFormat#getFormatSpecificationCitation()
+ * format specification citation}, including:
+ * <ul>
+ * <li>a format specification {@linkplain DefaultCitation#getTitle() title}
+ * (example: <cite>\u201cPNG (Portable Network Graphics) Specification\u201d</cite>),</li>
+ * <li>the format {@linkplain #getShortName() short name} as a citation
+ * {@linkplain DefaultCitation#getAlternateTitles() alternate title}
+ * (example: <cite>\u201cPNG\u201d</cite>),</li>
+ * <li>the format version as the citation {@linkplain DefaultCitation#getEdition() edition},</li>
+ * <li>link to an {@linkplain DefaultCitation#getOnlineResources() online} version of the specification.</li>
+ * </ul>
+ * </li>
+ * <li>The title of the {@linkplain DefaultFormat#getFileDecompressionTechnique() file decompression technique}
+ * used for reading the data.</li>
+ * </ul>
+ *
+ * The default implementation returns a format containing only the value returned by {@link #getShortName()}.
+ * Subclasses are encouraged to override this method for providing a more complete description, if available.
+ *
+ * @return a description of the data format.
+ *
+ * @see #getShortName()
+ * @see DefaultFormat
+ *
+ * @since 0.8
+ */
+ public Format getFormat() {
+ return new SimpleFormat(getShortName());
+ }
+
+ /**
* Indicates if the given storage appears to be supported by the {@code DataStore}s created by this provider.
* The most typical return values are:
*
Modified: sis/trunk/storage/sis-storage/src/main/java/org/apache/sis/storage/DataStoreRegistry.java
URL: http://svn.apache.org/viewvc/sis/trunk/storage/sis-storage/src/main/java/org/apache/sis/storage/DataStoreRegistry.java?rev=1778501&r1=1778500&r2=1778501&view=diff
==============================================================================
--- sis/trunk/storage/sis-storage/src/main/java/org/apache/sis/storage/DataStoreRegistry.java [UTF-8] (original)
+++ sis/trunk/storage/sis-storage/src/main/java/org/apache/sis/storage/DataStoreRegistry.java [UTF-8] Fri Jan 13 07:41:23 2017
@@ -18,10 +18,12 @@ package org.apache.sis.storage;
import java.util.List;
import java.util.LinkedList;
+import java.util.Collection;
import java.util.Iterator;
import java.util.ServiceLoader;
import org.apache.sis.internal.storage.Resources;
import org.apache.sis.internal.system.DefaultFactories;
+import org.apache.sis.internal.util.LazySet;
import org.apache.sis.util.ArgumentChecks;
@@ -71,6 +73,37 @@ final class DataStoreRegistry {
}
/**
+ * Returns the list of data store providers available at this method invocation time.
+ * More providers may be added later if new modules are added on the classpath.
+ *
+ * @return descriptions of available data stores.
+ *
+ * @since 0.8
+ */
+ public Collection<DataStoreProvider> providers() {
+ synchronized (loader) {
+ final Iterator<DataStoreProvider> providers = loader.iterator();
+ return new LazySet<>(new Iterator<DataStoreProvider>() {
+ @Override public boolean hasNext() {
+ synchronized (loader) {
+ return providers.hasNext();
+ }
+ }
+
+ @Override public DataStoreProvider next() {
+ synchronized (loader) {
+ return providers.next();
+ }
+ }
+
+ @Override public void remove() {
+ throw new UnsupportedOperationException();
+ }
+ });
+ }
+ }
+
+ /**
* Returns the MIME type of the storage file format, or {@code null} if unknown or not applicable.
*
* @param storage the input/output object as a URL, file, image input stream, <i>etc.</i>.
Modified: sis/trunk/storage/sis-storage/src/main/java/org/apache/sis/storage/DataStores.java
URL: http://svn.apache.org/viewvc/sis/trunk/storage/sis-storage/src/main/java/org/apache/sis/storage/DataStores.java?rev=1778501&r1=1778500&r2=1778501&view=diff
==============================================================================
--- sis/trunk/storage/sis-storage/src/main/java/org/apache/sis/storage/DataStores.java [UTF-8] (original)
+++ sis/trunk/storage/sis-storage/src/main/java/org/apache/sis/storage/DataStores.java [UTF-8] Fri Jan 13 07:41:23 2017
@@ -16,6 +16,7 @@
*/
package org.apache.sis.storage;
+import java.util.Collection;
import org.apache.sis.util.Static;
import org.apache.sis.internal.system.Modules;
import org.apache.sis.internal.system.SystemListener;
@@ -28,7 +29,7 @@ import org.apache.sis.internal.system.Sy
*
* @author Martin Desruisseaux (Geomatys)
* @since 0.4
- * @version 0.4
+ * @version 0.8
* @module
*/
public final class DataStores extends Static {
@@ -78,6 +79,18 @@ public final class DataStores extends St
}
/**
+ * Returns the list of data store providers available at this method invocation time.
+ * More providers may be added later if new modules are added on the classpath.
+ *
+ * @return descriptions of available data stores.
+ *
+ * @since 0.8
+ */
+ public static Collection<DataStoreProvider> providers() {
+ return registry().providers();
+ }
+
+ /**
* Returns the MIME type of the storage file format, or {@code null} if unknown or not applicable.
*
* @param storage the input/output object as a URL, file, image input stream, <i>etc.</i>.
Modified: sis/trunk/storage/sis-storage/src/test/java/org/apache/sis/internal/storage/xml/MimeTypeDetectorTest.java
URL: http://svn.apache.org/viewvc/sis/trunk/storage/sis-storage/src/test/java/org/apache/sis/internal/storage/xml/MimeTypeDetectorTest.java?rev=1778501&r1=1778500&r2=1778501&view=diff
==============================================================================
--- sis/trunk/storage/sis-storage/src/test/java/org/apache/sis/internal/storage/xml/MimeTypeDetectorTest.java [UTF-8] (original)
+++ sis/trunk/storage/sis-storage/src/test/java/org/apache/sis/internal/storage/xml/MimeTypeDetectorTest.java [UTF-8] Fri Jan 13 07:41:23 2017
@@ -25,6 +25,7 @@ import org.apache.sis.test.TestCase;
import org.junit.Test;
import static java.util.Collections.singletonMap;
+import org.apache.sis.xml.Namespaces;
import static org.apache.sis.xml.Namespaces.GMD;
import static org.junit.Assert.*;
@@ -34,11 +35,23 @@ import static org.junit.Assert.*;
*
* @author Martin Desruisseaux (Geomatys)
* @since 0.4
- * @version 0.4
+ * @version 0.8
* @module
*/
public final strictfp class MimeTypeDetectorTest extends TestCase {
/**
+ * Tests a pseudo-XML file in the default namespace, read from a hard-coded string.
+ *
+ * @throws IOException if an error occurred while reading the bytes or characters.
+ */
+ @Test
+ public void testInDefaultNamespace() throws IOException {
+ testFromString("<?xml version=\"1.0\" standalone=\"yes\"?>\n" +
+ "<MD_Metadata xmlns:xsi=\"" + Namespaces.XSI + "\"" +
+ " xmlns=\"" + Namespaces.GMD + "\"/>\n");
+ }
+
+ /**
* Tests a XML file in the {@value org.apache.sis.xml.Namespaces#GMD} namespace
* read from a hard-coded string.
*
@@ -46,7 +59,14 @@ public final strictfp class MimeTypeDete
*/
@Test
public void testGMDFromString() throws IOException {
- final StringReader in = new StringReader(StoreTest.XML);
+ testFromString(StoreTest.XML);
+ }
+
+ /**
+ * Implementation of test methods using a hard-coded XML string as a source.
+ */
+ private static void testFromString(final String xml) throws IOException {
+ final StringReader in = new StringReader(xml);
assertEquals('<', in.read());
assertEquals('?', in.read());
final MimeTypeDetector detector = new MimeTypeDetector(singletonMap(GMD, "application/vnd.iso.19139+xml")) {
@@ -67,16 +87,17 @@ public final strictfp class MimeTypeDete
@Test
@DependsOnMethod("testGMDFromString")
public void testGMDFromInputStream() throws IOException {
- final InputStream in = DefaultExtentTest.getResource("Extent.xml").openStream();
- assertEquals('<', in.read());
- assertEquals('?', in.read());
- final MimeTypeDetector detector = new MimeTypeDetector(singletonMap(GMD, "application/vnd.iso.19139+xml")) {
- @Override int read() throws IOException {
- return in.read();
- }
- };
- final String type = detector.getMimeType();
- in.close();
+ final String type;
+ try (InputStream in = DefaultExtentTest.getResource("Extent.xml").openStream()) {
+ assertEquals('<', in.read());
+ assertEquals('?', in.read());
+ final MimeTypeDetector detector = new MimeTypeDetector(singletonMap(GMD, "application/vnd.iso.19139+xml")) {
+ @Override int read() throws IOException {
+ return in.read();
+ }
+ };
+ type = detector.getMimeType();
+ }
assertEquals("application/vnd.iso.19139+xml", type);
}
}
Modified: sis/trunk/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/storage/gpx/Metadata.java
URL: http://svn.apache.org/viewvc/sis/trunk/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/storage/gpx/Metadata.java?rev=1778501&r1=1778500&r2=1778501&view=diff
==============================================================================
--- sis/trunk/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/storage/gpx/Metadata.java [UTF-8] (original)
+++ sis/trunk/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/storage/gpx/Metadata.java [UTF-8] Fri Jan 13 07:41:23 2017
@@ -172,6 +172,13 @@ public final class Metadata extends Simp
public Bounds bounds;
/**
+ * The format returned by {@link #getResourceFormats()}, created when first needed.
+ *
+ * @see #getResourceFormats()
+ */
+ private Format format;
+
+ /**
* Creates an initially empty metadata object.
*/
public Metadata() {
@@ -369,6 +376,7 @@ public final class Metadata extends Simp
*/
@Override
public Collection<ContentInformation> getContentInfo() {
+ final Store store = this.store;
return (store != null) ? store.types.metadata : super.getContentInfo();
}
@@ -379,12 +387,16 @@ public final class Metadata extends Simp
* @return description of the format of the resource(s).
*/
@Override
- public synchronized Collection<Format> getResourceFormats() {
+ public Collection<Format> getResourceFormats() {
+ final Store store = this.store;
if (store != null) {
- final Format f = store.getFormat();
- if (f != null) {
- return Collections.singletonList(f);
+ Format f;
+ synchronized (store) {
+ if ((f = format) == null) {
+ format = f = store.getFormat();
+ }
}
+ return Collections.singletonList(f);
}
return super.getResourceFormats();
}
Modified: sis/trunk/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/storage/gpx/Store.java
URL: http://svn.apache.org/viewvc/sis/trunk/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/storage/gpx/Store.java?rev=1778501&r1=1778500&r2=1778501&view=diff
==============================================================================
--- sis/trunk/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/storage/gpx/Store.java [UTF-8] (original)
+++ sis/trunk/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/storage/gpx/Store.java [UTF-8] Fri Jan 13 07:41:23 2017
@@ -28,8 +28,9 @@ import org.apache.sis.internal.storage.x
import org.apache.sis.util.collection.BackingStoreException;
import org.apache.sis.util.ArgumentChecks;
import org.apache.sis.util.Version;
-import org.apache.sis.metadata.sql.MetadataSource;
-import org.apache.sis.metadata.sql.MetadataStoreException;
+import org.apache.sis.util.iso.SimpleInternationalString;
+import org.apache.sis.metadata.iso.citation.DefaultCitation;
+import org.apache.sis.metadata.iso.distribution.DefaultFormat;
// Branch-dependent imports
import org.apache.sis.internal.jdk8.Stream;
@@ -97,25 +98,23 @@ public final class Store extends StaxDat
}
/**
- * Returns the short name (abbreviation) of the format being read or written.
+ * Returns a more complete description of the GPX format.
+ * The format will be part of the metadata returned by {@link #getMetadata()}.
*
- * @return {@code "GPX"}.
- */
- @Override
- public String getFormatName() {
- return "GPX";
- }
-
- /**
- * Returns a more complete description of the GPX format, or {@code null} if not available.
+ * @see StoreProvider#getFormat()
+ * @see org.apache.sis.internal.storage.gpx.Metadata#getResourceFormats()
*/
final Format getFormat() {
- try {
- return MetadataSource.getProvided().lookup(Format.class, "GPX");
- } catch (MetadataStoreException e) {
- listeners.warning(null, e);
+ assert Thread.holdsLock(this);
+ Format format = ((StoreProvider) provider).getFormat(listeners);
+ if (version != null) {
+ final DefaultFormat df = new DefaultFormat(format);
+ final DefaultCitation citation = new DefaultCitation(df.getFormatSpecificationCitation());
+ citation.setEdition(new SimpleInternationalString(version.toString()));
+ df.setFormatSpecificationCitation(citation);
+ format = df;
}
- return null;
+ return format;
}
/**
Modified: sis/trunk/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/storage/gpx/StoreProvider.java
URL: http://svn.apache.org/viewvc/sis/trunk/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/storage/gpx/StoreProvider.java?rev=1778501&r1=1778500&r2=1778501&view=diff
==============================================================================
--- sis/trunk/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/storage/gpx/StoreProvider.java [UTF-8] (original)
+++ sis/trunk/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/storage/gpx/StoreProvider.java [UTF-8] Fri Jan 13 07:41:23 2017
@@ -21,6 +21,8 @@ import javax.xml.bind.JAXBException;
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.xml.stream.StaxDataStoreProvider;
@@ -34,12 +36,13 @@ import org.apache.sis.internal.storage.x
* @version 0.8
* @module
*/
+@Capabilities({Capability.READ, Capability.WRITE})
public final class StoreProvider extends StaxDataStoreProvider {
/**
* Creates a new GPX store provider.
*/
public StoreProvider() {
- super(4);
+ super("GPX", 4);
types.put(Tags.NAMESPACE_V10, "application/gpx+xml");
types.put(Tags.NAMESPACE_V11, "application/gpx+xml");
}
Modified: sis/trunk/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/storage/xml/stream/StaxDataStore.java
URL: http://svn.apache.org/viewvc/sis/trunk/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/storage/xml/stream/StaxDataStore.java?rev=1778501&r1=1778500&r2=1778501&view=diff
==============================================================================
--- sis/trunk/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/storage/xml/stream/StaxDataStore.java [UTF-8] (original)
+++ sis/trunk/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/storage/xml/stream/StaxDataStore.java [UTF-8] Fri Jan 13 07:41:23 2017
@@ -355,8 +355,12 @@ public abstract class StaxDataStore exte
* This is used for error messages.
*
* @return short name of format being read or written.
+ *
+ * @see StaxDataStoreProvider#getShortName()
*/
- public abstract String getFormatName();
+ public final String getFormatName() {
+ return provider.getShortName();
+ }
/**
* Returns the factory for StAX readers. The same instance is returned for all {@code StaxDataStore} lifetime.
Modified: sis/trunk/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/storage/xml/stream/StaxDataStoreProvider.java
URL: http://svn.apache.org/viewvc/sis/trunk/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/storage/xml/stream/StaxDataStoreProvider.java?rev=1778501&r1=1778500&r2=1778501&view=diff
==============================================================================
--- sis/trunk/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/storage/xml/stream/StaxDataStoreProvider.java [UTF-8] (original)
+++ sis/trunk/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/storage/xml/stream/StaxDataStoreProvider.java [UTF-8] Fri Jan 13 07:41:23 2017
@@ -43,10 +43,11 @@ public abstract class StaxDataStoreProvi
* Creates a new provider. Subclasses shall populate the {@link #types} map with a mapping
* from their namespace to the MIME type to declare.
*
+ * @param name the primary key to use for searching in the {@code MD_Format} table, or {@code null} if none.
* @param initialCapacity initial capacity of the hash map to create.
*/
- protected StaxDataStoreProvider(final int initialCapacity) {
- super(initialCapacity);
+ protected StaxDataStoreProvider(final String name, final int initialCapacity) {
+ super(name, initialCapacity);
}
/**