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.

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

Field Summary
 
Fields inherited from interface org.opennms.netmgt.config.EventTranslatorConfig
TRANSLATOR_NAME
 
Constructor Summary
EventTranslatorConfigFactory(Reader rdr, DataSource dbConnFactory)
          Deprecated. 
 
Method Summary
static EventTranslatorConfig getInstance()
          Return the singleton instance of this factory.
 List<String> getUEIList()
          getUEIList
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)
          setInstance
 List<Event> translateEvent(Event e)
          Translate the @param e to a new event
 void update()
          Simply marshals the config without messing with the singletons.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EventTranslatorConfigFactory

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

Constructor for EventTranslatorConfigFactory.

Parameters:
rdr - a Reader object.
dbConnFactory - a DataSource object.
Throws:
org.exolab.castor.xml.MarshalException - if any.
org.exolab.castor.xml.ValidationException - if any.
Method Detail

update

public void update()
            throws Exception
Simply marshals the config without messing with the singletons.

Specified by:
update in interface EventTranslatorConfig
Throws:
Exception - if any.

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 - if any.
IOException - if any.
org.exolab.castor.xml.MarshalException - if any.
org.exolab.castor.xml.ValidationException - if any.
SQLException - if any.
PropertyVetoException - if any.

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 - if any.
IOException - if any.
org.exolab.castor.xml.MarshalException - if any.
org.exolab.castor.xml.ValidationException - if any.
SQLException - if any.
PropertyVetoException - if any.

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)

setInstance

Parameters:
singleton - a EventTranslatorConfig object.

getUEIList

public List<String> getUEIList()

getUEIList

Specified by:
getUEIList in interface EventTranslatorConfig
Returns:
a List object.

isTranslationEvent

public boolean isTranslationEvent(Event e)
Determine if the @param e is a translation event

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

translateEvent

public List<Event> translateEvent(Event e)
Translate the @param e to a new event

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


Copyright © 2011. All Rights Reserved.