org.opennms.netmgt.vacuumd
Class AutomationProcessor

java.lang.Object
  extended by org.opennms.netmgt.vacuumd.AutomationProcessor
All Implemented Interfaces:
Runnable, ReadyRunnable

public class AutomationProcessor
extends Object
implements ReadyRunnable

This class used to process automations configured in the vacuumd-configuration.xml file. Automations are identified by a name and they reference Triggers and Actions by name, as well. Autmations also have an interval attribute that determines how often they run.

Author:
David Hustace

Constructor Summary
AutomationProcessor(Automation automation)
          Public constructor.
 
Method Summary
 boolean containsTokens(String targetString)
          Simple helper method to determine if the targetString contains any '${token}'s.
 int countRows(ResultSet rs)
          Method used to count the rows in a ResultSet.
 org.opennms.netmgt.vacuumd.AutomationProcessor.ActionProcessor getAction()
           
 Automation getAutomation()
           
 Schedule getSchedule()
           
 org.opennms.netmgt.vacuumd.AutomationProcessor.TriggerProcessor getTrigger()
           
 boolean isReady()
          Returns true if the runnable is ready to start.
 void run()
           
 boolean runAutomation()
          Called by the run method to execute the sql statements of triggers and actions defined for an automation.
 void setReady(boolean ready)
           
 void setSchedule(Schedule schedule)
           
protected  boolean verifyRowCount(ResultSet triggerResultSet)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AutomationProcessor

public AutomationProcessor(Automation automation)
Public constructor.

Method Detail

getAction

public org.opennms.netmgt.vacuumd.AutomationProcessor.ActionProcessor getAction()

getTrigger

public org.opennms.netmgt.vacuumd.AutomationProcessor.TriggerProcessor getTrigger()

run

public void run()
Specified by:
run in interface Runnable

runAutomation

public boolean runAutomation()
                      throws SQLException
Called by the run method to execute the sql statements of triggers and actions defined for an automation. An automation may have 0 or 1 trigger and must have 1 action. If the automation doesn't have a trigger than the action must not contain any tokens.

Parameters:
auto -
Returns:
Throws:
SQLException

verifyRowCount

protected boolean verifyRowCount(ResultSet triggerResultSet)
                          throws SQLException
Throws:
SQLException

countRows

public int countRows(ResultSet rs)
              throws SQLException
Method used to count the rows in a ResultSet. This probably requires that your ResultSet is scrollable.

Parameters:
rs -
Returns:
Throws:
SQLException

containsTokens

public boolean containsTokens(String targetString)
Simple helper method to determine if the targetString contains any '${token}'s.

Parameters:
targetString -
Returns:

getAutomation

public Automation getAutomation()
Returns:
Returns the automation.

isReady

public boolean isReady()
Description copied from interface: ReadyRunnable
Returns true if the runnable is ready to start.

Specified by:
isReady in interface ReadyRunnable

getSchedule

public Schedule getSchedule()
Returns:
Returns the schedule.

setSchedule

public void setSchedule(Schedule schedule)
Parameters:
schedule - The schedule to set.

setReady

public void setReady(boolean ready)


Copyright © 2009. All Rights Reserved.