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 2016/08/29 14:43:18 UTC
svn commit: r1758238 - in /sis/branches/JDK8:
core/sis-referencing/src/test/java/org/apache/sis/referencing/report/
storage/sis-earth-observation/src/main/java/org/apache/sis/storage/earthobservation/
storage/sis-earth-observation/src/main/resources/ s...
Author: desruisseaux
Date: Mon Aug 29 14:43:18 2016
New Revision: 1758238
URL: http://svn.apache.org/viewvc?rev=1758238&view=rev
Log:
Provide LandsatReader service behind a LandsatStore facade.
This require an implementation of LandsatReaderProvider, for which we reuse code that were designed for WKT data store.
Added:
sis/branches/JDK8/storage/sis-earth-observation/src/main/java/org/apache/sis/storage/earthobservation/LandsatStore.java (with props)
sis/branches/JDK8/storage/sis-earth-observation/src/main/java/org/apache/sis/storage/earthobservation/LandsatStoreProvider.java (with props)
sis/branches/JDK8/storage/sis-earth-observation/src/main/resources/
sis/branches/JDK8/storage/sis-earth-observation/src/main/resources/META-INF/
sis/branches/JDK8/storage/sis-earth-observation/src/main/resources/META-INF/services/
sis/branches/JDK8/storage/sis-earth-observation/src/main/resources/META-INF/services/org.apache.sis.storage.DataStoreProvider
- copied, changed from r1758185, sis/branches/JDK8/storage/sis-storage/src/main/resources/META-INF/services/org.apache.sis.storage.DataStoreProvider
sis/branches/JDK8/storage/sis-earth-observation/src/test/java/org/apache/sis/storage/earthobservation/LandsatStoreProviderTest.java (with props)
sis/branches/JDK8/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/wkt/FirstKeywordPeek.java
- copied, changed from r1758185, sis/branches/JDK8/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/wkt/StoreProvider.java
Modified:
sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/report/CoordinateReferenceSystems.java
sis/branches/JDK8/storage/sis-earth-observation/src/main/java/org/apache/sis/storage/earthobservation/LandsatReader.java
sis/branches/JDK8/storage/sis-earth-observation/src/test/java/org/apache/sis/test/suite/EarthObservationTestSuite.java
sis/branches/JDK8/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/wkt/Store.java
sis/branches/JDK8/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/wkt/StoreProvider.java
sis/branches/JDK8/storage/sis-storage/src/test/java/org/apache/sis/internal/storage/wkt/StoreProviderTest.java
Modified: sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/report/CoordinateReferenceSystems.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/report/CoordinateReferenceSystems.java?rev=1758238&r1=1758237&r2=1758238&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/report/CoordinateReferenceSystems.java [UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/report/CoordinateReferenceSystems.java [UTF-8] Mon Aug 29 14:43:18 2016
@@ -455,6 +455,7 @@ public final strictfp class CoordinateRe
properties.setProperty("FACTORY.NAME", "EPSG");
properties.setProperty("FACTORY.VERSION", "8.9");
properties.setProperty("FACTORY.VERSION.SUFFIX", ", together with other sources");
+ properties.setProperty("PRODUCT.VERSION.SUFFIX", " (provided that <a href=\"http://sis.apache.org/epsg.html\">a connection to an EPSG database exists</a>)");
properties.setProperty("DESCRIPTION", "<p><b>Notation:</b></p>\n" +
"<ul>\n" +
" <li>The " + YX_ORDER + " symbol in front of authority codes (${PERCENT.ANNOTATED} of them) identifies" +
Modified: sis/branches/JDK8/storage/sis-earth-observation/src/main/java/org/apache/sis/storage/earthobservation/LandsatReader.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/storage/sis-earth-observation/src/main/java/org/apache/sis/storage/earthobservation/LandsatReader.java?rev=1758238&r1=1758237&r2=1758238&view=diff
==============================================================================
--- sis/branches/JDK8/storage/sis-earth-observation/src/main/java/org/apache/sis/storage/earthobservation/LandsatReader.java [UTF-8] (original)
+++ sis/branches/JDK8/storage/sis-earth-observation/src/main/java/org/apache/sis/storage/earthobservation/LandsatReader.java [UTF-8] Mon Aug 29 14:43:18 2016
@@ -84,12 +84,12 @@ import org.opengis.metadata.content.Attr
* <a href="./doc-files/LandsatMetadata.html">./doc-files/LandsatMetadata.html</a> accordingly.</p>
*
* @author Thi Phuong Hao Nguyen (VNSC)
- * @author Remi Marechal (Geomatys)
+ * @author R�mi Mar�chal (Geomatys)
* @since 0.8
* @version 0.8
* @module
*/
-public class LandsatReader {
+final class LandsatReader {
/**
* The description of all bands that can be included in a Landsat coverage.
* This description is hard-coded and shared by all metadata instances.
Added: sis/branches/JDK8/storage/sis-earth-observation/src/main/java/org/apache/sis/storage/earthobservation/LandsatStore.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/storage/sis-earth-observation/src/main/java/org/apache/sis/storage/earthobservation/LandsatStore.java?rev=1758238&view=auto
==============================================================================
--- sis/branches/JDK8/storage/sis-earth-observation/src/main/java/org/apache/sis/storage/earthobservation/LandsatStore.java (added)
+++ sis/branches/JDK8/storage/sis-earth-observation/src/main/java/org/apache/sis/storage/earthobservation/LandsatStore.java [UTF-8] Mon Aug 29 14:43:18 2016
@@ -0,0 +1,146 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.sis.storage.earthobservation;
+
+import java.io.Reader;
+import java.io.BufferedReader;
+import java.io.LineNumberReader;
+import java.io.IOException;
+import org.opengis.metadata.Metadata;
+import org.apache.sis.metadata.ModifiableMetadata;
+import org.apache.sis.storage.DataStore;
+import org.apache.sis.storage.DataStoreException;
+import org.apache.sis.storage.StorageConnector;
+import org.apache.sis.util.resources.Errors;
+import org.apache.sis.util.ArgumentChecks;
+import org.apache.sis.util.Debug;
+
+
+/**
+ * Parses Landsat metadata as {@linkplain DefaultMetadata ISO-19115 Metadata} object.
+ * Landsat data are distributed as a collection of TIFF files, together with a single
+ * text file like below:
+ *
+ * {@preformat text
+ * GROUP = L1_METADATA_FILE
+ * GROUP = METADATA_FILE_INFO
+ * ORIGIN = "Image courtesy of the U.S. Geological Survey"
+ * REQUEST_ID = "0501403126384_00011"
+ * LANDSAT_SCENE_ID = "LC81230522014071LGN00"
+ * FILE_DATE = 2014-03-12T06:06:35Z
+ * STATION_ID = "LGN"
+ * PROCESSING_SOFTWARE_VERSION = "LPGS_2.3.0"
+ * END_GROUP = METADATA_FILE_INFO
+ * GROUP = PRODUCT_METADATA
+ * DATA_TYPE = "L1T"
+ * ELEVATION_SOURCE = "GLS2000"
+ * OUTPUT_FORMAT = "GEOTIFF"
+ * SPACECRAFT_ID = "LANDSAT_8"
+ * SENSOR_ID = "OLI_TIRS"
+ * etc...
+ * }
+ *
+ * This class reads the content from the given input until the first occurrence of the {@code END} keyword.
+ * Lines beginning with the {@code #} character (ignoring spaces) are treated as comment lines and ignored.
+ *
+ * @author Thi Phuong Hao Nguyen (VNSC)
+ * @author Martin Desruisseaux (Geomatys)
+ * @since 0.8
+ * @version 0.8
+ * @module
+ */
+public class LandsatStore extends DataStore {
+ /**
+ * The file name.
+ */
+ private final String name;
+
+ /**
+ * The reader, or {@code null} if closed.
+ */
+ private Reader source;
+
+ /**
+ * The object returned by {@link #getMetadata()}, created when first needed and cached.
+ */
+ private Metadata metadata;
+
+ /**
+ * Creates a new Landsat store from the given file, URL, stream or character reader.
+ * This constructor invokes {@link StorageConnector#closeAllExcept(Object)},
+ * keeping open only the needed resource.
+ *
+ * @param connector information about the storage (URL, stream, reader instance, <i>etc</i>).
+ * @throws DataStoreException if an error occurred while opening the Landsat file.
+ */
+ public LandsatStore(final StorageConnector connector) throws DataStoreException {
+ ArgumentChecks.ensureNonNull("connector", connector);
+ name = connector.getStorageName();
+ source = connector.getStorageAs(Reader.class);
+ connector.closeAllExcept(source);
+ if (source == null) {
+ throw new DataStoreException(Errors.format(Errors.Keys.CanNotOpen_1, name));
+ }
+ }
+
+ /**
+ * Returns information about the dataset as a whole. The returned metadata object can contain information
+ * such as the spatiotemporal extent of the dataset, contact information about the creator or distributor,
+ * data quality, usage constraints and more.
+ *
+ * @return information about the dataset.
+ * @throws DataStoreException if an error occurred while reading the data.
+ */
+ @Override
+ public Metadata getMetadata() throws DataStoreException {
+ if (metadata == null && source != null) try {
+ try (BufferedReader reader = (source instanceof BufferedReader) ? (BufferedReader) source : new LineNumberReader(source)) {
+ source = null; // Will be closed at the end of this try-catch block.
+ final LandsatReader parser = new LandsatReader(reader);
+ metadata = parser.read();
+ if (metadata instanceof ModifiableMetadata) {
+ ((ModifiableMetadata) metadata).freeze();
+ }
+ }
+ } catch (IOException e) {
+ throw new DataStoreException(e);
+ }
+ return metadata;
+ }
+
+ /**
+ * Closes this Landsat store and releases any underlying resources.
+ *
+ * @throws DataStoreException if an error occurred while closing the Landsat file.
+ */
+ @Override
+ public void close() throws DataStoreException {
+ metadata = null;
+ }
+
+ /**
+ * Returns a string representation of this Landsat store for debugging purpose.
+ * The content of the string returned by this method may change in any future SIS version.
+ *
+ * @return a string representation of this datastore for debugging purpose.
+ */
+ @Debug
+ @Override
+ public String toString() {
+ return getClass().getSimpleName() + '[' + name + ']';
+ }
+}
Propchange: sis/branches/JDK8/storage/sis-earth-observation/src/main/java/org/apache/sis/storage/earthobservation/LandsatStore.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: sis/branches/JDK8/storage/sis-earth-observation/src/main/java/org/apache/sis/storage/earthobservation/LandsatStore.java
------------------------------------------------------------------------------
svn:mime-type = text/plain;charset=UTF-8
Added: 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=1758238&view=auto
==============================================================================
--- sis/branches/JDK8/storage/sis-earth-observation/src/main/java/org/apache/sis/storage/earthobservation/LandsatStoreProvider.java (added)
+++ sis/branches/JDK8/storage/sis-earth-observation/src/main/java/org/apache/sis/storage/earthobservation/LandsatStoreProvider.java [UTF-8] Mon Aug 29 14:43:18 2016
@@ -0,0 +1,149 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.sis.storage.earthobservation;
+
+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.wkt.FirstKeywordPeek;
+
+
+/**
+ * The provider of {@link LandsatStore} instances. Given a {@link StorageConnector} input,
+ * this class tries to instantiate a {@code LandsatStore}.
+ *
+ * <div class="section">Thread safety</div>
+ * The same {@code LandsatStoreProvider} instance can be safely used by many threads without synchronization on
+ * the part of the caller. However the {@link LandsatStore} instances created by this factory are not thread-safe.
+ *
+ * @author Martin Desruisseaux (Geomatys)
+ * @since 0.8
+ * @version 0.8
+ * @module
+ */
+public class LandsatStoreProvider extends DataStoreProvider {
+ /**
+ * The object to use for verifying if the first keyword is the expected one.
+ */
+ private static final class Peek extends FirstKeywordPeek {
+ /**
+ * The expected keyword after spaces removal.
+ */
+ private static final String KEYWORD = "GROUP=L1_METADATA_FILE";
+
+ /**
+ * The part in process of being parsed:
+ * <ul>
+ * <li>{@code KEY} (0) for the {@code "GROUP"} keyword,</li>
+ * <li>{@code SEPARATOR} (1) for the {@code '='} symbol,</li>
+ * <li>{@code VALUE} (2) for the {@code "L1_METADATA_FILE"} value.</li>
+ * </ul>
+ */
+ private static final int KEY = 0, SEPARATOR = 1, VALUE = 2;
+
+ /**
+ * {@value #SEPARATOR} if parsing the characters after the {@code =} symbol,
+ * {@value #VALUE} if parsing the non-white characters after {@code =}.
+ */
+ private int part = KEY;
+
+ /**
+ * Creates a new instance.
+ */
+ Peek() {
+ super(KEYWORD.length());
+ }
+
+ /**
+ * Returns {@code ACCEPT} if the given character is valid for a keyword.
+ */
+ @Override
+ protected int isKeywordChar(final int c) {
+ final int s = super.isKeywordChar(c);
+ if (s == REJECT) {
+ if (c >= '0' && c <= '9' && part == VALUE) {
+ return ACCEPT;
+ }
+ switch (c) {
+ case '\t':
+ case ' ' : if (part < VALUE) { return IGNORE;} else break;
+ case '=' : if (part == KEY) {part = SEPARATOR; return ACCEPT;} else break;
+ }
+ } else {
+ if (part == SEPARATOR) {
+ part = VALUE;
+ }
+ }
+ return s;
+ }
+
+ /**
+ * Returns {@code true} if the given first non-white character after the keyword is one of the expected
+ * characters. This implementation expects the first letter of the {@code "GROUP"} keyword for the first
+ * sub-group (unless there is a comment line between them).
+ */
+ @Override
+ protected boolean isPostKeyword(final int c) {
+ return c == 'G' || c == 'g' || c == COMMENT;
+ }
+
+ /**
+ * Returns the value to be returned by {@link LandsatStoreProvider#probeContent(StorageConnector)}
+ * for the given keyword.
+ */
+ @Override
+ protected ProbeResult forKeyword(final char[] keyword, final int length) {
+ if (length == maxLength && KEYWORD.equalsIgnoreCase(new String(keyword))) {
+ return ProbeResult.SUPPORTED;
+ }
+ return ProbeResult.UNSUPPORTED_STORAGE;
+ }
+ }
+
+ /**
+ * Creates a new provider.
+ */
+ public LandsatStoreProvider() {
+ }
+
+ /**
+ * 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.
+ *
+ * @return {@link ProbeResult#SUPPORTED} if the given storage seems to be readable as a Landsat file.
+ * @throws DataStoreException if an I/O or SQL error occurred.
+ */
+ @Override
+ public ProbeResult probeContent(final StorageConnector connector) throws DataStoreException {
+ return new Peek().probeContent(connector);
+ }
+
+ /**
+ * Returns a {@link LandsatStore} implementation associated with this provider.
+ *
+ * @param connector information about the storage (URL, stream, <i>etc</i>).
+ * @return a data store implementation associated with this provider for the given storage.
+ * @throws DataStoreException if an error occurred while creating the data store instance.
+ */
+ @Override
+ public DataStore open(final StorageConnector connector) throws DataStoreException {
+ return new LandsatStore(connector);
+ }
+}
Propchange: sis/branches/JDK8/storage/sis-earth-observation/src/main/java/org/apache/sis/storage/earthobservation/LandsatStoreProvider.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: sis/branches/JDK8/storage/sis-earth-observation/src/main/java/org/apache/sis/storage/earthobservation/LandsatStoreProvider.java
------------------------------------------------------------------------------
svn:mime-type = text/plain;charset=UTF-8
Copied: sis/branches/JDK8/storage/sis-earth-observation/src/main/resources/META-INF/services/org.apache.sis.storage.DataStoreProvider (from r1758185, sis/branches/JDK8/storage/sis-storage/src/main/resources/META-INF/services/org.apache.sis.storage.DataStoreProvider)
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/storage/sis-earth-observation/src/main/resources/META-INF/services/org.apache.sis.storage.DataStoreProvider?p2=sis/branches/JDK8/storage/sis-earth-observation/src/main/resources/META-INF/services/org.apache.sis.storage.DataStoreProvider&p1=sis/branches/JDK8/storage/sis-storage/src/main/resources/META-INF/services/org.apache.sis.storage.DataStoreProvider&r1=1758185&r2=1758238&rev=1758238&view=diff
==============================================================================
--- sis/branches/JDK8/storage/sis-storage/src/main/resources/META-INF/services/org.apache.sis.storage.DataStoreProvider [UTF-8] (original)
+++ sis/branches/JDK8/storage/sis-earth-observation/src/main/resources/META-INF/services/org.apache.sis.storage.DataStoreProvider [UTF-8] Mon Aug 29 14:43:18 2016
@@ -1,2 +1 @@
-org.apache.sis.internal.storage.xml.StoreProvider
-org.apache.sis.internal.storage.wkt.StoreProvider
+org.apache.sis.storage.earthobservation.LandsatStoreProvider
Added: sis/branches/JDK8/storage/sis-earth-observation/src/test/java/org/apache/sis/storage/earthobservation/LandsatStoreProviderTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/storage/sis-earth-observation/src/test/java/org/apache/sis/storage/earthobservation/LandsatStoreProviderTest.java?rev=1758238&view=auto
==============================================================================
--- sis/branches/JDK8/storage/sis-earth-observation/src/test/java/org/apache/sis/storage/earthobservation/LandsatStoreProviderTest.java (added)
+++ sis/branches/JDK8/storage/sis-earth-observation/src/test/java/org/apache/sis/storage/earthobservation/LandsatStoreProviderTest.java [UTF-8] Mon Aug 29 14:43:18 2016
@@ -0,0 +1,53 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.sis.storage.earthobservation;
+
+import org.apache.sis.setup.OptionKey;
+import org.apache.sis.storage.ProbeResult;
+import org.apache.sis.storage.StorageConnector;
+import org.apache.sis.storage.DataStoreException;
+import org.apache.sis.test.TestCase;
+import org.junit.Test;
+
+import static org.junit.Assert.*;
+
+// Branch-dependent imports
+import java.nio.charset.StandardCharsets;
+
+
+/**
+ * Tests {@link LandsatStoreProvider}.
+ *
+ * @author Martin Desruisseaux (Geomatys)
+ * @since 0.8
+ * @version 0.8
+ * @module
+ */
+public final strictfp class LandsatStoreProviderTest extends TestCase {
+ /**
+ * Tests {@link LandsatStoreProvider#probeContent(StorageConnector)} method.
+ *
+ * @throws DataStoreException if en error occurred while reading the test file.
+ */
+ @Test
+ public void testProbeContentFromReader() throws DataStoreException {
+ final StorageConnector connector = new StorageConnector(LandsatReaderTest.class.getResourceAsStream("LandsatTest.txt"));
+ connector.setOption(OptionKey.ENCODING, StandardCharsets.UTF_8);
+ final LandsatStoreProvider provider = new LandsatStoreProvider();
+ assertEquals(ProbeResult.SUPPORTED, provider.probeContent(connector));
+ }
+}
Propchange: sis/branches/JDK8/storage/sis-earth-observation/src/test/java/org/apache/sis/storage/earthobservation/LandsatStoreProviderTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: sis/branches/JDK8/storage/sis-earth-observation/src/test/java/org/apache/sis/storage/earthobservation/LandsatStoreProviderTest.java
------------------------------------------------------------------------------
svn:mime-type = text/plain;charset=UTF-8
Modified: sis/branches/JDK8/storage/sis-earth-observation/src/test/java/org/apache/sis/test/suite/EarthObservationTestSuite.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/storage/sis-earth-observation/src/test/java/org/apache/sis/test/suite/EarthObservationTestSuite.java?rev=1758238&r1=1758237&r2=1758238&view=diff
==============================================================================
--- sis/branches/JDK8/storage/sis-earth-observation/src/test/java/org/apache/sis/test/suite/EarthObservationTestSuite.java [UTF-8] (original)
+++ sis/branches/JDK8/storage/sis-earth-observation/src/test/java/org/apache/sis/test/suite/EarthObservationTestSuite.java [UTF-8] Mon Aug 29 14:43:18 2016
@@ -31,7 +31,8 @@ import org.junit.BeforeClass;
* @module
*/
@Suite.SuiteClasses({
- org.apache.sis.storage.earthobservation.LandsatReaderTest.class
+ org.apache.sis.storage.earthobservation.LandsatReaderTest.class,
+ org.apache.sis.storage.earthobservation.LandsatStoreProviderTest.class
})
public final strictfp class EarthObservationTestSuite extends TestSuite {
/**
Copied: sis/branches/JDK8/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/wkt/FirstKeywordPeek.java (from r1758185, 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/FirstKeywordPeek.java?p2=sis/branches/JDK8/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/wkt/FirstKeywordPeek.java&p1=sis/branches/JDK8/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/wkt/StoreProvider.java&r1=1758185&r2=1758238&rev=1758238&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/FirstKeywordPeek.java [UTF-8] Mon Aug 29 14:43:18 2016
@@ -16,81 +16,51 @@
*/
package org.apache.sis.internal.storage.wkt;
-import java.util.HashSet;
-import java.util.Set;
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.metadata.WKTKeywords;
-import org.apache.sis.util.Version;
+import org.apache.sis.util.Characters;
/**
- * The provider of WKT {@link Store} instances.
+ * Inspects the type of a text file based on the first keyword.
*
* @author Martin Desruisseaux (Geomatys)
- * @since 0.7
- * @version 0.7
+ * @since 0.8
+ * @version 0.8
* @module
*/
-public class StoreProvider extends DataStoreProvider {
+public abstract class FirstKeywordPeek {
/**
- * The {@value} MIME type.
+ * Return values for the {@link #isKeywordChar(int)} method.
*/
- public static final String MIME_TYPE = "application/wkt";
+ protected static final int REJECT = 0, ACCEPT = 1, IGNORE = 2;
/**
- * The read-ahead limit when reading the WKT from a {@link Reader}.
+ * The read-ahead limit when reading a text from a {@link Reader}.
*/
static final int READ_AHEAD_LIMIT = 2048;
/**
- * Length of the shortest WKT keyword.
+ * The comment character to ignore.
*/
- static final int MIN_LENGTH = 6;
+ protected static final char COMMENT = '#';
/**
- * Length of the longest WKT keyword.
+ * Length of the longest keyword.
*/
- static final int MAX_LENGTH = 14;
-
- /**
- * The set of WKT keywords.
- */
- private static final Set<String> KEYWORDS = keywords();
- static Set<String> keywords() {
- final Set<String> s = new HashSet<>(22);
- s.add(WKTKeywords.GeodeticCRS);
- s.add(WKTKeywords.GeodCRS);
- s.add(WKTKeywords.GeogCS);
- s.add(WKTKeywords.GeocCS);
- s.add(WKTKeywords.VerticalCRS);
- s.add(WKTKeywords.VertCRS);
- s.add(WKTKeywords.Vert_CS);
- s.add(WKTKeywords.TimeCRS);
- s.add(WKTKeywords.ImageCRS);
- s.add(WKTKeywords.EngineeringCRS);
- s.add(WKTKeywords.EngCRS);
- s.add(WKTKeywords.Local_CS);
- s.add(WKTKeywords.CompoundCRS);
- s.add(WKTKeywords.Compd_CS);
- s.add(WKTKeywords.ProjectedCRS);
- s.add(WKTKeywords.ProjCRS);
- s.add(WKTKeywords.ProjCS);
- s.add(WKTKeywords.Fitted_CS);
- s.add(WKTKeywords.BoundCRS);
- return s;
- }
+ protected final int maxLength;
/**
* Creates a new provider.
+ *
+ * @param maxLength length of the longest keyword.
*/
- public StoreProvider() {
+ public FirstKeywordPeek(final int maxLength) {
+ this.maxLength = maxLength;
}
/**
@@ -115,60 +85,91 @@ public class StoreProvider extends DataS
}
/**
- * Returns {@code true} if the given character is valid for a WKT keyword.
+ * Moves the buffer or stream until the character after the next end of line character.
*/
- private static boolean isValidChar(final int c) {
- return (c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z') || (c == '_');
+ private static void toEndOfLine(final ByteBuffer buffer, final Reader reader) throws IOException {
+ int c;
+ do {
+ if (buffer != null) {
+ if (!buffer.hasRemaining()) break;
+ c = (char) buffer.get();
+ } else {
+ c = reader.read();
+ if (c < 0) break;
+ }
+ } while (!Characters.isLineOrParagraphSeparator(c));
}
/**
- * Returns {@link ProbeResult#SUPPORTED} if the given storage appears to be supported by WKT {@link Store}.
+ * Returns {@code true} if the given character is valid for a keyword.
+ *
+ * @param c the character to test.
+ * @return {@link #ACCEPT} if the given character should be accepted,
+ * {@link #REJECT} if the character is not valid for the keyword, or
+ * {@link #IGNORE} if the character should be accepted but not stored.
+ */
+ protected int isKeywordChar(final int c) {
+ return (c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z') || (c == '_') ? ACCEPT : REJECT;
+ }
+
+ /**
+ * Returns {@link ProbeResult#SUPPORTED} if the given storage appears to begin with an expected keyword
* 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.
*
- * @return {@link ProbeResult#SUPPORTED} if the given storage seems to be readable as a WKT file.
+ * @param connector information about the storage (URL, stream, JDBC connection, <i>etc</i>).
+ * @return {@link ProbeResult#SUPPORTED} if the given storage seems to be readable.
* @throws DataStoreException if an I/O or SQL error occurred.
*/
- @Override
@SuppressWarnings("null")
- public ProbeResult probeContent(final StorageConnector storage) throws DataStoreException {
+ public final ProbeResult probeContent(final StorageConnector connector) throws DataStoreException {
char[] keyword = null;
int pos = 0;
try {
- final ByteBuffer buffer = storage.getStorageAs(ByteBuffer.class);
+ final ByteBuffer buffer = connector.getStorageAs(ByteBuffer.class);
final Reader reader;
if (buffer != null) {
buffer.mark();
reader = null;
} else {
// User gave us explicitely a Reader (e.g. a StringReader wrapping a String instance).
- reader = storage.getStorageAs(Reader.class);
+ reader = connector.getStorageAs(Reader.class);
if (reader == null) {
return ProbeResult.UNSUPPORTED_STORAGE;
}
reader.mark(READ_AHEAD_LIMIT);
}
/*
- * Ignore leading spaces if any, then get a keyword no longer than LENGTH.
+ * Ignore leading spaces and comments if any, then get a keyword no longer than 'maxLength'.
* That keyword shall be followed by [ or (, ignoring whitespaces.
*/
- int c = nextAfterSpaces(buffer, reader);
- if (isValidChar(c)) {
- keyword = new char[MAX_LENGTH];
+ int c;
+ while ((c = nextAfterSpaces(buffer, reader)) == COMMENT) {
+ toEndOfLine(buffer, reader);
+ }
+ int s;
+ if ((s = isKeywordChar(c)) >= ACCEPT) {
+ keyword = new char[maxLength];
do {
- if (pos >= MAX_LENGTH) {
- keyword = null; // Keyword too long.
- break;
+ if (s == ACCEPT) {
+ if (pos >= keyword.length) {
+ pos = 0; // Keyword too long.
+ break;
+ }
+ keyword[pos++] = (char) c;
}
- keyword[pos++] = (char) c;
c = (buffer == null) ? reader.read() : buffer.hasRemaining() ? (char) buffer.get() : -1;
- } while (isValidChar(c));
+ } while ((s = isKeywordChar(c)) >= ACCEPT);
+ /*
+ * At this point we finished to read and store the keyword.
+ * Verify if the keyword is followed by a character that indicate a keyword end.
+ */
if (Character.isWhitespace(c)) {
c = nextAfterSpaces(buffer, reader);
}
- if (c != '[' && c != '(') {
- keyword = null;
+ if (!isPostKeyword(c)) {
+ pos = 0;
}
}
if (buffer != null) {
@@ -182,41 +183,23 @@ public class StoreProvider extends DataS
} catch (IOException e) {
throw new DataStoreException(e);
}
- /*
- * At this point we got the first keyword. Change the case to match the one used in the KEYWORDS map,
- * then verify if the keyword that we found is one of the known WKT keywords. Keywords with the "CRS"
- * suffix are WKT 2 while keywords with the "CS" suffix are WKT 1.
- */
- final int length = pos;
- if (pos >= MIN_LENGTH) {
- int version = 1;
- keyword[ 0] &= ~0x20; // Make upper-case (valid only for characters in the a-z range).
- keyword[--pos] &= ~0x20;
- if ((keyword[--pos] &= ~0x20) == 'R') {
- keyword[--pos] &= ~0x20; // Make "CRS" suffix in upper case (otherwise, was "CS" suffix)
- version = 2;
- }
- while (--pos != 0) {
- if (keyword[pos] != '_') {
- keyword[pos] |= 0x20; // Make lower-case.
- }
- }
- if (KEYWORDS.contains(String.valueOf(keyword, 0, length))) {
- return new ProbeResult(true, MIME_TYPE, Version.valueOf(version));
- }
- }
- return ProbeResult.UNSUPPORTED_STORAGE;
+ return forKeyword(keyword, pos);
}
/**
- * Returns a {@link Store} implementation associated with this provider.
+ * Returns {@code true} if the given first non-white character after the keywordis one of the expected characters.
*
- * @param storage Information about the storage (URL, stream, <i>etc</i>).
- * @return A data store implementation associated with this provider for the given storage.
- * @throws DataStoreException If an error occurred while creating the data store instance.
- */
- @Override
- public DataStore open(final StorageConnector storage) throws DataStoreException {
- return new Store(storage);
- }
+ * @param c the first non-white character after the keyword, or -1 if we reached the end of stream.
+ * @return {@code true} if the given character is one of the expected post-keyword characters.
+ */
+ protected abstract boolean isPostKeyword(int c);
+
+ /**
+ * Returns the value to be returned by {@link #probeContent(StorageConnector)} for the given keyword.
+ *
+ * @param keyword the first keyword found in the input. May be {@code null} if {@code length} is zero.
+ * @param length number of valid characters in {@code keyword}.
+ * @return {@link ProbeResult#SUPPORTED} if the given storage seems to be readable.
+ */
+ protected abstract ProbeResult forKeyword(final char[] keyword, final int length);
}
Modified: sis/branches/JDK8/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/wkt/Store.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/wkt/Store.java?rev=1758238&r1=1758237&r2=1758238&view=diff
==============================================================================
--- sis/branches/JDK8/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/wkt/Store.java [UTF-8] (original)
+++ sis/branches/JDK8/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/wkt/Store.java [UTF-8] Mon Aug 29 14:43:18 2016
@@ -73,8 +73,8 @@ final class Store extends DataStore {
/**
* Creates a new WKT store from the given file, URL or stream.
*
- * @param connector Information about the storage (URL, stream, <i>etc</i>).
- * @throws DataStoreException If an error occurred while opening the stream.
+ * @param connector information about the storage (URL, stream, <i>etc</i>).
+ * @throws DataStoreException if an error occurred while opening the stream.
*/
public Store(final StorageConnector connector) throws DataStoreException {
objects = new ArrayList<>();
@@ -98,7 +98,7 @@ final class Store extends DataStore {
source = null; // Cleared first in case of error.
final String wkt;
try {
- char[] buffer = new char[StoreProvider.READ_AHEAD_LIMIT];
+ char[] buffer = new char[FirstKeywordPeek.READ_AHEAD_LIMIT];
int length = 0;
int n;
while ((n = in.read(buffer, length, buffer.length - length)) >= 0) {
@@ -136,7 +136,7 @@ final class Store extends DataStore {
* The current implementation retains only instances of {@link ReferenceSystem}
* and ignore other cases.
*
- * @return The metadata associated to the parsed object, or {@code null} if none.
+ * @return the metadata associated to the parsed object, or {@code null} if none.
* @throws DataStoreException if an error occurred during the parsing process.
*/
@Override
@@ -158,7 +158,7 @@ final class Store extends DataStore {
/**
* Closes this data store and releases any underlying resources.
*
- * @throws DataStoreException If an error occurred while closing this data store.
+ * @throws DataStoreException if an error occurred while closing this data store.
*/
@Override
public void close() throws DataStoreException {
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=1758238&r1=1758237&r2=1758238&view=diff
==============================================================================
--- sis/branches/JDK8/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/wkt/StoreProvider.java [UTF-8] (original)
+++ sis/branches/JDK8/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/wkt/StoreProvider.java [UTF-8] Mon Aug 29 14:43:18 2016
@@ -16,11 +16,9 @@
*/
package org.apache.sis.internal.storage.wkt;
+import java.util.Collections;
import java.util.HashSet;
import java.util.Set;
-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;
@@ -35,7 +33,7 @@ import org.apache.sis.util.Version;
*
* @author Martin Desruisseaux (Geomatys)
* @since 0.7
- * @version 0.7
+ * @version 0.8
* @module
*/
public class StoreProvider extends DataStoreProvider {
@@ -45,80 +43,103 @@ public class StoreProvider extends DataS
public static final String MIME_TYPE = "application/wkt";
/**
- * The read-ahead limit when reading the WKT from a {@link Reader}.
+ * The object to use for verifying if the first keyword is a WKT one.
+ * This object contains the set of recognized WKT keywords.
*/
- static final int READ_AHEAD_LIMIT = 2048;
+ static final class Peek extends FirstKeywordPeek {
+ /**
+ * The unique instance.
+ */
+ static final Peek INSTANCE = new Peek();
- /**
- * Length of the shortest WKT keyword.
- */
- static final int MIN_LENGTH = 6;
+ /**
+ * Length of the shortest keyword.
+ */
+ static final int MIN_LENGTH = 6;
- /**
- * Length of the longest WKT keyword.
- */
- static final int MAX_LENGTH = 14;
+ /**
+ * The set of WKT keywords.
+ */
+ private final Set<String> keywords;
- /**
- * The set of WKT keywords.
- */
- private static final Set<String> KEYWORDS = keywords();
- static Set<String> keywords() {
- final Set<String> s = new HashSet<>(22);
- s.add(WKTKeywords.GeodeticCRS);
- s.add(WKTKeywords.GeodCRS);
- s.add(WKTKeywords.GeogCS);
- s.add(WKTKeywords.GeocCS);
- s.add(WKTKeywords.VerticalCRS);
- s.add(WKTKeywords.VertCRS);
- s.add(WKTKeywords.Vert_CS);
- s.add(WKTKeywords.TimeCRS);
- s.add(WKTKeywords.ImageCRS);
- s.add(WKTKeywords.EngineeringCRS);
- s.add(WKTKeywords.EngCRS);
- s.add(WKTKeywords.Local_CS);
- s.add(WKTKeywords.CompoundCRS);
- s.add(WKTKeywords.Compd_CS);
- s.add(WKTKeywords.ProjectedCRS);
- s.add(WKTKeywords.ProjCRS);
- s.add(WKTKeywords.ProjCS);
- s.add(WKTKeywords.Fitted_CS);
- s.add(WKTKeywords.BoundCRS);
- return s;
- }
+ /**
+ * Creates the unique instance.
+ */
+ private Peek() {
+ super(14);
+ final Set<String> s = new HashSet<>(22);
+ s.add(WKTKeywords.GeodeticCRS);
+ s.add(WKTKeywords.GeodCRS);
+ s.add(WKTKeywords.GeogCS);
+ s.add(WKTKeywords.GeocCS);
+ s.add(WKTKeywords.VerticalCRS);
+ s.add(WKTKeywords.VertCRS);
+ s.add(WKTKeywords.Vert_CS);
+ s.add(WKTKeywords.TimeCRS);
+ s.add(WKTKeywords.ImageCRS);
+ s.add(WKTKeywords.EngineeringCRS);
+ s.add(WKTKeywords.EngCRS);
+ s.add(WKTKeywords.Local_CS);
+ s.add(WKTKeywords.CompoundCRS);
+ s.add(WKTKeywords.Compd_CS);
+ s.add(WKTKeywords.ProjectedCRS);
+ s.add(WKTKeywords.ProjCRS);
+ s.add(WKTKeywords.ProjCS);
+ s.add(WKTKeywords.Fitted_CS);
+ s.add(WKTKeywords.BoundCRS);
+ keywords = s;
+ }
- /**
- * Creates a new provider.
- */
- public StoreProvider() {
- }
+ /**
+ * Returns the keywords for test purpose.
+ */
+ final Set<String> keywords() {
+ return Collections.unmodifiableSet(keywords);
+ }
- /**
- * Returns the next character which is not a white space, or -1 if the end of stream is reached.
- * Exactly one of {@code buffer} and {@code reader} shall be non-null.
- */
- private static int nextAfterSpaces(final ByteBuffer buffer, final Reader reader) throws IOException {
- if (buffer != null) {
- while (buffer.hasRemaining()) {
- final char c = (char) buffer.get();
- if (!Character.isWhitespace(c)) {
- return c;
+ /**
+ * Returns {@code true} if the given first non-white character after the keyword
+ * is one of the expected characters.
+ */
+ @Override
+ protected boolean isPostKeyword(final int c) {
+ return c == '[' || c == '(';
+ }
+
+ /**
+ * Returns the value to be returned by {@link StoreProvider#probeContent(StorageConnector)}
+ * for the given WKT keyword. This method changes the case to match the one used in the keywords map,
+ * then verify if the keyword that we found is one of the known WKT keywords. Keywords with the "CRS"
+ * suffix are WKT 2 while keywords with the "CS" suffix are WKT 1.
+ */
+ @Override
+ protected ProbeResult forKeyword(final char[] keyword, final int length) {
+ if (length >= MIN_LENGTH) {
+ int pos = length;
+ int version = 1;
+ keyword[ 0] &= ~0x20; // Make upper-case (valid only for characters in the a-z range).
+ keyword[--pos] &= ~0x20;
+ if ((keyword[--pos] &= ~0x20) == 'R') {
+ keyword[--pos] &= ~0x20; // Make "CRS" suffix in upper case (otherwise, was "CS" suffix)
+ version = 2;
+ }
+ while (--pos != 0) {
+ if (keyword[pos] != '_') {
+ keyword[pos] |= 0x20; // Make lower-case.
+ }
+ }
+ if (keywords.contains(String.valueOf(keyword, 0, length))) {
+ return new ProbeResult(true, MIME_TYPE, Version.valueOf(version));
}
}
- return -1;
- }
- int c;
- while ((c = reader.read()) >= 0) {
- if (!Character.isWhitespace(c)) break;
+ return ProbeResult.UNSUPPORTED_STORAGE;
}
- return c;
}
/**
- * Returns {@code true} if the given character is valid for a WKT keyword.
+ * Creates a new provider.
*/
- private static boolean isValidChar(final int c) {
- return (c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z') || (c == '_');
+ public StoreProvider() {
}
/**
@@ -131,92 +152,19 @@ public class StoreProvider extends DataS
* @throws DataStoreException if an I/O or SQL error occurred.
*/
@Override
- @SuppressWarnings("null")
- public ProbeResult probeContent(final StorageConnector storage) throws DataStoreException {
- char[] keyword = null;
- int pos = 0;
- try {
- final ByteBuffer buffer = storage.getStorageAs(ByteBuffer.class);
- final Reader reader;
- if (buffer != null) {
- buffer.mark();
- reader = null;
- } else {
- // User gave us explicitely a Reader (e.g. a StringReader wrapping a String instance).
- reader = storage.getStorageAs(Reader.class);
- if (reader == null) {
- return ProbeResult.UNSUPPORTED_STORAGE;
- }
- reader.mark(READ_AHEAD_LIMIT);
- }
- /*
- * Ignore leading spaces if any, then get a keyword no longer than LENGTH.
- * That keyword shall be followed by [ or (, ignoring whitespaces.
- */
- int c = nextAfterSpaces(buffer, reader);
- if (isValidChar(c)) {
- keyword = new char[MAX_LENGTH];
- do {
- if (pos >= MAX_LENGTH) {
- keyword = null; // Keyword too long.
- break;
- }
- keyword[pos++] = (char) c;
- c = (buffer == null) ? reader.read() : buffer.hasRemaining() ? (char) buffer.get() : -1;
- } while (isValidChar(c));
- if (Character.isWhitespace(c)) {
- c = nextAfterSpaces(buffer, reader);
- }
- if (c != '[' && c != '(') {
- keyword = null;
- }
- }
- if (buffer != null) {
- buffer.reset();
- } else {
- reader.reset();
- }
- if (c < 0) {
- return ProbeResult.INSUFFICIENT_BYTES;
- }
- } catch (IOException e) {
- throw new DataStoreException(e);
- }
- /*
- * At this point we got the first keyword. Change the case to match the one used in the KEYWORDS map,
- * then verify if the keyword that we found is one of the known WKT keywords. Keywords with the "CRS"
- * suffix are WKT 2 while keywords with the "CS" suffix are WKT 1.
- */
- final int length = pos;
- if (pos >= MIN_LENGTH) {
- int version = 1;
- keyword[ 0] &= ~0x20; // Make upper-case (valid only for characters in the a-z range).
- keyword[--pos] &= ~0x20;
- if ((keyword[--pos] &= ~0x20) == 'R') {
- keyword[--pos] &= ~0x20; // Make "CRS" suffix in upper case (otherwise, was "CS" suffix)
- version = 2;
- }
- while (--pos != 0) {
- if (keyword[pos] != '_') {
- keyword[pos] |= 0x20; // Make lower-case.
- }
- }
- if (KEYWORDS.contains(String.valueOf(keyword, 0, length))) {
- return new ProbeResult(true, MIME_TYPE, Version.valueOf(version));
- }
- }
- return ProbeResult.UNSUPPORTED_STORAGE;
+ public ProbeResult probeContent(final StorageConnector connector) throws DataStoreException {
+ return Peek.INSTANCE.probeContent(connector);
}
/**
* Returns a {@link Store} implementation associated with this provider.
*
- * @param storage Information about the storage (URL, stream, <i>etc</i>).
- * @return A data store implementation associated with this provider for the given storage.
- * @throws DataStoreException If an error occurred while creating the data store instance.
+ * @param connector information about the storage (URL, stream, <i>etc</i>).
+ * @return a data store implementation associated with this provider for the given storage.
+ * @throws DataStoreException if an error occurred while creating the data store instance.
*/
@Override
- public DataStore open(final StorageConnector storage) throws DataStoreException {
- return new Store(storage);
+ public DataStore open(final StorageConnector connector) throws DataStoreException {
+ return new Store(connector);
}
}
Modified: sis/branches/JDK8/storage/sis-storage/src/test/java/org/apache/sis/internal/storage/wkt/StoreProviderTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/storage/sis-storage/src/test/java/org/apache/sis/internal/storage/wkt/StoreProviderTest.java?rev=1758238&r1=1758237&r2=1758238&view=diff
==============================================================================
--- sis/branches/JDK8/storage/sis-storage/src/test/java/org/apache/sis/internal/storage/wkt/StoreProviderTest.java [UTF-8] (original)
+++ sis/branches/JDK8/storage/sis-storage/src/test/java/org/apache/sis/internal/storage/wkt/StoreProviderTest.java [UTF-8] Mon Aug 29 14:43:18 2016
@@ -32,7 +32,7 @@ import static org.junit.Assert.*;
*
* @author Martin Desruisseaux (Geomatys)
* @since 0.7
- * @version 0.7
+ * @version 0.8
* @module
*/
@DependsOn(org.apache.sis.storage.StorageConnectorTest.class)
@@ -45,13 +45,13 @@ public final strictfp class StoreProvide
public void testKeywordsMap() {
int min = Integer.MAX_VALUE;
int max = Integer.MIN_VALUE;
- for (final String keyword : StoreProvider.keywords()) {
+ for (final String keyword : StoreProvider.Peek.INSTANCE.keywords()) {
final int length = keyword.length();
if (length < min) min = length;
if (length > max) max = length;
}
- assertEquals("MIN_LENGTH", min, StoreProvider.MIN_LENGTH);
- assertEquals("MAX_LENGTH", max, StoreProvider.MAX_LENGTH);
+ assertEquals("MIN_LENGTH", min, StoreProvider.Peek.MIN_LENGTH);
+ assertEquals("MAX_LENGTH", max, StoreProvider.Peek.INSTANCE.maxLength);
}
/**