Package org.apache.sis.referencing
Class AuthorityFactories<T extends org.opengis.referencing.AuthorityFactory>
java.lang.Object
java.util.AbstractCollection<E>
java.util.AbstractSet<E>
org.apache.sis.internal.util.SetOfUnknownSize<E>
org.apache.sis.internal.referencing.LazySet<T>
org.apache.sis.referencing.AuthorityFactories<T>
- All Implemented Interfaces:
Iterable<T>
,Collection<T>
,Set<T>
final class AuthorityFactories<T extends org.opengis.referencing.AuthorityFactory>
extends LazySet<T>
Provides the CRS, CS, datum and coordinate operation authority factories.
Provides also the system-wide
MultiAuthoritiesFactory
instance used by CRS.forCode(String)
.
Current version handles the EPSG factory in a special way, but we may try to avoid doing special cases in a
future SIS version (this may require more help from ServiceLoader
).- Since:
- 0.7
- Version:
- 0.8
-
Field Summary
FieldsModifier and TypeFieldDescription(package private) static final MultiAuthoritiesFactory
The unique system-wide authority factory instance that contains all factories found on the classpath, plus the EPSG factory.private static final GeodeticAuthorityFactory[]
An array containing only the EPSG factory. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivate
AuthorityFactories
(Class<T> type) Creates a new provider for factories of the given type. -
Method Summary
Modifier and TypeMethodDescription(package private) static GeodeticAuthorityFactory
EPSG()
Returns the factory connected to the EPSG geodetic dataset if possible, or the EPSG fallback otherwise.(package private) static void
EPSG
(GeodeticAuthorityFactory factory) Sets the EPSG factory to the given value.(package private) static boolean
Notifies that a factory is unavailable, but without giving a fallback and without logging.(package private) static GeodeticAuthorityFactory
Returns the fallback to use if the authority factory is not available.protected T[]
Invoked byLazySet
for adding the EPSG factory before any other factory fetched byServiceLoader
.private static void
Logs the given exception at the given level.protected T
Invoked byLazySet
for fetching the next element from the given iterator.Methods inherited from class org.apache.sis.internal.referencing.LazySet
cache, cached, isEmpty, iterator, reload, size
Methods inherited from class org.apache.sis.internal.util.SetOfUnknownSize
equals, isSizeKnown, removeAll, spliterator, toArray, toArray
Methods inherited from class java.util.AbstractSet
hashCode
Methods inherited from class java.util.AbstractCollection
add, addAll, clear, contains, containsAll, remove, retainAll, toString
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArray
-
Field Details
-
EPSG
An array containing only the EPSG factory. Content of this array is initially null. The EPSG factory will be created when first needed byinitialValues()
. This array is returned directly (not cloned) byinitialValues()
. -
ALL
The unique system-wide authority factory instance that contains all factories found on the classpath, plus the EPSG factory. TheEPSGFactoryProxy
most be excluded from this list, since the EPSG factory is handled in a special way.
-
-
Constructor Details
-
AuthorityFactories
Creates a new provider for factories of the given type.
-
-
Method Details
-
EPSG
Sets the EPSG factory to the given value. -
EPSG
Returns the factory connected to the EPSG geodetic dataset if possible, or the EPSG fallback otherwise. If an EPSG data source has been found, then this method returns an instance ofEPSGFactory
but there is no guarantee that attempts to use that factory will succeed; for example maybe the EPSG schema does not exist. Callers should be prepared to either receive anEPSGFactoryFallback
directly if the EPSG data source does not exist, or replace theEPSGFactory
by aEPSGFactoryFallback
later if attempt to use the returned factory fails. -
log
Logs the given exception at the given level. This method pretends that the logging come fromCRS.getAuthorityFactory(String)
, which is the public facade forEPSG()
. -
initialValues
Invoked byLazySet
for adding the EPSG factory before any other factory fetched byServiceLoader
. We put the EPSG factory first because it is often used anyway even forCRS
andAUTO
namespaces.This method tries to instantiate an
EPSGFactory
if possible, or anEPSGFactoryFallback
otherwise.- Overrides:
initialValues
in classLazySet<T extends org.opengis.referencing.AuthorityFactory>
- Returns:
- the EPSG factory in an array. Callers shall not modify the returned array.
-
next
Invoked byLazySet
for fetching the next element from the given iterator. Skips theEPSGFactoryProxy
if possible, or returnsnull
otherwise. Note thatMultiAuthoritiesFactory
is safe to null values.
-