public void createAlarm(ComponentID alarmSource, Level alarmLevel, String alarmType, String message, Throwable cause, long timestamp) throws UnrecognizedComponentException { if (log.isDebugEnabled()) { log.debug("alarmSource:" + alarmSource + " alarmLevel:" + alarmLevel + " alarmType:" + alarmType + " message:" + message + " cause:" + cause + " timeStamp:" + timestamp); } if (alarmSource == null || alarmLevel == null || alarmType == null || message == null) throw new NullPointerException("Null parameter"); if (alarmLevel.isOff()) throw new IllegalArgumentException("Invalid alarm level"); RegisteredComp comp = registeredComps.get(alarmSource); if (comp == null) throw new UnrecognizedComponentException("Component not registered"); // TODO I'm not sure if we should log the alarm too // Add the notication type if not already in set. See note in // declaration about why we are using a map, not a set // if (!this.notificationTypes.containsKey(alarmType)) // this.notificationTypes.put(alarmType, alarmType); // Create the alarm notification and propagate to the Alarm MBean AlarmNotification notification = new AlarmNotification(this, alarmType, alarmSource, alarmLevel, message, cause, comp.getSeqNo(), timestamp); super.sendNotification(notification); }
private void createAlarmInternal(ComponentID alarmSource, Level alarmLevel, String alarmType, String message, Throwable cause, long timeStamp) throws NullPointerException, IllegalArgumentException, UnrecognizedComponentException, FacilityException { if (log.isDebugEnabled()) { log.debug("alarmSource:" + alarmSource + " alarmLevel:" + alarmLevel + " alarmType:" + alarmType + " message:" + message + " cause:" + cause + " timeStamp:" + timeStamp); } if (alarmSource == null || alarmLevel == null || alarmType == null || message == null) throw new NullPointerException("Null parameter"); if (alarmLevel.isOff()) throw new IllegalArgumentException("Invalid alarm level"); RegisteredComp comp = (RegisteredComp)registeredComps.get(alarmSource); if (comp == null) throw new UnrecognizedComponentException("Component not registered"); //TODO I'm not sure if we should log the alarm too //Add the notication type if not already in set. See note in declaration about why we are using a map, not a set if (!this.notificationTypes.containsKey(alarmType)) this.notificationTypes.put(alarmType, alarmType); //Create the alarm notification and propagate to the Alarm MBean AlarmNotification notification = new AlarmNotification(mBean, alarmType, alarmSource, alarmLevel, message, cause, comp.getSeqNo(), timeStamp); mBean.sendNotification(notification); }
private void generateNotification(AlarmPlaceHolder aph, boolean isCleared) { Alarm alarm = aph.getAlarm(); AlarmLevel generalLevel = isCleared ? AlarmLevel.CLEAR : alarm.getAlarmLevel(); AlarmNotification notification = new AlarmNotification(aph.getNotificationSource().getNotificationSource().getAlarmNotificationType(), this, alarm.getAlarmID(), aph.getNotificationSource() .getNotificationSource(), alarm.getAlarmType(), alarm.getInstanceID(), generalLevel, alarm.getMessage(), alarm.getCause(), aph.getNotificationSource().getNextSequence(), System .currentTimeMillis()); super.sendNotification(notification); }