Class 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
    • Constructor Detail

      • EventTranslatorConfigFactory

        public EventTranslatorConfigFactory​(java.io.InputStream rdr,
                                            javax.sql.DataSource dbConnFactory)
                                     throws java.io.IOException

        Constructor for EventTranslatorConfigFactory.

        Parameters:
        rdr - a Reader object.
        dbConnFactory - a DataSource object.
        Throws:
        java.io.IOException
    • Method Detail

      • update

        public void update()
                    throws java.lang.Exception
        Simply marshals the config without messing with the singletons.
        Specified by:
        update in interface EventTranslatorConfig
        Throws:
        java.lang.Exception - if any.
      • init

        public static void init()
                         throws java.io.IOException,
                                java.lang.ClassNotFoundException,
                                java.sql.SQLException,
                                java.beans.PropertyVetoException
        Load 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 read
        java.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.PropertyVetoException
        Reload the config from the default config file
        Throws:
        java.io.IOException - Thrown if the specified config file cannot be read/loaded
        java.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.
      • getUEIList

        public java.util.List<java.lang.String> getUEIList()

        getUEIList

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

        public java.util.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
      • cloneEvent

        public static Event cloneEvent​(Event orig)

        cloneEvent

        Parameters:
        orig - a Event object.
        Returns:
        a Event object.