Package com.sun.appserv.management.util.jmx

Examples of com.sun.appserv.management.util.jmx.NotificationBuilder


    public void
  testEmit()
  {
    final NotificationEmitterService  nes  = getNotificationEmitterService();
   
    final NotificationBuilder  builder  =
      new NotificationBuilder( testEmitListener.TEST_TYPE, TEST_SOURCE );
   
    final testEmitListener  listener  = new testEmitListener();
    nes.addNotificationListener( listener, null, null);
    final Notification  notif  = builder.buildNew( TEST_MESSAGE);
    builder.putMapData( notif, TEST_KEY, TEST_VALUE );
   
    // call emitNotification() and verify it was emitted
    nes.emitNotification( notif );
    while( listener.getLast() == null )
    {
      // wait...
      mySleep( 20 );
    }
    final Notification  retrieved  = listener.getLast();
    assert( retrieved.getType().equals( notif.getType() ) );
    assert( Util.getAMXNotificationValue( retrieved, TEST_KEY, String.class).equals( TEST_VALUE ) );
    assert( retrieved.getSource().equals( TEST_SOURCE ) );
    assert( retrieved.getMessage().equals( TEST_MESSAGE ) );
   
    // now emit many Notifications.
    listener.clear();
    long  start  = now();
    final int  ITER  = 200;
    for( int i = 0; i < ITER; ++i)
    {
      final Notification  temp  = builder.buildNew( TEST_MESSAGE);
        builder.putMapData( notif, TEST_KEY, TEST_VALUE );
      nes.emitNotification( temp );
    }
    printElapsedIter( "Emitted Notifications", start, ITER );
    start  = now();
    while( listener.getNumHeard() < ITER )
View Full Code Here


  /**
   */
    protected void
  issueDeploymentStartedNotification( final Object deployID )
  {
    final NotificationBuilder  builder  =
      getNotificationBuilder( DEPLOYMENT_STARTED_NOTIFICATION_TYPE );
   
    final Notification  notif  = builder.buildNew( );
    builder.putMapData( notif, NOTIF_DEPLOYMENT_ID_KEY, (Serializable)deployID );
   
    issueNotification( deployID, notif );
  }
View Full Code Here

    protected void
  issueDeploymentDoneNotification(
    final Object      deployID,
    final DeploymentStatus  deploymentStatus )
  {
    final NotificationBuilder  builder  =
      getNotificationBuilder( DEPLOYMENT_COMPLETED_NOTIFICATION_TYPE );
   
    final Notification  notif  = builder.buildNew( );
    builder.putMapData( notif, NOTIF_DEPLOYMENT_ID_KEY, (Serializable)deployID );
    builder.putMapData( notif, NOTIF_DEPLOYMENT_COMPLETED_STATUS_KEY, (Serializable)deploymentStatus.asMap() );
   
    issueNotification( deployID, notif );
  }
View Full Code Here

    protected void
  issueDeploymentProgressNotification(
    final Object        deployID,
    final DeploymentProgress  progress)
  {
    final NotificationBuilder  builder  =
      getNotificationBuilder( DEPLOYMENT_PROGRESS_NOTIFICATION_TYPE );
   
    final Notification  notif  = builder.buildNew( );
    builder.putMapData( notif, NOTIF_DEPLOYMENT_ID_KEY, (Serializable)deployID );
    builder.putMapData( notif, NOTIF_DEPLOYMENT_PROGRESS_KEY, (Serializable)progress.asMap() );
   
    issueNotification( deployID, notif );
  }
View Full Code Here

        mNotificationTypeToNotificationBuilderMap.clear();
        for( final String notifType : ALL_LOG_RECORD_NOTIFICATION_TYPES )
        {
            mNotificationTypeToNotificationBuilderMap.put(
                notifType,
                new NotificationBuilder( notifType, objectName ) );
        }
    }
View Full Code Here

   }
 
    protected NotificationBuilder
  createNotificationBuilder( final String notificationType )
  {
    NotificationBuilder  builder  = null;
   
    if ( notificationType.equals( AttributeChangeNotification.ATTRIBUTE_CHANGE ) )
    {
      builder  = new AttributeChangeNotificationBuilder( getObjectName() );
    }
    else
    {
      builder  = new NotificationBuilder( notificationType, getObjectName() );
    }
   
    return( builder );
  }
View Full Code Here

    if ( mNotificationBuilders == null )
    {
      mNotificationBuilders  = new HashMap<String,NotificationBuilder>();
    }
   
    NotificationBuilder  builder  =
      (NotificationBuilder)mNotificationBuilders.get( notificationType );
   
    if ( builder == null )
    {
      builder  = createNotificationBuilder( notificationType );
View Full Code Here

    final String      notificationType,
    final String        message,
    final String      key,
    final Serializable  value)
  {
    final NotificationBuilder  builder  =
      getNotificationBuilder( notificationType );
     
    final Notification  notif  = builder.buildNew( message );
    NotificationBuilder.putMapData( notif, key, value );
     
    sendNotification( notif );
  }
View Full Code Here

  /**
   */
    protected void
  issueDeploymentAbortedNotification( final Object deployID )
  {
    final NotificationBuilder  builder  =
      getNotificationBuilder( DEPLOYMENT_ABORTED_NOTIFICATION_TYPE );
   
    final Notification  notif  = builder.buildNew( );
    builder.putMapData( notif, NOTIF_DEPLOYMENT_ID_KEY, (Serializable)deployID );
   
    issueNotification( deployID, notif );
  }
View Full Code Here

   
   
        private NotificationBuilder
    notificationTypeToNotificationBuilder( final String notificationType )
    {
        NotificationBuilder builder =
            mNotificationTypeToNotificationBuilderMap.get( notificationType );
           
        assert( builder != null );
       
        return builder;
View Full Code Here

TOP

Related Classes of com.sun.appserv.management.util.jmx.NotificationBuilder

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.