sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject svn commit: r1770274 [1/2] - in /sis/branches/JDK8: core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/distribution/ core/sis-metadata/src/main/java/org/apache/sis/metadata/sql/ core/sis-referencing/src/test/java/org/apache/sis/test/integratio...
Date Thu, 17 Nov 2016 20:14:36 GMT
Author: desruisseaux
Date: Thu Nov 17 20:14:36 2016
New Revision: 1770274

URL: http://svn.apache.org/viewvc?rev=1770274&view=rev
Log:
Review MetadataBuilder. This implied changes in ImageFileDirectory.
This work will also require the org.apache.sis.metadata.sql package.
For now we put hard-coded values, to be replaced later by database.

Added:
    sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/sql/
    sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/sql/MetadataResult.java   (with props)
    sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/sql/MetadataSource.java   (with props)
    sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/sql/MetadataStoreException.java   (with props)
    sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/sql/package-info.java   (with props)
Modified:
    sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/distribution/DefaultFormat.java
    sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/test/integration/MetadataTest.java
    sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/util/logging/WarningListeners.java
    sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.java
    sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.properties
    sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors_fr.properties
    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/storage/earthobservation/LandsatReaderTest.java
    sis/branches/JDK8/storage/sis-geotiff/src/main/java/org/apache/sis/internal/geotiff/Resources.java
    sis/branches/JDK8/storage/sis-geotiff/src/main/java/org/apache/sis/internal/geotiff/Resources.properties
    sis/branches/JDK8/storage/sis-geotiff/src/main/java/org/apache/sis/internal/geotiff/Resources_fr.properties
    sis/branches/JDK8/storage/sis-geotiff/src/main/java/org/apache/sis/storage/geotiff/GeoTiffStore.java
    sis/branches/JDK8/storage/sis-geotiff/src/main/java/org/apache/sis/storage/geotiff/ImageFileDirectory.java
    sis/branches/JDK8/storage/sis-geotiff/src/main/java/org/apache/sis/storage/geotiff/Reader.java
    sis/branches/JDK8/storage/sis-geotiff/src/main/java/org/apache/sis/storage/geotiff/Tags.java
    sis/branches/JDK8/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/MetadataBuilder.java
    sis/branches/JDK8/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/Resources.java
    sis/branches/JDK8/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/Resources.properties
    sis/branches/JDK8/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/Resources_fr.properties
    sis/branches/JDK8/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/csv/Store.java

Modified: sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/distribution/DefaultFormat.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/distribution/DefaultFormat.java?rev=1770274&r1=1770273&r2=1770274&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/distribution/DefaultFormat.java [UTF-8] (original)
+++ sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/distribution/DefaultFormat.java [UTF-8] Thu Nov 17 20:14:36 2016
@@ -38,6 +38,26 @@ import java.util.function.BiConsumer;
 /**
  * Description of the computer language construct that specifies the representation
  * of data objects in a record, file, message, storage device or transmission channel.
+ * Each {@code Format} instance should contain a {@linkplain #getFormatSpecificationCitation() reference
+ * to the format specification}, for example <cite>"PNG (Portable Network Graphics) Specification"</cite>.
+ * The specification often has an abbreviation (for example "PNG") which can be stored as an
+ * {@linkplain DefaultCitation#getAlternateTitles() alternate title}.
+ *
+ * <p>Apache SIS provides pre-defined metadata structures for some commonly-used formats.
+ * A pre-defined format can be obtained by a call to
+ * <code>{@linkplain org.apache.sis.metadata.sql.MetadataSource#lookup(Class, String) lookup}(Format.class,
+ * <var>abbreviation</var>)</code> where <var>abbreviation</var> can be one of the values listed below:</p>
+ *
+ * <table class="sis">
+ *   <caption>Specification titles for well-known format names</caption>
+ *   <tr><th>Abbreviation</th> <th>Specification title</th></tr>
+ *   <tr><td>CSV</td>          <td>Common Format and MIME Type for Comma-Separated Values (CSV) Files</td></tr>
+ *   <tr><td>GeoTIFF</td>      <td>GeoTIFF Coverage Encoding Profile</td></tr>
+ *   <tr><td>NetCDF</td>       <td>NetCDF Classic and 64-bit Offset Format</td></tr>
+ *   <tr><td>PNG</td>          <td>PNG (Portable Network Graphics) Specification</td></tr>
+ * </table>
+ *
+ * Above list may be expanded in any future SIS version.
  *
  * <p><b>Limitations:</b></p>
  * <ul>
@@ -106,50 +126,21 @@ public class DefaultFormat extends ISOMe
      * Creates a format initialized to the given name and version.
      * The given name should be a short name or abbreviation, for example "JPEG" or "GeoTIFF".
      *
-     * <p>This convenience constructor automatically sets a format specification title for some well-known values.
-     * The currently recognized list of format names is given below. This list may be expanded in any future SIS
-     * version.</p>
-     *
-     * <table class="sis">
-     *   <caption>Specification titles for well-known format names</caption>
-     *   <tr><th>Name</th>    <th>Specification title</th></tr>
-     *   <tr><td>CSV</td>     <td>Common Format and MIME Type for Comma-Separated Values (CSV) Files</td></tr>
-     *   <tr><td>GeoTIFF</td> <td>GeoTIFF Coverage Encoding Profile</td></tr>
-     *   <tr><td>NetCDF</td>  <td>NetCDF Classic and 64-bit Offset Format</td></tr>
-     *   <tr><td>PNG</td>     <td>PNG (Portable Network Graphics) Specification</td></tr>
-     * </table>
-     *
      * @param  name     the abbreviated name of the data transfer format, or {@code null}.
      * @param  version  the version of the format (date, number, <i>etc.</i>), or {@code null}.
+     *
+     * @deprecated This constructor had a straightforward meaning in ISO 19115:2003, but became confusing
+     *             with the ISO 19115:2014 update because of differences in the {@code Format} model.
+     *             Consider using {@link org.apache.sis.metadata.sql.MetadataSource#lookup(Class, String)} instead.
      */
