OpenNMS API 1.2.3

org.opennms.netmgt.eventd
Class EventConfigurationManager

java.lang.Object
  extended byorg.opennms.netmgt.eventd.EventConfigurationManager

public final class EventConfigurationManager
extends java.lang.Object

This is the singleton class used to manage the event configuration. When the class is loaded an attempt is made to read and load the file named eventconf.xml. The file must be in the applications searched classpaths in order to be loaded when the class is loaded.

Once the class is constructed it is possible to reconfigure or merge additional events into the configuration by using the methods provided by the class.

Author:
Brian Weaver , Sowmya Nataraj , OpenNMS

Field Summary
private static EventConfData m_eventConf
          The mapping of all the Event Configuration objects
private static boolean m_loaded
          This member is set to true if the configuration file has been loaded.
private static java.lang.String[] m_secureTags
          The list of secure tags.
 
Constructor Summary
EventConfigurationManager()
           
 
Method Summary
static Event get(Event event)
          Returns the matching event configuration instance for the event that just came in.
static Event getBySnmpEid(java.lang.String eid)
          Returns the matching event configuration instance that is indexed by the SNMP enterprise identifier.
static Event getByUei(java.lang.String uei)
          Returns the matching event configuration instance that is indexed by the passed UEI.
static boolean isConfigured()
          Returns true if the configuration has been loaded.
static boolean isSecureTag(java.lang.String name)
          Returns true if the tag is marked as secure.
static void loadConfiguration(java.io.Reader rdr)
          This method is used to load the passed configuration into the currently managed configuration instance.
static void loadConfiguration(java.lang.String file)
          This method is used to load the passed configuration into the currently managed configuration instance.
static void mergeConfiguration(java.io.Reader rdr)
          This method is used to load the passed configuration into the currently managed configuration instance.
static void mergeConfiguration(java.lang.String file)
          This method is used to load the passed configuration into the currently managed configuration instance.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

m_eventConf

private static EventConfData m_eventConf
The mapping of all the Event Configuration objects


m_loaded

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


m_secureTags

private static volatile java.lang.String[] m_secureTags
The list of secure tags.

Constructor Detail

EventConfigurationManager

public EventConfigurationManager()
Method Detail

isConfigured

public static boolean isConfigured()
Returns true if the configuration has been loaded.

Returns:
True if the configuration is loaded.

loadConfiguration

public static void loadConfiguration(java.lang.String file)
                              throws java.io.IOException,
                                     org.exolab.castor.xml.MarshalException,
                                     org.exolab.castor.xml.ValidationException
This method is used to load the passed configuration into the currently managed configuration instance. Any events that previously existed are cleared.

Parameters:
file - The file to load.
Throws:
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.
java.lang.IOException - Thrown if the file cannot be opened for reading.
java.io.IOException

loadConfiguration

public static void loadConfiguration(java.io.Reader rdr)
                              throws java.io.IOException,
                                     org.exolab.castor.xml.MarshalException,
                                     org.exolab.castor.xml.ValidationException
This method is used to load the passed configuration into the currently managed configuration instance. Any events that previously existed are cleared. After the contents of the reader stream is loaded the stream is closed.

Parameters:
rdr - The reader used to load the configuration.
Throws:
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.
java.io.IOException

mergeConfiguration

public static void mergeConfiguration(java.lang.String file)
                               throws java.io.IOException,
                                      org.exolab.castor.xml.MarshalException,
                                      org.exolab.castor.xml.ValidationException
This method is used to load the passed configuration into the currently managed configuration instance. Any events that previously existed are overwritten by the new events in this configuration. This call will replace the current override settings.

Parameters:
file - The configuration file name.
Throws:
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.
java.lang.IOException - Thrown if the file cannot be opened for reading.
java.io.IOException

mergeConfiguration

public static void mergeConfiguration(java.io.Reader rdr)
                               throws org.exolab.castor.xml.MarshalException,
                                      org.exolab.castor.xml.ValidationException
This method is used to load the passed configuration into the currently managed configuration instance. Any events that previously existed are overwritten by the new events in this configuration. This call will replace the current override settings. After the contents of the reader stream is loaded, the reader is closed.

Parameters:
rdr - The reader used to load the configuration.
Throws:
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.

getByUei

public static Event getByUei(java.lang.String uei)
Returns the matching event configuration instance that is indexed by the passed UEI. This is an instance of the Event that was loaded from the event configuration file.

Returns:
The loaded event matching the UEI

getBySnmpEid

public static Event getBySnmpEid(java.lang.String eid)
Returns the matching event configuration instance that is indexed by the SNMP enterprise identifier. This is an instance of the Event that was loaded from the event configuration file.

Returns:
The loaded event matching the EID.

get

public static Event get(Event event)
Returns the matching event configuration instance for the event that just came in. This is an instance of the Event that was loaded from the event configuration file.

Returns:
The loaded event matching the event.

isSecureTag

public static boolean isSecureTag(java.lang.String name)
Returns true if the tag is marked as secure.


OpenNMS API 1.2.3

Generated by eevans on May 29 2005 2015.