org.opennms.netmgt.config
Class VacuumdConfigFactory

java.lang.Object
  extended by org.opennms.netmgt.config.VacuumdConfigFactory

public final class VacuumdConfigFactory
extends Object

This is the singleton class used to load the configuration for the OpenNMS Vacuumd process from the vacuumd-configuration xml file. Note: Users of this class should make sure the setReader() method is called before calling any other method to ensure the config is loaded before accessing other convenience methods.

Version:
$Id: $
Author:
David Hustace , Mathew Brozowski , OpenNMS , David Hustace , Mathew Brozowski , OpenNMS , David Hustace , Mathew Brozowski , OpenNMS

Constructor Summary
VacuumdConfigFactory(InputStream stream)
          Constructor for VacuumdConfigFactory.
VacuumdConfigFactory(Reader rdr)
          Deprecated. 
 
Method Summary
 Action getAction(String actionName)
          Returns an Action with a name matching the string parmater
 ActionEvent getActionEvent(String name)
          getActionEvent
 Collection<ActionEvent> getActionEvents()
          getActionEvents
 Collection<Action> getActions()
          Returns a Collection of actions defined in the config
 AutoEvent getAutoEvent(String name)
          Deprecated. Use ActionEvent objects instead. Access these objects with getActionEvent(String).
 Collection<AutoEvent> getAutoEvents()
          Deprecated. Use ActionEvent objects instead. Access these objects with getActionEvents().
 Automation getAutomation(String autoName)
          Returns an Automation with a name matching the string parameter
 Collection<Automation> getAutomations()
          Returns a Collection of automations defined in the config
static VacuumdConfigFactory getInstance()
          Return the singleton instance of this factory.
 int getPeriod()
          getPeriod
 String[] getSqlStatements()
          getSqlStatements
 List<Statement> getStatements()
          getStatements
 Trigger getTrigger(String triggerName)
          Returns a Trigger with a name matching the string parameter
 Collection<Trigger> getTriggers()
          Returns a Collection of triggers defined in the config
static void init()
          Load the config from the default config file and create the singleton instance of this factory.
static void reload()
          Reload the config from the default config file
static void setInstance(VacuumdConfigFactory instance)
          Set the singleton instance of this factory.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

VacuumdConfigFactory

@Deprecated
public VacuumdConfigFactory(Reader rdr)
                     throws org.exolab.castor.xml.MarshalException,
                            org.exolab.castor.xml.ValidationException
Deprecated. 

Constructor for VacuumdConfigFactory.

Parameters:
rdr - Reader
Throws:
org.exolab.castor.xml.MarshalException - if any.
org.exolab.castor.xml.ValidationException - if any.

VacuumdConfigFactory

public VacuumdConfigFactory(InputStream stream)
                     throws org.exolab.castor.xml.MarshalException,
                            org.exolab.castor.xml.ValidationException

Constructor for VacuumdConfigFactory.

Parameters:
stream - a InputStream object.
Throws:
org.exolab.castor.xml.MarshalException - if any.
org.exolab.castor.xml.ValidationException - if any.
Method Detail

init

public static void init()
                 throws IOException,
                        org.exolab.castor.xml.MarshalException,
                        org.exolab.castor.xml.ValidationException
Load the config from the default config file and create the singleton instance of this factory.

Throws:
IOException - Thrown if the specified config file cannot be read
org.exolab.castor.xml.MarshalException - Thrown if the file does not conform to the schema.
org.exolab.castor.xml.ValidationException - Thrown if the contents do not match the required schema.
IOException - if any.
org.exolab.castor.xml.MarshalException - if any.
org.exolab.castor.xml.ValidationException - if any.

reload

public static void reload()
                   throws IOException,
                          org.exolab.castor.xml.MarshalException,
                          org.exolab.castor.xml.ValidationException
Reload the config from the default config file

Throws:
IOException - Thrown if the specified config file cannot be read/loaded
org.exolab.castor.xml.MarshalException - Thrown if the file does not conform to the schema.
org.exolab.castor.xml.ValidationException - Thrown if the contents do not match the required schema.
IOException - if any.
org.exolab.castor.xml.MarshalException - if any.
org.exolab.castor.xml.ValidationException - if any.

getInstance

public static VacuumdConfigFactory getInstance()
Return the singleton instance of this factory.

Returns:
The current factory instance.
Throws:
IllegalStateException - Thrown if the factory has not yet been initialized.

setInstance

public static void setInstance(VacuumdConfigFactory instance)
Set the singleton instance of this factory.

Parameters:
instance - The factory instance to set.

getAutomations

public Collection<Automation> getAutomations()
Returns a Collection of automations defined in the config

Returns:
a Collection object.

getTriggers

public Collection<Trigger> getTriggers()
Returns a Collection of triggers defined in the config

Returns:
a Collection object.

getActions

public Collection<Action> getActions()
Returns a Collection of actions defined in the config

Returns:
a Collection object.

getAutoEvents

public Collection<AutoEvent> getAutoEvents()
Deprecated. Use ActionEvent objects instead. Access these objects with getActionEvents().

Returns a Collection of named events to that may have been configured to be sent after an automation has run.

Returns:
a Collection object.

getActionEvents

public Collection<ActionEvent> getActionEvents()

getActionEvents

Returns:
a Collection object.

getPeriod

public int getPeriod()

getPeriod

Returns:
a int.

getTrigger

public Trigger getTrigger(String triggerName)
Returns a Trigger with a name matching the string parameter

Parameters:
triggerName - a String object.
Returns:
a Trigger object.

getAction

public Action getAction(String actionName)
Returns an Action with a name matching the string parmater

Parameters:
actionName - a String object.
Returns:
a Action object.

getAutomation

public Automation getAutomation(String autoName)
Returns an Automation with a name matching the string parameter

Parameters:
autoName - a String object.
Returns:
a Automation object.

getAutoEvent

public AutoEvent getAutoEvent(String name)
Deprecated. Use ActionEvent objects instead. Access these objects with getActionEvent(String).

Returns the AutoEvent associated with the auto-event-name

Parameters:
name - a String object.
Returns:
a AutoEvent object.

getSqlStatements

public String[] getSqlStatements()

getSqlStatements

Returns:
an array of String objects.

getStatements

public List<Statement> getStatements()

getStatements

Returns:
a List object.

getActionEvent

public ActionEvent getActionEvent(String name)

getActionEvent

Parameters:
name - a String object.
Returns:
a ActionEvent object.


Copyright © 2011. All Rights Reserved.