de.intarsys.tools.event
public abstract class LifecycleWatchdog extends java.lang.Object implements IStartStop
Modifier and Type | Field and Description |
---|---|
protected INotificationListener |
listenFactoryLifecycle
A listener for factory lifecycle events
|
protected INotificationListener |
listenObjectLifecycle
A listener for object lifecycle events
|
Constructor and Description |
---|
LifecycleWatchdog(INotificationSupport factory) |
Modifier and Type | Method and Description |
---|---|
protected void |
arm(INotificationSupport object) |
protected void |
disarm(INotificationSupport object) |
java.lang.String |
getLabel() |
INotificationSupport |
getObject() |
boolean |
isStarted()
Answer
true if this object is started |
protected void |
myFactoryStarted(Event event) |
protected void |
myFactoryStopped(Event event) |
protected void |
myObjectActivated(java.lang.Object object)
A previously armed IObject is activated.
|
protected void |
myObjectCreated(java.lang.Object object)
A new IObject is created and armed for further notification.
|
protected void |
myObjectDeactivated(java.lang.Object object)
A previously armed IObject is deactivated.
|
protected void |
myObjectDestroyed(java.lang.Object object)
A previously armed IObject is destroyed.
|
protected void |
myObjectStarted(java.lang.Object object)
A previously armed IObject is started.
|
protected void |
myObjectStopped(java.lang.Object object)
A previously armed IObject is stopped.
|
protected boolean |
myObjectStopRequested(java.lang.Object object)
A previously armed IObject is requested to stop.
|
protected void |
objectActivated(java.lang.Object object)
Redefine to get informed when an IObject is activated.
|
protected void |
objectCreated(java.lang.Object object)
Redefine to get informed when an IObject is created.
|
protected void |
objectDeactivated(java.lang.Object object)
Redefine to get informed when an IObject is deactivated.
|
protected void |
objectDestroyed(java.lang.Object object)
Redefine to get informed when an IObject is destroyed.
|
protected void |
objectStarted(java.lang.Object object)
Redefine to get informed when an IObject is started.
|
protected void |
objectStopped(java.lang.Object object)
Redefine to get informed when an IObject is requested to stop.
|
protected boolean |
objectStopRequested(java.lang.Object object)
Redefine to get informed when an IObject is stopped.
|
protected void |
onFactoryLifecycleEvent(Event event)
A previously armed object is activated.
|
protected void |
onObjectLifecycleEvent(Event event)
A previously armed object is activated.
|
void |
setLabel(java.lang.String label) |
void |
start()
Arm the watchdog itself.
|
void |
startAuto()
Arm the watchdog itself.
|
void |
stop()
Disarm the watchdog itself.
|
boolean |
stopRequested(java.util.Set visited)
Ask the component if it agrees to end its lifecycle at the very moment.
|
protected boolean |
supports(java.lang.Object object)
Answer
true if we are interested in the object
instance. |
java.lang.String |
toString() |
protected final INotificationListener listenObjectLifecycle
protected final INotificationListener listenFactoryLifecycle
public LifecycleWatchdog(INotificationSupport factory)
protected void arm(INotificationSupport object)
protected void disarm(INotificationSupport object)
public java.lang.String getLabel()
public INotificationSupport getObject()
public boolean isStarted()
IStartStop
true
if this object is startedisStarted
in interface IStartStop
true
if this object is started.protected final void myFactoryStarted(Event event)
protected final void myFactoryStopped(Event event)
protected final void myObjectActivated(java.lang.Object object)
event
- The activation event instanceprotected final void myObjectCreated(java.lang.Object object)
event
- The activation event instanceprotected final void myObjectDeactivated(java.lang.Object object)
event
- The activation event instanceprotected final void myObjectDestroyed(java.lang.Object object)
event
- The activation event instanceprotected final void myObjectStarted(java.lang.Object object)
event
- The activation event instanceprotected final void myObjectStopped(java.lang.Object object)
event
- The activation event instanceprotected final boolean myObjectStopRequested(java.lang.Object object)
event
- The event instanceprotected void objectActivated(java.lang.Object object)
object
- The object that was activated.protected void objectCreated(java.lang.Object object)
object
- The object that was created,protected void objectDeactivated(java.lang.Object object)
object
- the object that was deactivated.protected void objectDestroyed(java.lang.Object object)
object
- The object that was destroyed.protected void objectStarted(java.lang.Object object)
object
- The object that was started.protected void objectStopped(java.lang.Object object)
object
- The object that was stopped.protected boolean objectStopRequested(java.lang.Object object)
object
- The object that should be stopped.protected void onFactoryLifecycleEvent(Event event)
event
- The activation event instanceprotected void onObjectLifecycleEvent(Event event)
event
- The activation event instancepublic void setLabel(java.lang.String label)
public void start()
start
in interface IStartStop
IStartStop.start()
public void startAuto()
IStartStop.start()
public void stop()
stop
in interface IStartStop
IStartStop.stop()
public boolean stopRequested(java.util.Set visited)
IStartStop
stopRequested
in interface IStartStop
visited
- The optional set of already visited objects in the stop
request cycle.protected boolean supports(java.lang.Object object)
true
if we are interested in the object
instance. If we are interested the watchdog will register itself for the
lifecycle events.object
- The newly created object.true
if we are interested in the
object
instance.public java.lang.String toString()
toString
in class java.lang.Object