+    @Deprecated
     public DefaultFormat(CharSequence name, final CharSequence version) {
-        if (name != null || version != null) {
-            final DefaultCitation citation = new DefaultCitation();
-            if (name != null) {
-                /*
-                 * TODO: move the following hard-coded values in a database
-                 * after we ported the org.apache.sis.metadata.sql package.
-                 */
-                String title = null;
-                final String keyword = name.toString();
-                if (keyword.equalsIgnoreCase("GeoTIFF")) {
-                    title = "GeoTIFF Coverage Encoding Profile";
-                } else if (keyword.equalsIgnoreCase("NetCDF")) {
-                    title = "NetCDF Classic and 64-bit Offset Format";
-                } else if (keyword.equalsIgnoreCase("PNG")) {
-                    title = "PNG (Portable Network Graphics) Specification";
-                } else if (keyword.equalsIgnoreCase("CSV")) {
-                    title = "Common Format and MIME Type for Comma-Separated Values (CSV) Files";
-                } else if (keyword.equalsIgnoreCase("CSV/MF")) {    // Not yet documented format.
-                    title = "OGC Moving Features Encoding Extension: Simple Comma-Separated Values (CSV)";
-                    name  = "CSV";
-                }
-                citation.setTitle(Types.toInternationalString(title));
-                citation.setAlternateTitles(Collections.singleton(Types.toInternationalString(name)));
-            }
-            citation.setEdition(Types.toInternationalString(version));
-            formatSpecificationCitation = citation;
+        final DefaultCitation citation = new DefaultCitation();
+        if (name != null) {
+            citation.setAlternateTitles(Collections.singleton(Types.toInternationalString(name)));
         }
+        citation.setEdition(Types.toInternationalString(version));
+        formatSpecificationCitation = citation;
     }
 
     /**

Added: sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/sql/MetadataResult.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/sql/MetadataResult.java?rev=1770274&view=auto
==============================================================================
--- sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/sql/MetadataResult.java (added)
+++ sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/sql/MetadataResult.java [UTF-8] Thu Nov 17 20:14:36 2016
@@ -0,0 +1,193 @@
+/*
+ * 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.metadata.sql;
+
+import java.util.Locale;
+import java.util.logging.Level;
+import java.util.logging.LogRecord;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import org.apache.sis.util.resources.Errors;
+import org.apache.sis.util.logging.WarningListeners;
+import org.apache.sis.internal.system.Loggers;
+
+
+/**
+ * The result of a query for metadata attributes. This object {@linkplain PreparedStatement prepares a statement}
+ * once for ever for a given table. When a particular record in this table is fetched, the {@link ResultSet} is
+ * automatically constructed. If many attributes are fetched consecutively for the same record, then the same
+ * {@link ResultSet} is reused.
+ *
+ * <div class="section"><b>Synchronization</b>:
+ * This class is <strong>not</strong> thread-safe. Callers must perform their own synchronization in such a way
+ * that only one query is executed on the same connection (JDBC connections can not be assumed thread-safe).
+ * The synchronization block shall be the {@link Tables} which contain this entry.</div>
+ *
+ * <div class="section"><b>Closing</b>:
+ * This class does not implement {@link java.lang.AutoCloseable} because it is typically closed by a different
+ * thread than the one that created the {@code MetadataResult} instance. This object is closed by a background
+ * thread of {@link Tables}.</div>
+ *
+ * @author  Martin Desruisseaux (IRD, Geomatys)
+ * @since   0.8
+ * @version 0.8
+ * @module
+ */
+final class MetadataResult {
+    /**
+     * The implemented interface, used for formatting error messages.
+     */
+    private final Class<?> type;
+
+    /**
+     * The statement associated with this entry.
+     * This is the statement given to the constructor.
+     */
+    private final PreparedStatement statement;
+
+    /**
+     * The results, or {@code null} if not yet determined.
+     */
+    private ResultSet results;
+
+    /**
+     * The identifier (usually the primary key) for current results. If the record to fetch does not
+     * have the same identifier, then the {@link #results} will need to be closed and reconstructed.
+     */
+    private String identifier;
+
+    /**
+     * The expiration time of this result. This is read and updated by {@link Tables} only.
+     */
+    long expireTime;
+
+    /**
+     * Where to report the warnings. This is not necessarily a logger, since users can register listeners.
+     */
+    private final WarningListeners<MetadataSource> listeners;
+
+    /**
+     * Constructs a metadata result from the specified connection.
+     *
+     * @param type       the GeoAPI interface to implement.
+     * @param statement  the prepared statement.
+     * @param listeners  where to report the warnings.
+     */
+    MetadataResult(final Class<?> type, final PreparedStatement statement,
+            final WarningListeners<MetadataSource> listeners)
+    {
+        this.type      = type;
+        this.statement = statement;
+        this.listeners = listeners;
+    }
+
+    /**
+     * Returns the attribute value in the given column for the given record.
+     *
+     * @param  id         the object identifier, usually the primary key value.
+     * @param  attribute  the column name of the attribute to fetch.
+     * @return the value of the requested attribute for the row identified by the given key.
+     * @throws SQLException if an SQL operation failed.
+     * @throws MetadataStoreException if no record has been found for the given key.
+     */
+    Object getValue(final String id, final String attribute) throws SQLException, MetadataStoreException {
+        if (!id.equals(identifier)) {
+            closeResultSet();
+        }
+        ResultSet r = results;
+        if (r == null) {
+            statement.setString(1, id);
+            r = statement.executeQuery();
+            if (!r.next()) {
+                final String table = r.getMetaData().getTableName(1);
+                r.close();
+                throw new SQLException(Errors.format(Errors.Keys.RecordNotFound_2, table, id));
+            }
+            results = r;
+            identifier = id;
+        }
+        return r.getObject(attribute);
+    }
+
+    /**
+     * Closes the current {@link ResultSet}. Before doing so, we make an opportunist check for duplicated values
+     * in the table. If a duplicate is found, a warning is logged. The log message pretends to be emitted by the
+     * interface constructor, which does not exist. But this is the closest we can get from a public API.
+     */
+    private void closeResultSet() throws SQLException {
+        final ResultSet r = results;
+        results = null;               // Make sure that this field is cleared even if an exception occurs below.
+        if (r != null) {
+            final boolean hasNext = r.next();
+            r.close();
+            if (hasNext) {
+                warning(type, "<init>", Errors.getResources((Locale) null).getLogRecord(
+                        Level.WARNING, Errors.Keys.DuplicatedIdentifier_1, identifier));
+            }
+            identifier = null;
+        }
+    }
+
+    /**
+     * Closes the statement and free all resources.
+     * After this method has been invoked, this object can not be used anymore.
+     *
+     * <p>This method is usually not invoked by the method or thread that created the
+     * {@code StatementEntry} instance. It is invoked by {@link Tables#close()} instead.</p>
+     *
+     * @throws SQLException if an error occurred while closing the statement.
+     */
+    void close() throws SQLException {
+        closeResultSet();
+        statement.close();
+    }
+
+    /**
+     * Closes the statement and free all resources. In case of failure while closing JDBC objects,
+     * the message is logged but the process continue since we are not supposed to use the statement anymore.
+     * This method is invoked from other methods that can not throws an SQL exception.
+     */
+    void closeQuietly() {
+        try {
+            close();
+        } catch (Exception e) {
+            /*
+             * Catch Exception rather than SQLException because this method is invoked from semi-critical code
+             * which need to never fail, otherwise some memory leak could occur. Pretend that the message come
+             * from PreparedStatement.close(), which is the closest we can get to a public API.
+             */
+            final LogRecord record = new LogRecord(Level.WARNING, e.toString());
+            record.setThrown(e);
+            warning(PreparedStatement.class, "close", record);
+        }
+    }
+
+    /**
+     * Reports a warning.
+     *
+     * @param source  the class to report as the warning emitter.
+     * @param method  the method to report as the warning emitter.
+     * @param record  the warning to report.
+     */
+    private void warning(final Class<?> source, final String method, final LogRecord record) {
+        record.setSourceClassName(source.getCanonicalName());
+        record.setSourceMethodName(method);
+        record.setLoggerName(Loggers.SQL);
+        listeners.warning(record);
+    }
+}

Propchange: sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/sql/MetadataResult.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/sql/MetadataResult.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain;charset=UTF-8

Added: sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/sql/MetadataSource.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/sql/MetadataSource.java?rev=1770274&view=auto
==============================================================================
--- sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/sql/MetadataSource.java (added)
+++ sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/sql/MetadataSource.java [UTF-8] Thu Nov 17 20:14:36 2016
@@ -0,0 +1,179 @@
+/*
+ * 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.metadata.sql;
+
+import java.util.Set;
+import java.util.Map;
+import java.util.HashMap;
+import java.util.Collections;
+import java.sql.SQLException;
+import javax.sql.DataSource;
+import org.opengis.metadata.distribution.Format;
+import org.apache.sis.metadata.MetadataStandard;
+import org.apache.sis.metadata.iso.citation.DefaultCitation;
+import org.apache.sis.metadata.iso.distribution.DefaultFormat;
+import org.apache.sis.internal.system.Modules;
+import org.apache.sis.internal.system.SystemListener;
+import org.apache.sis.internal.metadata.sql.Initializer;
+import org.apache.sis.util.resources.Errors;
+import org.apache.sis.util.ArgumentChecks;
+import org.apache.sis.util.iso.Types;
+
+
+/**
+ * A connection to a metadata database in read-only mode. The database must have a schema of the given name
+ * ({@code "metadata"} in the example below). Existing entries can be obtained as in the example below:
+ *
+ * {@preformat java
+ *   DataSource     source     = ... // This is database-specific.
+ *   MetadataSource source     = new MetadataSource(MetadataStandard.ISO_19115, source, "metadata");
+ *   Telephone      telephone  = source.lookup(Telephone.class, id);
+ * }
+ *
+ * where {@code id} is the primary key value for the desired record in the {@code CI_Telephone} table.
+ *
+ * <div class="section">Concurrency</div>
+ * {@code MetadataSource} is thread-safe but is not concurrent. If concurrency is desired,
+ * multiple instances of {@code MetadataSource} can be created for the same {@link DataSource}.
+ * The {@link #MetadataSource(MetadataSource)} convenience constructor can be used for this purpose.
+ *
+ * @author  Touraïvane (IRD)
+ * @author  Martin Desruisseaux (IRD, Geomatys)
+ * @since   0.8
+ * @version 0.8
+ * @module
+ */
+public class MetadataSource {
+    /**
+     * The column name used for the identifiers. We do not quote this identifier;
+     * we will let the database uses its own convention.
+     */
+    static final String ID_COLUMN = "ID";
+
+    /**
+     * The metadata standard to be used for constructing the database schema.
+     */
+    protected final MetadataStandard standard;
+
+    /**
+     * The catalog, set to {@code null} for now. This is defined as a constant in order to make easier
+     * to spot the places where catalog would be used, if we want to use it in a future version.
+     */
+    static final String CATALOG = null;
+
+    /**
+     * The schema where metadata are stored, or {@code null} if none.
+     */
+    final String schema;
+
+    /**
+     * The tables which have been queried or created up to date.
+     * Keys are table names and values are the columns defined for that table.
+     */
+    private final Map<String, Set<String>> tables;
+
+    /**
+     * The default instance, created when first needed and cleared when the classpath change.
+     */
+    private static volatile MetadataSource instance;
+    static {
+        SystemListener.add(new SystemListener(Modules.METADATA) {
+            @Override protected void classpathChanged() {
+                instance = null;
+            }
+        });
+    }
+
+    /**
+     * Returns the metadata source connected to the {@code "jdbc/SpatialMetadata"} database.
+     * In a default Apache SIS installation, this metadata source contains pre-defined records
+     * for some commonly used {@linkplain org.apache.sis.metadata.iso.citation.DefaultCitation
+     * citations} and {@linkplain org.apache.sis.metadata.iso.distribution.DefaultFormat formats}
+     * among others.
+     *
+     * @return source of pre-defined metadata records from the {@code "jdbc/SpatialMetadata"} database.
+     * @throws MetadataStoreException if this method can not connect to the database.
+     */
+    public static MetadataSource getDefault() throws MetadataStoreException {
+        MetadataSource ms = instance;
+        if (ms == null) try {
+            final DataSource dataSource = Initializer.getDataSource();
+            if (dataSource == null) {
+                throw new MetadataStoreException(Initializer.unspecified(null));
+            }
+            synchronized (MetadataSource.class) {
+                ms = instance;
+                if (ms == null) {
+                    instance = ms = new MetadataSource(MetadataStandard.ISO_19115, dataSource, "metadata");
+                }
+            }
+        } catch (MetadataStoreException e) {
+            throw e;
+        } catch (Exception e) {
+            throw new MetadataStoreException(Errors.format(Errors.Keys.CanNotConnectTo_1, Initializer.JNDI), e);
+        }
+        return ms;
+    }
+
+    /**
+     * Creates a new metadata source.
+     *
+     * @param  standard    the metadata standard to implement.
+     * @param  dataSource  the source for getting a connection to the database.
+     * @param  schema      the schema were metadata are expected to be found, or {@code null} if none.
+     * @throws SQLException if the connection to the given database can not be established.
+     */
+    public MetadataSource(final MetadataStandard standard, final DataSource dataSource, final String schema)
+            throws SQLException
+    {
+        ArgumentChecks.ensureNonNull("standard",   standard);
+        ArgumentChecks.ensureNonNull("dataSource", dataSource);
+        this.standard = standard;
+        this.schema   = schema;
+        this.tables   = new HashMap<>();
+        // TODO
+    }
+
+    /**
+     * Temporary place-holder for a method to be developed later.
+     */
+    public <T> T lookup(final Class<T> type, String identifier) throws MetadataStoreException {
+        if (type == Format.class) {
+            final DefaultCitation spec = new DefaultCitation();
+            /*
+             * TODO: move the following hard-coded values in a database
+             * after we ported the org.apache.sis.metadata.sql package.
+             */
+            String title = null;
+            switch (identifier) {
+                case "GeoTIFF": title = "GeoTIFF Coverage Encoding Profile"; break;
+                case "NetCDF":  title = "NetCDF Classic and 64-bit Offset Format"; break;
+                case "PNG":     title = "PNG (Portable Network Graphics) Specification"; break;
+                case "CSV":     title = "Common Format and MIME Type for Comma-Separated Values (CSV) Files"; break;
+                case "CSV/MF":  title = "OGC Moving Features Encoding Extension: Simple Comma-Separated Values (CSV)";
+                                identifier  = "CSV";      // "CSV/MF" is not yet a documented format.
+                                break;
+            }
+            spec.setTitle(Types.toInternationalString(title));
+            spec.setAlternateTitles(Collections.singleton(Types.toInternationalString(identifier)));
+            final DefaultFormat format = new DefaultFormat();
+            format.setFormatSpecificationCitation(spec);
+            return (T) format;
+        }
+        return null;
+    }
+}

Propchange: sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/sql/MetadataSource.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/sql/MetadataSource.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain;charset=UTF-8

Added: sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/sql/MetadataStoreException.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/sql/MetadataStoreException.java?rev=1770274&view=auto
==============================================================================
--- sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/sql/MetadataStoreException.java (added)
+++ sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/sql/MetadataStoreException.java [UTF-8] Thu Nov 17 20:14:36 2016
@@ -0,0 +1,56 @@
+/*
+ * 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.metadata.sql;
+
+import org.opengis.util.FactoryException;
+
+
+/**
+ * Throws when a metadata access failed.
+ * The cause for this exception is typically a {@link java.sql.SQLException}.
+ *
+ * @author  Touraïvane (IRD)
+ * @author  Martin Desruisseaux (IRD, Geomatys)
+ * @since   0.8
+ * @version 0.8
+ * @module
+ */
+public class MetadataStoreException extends FactoryException {
+    /**
+     * For cross-version compatibility.
+     */
+    private static final long serialVersionUID = -7156617726114815455L;
+
+    /**
+     * Creates an instance of {@code MetadataException} with the specified detail message.
+     *
+     * @param message  the detail message.
+     */
+    public MetadataStoreException(final String message) {
+        super(message);
+    }
+
+    /**
+     * Creates an instance of {@code MetadataException} with the specified message and cause.
+     *
+     * @param message  the detail message.
+     * @param cause    the cause of this exception.
+     */
+    public MetadataStoreException(final String message, final Exception cause) {
+        super(message, cause);
+    }
+}

Propchange: sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/sql/MetadataStoreException.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/sql/MetadataStoreException.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain;charset=UTF-8

Added: sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/sql/package-info.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/sql/package-info.java?rev=1770274&view=auto
==============================================================================
--- sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/sql/package-info.java (added)
+++ sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/sql/package-info.java [UTF-8] Thu Nov 17 20:14:36 2016
@@ -0,0 +1,49 @@
+/*
+ * 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.
+ */
+
+/**
+ * An implementation of {@linkplain org.opengis.metadata.Metadata Metadata} interfaces
+ * fetching the data from an SQL database. Each metadata class is mapped to a table,
+ * and each metadata property is mapped to a column in the table corresponding to the class.
+ * Tables and columns are created only when first needed.
+ *
+ * <p>This package is not a replacement for more sophisticated metadata applications.
+ * This package provides only a direct mapping from metadata <i>interfaces</i> and <i>methods</i>
+ * to database <i>tables</i> and <i>columns</i> with limited capability.
+ * This is suitable only for applications wanting a simple metadata schema.
+ * The restrictions are:</p>
+ *
+ * <ul>
+ *   <li>Interfaces and methods must have {@link org.opengis.annotation.UML} annotations.</li>
+ *   <li>Collections are not currently supported (only the first element is stored).</li>
+ *   <li>{@link org.opengis.util.InternationalString} are stored only for the default locale.</li>
+ *   <li>Cyclic graph (<var>A</var> references <var>B</var> which reference <var>A</var>) are not supported,
+ *       unless foreigner key constraints are manually disabled for the columns which contain the cyclic references.</li>
+ *   <li>Metadata that are sub-interface of other metadata (for example
+ *       {@link org.opengis.metadata.extent.GeographicDescription} which extends
+ *       {@link org.opengis.metadata.extent.GeographicExtent}) can be stored only
+ *       in databases supporting <cite>table inheritance</cite>, like
+ *       <a href="http://www.postgresql.org">PostgreSQL</a>.</li>
+ * </ul>
+ *
+ * @author  Touraïvane (IRD)
+ * @author  Martin Desruisseaux (IRD, Geomatys)
+ * @since   0.8
+ * @version 0.8
+ * @module
+ */
+package org.apache.sis.metadata.sql;

Propchange: sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/sql/package-info.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/sql/package-info.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain;charset=UTF-8

Modified: sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/test/integration/MetadataTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/test/integration/MetadataTest.java?rev=1770274&r1=1770273&r2=1770274&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/test/integration/MetadataTest.java [UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/test/integration/MetadataTest.java [UTF-8] Thu Nov 17 20:14:36 2016
@@ -347,12 +347,17 @@ public strictfp class MetadataTest exten
             final DefaultDistribution distributionInfo = new DefaultDistribution();
             distributor.setRole(Role.DISTRIBUTOR);
             distributionInfo.setDistributors(singleton(new DefaultDistributor(distributor)));
-            distributionInfo.setDistributionFormats(singleton(new DefaultFormat(
-                    new Anchor(URI.create("SDN:L241:1:MEDATLAS"), "MEDATLAS ASCII"), "1.0")));
+
+            final DefaultFormat format = new DefaultFormat();
+            final DefaultCitation specification = new DefaultCitation();
+            specification.setAlternateTitles(singleton(new Anchor(URI.create("SDN:L241:1:MEDATLAS"), "MEDATLAS ASCII")));
+            specification.setEdition(new SimpleInternationalString("1.0"));
+            format.setFormatSpecificationCitation(specification);
+            distributionInfo.setDistributionFormats(singleton(format));
+
             final DefaultDigitalTransferOptions transfer = new DefaultDigitalTransferOptions();
             transfer.setTransferSize(2.431640625);
-            final DefaultOnlineResource onlines = new DefaultOnlineResource(URI.create(
-                    "http://www.ifremer.fr/data/something"));
+            final DefaultOnlineResource onlines = new DefaultOnlineResource(URI.create("http://www.ifremer.fr/data/something"));
             onlines.setDescription(new SimpleInternationalString("CTDF02"));
             onlines.setFunction(OnLineFunction.DOWNLOAD);
             onlines.setProtocol("http");

Modified: sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/util/logging/WarningListeners.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/util/logging/WarningListeners.java?rev=1770274&r1=1770273&r2=1770274&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/util/logging/WarningListeners.java [UTF-8] (original)
+++ sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/util/logging/WarningListeners.java [UTF-8] Thu Nov 17 20:14:36 2016
@@ -46,7 +46,7 @@ import org.apache.sis.util.resources.Err
  * on the part of the caller. Subclasses should make sure that any overridden methods remain safe to call
  * from multiple threads.
  *
- * @param <S> The type of the source of warnings.
+ * @param  <S>  the type of the source of warnings.
  *
  * @author  Martin Desruisseaux (Geomatys)
  * @since   0.3

Modified: sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.java?rev=1770274&r1=1770273&r2=1770274&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.java [UTF-8] (original)
+++ sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.java [UTF-8] Thu Nov 17 20:14:36 2016
@@ -670,6 +670,11 @@ public final class Errors extends Indexe
         public static final short RecordAlreadyDefined_2 = 116;
 
         /**
+         * No record found in “{0}” table for “{1}” key.
+         */
+        public static final short RecordNotFound_2 = 164;
+
+        /**
          * Recursive call while creating an object for the “{0}” key.
          */
         public static final short RecursiveCreateCallForKey_1 = 117;

Modified: sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.properties
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.properties?rev=1770274&r1=1770273&r2=1770274&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.properties [ISO-8859-1] (original)
+++ sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.properties [ISO-8859-1] Thu Nov 17 20:14:36 2016
@@ -145,6 +145,7 @@ OddArrayLength_1                  = Arra
 OutsideDomainOfValidity           = Coordinate is outside the domain of validity.
 PropertyNotFound_2                = No property named \u201c{1}\u201d has been found in \u201c{0}\u201d.
 RecordAlreadyDefined_2            = Record \u201c{1}\u201d is already defined in schema \u201c{0}\u201d.
+RecordNotFound_2                  = No record found in \u201c{0}\u201d table for \u201c{1}\u201d key.
 RecursiveCreateCallForKey_1       = Recursive call while creating an object for the \u201c{0}\u201d key.
 RequireDecimalSeparator           = A decimal separator is required.
 StalledThread_1                   = Thread \u201c{0}\u201d seems stalled.

Modified: sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors_fr.properties
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors_fr.properties?rev=1770274&r1=1770273&r2=1770274&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors_fr.properties [ISO-8859-1] (original)
+++ sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors_fr.properties [ISO-8859-1] Thu Nov 17 20:14:36 2016
@@ -141,6 +141,7 @@ OddArrayLength_1                  = La l
 OutsideDomainOfValidity           = La coordonn\u00e9e est en dehors du domaine de validit\u00e9.
 PropertyNotFound_2                = Aucune propri\u00e9t\u00e9 nomm\u00e9e \u00ab\u202f{1}\u202f\u00bb n\u2019a \u00e9t\u00e9 trouv\u00e9e dans \u00ab\u202f{0}\u202f\u00bb.
 RecordAlreadyDefined_2            = L\u2019enregistrement \u00ab\u202f{1}\u202f\u00bb est d\u00e9j\u00e0 d\u00e9finit dans le sch\u00e9ma \u00ab\u202f{0}\u202f\u00bb.
+RecordNotFound_2                  = Aucune entr\u00e9e n\u2019a \u00e9t\u00e9 trouv\u00e9e dans la table \u00ab\u202f{0}\u202f\u00bb pour la cl\u00e9 \u00ab\u202f{1}\u202f\u00bb.
 RecursiveCreateCallForKey_1       = Appel r\u00e9cursif lors de la cr\u00e9ation d\u2019un objet pour la cl\u00e9 \u00ab\u202f{0}\u202f\u00bb.
 RequireDecimalSeparator           = Un s\u00e9parateur d\u00e9cimal est requis.
 StalledThread_1                   = La t\u00e2che \u00ab\u202f{0}\u202f\u00bb semble bloqu\u00e9e.

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=1770274&r1=1770273&r2=1770274&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] Thu Nov 17 20:14:36 2016
@@ -47,6 +47,7 @@ import org.apache.sis.metadata.iso.citat
 import org.apache.sis.metadata.iso.content.DefaultAttributeGroup;
 import org.apache.sis.metadata.iso.content.DefaultBand;
 import org.apache.sis.metadata.iso.content.DefaultCoverageDescription;
+import org.apache.sis.metadata.sql.MetadataStoreException;
 import org.apache.sis.referencing.CRS;
 import org.apache.sis.referencing.CommonCRS;
 import org.apache.sis.storage.DataStoreException;
@@ -413,15 +414,15 @@ final class LandsatReader {
      * Invoked for every key-value pairs found in the file.
      * Leading and trailing spaces, if any, have been removed.
      *
-     * @param  key     the key in upper cases.
-     * @param  band    the band number, or 0 if none.
-     * @param  value   the value, without quotes if those quotes existed.
+     * @param  key    the key in upper cases.
+     * @param  band   the band number, or 0 if none.
+     * @param  value  the value, without quotes if those quotes existed.
      * @throws NumberFormatException if the value was expected to be a string but the parsing failed.
      * @throws DateTimeException if the value was expected to be a date but the parsing failed,
      *         or if the result of the parsing was not of the expected type.
      * @throws IllegalArgumentException if the value is out of range.
      */
-    private void parseKeyValuePair(final String key, final int band, final String value)
+    private void parseKeyValuePair(final String key, final int band, String value)
             throws IllegalArgumentException, DateTimeException, DataStoreException
     {
         switch (key) {
@@ -510,7 +511,14 @@ final class LandsatReader {
              * Value is "GEOTIFF".
              */
             case "OUTPUT_FORMAT": {
-                metadata.addFormat(value);
+                if ("GeoTIFF".equalsIgnoreCase(value)) {
+                    value = "GeoTIFF";                      // Because 'metadata.setFormat(…)' is case-sensitive.
+                }
+                try {
+                    metadata.setFormat(value);
+                } catch (MetadataStoreException e) {
+                    warning(key, null, e);
+                }
                 break;
             }
             /*
@@ -882,7 +890,7 @@ final class LandsatReader {
      */
     final Metadata getMetadata() throws FactoryException {
         metadata.add(Locale.ENGLISH);
-        metadata.add(ScopeCode.DATASET);
+        metadata.add(ScopeCode.COVERAGE);
         try {
             flushSceneTime();
         } catch (DateTimeException e) {

Modified: sis/branches/JDK8/storage/sis-earth-observation/src/test/java/org/apache/sis/storage/earthobservation/LandsatReaderTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/storage/sis-earth-observation/src/test/java/org/apache/sis/storage/earthobservation/LandsatReaderTest.java?rev=1770274&r1=1770273&r2=1770274&view=diff
==============================================================================
--- sis/branches/JDK8/storage/sis-earth-observation/src/test/java/org/apache/sis/storage/earthobservation/LandsatReaderTest.java [UTF-8] (original)
+++ sis/branches/JDK8/storage/sis-earth-observation/src/test/java/org/apache/sis/storage/earthobservation/LandsatReaderTest.java [UTF-8] Thu Nov 17 20:14:36 2016
@@ -95,7 +95,7 @@ public class LandsatReaderTest extends T
         assertMultilinesEquals(
                 "Metadata\n"
                 + "  ├─Language…………………………………………………………………………………………… en\n"
-                + "  ├─Spatial representation info (1 of 3)\n"
+                + "  ├─Spatial representation info (1 of 2)\n"
                 + "  │   ├─Number of dimensions………………………………………………… 2\n"
                 + "  │   ├─Axis dimension properties (1 of 2)\n"
                 + "  │   │   ├─Dimension name……………………………………………………… Sample\n"
@@ -104,16 +104,7 @@ public class LandsatReaderTest extends T
                 + "  │   │   ├─Dimension name……………………………………………………… Line\n"
                 + "  │   │   └─Dimension size……………………………………………………… 15500\n"
                 + "  │   └─Transformation parameter availability…… false\n"
-                + "  ├─Spatial representation info (2 of 3)\n"
-                + "  │   ├─Number of dimensions………………………………………………… 2\n"
-                + "  │   ├─Axis dimension properties (1 of 2)\n"
-                + "  │   │   ├─Dimension name……………………………………………………… Sample\n"
-                + "  │   │   └─Dimension size……………………………………………………… 7600\n"
-                + "  │   ├─Axis dimension properties (2 of 2)\n"
-                + "  │   │   ├─Dimension name……………………………………………………… Line\n"
-                + "  │   │   └─Dimension size……………………………………………………… 7800\n"
-                + "  │   └─Transformation parameter availability…… false\n"
-                + "  ├─Spatial representation info (3 of 3)\n"
+                + "  ├─Spatial representation info (2 of 2)\n"
                 + "  │   ├─Number of dimensions………………………………………………… 2\n"
                 + "  │   ├─Axis dimension properties (1 of 2)\n"
                 + "  │   │   ├─Dimension name……………………………………………………… Sample\n"
@@ -134,7 +125,7 @@ public class LandsatReaderTest extends T
                 + "  │   ├─Resource format\n"
                 + "  │   │   └─Format specification citation\n"
                 + "  │   │       ├─Title…………………………………………………………………… GeoTIFF Coverage Encoding Profile\n"
-                + "  │   │       └─Alternate title………………………………………… GEOTIFF\n"
+                + "  │   │       └─Alternate title………………………………………… GeoTIFF\n"
                 + "  │   ├─Spatial resolution (1 of 2)\n"
                 + "  │   │   └─Distance……………………………………………………………………… 15.0\n"
                 + "  │   ├─Spatial resolution (2 of 2)\n"
@@ -297,7 +288,7 @@ public class LandsatReaderTest extends T
                 + "  │   ├─Date…………………………………………………………………………………………… 2016-06-27 16:48:12\n"
                 + "  │   └─Date type……………………………………………………………………………… Creation\n"
                 + "  ├─Metadata scope\n"
-                + "  │   └─Resource scope………………………………………………………………… Dataset\n"
+                + "  │   └─Resource scope………………………………………………………………… Coverage\n"
                 + "  ├─Metadata identifier\n"
                 + "  │   └─Code…………………………………………………………………………………………… LandsatTest\n"
                 + "  ├─Metadata standard (1 of 2)\n"

Modified: sis/branches/JDK8/storage/sis-geotiff/src/main/java/org/apache/sis/internal/geotiff/Resources.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/storage/sis-geotiff/src/main/java/org/apache/sis/internal/geotiff/Resources.java?rev=1770274&r1=1770273&r2=1770274&view=diff
==============================================================================
--- sis/branches/JDK8/storage/sis-geotiff/src/main/java/org/apache/sis/internal/geotiff/Resources.java [UTF-8] (original)
+++ sis/branches/JDK8/storage/sis-geotiff/src/main/java/org/apache/sis/internal/geotiff/Resources.java [UTF-8] Thu Nov 17 20:14:36 2016
@@ -109,8 +109,8 @@ public final class Resources extends Ind
         public static final short RandomizedProcessApplied = 8;
 
         /**
-         * The Geodetic CRS define into TIFF image from “{0}” is not Geographic.Try to rebuild a
-         * Geographic CRS from others defined components.
+         * The coordinate reference system defined in the “{0}” TIFF image is not geographic. A
+         * geographic system will be created from others components.
          */
         public static final short UnexpectedGeoCRS_1 = 11;
 

Modified: sis/branches/JDK8/storage/sis-geotiff/src/main/java/org/apache/sis/internal/geotiff/Resources.properties
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/storage/sis-geotiff/src/main/java/org/apache/sis/internal/geotiff/Resources.properties?rev=1770274&r1=1770273&r2=1770274&view=diff
==============================================================================
--- sis/branches/JDK8/storage/sis-geotiff/src/main/java/org/apache/sis/internal/geotiff/Resources.properties [ISO-8859-1] (original)
+++ sis/branches/JDK8/storage/sis-geotiff/src/main/java/org/apache/sis/internal/geotiff/Resources.properties [ISO-8859-1] Thu Nov 17 20:14:36 2016
@@ -28,6 +28,6 @@ InconsistentTileStrip_1           = TIFF
 MismatchedLength_4                = TIFF tags \u201c{0}\u201d and \u201c{1}\u201d have values of different lengths. Found \u201c{2}\u201d and \u201c{3}\u201d elements respectively.
 MissingValue_2                    = Can not read TIFF image from \u201c{0}\u201d because the \u201c{1}\u201d tag is missing.
 RandomizedProcessApplied          = A randomized process such as error diffusion has been applied to the image data.
+UnexpectedGeoCRS_1                = The coordinate reference system defined in the \u201c{0}\u201d TIFF image is not geographic. A geographic system will be created from others components.
 UnexpectedKeyValue_3              = Unexpected value for the \u201c{0}\u201d GeoTIFF key. Expected value {1} but found {2}.
 UnexpectedTileCount_3             = Found {2} tiles or strips in the \u201c{0}\u201d file while {1} were expected.
-UnexpectedGeoCRS_1                = The Geodetic CRS define into TIFF image from \u201c{0}\u201d is not Geographic.Try to rebuild a Geographic CRS from others defined components.

Modified: sis/branches/JDK8/storage/sis-geotiff/src/main/java/org/apache/sis/internal/geotiff/Resources_fr.properties
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/storage/sis-geotiff/src/main/java/org/apache/sis/internal/geotiff/Resources_fr.properties?rev=1770274&r1=1770273&r2=1770274&view=diff
==============================================================================
--- sis/branches/JDK8/storage/sis-geotiff/src/main/java/org/apache/sis/internal/geotiff/Resources_fr.properties [ISO-8859-1] (original)
+++ sis/branches/JDK8/storage/sis-geotiff/src/main/java/org/apache/sis/internal/geotiff/Resources_fr.properties [ISO-8859-1] Thu Nov 17 20:14:36 2016
@@ -33,6 +33,6 @@ InconsistentTileStrip_1           = L\u2
 MismatchedLength_4                = Les tags TIFF \u00ab\u202f{0}\u202f\u00bb et \u00ab\u202f{1}\u202f\u00bb contiennent des valeurs de longueurs diff\u00e9rentes. On a trouv\u00e9 {2} et {3} \u00e9l\u00e9ments respectivement.
 MissingValue_2                    = Ne peut pas lire l\u2019image TIFF provenant de \u00ab\u202f{0}\u202f\u00bb car le tag \u00ab\u202f{1}\u202f\u00bb est manquant.
 RandomizedProcessApplied          = Un processus randomis\u00e9 comme la diffusion d\u2019erreur a \u00e9t\u00e9 appliqu\u00e9.
+UnexpectedGeoCRS_1                = Le syst\u00e8me de r\u00e9f\u00e9rence des coordonn\u00e9es d\u00e9finit dans l\u2019image TIFF \u00ab\u202f{0}\u202f\u00bb n\u2019est pas de type g\u00e9ographique. Un syst\u00e8me g\u00e9ographique sera cr\u00e9\u00e9 \u00e0 partir des \u00e9l\u00e9ments existants.
 UnexpectedKeyValue_3              = Valeur innatendue pour la cl\u00e9 GeoTIFF \u00ab\u202f{0}\u202f\u00bb. La valeur attendue \u00e9tait {1}  mais la valeur trouv\u00e9e est {2}.
 UnexpectedTileCount_3             = {2} tuiles ont \u00e9t\u00e9 trouv\u00e9es dans le fichier \u00ab\u202f{0}\u202f\u00bb alors qu\u2019on en attendait {1}.
-UnexpectedGeoCRS_1                = Le CRS geographic d\u00e9finit dans l'image tiff suivante:  \u00ab\u202f{0}\u202f\u00bb  n'est pas de type Geographic. Un CRS g\u00e9ographic va \u00e9ssayer d'\u00eatre cr\u00e9er \u00e0 partir des \u00e9l\u00e9ments existants.

Modified: sis/branches/JDK8/storage/sis-geotiff/src/main/java/org/apache/sis/storage/geotiff/GeoTiffStore.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/storage/sis-geotiff/src/main/java/org/apache/sis/storage/geotiff/GeoTiffStore.java?rev=1770274&r1=1770273&r2=1770274&view=diff
==============================================================================
--- sis/branches/JDK8/storage/sis-geotiff/src/main/java/org/apache/sis/storage/geotiff/GeoTiffStore.java [UTF-8] (original)
+++ sis/branches/JDK8/storage/sis-geotiff/src/main/java/org/apache/sis/storage/geotiff/GeoTiffStore.java [UTF-8] Thu Nov 17 20:14:36 2016
@@ -23,12 +23,15 @@ import java.util.logging.LogRecord;
 import java.nio.charset.StandardCharsets;
 import org.opengis.util.FactoryException;
 import org.opengis.metadata.Metadata;
+import org.opengis.metadata.maintenance.ScopeCode;
 import org.apache.sis.setup.OptionKey;
 import org.apache.sis.storage.DataStore;
 import org.apache.sis.storage.StorageConnector;
 import org.apache.sis.storage.DataStoreException;
 import org.apache.sis.storage.DataStoreContentException;
 import org.apache.sis.internal.storage.ChannelDataInput;
+import org.apache.sis.internal.storage.MetadataBuilder;
+import org.apache.sis.metadata.sql.MetadataStoreException;
 import org.apache.sis.util.resources.Errors;
 import org.apache.sis.util.ArgumentChecks;
 import org.apache.sis.util.Classes;
@@ -97,24 +100,34 @@ public class GeoTiffStore extends DataSt
      */
     @Override
     public synchronized Metadata getMetadata() throws DataStoreException {
-        if (metadata == null) try {
-            int n = 0;
-            ImageFileDirectory dir;
+        if (metadata == null) {
+            final MetadataBuilder builder = reader.metadata;
+            try {
+                builder.setFormat("GeoTIFF");
+            } catch (MetadataStoreException e) {
+                warning(null, e);
+            }
+            builder.add(encoding);
+            builder.add(ScopeCode.COVERAGE);
             final Locale locale = getLocale();
-            while ((dir = reader.getImageFileDirectory(n++)) != null) {
-                dir.completeMetadata(reader.metadata, locale);
+            int n = 0;
+            try {
+                ImageFileDirectory dir;
+                while ((dir = reader.getImageFileDirectory(n++)) != null) {
+                    dir.completeMetadata(builder, locale);
+                }
+                /*
+                 * Add Coordinate Reference System built from GeoTIFF tags.  Note that the CRS may not exist,
+                 * in which case the CRS builder returns null. This is safe since all MetadataBuilder methods
+                 * ignore null values (a design choice because this pattern come very often).
+                 */
+                builder.add(reader.crsBuilder.build());
+                metadata = builder.build(true);
+            } catch (IOException e) {
+                throw new DataStoreException(reader.errors().getString(Errors.Keys.CanNotRead_1, reader.input.filename), e);
+            } catch (FactoryException | ArithmeticException e) {
+                throw new DataStoreContentException(reader.canNotDecode(), e);
             }
-            /*
-             * Add Coordinate Reference System built from GeoTIFF tags.  Note that the CRS may not exist,
-             * in which case the CRS builder returns null. This is safe since all MetadataBuilder methods
-             * ignore null values (a design choice because this pattern come very often).
-             */
-            reader.metadata.add(reader.crsBuilder.build());
-            metadata = reader.metadata.build(true);
-        } catch (IOException e) {
-            throw new DataStoreException(reader.errors().getString(Errors.Keys.CanNotRead_1, reader.input.filename), e);
-        } catch (FactoryException | ArithmeticException e) {
-            throw new DataStoreContentException(reader.canNotDecode(), e);
         }
         return metadata;
     }



Mime
View raw message