sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject svn commit: r1748710 [2/2] - in /sis/trunk: ./ application/sis-console/src/main/java/org/apache/sis/console/ application/sis-console/src/test/java/org/apache/sis/console/ application/sis-console/src/test/java/org/apache/sis/test/suite/ application/sis-...
Date Thu, 16 Jun 2016 12:37:55 GMT
Modified: sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/system/DefaultFactories.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/system/DefaultFactories.java?rev=1748710&r1=1748709&r2=1748710&view=diff
==============================================================================
--- sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/system/DefaultFactories.java
[UTF-8] (original)
+++ sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/system/DefaultFactories.java
[UTF-8] Thu Jun 16 12:37:54 2016
@@ -16,11 +16,13 @@
  */
 package org.apache.sis.internal.system;
 
+import java.util.Set;
 import java.util.Map;
+import java.util.HashSet;
 import java.util.IdentityHashMap;
 import java.util.ServiceLoader;
 import java.util.ServiceConfigurationError;
-import org.apache.sis.internal.util.Utilities;
+import org.apache.sis.util.logging.Logging;
 
 
 /**
@@ -31,7 +33,7 @@ import org.apache.sis.internal.util.Util
  * @author  Martin Desruisseaux (Geomatys)
  * @author  Guilhem Legal (Geomatys)
  * @since   0.3
- * @version 0.7
+ * @version 0.8
  * @module
  *
  * @see <a href="https://jcp.org/en/jsr/detail?id=330">JSR-330</a>
@@ -87,8 +89,8 @@ public final class DefaultFactories exte
         T factory = type.cast(FACTORIES.get(type));
         if (factory == null && !FACTORIES.containsKey(type)) {
             T fallback = null;
-            for (final T candidate : ServiceLoader.load(type)) {
-                if (Utilities.isSIS(candidate.getClass())) {
+            for (final T candidate : createServiceLoader(type)) {
+                if (candidate.getClass().getName().startsWith(Modules.CLASSNAME_PREFIX))
{
                     if (factory != null) {
                         throw new ServiceConfigurationError("Found two implementations of
" + type);
                     }
@@ -157,4 +159,77 @@ public final class DefaultFactories exte
         }
         return impl.cast(factory);
     }
+
+    /**
+     * Returns a service loader for the given type using the default class loader.
+     * The default is the current thread {@linkplain Thread#getContextClassLoader() context
class loader},
+     * provided that it can access at least the Apache SIS stores.
+     *
+     * @param  <T> The compile-time value of {@code service} argument.
+     * @param  service The interface or abstract class representing the service.
+     * @return A new service loader for the given service type.
+     *
+     * @since 0.8
+     */
+    public static <T> ServiceLoader<T> createServiceLoader(final Class<T>
service) {
+        try {
+            return ServiceLoader.load(service, getContextClassLoader());
+        } catch (SecurityException e) {
+            /*
+             * We were not allowed to invoke Thread.currentThread().getContextClassLoader().
+             * But ServiceLoader.load(Class) may be allowed to, since it is part of JDK.
+             */
+            Logging.recoverableException(Logging.getLogger(Loggers.SYSTEM),
+                    DefaultFactories.class, "createServiceLoader", e);
+            return ServiceLoader.load(service);
+        }
+    }
+
+    /**
+     * Returns the context class loader, but makes sure that it has Apache SIS on its classpath.
+     * First, this method invokes {@link Thread#getContextClassLoader()} for the current
thread.
+     * Then this method scans over all Apache SIS classes on the stack trace. For each SIS
class,
+     * its loader is compared to the above-cited context class loader. If the context class
loader
+     * is equal or is a child of the SIS loader, then it is left unchanged. Otherwise the
context
+     * class loader is replaced by the SIS one.
+     *
+     * <p>The intend of this method is to ensure that {@link ServiceLoader#load(Class)}
will find the
+     * Apache SIS services even in an environment that defined an unsuitable context class
loader.</p>
+     *
+     * @return The context class loader if suitable, or another class loader otherwise.
+     * @throws SecurityException if this method is not allowed to get the current thread
+     *         context class loader or one of its parent.
+     *
+     * @since 0.8
+     */
+    private static ClassLoader getContextClassLoader() throws SecurityException {
+        final Thread thread = Thread.currentThread();
+        ClassLoader loader = thread.getContextClassLoader();
+        final Set<ClassLoader> parents = new HashSet<ClassLoader>();
+        for (ClassLoader c = loader; c != null; c = c.getParent()) {
+            parents.add(c);
+        }
+        boolean warnings = false;
+        for (final StackTraceElement trace : thread.getStackTrace()) {
+            final String element = trace.getClassName();
+            if (element.startsWith(Modules.CLASSNAME_PREFIX)) try {
+                ClassLoader c = Class.forName(element).getClassLoader();
+                if (!parents.contains(c)) {
+                    loader = c;
+                    parents.clear();
+                    while (c != null) {
+                        parents.add(c);
+                        c = c.getParent();
+                    }
+                }
+            } catch (Exception e) {     // This is (SecurityException | ClassNotFoundException)
on the JDK7 branch.
+                if (!warnings) {
+                    warnings = true;
+                    Logging.recoverableException(Logging.getLogger(Loggers.SYSTEM),
+                            DefaultFactories.class, "getContextClassLoader", e);
+                }
+            }
+        }
+        return loader;
+    }
 }

