public abstract class SimpleService extends BaseComponent implements java.lang.Runnable, Stateful, Resettable, Stoppable, LogEnabled
Note that this class is only required when special interaction with Oddjob is required such as different state handling. Most simple service can be provided a classes to be proxied.
Constructor and Description |
---|
SimpleService()
Constructor.
|
Modifier and Type | Method and Description |
---|---|
protected void |
fireDestroyedState()
Internal method to fire state.
|
java.lang.String |
getName()
Get the name.
|
protected ServiceStateChanger |
getStateChanger() |
boolean |
hardReset()
Perform a hard reset on the job.
|
protected IconHelper |
iconHelper()
Subclasses must provide a
IconHelper . |
protected org.slf4j.Logger |
logger() |
java.lang.String |
loggerName()
Provide the logger name.
|
protected void |
onDestroy()
Subclasses override this method to clear up resources.
|
protected abstract void |
onStart() |
protected void |
onStop()
Allow sub classes to do something on stop.
|
void |
run() |
void |
setName(java.lang.String name)
Set the name
|
boolean |
softReset()
Perform a soft reset on the job.
|
protected ServiceStateHandler |
stateHandler()
Subclasses must provide a
StateHandler . |
void |
stop()
Stop executing.
|
java.lang.String |
toString() |
addIconListener, addPropertyChangeListener, addStateListener, configure, destroy, firePropertyChange, getArooaSession, iconForId, initialise, lastStateEvent, onConfigured, onInitialised, removeIconListener, removePropertyChangeListener, removeStateListener, save, save, setArooaContext, setArooaSession
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
addStateListener, lastStateEvent, removeStateListener
protected org.slf4j.Logger logger()
logger
in class BaseComponent
public java.lang.String loggerName()
LogEnabled
loggerName
in interface LogEnabled
protected ServiceStateHandler stateHandler()
BaseComponent
StateHandler
.stateHandler
in class BaseComponent
protected IconHelper iconHelper()
BaseComponent
IconHelper
.iconHelper
in class BaseComponent
protected ServiceStateChanger getStateChanger()
public void run()
run
in interface java.lang.Runnable
protected abstract void onStart() throws java.lang.Throwable
java.lang.Exception
java.lang.Throwable
public void stop() throws FailedToStopException
Stoppable
stop
in interface Stoppable
FailedToStopException
protected void onStop() throws FailedToStopException
FailedToStopException
public boolean softReset()
softReset
in interface Resettable
public boolean hardReset()
hardReset
in interface Resettable
public java.lang.String getName()
public void setName(java.lang.String name)
name
- The name.public java.lang.String toString()
toString
in class java.lang.Object
protected void onDestroy()
BaseComponent
onDestroy
in class BaseComponent
protected void fireDestroyedState()
fireDestroyedState
in class BaseComponent