sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject [sis] 01/04: Remove the deprecated WarningListeners class and interface.
Date Thu, 12 Sep 2019 14:53:42 GMT
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 25e21ce4111c26c6245aee76758f9d7553d48121
Author: Martin Desruisseaux <martin.desruisseaux@geomatys.com>
AuthorDate: Thu Sep 12 14:21:00 2019 +0200

    Remove the deprecated WarningListeners class and interface.
---
 .../java/org/apache/sis/internal/jaxb/Context.java |  14 +-
 .../apache/sis/metadata/sql/CachedStatement.java   |  25 +-
 .../apache/sis/metadata/sql/MetadataFallback.java  |  15 -
 .../apache/sis/metadata/sql/MetadataSource.java    |  77 ++---
 .../org/apache/sis/metadata/sql/package-info.java  |   2 +-
 .../src/main/java/org/apache/sis/xml/Pooled.java   |  18 +-
 .../src/main/java/org/apache/sis/xml/XML.java      |  20 +-
 .../java/org/apache/sis/util/logging/Logging.java  |  28 +-
 .../apache/sis/util/logging/QuietLogRecord.java    |  73 ----
 .../apache/sis/util/logging/WarningListener.java   |  92 ------
 .../apache/sis/util/logging/WarningListeners.java  | 366 ---------------------
 .../org/apache/sis/util/logging/package-info.java  |   2 +-
 .../sis/internal/storage/io/ChannelFactory.java    |   8 +-
 .../apache/sis/storage/event/StoreListeners.java   |  58 +---
 .../org/apache/sis/storage/event/package-info.java |   2 +-
 .../internal/storage/xml/stream/StaxDataStore.java |   2 +-
 16 files changed, 99 insertions(+), 703 deletions(-)