Modified: sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/system/Modules.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/system/Modules.java?rev=1748710&r1=1748709&r2=1748710&view=diff
==============================================================================
--- sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/system/Modules.java [UTF-8]
(original)
+++ sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/system/Modules.java [UTF-8]
Thu Jun 16 12:37:54 2016
@@ -77,6 +77,16 @@ public final class Modules {
     public static final int MINOR_VERSION = 8;
 
     /**
+     * The prefix of all classnames in Apache SIS, including a trailing dot.
+     */
+    public static final String CLASSNAME_PREFIX = "org.apache.sis.";
+
+    /**
+     * The prefix of all internal classnames in Apache SIS, including a trailing dot.
+     */
+    public static final String INTERNAL_CLASSNAME_PREFIX = CLASSNAME_PREFIX + "internal.";
+
+    /**
      * Do not allow instantiation of this class.
      */
     private Modules() {

Modified: sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/util/DefinitionURI.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/util/DefinitionURI.java?rev=1748710&r1=1748709&r2=1748710&view=diff
==============================================================================
--- sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/util/DefinitionURI.java
[UTF-8] (original)
+++ sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/util/DefinitionURI.java
[UTF-8] Thu Jun 16 12:37:54 2016
@@ -125,7 +125,7 @@ public final class DefinitionURI {
     /**
      * The domain of URLs in the OGC namespace.
      */
-    private static final String DOMAIN = "www.opengis.net";
+    public static final String DOMAIN = "www.opengis.net";
 
     /**
      * Server and path portions of HTTP URL for various types (currently {@code "crs"}).

Modified: sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/util/LazySet.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/util/LazySet.java?rev=1748710&r1=1748709&r2=1748710&view=diff
==============================================================================
--- sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/util/LazySet.java [UTF-8]
(original)
+++ sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/util/LazySet.java [UTF-8]
Thu Jun 16 12:37:54 2016
@@ -22,6 +22,7 @@ import java.util.Iterator;
 import java.util.ServiceLoader;
 import java.util.NoSuchElementException;
 import org.apache.sis.util.Workaround;
+import org.apache.sis.internal.system.DefaultFactories;
 
 // Branch-specific imports
 import org.apache.sis.internal.jdk7.Objects;
@@ -44,9 +45,9 @@ import org.apache.sis.internal.jdk7.Obje
  *
  * @param <E> The type of elements in the set.
  *
- * @author  Martin Desruisseaux (IRD)
+ * @author  Martin Desruisseaux (IRD, Geomatys)
  * @since   0.6
- * @version 0.7
+ * @version 0.8
  * @module
  */
 @Workaround(library="JDK", version="1.8.0_31-b13")
@@ -155,7 +156,7 @@ public class LazySet<E> extends SetOfUnk
      */
     private boolean canPullMore() {
         if (sourceIterator == null && cachedElements == null) {
-            sourceIterator = ServiceLoader.load(service).iterator();
+            sourceIterator = DefaultFactories.createServiceLoader(service).iterator();
             if (createCache()) {
                 return true;
             }

Modified: sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/util/Utilities.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/util/Utilities.java?rev=1748710&r1=1748709&r2=1748710&view=diff
==============================================================================
--- sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/util/Utilities.java [UTF-8]
(original)
+++ sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/util/Utilities.java [UTF-8]
Thu Jun 16 12:37:54 2016
@@ -28,7 +28,7 @@ import org.apache.sis.util.CharSequences
  *
  * @author  Martin Desruisseaux (Geomatys)
  * @since   0.3
- * @version 0.6
+ * @version 0.8
  * @module
  */
 public final class Utilities extends Static {
@@ -39,16 +39,6 @@ public final class Utilities extends Sta
     }
 
     /**
-     * Returns {@code true} if the given class is an Apache SIS class.
-     *
-     * @param  type The class to verify.
-     * @return {@code true} if the given class is an Apache SIS class.
-     */
-    public static boolean isSIS(final Class<?> type) {
-        return type.getName().startsWith("org.apache.sis.");
-    }
-
-    /**
      * Appends to the given buffer only the characters that are valid for a Unicode identifier.
      * The given separator character is append before the given {@code text} only if the
buffer
      * is not empty and at least one {@code text} character is valid.

Modified: sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/Locales.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/Locales.java?rev=1748710&r1=1748709&r2=1748710&view=diff
==============================================================================
--- sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/Locales.java [UTF-8] (original)
+++ sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/Locales.java [UTF-8] Thu
Jun 16 12:37:54 2016
@@ -103,10 +103,10 @@ public final class Locales extends Stati
      */
     private static final short[] ISO3, ISO2;
     static {
-        final Short CONFLICT = 0; // Sentinal value for conflicts (paranoiac safety).
+        final Short CONFLICT = 0;                           // Sentinal value for conflicts
(paranoiac safety).
         final Map<Short,Short> map = new TreeMap<Short,Short>();
         for (final Locale locale : POOL.values()) {
-            short type = LANGUAGE; // 0 for language, or leftmost bit set for country.
+            short type = LANGUAGE;                          // 0 for language, or leftmost
bit set for country.
             do { // Executed exactly twice: once for language, than once for country.
                 final short alpha2 = toNumber((type == LANGUAGE) ? locale.getLanguage() :
locale.getCountry(), type);
                 if (alpha2 != 0) {
@@ -114,7 +114,7 @@ public final class Locales extends Stati
                     try {
                         alpha3 = toNumber((type == LANGUAGE) ? locale.getISO3Language() :
locale.getISO3Country(), type);
                     } catch (MissingResourceException e) {
-                        continue; // No 3-letters code to map for this locale.
+                        continue;                           // No 3-letters code to map for
this locale.
                     }
                     if (alpha3 != 0 && alpha3 != alpha2) {
                         final Short p = map.put(alpha3, alpha2);
@@ -127,7 +127,7 @@ public final class Locales extends Stati
                 }
             } while ((type ^= COUNTRY) != LANGUAGE);
         }
-        while (map.values().remove(CONFLICT)); // Remove all conflicts that we may have found.
+        while (map.values().remove(CONFLICT));              // Remove all conflicts that
we may have found.
         ISO3 = new short[map.size()];
         ISO2 = new short[map.size()];
         int i = 0;
@@ -318,8 +318,8 @@ filter: for (final Locale locale : local
     }
 
     /**
-     * Converts a 3-letters ISO code to a 2-letters one. If the given code is not recognized,
-     * then this method returns {@code code} unmodified.
+     * Converts a 3-letters ISO code to a 2-letters one.
+     * If the given code is not recognized, then this method returns {@code code} unmodified.
      *
      * @param  code The 3-letters code.
      * @param  type Either {@link #LANGUAGE} or {@link #COUNTRY}.

Modified: sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/logging/Logging.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/logging/Logging.java?rev=1748710&r1=1748709&r2=1748710&view=diff
==============================================================================
--- sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/logging/Logging.java [UTF-8]
(original)
+++ sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/logging/Logging.java [UTF-8]
Thu Jun 16 12:37:54 2016
@@ -25,6 +25,7 @@ import org.apache.sis.util.Configuration
 import org.apache.sis.util.Static;
 import org.apache.sis.util.Exceptions;
 import org.apache.sis.util.Classes;
+import org.apache.sis.internal.system.Modules;
 
 
 /**
@@ -85,6 +86,12 @@ public final class Logging extends Stati
      */
     private static volatile LoggerFactory<?> factory;
     static {
+        /*
+         * Use ServiceLoader.load(…), not DefaultFactories.createServiceLoader(…), for
avoiding a never-ending
+         * loop if a warning occurs in DefaultFactories. This risk exists because DefaultFactories
may use the
+         * logging services. Anyway, Apache SIS does not define any custom logger factory,
so DefaultFactories
+         * is not needed in this case.
+         */
         LoggerFactory<?> factory = null;
         for (final LoggerFactory<?> found : ServiceLoader.load(LoggerFactory.class))
{
             if (factory == null) {
@@ -170,8 +177,9 @@ public final class Logging extends Stati
         String name = classe.getName();
         final int separator = name.lastIndexOf('.');
         name = (separator >= 1) ? name.substring(0, separator) : "";
-        if (name.startsWith("org.apache.sis.internal.")) {
-            name = "org.apache.sis" + name.substring(23);       // Remove the "internal"
part from SIS package name.
+        if (name.startsWith(Modules.INTERNAL_CLASSNAME_PREFIX)) {
+            // Remove the "internal" part from Apache SIS package names.
+            name = Modules.CLASSNAME_PREFIX + name.substring(Modules.INTERNAL_CLASSNAME_PREFIX.length());
         }
         return getLogger(name);
     }
@@ -211,24 +219,6 @@ public final class Logging extends Stati
     }
 
     /**
-     * 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 are inferred from the
error stack trace,
-     * using the first {@linkplain StackTraceElement stack trace element} for which the class
name is inside
-     * a package or sub-package of the logger name.
-     *
-     * @param  logger Where to log the error, or {@code null} for inferring a default value
from other arguments.
-     * @param  error  The error that occurred, or {@code null} if none.
-     * @return {@code true} if the error has been logged, or {@code false} if the given {@code
error}
-     *         was null or if the logger does not log anything at {@link Level#WARNING}.
-     *
-     * @deprecated Use {@link #unexpectedException(Logger, Class, String, Throwable)} instead.
-     */
-    @Deprecated
-    public static boolean unexpectedException(final Logger logger, final Throwable error)
{
-        return unexpectedException(logger, null, null, error, Level.WARNING);
-    }
-
-    /**
      * 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.

Modified: sis/trunk/core/sis-utility/src/main/java/org/apache/sis/xml/MarshallerPool.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/main/java/org/apache/sis/xml/MarshallerPool.java?rev=1748710&r1=1748709&r2=1748710&view=diff
==============================================================================
--- sis/trunk/core/sis-utility/src/main/java/org/apache/sis/xml/MarshallerPool.java [UTF-8]
(original)
+++ sis/trunk/core/sis-utility/src/main/java/org/apache/sis/xml/MarshallerPool.java [UTF-8]
Thu Jun 16 12:37:54 2016
@@ -29,6 +29,7 @@ import org.apache.sis.util.logging.Loggi
 import org.apache.sis.internal.system.Loggers;
 import org.apache.sis.internal.system.DelayedExecutor;
 import org.apache.sis.internal.system.DelayedRunnable;
+import org.apache.sis.internal.system.DefaultFactories;
 import org.apache.sis.internal.jaxb.AdapterReplacement;
 import org.apache.sis.internal.jaxb.TypeRegistration;
 import org.apache.sis.util.ArgumentChecks;
@@ -57,7 +58,7 @@ import org.apache.sis.util.ArgumentCheck
  *
  * @author  Martin Desruisseaux (Geomatys)
  * @since   0.3
- * @version 0.3
+ * @version 0.8
  * @module
  *
  * @see XML
@@ -184,7 +185,7 @@ public class MarshallerPool {
     public MarshallerPool(final JAXBContext context, final Map<String,?> properties)
throws JAXBException {
         ArgumentChecks.ensureNonNull("context", context);
         this.context = context;
-        replacements = ServiceLoader.load(AdapterReplacement.class);
+        replacements = DefaultFactories.createServiceLoader(AdapterReplacement.class);
         /*
          * Detects if we are using the endorsed JAXB implementation (i.e. the one provided
in
          * separated JAR files) or the one bundled in JDK 6. We use the JAXB context package

Modified: sis/trunk/core/sis-utility/src/test/java/org/apache/sis/test/LogRecordCollector.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/test/java/org/apache/sis/test/LogRecordCollector.java?rev=1748710&r1=1748709&r2=1748710&view=diff
==============================================================================
--- sis/trunk/core/sis-utility/src/test/java/org/apache/sis/test/LogRecordCollector.java [UTF-8]
(original)
+++ sis/trunk/core/sis-utility/src/test/java/org/apache/sis/test/LogRecordCollector.java [UTF-8]
Thu Jun 16 12:37:54 2016
@@ -23,6 +23,7 @@ import java.util.logging.Handler;
 import java.util.logging.Level;
 import java.util.logging.LogRecord;
 import java.io.IOException;
+import org.apache.sis.internal.system.Modules;
 import org.apache.sis.io.TableAppender;
 import org.junit.runner.Description;
 
@@ -99,7 +100,7 @@ final class LogRecordCollector extends H
                 method = "<unknown>";
                 for (final StackTraceElement t : Thread.currentThread().getStackTrace())
{
                     final String c = t.getClassName();
-                    if (c.startsWith("org.apache.sis.") && c.endsWith(TestSuite.CLASSNAME_SUFFIX))
{
+                    if (c.startsWith(Modules.CLASSNAME_PREFIX) && c.endsWith(TestSuite.CLASSNAME_SUFFIX))
{
                         cname  = c;
                         method = t.getMethodName();
                         break;

Modified: sis/trunk/core/sis-utility/src/test/java/org/apache/sis/test/TestCase.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/test/java/org/apache/sis/test/TestCase.java?rev=1748710&r1=1748709&r2=1748710&view=diff
==============================================================================
--- sis/trunk/core/sis-utility/src/test/java/org/apache/sis/test/TestCase.java [UTF-8] (original)
+++ sis/trunk/core/sis-utility/src/test/java/org/apache/sis/test/TestCase.java [UTF-8] Thu
Jun 16 12:37:54 2016
@@ -25,6 +25,7 @@ import java.io.PrintWriter;
 import java.io.StringWriter;
 import java.io.OutputStreamWriter;
 import java.io.UnsupportedEncodingException;
+import org.apache.sis.internal.system.Loggers;
 import org.apache.sis.util.logging.Logging;
 import org.apache.sis.util.logging.MonolineFormatter;
 import org.junit.runner.RunWith;
@@ -131,7 +132,7 @@ public abstract strictfp class TestCase
      * The parent logger of all Apache SIS loggers.
      * Needs to be retained by strong reference.
      */
-    static final Logger LOGGER = Logger.getLogger("org.apache.sis");
+    static final Logger LOGGER = Logger.getLogger(Loggers.ROOT);
 
     /**
      * Initializes {@link MonolineFormatter} if it has been specified in the {@code logging.properties}

Modified: sis/trunk/pom.xml
URL: http://svn.apache.org/viewvc/sis/trunk/pom.xml?rev=1748710&r1=1748709&r2=1748710&view=diff
==============================================================================
--- sis/trunk/pom.xml (original)
+++ sis/trunk/pom.xml Thu Jun 16 12:37:54 2016
@@ -371,7 +371,7 @@ Apache SIS is a free software, Java lang
       <dependency>
         <groupId>org.apache.commons</groupId>
         <artifactId>commons-compress</artifactId>
-        <version>1.10</version>
+        <version>1.11</version>
       </dependency>
 
       <!-- Optional dependencies -->
@@ -390,8 +390,8 @@ Apache SIS is a free software, Java lang
       <dependency>
         <groupId>org.slf4j</groupId>
         <artifactId>slf4j-jdk14</artifactId>
-        <version>1.7.5</version> <!-- Must matches the version used by NetCDF.
-->
-        <scope>runtime</scope> <!-- Should never be needed at compile time.
-->
+        <version>1.7.5</version>                <!-- Must matches the version
used by NetCDF. -->
+        <scope>runtime</scope>                  <!-- Should never be needed
at compile time.  -->
       </dependency>
     </dependencies>
   </dependencyManagement>
@@ -416,7 +416,7 @@ Apache SIS is a free software, Java lang
          The last properties in this list depend on the Apache SIS branch.
        =================================================================== -->
   <properties>
-    <netcdf.version>4.4.2</netcdf.version> <!-- Last version compatible with
JDK6. -->
+    <netcdf.version>4.4.2</netcdf.version>          <!-- Last version compatible
with JDK6. -->
     <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
     <website.encoding>UTF-8</website.encoding>
     <website.locale>en</website.locale>
@@ -530,17 +530,22 @@ Apache SIS is a free software, Java lang
            INDEX.LIST file is incomplete (which seem to happen in practice). -->
       <plugin>
         <artifactId>maven-jar-plugin</artifactId>
+        <version>2.6</version>
+        <!-- Regression in maven-jar-plugin version 3.0: the class-path entry in MANIFEST.MF
+             has the "repository" layout in sis-openoffice artifact even if we explicitely
+             ask for the "simple" layout. https://issues.apache.org/jira/browse/MJAR-223
-->
+
         <configuration>
           <archive>
             <addMavenDescriptor>false</addMavenDescriptor>
             <index>false</index>
             <manifest>
               <addClasspath>true</addClasspath>
+              <classpathLayoutType>simple</classpathLayoutType>
               <addDefaultImplementationEntries>true</addDefaultImplementationEntries>
             </manifest>
             <manifestEntries>
               <Built-On>${maven.build.timestamp}</Built-On>
-              <Implementation-URL>${project.url}</Implementation-URL>
               <Specification-Title>GeoAPI</Specification-Title>
               <Specification-Version>${geoapi.version}</Specification-Version>
               <Specification-Vendor>Open Geospatial Consortium</Specification-Vendor>

Modified: sis/trunk/storage/sis-storage/src/main/java/org/apache/sis/storage/DataStoreRegistry.java
URL: http://svn.apache.org/viewvc/sis/trunk/storage/sis-storage/src/main/java/org/apache/sis/storage/DataStoreRegistry.java?rev=1748710&r1=1748709&r2=1748710&view=diff
==============================================================================
--- sis/trunk/storage/sis-storage/src/main/java/org/apache/sis/storage/DataStoreRegistry.java
[UTF-8] (original)
+++ sis/trunk/storage/sis-storage/src/main/java/org/apache/sis/storage/DataStoreRegistry.java
[UTF-8] Thu Jun 16 12:37:54 2016
@@ -20,6 +20,7 @@ import java.util.List;
 import java.util.LinkedList;
 import java.util.Iterator;
 import java.util.ServiceLoader;
+import org.apache.sis.internal.system.DefaultFactories;
 import org.apache.sis.util.ArgumentChecks;
 import org.apache.sis.util.resources.Errors;
 
@@ -39,7 +40,7 @@ import org.apache.sis.util.resources.Err
  *
  * @author  Martin Desruisseaux (Geomatys)
  * @since   0.4
- * @version 0.4
+ * @version 0.8
  * @module
  */
 final class DataStoreRegistry {
@@ -51,19 +52,20 @@ final class DataStoreRegistry {
     private final ServiceLoader<DataStoreProvider> loader;
 
     /**
-     * Creates a new registry which will use the current thread
-     * {@linkplain Thread#getContextClassLoader() context class loader}.
+     * Creates a new registry which will look for data stores accessible to the default class
loader.
+     * The default is the current thread {@linkplain Thread#getContextClassLoader() context
class loader},
+     * provided that it can access at least the Apache SIS stores.
      */
-    DataStoreRegistry() {
-        loader = ServiceLoader.load(DataStoreProvider.class);
+    public DataStoreRegistry() {
+        loader = DefaultFactories.createServiceLoader(DataStoreProvider.class);
     }
 
     /**
-     * Creates a new registry which will use the given class loader.
+     * Creates a new registry which will look for data stores accessible to the given class
loader.
      *
      * @param loader The class loader to use for loading {@link DataStoreProvider} implementations.
      */
-    DataStoreRegistry(final ClassLoader loader) {
+    public DataStoreRegistry(final ClassLoader loader) {
         ArgumentChecks.ensureNonNull("loader", loader);
         this.loader = ServiceLoader.load(DataStoreProvider.class, loader);
     }

Modified: sis/trunk/storage/sis-storage/src/test/java/org/apache/sis/test/suite/StorageTestSuite.java
URL: http://svn.apache.org/viewvc/sis/trunk/storage/sis-storage/src/test/java/org/apache/sis/test/suite/StorageTestSuite.java?rev=1748710&r1=1748709&r2=1748710&view=diff
==============================================================================
--- sis/trunk/storage/sis-storage/src/test/java/org/apache/sis/test/suite/StorageTestSuite.java
[UTF-8] (original)
+++ sis/trunk/storage/sis-storage/src/test/java/org/apache/sis/test/suite/StorageTestSuite.java
[UTF-8] Thu Jun 16 12:37:54 2016
@@ -26,10 +26,11 @@ import org.junit.BeforeClass;
  *
  * @author  Martin Desruisseaux (Geomatys)
  * @since   0.3
- * @version 0.7
+ * @version 0.8
  * @module
  */
 @Suite.SuiteClasses({
+    org.apache.sis.internal.storage.CodeTypeTest.class,
     org.apache.sis.internal.storage.IOUtilitiesTest.class,
     org.apache.sis.internal.storage.ChannelDataInputTest.class,
     org.apache.sis.internal.storage.ChannelDataOutputTest.class,



Mime
View raw message