FileDocCategorySizeDatePackage
NotificationBuilder.javaAPI DocGlassfish v2 API5512Fri May 04 22:31:04 BST 2007com.sun.appserv.management.util.jmx

NotificationBuilder

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().

Fields Summary
private long
mSequenceNumber
private final String
mNotificationType
private final Object
mSource
Constructors Summary
public NotificationBuilder(String notificationType, Object source)

		mNotificationType	= notificationType;
		mSource				= source;
	
Methods Summary
public javax.management.NotificationbuildNew()
Build a new Notification without any values in its Map and no message.

		return buildNew( mNotificationType );
	
public javax.management.NotificationbuildNew(java.lang.String message)
Build a new Notification without any values in its Map.

param
message

	    return buildNewWithMap( message, null );
	
public javax.management.NotificationbuildNewWithMap(java.lang.String message, java.util.Map userDataMap)
Build a new Notification with an existing Map.

		final Notification notif	= new Notification(
			mNotificationType,
			mSource,
			nextSequenceNumber(),
			now(),
			message);
	
	    if ( userDataMap != null )
	    {
		    notif.setUserData( userDataMap );
		}
		else
		{
		    notif.setUserData( new HashMap<String,Serializable>() );
		}
		
		return( notif );
	
public final java.lang.StringgetNotificationType()

		return( mNotificationType );
	
public final java.lang.ObjectgetSource()

		return( mSource );
	
protected synchronized longnextSequenceNumber()

	
		  
	 
	
		return( mSequenceNumber++ );
	
protected final longnow()

		return( System.currentTimeMillis() );
	
public static final voidputAllMapData(javax.management.Notification notif, java.util.Map additionalUserData)
Put all key/value pairs into the user data Map.

	    final Map<String,Serializable> userData   =
	        JMXUtil.getUserDataMapString_Serializable( notif );
	        
		userData.putAll( additionalUserData );
	
public static final voidputMapData(javax.management.Notification notif, java.lang.String keyToInsert, java.io.Serializable valueToInsert)
Put a single key/value pair into the user data Map.

	    final Map<String,Serializable> userData   =
	        JMXUtil.getUserDataMapString_Serializable( notif );
	    
		userData.put( keyToInsert, valueToInsert );