@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; NotificationSourceWrapperImpl other = (NotificationSourceWrapperImpl) obj; if (notificationSource == null) { if (other.notificationSource != null) return false; } else if (!notificationSource.equals(other.notificationSource)) return false; return true; }
/** * Creates an instance of an {@link UsageNotification} for the specified * args. This operation is exposed to allow it be overriden by * {@link SbbUsageMBean} impl. * * @param value * @param seqno * @param usageParameterSetName * @param usageParameterName * @param isCounter * @return */ protected UsageNotification createUsageNotification(long value, long seqno, String usageParameterSetName, String usageParameterName, boolean isCounter) { return new UsageNotification(notificationSource .getUsageNotificationType(), this, notificationSource, usageParameterSetName, usageParameterName, isCounter, value, seqno, System.currentTimeMillis()); }
@Override public int hashCode() { return ((notificationSource == null) ? 0 : notificationSource.hashCode()); }
/** * Generates the log4j logger name for the tracer with specified named and notification source. * * @param tracerName * @param notificationSource * @return */ private String tracerNameToLog4JLoggerName(String tracerName, NotificationSource notificationSource) { final StringBuilder sb = new StringBuilder("javax.slee.").append(notificationSource.toString()); if(!tracerName.equals(ROOT_TRACER_NAME)) { sb.append('.').append(tracerName); } return sb.toString(); }
/** * THis is internaly called, by 1.1 tracers * * @param src */ void sendNotification(javax.slee.facilities.TraceLevel level, String message, Throwable t) { if (!isTraceable(level)) { return; } traceMBean.sendNotification(new TraceNotification(notificationSource.getNotificationSource().getTraceNotificationType(), traceMBean, notificationSource.getNotificationSource(), getTracerName(), level, message, t, notificationSource.getNextSequence(), System.currentTimeMillis())); }
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); }
public String[] getAlarms(NotificationSource notificationSource) throws NullPointerException, UnrecognizedNotificationSourceException, ManagementException { if (notificationSource == null) { throw new NullPointerException("NotificationSource must not be null"); } mandateSource(notificationSource); try { Set<String> ids = new HashSet<String>(); for (Map.Entry<AlarmPlaceHolder, NotificationSource> e : placeHolderToNotificationSource.entrySet()) { if (e.getValue().equals(notificationSource)) { ids.add(e.getKey().getAlarm().getAlarmID()); } } return ids.toArray(new String[ids.size()]); } catch (Exception e) { throw new ManagementException("Failed to get alarm id list due to: ", e); } }
public boolean isSourceOwnerOfAlarm(NotificationSourceWrapper notificationSource, String alarmID) { AlarmPlaceHolder aph = this.alarmIdToAlarm.get(alarmID); if (aph == null) return false; return aph.getNotificationSource().getNotificationSource().equals(notificationSource.getNotificationSource()); }
public int clearAlarms(NotificationSource notificationSource, String alarmType) throws NullPointerException, UnrecognizedNotificationSourceException, ManagementException { if (notificationSource == null) { throw new NullPointerException("NotificationSource must not be null"); } if (alarmType == null) { throw new NullPointerException("AlarmType must not be null"); } mandateSource(notificationSource); int count = 0; try { for (Map.Entry<AlarmPlaceHolder, NotificationSource> e : placeHolderToNotificationSource.entrySet()) { if (e.getValue().equals(notificationSource) && e.getKey().getAlarmType().equals(alarmType)) { if (clearAlarm(e.getKey().getAlarm().getAlarmID())) { count++; } } } } catch (Exception e) { throw new ManagementException("Failed to get alarm id list due to: ", e); } return count; }
public int clearAlarms(NotificationSource notificationSource) throws NullPointerException, UnrecognizedNotificationSourceException, ManagementException { if (notificationSource == null) { throw new NullPointerException("NotificationSource must not be null"); } mandateSource(notificationSource); int count = 0; try { for (Map.Entry<AlarmPlaceHolder, NotificationSource> e : placeHolderToNotificationSource.entrySet()) { if (e.getValue().equals(notificationSource)) { if (clearAlarm(e.getKey().getAlarm().getAlarmID())) { count++; } } } } catch (Exception e) { throw new ManagementException("Failed to get alarm id list due to: ", e); } return count; }