Package org.opennms.netmgt.config
Class EventTranslatorConfigFactory
- java.lang.Object
-
- org.opennms.netmgt.config.EventTranslatorConfigFactory
-
- All Implemented Interfaces:
EventTranslatorConfig
public final class EventTranslatorConfigFactory extends java.lang.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(java.io.InputStream rdr, javax.sql.DataSource dbConnFactory)Constructor for EventTranslatorConfigFactory.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static EventcloneEvent(Event orig)cloneEventstatic EventTranslatorConfiggetInstance()Return the singleton instance of this factory.java.util.List<java.lang.String>getUEIList()getUEIListstatic voidinit()Load the config from the default config file and create the singleton instance of this factory.static voidreload()Reload the config from the default config filestatic voidsetInstance(EventTranslatorConfig singleton)setInstancejava.util.List<Event>translateEvent(Event e)Translate the @param e to a new eventvoidupdate()Simply marshals the config without messing with the singletons.
-
-
-
Constructor Detail
-
EventTranslatorConfigFactory
public EventTranslatorConfigFactory(java.io.InputStream rdr, javax.sql.DataSource dbConnFactory) throws java.io.IOExceptionConstructor for EventTranslatorConfigFactory.
- Parameters:
rdr- aReaderobject.dbConnFactory- aDataSourceobject.- Throws:
java.io.IOException
-
-
Method Detail
-
update
public void update() throws java.lang.ExceptionSimply marshals the config without messing with the singletons.- Specified by:
updatein interfaceEventTranslatorConfig- Throws:
java.lang.Exception- if any.
-
init
public static void init() throws java.io.IOException, java.lang.ClassNotFoundException, java.sql.SQLException, java.beans.PropertyVetoExceptionLoad the config from the default config file and create the singleton instance of this factory.- Throws:
java.io.IOException- Thrown if the specified config file cannot be readjava.lang.ClassNotFoundException- if any.java.io.IOException- if any.java.sql.SQLException- if any.java.beans.PropertyVetoException- if any.
-
reload
public static void reload() throws java.io.IOException, java.lang.ClassNotFoundException, java.sql.SQLException, java.beans.PropertyVetoExceptionReload the config from the default config file- Throws:
java.io.IOException- Thrown if the specified config file cannot be read/loadedjava.lang.ClassNotFoundException- if any.java.io.IOException- if any.java.sql.SQLException- if any.java.beans.PropertyVetoException- if any.
-
getInstance
public static EventTranslatorConfig getInstance()
Return the singleton instance of this factory.- Returns:
- The current factory instance.
- Throws:
java.lang.IllegalStateException- Thrown if the factory has not yet been initialized.
-
setInstance
public static void setInstance(EventTranslatorConfig singleton)
setInstance
- Parameters:
singleton- aEventTranslatorConfigobject.
-
getUEIList
public java.util.List<java.lang.String> getUEIList()
getUEIList
- Specified by:
getUEIListin interfaceEventTranslatorConfig- Returns:
- a
Listobject.
-
translateEvent
public java.util.List<Event> translateEvent(Event e)
Translate the @param e to a new event- Specified by:
translateEventin interfaceEventTranslatorConfig- Parameters:
e- Event- Returns:
- a translated event
-
-