public interface ModuleServicesManager
Modifier and Type | Method and Description |
---|---|
<T extends ModuleService> |
getService(java.lang.Class<T> serviceClass)
Retrieves a
ModuleService indicated by the given serviceClass . |
void |
notifyServiceReady(ModuleService service)
To be called by a
ModuleService after it is first ready for use. |
void |
notifyServiceShutdown(ModuleService service)
To be called by a
ModuleService when it is longer ready for use. |
void |
registerService(java.lang.Class<? extends ModuleService> serviceClass,
ModuleService service)
Registers a
ModuleService for use. |
void |
subscribe(java.lang.Class<? extends ModuleService> serviceClass,
ModuleServiceConsumer consumer)
Indicate that the given
ModuleServiceConsumer is interested in using the ModuleService
indicated by serviceClass . |
void |
unregisterService(java.lang.Class<? extends ModuleService> serviceClass)
Unregisters a
ModuleService with the given serviceClass . |
void |
unsubscribe(java.lang.Class<? extends ModuleService> serviceClass,
ModuleServiceConsumer consumer)
Indicate that the given
ModuleServiceConsumer is no longer interested in the ModuleService
indicated by serviceClass . |
void registerService(java.lang.Class<? extends ModuleService> serviceClass, ModuleService service)
ModuleService
for use.serviceClass
- the Class ModuleServiceConsumer
s will request this service by.service
- the ModuleService
provided.void unregisterService(java.lang.Class<? extends ModuleService> serviceClass)
ModuleService
with the given serviceClass
.serviceClass
- the ModuleService
Class to unregister.<T extends ModuleService> T getService(java.lang.Class<T> serviceClass)
ModuleService
indicated by the given serviceClass
. A ModuleService
should not
be retrieved by a ModuleServiceConsumer
until it has been notified of its availability.serviceClass
- the Class linked to the desired ModuleService
.ModuleService
indicated by serviceClass
.void subscribe(java.lang.Class<? extends ModuleService> serviceClass, ModuleServiceConsumer consumer)
ModuleServiceConsumer
is interested in using the ModuleService
indicated by serviceClass
.
The ModuleServiceConsumer
will be notified when the ModuleService
is ready for use.serviceClass
- the Class used to indicate the ModuleService
.consumer
- the ModuleServiceConsumer
interested in the ModuleService
.void unsubscribe(java.lang.Class<? extends ModuleService> serviceClass, ModuleServiceConsumer consumer)
ModuleServiceConsumer
is no longer interested in the ModuleService
indicated by serviceClass
.serviceClass
- the Class used to indicate the ModuleService
.consumer
- ModuleServiceConsumer
to unsubscribe.void notifyServiceReady(ModuleService service)
ModuleService
after it is first ready for use.
All ModuleServiceConsumer
s that subscribed prior to this call will be notified that the service
is ready.
service
- the ModuleService
that is ready.void notifyServiceShutdown(ModuleService service)
ModuleService
when it is longer ready for use.
All subscribed ModuleServiceConsumer
s will be notified of the shutdown.
service
- the ModuleService
that is no longer ready for use.