Package org.apache.sis.internal.util
Class MetadataServices
java.lang.Object
org.apache.sis.internal.system.SystemListener
org.apache.sis.internal.system.OptionalDependency
org.apache.sis.internal.util.MetadataServices
- All Implemented Interfaces:
EventListener
- Direct Known Subclasses:
ServicesForUtility
Provides access to services defined in the
"sis-metadata" module.
This class searches for the ServicesForUtility
implementation using Java reflection.- Since:
- 0.6
- Version:
- 1.2
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringA pseudo-authority name used byInstallationResourcesfor identifying the embedded data resources.private static MetadataServicesThe services, fetched when first needed. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected final voidInvoked when the classpath changed.createCoordinateFormat(Locale locale, TimeZone timezone) Creates a format forDirectPositioninstances.getCodeTitle(org.opengis.util.CodeList<?> code, Locale locale) Returns the title of the given enumeration or code list value.Returns the data source for the SIS-wide "SpatialMetadata" database.getInformation(String key, Locale locale) Returns information about the Apache SIS configuration to be reported inAbout.static MetadataServicesReturns the singleton instance.getUnicodeIdentifier(org.opengis.metadata.citation.Citation citation) Infers an identifier from the given citation, or returnsnullif no identifier has been found.booleantrueif this thread is in the process of reading a XML document with JAXB.voidSpecifies the data source to use if there is no JNDI environment or if no data source is binded tojdbc/SpatialMetadata.Methods inherited from class org.apache.sis.internal.system.OptionalDependency
getInstance, moduleNotFoundMethods inherited from class org.apache.sis.internal.system.SystemListener
add, databaseChanged, fireClasspathChanged, remove
-
Field Details
-
EMBEDDED
A pseudo-authority name used byInstallationResourcesfor identifying the embedded data resources. The actual data are provided by the metadata module.- See Also:
-
instance
The services, fetched when first needed.
-
-
Constructor Details
-
MetadataServices
protected MetadataServices()For subclass only. This constructor registers this instance as aSystemListenerin order to force a newMetadataServiceslookup if the classpath changes.
-
-
Method Details
-
classpathChanged
protected final void classpathChanged()Invoked when the classpath changed. Resets theinstancetonullin order to force the next call togetInstance()to fetch a new one, which may be different.- Overrides:
classpathChangedin classOptionalDependency
-
getInstance
Returns the singleton instance.- Returns:
- the singleton instance.
-
isUnmarshalling
public boolean isUnmarshalling()trueif this thread is in the process of reading a XML document with JAXB.- Returns:
- if XML unmarshalling is in progress in current thread.
-
getCodeTitle
Returns the title of the given enumeration or code list value.- Parameters:
code- the code for which to get the title.locale- desired locale for the title.- Returns:
- the title.
- See Also:
-
getUnicodeIdentifier
Infers an identifier from the given citation, or returnsnullif no identifier has been found. This method returns a non-null value only if the identifier is a valid Unicode identifier.- Parameters:
citation- the citation for which to get the identifier, ornull.- Returns:
- a non-empty identifier without leading or trailing whitespaces, or
null.
-
getInformation
Returns information about the Apache SIS configuration to be reported inAbout. This method is invoked only for aspects that depends on other modules thansis-utility.Current keys are:
"EPSG": version of EPSG database."DataSource": URL to the data source, or error message.
- Parameters:
key- a key identifying the information to return.locale- language to use if possible.- Returns:
- the information, or
nullif none. - See Also:
-
createCoordinateFormat
Creates a format forDirectPositioninstances.- Parameters:
locale- the locale for the newFormat, ornullforLocale.ROOT.timezone- the timezone, ornullfor UTC.- Returns:
- a
CoordinateFormat.
-
getDataSource
Returns the data source for the SIS-wide "SpatialMetadata" database.- Returns:
- the data source for the
$SIS_DATA/Databases/SpatialMetadataor equivalent database, ornullif none. - Throws:
SQLException- if an error occurred while fetching the database source.
-
setDataSource
Specifies the data source to use if there is no JNDI environment or if no data source is binded tojdbc/SpatialMetadata.- Parameters:
ds- supplier of data source to set, ornullfor removing previous supplier. This supplier may returnnull, in which case it will be ignored.- Throws:
IllegalStateException- ifDataSourcehas already be obtained before this method call.
-