@Deprecated public final class Factories extends Static
Integration plugins: If hosting Geotk in a alternate plugin system such as
Spring or OSGi, application may needs to register additional "Factory Iterators" for Geotk
to search using the
Defined in the
|Modifier and Type||Method and Description|
Adds the specified listener to the list of objects to inform when a system-wide configuration changed.
Adds an alternative way to search for factory implementations.
Lists all available factory implementations in a tabular format.
Returns an iterator giving precedence to classes loaded by the given class loader or one of its parents/children.
Removes the specified listener from the list of objects to inform when a system-wide configuration changed.
Removes a provider that was previously added.
public static void addChangeListener(ChangeListener listener)
listener- The listener to add.
public static void removeChangeListener(ChangeListener listener)
listener- The listener to remove.
@Configuration public static void addFactoryIteratorProvider(FactoryIteratorProvider provider)
FactoryRegistryhas a default mechanism bundled in it, which uses the content of all
META-INF/servicesdirectories found on the classpath. This
addFactoryIteratorProvidermethod allows to specify additional discovery algorithms. It may be useful in the context of some frameworks that use the constructor injection pattern, like the Spring framework.
If the given provider was not already registered, then this method notifies
every listeners registered with
provider- A new provider for factory iterators.
@Configuration public static void removeFactoryIteratorProvider(FactoryIteratorProvider provider)
If the given provider was found, then this method notifies every listeners
provider- The provider to remove.
@Debug public static void listProviders(Collection<FactoryRegistry> registries, Writer out, Locale locale) throws IOException
registries- Where the factories are registered.
out- The output stream where to format the list.
locale- The locale for the list, or
IOException- if an error occurs while writing to
public static <T> Iterator<T> orderForClassLoader(ClassLoader classLoader, Iterator<T> iterator)
geotk-coverageiomodule defines new
ImageReaderimplementations, which are automatically discovered by the standard JDK through the
META-INF/services/mechanism. If a web container contains two copies of the Geotoolkit.org library - one for each web application - then all image formats like
NetcdfImageReaderwill be registered twice, because the JVM will find two
NetcdfImageReader.Spiclasses loaded by two different class loaders.
The service provider instance returned by
be somewhat random in the above scenario. This leads to subtle and hard-to-identify
bugs. This method reduces the risk by giving precedence to SPI classes loaded by the
same class loader than the application. However users are still encouraged to load,
for each running JVM, only one copy of the Geotoolkit.org library to be shared by all
T- The type of elements in the iterator.
classLoader- The desired class loader, or
nullfor the bootstrap class loader.
iterator- The iterator to wrap.
Copyright © 2009–2017 Geotoolkit.org. All rights reserved.