This is an automated email from the ASF dual-hosted git repository. desruisseaux pushed a commit to branch geoapi-4.0 in repository https://gitbox.apache.org/repos/asf/sis.git
commit 434774279e276bc8c501b38d542b0e1140e89084 Author: Martin Desruisseaux <martin.desruisse...@geomatys.com> AuthorDate: Fri Sep 24 14:08:34 2021 +0200 Move Landsat store implementation from "earthobservation" to "landsat" package. --- .../sis/storage/earthobservation/LandsatStore.java | 247 +-------------------- .../earthobservation/LandsatStoreProvider.java | 183 +-------------- .../sis/storage/earthobservation/package-info.java | 7 +- .../LandsatResource.java => landsat/Band.java} | 12 +- .../BandGroup.java} | 36 +-- .../BandGroupName.java} | 6 +- .../LandsatBand.java => landsat/BandName.java} | 30 +-- .../LandsatStore.java | 28 +-- .../LandsatStoreProvider.java | 4 +- .../MetadataReader.java} | 48 ++-- .../doc-files/MetadataMapping.html} | 2 +- .../package-info.java | 26 +-- .../org.apache.sis.storage.DataStoreProvider | 2 +- .../LandsatStoreProviderTest.java | 4 +- .../MetadataReaderTest.java} | 16 +- .../sis/test/suite/EarthObservationTestSuite.java | 4 +- .../{earthobservation => landsat}/LandsatTest.txt | 0 .../apache/sis/storage/geotiff/GeoTiffStore.java | 2 +- 18 files changed, 120 insertions(+), 537 deletions(-) diff --git a/storage/sis-earth-observation/src/main/java/org/apache/sis/storage/earthobservation/LandsatStore.java b/storage/sis-earth-observation/src/main/java/org/apache/sis/storage/earthobservation/LandsatStore.java index 11f8b87..7d82b5e 100644 --- a/storage/sis-earth-observation/src/main/java/org/apache/sis/storage/earthobservation/LandsatStore.java +++ b/storage/sis-earth-observation/src/main/java/org/apache/sis/storage/earthobservation/LandsatStore.java @@ -16,38 +16,9 @@ */ package org.apache.sis.storage.earthobservation; -import java.util.Map; -import java.util.List; -import java.util.Optional; -import java.io.Reader; -import java.io.BufferedReader; -import java.io.LineNumberReader; -import java.io.IOException; -import java.net.URI; -import java.nio.charset.Charset; -import java.nio.file.Path; -import java.nio.file.Files; -import java.nio.file.StandardOpenOption; -import org.opengis.util.NameSpace; -import org.opengis.util.GenericName; -import org.opengis.util.NameFactory; -import org.opengis.util.FactoryException; -import org.opengis.metadata.Metadata; -import org.opengis.parameter.ParameterValueGroup; -import org.apache.sis.storage.Aggregate; -import org.apache.sis.storage.DataStore; import org.apache.sis.storage.DataStoreException; -import org.apache.sis.storage.DataStoreClosedException; -import org.apache.sis.storage.DataStoreReferencingException; -import org.apache.sis.storage.UnsupportedStorageException; import org.apache.sis.storage.StorageConnector; -import org.apache.sis.storage.event.StoreEvent; -import org.apache.sis.storage.event.StoreListener; -import org.apache.sis.storage.event.WarningEvent; -import org.apache.sis.internal.storage.URIDataStore; -import org.apache.sis.internal.system.DefaultFactories; -import org.apache.sis.internal.util.UnmodifiableArrayList; -import org.apache.sis.setup.OptionKey; +import org.apache.sis.storage.landsat.LandsatStoreProvider; /** @@ -82,39 +53,11 @@ import org.apache.sis.setup.OptionKey; * @version 1.1 * @since 0.8 * @module + * + * @deprecated Moved to the {@link org.apache.sis.storage.landsat} package. */ -public class LandsatStore extends DataStore implements Aggregate { - /** - * The reader, or {@code null} if closed. - */ - private Reader source; - - /** - * The root directory where this file is located, or {@code null} if unknown. - */ - final Path directory; - - /** - * The {@link LandsatStoreProvider#LOCATION} parameter value, or {@code null} if none. - */ - private final URI location; - - /** - * The object returned by {@link #getMetadata()}, created when first needed and cached. - */ - private Metadata metadata; - - /** - * The identifier, cached when first requested. - */ - private GenericName identifier; - - /** - * The array of aggregates for each Landsat band group, or {@code null} if not yet created. - * This array is created together with {@linkplain #metadata} and is unmodifiable. - */ - private LandsatAggregate[] components; - +@Deprecated +public class LandsatStore extends org.apache.sis.storage.landsat.LandsatStore { /** * Creates a new Landsat store from the given file, URL, stream or character reader. * This constructor invokes {@link StorageConnector#closeAllExcept(Object)}, @@ -126,185 +69,5 @@ public class LandsatStore extends DataStore implements Aggregate { */ public LandsatStore(final LandsatStoreProvider provider, final StorageConnector connector) throws DataStoreException { super(provider, connector); - Path path = connector.getStorageAs(Path.class); - location = connector.getStorageAs(URI.class); - source = connector.getStorageAs(Reader.class); - connector.closeAllExcept(source); - if (path != null) { - if (source != null) { - path = path.getParent(); // If the source has been opened, then the path is a file. - } else try { - final Path file = LandsatStoreProvider.getMetadataFile(path); - if (file != null) { - final Charset encoding = connector.getOption(OptionKey.ENCODING); - if (encoding != null) { - source = Files.newBufferedReader(file, encoding); - } else { - source = Files.newBufferedReader(file); - } - } - } catch (IOException e) { - throw new DataStoreException(e); - } - } - directory = path; - if (source == null) { - throw new UnsupportedStorageException(super.getLocale(), LandsatStoreProvider.NAME, - connector.getStorage(), connector.getOption(OptionKey.OPEN_OPTIONS)); - } - } - - /** - * Returns the name of the directory that contains this data set. - * The directory may not exist, for example if the data are read from a ZIP file. - * The returned name can be used in user interfaces or in error messages. - */ - @Override - public final String getDisplayName() { - return (directory != null) ? directory.getFileName().toString() : super.getDisplayName(); - } - - /** - * Returns the parameters used to open this Landsat data store. - * The parameters are described by {@link LandsatStoreProvider#getOpenParameters()} and contains at least - * a parameter named {@value org.apache.sis.storage.DataStoreProvider#LOCATION} with a {@link URI} value. - * The return value may be empty if the storage input can not be described by a URI - * (for example a Landsat file reading directly from a {@link java.nio.channels.ReadableByteChannel}). - * - * @return parameters used for opening this data store. - * - * @since 0.8 - */ - @Override - public Optional<ParameterValueGroup> getOpenParameters() { - return Optional.ofNullable(URIDataStore.parameters(provider, location)); - } - - /** - * Returns the value associated to {@code LANDSAT_SCENE_ID} in the Landsat metadata file. - * This value is fetched from - * <code>{@linkplain #getMetadata()}/identificationInfo/citation/identifier</code>. - * - * @return the identifier fetched from metadata, or {@code null} if none. - * @throws DataStoreException if an error occurred while reading the metadata. - * - * @since 1.0 - */ - @Override - public synchronized Optional<GenericName> getIdentifier() throws DataStoreException { - if (identifier == null) { - identifier = super.getIdentifier().orElse(null); - } - return Optional.ofNullable(identifier); - } - - /** - * Parses the main Landsat text file. - * Also creates the array of components, but without loading GeoTIFF data yet. - */ - private void loadMetadata() throws DataStoreException { - if (source == null) { - throw new DataStoreClosedException(getLocale(), LandsatStoreProvider.NAME, StandardOpenOption.READ); - } - final String name = getDisplayName(); - final NameFactory factory = DefaultFactories.forBuildin(NameFactory.class); - final NameSpace scope = (name != null) ? factory.createNameSpace(factory.createLocalName(null, name), null) : null; - final LandsatResource[] resources; - int count = 0; - try (BufferedReader reader = (source instanceof BufferedReader) ? (BufferedReader) source : new LineNumberReader(source)) { - source = null; // Will be closed at the end of this try-finally block. - final LandsatReader parser = new LandsatReader(this, getDisplayName(), listeners); - parser.read(reader); - metadata = parser.getMetadata(); - /* - * Create the array of components. The resource identifier is the band name. - * The namespace of each identifier is the name of the data set directory. - */ - resources = new LandsatResource[parser.bands.size()]; - for (final Map.Entry<LandsatBand,LandsatResource> entry : parser.bands.entrySet()) { - final LandsatResource component = entry.getValue(); - if (component.filename != null) { - component.identifier = factory.createLocalName(scope, entry.getKey().name()); - resources[count++] = component; - } - } - } catch (IOException e) { - throw new DataStoreException(e); - } catch (FactoryException e) { - throw new DataStoreReferencingException(e); - } - components = LandsatAggregate.group(listeners, resources, count); - for (final LandsatAggregate c : components) { - c.identifier = factory.createLocalName(scope, c.group.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 metadata. - */ - @Override - public synchronized Metadata getMetadata() throws DataStoreException { - if (metadata == null) { - loadMetadata(); - } - return metadata; - } - - /** - * Returns the resources for each group of Landsat bands. - * - * @return all group of bands that are components of this aggregate. Never {@code null}. - * @throws DataStoreException if an error occurred while fetching the components. - * - * @since 1.1 - */ - @Override - public synchronized List<Aggregate> components() throws DataStoreException { - if (components == null) { - loadMetadata(); - } - return UnmodifiableArrayList.wrap(components); - } - - /** - * Registers a listener to notify when the specified kind of event occurs in this data store. - * The current implementation of this data store can emit only {@link WarningEvent}s; - * any listener specified for another kind of events will be ignored. - */ - @Override - public <T extends StoreEvent> void addListener(Class<T> eventType, StoreListener<? super T> listener) { - // If an argument is null, we let the parent class throws (indirectly) NullArgumentException. - if (listener == null || eventType == null || eventType.isAssignableFrom(WarningEvent.class)) { - super.addListener(eventType, listener); - } - } - - /** - * Closes this Landsat store and releases any underlying resources. - * - * @throws DataStoreException if an error occurred while closing the Landsat file. - */ - @Override - public synchronized void close() throws DataStoreException { - metadata = null; - DataStoreException error = null; - for (final LandsatResource band : LandsatAggregate.bands(components)) { - try { - band.closeDataStore(); - } catch (DataStoreException e) { - if (error == null) { - error = e; - } else { - error.addSuppressed(e); - } - } - } - components = null; - if (error != null) throw error; } } diff --git a/storage/sis-earth-observation/src/main/java/org/apache/sis/storage/earthobservation/LandsatStoreProvider.java b/storage/sis-earth-observation/src/main/java/org/apache/sis/storage/earthobservation/LandsatStoreProvider.java index 05b131a..6b34933 100644 --- a/storage/sis-earth-observation/src/main/java/org/apache/sis/storage/earthobservation/LandsatStoreProvider.java +++ b/storage/sis-earth-observation/src/main/java/org/apache/sis/storage/earthobservation/LandsatStoreProvider.java @@ -16,19 +16,7 @@ */ package org.apache.sis.storage.earthobservation; -import java.nio.file.Path; -import java.nio.file.Paths; -import java.nio.file.Files; -import org.opengis.parameter.ParameterDescriptorGroup; -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.Capability; -import org.apache.sis.internal.storage.StoreMetadata; -import org.apache.sis.internal.storage.URIDataStore; -import org.apache.sis.internal.storage.wkt.FirstKeywordPeek; /** @@ -43,177 +31,14 @@ import org.apache.sis.internal.storage.wkt.FirstKeywordPeek; * @version 1.1 * @since 0.8 * @module + * + * @deprecated Moved to the {@link org.apache.sis.storage.landsat} package. */ -@StoreMetadata(formatName = LandsatStoreProvider.NAME, - fileSuffixes = "txt", - capabilities = Capability.READ) -public class LandsatStoreProvider extends DataStoreProvider { - /** - * The format name. - */ - static final String NAME = "Landsat"; - - /** - * The parameter descriptor to be returned by {@link #getOpenParameters()}. - */ - private static final ParameterDescriptorGroup OPEN_DESCRIPTOR = URIDataStore.Provider.descriptor(NAME); - - /** - * 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=LANDSAT_METADATA_FILE", - L1_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 the path to the metadata file relative to the directory specified by user. - * This method is invoked if the user gave us the directory containing all Landsat files - * instead of the path to the metadata file. - */ - @Override - protected Path getAuxiliaryPath(final StorageConnector connector) throws DataStoreException { - return getMetadataFile(connector.getStorageAs(Path.class)); - } - - /** - * 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) { - final String ks = new String(keyword, 0, length); - if (KEYWORD.equalsIgnoreCase(ks) || L1_KEYWORD.equalsIgnoreCase(ks)) { - return ProbeResult.SUPPORTED; - } - return ProbeResult.UNSUPPORTED_STORAGE; - } - } - +@Deprecated +public class LandsatStoreProvider extends org.apache.sis.storage.landsat.LandsatStoreProvider { /** * Creates a new provider. */ public LandsatStoreProvider() { } - - /** - * 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 NAME; - } - - /** - * Returns a description of all parameters accepted by this provider for opening a Landsat file. - * - * @return description of available parameters for opening a Landsat file. - * - * @since 0.8 - */ - @Override - public ParameterDescriptorGroup getOpenParameters() { - return OPEN_DESCRIPTOR; - } - - /** - * Returns the metadata file inside the given directory if the file exists, or {@code null} otherwise. - * - * @param directory directory to test, or {@code null} if unknown. - * @return metadata file, or {@code null} if it does not exist. - */ - static Path getMetadataFile(final Path directory) { - if (directory != null) { - final Path file = directory.resolve(Paths.get(directory.getFileName().toString().concat("_MTL.txt"))); - if (Files.isRegularFile(file)) { - return file; - } - } - return null; - } - - /** - * 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(this, connector); - } } diff --git a/storage/sis-earth-observation/src/main/java/org/apache/sis/storage/earthobservation/package-info.java b/storage/sis-earth-observation/src/main/java/org/apache/sis/storage/earthobservation/package-info.java index b84a034..14748f7 100644 --- a/storage/sis-earth-observation/src/main/java/org/apache/sis/storage/earthobservation/package-info.java +++ b/storage/sis-earth-observation/src/main/java/org/apache/sis/storage/earthobservation/package-info.java @@ -28,7 +28,7 @@ * </tr><tr> * <td>Landsat 8 level 1</td> * <td>U.S. Geological Survey (USGS)</td> - * <td><a href="doc-files/LandsatMetadata.html">Mapping from/to ISO 19115</a></td> + * <td><a href="../landsat/doc-files/MetadataMapping.html">Mapping from/to ISO 19115</a></td> * </tr> * </table> * @@ -36,7 +36,10 @@ * @author Minh Chinh Vu (VNSC) * @author Martin Desruisseaux (Geomatys) * @version 1.1 - * @since 0.8 + * @since 1.1 * @module + * + * @deprecated Moved to {@link org.apache.sis.storage.landsat}. */ +@Deprecated package org.apache.sis.storage.earthobservation; diff --git a/storage/sis-earth-observation/src/main/java/org/apache/sis/storage/earthobservation/LandsatResource.java b/storage/sis-earth-observation/src/main/java/org/apache/sis/storage/landsat/Band.java similarity index 96% rename from storage/sis-earth-observation/src/main/java/org/apache/sis/storage/earthobservation/LandsatResource.java rename to storage/sis-earth-observation/src/main/java/org/apache/sis/storage/landsat/Band.java index 29a0293..850992e 100644 --- a/storage/sis-earth-observation/src/main/java/org/apache/sis/storage/earthobservation/LandsatResource.java +++ b/storage/sis-earth-observation/src/main/java/org/apache/sis/storage/landsat/Band.java @@ -14,7 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.sis.storage.earthobservation; +package org.apache.sis.storage.landsat; import java.nio.file.Path; import java.nio.file.Paths; @@ -52,7 +52,7 @@ import static org.apache.sis.internal.util.CollectionsExt.first; * @since 1.1 * @module */ -final class LandsatResource extends GridResourceWrapper implements SchemaModifier { +final class Band extends GridResourceWrapper implements SchemaModifier { /** * The data store that contains this band. * Also the object on which to perform synchronization locks. @@ -62,7 +62,7 @@ final class LandsatResource extends GridResourceWrapper implements SchemaModifie /** * The band for which this instance provides data. */ - final LandsatBand band; + final BandName band; /** * Identifier of the band for which this instance provides data. @@ -88,7 +88,7 @@ final class LandsatResource extends GridResourceWrapper implements SchemaModifie /** * Creates a new resource for the specified band. */ - LandsatResource(final LandsatStore parent, final LandsatBand band) { + Band(final LandsatStore parent, final BandName band) { this.parent = parent; this.band = band; if (band.wavelength != 0) { @@ -132,7 +132,7 @@ final class LandsatResource extends GridResourceWrapper implements SchemaModifie } /** - * Returns the resource persistent identifier. The name is the {@link LandsatBand#name()} + * Returns the resource persistent identifier. The name is the {@link BandName#name()} * and the scope (namespace) is the name of the directory that contains this band. */ @Override @@ -142,7 +142,7 @@ final class LandsatResource extends GridResourceWrapper implements SchemaModifie /** * Invoked when the GeoTIFF reader creates the resource identifier. - * We use the identifier of the enclosing {@link LandsatResource}. + * We use the identifier of the enclosing {@link Band}. */ @Override public GenericName customize(final int image, final GenericName fallback) { diff --git a/storage/sis-earth-observation/src/main/java/org/apache/sis/storage/earthobservation/LandsatAggregate.java b/storage/sis-earth-observation/src/main/java/org/apache/sis/storage/landsat/BandGroup.java similarity index 74% rename from storage/sis-earth-observation/src/main/java/org/apache/sis/storage/earthobservation/LandsatAggregate.java rename to storage/sis-earth-observation/src/main/java/org/apache/sis/storage/landsat/BandGroup.java index 9517e1d..58c8139 100644 --- a/storage/sis-earth-observation/src/main/java/org/apache/sis/storage/earthobservation/LandsatAggregate.java +++ b/storage/sis-earth-observation/src/main/java/org/apache/sis/storage/landsat/BandGroup.java @@ -14,7 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.sis.storage.earthobservation; +package org.apache.sis.storage.landsat; import java.util.List; import java.util.Arrays; @@ -33,8 +33,8 @@ import org.apache.sis.util.ArraysExt; /** - * An aggregate of {@link LandsatResource}. - * Each aggregate is for one {@link LandsatBandGroup}. + * An aggregate of {@link Band}. + * Each aggregate is for one {@link BandGroupName}. * * @todo Future implementation should implement {@code GridCoverageResource} * and provides an aggregated coverage view where each Landsat band is @@ -45,11 +45,11 @@ import org.apache.sis.util.ArraysExt; * @since 1.1 * @module */ -final class LandsatAggregate extends AbstractResource implements Aggregate { +final class BandGroup extends AbstractResource implements Aggregate { /** * The group of bands that this aggregate represents. */ - final LandsatBandGroup group; + final BandGroupName group; /** * Name of the band group. @@ -60,21 +60,21 @@ final class LandsatAggregate extends AbstractResource implements Aggregate { /** * The array of images for each Landsat band. */ - private final LandsatResource[] components; + private final Band[] components; /** * Creates a new aggregate for the specified group. * This constructor will copy only the resources for that group from the given array. */ - private LandsatAggregate(final StoreListeners parent, final LandsatBandGroup group, - final LandsatResource[] resources, final int count) + private BandGroup(final StoreListeners parent, final BandGroupName group, + final Band[] resources, final int count) { super(parent); this.group = group; int n = 0; - LandsatResource[] components = new LandsatResource[resources.length]; + Band[] components = new Band[resources.length]; for (int i=0; i<count; i++) { - final LandsatResource r = resources[i]; + final Band r = resources[i]; if (r.band.group == group) { components[n++] = r; } @@ -85,12 +85,12 @@ final class LandsatAggregate extends AbstractResource implements Aggregate { /** * Creates aggregates for the given bands. */ - static LandsatAggregate[] group(final StoreListeners parent, final LandsatResource[] resources, final int count) { - final LandsatBandGroup[] groups = LandsatBandGroup.values(); - final LandsatAggregate[] aggregates = new LandsatAggregate[groups.length]; + static BandGroup[] group(final StoreListeners parent, final Band[] resources, final int count) { + final BandGroupName[] groups = BandGroupName.values(); + final BandGroup[] aggregates = new BandGroup[groups.length]; int n = 0; - for (final LandsatBandGroup group : groups) { - final LandsatAggregate c = new LandsatAggregate(parent, group, resources, count); + for (final BandGroupName group : groups) { + final BandGroup c = new BandGroup(parent, group, resources, count); if (c.components.length != 0) { aggregates[n++] = c; } @@ -126,10 +126,10 @@ final class LandsatAggregate extends AbstractResource implements Aggregate { /** * Returns all bands in the given array of aggregates. */ - static final List<LandsatResource> bands(final LandsatAggregate[] components) { - final List<LandsatResource> bands = new ArrayList<>(); + static final List<Band> bands(final BandGroup[] components) { + final List<Band> bands = new ArrayList<>(); if (components != null) { - for (final LandsatAggregate c : components) { + for (final BandGroup c : components) { bands.addAll(Arrays.asList(c.components)); } } diff --git a/storage/sis-earth-observation/src/main/java/org/apache/sis/storage/earthobservation/LandsatBandGroup.java b/storage/sis-earth-observation/src/main/java/org/apache/sis/storage/landsat/BandGroupName.java similarity index 91% rename from storage/sis-earth-observation/src/main/java/org/apache/sis/storage/earthobservation/LandsatBandGroup.java rename to storage/sis-earth-observation/src/main/java/org/apache/sis/storage/landsat/BandGroupName.java index 18b8c45..ba282e7 100644 --- a/storage/sis-earth-observation/src/main/java/org/apache/sis/storage/earthobservation/LandsatBandGroup.java +++ b/storage/sis-earth-observation/src/main/java/org/apache/sis/storage/landsat/BandGroupName.java @@ -14,7 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.sis.storage.earthobservation; +package org.apache.sis.storage.landsat; import org.apache.sis.util.resources.Vocabulary; import org.opengis.util.InternationalString; @@ -29,7 +29,7 @@ import org.opengis.util.InternationalString; * @since 1.1 * @module */ -enum LandsatBandGroup { +enum BandGroupName { /** * Group for bands 1, 2, 3, 4, 5, 6, 7, 9. */ @@ -64,7 +64,7 @@ enum LandsatBandGroup { /** * Creates a new enumeration value. */ - private LandsatBandGroup(final short name, final InternationalString measurement, final boolean reflectance) { + private BandGroupName(final short name, final InternationalString measurement, final boolean reflectance) { this.title = Vocabulary.formatInternational(name); this.measurement = measurement; this.reflectance = reflectance; diff --git a/storage/sis-earth-observation/src/main/java/org/apache/sis/storage/earthobservation/LandsatBand.java b/storage/sis-earth-observation/src/main/java/org/apache/sis/storage/landsat/BandName.java similarity index 58% rename from storage/sis-earth-observation/src/main/java/org/apache/sis/storage/earthobservation/LandsatBand.java rename to storage/sis-earth-observation/src/main/java/org/apache/sis/storage/landsat/BandName.java index ce92298..5798f00 100644 --- a/storage/sis-earth-observation/src/main/java/org/apache/sis/storage/earthobservation/LandsatBand.java +++ b/storage/sis-earth-observation/src/main/java/org/apache/sis/storage/landsat/BandName.java @@ -14,7 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.sis.storage.earthobservation; +package org.apache.sis.storage.landsat; import org.opengis.util.InternationalString; import org.apache.sis.util.SimpleInternationalString; @@ -32,23 +32,23 @@ import org.apache.sis.util.SimpleInternationalString; * @since 1.1 * @module */ -enum LandsatBand { - COASTAL_AEROSOL(LandsatBandGroup.REFLECTIVE, "Coastal Aerosol", (short) 433), - BLUE (LandsatBandGroup.REFLECTIVE, "Blue", (short) 482), - GREEN (LandsatBandGroup.REFLECTIVE, "Green", (short) 562), - RED (LandsatBandGroup.REFLECTIVE, "Red", (short) 655), - NEAR_INFRARED (LandsatBandGroup.REFLECTIVE, "Near-Infrared", (short) 865), - SWIR1 (LandsatBandGroup.REFLECTIVE, "Short Wavelength Infrared (SWIR) 1", (short) 1610), - SWIR2 (LandsatBandGroup.REFLECTIVE, "Short Wavelength Infrared (SWIR) 2", (short) 2200), - PANCHROMATIC (LandsatBandGroup.PANCHROMATIC, "Panchromatic", (short) 590), - CIRRUS (LandsatBandGroup.REFLECTIVE, "Cirrus", (short) 1375), - TIRS1 (LandsatBandGroup.THERMAL, "Thermal Infrared Sensor (TIRS) 1", (short) 10800), - TIRS2 (LandsatBandGroup.THERMAL, "Thermal Infrared Sensor (TIRS) 2", (short) 12000); +enum BandName { + COASTAL_AEROSOL(BandGroupName.REFLECTIVE, "Coastal Aerosol", (short) 433), + BLUE (BandGroupName.REFLECTIVE, "Blue", (short) 482), + GREEN (BandGroupName.REFLECTIVE, "Green", (short) 562), + RED (BandGroupName.REFLECTIVE, "Red", (short) 655), + NEAR_INFRARED (BandGroupName.REFLECTIVE, "Near-Infrared", (short) 865), + SWIR1 (BandGroupName.REFLECTIVE, "Short Wavelength Infrared (SWIR) 1", (short) 1610), + SWIR2 (BandGroupName.REFLECTIVE, "Short Wavelength Infrared (SWIR) 2", (short) 2200), + PANCHROMATIC (BandGroupName.PANCHROMATIC, "Panchromatic", (short) 590), + CIRRUS (BandGroupName.REFLECTIVE, "Cirrus", (short) 1375), + TIRS1 (BandGroupName.THERMAL, "Thermal Infrared Sensor (TIRS) 1", (short) 10800), + TIRS2 (BandGroupName.THERMAL, "Thermal Infrared Sensor (TIRS) 2", (short) 12000); /** * Group in which this band belong. */ - final LandsatBandGroup group; + final BandGroupName group; /** * Localized name of Landsat band. @@ -65,7 +65,7 @@ enum LandsatBand { /** * Creates a new enumeration value. */ - private LandsatBand(final LandsatBandGroup group, final String name, final short wavelength) { + private BandName(final BandGroupName group, final String name, final short wavelength) { this.group = group; this.title = new SimpleInternationalString(name); this.wavelength = wavelength; diff --git a/storage/sis-earth-observation/src/main/java/org/apache/sis/storage/earthobservation/LandsatStore.java b/storage/sis-earth-observation/src/main/java/org/apache/sis/storage/landsat/LandsatStore.java similarity index 92% copy from storage/sis-earth-observation/src/main/java/org/apache/sis/storage/earthobservation/LandsatStore.java copy to storage/sis-earth-observation/src/main/java/org/apache/sis/storage/landsat/LandsatStore.java index 11f8b87..d2e9508 100644 --- a/storage/sis-earth-observation/src/main/java/org/apache/sis/storage/earthobservation/LandsatStore.java +++ b/storage/sis-earth-observation/src/main/java/org/apache/sis/storage/landsat/LandsatStore.java @@ -14,7 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.sis.storage.earthobservation; +package org.apache.sis.storage.landsat; import java.util.Map; import java.util.List; @@ -51,9 +51,9 @@ import org.apache.sis.setup.OptionKey; /** - * Parses Landsat metadata as {@linkplain org.apache.sis.metadata.iso.DefaultMetadata ISO 19115 Metadata} object. - * Landsat data are distributed as a collection of TIFF files, together with a single - * text file like below: + * Reads Landsat metadata and bands. + * Landsat data are distributed as a collection of TIFF files, + * together with a single text file like below: * * {@preformat text * GROUP = L1_METADATA_FILE @@ -80,7 +80,7 @@ import org.apache.sis.setup.OptionKey; * @author Thi Phuong Hao Nguyen (VNSC) * @author Martin Desruisseaux (Geomatys) * @version 1.1 - * @since 0.8 + * @since 1.1 * @module */ public class LandsatStore extends DataStore implements Aggregate { @@ -113,7 +113,7 @@ public class LandsatStore extends DataStore implements Aggregate { * The array of aggregates for each Landsat band group, or {@code null} if not yet created. * This array is created together with {@linkplain #metadata} and is unmodifiable. */ - private LandsatAggregate[] components; + private BandGroup[] components; /** * Creates a new Landsat store from the given file, URL, stream or character reader. @@ -209,20 +209,20 @@ public class LandsatStore extends DataStore implements Aggregate { final String name = getDisplayName(); final NameFactory factory = DefaultFactories.forBuildin(NameFactory.class); final NameSpace scope = (name != null) ? factory.createNameSpace(factory.createLocalName(null, name), null) : null; - final LandsatResource[] resources; + final Band[] resources; int count = 0; try (BufferedReader reader = (source instanceof BufferedReader) ? (BufferedReader) source : new LineNumberReader(source)) { source = null; // Will be closed at the end of this try-finally block. - final LandsatReader parser = new LandsatReader(this, getDisplayName(), listeners); + final MetadataReader parser = new MetadataReader(this, getDisplayName(), listeners); parser.read(reader); metadata = parser.getMetadata(); /* * Create the array of components. The resource identifier is the band name. * The namespace of each identifier is the name of the data set directory. */ - resources = new LandsatResource[parser.bands.size()]; - for (final Map.Entry<LandsatBand,LandsatResource> entry : parser.bands.entrySet()) { - final LandsatResource component = entry.getValue(); + resources = new Band[parser.bands.size()]; + for (final Map.Entry<BandName,Band> entry : parser.bands.entrySet()) { + final Band component = entry.getValue(); if (component.filename != null) { component.identifier = factory.createLocalName(scope, entry.getKey().name()); resources[count++] = component; @@ -233,8 +233,8 @@ public class LandsatStore extends DataStore implements Aggregate { } catch (FactoryException e) { throw new DataStoreReferencingException(e); } - components = LandsatAggregate.group(listeners, resources, count); - for (final LandsatAggregate c : components) { + components = BandGroup.group(listeners, resources, count); + for (final BandGroup c : components) { c.identifier = factory.createLocalName(scope, c.group.name()); } } @@ -293,7 +293,7 @@ public class LandsatStore extends DataStore implements Aggregate { public synchronized void close() throws DataStoreException { metadata = null; DataStoreException error = null; - for (final LandsatResource band : LandsatAggregate.bands(components)) { + for (final Band band : BandGroup.bands(components)) { try { band.closeDataStore(); } catch (DataStoreException e) { diff --git a/storage/sis-earth-observation/src/main/java/org/apache/sis/storage/earthobservation/LandsatStoreProvider.java b/storage/sis-earth-observation/src/main/java/org/apache/sis/storage/landsat/LandsatStoreProvider.java similarity index 99% copy from storage/sis-earth-observation/src/main/java/org/apache/sis/storage/earthobservation/LandsatStoreProvider.java copy to storage/sis-earth-observation/src/main/java/org/apache/sis/storage/landsat/LandsatStoreProvider.java index 05b131a..5a716d6 100644 --- a/storage/sis-earth-observation/src/main/java/org/apache/sis/storage/earthobservation/LandsatStoreProvider.java +++ b/storage/sis-earth-observation/src/main/java/org/apache/sis/storage/landsat/LandsatStoreProvider.java @@ -14,7 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.sis.storage.earthobservation; +package org.apache.sis.storage.landsat; import java.nio.file.Path; import java.nio.file.Paths; @@ -41,7 +41,7 @@ import org.apache.sis.internal.storage.wkt.FirstKeywordPeek; * * @author Martin Desruisseaux (Geomatys) * @version 1.1 - * @since 0.8 + * @since 1.1 * @module */ @StoreMetadata(formatName = LandsatStoreProvider.NAME, diff --git a/storage/sis-earth-observation/src/main/java/org/apache/sis/storage/earthobservation/LandsatReader.java b/storage/sis-earth-observation/src/main/java/org/apache/sis/storage/landsat/MetadataReader.java similarity index 95% rename from storage/sis-earth-observation/src/main/java/org/apache/sis/storage/earthobservation/LandsatReader.java rename to storage/sis-earth-observation/src/main/java/org/apache/sis/storage/landsat/MetadataReader.java index ea1fd25..a08ed14 100644 --- a/storage/sis-earth-observation/src/main/java/org/apache/sis/storage/earthobservation/LandsatReader.java +++ b/storage/sis-earth-observation/src/main/java/org/apache/sis/storage/landsat/MetadataReader.java @@ -14,7 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.sis.storage.earthobservation; +package org.apache.sis.storage.landsat; import java.awt.Dimension; import java.io.BufferedReader; @@ -91,7 +91,7 @@ import static org.apache.sis.internal.util.CollectionsExt.singletonOrNull; * } * * <p><b>NOTE FOR MAINTAINER:</b> if the work performed by this class is modified, consider updating - * <a href="./doc-files/LandsatMetadata.html">./doc-files/LandsatMetadata.html</a> accordingly.</p> + * <a href="./doc-files/MetadataMapping.html">./doc-files/MetadataMapping.html</a> accordingly.</p> * * @author Thi Phuong Hao Nguyen (VNSC) * @author Rémi Maréchal (Geomatys) @@ -100,7 +100,7 @@ import static org.apache.sis.internal.util.CollectionsExt.singletonOrNull; * @since 0.8 * @module */ -final class LandsatReader extends MetadataBuilder { +final class MetadataReader extends MetadataBuilder { /** * The pattern determining if the value of {@code ORIGIN} key is of the form * “Image courtesy of the U.S. Geological Survey”. @@ -187,7 +187,7 @@ final class LandsatReader extends MetadataBuilder { * Image width and hight in pixels, as unsigned integers. Values are (<var>width</var>,<var>height</var>) tuples. * Tuples in this array are for {@link #PANCHROMATIC}, {@link #REFLECTIVE} or {@link #THERMAL} bands, in that order. */ - private final EnumMap<LandsatBandGroup,Dimension> gridSizes; + private final EnumMap<BandGroupName,Dimension> gridSizes; /** * The bands descriptions. The bands can be, in this exact order: @@ -208,12 +208,12 @@ final class LandsatReader extends MetadataBuilder { * * @see #band(String, int) */ - final EnumMap<LandsatBand,LandsatResource> bands; + final EnumMap<BandName,Band> bands; /** - * {@link LandsatBand#values()}, fetched once for avoiding multiple array creations. + * {@link BandName#values()}, fetched once for avoiding multiple array creations. */ - private final LandsatBand[] bandEnumerations; + private final BandName[] bandEnumerations; /** * The enumeration for the {@code "DATUM"} element, to be used for creating the Coordinate Reference System. @@ -244,15 +244,15 @@ final class LandsatReader extends MetadataBuilder { * @param filename an identifier of the file being read, or {@code null} if unknown. * @param listeners where to sent warnings that may occur during the parsing process. */ - LandsatReader(final LandsatStore store, final String filename, final StoreListeners listeners) { + MetadataReader(final LandsatStore store, final String filename, final StoreListeners listeners) { this.store = store; this.filename = filename; this.listeners = listeners; this.factories = new ReferencingFactoryContainer(); this.corners = new double[2*NUM_COORDINATES]; // 2 types of CRS: GEOGRAPHIC and PROJECTED. - this.gridSizes = new EnumMap<>(LandsatBandGroup.class); - this.bands = new EnumMap<>(LandsatBand.class); - bandEnumerations = LandsatBand.values(); + this.gridSizes = new EnumMap<>(BandGroupName.class); + this.bands = new EnumMap<>(BandName.class); + bandEnumerations = BandName.values(); Arrays.fill(corners, Double.NaN); } @@ -362,7 +362,7 @@ final class LandsatReader extends MetadataBuilder { * * @param value the value to parse. */ - private void parseGridSize(final LandsatBandGroup group, final boolean isX, final String value) throws NumberFormatException { + private void parseGridSize(final BandGroupName group, final boolean isX, final String value) throws NumberFormatException { final int s = Integer.parseUnsignedInt(value); final Dimension size = gridSizes.computeIfAbsent(group, (k) -> new Dimension()); if (isX) size.width = s; @@ -561,12 +561,12 @@ final class LandsatReader extends MetadataBuilder { * The number of product lines and samples for the panchromatic, reflective and thermal bands. * Those parameters are only present if the corresponding band is present in the product. */ - case "PANCHROMATIC_LINES": parseGridSize(LandsatBandGroup.PANCHROMATIC, false, value); break; - case "PANCHROMATIC_SAMPLES": parseGridSize(LandsatBandGroup.PANCHROMATIC, true, value); break; - case "REFLECTIVE_LINES": parseGridSize(LandsatBandGroup.REFLECTIVE, false, value); break; - case "REFLECTIVE_SAMPLES": parseGridSize(LandsatBandGroup.REFLECTIVE, true, value); break; - case "THERMAL_LINES": parseGridSize(LandsatBandGroup.THERMAL, false, value); break; - case "THERMAL_SAMPLES": parseGridSize(LandsatBandGroup.THERMAL, true, value); break; + case "PANCHROMATIC_LINES": parseGridSize(BandGroupName.PANCHROMATIC, false, value); break; + case "PANCHROMATIC_SAMPLES": parseGridSize(BandGroupName.PANCHROMATIC, true, value); break; + case "REFLECTIVE_LINES": parseGridSize(BandGroupName.REFLECTIVE, false, value); break; + case "REFLECTIVE_SAMPLES": parseGridSize(BandGroupName.REFLECTIVE, true, value); break; + case "THERMAL_LINES": parseGridSize(BandGroupName.THERMAL, false, value); break; + case "THERMAL_SAMPLES": parseGridSize(BandGroupName.THERMAL, true, value); break; /* * The grid cell size in meters used in creating the image for the band, if part of the product. * This parameter is only included if the corresponding band is included in the product. @@ -767,15 +767,15 @@ final class LandsatReader extends MetadataBuilder { * @param index the band index. * @return information about the band, or {@code null} if none. */ - private Optional<LandsatResource> band(final String key, final int index) { + private Optional<Band> band(final String key, final int index) { if (index < 1 || index > bandEnumerations.length) { listeners.warning(errors().getString(Errors.Keys.UnexpectedValueInElement_2, key + index, index)); return Optional.empty(); } - final LandsatBand band = bandEnumerations[index - 1]; - LandsatResource data = bands.get(band); + final BandName band = bandEnumerations[index - 1]; + Band data = bands.get(band); if (data == null) { - data = new LandsatResource(store, band); + data = new Band(store, band); bands.put(band, data); } return Optional.of(data); @@ -925,8 +925,8 @@ final class LandsatReader extends MetadataBuilder { */ final DefaultCoverageDescription content = (DefaultCoverageDescription) singletonOrNull(result.getContentInfo()); if (content != null) { - final EnumMap<LandsatBandGroup,DefaultAttributeGroup> groups = new EnumMap<>(LandsatBandGroup.class); - for (final EnumMap.Entry<LandsatBand,LandsatResource> entry : bands.entrySet()) { + final EnumMap<BandGroupName,DefaultAttributeGroup> groups = new EnumMap<>(BandGroupName.class); + for (final EnumMap.Entry<BandName,Band> entry : bands.entrySet()) { final DefaultAttributeGroup group = groups.computeIfAbsent(entry.getKey().group, (k) -> { DefaultAttributeGroup g = new DefaultAttributeGroup(CoverageContentType.PHYSICAL_MEASUREMENT, null); content.getAttributeGroups().add(g); diff --git a/storage/sis-earth-observation/src/main/java/org/apache/sis/storage/earthobservation/doc-files/LandsatMetadata.html b/storage/sis-earth-observation/src/main/java/org/apache/sis/storage/landsat/doc-files/MetadataMapping.html similarity index 99% rename from storage/sis-earth-observation/src/main/java/org/apache/sis/storage/earthobservation/doc-files/LandsatMetadata.html rename to storage/sis-earth-observation/src/main/java/org/apache/sis/storage/landsat/doc-files/MetadataMapping.html index da6ee8a..e349c10 100644 --- a/storage/sis-earth-observation/src/main/java/org/apache/sis/storage/earthobservation/doc-files/LandsatMetadata.html +++ b/storage/sis-earth-observation/src/main/java/org/apache/sis/storage/landsat/doc-files/MetadataMapping.html @@ -83,7 +83,7 @@ The Landsat to ISO mapping is not always a one-to-one relationship. In some cases the ISO value need to be computed from two or more Landsat values. In other cases the ISO value does not appear in the Landsat file at all, - so the value is hard-coded in the <code>LandsatReader</code> class. + so the value is hard-coded in the <code>MetadataReader</code> class. </p> <p> In the following table, black values in the "Landsat property" column are hard-coded values. diff --git a/storage/sis-earth-observation/src/main/java/org/apache/sis/storage/earthobservation/package-info.java b/storage/sis-earth-observation/src/main/java/org/apache/sis/storage/landsat/package-info.java similarity index 61% copy from storage/sis-earth-observation/src/main/java/org/apache/sis/storage/earthobservation/package-info.java copy to storage/sis-earth-observation/src/main/java/org/apache/sis/storage/landsat/package-info.java index b84a034..81a1201 100644 --- a/storage/sis-earth-observation/src/main/java/org/apache/sis/storage/earthobservation/package-info.java +++ b/storage/sis-earth-observation/src/main/java/org/apache/sis/storage/landsat/package-info.java @@ -16,27 +16,19 @@ */ /** - * Metadata readers for some format used in Earth observation (Landsat, MODIS). - * This package includes mapping from the following formats to ISO 19115 metadata: - * - * <table class="sis"> - * <caption>Earth observation formats</caption> - * <tr> - * <th>Format</th> - * <th>Provider</th> - * <th>Apache SIS notes</th> - * </tr><tr> - * <td>Landsat 8 level 1</td> - * <td>U.S. Geological Survey (USGS)</td> - * <td><a href="doc-files/LandsatMetadata.html">Mapping from/to ISO 19115</a></td> - * </tr> - * </table> + * Reader of Landsat 8 level 1-2 data. + * Those data are produced by the U.S. Geological Survey (USGS). + * This reader takes in input the directory containing the files for a Landsat scene. + * Such directory is made of metadata files in text or XML formal and GeoTIFF files. + * The text file is parsed and <a href="doc-files/MetadataMapping.html">mapped to ISO 19115 metadata</a>. + * The GeoTIFF files are read using {@link org.apache.sis.storage.geotiff.GeoTiffStore} + * with each band offered as a Landsat resource. * * @author Thi Phuong Hao Nguyen (VNSC) * @author Minh Chinh Vu (VNSC) * @author Martin Desruisseaux (Geomatys) * @version 1.1 - * @since 0.8 + * @since 1.1 * @module */ -package org.apache.sis.storage.earthobservation; +package org.apache.sis.storage.landsat; diff --git a/storage/sis-earth-observation/src/main/resources/META-INF/services/org.apache.sis.storage.DataStoreProvider b/storage/sis-earth-observation/src/main/resources/META-INF/services/org.apache.sis.storage.DataStoreProvider index b5dd8b7..c01464d 100644 --- a/storage/sis-earth-observation/src/main/resources/META-INF/services/org.apache.sis.storage.DataStoreProvider +++ b/storage/sis-earth-observation/src/main/resources/META-INF/services/org.apache.sis.storage.DataStoreProvider @@ -1 +1 @@ -org.apache.sis.storage.earthobservation.LandsatStoreProvider +org.apache.sis.storage.landsat.LandsatStoreProvider diff --git a/storage/sis-earth-observation/src/test/java/org/apache/sis/storage/earthobservation/LandsatStoreProviderTest.java b/storage/sis-earth-observation/src/test/java/org/apache/sis/storage/landsat/LandsatStoreProviderTest.java similarity index 94% rename from storage/sis-earth-observation/src/test/java/org/apache/sis/storage/earthobservation/LandsatStoreProviderTest.java rename to storage/sis-earth-observation/src/test/java/org/apache/sis/storage/landsat/LandsatStoreProviderTest.java index 65b6d26..6188292 100644 --- a/storage/sis-earth-observation/src/test/java/org/apache/sis/storage/earthobservation/LandsatStoreProviderTest.java +++ b/storage/sis-earth-observation/src/test/java/org/apache/sis/storage/landsat/LandsatStoreProviderTest.java @@ -14,7 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.sis.storage.earthobservation; +package org.apache.sis.storage.landsat; import java.nio.charset.StandardCharsets; import org.apache.sis.setup.OptionKey; @@ -43,7 +43,7 @@ public final strictfp class LandsatStoreProviderTest extends TestCase { */ @Test public void testProbeContentFromReader() throws DataStoreException { - final StorageConnector connector = new StorageConnector(LandsatReaderTest.class.getResourceAsStream("LandsatTest.txt")); + final StorageConnector connector = new StorageConnector(MetadataReaderTest.class.getResourceAsStream("LandsatTest.txt")); connector.setOption(OptionKey.ENCODING, StandardCharsets.UTF_8); final LandsatStoreProvider provider = new LandsatStoreProvider(); assertEquals(ProbeResult.SUPPORTED, provider.probeContent(connector)); diff --git a/storage/sis-earth-observation/src/test/java/org/apache/sis/storage/earthobservation/LandsatReaderTest.java b/storage/sis-earth-observation/src/test/java/org/apache/sis/storage/landsat/MetadataReaderTest.java similarity index 96% rename from storage/sis-earth-observation/src/test/java/org/apache/sis/storage/earthobservation/LandsatReaderTest.java rename to storage/sis-earth-observation/src/test/java/org/apache/sis/storage/landsat/MetadataReaderTest.java index b7cffdf..32df297 100644 --- a/storage/sis-earth-observation/src/test/java/org/apache/sis/storage/earthobservation/LandsatReaderTest.java +++ b/storage/sis-earth-observation/src/test/java/org/apache/sis/storage/landsat/MetadataReaderTest.java @@ -14,7 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.sis.storage.earthobservation; +package org.apache.sis.storage.landsat; import java.util.regex.Matcher; import java.io.BufferedReader; @@ -42,7 +42,7 @@ import static org.apache.sis.test.TestUtilities.date; /** - * Tests {@link LandsatReader}. + * Tests {@link MetadataReader}. * * @author Thi Phuong Hao Nguyen (VNSC) * @author Martin Desruisseaux (Geomatys) @@ -50,23 +50,23 @@ import static org.apache.sis.test.TestUtilities.date; * @since 0.8 * @module */ -public class LandsatReaderTest extends TestCase { +public class MetadataReaderTest extends TestCase { /** * Tests the regular expression used for detecting the * “Image courtesy of the U.S. Geological Survey” credit. */ @Test public void testCreditPattern() { - final Matcher m = LandsatReader.CREDIT.matcher("Image courtesy of the U.S. Geological Survey"); + final Matcher m = MetadataReader.CREDIT.matcher("Image courtesy of the U.S. Geological Survey"); assertTrue("matches", m.find()); assertEquals("end", 22, m.end()); } /** - * Tests {@link LandsatReader#read(BufferedReader)}. + * Tests {@link MetadataReader#read(BufferedReader)}. * * <p><b>Note for maintainer:</b> if the result of this test changes, consider updating - * <a href="./doc-files/LandsatMetadata.html">./doc-files/LandsatMetadata.html</a> accordingly.</p> + * <a href="./doc-files/MetadataMapping.html">./doc-files/MetadataMapping.html</a> accordingly.</p> * * @throws IOException if an error occurred while reading the test file. * @throws DataStoreException if a property value can not be parsed as a number or a date. @@ -76,9 +76,9 @@ public class LandsatReaderTest extends TestCase { public void testRead() throws IOException, DataStoreException, FactoryException { final Metadata actual; try (BufferedReader in = new BufferedReader(new InputStreamReader( - LandsatReaderTest.class.getResourceAsStream("LandsatTest.txt"), "UTF-8"))) + MetadataReaderTest.class.getResourceAsStream("LandsatTest.txt"), "UTF-8"))) { - final LandsatReader reader = new LandsatReader(null, "LandsatTest.txt", new AbstractResource(null)); + final MetadataReader reader = new MetadataReader(null, "LandsatTest.txt", new AbstractResource(null)); reader.read(in); actual = reader.getMetadata(); } diff --git a/storage/sis-earth-observation/src/test/java/org/apache/sis/test/suite/EarthObservationTestSuite.java b/storage/sis-earth-observation/src/test/java/org/apache/sis/test/suite/EarthObservationTestSuite.java index 7e85a2f..c476dc5 100644 --- a/storage/sis-earth-observation/src/test/java/org/apache/sis/test/suite/EarthObservationTestSuite.java +++ b/storage/sis-earth-observation/src/test/java/org/apache/sis/test/suite/EarthObservationTestSuite.java @@ -31,8 +31,8 @@ import org.junit.BeforeClass; * @module */ @Suite.SuiteClasses({ - org.apache.sis.storage.earthobservation.LandsatReaderTest.class, - org.apache.sis.storage.earthobservation.LandsatStoreProviderTest.class + org.apache.sis.storage.landsat.MetadataReaderTest.class, + org.apache.sis.storage.landsat.LandsatStoreProviderTest.class }) public final strictfp class EarthObservationTestSuite extends TestSuite { /** diff --git a/storage/sis-earth-observation/src/test/resources/org/apache/sis/storage/earthobservation/LandsatTest.txt b/storage/sis-earth-observation/src/test/resources/org/apache/sis/storage/landsat/LandsatTest.txt similarity index 100% rename from storage/sis-earth-observation/src/test/resources/org/apache/sis/storage/earthobservation/LandsatTest.txt rename to storage/sis-earth-observation/src/test/resources/org/apache/sis/storage/landsat/LandsatTest.txt diff --git a/storage/sis-geotiff/src/main/java/org/apache/sis/storage/geotiff/GeoTiffStore.java b/storage/sis-geotiff/src/main/java/org/apache/sis/storage/geotiff/GeoTiffStore.java index c1f47a8..1bc2fe3 100644 --- a/storage/sis-geotiff/src/main/java/org/apache/sis/storage/geotiff/GeoTiffStore.java +++ b/storage/sis-geotiff/src/main/java/org/apache/sis/storage/geotiff/GeoTiffStore.java @@ -162,7 +162,7 @@ public class GeoTiffStore extends DataStore implements Aggregate { * <div class="note"><b>Example:</b> * A Landsat data set is a collection of files in a directory or ZIP file, * which includes more than 10 GeoTIFF files (one image per band or product for a scene). - * {@link org.apache.sis.storage.earthobservation.LandsatStore} is a data store opening the Landsat + * {@link org.apache.sis.storage.landsat.LandsatStore} is a data store opening the Landsat * metadata file as the main file, then opening each band/product using a GeoTIFF data store. * Those bands/products are components of the Landsat data store.</div> *