OpenNMS API 1.2.3

org.opennms.netmgt.config
Class RTCConfigFactory

java.lang.Object
  extended byorg.opennms.netmgt.config.RTCConfigFactory

public final class RTCConfigFactory
extends java.lang.Object

This is the singleton class used to load the configuration for the OpenNMS RTC from the rtc-configuration xml file. 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:
Sowmya Nataraj , OpenNMS

Field Summary
private  RTCConfiguration m_config
          The config class loaded from the config file
private static boolean m_loaded
          This member is set to true if the configuration file has been loaded.
private static RTCConfigFactory m_singleton
          The singleton instance of this factory
 
Constructor Summary
private RTCConfigFactory(java.lang.String configFile)
          Private constructor
 
Method Summary
 int getErrorsBeforeUrlUnsubscribe()
          Return the number of times posts are tried with errors before an URL is automatically unsubscribed.
 long getHighThresholdInterval()
          Return the high threshold interval at which data is to be resent.
 java.lang.String getHighThresholdIntervalStr()
          Return the high threshold interval at which data is to be resent.
static RTCConfigFactory getInstance()
          Return the singleton instance of this factory.
 long getLowThresholdInterval()
          Return the low threshold interval at which data is to be resent.
 java.lang.String getLowThresholdIntervalStr()
          Return the low threshold interval at which data is to be resent.
 int getMaxEventsBeforeResend()
          Return the max number of events after which data is to resent.
 long getRollingWindow()
          Return the rolling window for which availability is to be computed.
 java.lang.String getRollingWindowStr()
          Return the rolling window for which availability is to be computed.
 int getSenders()
          Return the number of sender to be started.
 int getUpdaters()
          Return the number of updater threads to be started.
 long getUserRefreshInterval()
          Return the user refresh interval at which data is to be resent - this is the interval at which data is resent when no events are received.
 java.lang.String getUserRefreshIntervalStr()
          Return the user refresh interval at which data is to be resent - this is the interval at which data is resent when no events are received.
static void init()
          Load the config from the default config file and create the singleton instance of this factory.
private  long parseRollingWindow(java.lang.String rolling)
          Parse the rolling window in the properties file in the format h m s into a long value of milliseconds
static void reload()
          Reload the config from the default config file
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

m_singleton

private static RTCConfigFactory m_singleton
The singleton instance of this factory


m_config

private RTCConfiguration m_config
The config class loaded from the config file


m_loaded

private static boolean m_loaded
This member is set to true if the configuration file has been loaded.

Constructor Detail

RTCConfigFactory

private RTCConfigFactory(java.lang.String configFile)
                  throws java.io.IOException,
                         org.exolab.castor.xml.MarshalException,
                         org.exolab.castor.xml.ValidationException
Private constructor

Throws:
java.io.IOException - Thrown if the specified config file cannot be read
org.exolab.castor.xml.MarshalException - Thrown if the file does not conform to the schema.
org.exolab.castor.xml.ValidationException - Thrown if the contents do not match the required schema.
Method Detail

parseRollingWindow

private long parseRollingWindow(java.lang.String rolling)
                         throws java.lang.IllegalArgumentException
Parse the rolling window in the properties file in the format h m s into a long value of milliseconds

Returns:
the rolling window as milliseconds
Throws:
java.lang.IllegalArgumentException

init

public static void init()
                 throws java.io.IOException,
                        org.exolab.castor.xml.MarshalException,
                        org.exolab.castor.xml.ValidationException
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
org.exolab.castor.xml.MarshalException - Thrown if the file does not conform to the schema.
org.exolab.castor.xml.ValidationException - Thrown if the contents do not match the required schema.

reload

public static void reload()
                   throws java.io.IOException,
                          org.exolab.castor.xml.MarshalException,
                          org.exolab.castor.xml.ValidationException
Reload the config from the default config file

Throws:
java.io.IOException - Thrown if the specified config file cannot be read/loaded
org.exolab.castor.xml.MarshalException - Thrown if the file does not conform to the schema.
org.exolab.castor.xml.ValidationException - Thrown if the contents do not match the required schema.

getInstance

public static RTCConfigFactory 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.

getUpdaters

public int getUpdaters()
Return the number of updater threads to be started.

Returns:
the number of updater threads to be started

getSenders

public int getSenders()
Return the number of sender to be started.

Returns:
the number of sender threads to be started

getRollingWindowStr

public java.lang.String getRollingWindowStr()
Return the rolling window for which availability is to be computed.

Returns:
the rolling window for which availability is to be computed

getRollingWindow

public long getRollingWindow()
Return the rolling window for which availability is to be computed.

Returns:
the rolling window for which availability is to be computed

getMaxEventsBeforeResend

public int getMaxEventsBeforeResend()
Return the max number of events after which data is to resent.

Returns:
the max number of events after which data is to resent

getLowThresholdIntervalStr

public java.lang.String getLowThresholdIntervalStr()
Return the low threshold interval at which data is to be resent.

Returns:
the low threshold interval at which data is to be resent

getLowThresholdInterval

public long getLowThresholdInterval()
Return the low threshold interval at which data is to be resent.

Returns:
the low threshold interval at which data is to be resent

getHighThresholdIntervalStr

public java.lang.String getHighThresholdIntervalStr()
Return the high threshold interval at which data is to be resent.

Returns:
the high threshold interval at which data is to be resent

getHighThresholdInterval

public long getHighThresholdInterval()
Return the high threshold interval at which data is to be resent.

Returns:
the high threshold interval at which data is to be resent

getUserRefreshIntervalStr

public java.lang.String getUserRefreshIntervalStr()
Return the user refresh interval at which data is to be resent - this is the interval at which data is resent when no events are received.

Returns:
the user refresh interval at which data is to be resent

getUserRefreshInterval

public long getUserRefreshInterval()
Return the user refresh interval at which data is to be resent - this is the interval at which data is resent when no events are received.

Returns:
the user refresh interval at which data is to be resent

getErrorsBeforeUrlUnsubscribe

public int getErrorsBeforeUrlUnsubscribe()
Return the number of times posts are tried with errors before an URL is automatically unsubscribed. A negative value means URL is never unsubscribed

Returns:
the number of times posts are tried with errors before an URL is automatically unsubscribed

OpenNMS API 1.2.3

Generated by eevans on May 29 2005 2015.