Java EE 5 SDK

com.sun.appserv.management.util.jmx
Class NotificationBuilder

java.lang.Object
  extended by com.sun.appserv.management.util.jmx.NotificationBuilder
Direct Known Subclasses:
AttributeChangeNotificationBuilder

public class NotificationBuilder
extends Object

Base class for building AMX Notifications. AMX Notifications all place a Map in the userData field. This class takes care of building Notifications with correct time stamp, sequence number, etc. It also enforces certain conventions.

A convenience routine is provided for adding additional fields to the Map--putMapData().


Constructor Summary
NotificationBuilder(String notificationType, Object source)
           
 
Method Summary
 Notification buildNew()
          Build a new Notification without any values in its Map and no message.
 Notification buildNew(String message)
          Build a new Notification without any values in its Map.
 Notification buildNewWithMap(String message, Map<String,Serializable> userDataMap)
          Build a new Notification with an existing Map.
 String getNotificationType()
           
 Object getSource()
           
protected  long nextSequenceNumber()
           
protected  long now()
           
static
<T extends Serializable>
void
putAllMapData(Notification notif, Map<String,T> additionalUserData)
          Put all key/value pairs into the user data Map.
static void putMapData(Notification notif, String keyToInsert, Serializable valueToInsert)
          Put a single key/value pair into the user data Map.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NotificationBuilder

public NotificationBuilder(String notificationType,
                           Object source)
Method Detail

nextSequenceNumber

protected long nextSequenceNumber()

getNotificationType

public final String getNotificationType()

getSource

public final Object getSource()

now

protected final long now()

buildNewWithMap

public Notification buildNewWithMap(String message,
                                    Map<String,Serializable> userDataMap)
Build a new Notification with an existing Map.


buildNew

public Notification buildNew()
Build a new Notification without any values in its Map and no message.


buildNew

public Notification buildNew(String message)
Build a new Notification without any values in its Map.

Parameters:
message -

putMapData

public static final void putMapData(Notification notif,
                                    String keyToInsert,
                                    Serializable valueToInsert)
Put a single key/value pair into the user data Map.


putAllMapData

public static final <T extends Serializable> void putAllMapData(Notification notif,
                                                                Map<String,T> additionalUserData)
Put all key/value pairs into the user data Map.


Java EE 5 SDK

Submit a bug or feature

Copyright 2006 Sun Microsystems, Inc. All rights reserved.