org.opennms.netmgt.eventd
Class EventConfigurationManager

java.lang.Object
  extended by org.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

Constructor Summary
EventConfigurationManager()
           
 
Method Summary
static org.opennms.netmgt.xml.eventconf.Event get(org.opennms.netmgt.xml.event.Event event)
          Returns the matching event configuration instance for the event that just came in.
static org.opennms.netmgt.xml.eventconf.Event getByUei(java.lang.String uei)
          Returns the matching event configuration instance that is indexed by the passed UEI.
static void init()
           
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)
          Deprecated. this is currently unused and will be deleted. brozow - 23-Jan-07
static void mergeConfiguration(java.lang.String file)
          Deprecated. this is currently unused and will be deleted. brozow - 23-Jan-07
static void reload()
          Reloads the configuration off disk
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

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.

init

public static void init()
                 throws org.exolab.castor.xml.MarshalException,
                        org.exolab.castor.xml.ValidationException,
                        java.io.IOException
Throws:
org.exolab.castor.xml.MarshalException
org.exolab.castor.xml.ValidationException
java.io.IOException

reload

public static void reload()
                   throws org.exolab.castor.xml.MarshalException,
                          org.exolab.castor.xml.ValidationException,
                          java.io.IOException
Reloads the configuration off disk

Throws:
org.exolab.castor.xml.MarshalException
org.exolab.castor.xml.ValidationException
java.io.IOException

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
Deprecated. this is currently unused and will be deleted. brozow - 23-Jan-07

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
Deprecated. this is currently unused and will be deleted. brozow - 23-Jan-07

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 org.opennms.netmgt.xml.eventconf.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

get

public static org.opennms.netmgt.xml.eventconf.Event get(org.opennms.netmgt.xml.event.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.



Copyright © 2007. All Rights Reserved.