org.openoss.opennms.spring.qosd
Class QoSDimpl2

java.lang.Object
  extended by org.openoss.opennms.spring.qosd.QoSDimpl2
All Implemented Interfaces:
org.opennms.core.fiber.Fiber, org.opennms.core.fiber.PausableFiber, org.opennms.netmgt.eventd.EventListener, QoSD

public class QoSDimpl2
extends java.lang.Object
implements org.opennms.core.fiber.PausableFiber, org.opennms.netmgt.eventd.EventListener, QoSD

This class is a fiber scheduled by OpenNMS. It's purpose is to collect OpenNMS alarms and transmit them to an OpenOSS QoS bean. The start() method loads the configuration for the QosD daemon and registers for events Configuration is held in 4 files.

QoSD-configuration.xml

qosd.properties

opennms.conf

rmi.policy The Daemon starts in the following sequence;

1. When the deamon starts it initialises the AlarmListJ2eeConnectionManagerThread and registers with the AlarmMonitor bean in the application server.

2. It then calls the AlarmListJ2eeConnectionManagerThread.Reset_List in order to cause the interface to send an AlarmListRebuiltEvent.

The JNDI naming factory, JMS queues and ejb's conected to by the daemon are specified in the qosd.properties file. The location of qosd.properties file is set by the JRE system variable -DpropertiesFile which should be set when OpenNMS is started up. This is set in /etc/opennms.conf file Contents of opennms.conf:

ADDITIONAL_MANAGER_OPTIONS='-Djava.security.policy=/opt/OpenNMS/etc/rmi.policy \ -DpropertiesFile=/opt/OpenNMS/etc/qosd.properties \ -Drx_propertiesFile=/opt/OpenNMS/etc/qosdrx.properties \ -Djava.naming.provider.url=jnp://jbossjmsserver1:1099 \ -Djava.naming.factory.initial=org.jnp.interfaces.NamingContextFactory \ -Djava.naming.factory.url.pkgs=org.jboss.naming ' rmi.policy sets the security settings to allow the JVM to connect externally Contents of rmi.policy: grant{permission java.security.AllPermission;};

3. The daemon then sends out the full current alarm list to the AlarmMonitor bean and registers with OpenNMS for events

The events used to run the QosD bean are determined by the file /etc/QoSD-configuration.xml By default only the 'uei.opennms.org/vacuumd/alarmListChanged' uei is included in this file. This event is generated when the notifyOSSJnewAlarm automation running in the vacuumd deamon determines that the alarm list has changed. In normal operation there is a short delay between an alarm entering the alarm list and the notifyOSSJnewAlarm automation picking it up. This can be significantly shortend for high priority alarms if their raise uei's are also included in the QoSD-configuration.xml file. However for most alarms this is not worth the effort.


Field Summary
static java.lang.String NAME
           
static PropertiesLoader props
           
static boolean useUeiList
           
 
Fields inherited from interface org.opennms.core.fiber.PausableFiber
PAUSE_PENDING, PAUSED, RESUME_PENDING
 
Fields inherited from interface org.opennms.core.fiber.Fiber
RUNNING, START_PENDING, STARTING, STATUS_NAMES, STOP_PENDING, STOPPED
 
Constructor Summary
QoSDimpl2()
           
 
Method Summary
static org.apache.log4j.Logger getLog()
          Method to get the QosD's logger from OpenNMS
 java.lang.String getName()
          Returns the Log category name
 java.lang.String getStats()
          not used but needed for initialization
 int getStatus()
          lets OpenNMS know what state the daemon is in
 void init()
          Method to set up the fiber Note - not used in Spring activation
 void onEvent(org.opennms.netmgt.xml.event.Event event)
          The OpenNMS event listener runs this routine when a new event is detected.
 void pause()
          Pause method of fiber, called by OpenNMS to put the fiber in a suspended state until it can be later resumed.
 void registerListener()
          Registers an OpenNMS event listener with this class.
 void resume()
          Resume method of fiber, called by OpenNMS to start the fiber up from a paused state.
 void sendAlarms()
          A method to request an alarm list from the OpenNMS database using the ossDao, convert them to OSS/J alarms using the onmsAlarmOssjMapper and send the OSS/J alarms using the alarm list connection manager (alcm) to update the the AlarmMonitor bean.
 void setalarmDao(org.opennms.netmgt.dao.AlarmDao almDao)
          Used by Spring Application context to pass in alarmDao
 void setalarmListConnectionManager(AlarmListConnectionManager alcm)
          Used by Spring Application context to pass in AlarmListConnectionManager
 void setapplicationcontext(org.springframework.context.support.ClassPathXmlApplicationContext m_context)
          Used by jmx mbean QoSD to pass in Spring Application context
 void setassetRecordDao(org.opennms.netmgt.dao.AssetRecordDao ar)
          Used by Spring Application context to pass in AssetRecordDao
 void seteventIpcManager(org.opennms.netmgt.eventd.EventIpcManager evtIpcManager)
          Used by Spring Application context to pass in EventIpcManager
 void setnodeDao(org.opennms.netmgt.dao.NodeDao nodedao)
          Used by Spring Application context to pass in NodeDaof
 void setOnmsAlarmOssjMapper(OnmsAlarmOssjMapper _onmsAlarmOssjMapper)
          Used by Spring Application context to pass in OnmsAlarmOssjMapper The OnmsAlarmOssjMapper class maps OpenNMS alarms to OSS/J alarms and events
 void setossDao(OssDaoOpenNMSImpl _ossDao)
          provides an interface to OpenNMS which provides a unified api
 void start()
          The start() method loads the configuration for the QosD daemon and registers for events
 void stop()
          Stop method of fiber, called by OpenNMS when fiber execution is to finish.
 void unregisterListener()
          Stops OpenNMS calling the onEvent method of this object when an event occurs.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

