Package org.opennms.netmgt.vacuumd
Class AutomationProcessor
- java.lang.Object
-
- 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.- Version:
- $Id: $
- Author:
- David Hustace
-
-
Constructor Summary
Constructors Constructor Description AutomationProcessor(Automation automation)
Public constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description 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()
getActionAutomation
getAutomation()
getAutomationSchedule
getSchedule()
getScheduleorg.opennms.netmgt.vacuumd.AutomationProcessor.TriggerProcessor
getTrigger()
getTriggerboolean
isReady()
isReadyvoid
run()
runboolean
runAutomation()
Called by the run method to execute the sql statements of triggers and actions defined for an automation.void
setReady(boolean ready)
setReadyvoid
setSchedule(Schedule schedule)
setScheduleprotected boolean
verifyRowCount(ResultSet triggerResultSet)
verifyRowCount
-
-
-
Constructor Detail
-
AutomationProcessor
public AutomationProcessor(Automation automation)
Public constructor.- Parameters:
automation
- aAutomation
object.
-
-
Method Detail
-
getAction
public org.opennms.netmgt.vacuumd.AutomationProcessor.ActionProcessor getAction()
getAction
- Returns:
- a
AutomationProcessor.ActionProcessor
object.
-
getTrigger
public org.opennms.netmgt.vacuumd.AutomationProcessor.TriggerProcessor getTrigger()
getTrigger
- Returns:
- a
AutomationProcessor.TriggerProcessor
object.
-
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.- Returns:
- a boolean.
- Throws:
SQLException
- if any.
-
verifyRowCount
protected boolean verifyRowCount(ResultSet triggerResultSet) throws SQLException
verifyRowCount
- Parameters:
triggerResultSet
- aResultSet
object.- Returns:
- a boolean.
- Throws:
SQLException
- if any.
-
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
- aResultSet
object.- Returns:
- a int.
- Throws:
SQLException
- if any.
-
containsTokens
public boolean containsTokens(String targetString)
Simple helper method to determine if the targetString contains any '${token}'s.- Parameters:
targetString
- aString
object.- Returns:
- a boolean.
-
getAutomation
public Automation getAutomation()
getAutomation
- Returns:
- Returns the automation.
-
isReady
public boolean isReady()
isReady
- Specified by:
isReady
in interfaceReadyRunnable
- Returns:
- a boolean.
-
getSchedule
public Schedule getSchedule()
getSchedule
- Returns:
- Returns the schedule.
-
setSchedule
public void setSchedule(Schedule schedule)
setSchedule
- Parameters:
schedule
- The schedule to set.
-
setReady
public void setReady(boolean ready)
setReady
- Parameters:
ready
- a boolean.
-
-