jet.server.api.trigger
Interface TriggerManager


public interface TriggerManager

The TriggerManager is the manager of all triggers in the server.


Method Summary
 boolean contains(java.lang.String triggerName)
          Tests whether there is a trigger specified by triggerName in the TriggerManager.
 Trigger createTrigger(java.lang.String triggerName, java.lang.String triggerDesc)
          Creates a new EXTERN trigger with the specified trigger name and description in the inner collection if there is no trigger with the same name yet.
 void deleteTrigger(java.lang.String triggerName)
          Deletes an existing Trigger specified by triggerName.
 void fire(java.lang.String triggerName, java.util.Properties userData)
          Fires a trigger with the specified name and customer's trigger data.
 Trigger getTrigger(java.lang.String triggerName)
          Gets an existing Trigger specified by triggerName.
 java.util.Iterator iterator()
          Gets all triggers in the TriggerManager, and the triggers are put into an iterator.
 void setEnable(java.lang.String triggerName, boolean enable)
          Enables or disables a Trigger specified by triggerName.
 int size()
          Gets the number of triggers in the TriggerManager.
 

Method Detail

createTrigger

Trigger createTrigger(java.lang.String triggerName,
                      java.lang.String triggerDesc)
                      throws TriggerManageException
Creates a new EXTERN trigger with the specified trigger name and description in the inner collection if there is no trigger with the same name yet.

Parameters:
triggerName - The name of the trigger which you want to create.
triggerDesc - The description of the trigger which you want to create.
Returns:
A trigger instance if there is no trigger with the name specified by triggerName yet, or else throws a TriggerManageException.
Throws:
TriggerManageException - If there is a trigger with the name specified by triggerName already.

getTrigger

Trigger getTrigger(java.lang.String triggerName)
Gets an existing Trigger specified by triggerName.

Parameters:
triggerName - The name of the trigger which you want to get.
Returns:
A Trigger instance if it exists, or else return null.

deleteTrigger

void deleteTrigger(java.lang.String triggerName)
                   throws TriggerManageException
Deletes an existing Trigger specified by triggerName.

Parameters:
triggerName - The name of the trigger which you want to delete.
Throws:
TriggerManageException - If the trigger specified by triggerName is not bound with any scheduled task, that is to say, the trigger is not referenced, it will be deleted; otherwise, a TriggerManageException will be thrown.

setEnable

void setEnable(java.lang.String triggerName,
               boolean enable)
Enables or disables a Trigger specified by triggerName.

An enabled trigger can be fired, but a disabled trigger cannot.

Parameters:
triggerName - The name of the trigger which you want to enable or disable.
enable - true to enable the trigger, or false to disable the trigger.

fire

void fire(java.lang.String triggerName,
          java.util.Properties userData)
          throws TriggerManageException
Fires a trigger with the specified name and customer's trigger data. When a trigger is fired, the scheduled tasks bound with it will get running, and if there is no scheduled tasks bound with the trigger, nothing will happen except the last fired time of the trigger is updated.

Parameters:
triggerName - The name of the trigger which you want to fire.
userData - The customer's trigger data passed to the scheduled tasks. It can be used to transfer parameters of reports between external system and the server.
Throws:
TriggerManageException - A TriggerManagerException will be thrown if there is no trigger specified by triggerName.

contains

boolean contains(java.lang.String triggerName)
Tests whether there is a trigger specified by triggerName in the TriggerManager.

Parameters:
triggerName - The name of the trigger which you want to test.
Returns:
true if this manager contains the specified trigger.

iterator

java.util.Iterator iterator()
Gets all triggers in the TriggerManager, and the triggers are put into an iterator.

Returns:
An Iterator.

size

int size()
Gets the number of triggers in the TriggerManager.

Returns:
the number of triggers in the TriggerManager.