public class CommunoteServiceManager extends Object implements EventListener<RestartServiceEvent>
CommunoteService instances.| Constructor and Description |
|---|
CommunoteServiceManager() |
| Modifier and Type | Method and Description |
|---|---|
String |
getNameOfService(Class<? extends CommunoteService> serviceClass)
Returns the name of the registered service that has the provided class.
|
Class<RestartServiceEvent> |
getObservedEvent()
Defines the types of events about which this listener will be informed.
|
void |
handle(RestartServiceEvent event)
Is called by the
EventDispatcher when the observed event was fired. |
boolean |
isRunning(String serviceName)
Returns whether the named service is running.
|
boolean |
registerService(CommunoteService service)
Registers the service if it is not yet registered.
|
boolean |
registerService(CommunoteService service,
boolean start)
Registers the service if it is not yet registered.
|
void |
restart(String serviceName)
Stops a service by name and restarts it afterwards.
|
void |
shutdown()
Stops and unregisters all running services.
|
void |
start(String serviceName)
Starts a service by name.
|
void |
stop(String serviceName)
Stops a service by name.
|
public String getNameOfService(Class<? extends CommunoteService> serviceClass)
serviceClass - the class of the servicepublic Class<RestartServiceEvent> getObservedEvent()
getObservedEvent in interface EventListener<RestartServiceEvent>public void handle(RestartServiceEvent event)
EventDispatcher when the observed event was fired.handle in interface EventListener<RestartServiceEvent>event - the event that was firedpublic boolean isRunning(String serviceName)
CommunoteService.isRunning() of the named service.serviceName - the name of the service whose status is to be returnedpublic boolean registerService(CommunoteService service)
CommunoteService.getName().service - the service to registershutdown() had been calledpublic boolean registerService(CommunoteService service, boolean start)
CommunoteService.getName().service - the service to registerstart - whether to directly start the service after registeringshutdown() had been calledpublic void restart(String serviceName)
serviceName - the name of the service to restartpublic void shutdown()
public void start(String serviceName)
serviceName - the name of the service to startpublic void stop(String serviceName)
serviceName - the name of the service to stopCopyright © 2019 Communote team. All rights reserved.