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 EventcloneEvent(Event orig)cloneEventstatic EventTranslatorConfiggetInstance()Return the singleton instance of this factory.List<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)setInstanceList<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(InputStream rdr, DataSource dbConnFactory) throws IOException
Constructor for EventTranslatorConfigFactory.
- Parameters:
rdr- aReaderobject.dbConnFactory- aDataSourceobject.- Throws:
IOException
-
-
Method Detail
-
update
public void update() throws ExceptionSimply marshals the config without messing with the singletons.- Specified by:
updatein interfaceEventTranslatorConfig- Throws:
Exception- if any.
-
init
public static void init() throws IOException, ClassNotFoundException, SQLException, PropertyVetoExceptionLoad 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, PropertyVetoExceptionReload 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- aEventTranslatorConfigobject.
-
getUEIList
public List<String> getUEIList()
getUEIList
- Specified by:
getUEIListin interfaceEventTranslatorConfig- Returns:
- a
Listobject.
-
translateEvent
public List<Event> translateEvent(Event e)
Translate the @param e to a new event- Specified by:
translateEventin interfaceEventTranslatorConfig- Parameters:
e- Event- Returns:
- a translated event
-
-