|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.modeshape.repository.service.AbstractServiceAdministrator
@ThreadSafe public abstract class AbstractServiceAdministrator

Simple abstract implementation of the service administrator interface that can be easily subclassed by services that require an administrative interface.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from interface org.modeshape.repository.service.ServiceAdministrator |
|---|
ServiceAdministrator.State |
| Constructor Summary | |
|---|---|
protected |
AbstractServiceAdministrator(I18n serviceName,
ServiceAdministrator.State initialState)
|
| Method Summary | |
|---|---|
protected abstract boolean |
doCheckIsTerminated()
Subclasses should implement this method to determine whether the service has completed shutdown. |
protected void |
doPause(ServiceAdministrator.State fromState)
Implementation of the functionality to switch to the paused state. |
protected void |
doShutdown(ServiceAdministrator.State fromState)
Implementation of the functionality to switch to the shutdown state. |
protected void |
doStart(ServiceAdministrator.State fromState)
Implementation of the functionality to switch to the started state. |
String |
getServiceName()
Get the name of this service in the current locale. |
String |
getServiceName(Locale locale)
Get the name of this service in the specified locale. |
ServiceAdministrator.State |
getState()
Return the current state of this service. |
boolean |
isPaused()
Return whether this service is currently paused. |
boolean |
isShutdown()
Return whether this service is stopped and unable to be restarted. |
boolean |
isStarted()
Return whether this service has been started and is currently running. |
boolean |
isTerminated()
Return whether this system has finished shutting down. |
ServiceAdministrator |
pause()
Temporarily stop monitoring and sequencing events. |
ServiceAdministrator |
setState(ServiceAdministrator.State state)
Set the state of the service. |
ServiceAdministrator |
setState(String state)
Set the state of the service. |
ServiceAdministrator |
shutdown()
Permanently stop monitoring and sequencing events. |
ServiceAdministrator |
start()
Start monitoring and sequence the events. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface org.modeshape.repository.service.ServiceAdministrator |
|---|
awaitTermination |
| Constructor Detail |
|---|
protected AbstractServiceAdministrator(I18n serviceName,
ServiceAdministrator.State initialState)
| Method Detail |
|---|
public ServiceAdministrator.State getState()
getState in interface ServiceAdministratorpublic ServiceAdministrator setState(ServiceAdministrator.State state)
setState in interface ServiceAdministratorstate - the desired state
setState(String),
start(),
pause(),
shutdown()public ServiceAdministrator setState(String state)
setState in interface ServiceAdministratorstate - the desired state in string form
IllegalArgumentException - if the specified state string is null or does not match one of the predefined
predefined enumerated valuesServiceAdministrator.setState(State),
start(),
pause(),
shutdown()public ServiceAdministrator start()
paused. However, once the service is shutdown, it cannot be started or paused.
start in interface ServiceAdministratorIllegalStateException - if called when the service has been shutdown.pause(),
shutdown(),
isStarted()protected void doStart(ServiceAdministrator.State fromState)
ServiceAdministrator.State.PAUSED). This method does nothing by default,
and should be overridden if needed.
fromState - the state from which this service is transitioning; never null
IllegalStateException - if the service is such that it cannot be transitioned from the supplied statepublic ServiceAdministrator pause()
started. However, once the service is shutdown, it cannot be started or paused.
pause in interface ServiceAdministratorIllegalStateException - if called when the service has been shutdown.start(),
shutdown(),
isPaused()protected void doPause(ServiceAdministrator.State fromState)
ServiceAdministrator.State.STARTED). This method does nothing by default,
and should be overridden if needed.
fromState - the state from which this service is transitioning; never null
IllegalStateException - if the service is such that it cannot be transitioned from the supplied statepublic ServiceAdministrator shutdown()
restarted or paused.
shutdown in interface ServiceAdministratorstart(),
pause(),
isShutdown()protected void doShutdown(ServiceAdministrator.State fromState)
ServiceAdministrator.State.STARTED or
ServiceAdministrator.State.PAUSED). This method does nothing by default, and should be overridden if needed.
fromState - the state from which this service is transitioning; never null
IllegalStateException - if the service is such that it cannot be transitioned from the supplied statepublic boolean isStarted()
isStarted in interface ServiceAdministratorstart(),
pause(),
isPaused(),
isShutdown()public boolean isPaused()
isPaused in interface ServiceAdministratorpause(),
start(),
isStarted(),
isShutdown()public boolean isShutdown()
isShutdown in interface ServiceAdministratorshutdown(),
isPaused(),
isStarted()public boolean isTerminated()
shutting down. Note that isTerminated is never
true unless either ServiceAdministrator.shutdown() was called first.
isTerminated in interface ServiceAdministratorServiceAdministrator.shutdown(),
ServiceAdministrator.isPaused(),
ServiceAdministrator.isStarted(),
ServiceAdministrator.isShutdown()protected abstract boolean doCheckIsTerminated()
public String getServiceName()
public String getServiceName(Locale locale)
locale - the locale in which the service name is to be returned; may be null if the default locale is to be used
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||