org.opennms.bb.dp.eventd
Class Eventd

java.lang.Object
  |
  +--org.opennms.bb.dp.eventd.Eventd

public class Eventd
extends Object

Eventd listens for events from the discovery, capsd, trapd processes and sends events to the Master Station when queried for.

Eventd receives events sent in as XML, looks up the event.conf and adds information to these events and stores them to the db. It also reconverts them back to XML to be sent to other processes like 'actiond'

Process like trapd, capsd etc. that are local to the distributed poller use JSDT to send events to the eventd. Events can also be sent via TCP or UDP to eventd

Eventd has the following components - EventListener, EventExpandManager, and EventPersistd to listen for incoming events, load info from the 'event.conf' and to add the expanded events to the database respectively. The events added to the database are then sent out via JSDT

Version:
$Revision: 1.1 $
Author:
Sowmya Kumaraswamy, OpenNMS.org

Inner Class Summary
private static class Eventd.EventdClient
          The JSDT client.
 
Field Summary
private  PCQueue m_bridgeQ
          The queue of EventReaders from the TCP/UDP/JSDT receivers.
private static com.sun.media.jsdt.Client m_client
          The JSDT client that is registered for the session and channels.
private static Map m_eventConf
          The list of base events from the event configuration file.
private  EventListener m_listener
          The thread that listens to incoming threads
private static List m_overrides
          The list of elements in each event that cannot be overridden by the input source.
private  EventPersistd m_persistd
          the thread that is responsible for writing event data to the db
private static Properties m_properties
          The properties that are specific to the eventd process.
private static com.sun.media.jsdt.Session m_session
          The jsdt session that all tranactions should occur on.
 
Constructor Summary
Eventd()
          Eventd constructor creates the eventlistener to listen for events..
 
Method Summary
(package private) static void ()
          Copy the System properties and then load the bluebird and eventd specific files into the property object.
static void closeSession()
          Closes the global JSDT communication session for the event daemon.
static com.sun.media.jsdt.Client getClient()
          Returns the JSDT Client for the event system.
static EventBase getEventByName(String key)
          Find the mapped event base object for the passed key.
static List getOverrides()
          Returns list of strings that must be reset in the parser.
static Properties getProperties()
           
static String getProperty(String key)
           
static com.sun.media.jsdt.Session getSession()
          Returns the global Event daemon session to the requestor.
static void initSession()
          Opens up hte current JSDT session for the event daemon.
static void loadConfiguration()
           
static void main(String[] args)
          Start up Eventd
 void shutdown()
          Initiates the shutdown sequence and waits for this thread to exit.
 void start()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

m_listener

private EventListener m_listener
The thread that listens to incoming threads

m_persistd

private EventPersistd m_persistd
the thread that is responsible for writing event data to the db

m_bridgeQ

private PCQueue m_bridgeQ
The queue of EventReaders from the TCP/UDP/JSDT receivers. These events have already been run so all events are already decomposed.

m_session

private static com.sun.media.jsdt.Session m_session
The jsdt session that all tranactions should occur on.

m_client

private static com.sun.media.jsdt.Client m_client
The JSDT client that is registered for the session and channels.

m_overrides

private static List m_overrides
The list of elements in each event that cannot be overridden by the input source. If an input event has one of the fields set then it is discarded by the event stream.

m_eventConf

private static Map m_eventConf
The list of base events from the event configuration file. This is loaded once when the Event object is loaded by the system, and again if the loadConfiguration() method is called to explicitily load the events.

m_properties

private static Properties m_properties

The properties that are specific to the eventd process. The properties are a combination of the JVM's system properties, plus the inclusion of the OpenNMS specific property files. There are two additional files that are loaded, if the system properties are correctly set.

In order to properly load the OpenNMS specific file(s) their location must be known in advance. Instead of hard coding the location of the files, the files are referenced by properties. The following list declares the properites that reference the specific files. The property files are loaded in the order they appear in the list.

Currently the string returned for the propertyFile(s) must be a file on the local filesystem. Later support for remote files via HTTP, JSDT, etc al may be supported.

Constructor Detail

Eventd

public Eventd()
       throws com.sun.media.jsdt.JSDTException,
              SQLException,
              EventListenerException
Eventd constructor creates the eventlistener to listen for events..
Throws:
EventListenerException - if the event listener communication channels cannot be set up
java.lang.NullPointerException - Thrown if the properties eventd is looking for cannot be read
com.sun.media.JSDTPropertiesException - Thrown if the JSDT communication channel cannot be established
Method Detail

static void ()

Copy the System properties and then load the bluebird and eventd specific files into the property object. For more information see the javadoc comment for the m_properties element.

Additionally, this static loading will also look at the debugging options and will setup the Logging Facility. This can only be done after the properties have been loaded.


loadConfiguration

public static void loadConfiguration()
                              throws IOException,
                                     org.xml.sax.SAXException
Throws:
java.lang.NullPointerException - Thrown if a required property cannot be found.

initSession

public static void initSession()
                        throws com.sun.media.jsdt.JSDTException
Opens up hte current JSDT session for the event daemon. If the session was already open then an exception will be generated.
Throws:
com.sun.media.jsdt.JSDTException - Thrown if an error occurs openning the session.
IllegalStateException - Thrown if the session was already open for the eventd system.

closeSession

public static void closeSession()
                         throws com.sun.media.jsdt.JSDTException
Closes the global JSDT communication session for the event daemon. If the session has already been closed then an exception will be generated.
Throws:
com.sun.media.jsdt.JSDTException - Thrown if an error occurs shutting down the session.
IllegalStateException - Thrown if the session was not open.

getSession

public static com.sun.media.jsdt.Session getSession()
Returns the global Event daemon session to the requestor. There is only one session per JVM for the event daemon. Thus there can only be one eventd per JVM.
Returns:
The global JSDT session.
Throws:
IllegalStateException - Thrown if the session has not yet been initalized.

getClient

public static com.sun.media.jsdt.Client getClient()
Returns the JSDT Client for the event system. This client can be shared, so long as there is one and only one listener per channel.

shutdown

public void shutdown()

Initiates the shutdown sequence and waits for this thread to exit.


start

public void start()

getProperties

public static Properties getProperties()
Returns:
all the loaded properties

getProperty

public static String getProperty(String key)
Returns:
value for the specified property

getOverrides

public static List getOverrides()
Returns list of strings that must be reset in the parser.

getEventByName

public static EventBase getEventByName(String key)

Find the mapped event base object for the passed key. When the event configuration is loaded the event base objects are indexed using their UEI and if available, the SNMP Enterprise identifier.

Parameters:
key - The key for the required event base object.
Returns:
The base configuration object.

main

public static void main(String[] args)
Start up Eventd