Class RWSConfigFactory

  • All Implemented Interfaces:
    RWSConfig

    public final class RWSConfigFactory
    extends RWSConfigManager
    This is the singleton class used to load the configuration for the OpenNMS Poller service from the poller-configuration xml file. A mapping of the configured URLs to the iplist they contain is built at init() time so as to avoid numerous file reads. 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:
    James Zuo , Mike Davidson , Sowmya Nataraj , OpenNMS
    • Constructor Detail

      • RWSConfigFactory

        public RWSConfigFactory​(long currentVersion,
                                java.io.InputStream stream)
                         throws java.io.IOException

        Constructor for RWSConfigFactory.

        Parameters:
        currentVersion - a long.
        stream - a InputStream object.
        Throws:
        java.io.IOException - if any.
    • Method Detail

      • init

        public static void init()
                         throws java.io.IOException
        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.io.IOException - if any.
      • getInstance

        public static RWSConfig 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​(RWSConfig instance)

        setInstance

        Parameters:
        instance - a RWSConfig object.
      • saveXml

        protected void saveXml​(java.lang.String xml)
                        throws java.io.IOException
        Reload the config from the default config file
        Parameters:
        xml - a String object.
        Throws:
        java.io.IOException - Thrown if the specified config file cannot be read/loaded
        java.io.IOException - if any.
      • update

        public void update()
                    throws java.io.IOException

        update

        Throws:
        java.io.IOException - if any.