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 aModuleServiceindicated by the givenserviceClass.voidnotifyServiceReady(ModuleService service)To be called by aModuleServiceafter it is first ready for use.voidnotifyServiceShutdown(ModuleService service)To be called by aModuleServicewhen it is longer ready for use.voidregisterService(java.lang.Class<? extends ModuleService> serviceClass, ModuleService service)Registers aModuleServicefor use.voidsubscribe(java.lang.Class<? extends ModuleService> serviceClass, ModuleServiceConsumer consumer)Indicate that the givenModuleServiceConsumeris interested in using theModuleServiceindicated byserviceClass.voidunregisterService(java.lang.Class<? extends ModuleService> serviceClass)Unregisters aModuleServicewith the givenserviceClass.voidunsubscribe(java.lang.Class<? extends ModuleService> serviceClass, ModuleServiceConsumer consumer)Indicate that the givenModuleServiceConsumeris no longer interested in theModuleServiceindicated byserviceClass.
-
-
-
Method Detail
-
registerService
void registerService(java.lang.Class<? extends ModuleService> serviceClass, ModuleService service)
Registers aModuleServicefor use.- Parameters:
serviceClass- the ClassModuleServiceConsumers will request this service by.service- theModuleServiceprovided.
-
unregisterService
void unregisterService(java.lang.Class<? extends ModuleService> serviceClass)
Unregisters aModuleServicewith the givenserviceClass.- Parameters:
serviceClass- theModuleServiceClass to unregister.
-
getService
<T extends ModuleService> T getService(java.lang.Class<T> serviceClass)
Retrieves aModuleServiceindicated by the givenserviceClass. AModuleServiceshould not be retrieved by aModuleServiceConsumeruntil it has been notified of its availability.- Parameters:
serviceClass- the Class linked to the desiredModuleService.- Returns:
- the
ModuleServiceindicated byserviceClass.
-
subscribe
void subscribe(java.lang.Class<? extends ModuleService> serviceClass, ModuleServiceConsumer consumer)
Indicate that the givenModuleServiceConsumeris interested in using theModuleServiceindicated byserviceClass. TheModuleServiceConsumerwill be notified when theModuleServiceis ready for use.- Parameters:
serviceClass- the Class used to indicate theModuleService.consumer- theModuleServiceConsumerinterested in theModuleService.
-
unsubscribe
void unsubscribe(java.lang.Class<? extends ModuleService> serviceClass, ModuleServiceConsumer consumer)
Indicate that the givenModuleServiceConsumeris no longer interested in theModuleServiceindicated byserviceClass.- Parameters:
serviceClass- the Class used to indicate theModuleService.consumer-ModuleServiceConsumerto unsubscribe.
-
notifyServiceReady
void notifyServiceReady(ModuleService service)
To be called by aModuleServiceafter it is first ready for use.All
ModuleServiceConsumers that subscribed prior to this call will be notified that the service is ready.- Parameters:
service- theModuleServicethat is ready.
-
notifyServiceShutdown
void notifyServiceShutdown(ModuleService service)
To be called by aModuleServicewhen it is longer ready for use.All subscribed
ModuleServiceConsumers will be notified of the shutdown.- Parameters:
service- theModuleServicethat is no longer ready for use.
-
-