org.openoss.opennms.spring.dao
Class OnmsAlarmOssjMapper

java.lang.Object
  extended by org.openoss.opennms.spring.dao.OnmsAlarmOssjMapper

public class OnmsAlarmOssjMapper
extends Object

OnmsAlarmOssjMapper class.

Version:
$Id: $
Author:
ranger

Field Summary
static int SPECIFY_OUTSTATION
          if alarmUpdateBehaviour is set to SPECIFY_OUTSTATION the receiver name will be used as the node name which will be updated with alarms from this receiver.
static int USE_TYPE_INSTANCE
          if alarmUpdateBehaviour is set to USE_TYPE_INSTANCE the alarm will be created with the node name corrsponding to a concatenation of the ManagedObjectID and ManagedObjectType.
 
Constructor Summary
OnmsAlarmOssjMapper()
           
 
Method Summary
static String ossjAlarmTypeToUei(String alarmType)
          Maps OSS/J alarm types to OpenNMS uei types
static OnmsSeverity ossjSeveritytoOnmsSeverity(short ossjseverity)
          convenience method to map OSS/J to OpenNMS severities A switch statement converts the OSS/J severity qualifier over to one compatible with OpenNMS From OpenNMS code; public static final int INDETERMINATE_SEVERITY = 1; public static final int CLEARED_SEVERITY = 2; public static final int NORMAL_SEVERITY = 3; public static final int WARNING_SEVERITY = 4; public static final int MINOR_SEVERITY = 5; public static final int MAJOR_SEVERITY = 6; public static final int CRITICAL_SEVERITY = 7; NOTE org.opennms.web.alarm.Alarm.NORMAL_SEVERITY has no equivilent in OSS/J X733
 OnmsAlarm populateOnmsAlarmFromOssjAlarm(OnmsAlarm onmsAlarm, AlarmValue alarmValue, Integer almUpdateBehaviour, String defaultUpdateNodeLabel)
          This method maps an OSS/J AlarmValue to OpenNMS alarm
 AlarmValue populateOssjAlarmFromOpenNMSAlarm(AlarmValue alarmValueSpecification, OnmsAlarm _openNMSalarm)
          This method maps OpenNMS alarm to an OSS/J alarms and adds additional information
 void setAssetRecordDao(AssetRecordDao ar)
          Used by Spring Application context to pass in AssetRecordDao
 void setDistPollerDao(DistPollerDao _distPollerDao)
          Used by Spring Application context to pass in distPollerDao;
 void setNodeDao(NodeDao nodedao)
          Used by Spring Application context to pass in NodeDaof
 void setOssDao(OssDao _ossDao)
          provides an interface to OpenNMS which provides a unified api
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SPECIFY_OUTSTATION

public static int SPECIFY_OUTSTATION
if alarmUpdateBehaviour is set to SPECIFY_OUTSTATION the receiver name will be used as the node name which will be updated with alarms from this receiver. Usually this is set to the name of the node associated with the outstation but it can be set to a node which is a catch all for received alarms ( i.e. the local host perhaps )


USE_TYPE_INSTANCE

public static int USE_TYPE_INSTANCE
if alarmUpdateBehaviour is set to USE_TYPE_INSTANCE the alarm will be created with the node name corrsponding to a concatenation of the ManagedObjectID and ManagedObjectType. If these cannot be found then the alarm will default to the outstation node

Constructor Detail

OnmsAlarmOssjMapper

public OnmsAlarmOssjMapper()
Method Detail

setDistPollerDao

public void setDistPollerDao(DistPollerDao _distPollerDao)
Used by Spring Application context to pass in distPollerDao;

Parameters:
_distPollerDao - a DistPollerDao object.

setAssetRecordDao

public void setAssetRecordDao(AssetRecordDao ar)
Used by Spring Application context to pass in AssetRecordDao

Parameters:
ar - a AssetRecordDao object.

setNodeDao

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

Parameters:
nodedao - a NodeDao object.

setOssDao

public void setOssDao(OssDao _ossDao)
provides an interface to OpenNMS which provides a unified api

Parameters:
_ossDao - the ossDao to set

populateOnmsAlarmFromOssjAlarm

public OnmsAlarm populateOnmsAlarmFromOssjAlarm(OnmsAlarm onmsAlarm,
                                                AlarmValue alarmValue,
                                                Integer almUpdateBehaviour,
                                                String defaultUpdateNodeLabel)
                                         throws IllegalArgumentException,
                                                UnsupportedAttributeException
This method maps an OSS/J AlarmValue to OpenNMS alarm

Parameters:
onmsAlarm - OnmsAlarm object to be populated
alarmValue - OSS/J AlarmValue data to use to populate OnmsAlarm
almUpdateBehaviour - - determines how to treat the node name of the new alarm must be of value; USE_TYPE_INSTANCE - populate nodeID with node having same asset type and instance data as alarm or SPECIFY_OUTSTATION - populate nodeID with node having same nodeLabel as defaultUpdateNodeLabel
defaultUpdateNodeLabel - name of node to be updated if almUpdateBehaviour==SPECIFY_OUTSTATION
Returns:
the OnmsAlarm populated with OSS/J NotifyNewAlarmEvent data
Throws:
IllegalArgumentException - if any.
javax.oss.UnsupportedAttributeException - if any.
UnsupportedAttributeException

populateOssjAlarmFromOpenNMSAlarm

public AlarmValue populateOssjAlarmFromOpenNMSAlarm(AlarmValue alarmValueSpecification,
                                                    OnmsAlarm _openNMSalarm)
                                             throws IllegalArgumentException,
                                                    UnsupportedAttributeException
This method maps OpenNMS alarm to an OSS/J alarms and adds additional information

Parameters:
_openNMSalarm - data to use to populate the OSS/J alarm
alarmValueSpecification - AlarmValue object to be populated - Invariant (Specifcation) values should be already populated
Returns:
the _av OSS/J AlarmValue populated with opennms data
Throws:
IllegalArgumentException - if any.
javax.oss.UnsupportedAttributeException - if any.
UnsupportedAttributeException

ossjSeveritytoOnmsSeverity

public static OnmsSeverity ossjSeveritytoOnmsSeverity(short ossjseverity)
                                               throws IllegalArgumentException
convenience method to map OSS/J to OpenNMS severities A switch statement converts the OSS/J severity qualifier over to one compatible with OpenNMS From OpenNMS code; public static final int INDETERMINATE_SEVERITY = 1; public static final int CLEARED_SEVERITY = 2; public static final int NORMAL_SEVERITY = 3; public static final int WARNING_SEVERITY = 4; public static final int MINOR_SEVERITY = 5; public static final int MAJOR_SEVERITY = 6; public static final int CRITICAL_SEVERITY = 7; NOTE org.opennms.web.alarm.Alarm.NORMAL_SEVERITY has no equivilent in OSS/J X733

Parameters:
ossjseverity - the severity value according to ossj / X733
Returns:
the severity value according to opennms
Throws:
IllegalArgumentException - if any.

ossjAlarmTypeToUei

public static String ossjAlarmTypeToUei(String alarmType)
Maps OSS/J alarm types to OpenNMS uei types

Parameters:
alarmType - String representing OSS/J alarm Type
Returns:
string representing equivilent OpenNMS uei


Copyright © 2011. All Rights Reserved.