org.openoss.opennms.spring.qosd
Class QoSDimpl2

java.lang.Object
  extended by org.opennms.netmgt.daemon.AbstractServiceDaemon
      extended by org.openoss.opennms.spring.qosd.QoSDimpl2
All Implemented Interfaces:
Fiber, PausableFiber, SpringServiceDaemon, EventListener, ServiceDaemon, QoSD, org.springframework.beans.factory.InitializingBean

public class QoSDimpl2
extends AbstractServiceDaemon
implements PausableFiber, 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.

Version:
$Id: $
Author:
ranger

Field Summary
static String NAME
          Constant NAME="OpenOSS.QoSD"
 PropertiesLoader props
           
 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()
          Constructor for QoSDimpl2.
 
Method Summary
static ThreadCategory getLog()
          Method to get the QosD's logger from OpenNMS
 String getStats()
          not used but needed for initialization
 void onEvent(Event event)
          Process a sent event.
protected  void onInit()
          Method to set up the fiber Note - not used in Spring activation
protected  void onPause()
          Pause method of fiber, called by OpenNMS to put the fiber in a suspended state until it can be later resumed.
protected  void onResume()
          Resume method of fiber, called by OpenNMS to start the fiber up from a paused state.
protected  void onStart()
          The start() method loads the configuration for the QosD daemon and registers for events
protected  void onStop()
          Stop method of fiber, called by OpenNMS when fiber execution is to finish.
 void registerListener()
          Registers an OpenNMS event listener with this class.
 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(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(AssetRecordDao ar)
          Used by Spring Application context to pass in AssetRecordDao
 void setEventIpcManager(EventIpcManager evtIpcManager)
          Used by Spring Application context to pass in EventIpcManager
 void setNodeDao(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(OssDao _ossDao)
          provides an interface to OpenNMS which provides a unified api
 void unregisterListener()
          Stops OpenNMS calling the onEvent method of this object when an event occurs.
 
Methods inherited from class org.opennms.netmgt.daemon.AbstractServiceDaemon
afterPropertiesSet, debugf, debugf, errorf, errorf, fatalf, fatalf, getName, getStatus, getStatusText, infof, infof, init, isPaused, isRunning, isStarting, isStartPending, log, pause, resume, setStatus, start, status, stop, waitForStatus, waitForStatus, warnf, warnf
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.opennms.core.fiber.PausableFiber
pause, resume
 
Methods inherited from interface org.opennms.core.fiber.Fiber
getName, getStatus, start, stop
 
Methods inherited from interface org.opennms.netmgt.model.events.EventListener
getName
 
Methods inherited from interface org.openoss.opennms.spring.qosd.QoSD
getName, getStatus, init, pause, resume, start, stop
 

Field Detail

props

public PropertiesLoader props

NAME

public static final String NAME
Constant NAME="OpenOSS.QoSD"

See Also:
Constant Field Values

useUeiList

public boolean useUeiList
Constructor Detail

QoSDimpl2

public QoSDimpl2()

Constructor for QoSDimpl2.

Method Detail

getLog

public static ThreadCategory getLog()
Method to get the QosD's logger from OpenNMS

Returns:
a ThreadCategory object.

setOssDao

public void setOssDao(OssDao _ossDao)
provides an interface to OpenNMS which provides a unified api 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 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(AssetRecordDao ar)
Used by Spring Application context to pass in AssetRecordDao Used by Spring Application context to pass in AssetRecordDao

Specified by:
setAssetRecordDao in interface QoSD
Parameters:
ar - a AssetRecordDao object.

setNodeDao

public void setNodeDao(NodeDao nodedao)
Used by Spring Application context to pass in NodeDaof Used by Spring Application context to pass in NodeDaof

Specified by:
setNodeDao in interface QoSD
Parameters:
nodedao - a NodeDao object.

setEventIpcManager

public void setEventIpcManager(EventIpcManager evtIpcManager)
Used by Spring Application context to pass in EventIpcManager Used by Spring Application context to pass in EventIpcManager

Specified by:
setEventIpcManager in interface QoSD
Parameters:
evtIpcManager - a EventIpcManager object.

setAlarmDao

public void setAlarmDao(AlarmDao almDao)
Used by Spring Application context to pass in alarmDao Used by Spring Application context to pass in alarmDao

Specified by:
setAlarmDao in interface QoSD
Parameters:
almDao - a AlarmDao object.

setAlarmListConnectionManager

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

Specified by:
setAlarmListConnectionManager in interface QoSD
Parameters:
alcm - a AlarmListConnectionManager object.

setApplicationContext

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

Specified by:
setApplicationContext in interface QoSD
Parameters:
m_context - - application context for this bean to use

onInit

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

Specified by:
onInit in class AbstractServiceDaemon

onStart

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

Overrides:
onStart in class AbstractServiceDaemon

onStop

protected void onStop()
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.

Overrides:
onStop in class AbstractServiceDaemon

onResume

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

Overrides:
onResume in class AbstractServiceDaemon

onPause

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

Overrides:
onPause in class AbstractServiceDaemon

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(Event event)
Process a sent 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 EventListener
Specified by:
onEvent in interface QoSD
Parameters:
event - a Event object.

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 String getStats()
not used but needed for initialization

Specified by:
getStats in interface QoSD
Returns:
stats


Copyright © 2011. All Rights Reserved.