Interface ModuleServicesManager
-
public interface ModuleServicesManager
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description <T extends ModuleService>
TgetService(java.lang.Class<T> serviceClass)
Retrieves aModuleService
indicated by the givenserviceClass
.void
notifyServiceReady(ModuleService service)
To be called by aModuleService
after it is first ready for use.void
notifyServiceShutdown(ModuleService service)
To be called by aModuleService
when it is longer ready for use.void
registerService(java.lang.Class<? extends ModuleService> serviceClass, ModuleService service)
Registers aModuleService
for use.void
subscribe(java.lang.Class<? extends ModuleService> serviceClass, ModuleServiceConsumer consumer)
Indicate that the givenModuleServiceConsumer
is interested in using theModuleService
indicated byserviceClass
.void
unregisterService(java.lang.Class<? extends ModuleService> serviceClass)
Unregisters aModuleService
with the givenserviceClass
.void
unsubscribe(java.lang.Class<? extends ModuleService> serviceClass, ModuleServiceConsumer consumer)
Indicate that the givenModuleServiceConsumer
is no longer interested in theModuleService
indicated byserviceClass
.
-
-
-
Method Detail
-
registerService
void registerService(java.lang.Class<? extends ModuleService> serviceClass, ModuleService service)
Registers aModuleService
for use.- Parameters:
serviceClass
- the ClassModuleServiceConsumer
s will request this service by.service
- theModuleService
provided.
-
unregisterService
void unregisterService(java.lang.Class<? extends ModuleService> serviceClass)
Unregisters aModuleService
with the givenserviceClass
.- Parameters:
serviceClass
- theModuleService
Class to unregister.
-
getService
<T extends ModuleService> T getService(java.lang.Class<T> serviceClass)
Retrieves aModuleService
indicated by the givenserviceClass
. AModuleService
should not be retrieved by aModuleServiceConsumer
until it has been notified of its availability.- Parameters:
serviceClass
- the Class linked to the desiredModuleService
.- Returns:
- the
ModuleService
indicated byserviceClass
.
-
subscribe
void subscribe(java.lang.Class<? extends ModuleService> serviceClass, ModuleServiceConsumer consumer)
Indicate that the givenModuleServiceConsumer
is interested in using theModuleService
indicated byserviceClass
. TheModuleServiceConsumer
will be notified when theModuleService
is ready for use.- Parameters:
serviceClass
- the Class used to indicate theModuleService
.consumer
- theModuleServiceConsumer
interested in theModuleService
.
-
unsubscribe
void unsubscribe(java.lang.Class<? extends ModuleService> serviceClass, ModuleServiceConsumer consumer)
Indicate that the givenModuleServiceConsumer
is no longer interested in theModuleService
indicated byserviceClass
.- Parameters:
serviceClass
- the Class used to indicate theModuleService
.consumer
-ModuleServiceConsumer
to unsubscribe.
-
notifyServiceReady
void notifyServiceReady(ModuleService service)
To be called by aModuleService
after it is first ready for use.All
ModuleServiceConsumer
s that subscribed prior to this call will be notified that the service is ready.- Parameters:
service
- theModuleService
that is ready.
-
notifyServiceShutdown
void notifyServiceShutdown(ModuleService service)
To be called by aModuleService
when it is longer ready for use.All subscribed
ModuleServiceConsumer
s will be notified of the shutdown.- Parameters:
service
- theModuleService
that is no longer ready for use.
-
-