diff --git a/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/Context.java b/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/Context.java
index a4af9cf..4483329 100644
--- a/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/Context.java
+++ b/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/Context.java
@@ -181,7 +181,7 @@ public final class Context extends MarshalContext {
     /**
      * The object to inform about warnings, or {@code null} if none.
      */
-    private final Filter warningListener;
+    private final Filter logFilter;
 
     /**
      * The {@code <gml:*PropertyType>} which is wrapping the {@code <gml:*Type>} object to (un)marshal, or
@@ -222,7 +222,7 @@ public final class Context extends MarshalContext {
      * @param  versionMetadata  the metadata version, or {@code null}.
      * @param  resolver         the resolver in use.
      * @param  converter        the converter in use.
-     * @param  warningListener  the object to inform about warnings.
+     * @param  logFilter        the object to inform about warnings.
      */
     @SuppressWarnings("ThisEscapedInObjectConstruction")
     public Context(int                      bitMasks,
@@ -233,7 +233,7 @@ public final class Context extends MarshalContext {
                    final Version            versionMetadata,
                    final ReferenceResolver  resolver,
                    final ValueConverter     converter,
-                   final Filter             warningListener)
+                   final Filter             logFilter)
     {
         if (versionMetadata != null && versionMetadata.compareTo(LegacyNamespaces.VERSION_2014) < 0) {
             bitMasks |= LEGACY_METADATA;
@@ -244,7 +244,7 @@ public final class Context extends MarshalContext {
         this.versionGML        = versionGML;
         this.resolver          = resolver;
         this.converter         = converter;
-        this.warningListener   = warningListener;
+        this.logFilter         = logFilter;
         this.identifiers       = new HashMap<>();
         this.identifiedObjects = new IdentityHashMap<>();
         if (locale != null) {
@@ -621,10 +621,10 @@ public final class Context extends MarshalContext {
         record.setSourceMethodName(method);
         record.setLoggerName(Loggers.XML);
         if (context != null) {
-            final Filter warningListener = context.warningListener;
-            if (warningListener != null) {
+            final Filter logFilter = context.logFilter;
+            if (logFilter != null) {
                 record.setThrown(exception);
-                if (!warningListener.isLoggable(record)) {
+                if (!logFilter.isLoggable(record)) {
                     return;
                 }
             }
diff --git a/core/sis-metadata/src/main/java/org/apache/sis/metadata/sql/CachedStatement.java b/core/sis-metadata/src/main/java/org/apache/sis/metadata/sql/CachedStatement.java
index 306dd04..6b35eb3 100644
--- a/core/sis-metadata/src/main/java/org/apache/sis/metadata/sql/CachedStatement.java
+++ b/core/sis-metadata/src/main/java/org/apache/sis/metadata/sql/CachedStatement.java
@@ -18,13 +18,15 @@ package org.apache.sis.metadata.sql;
 
 import java.util.Locale;
 import java.util.logging.Level;
+import java.util.logging.Filter;
+import java.util.logging.Logger;
 import java.util.logging.LogRecord;
 import java.sql.PreparedStatement;
 import java.sql.ResultSet;
 import java.sql.SQLException;
 import java.sql.Types;
+import org.apache.sis.util.logging.Logging;
 import org.apache.sis.util.resources.Errors;
-import org.apache.sis.util.logging.WarningListeners;
 import org.apache.sis.internal.system.Loggers;
 
 
@@ -51,6 +53,11 @@ import org.apache.sis.internal.system.Loggers;
  */
 final class CachedStatement implements AutoCloseable {
     /**
+     * Where to log warnings.
+     */
+    static final Logger LOGGER = Logging.getLogger(Loggers.SQL);
+
+    /**
      * The interface for which the prepared statement has been created.
      */
     final Class<?> type;
@@ -81,23 +88,21 @@ final class CachedStatement implements AutoCloseable {
     long expireTime;
 
     /**
-     * Where to report the warnings. This is not necessarily a logger, since users can register listeners.
+     * Where to report the warnings before to eventually log them.
      */
-    private final WarningListeners<MetadataSource> listeners;
+    private final Filter logFilter;
 
     /**
      * 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.
+     * @param logFilter  where to report the warnings.
      */
-    CachedStatement(final Class<?> type, final PreparedStatement statement,
-            final WarningListeners<MetadataSource> listeners)
-    {
+    CachedStatement(final Class<?> type, final PreparedStatement statement, final Filter logFilter) {
         this.type      = type;
         this.statement = statement;
-        this.listeners = listeners;
+        this.logFilter = logFilter;
     }
 
     /**
@@ -183,6 +188,8 @@ final class CachedStatement implements AutoCloseable {
         record.setSourceClassName(source.getCanonicalName());
         record.setSourceMethodName(method);
         record.setLoggerName(Loggers.SQL);
-        listeners.warning(record);
+        if (logFilter == null || logFilter.isLoggable(record)) {
+            LOGGER.log(record);
+        }
     }
 }
diff --git a/core/sis-metadata/src/main/java/org/apache/sis/metadata/sql/MetadataFallback.java b/core/sis-metadata/src/main/java/org/apache/sis/metadata/sql/MetadataFallback.java
index 87609ce..97f4de9 100644
--- a/core/sis-metadata/src/main/java/org/apache/sis/metadata/sql/MetadataFallback.java
+++ b/core/sis-metadata/src/main/java/org/apache/sis/metadata/sql/MetadataFallback.java
@@ -27,7 +27,6 @@ import org.apache.sis.metadata.iso.citation.DefaultResponsibility;
 import org.apache.sis.internal.util.Constants;
 import org.apache.sis.util.iso.Types;
 import org.apache.sis.util.ArgumentChecks;
-import org.apache.sis.util.logging.WarningListener;
 import org.apache.sis.xml.NilReason;
 
 import static java.util.Collections.singleton;
@@ -222,20 +221,6 @@ final class MetadataFallback extends MetadataSource {
      * Ignored.
      */
     @Override
-    public void addWarningListener(WarningListener<? super MetadataSource> listener) {
-    }
-
-    /**
-     * Ignored.
-     */
-    @Override
-    public void removeWarningListener(WarningListener<? super MetadataSource> listener) {
-    }
-
-    /**
-     * Ignored.
-     */
-    @Override
     public void close() {
     }
 }
diff --git a/core/sis-metadata/src/main/java/org/apache/sis/metadata/sql/MetadataSource.java b/core/sis-metadata/src/main/java/org/apache/sis/metadata/sql/MetadataSource.java
index 5e4a6c2..75f15b8 100644
--- a/core/sis-metadata/src/main/java/org/apache/sis/metadata/sql/MetadataSource.java
+++ b/core/sis-metadata/src/main/java/org/apache/sis/metadata/sql/MetadataSource.java
@@ -28,8 +28,8 @@ import java.util.Collections;
 import java.util.EnumSet;
 import java.util.Iterator;
 import java.util.Locale;
-import java.util.NoSuchElementException;
 import java.util.logging.Level;
+import java.util.logging.Filter;
 import java.util.logging.LogRecord;
 import java.lang.reflect.Array;
 import java.lang.reflect.Method;
@@ -65,8 +65,6 @@ import org.apache.sis.internal.util.UnmodifiableArrayList;
 import org.apache.sis.util.collection.Containers;
 import org.apache.sis.util.collection.CodeListSet;
 import org.apache.sis.util.collection.WeakValueHashMap;
-import org.apache.sis.util.logging.WarningListeners;
-import org.apache.sis.util.logging.WarningListener;
 import org.apache.sis.util.logging.Logging;
 import org.apache.sis.util.resources.Errors;
 import org.apache.sis.util.ArgumentChecks;
@@ -110,7 +108,7 @@ import org.apache.sis.util.iso.Types;
  *
  * @author  Touraïvane (IRD)
  * @author  Martin Desruisseaux (IRD, Geomatys)
- * @version 1.0
+ * @version 1.1
  * @since   0.8
  * @module
  */
@@ -262,11 +260,11 @@ public class MetadataSource implements AutoCloseable {
     private final ThreadLocal<LookupInfo> lastUsed;
 
     /**
-     * Where to report the warnings. This is not necessarily a logger, since users can register listeners.
+     * Where to report the warnings before to eventually log them.
      *
      * @see #readColumn(LookupInfo, Method, Dispatcher)
      */
-    private final WarningListeners<MetadataSource> listeners;
+    private volatile Filter logFilter;
 
     /**
      * Whether at least one {@link CloseTask} is scheduled for execution.
@@ -391,7 +389,6 @@ public class MetadataSource implements AutoCloseable {
         this.statements   = new CachedStatement[maxStatements - 1];
         this.tableColumns = new HashMap<>();
         this.pool         = new WeakValueHashMap<>(CacheKey.class);
-        this.listeners    = new WarningListeners<>(this);
         this.lastUsed     = ThreadLocal.withInitial(LookupInfo::new);
     }
 
@@ -401,9 +398,8 @@ public class MetadataSource implements AutoCloseable {
      * but will use their own {@link Connection}.
      * This constructor is useful when concurrency is desired.
      *
-     * <p>The new {@code MetadataSource} initially contains all {@linkplain #addWarningListener warning listeners}
-     * declared in the given {@code source}. But listeners added or removed in a {@code MetadataSource} after the
-     * construction will not impact the other {@code MetadataSource} instance.</p>
+     * <p>The new {@code MetadataSource} initially contains the {@linkplain #setWarningFilter warning filter}
+     * declared in the given {@code source}.</p>
      *
      * @param  source  the source from which to copy the configuration.
      */
@@ -419,7 +415,7 @@ public class MetadataSource implements AutoCloseable {
         classloader  = source.classloader;
         pool         = source.pool;
         lastUsed     = source.lastUsed;
-        listeners    = new WarningListeners<>(this, source.listeners);
+        logFilter    = source.logFilter;
     }
 
     /**
@@ -434,7 +430,6 @@ public class MetadataSource implements AutoCloseable {
         classloader  = getClass().getClassLoader();
         pool         = null;
         lastUsed     = null;
-        listeners    = null;
     }
 
     /**
@@ -940,7 +935,7 @@ public class MetadataSource implements AutoCloseable {
                     final String query = helper.clear().append("SELECT * FROM ")
                             .appendIdentifier(schema, tableName).append(" WHERE ")
                             .appendIdentifier(ID_COLUMN).append("=?").toString();
-                    result = new CachedStatement(type, connection().prepareStatement(query), listeners);
+                    result = new CachedStatement(type, connection().prepareStatement(query), logFilter);
                 }
                 value = result.getValue(toSearch.identifier, columnName);
                 isArray = (value instanceof java.sql.Array);
@@ -1073,56 +1068,44 @@ public class MetadataSource implements AutoCloseable {
         record.setSourceClassName(source.getCanonicalName());
         record.setSourceMethodName(method);
         record.setLoggerName(Loggers.SQL);
-        listeners.warning(record);
+        final Filter filter = logFilter;
+        if (filter == null || filter.isLoggable(record)) {
+            CachedStatement.LOGGER.log(record);
+        }
     }
 
     /**
-     * Adds a listener to be notified when a warning occurred while reading from or writing metadata.
+     * Sets a filter to be notified when a warning occurred while reading from or writing metadata.
      * When a warning occurs, there is a choice:
      *
      * <ul>
-     *   <li>If this metadata source has no warning listener, then the warning is logged at {@link Level#WARNING}.</li>
-     *   <li>If this metadata source has at least one warning listener, then all listeners are notified
-     *       and the warning is <strong>not</strong> logged by this metadata source instance.</li>
+     *   <li>If this metadata source has no warning filter, or if the filter returns {@code true},
+     *       then the warning is logged at {@link Level#WARNING}.</li>
+     *   <li>Otherwise the warning is not logged by this metadata source instance.
+     *       The filter implementation is free to keep a reference to the given record,
+     *       for example in order to display it in a graphical user interface.</li>
      * </ul>
      *
-     * Consider invoking this method in a {@code try} … {@code finally} block if the {@code MetadataSource}
-     * lifetime is longer than the listener lifetime, as below:
-     *
-     * {@preformat java
-     *     source.addWarningListener(listener);
-     *     try {
-     *         // Do some work...
-     *     } finally {
-     *         source.removeWarningListener(listener);
-     *     }
-     * }
-     *
-     * @param  listener  the listener to add.
-     * @throws IllegalArgumentException if the given listener is already registered in this metadata source.
+     * @param  filter  the filter to set, or {@code null} for removing the filter.
+     * @return the previous filter, or {@code null} if none.
      *
-     * @deprecated {@code WarningListener} to be replaced by {@link java.util.logging.Filter}.
+     * @since 1.1
      */
-    @Deprecated
-    public void addWarningListener(final WarningListener<? super MetadataSource> listener)
-            throws IllegalArgumentException
-    {
-        listeners.addWarningListener(listener);
+    public Filter setWarningFilter(final Filter filter) {
+        Filter p = logFilter;
+        logFilter = filter;
+        return p;
     }
 
     /**
-     * Removes a previously registered listener.
+     * Returns the current warning filter.
      *
-     * @param  listener  the listener to remove.
-     * @throws NoSuchElementException if the given listener is not registered in this metadata source.
+     * @return the current filter, or {@code null} if none.
      *
-     * @deprecated {@code WarningListener} to be replaced by {@link java.util.logging.Filter}.
+     * @since 1.1
      */
-    @Deprecated
-    public void removeWarningListener(final WarningListener<? super MetadataSource> listener)
-            throws NoSuchElementException
-    {
-        listeners.removeWarningListener(listener);
+    public Filter getWarningFilter() {
+        return logFilter;
     }
 
     /**
diff --git a/core/sis-metadata/src/main/java/org/apache/sis/metadata/sql/package-info.java b/core/sis-metadata/src/main/java/org/apache/sis/metadata/sql/package-info.java
index 14c2a0f..14e4bc0 100644
--- a/core/sis-metadata/src/main/java/org/apache/sis/metadata/sql/package-info.java
+++ b/core/sis-metadata/src/main/java/org/apache/sis/metadata/sql/package-info.java
@@ -42,7 +42,7 @@
  *
  * @author  Touraïvane (IRD)
  * @author  Martin Desruisseaux (IRD, Geomatys)
- * @version 1.0
+ * @version 1.1
  *
  * @see org.apache.sis.referencing.factory.sql
  *
diff --git a/core/sis-metadata/src/main/java/org/apache/sis/xml/Pooled.java b/core/sis-metadata/src/main/java/org/apache/sis/xml/Pooled.java
index 4d0bcef..c06fb65 100644
--- a/core/sis-metadata/src/main/java/org/apache/sis/xml/Pooled.java
+++ b/core/sis-metadata/src/main/java/org/apache/sis/xml/Pooled.java
@@ -36,7 +36,6 @@ import org.apache.sis.util.Version;
 import org.apache.sis.util.ArraysExt;
 import org.apache.sis.util.CharSequences;
 import org.apache.sis.util.resources.Errors;
-import org.apache.sis.util.logging.WarningListener;
 import org.apache.sis.internal.util.CollectionsExt;
 import org.apache.sis.internal.util.Strings;
 import org.apache.sis.internal.jaxb.Context;
@@ -53,7 +52,7 @@ import org.apache.sis.internal.jaxb.TypeRegistration;
  *
  * @author  Martin Desruisseaux (Geomatys)
  * @author  Cullen Rombach (Image Matters)
- * @version 1.0
+ * @version 1.1
  * @since   0.3
  * @module
  */
@@ -154,7 +153,7 @@ abstract class Pooled {
     /**
      * The object to inform about warnings, or {@code null} if none.
      */
-    private Filter warningListener;
+    private Filter logFilter;
 
     /**
      * The {@link System#nanoTime()} value of the last call to {@link #reset(Pooled)}.
@@ -223,7 +222,7 @@ abstract class Pooled {
         resolver         = template.resolver;
         converter        = template.converter;
         rootAdapters     = template.rootAdapters;
-        warningListener  = template.warningListener;
+        logFilter        = template.logFilter;
         resetTime        = System.nanoTime();
         if (this instanceof Marshaller) {
             bitMasks |= Context.MARSHALLING;
@@ -380,11 +379,7 @@ abstract class Pooled {
                     return;
                 }
                 case XML.WARNING_FILTER: {
-                    warningListener = (Filter) value;
-                    return;
-                }
-                case XML.WARNING_LISTENER: {
-                    warningListener = ((WarningListener<?>) value).asFilter();
+                    logFilter = (Filter) value;
                     return;
                 }
                 case TypeRegistration.ROOT_ADAPTERS: {
@@ -425,8 +420,7 @@ abstract class Pooled {
             case XML.METADATA_VERSION:  return versionMetadata;
             case XML.RESOLVER:          return resolver;
             case XML.CONVERTER:         return converter;
-            case XML.WARNING_FILTER:    return warningListener;
-            case XML.WARNING_LISTENER:  return null;
+            case XML.WARNING_FILTER:    return logFilter;
             case XML.LENIENT_UNMARSHAL: return (bitMasks & Context.LENIENT_UNMARSHAL) != 0;
             case XML.STRING_SUBSTITUTES: {
                 int n = 0;
@@ -563,6 +557,6 @@ abstract class Pooled {
      */
     final Context begin() {
         return new Context(bitMasks | specificBitMasks(), locale, timezone,
-                schemas, versionGML, versionMetadata, resolver, converter, warningListener);
+                schemas, versionGML, versionMetadata, resolver, converter, logFilter);
     }
 }
diff --git a/core/sis-metadata/src/main/java/org/apache/sis/xml/XML.java b/core/sis-metadata/src/main/java/org/apache/sis/xml/XML.java
index 25d5411..1e684bf 100644
--- a/core/sis-metadata/src/main/java/org/apache/sis/xml/XML.java
+++ b/core/sis-metadata/src/main/java/org/apache/sis/xml/XML.java
@@ -46,7 +46,6 @@ import org.apache.sis.util.Static;
 import org.apache.sis.util.Version;
 import org.apache.sis.util.Workaround;
 import org.apache.sis.util.resources.Errors;
-import org.apache.sis.util.logging.WarningListener;
 import org.apache.sis.internal.system.Modules;
 import org.apache.sis.internal.system.SystemListener;
 import org.apache.sis.internal.jaxb.TypeRegistration;
@@ -82,13 +81,13 @@ import static org.apache.sis.util.ArgumentChecks.ensureNonNull;
  *   <tr><td>{@link #RESOLVER}</td>           <td>{@link ReferenceResolver}</td> <td>for replacing {@code xlink} or {@code uuidref} attributes by the actual object to use.</td></tr>
  *   <tr><td>{@link #CONVERTER}</td>          <td>{@link ValueConverter}</td>    <td>for controlling the conversion of URL, UUID, Units or similar objects.</td></tr>
  *   <tr><td>{@link #STRING_SUBSTITUTES}</td> <td>{@code String[]}</td>          <td>for specifying which code lists to replace by simpler {@code <gco:CharacterString>} elements.</td></tr>
- *   <tr><td>{@link #WARNING_LISTENER}</td>   <td>{@link WarningListener}</td>   <td>for being notified about non-fatal warnings.</td></tr>
+ *   <tr><td>{@link #WARNING_FILTER}</td>     <td>{@link Filter}</td>            <td>for being notified about non-fatal warnings.</td></tr>
  * </table>
  *
  * @author  Cédric Briançon (Geomatys)
  * @author  Martin Desruisseaux (Geomatys)
  * @author  Cullen Rombach (Image Matters)
- * @version 1.0
+ * @version 1.1
  * @since   0.3
  * @module
  */
@@ -373,21 +372,6 @@ public final class XML extends Static {
     public static final String WARNING_FILTER = "org.apache.sis.xml.warningFilter";
 
     /**
-     * Specifies a listener to be notified when a non-fatal error occurred during the (un)marshalling.
-     * The value for this property shall be an instance of {@code WarningListener<Object>}.
-     *
-     * <p>By default, warnings that occur during the (un)marshalling process are logged. However if a
-     * property is set for this key, then the {@link WarningListener#warningOccured(Object, LogRecord)}
-     * method will be invoked and the warning will <em>not</em> be logged by the (un)marshaller.</p>
-     *
-     * @see WarningListener
-     *
-     * @deprecated Replaced by {@link #WARNING_FILTER}.
-     */
-    @Deprecated
-    public static final String WARNING_LISTENER = "org.apache.sis.xml.warningListener";
-
-    /**
      * The pool of marshallers and unmarshallers used by this class.
      * The field name uses the uppercase convention because this field is almost constant:
      * this field is initially null, then created by {@link #getPool()} when first needed.
diff --git a/core/sis-utility/src/main/java/org/apache/sis/util/logging/Logging.java b/core/sis-utility/src/main/java/org/apache/sis/util/logging/Logging.java
index df73cb4..2fc3afd 100644
--- a/core/sis-utility/src/main/java/org/apache/sis/util/logging/Logging.java
+++ b/core/sis-utility/src/main/java/org/apache/sis/util/logging/Logging.java
@@ -48,7 +48,7 @@ import org.apache.sis.internal.system.Modules;
  * </ul>
  *
  * @author  Martin Desruisseaux (Geomatys)
- * @version 1.0
+ * @version 1.1
  * @since   0.3
  * @module
  */
@@ -261,7 +261,7 @@ public final class Logging extends Static {
                 if (!classname.equals(classe)) {
                     continue;
                 }
-            } else if (!WarningListeners.isPublic(element)) {
+            } else if (!isPublic(element)) {
                 continue;
             }
             /*
@@ -304,6 +304,30 @@ public final class Logging extends Static {
     }
 
     /**
+     * Returns {@code true} if the given stack trace element describes a method considered part of public API.
+     * This method is invoked in order to infer the class and method names to declare in a {@link LogRecord}.
+     * We do not document this feature in public Javadoc because it is based on heuristic rules that may change.
+     *
+     * <p>The current implementation compares the class name against a hard-coded list of classes to hide.
+     * This implementation may change in any future SIS version.</p>
+     *
+     * @param  e  a stack trace element.
+     * @return {@code true} if the class and method specified by the given element can be considered public API.
+     */
+    private static boolean isPublic(final StackTraceElement e) {
+        final String classname = e.getClassName();
+        if (classname.startsWith("java") || classname.startsWith(Modules.INTERNAL_CLASSNAME_PREFIX) ||
+            classname.indexOf('$') >= 0 || e.getMethodName().indexOf('$') >= 0)
+        {
+            return false;
+        }
+        if (classname.startsWith(Modules.CLASSNAME_PREFIX + "util.logging.")) {
+            return classname.endsWith("Test");      // Consider JUnit tests as public.
+        }
+        return true;    // TODO: with StackWalker on JDK9, check if the class is public.
+    }
+
+    /**
      * Invoked when an unexpected error occurred. This method logs a message at {@link Level#WARNING}
      * to the specified logger. The originating class name and method name can optionally be specified.
      * If any of them is {@code null}, then it will be inferred from the error stack trace as described below.
diff --git a/core/sis-utility/src/main/java/org/apache/sis/util/logging/QuietLogRecord.java b/core/sis-utility/src/main/java/org/apache/sis/util/logging/QuietLogRecord.java
deleted file mode 100644
index d10ff94..0000000
--- a/core/sis-utility/src/main/java/org/apache/sis/util/logging/QuietLogRecord.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * 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.util.logging;
-
-import java.util.logging.Level;
-import java.util.logging.LogRecord;
-
-
-/**
- * A log record to be logged without stack trace, unless the user specified it explicitly.
- *
- * @author  Martin Desruisseaux (Geomatys)
- * @version 0.8
- * @since   0.3
- * @module
- *
- * @deprecated Moved to {@link org.apache.sis.storage.event.QuietLogRecord}.
- */
-@Deprecated
-final class QuietLogRecord extends LogRecord {
-    /**
-     * For cross-version compatibility.
-     */
-    private static final long serialVersionUID = -8225936118310305206L;
-
-    /**
-     * {@code true} if the user invoked {@link #setThrown(Throwable)}.
-     * In such case, {@link #clearThrown()} will not reset the throwable to null.
-     */
-    private boolean explicitThrown;
-
-    /**
-     * Creates a new log record for the given message and exception.
-     */
-    QuietLogRecord(final Level level, final String message, final Exception exception) {
-        super(level, message);
-        super.setThrown(exception);
-    }
-
-    /**
-     * Sets the throwable to the given value. The given throwable will not be cleared
-     * when the record will be logged.
-     */
-    @Override
-    public void setThrown(final Throwable thrown) {
-        explicitThrown = true;
-        super.setThrown(thrown);
-    }
-
-    /**
-     * Clears the throwable if it has not been explicit set by the user.
-     * Otherwise do nothing.
-     */
-    void clearThrown() {
-        if (!explicitThrown) {
-            super.setThrown(null);
-        }
-    }
-}
diff --git a/core/sis-utility/src/main/java/org/apache/sis/util/logging/WarningListener.java b/core/sis-utility/src/main/java/org/apache/sis/util/logging/WarningListener.java
deleted file mode 100644
index 642e773..0000000
--- a/core/sis-utility/src/main/java/org/apache/sis/util/logging/WarningListener.java
+++ /dev/null
@@ -1,92 +0,0 @@
-/*
- * 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.util.logging;
-
-import java.util.EventListener;
-import java.util.logging.Level;
-import java.util.logging.LogRecord;
-import java.util.logging.Filter;
-
-
-/**
- * Intercepts non-fatal error messages logged by {@link org.apache.sis.storage.DataStore} or other SIS objects.
- * Warnings are encapsulated in {@link LogRecord} objects and logged at {@link Level#WARNING} if the emitter does not
- * have registered any {@code WarningListener}. This listener allows applications to intercept warning records for
- * displaying them in a dialog (or any other action that the application may choose) instead than logging them.
- *
- * <div class="note"><b>Comparison with alternative approaches:</b>
- * it is also possible to listen to login events by registering a custom {@link java.util.logging.Handler} to the logger.
- * But {@code Handler} instances are registered on a per-logger basis and receive all messages sent to that logger
- * regardless their emitter. By contrast, {@code WarningListener} instances are registered on a per-{@code DataStore}
- * basis (or any other emitter) and receive all messages sent by that emitter regardless the destination logger.
- * The emitter is part of the information given to the {@link #warningOccured(Object, LogRecord)} method,
- * in addition to the log record.</div>
- *
- * @author  Martin Desruisseaux (Geomatys)
- * @version 1.0
- *
- * @param <S>  the base type of objects that emit warnings (the <cite>source</cite>).
- *
- * @see WarningListeners
- * @see org.apache.sis.storage.event.StoreListener
- *
- * @since 0.3
- * @module
- *
- * @deprecated Replaced by {@link java.util.logging.Filter}.
- */
-@Deprecated
-public interface WarningListener<S> extends EventListener {
-    /**
-     * Returns the type of objects that emit warnings of interest for this listener.
-     * This is typically, but not necessarily, the class having the name returned by
-     * {@link LogRecord#getSourceClassName()}, or one of its parent classes.
-     *
-     * @return the base type of objects that emit warnings (the <cite>source</cite>).
-     */
-    Class<S> getSourceClass();
-
-    /**
-     * Reports the occurrence of a non-fatal error. The emitter process (often a
-     * {@link org.apache.sis.storage.DataStore} in the midst of a reading process)
-     * will continue following the call to this method.
-     *
-     * <p>The {@code LogRecord} provides the warning {@linkplain LogRecord#getMessage() message} together with
-     * programmatic information like the {@linkplain LogRecord#getSourceClassName() source class name} and
-     * {@linkplain LogRecord#getSourceMethodName() method name} where the warning occurred. The log record
-     * may optionally contains the exception which has been {@linkplain LogRecord#getThrown() thrown}.</p>
-     *
-     * <p>Applications may choose to ignore the warning, display a dialog or take any other action they choose.
-     * Applications do not need to log the warning, since logging will be done automatically if the emitter has
-     * no registered warning listeners.</p>
-     *
-     * @param source   the object that emitted a warning, or {@code null} if not available.
-     * @param warning  the warning message together with programmatic information.
-     */
-    void warningOccured(S source, LogRecord warning);
-
-    /**
-     * Wraps this listener in a {@code java.util.logging.Filter} for transitioning
-     * to the replacement of this interface.
-     */
-    default Filter asFilter() {
-        return (LogRecord warning) -> {
-            warningOccured(null, warning);
-            return false;
-        };
-    }
-}
diff --git a/core/sis-utility/src/main/java/org/apache/sis/util/logging/WarningListeners.java b/core/sis-utility/src/main/java/org/apache/sis/util/logging/WarningListeners.java
deleted file mode 100644
index 1e4717e..0000000
--- a/core/sis-utility/src/main/java/org/apache/sis/util/logging/WarningListeners.java
+++ /dev/null
@@ -1,366 +0,0 @@
-/*
- * 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.util.logging;
-
-import java.util.Collections;
-import java.util.List;
-import java.util.Locale;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-import java.util.logging.LogRecord;
-import java.util.NoSuchElementException;
-import org.apache.sis.util.Localized;
-import org.apache.sis.util.Exceptions;
-import org.apache.sis.util.ArgumentChecks;
-import org.apache.sis.util.resources.Errors;
-import org.apache.sis.internal.system.Modules;
-import org.apache.sis.internal.util.UnmodifiableArrayList;
-
-
-/**
- * Holds a list of {@link WarningListener} instances and provides convenience methods for emitting warnings.
- * This is a helper class for {@link org.apache.sis.storage.DataStore} implementations or for other services
- * susceptible to emit warnings.
- * Observers can {@linkplain #addWarningListener can add listeners} for being notified about warnings, and
- * processes can invoke one of the {@code warning(…)} methods for emitting warnings. All warnings are given
- * to the listeners as {@link LogRecord} instances (this allows localizable messages and additional information
- * like {@linkplain LogRecord#getMillis() timestamp} and {@linkplain LogRecord#getThrown() stack trace}).
- * This {@code WarningListeners} class provides convenience methods like {@link #warning(String, Exception)},
- * which builds {@code LogRecord} from an exception or from a string, but all those {@code warning(…)} methods
- * ultimately delegate to {@link #warning(LogRecord)}, thus providing a single point that subclasses can override.
- * When a warning is emitted, the default behavior is:
- *
- * <ul>
- *   <li>If at least one {@link WarningListener} is registered,
- *       then all listeners are notified and the warning is <strong>not</strong> logged.
- *   <li>Otherwise if the value returned by {@link LogRecord#getLoggerName()} is non-null,
- *       then the warning will be logged to that named logger.</li>
- *   <li>Otherwise the warning is logged to the logger returned by {@link #getLogger()}.</li>
- * </ul>
- *
- * <div class="section">Thread safety</div>
- * The same {@code WarningListeners} instance can be safely used by many threads without synchronization
- * on the part of the caller. Subclasses should make sure that any overridden methods remain safe to call
- * from multiple threads.
- *
- * @author  Martin Desruisseaux (Geomatys)
- * @version 1.0
- *
- * @param <S>  the type of the source of warnings.
- *
- * @see WarningListener
- * @see org.apache.sis.storage.DataStore#listeners
- *
- * @since 0.3
- * @module
- *
- * @deprecated Replaced by {@link org.apache.sis.storage.event.StoreListeners}.
- */
-@Deprecated
-public class WarningListeners<S> implements Localized {
-    /**
-     * The declared source of warnings. This is not necessarily the real source,
-     * but this is the source that the implementer wants to declare as public API.
-     */
-    private final S source;
-
-    /**
-     * The listeners, or {@code null} if none. This is a <cite>copy on write</cite> array:
-     * no elements are modified once the array have been created.
-     */
-    private WarningListener<? super S>[] listeners;
-
-    /**
-     * Creates a new instance with initially no listener.
-     * Warnings will be logger to the destination given by {@link #getLogger()},
-     * unless at least one listener is {@linkplain #addWarningListener registered}.
-     *
-     * @param source  the declared source of warnings. This is not necessarily the real source,
-     *                but this is the source that the implementer wants to declare as public API.
-     */
-    public WarningListeners(final S source) {
-        this.source = source;
-    }
-
-    /**
-     * Creates a new instance initialized with the same listeners than the given instance.
-     * This constructor is useful when a {@code DataStore} or other data producer needs to
-     * be duplicated for concurrency reasons.
-     *
-     * @param source  the declared source of warnings. This is not necessarily the real source,
-     *                but this is the source that the implementer wants to declare as public API.
-     * @param other   the existing instance from which to copy the listeners, or {@code null} if none.
-     *
-     * @since 0.8
-     */
-    public WarningListeners(final S source, final WarningListeners<? super S> other) {
-        this(source);
-        if (other != null) {
-            listeners = other.listeners;
-        }
-    }
-
-    /**
-     * Returns the source declared source of warnings.
-     * This value is specified at construction time.
-     *
-     * @return the declared source of warnings.
-     *
-     * @since 0.8
-     */
-    public S getSource() {
-        return source;
-    }
-
-    /**
-     * The locale to use for formatting warning messages, or {@code null} for the default locale.
-     * If the {@code source} object given to the constructor implements the {@link Localized} interface,
-     * then this method delegates to its {@code getLocale()} method. Otherwise this method returns {@code null}.
-     */
-    @Override
-    public Locale getLocale() {
-        return (source instanceof Localized) ? ((Localized) source).getLocale() : null;
-    }
-
-    /**
-     * Returns the logger where to send the warnings when no other destination is specified.
-     * This logger is used when:
-     *
-     * <ul>
-     *   <li>no listener has been {@linkplain #addWarningListener registered}, and</li>
-     *   <li>the {@code LogRecord} does not {@linkplain LogRecord#getLoggerName() specify a logger}.</li>
-     * </ul>
-     *
-     * The default implementation infers a logger name from the package name of the {@code source} object.
-     * Subclasses should override this method if they can provide a more determinist logger instance,
-     * typically from a static final constant.
-     *
-     * @return the logger where to send the warnings when there is no other destination.
-     */
-    public Logger getLogger() {
-        return Logging.getLogger(source.getClass());
-    }
-
-    /**
-     * Reports a warning represented by the given log record. The default implementation forwards
-     * the given record to <strong>one</strong> of the following destinations, in preference order:
-     *
-     * <ol>
-     *   <li><code>{@linkplain WarningListener#warningOccured WarningListener.warningOccured}(source, record)</code>
-     *       on all {@linkplain #addWarningListener registered listeners} it at least one such listener exists.</li>
-     *   <li><code>{@linkplain Logging#getLogger(String) Logging.getLogger}(record.{@linkplain LogRecord#getLoggerName
-     *       getLoggerName()}).{@linkplain Logger#log(LogRecord) log}(record)</code> if the logger name is non-null.</li>
-     *   <li><code>{@linkplain #getLogger()}.{@linkplain Logger#log(LogRecord) log}(record)</code> otherwise.</li>
-     * </ol>
-     *
-     * @param record  the warning as a log record.
-     */
-    public void warning(final LogRecord record) {
-        final WarningListener<? super S>[] current;
-        synchronized (this) {
-            current = listeners;
-        }
-        if (current != null) {
-            for (final WarningListener<? super S> listener : current) {
-                listener.warningOccured(source, record);
-            }
-        } else {
-            final String name = record.getLoggerName();
-            final Logger logger;
-            if (name != null) {
-                logger = Logging.getLogger(name);
-            } else {
-                logger = getLogger();
-                record.setLoggerName(logger.getName());
-            }
-            if (record instanceof QuietLogRecord) {
-                ((QuietLogRecord) record).clearThrown();
-            }
-            logger.log(record);
-        }
-    }
-
-    /**
-     * Reports a warning represented by the given message and exception.
-     * At least one of {@code message} and {@code exception} shall be non-null.
-     * If both are non-null, then the exception message will be concatenated after the given message.
-     * If the exception is non-null, its stack trace will be omitted at logging time for avoiding to
-     * pollute console output (keeping in mind that this method should be invoked only for non-fatal
-     * warnings). See {@linkplain #warning(Level, String, Exception) below} for more explanation.
-     *
-     * <p>This method is a shortcut for <code>{@linkplain #warning(Level, String, Exception)
-     * warning}({@linkplain Level#WARNING}, message, exception)</code>.
-     *
-     * @param message    the message to log, or {@code null} if none.
-     * @param exception  the exception to log, or {@code null} if none.
-     */
-    public void warning(String message, Exception exception) {
-        warning(Level.WARNING, message, exception);
-    }
-
-    /**
-     * Reports a warning at the given level represented by the given message and exception.
-     * At least one of {@code message} and {@code exception} shall be non-null.
-     * If both are non-null, then the exception message will be concatenated after the given message.
-     *
-     * <div class="section">Stack trace omission</div>
-     * If there is no registered listener, then the {@link #warning(LogRecord)} method will send the record to the
-     * {@linkplain #getLogger() logger}, but <em>without</em> the stack trace. This is done that way because stack
-     * traces consume lot of space in the logging files, while being considered implementation details in the context
-     * of {@code WarningListeners} (on the assumption that the logging message provides sufficient information).
-     * If the stack trace is desired, then users can either:
-     * <ul>
-     *   <li>invoke {@code warning(LogRecord)} directly, or</li>
-     *   <li>override {@code warning(LogRecord)} and invoke {@link LogRecord#setThrown(Throwable)} explicitly, or</li>
-     *   <li>register a listener which will log the record itself.</li>
-     * </ul>
-     *
-     * @param level      the warning level.
-     * @param message    the message to log, or {@code null} if none.
-     * @param exception  the exception to log, or {@code null} if none.
-     */
-    public void warning(final Level level, String message, final Exception exception) {
-        ArgumentChecks.ensureNonNull("level", level);
-        final LogRecord record;
-        final StackTraceElement[] trace;
-        if (exception != null) {
-            trace = exception.getStackTrace();
-            message = Exceptions.formatChainedMessages(getLocale(), message, exception);
-            if (message == null) {
-                message = exception.toString();
-            }
-            record = new QuietLogRecord(level, message, exception);
-        } else {
-            ArgumentChecks.ensureNonEmpty("message", message);
-            trace = Thread.currentThread().getStackTrace();
-            record = new LogRecord(level, message);
-        }
-        for (final StackTraceElement e : trace) {
-            if (isPublic(e)) {
-                record.setSourceClassName(e.getClassName());
-                record.setSourceMethodName(e.getMethodName());
-                break;
-            }
-        }
-        warning(record);
-    }
-
-    /**
-     * Returns {@code true} if the given stack trace element describes a method considered part of public API.
-     * This method is invoked in order to infer the class and method names to declare in a {@link LogRecord}.
-     * We do not document this feature in public Javadoc because it is based on heuristic rules that may change.
-     *
-     * <p>The current implementation compares the class name against a hard-coded list of classes to hide.
-     * This implementation may change in any future SIS version.</p>
-     *
-     * @param  e  a stack trace element.
-     * @return {@code true} if the class and method specified by the given element can be considered public API.
-     */
-    static boolean isPublic(final StackTraceElement e) {
-        final String classname = e.getClassName();
-        if (classname.startsWith("java") || classname.startsWith(Modules.INTERNAL_CLASSNAME_PREFIX) ||
-            classname.indexOf('$') >= 0 || e.getMethodName().indexOf('$') >= 0)
-        {
-            return false;
-        }
-        if (classname.startsWith(Modules.CLASSNAME_PREFIX + "util.logging.")) {
-            return classname.endsWith("Test");      // Consider JUnit tests as public.
-        }
-        return true;    // TODO: with StackWalker on JDK9, check if the class is public.
-    }
-
-    /**
-     * Adds a listener to be notified when a warning occurred.
-     * When a warning occurs, there is a choice:
-     *
-     * <ul>
-     *   <li>If this object has no warning listener, then the warning is logged at
-     *       {@link java.util.logging.Level#WARNING}.</li>
-     *   <li>If this object has at least one warning listener, then all listeners are notified
-     *       and the warning is <strong>not</strong> logged by this object.</li>
-     * </ul>
-     *
-     * @param  listener  the listener to add.
-     * @throws IllegalArgumentException if the given listener is already registered.
-     */
-    public synchronized void addWarningListener(final WarningListener<? super S> listener)
-            throws IllegalArgumentException
-    {
-        ArgumentChecks.ensureNonNull("listener", listener);
-        final WarningListener<? super S>[] current = listeners;
-        final int length = (current != null) ? current.length : 0;
-
-        @SuppressWarnings({"unchecked", "rawtypes"}) // Generic array creation.
-        final WarningListener<? super S>[] copy = new WarningListener[length + 1];
-        for (int i=0; i<length; i++) {
-            final WarningListener<? super S> c = current[i];
-            if (c == listener) {
-                throw new IllegalArgumentException(Errors.format(Errors.Keys.ElementAlreadyPresent_1, listener));
-            }
-            copy[i] = c;
-        }
-        copy[length] = listener;
-        listeners = copy;
-    }
-
-    /**
-     * Removes a previously registered listener.
-     *
-     * @param  listener  the listener to remove.
-     * @throws NoSuchElementException if the given listener is not registered.
-     */
-    public synchronized void removeWarningListener(final WarningListener<? super S> listener)
-            throws NoSuchElementException
-    {
-        ArgumentChecks.ensureNonNull("listener", listener);
-        final WarningListener<? super S>[] current = listeners;
-        if (current != null) {
-            for (int i=0; i<current.length; i++) {
-                if (current[i] == listener) {
-                    if (current.length == 1) {
-                        listeners = null;
-                    } else {
-                        @SuppressWarnings({"unchecked", "rawtypes"}) // Generic array creation.
-                        final WarningListener<? super S>[] copy = new WarningListener[current.length - 1];
-                        System.arraycopy(current, 0, copy, 0, i);
-                        System.arraycopy(current, i+1, copy, i, copy.length - i);
-                        listeners = copy;
-                    }
-                    return;
-                }
-            }
-        }
-        throw new NoSuchElementException(Errors.format(Errors.Keys.ElementNotFound_1, listener));
-    }
-
-    /**
-     * Returns all registered warning listeners, or an empty list if none.
-     * This method returns an unmodifiable snapshot of the listener list at the time this method is invoked.
-     *
-     * @return immutable list of all registered warning listeners.
-     *
-     * @since 0.8
-     */
-    public List<WarningListener<? super S>> getListeners() {
-        final WarningListener<? super S>[] current;
-        synchronized (this) {
-            current = listeners;
-        }
-        return (current != null) ? UnmodifiableArrayList.wrap(current) : Collections.emptyList();
-    }
-
-}
diff --git a/core/sis-utility/src/main/java/org/apache/sis/util/logging/package-info.java b/core/sis-utility/src/main/java/org/apache/sis/util/logging/package-info.java
index c5d651e..31d6ac6 100644
--- a/core/sis-utility/src/main/java/org/apache/sis/util/logging/package-info.java
+++ b/core/sis-utility/src/main/java/org/apache/sis/util/logging/package-info.java
@@ -50,7 +50,7 @@
  * order to give SIS a chance to redirect log events to an other logging framework.
  *
  * @author  Martin Desruisseaux (Geomatys)
- * @version 1.0
+ * @version 1.1
  *
  * @see <a href="http://download.oracle.com/javase/6/docs/technotes/guides/logging/overview.html">Java Logging Overview</a>
  *
diff --git a/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/io/ChannelFactory.java b/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/io/ChannelFactory.java
index 0f4dc55..a7aedfb 100644
--- a/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/io/ChannelFactory.java
+++ b/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/io/ChannelFactory.java
@@ -291,7 +291,7 @@ public abstract class ChannelFactory {
      * it is caller's responsibility to wrap the stream in a {@link java.io.BufferedInputStream} if desired.
      *
      * @param  filename  data store name to report in case of failure.
-     * @param  listeners set of registered {@code WarningListener}s for the data store, or {@code null} if none.
+     * @param  listeners set of registered {@code StoreListener}s for the data store, or {@code null} if none.
      * @return the input stream.
      * @throws DataStoreException if the channel is read-once.
      * @throws IOException if the input stream or its underlying byte channel can not be created.
@@ -307,7 +307,7 @@ public abstract class ChannelFactory {
      * it is caller's responsibility to wrap the stream in a {@link java.io.BufferedOutputStream} if desired.
      *
      * @param  filename  data store name to report in case of failure.
-     * @param  listeners set of registered {@code WarningListener}s for the data store, or {@code null} if none.
+     * @param  listeners set of registered {@code StoreListener}s for the data store, or {@code null} if none.
      * @return the output stream.
      * @throws DataStoreException if the channel is write-once.
      * @throws IOException if the output stream or its underlying byte channel can not be created.
@@ -324,7 +324,7 @@ public abstract class ChannelFactory {
      * this method throws an exception.
      *
      * @param  filename  data store name to report in case of failure.
-     * @param  listeners set of registered {@code WarningListener}s for the data store, or {@code null} if none.
+     * @param  listeners set of registered {@code StoreListener}s for the data store, or {@code null} if none.
      * @return the channel for the given input.
      * @throws DataStoreException if the channel is read-once.
      * @throws IOException if an error occurred while opening the channel.
@@ -338,7 +338,7 @@ public abstract class ChannelFactory {
      * this method throws an exception.
      *
      * @param  filename  data store name to report in case of failure.
-     * @param  listeners set of registered {@code WarningListener}s for the data store, or {@code null} if none.
+     * @param  listeners set of registered {@code StoreListener}s for the data store, or {@code null} if none.
      * @return the channel for the given output.
      * @throws DataStoreException if the channel is write-once.
      * @throws IOException if an error occurred while opening the channel.
diff --git a/storage/sis-storage/src/main/java/org/apache/sis/storage/event/StoreListeners.java b/storage/sis-storage/src/main/java/org/apache/sis/storage/event/StoreListeners.java
index 1b70be5..2e18ac1 100644
--- a/storage/sis-storage/src/main/java/org/apache/sis/storage/event/StoreListeners.java
+++ b/storage/sis-storage/src/main/java/org/apache/sis/storage/event/StoreListeners.java
@@ -29,7 +29,6 @@ import org.apache.sis.util.Localized;
 import org.apache.sis.util.Exceptions;
 import org.apache.sis.util.ArgumentChecks;
 import org.apache.sis.util.logging.Logging;
-import org.apache.sis.util.logging.WarningListener;
 import org.apache.sis.internal.system.Modules;
 import org.apache.sis.internal.storage.StoreResource;
 import org.apache.sis.storage.DataStoreProvider;
@@ -72,11 +71,11 @@ import org.apache.sis.storage.Resource;
  * from multiple threads.
  *
  * @author  Martin Desruisseaux (Geomatys)
- * @version 1.0
+ * @version 1.1
  * @since   1.0
  * @module
  */
-public class StoreListeners extends org.apache.sis.util.logging.WarningListeners implements Localized {
+public class StoreListeners implements Localized {
     /**
      * Parent manager to notify in addition to this manager.
      */
@@ -210,7 +209,6 @@ public class StoreListeners extends org.apache.sis.util.logging.WarningListeners
      * @param source  the source of events. Can not be null.
      */
     public StoreListeners(final StoreListeners parent, Resource source) {
-        super(source);
         /*
          * Undocumented feature for allowing subclass to specify `this` as the source resource.
          * This is used as a convenience by AbstractResource internal class. We need this hack
@@ -230,7 +228,6 @@ public class StoreListeners extends org.apache.sis.util.logging.WarningListeners
      *
      * @return the source of events.
      */
-    @Override
     public Resource getSource() {
         return source;
     }
@@ -319,7 +316,7 @@ public class StoreListeners extends org.apache.sis.util.logging.WarningListeners
      *
      * @return the logger where to send the warnings when there is no other destination.
      */
-    private Logger logger() {
+    private Logger getLogger() {
         Resource src = source;
         final DataStore ds = getDataStore(this);
         if (ds != null) {
@@ -378,7 +375,6 @@ public class StoreListeners extends org.apache.sis.util.logging.WarningListeners
      * @param  message    the warning message to report, or {@code null} if none.
      * @param  exception  the exception to report, or {@code null} if none.
      */
-    @Override
     public void warning(String message, Exception exception) {
         warning(Level.WARNING, message, exception);
     }
@@ -404,7 +400,6 @@ public class StoreListeners extends org.apache.sis.util.logging.WarningListeners
      * @param  message    the message to log, or {@code null} if none.
      * @param  exception  the exception to log, or {@code null} if none.
      */
-    @Override
     public void warning(final Level level, String message, final Exception exception) {
         ArgumentChecks.ensureNonNull("level", level);
         final LogRecord record;
@@ -476,7 +471,6 @@ public class StoreListeners extends org.apache.sis.util.logging.WarningListeners
      *
      * @param  description  warning details provided as a log record.
      */
-    @Override
     @SuppressWarnings("unchecked")
     public void warning(final LogRecord description) {
         if (!fire(new WarningEvent(source, description), WarningEvent.class)) {
@@ -485,7 +479,7 @@ public class StoreListeners extends org.apache.sis.util.logging.WarningListeners
             if (name != null) {
                 logger = Logging.getLogger(name);
             } else {
-                logger = logger();
+                logger = getLogger();
                 description.setLoggerName(logger.getName());
             }
             if (description instanceof QuietLogRecord) {
@@ -616,48 +610,4 @@ public class StoreListeners extends org.apache.sis.util.logging.WarningListeners
         } while (m != null);
         return false;
     }
-
-
-    /**
-     * @deprecated Replaced by {@code addListener(listener, WarningEvent.class)}.
-     */
-    @Override
-    @Deprecated
-    public void addWarningListener(final WarningListener listener) {
-        addListener(new Legacy(listener), WarningEvent.class);
-    }
-
-    /**
-     * @deprecated Replaced by {@code removeListener(listener, WarningEvent.class)}.
-     */
-    @Override
-    @Deprecated
-    public void removeWarningListener(final WarningListener listener) {
-        for (ForType<?> e = listeners; e != null; e = e.next) {
-            if (e.type.equals(WarningEvent.class)) {
-                StoreListener<?>[] list = e.listeners;
-                if (list != null) {
-                    for (final StoreListener<?> c : list) {
-                        if (c instanceof Legacy && ((Legacy) c).delegate == listener) {
-                            removeListener((StoreListener<WarningEvent>) c, WarningEvent.class);
-                            break;
-                        }
-                    }
-                }
-            }
-        }
-    }
-
-    @Deprecated
-    private static final class Legacy implements StoreListener<WarningEvent> {
-        final WarningListener<? super Resource> delegate;
-
-        Legacy(final WarningListener<? super Resource> delegate) {
-            this.delegate = delegate;
-        }
-
-        @Override public void eventOccured(WarningEvent event) {
-            delegate.warningOccured(event.getSource(), event.getDescription());
-        }
-    }
 }
diff --git a/storage/sis-storage/src/main/java/org/apache/sis/storage/event/package-info.java b/storage/sis-storage/src/main/java/org/apache/sis/storage/event/package-info.java
index 5745fca..c9a46b7 100644
--- a/storage/sis-storage/src/main/java/org/apache/sis/storage/event/package-info.java
+++ b/storage/sis-storage/src/main/java/org/apache/sis/storage/event/package-info.java
@@ -34,7 +34,7 @@
  * to a specific kind of event}.
  *
  * @author  Johann Sorel (Geomatys)
- * @since   1.0
+ * @since   1.1
  * @version 1.0
  * @module
  */
diff --git a/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/storage/xml/stream/StaxDataStore.java b/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/storage/xml/stream/StaxDataStore.java
index 9dc4462..8ba40a4 100644
--- a/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/storage/xml/stream/StaxDataStore.java
+++ b/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/storage/xml/stream/StaxDataStore.java
@@ -298,7 +298,7 @@ public abstract class StaxDataStore extends URIDataStore {
         /**
          * Returns configuration associated to the given key, or {@code null} if none.
          *
-         * @param  key  one of {@link XML#LOCALE}, {@link XML#TIMEZONE} or {@link XML#WARNING_LISTENER}.
+         * @param  key  one of {@link XML#LOCALE}, {@link XML#TIMEZONE} or {@link XML#WARNING_FILTER}.
          * @return the configuration for the given key, or {@code null} if none or if the given key is invalid.
          */
         @Override


Mime
View raw message