Interface ModuleServicesManager
public interface ModuleServicesManager
-
Method Summary
Modifier and TypeMethodDescription<T extends ModuleService>
TgetService(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(Class<? extends ModuleService> serviceClass, ModuleService service) Registers aModuleServicefor use.voidsubscribe(Class<? extends ModuleService> serviceClass, ModuleServiceConsumer consumer) Indicate that the givenModuleServiceConsumeris interested in using theModuleServiceindicated byserviceClass.voidunregisterService(Class<? extends ModuleService> serviceClass) Unregisters aModuleServicewith the givenserviceClass.voidunsubscribe(Class<? extends ModuleService> serviceClass, ModuleServiceConsumer consumer) Indicate that the givenModuleServiceConsumeris no longer interested in theModuleServiceindicated byserviceClass.
-
Method Details
-
registerService
Registers aModuleServicefor use.- Parameters:
serviceClass- the ClassModuleServiceConsumers will request this service by.service- theModuleServiceprovided.
-
unregisterService
Unregisters aModuleServicewith the givenserviceClass.- Parameters:
serviceClass- theModuleServiceClass to unregister.
-
getService
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
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
Indicate that the givenModuleServiceConsumeris no longer interested in theModuleServiceindicated byserviceClass.- Parameters:
serviceClass- the Class used to indicate theModuleService.consumer-ModuleServiceConsumerto unsubscribe.
-
notifyServiceReady
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
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.
-