Package org.apache.sis.internal.system
Class SystemListener
java.lang.Object
org.apache.sis.internal.system.SystemListener
- All Implemented Interfaces:
EventListener
- Direct Known Subclasses:
CoordinateOperations,DefaultFactories,OptionalDependency,XmlUtilities
Listeners for changes in the Apache SIS system. This listener is used only for rare events,
like OSGi module loaded or unloaded. We use this class instead of OSGi listeners in order
to keep the SIS library OSGi-independent.
- Since:
- 0.3
- Version:
- 0.6
- Author:
- Martin Desruisseaux (Geomatys)
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidadd(SystemListener listener) Adds the given listener to the list of listeners to notify when a change occurs.protected abstract voidInvoked when the classpath is likely to have changed.protected voidInvoked when the database content changed.static voidNotifies all registered listeners that the classpath may have changed.static voidremove(SystemListener listener) Removes all occurrences (not just the first one) of the given listener.
-
Constructor Details
-
SystemListener
Creates a new listener.- Parameters:
module- the OSGi module symbolic name, as declared in theBundle-SymbolicNameentry of theMETA-INF/MANIFEST.MFfile. Shall be one ofModulesconstants.
-
-
Method Details
-
add
Adds the given listener to the list of listeners to notify when a change occurs. This method doesn't check if the given listener is already present in the array, unless assertions are enabled.- Parameters:
listener- the listener to add. Cannot benull.
-
remove
Removes all occurrences (not just the first one) of the given listener. Only one occurrence should exist, but this method check all of them as a paranoiac check.`- Parameters:
listener- the listener to remove.
-
fireClasspathChanged
public static void fireClasspathChanged()Notifies all registered listeners that the classpath may have changed. -
classpathChanged
protected abstract void classpathChanged()Invoked when the classpath is likely to have changed. When this method is invoked, any classes usingServiceLoaderare advised to clear their cache. -
databaseChanged
protected void databaseChanged()Invoked when the database content changed. When this method is invoked, EPSG and Citations database are advised to clear their cache.- Since:
- 0.6
-