props

public static PropertiesLoader props

NAME

public static final java.lang.String NAME
See Also:
Constant Field Values

useUeiList

public static boolean useUeiList
Constructor Detail

QoSDimpl2

public QoSDimpl2()
Method Detail

getLog

public static org.apache.log4j.Logger getLog()
Method to get the QosD's logger from OpenNMS


setossDao

public void setossDao(OssDaoOpenNMSImpl _ossDao)
provides an interface to OpenNMS which provides a unified api

Specified by:
setossDao in interface QoSD
Parameters:
ossDao - the ossDao to set

setOnmsAlarmOssjMapper

public void setOnmsAlarmOssjMapper(OnmsAlarmOssjMapper _onmsAlarmOssjMapper)
Used by Spring Application context to pass in OnmsAlarmOssjMapper The OnmsAlarmOssjMapper class maps OpenNMS alarms to OSS/J alarms and events

Specified by:
setOnmsAlarmOssjMapper in interface QoSD
Parameters:
onmsAlarmOssjMapper - the onmsAlarmOssjMapper to set

setassetRecordDao

public void setassetRecordDao(org.opennms.netmgt.dao.AssetRecordDao ar)
Used by Spring Application context to pass in AssetRecordDao

Specified by:
setassetRecordDao in interface QoSD
Parameters:
ar -

setnodeDao

public void setnodeDao(org.opennms.netmgt.dao.NodeDao nodedao)
Used by Spring Application context to pass in NodeDaof

Specified by:
setnodeDao in interface QoSD
Parameters:
nodedao -

seteventIpcManager

public void seteventIpcManager(org.opennms.netmgt.eventd.EventIpcManager evtIpcManager)
Used by Spring Application context to pass in EventIpcManager

Specified by:
seteventIpcManager in interface QoSD
Parameters:
eventIpcManager -

setalarmDao

public void setalarmDao(org.opennms.netmgt.dao.AlarmDao almDao)
Used by Spring Application context to pass in alarmDao

Specified by:
setalarmDao in interface QoSD
Parameters:
alarmDao -

setalarmListConnectionManager

public void setalarmListConnectionManager(AlarmListConnectionManager alcm)
Used by Spring Application context to pass in AlarmListConnectionManager

Specified by:
setalarmListConnectionManager in interface QoSD
Parameters:
alcm -

setapplicationcontext

public void setapplicationcontext(org.springframework.context.support.ClassPathXmlApplicationContext m_context)
Used by jmx mbean QoSD to pass in Spring Application context

Specified by:
setapplicationcontext in interface QoSD
Parameters:
m_context - - application conext for this bean to use

init

public void init()
Method to set up the fiber Note - not used in Spring activation

Specified by:
init in interface QoSD

start

public void start()
The start() method loads the configuration for the QosD daemon and registers for events

Specified by:
start in interface org.opennms.core.fiber.Fiber
Specified by:
start in interface QoSD

stop

public void stop()
Stop method of fiber, called by OpenNMS when fiber execution is to finish. Its purpose is to clean everything up, e.g. close any JNDI or database connections, before the fiber's execution is ended.

Specified by:
stop in interface org.opennms.core.fiber.Fiber
Specified by:
stop in interface QoSD

resume

public void resume()
Resume method of fiber, called by OpenNMS to start the fiber up from a paused state.

Specified by:
resume in interface org.opennms.core.fiber.PausableFiber
Specified by:
resume in interface QoSD

pause

public void pause()
Pause method of fiber, called by OpenNMS to put the fiber in a suspended state until it can be later resumed.

Specified by:
pause in interface org.opennms.core.fiber.PausableFiber
Specified by:
pause in interface QoSD

getName

public java.lang.String getName()
Returns the Log category name

Specified by:
getName in interface org.opennms.core.fiber.Fiber
Specified by:
getName in interface org.opennms.netmgt.eventd.EventListener
Specified by:
getName in interface QoSD

getStatus

public int getStatus()
lets OpenNMS know what state the daemon is in

Specified by:
getStatus in interface org.opennms.core.fiber.Fiber
Specified by:
getStatus in interface QoSD
Parameters:
status -

registerListener

public void registerListener()
Registers an OpenNMS event listener with this class. When an event occurs, OpenNMS will call the onEvent() method of this object.

Specified by:
registerListener in interface QoSD

unregisterListener

public void unregisterListener()
Stops OpenNMS calling the onEvent method of this object when an event occurs.

Specified by:
unregisterListener in interface QoSD

onEvent

public void onEvent(org.opennms.netmgt.xml.event.Event event)
The OpenNMS event listener runs this routine when a new event is detected. This can be run on any event but only needs to run on uei.opennms.org/vacuumd/alarmListChanged

Specified by:
onEvent in interface org.opennms.netmgt.eventd.EventListener
Specified by:
onEvent in interface QoSD

sendAlarms

public void sendAlarms()
A method to request an alarm list from the OpenNMS database using the ossDao, convert them to OSS/J alarms using the onmsAlarmOssjMapper and send the OSS/J alarms using the alarm list connection manager (alcm) to update the the AlarmMonitor bean. This is called from ossDao every time there is an update to the database.

Specified by:
sendAlarms in interface QoSD

getStats

public java.lang.String getStats()
not used but needed for initialization

Specified by:
getStats in interface QoSD
Returns:
stats


Copyright ? 2006-2008. All Rights Reserved.