Package org.opennms.netmgt.config
Class EventTranslatorConfigFactory
- java.lang.Object
-
- 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
Constructors Constructor Description EventTranslatorConfigFactory(InputStream rdr, DataSource dbConnFactory)
Constructor for EventTranslatorConfigFactory.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static Event
cloneEvent(Event orig)
cloneEventstatic EventTranslatorConfig
getInstance()
Return the singleton instance of this factory.List<String>
getUEIList()
getUEIListstatic 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 filestatic void
setInstance(EventTranslatorConfig singleton)
setInstanceList<Event>
translateEvent(Event e)
Translate the @param e to a new eventvoid
update()
Simply marshals the config without messing with the singletons.
-
-
-
Constructor Detail
-
EventTranslatorConfigFactory
public EventTranslatorConfigFactory(InputStream rdr, DataSource dbConnFactory) throws IOException
Constructor for EventTranslatorConfigFactory.
- Parameters:
rdr
- aReader
object.dbConnFactory
- aDataSource
object.- Throws:
IOException
-
-
Method Detail
-
update
public void update() throws Exception
Simply marshals the config without messing with the singletons.- Specified by:
update
in interfaceEventTranslatorConfig
- Throws:
Exception
- if any.
-
init
public static void init() throws IOException, 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 readClassNotFoundException
- if any.IOException
- if any.SQLException
- if any.PropertyVetoException
- if any.
-
reload
public static void reload() throws IOException, ClassNotFoundException, SQLException, PropertyVetoException
Reload the config from the default config file- Throws:
IOException
- Thrown if the specified config file cannot be read/loadedClassNotFoundException
- if any.IOException
- 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
- aEventTranslatorConfig
object.
-
getUEIList
public List<String> getUEIList()
getUEIList
- Specified by:
getUEIList
in interfaceEventTranslatorConfig
- Returns:
- a
List
object.
-
translateEvent
public List<Event> translateEvent(Event e)
Translate the @param e to a new event- Specified by:
translateEvent
in interfaceEventTranslatorConfig
- Parameters:
e
- Event- Returns:
- a translated event
-
-