org.pf.util
Interface TriggerClient

All Known Implementing Classes:
ReloadableSettings, TemporaryMap

public interface TriggerClient

An object that wants to work with a trigger (see Trigger) is a TriggerClient and must therefore implement this interface.

Version:
1.0
Author:
Manfred Duchrow

Method Summary
 boolean canBeTriggeredBy(Trigger trigger)
          Returns whether or not the trigger is allowed to activate the trigger client's triggeredBy() method.
 boolean triggeredBy(Trigger trigger)
          This method will be called by a trigger whenever its timing says so.
 

Method Detail

canBeTriggeredBy

boolean canBeTriggeredBy(Trigger trigger)
Returns whether or not the trigger is allowed to activate the trigger client's triggeredBy() method.
This method will be called, whenever the trigger's timing allows the trigger to execute the trigger client's service method. So, eventually the trigger client decides itself, if its service method will be called this time.
Since the calling trigger is passed to this method, the client is able to react to more than one trigger. It can distinguish the calling triggers by name and dispatch internally to the appropriate method.
The implementer should be aware that this method will be called from a different thread than the one the trigger client is running in. Therefore it might be neccessary to do some synchronization here.

Parameters:
trigger - The trigger that calls this method
Returns:
true, if the service method triggeredBy() can be called
See Also:
Trigger

triggeredBy

boolean triggeredBy(Trigger trigger)
This method will be called by a trigger whenever its timing says so.
Since the calling trigger is passed to this method, the client is able to react to more than one trigger. It can distinguish the calling triggers by name and dispatch internally to the appropriate method.
The implementer should be aware that this method will be called from a different thread than the one the trigger client is running in. Therefore it might be neccessary to do some synchronization here.

Parameters:
trigger - The trigger that calls this method
Returns:
true, if the trigger should continue, otherwise false
See Also:
Trigger