2 * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
9 package org.opendaylight.controller.config.api.jmx.notifications;
11 import javax.management.Notification;
12 import javax.management.NotificationBroadcasterSupport;
13 import javax.management.ObjectName;
14 import org.opendaylight.controller.config.api.jmx.ObjectNameUtil;
16 public abstract class ConfigJMXNotification extends Notification {
21 private static final long serialVersionUID = 6754474563863772845L;
23 private static long sequenceNumber = 1;
25 public static String TYPE_NAME = "configfNotificationProvider";
26 public static ObjectName OBJECT_NAME = ObjectNameUtil.createONWithDomainAndType(TYPE_NAME);
28 private final NotificationType type;
30 protected ConfigJMXNotification(NotificationType type,
31 NotificationBroadcasterSupport source, String message) {
32 super(type.toString(), source, sequenceNumber++, System.nanoTime(), message);
37 public String toString() {
38 return "TransactionProviderJMXNotification [type=" + type + "]";
42 * Sends this notification using source that created it
45 ((NotificationBroadcasterSupport) getSource()).sendNotification(this);
49 * Creates notification about successful commit execution.
51 * Intended for config-persister.
53 public static CommitJMXNotification afterCommit(NotificationBroadcasterSupport source, String messages) {
54 return new CommitJMXNotification(source, messages);
57 enum NotificationType {