org.opennms.netmgt.config
Class EventTranslatorConfigFactory

java.lang.Object
  extended by org.opennms.netmgt.config.EventTranslatorConfigFactory
All Implemented Interfaces:
EventTranslatorConfig

public final class EventTranslatorConfigFactory
extends Object
implements EventTranslatorConfig

This is the singleton class used to load the configuration from the passive-status-configuration.xml. This provides convenience methods to get the configured categories and their information, add/delete categories from category groups. Note: Users of this class should make sure the init() is called before calling any other method to ensure the config is loaded before accessing other convenience methods.

Author:
David Hustace , OpenNMS

Field Summary
 
Fields inherited from interface org.opennms.netmgt.config.EventTranslatorConfig
TRANSLATOR_NAME
 
Constructor Summary
EventTranslatorConfigFactory(Reader rdr, DataSource dbConnFactory)
           
 
Method Summary
static EventTranslatorConfig getInstance()
          Return the singleton instance of this factory.
 List<String> getUEIList()
          Get the list of UEIs that are registered in the passive status configuration.
static void init()
          Load the config from the default config file and create the singleton instance of this factory.
 boolean isTranslationEvent(Event e)
          Determine if the @param e is a translation event
static void reload()
          Reload the config from the default config file
static void setInstance(EventTranslatorConfig singleton)
           
 List<Event> translateEvent(Event e)
          Translate the @param e to a new event
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EventTranslatorConfigFactory

public EventTranslatorConfigFactory(Reader rdr,
                                    DataSource dbConnFactory)
                             throws org.exolab.castor.xml.MarshalException,
                                    org.exolab.castor.xml.ValidationException
Throws:
org.exolab.castor.xml.MarshalException
org.exolab.castor.xml.ValidationException
Method Detail

init

public static void init()
                 throws IOException,
                        org.exolab.castor.xml.MarshalException,
                        org.exolab.castor.xml.ValidationException,
                        ClassNotFoundException,
                        SQLException,
                        PropertyVetoException
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.
ClassNotFoundException
SQLException
PropertyVetoException

reload

public static void reload()
                   throws IOException,
                          org.exolab.castor.xml.MarshalException,
                          org.exolab.castor.xml.ValidationException,
                          ClassNotFoundException,
                          SQLException,
                          PropertyVetoException
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.
ClassNotFoundException
SQLException
PropertyVetoException

getInstance

public static EventTranslatorConfig 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(EventTranslatorConfig singleton)

getUEIList

public List<String> getUEIList()
Description copied from interface: EventTranslatorConfig
Get the list of UEIs that are registered in the passive status configuration.

Specified by:
getUEIList in interface EventTranslatorConfig
Returns:
list of UEIs

isTranslationEvent

public boolean isTranslationEvent(Event e)
Description copied from interface: EventTranslatorConfig
Determine if the @param e is a translation event

Specified by:
isTranslationEvent in interface EventTranslatorConfig
Parameters:
e - Event
Returns:
true iff e is a translation event

translateEvent

public List<Event> translateEvent(Event e)
Description copied from interface: EventTranslatorConfig
Translate the @param e to a new event

Specified by:
translateEvent in interface EventTranslatorConfig
Parameters:
e - Event
Returns:
a translated event


Copyright © 2009. All Rights Reserved.