Coverage Report - org.mule.impl.internal.notifications.ModelNotification
 
Classes in this File Line Coverage Branch Coverage Complexity
ModelNotification
0%
0/9
0%
0/1
1.667
 
 1  
 /*
 2  
  * $Id: ModelNotification.java 7976 2007-08-21 14:26:13Z dirk.olmes $
 3  
  * --------------------------------------------------------------------------------------
 4  
  * Copyright (c) MuleSource, Inc.  All rights reserved.  http://www.mulesource.com
 5  
  *
 6  
  * The software in this package is published under the terms of the CPAL v1.0
 7  
  * license, a copy of which has been included with this distribution in the
 8  
  * LICENSE.txt file.
 9  
  */
 10  
 
 11  
 package org.mule.impl.internal.notifications;
 12  
 
 13  
 import org.mule.umo.manager.UMOServerNotification;
 14  
 import org.mule.umo.model.UMOModel;
 15  
 
 16  
 /**
 17  
  * <code>ModelNotification</code> is fired when an event such as the model starting
 18  
  * occurs. The payload of this event will always be a reference to the model.
 19  
  * 
 20  
  * @see org.mule.umo.model.UMOModel
 21  
  */
 22  
 public class ModelNotification extends UMOServerNotification implements BlockingServerEvent
 23  
 {
 24  
     /**
 25  
      * Serial version
 26  
      */
 27  
     private static final long serialVersionUID = -1954880336427554435L;
 28  
 
 29  
     public static final int MODEL_INITIALISING = MODEL_EVENT_ACTION_START_RANGE + 1;
 30  
     public static final int MODEL_INITIALISED = MODEL_EVENT_ACTION_START_RANGE + 2;
 31  
     public static final int MODEL_INITIALISING_LISTENERS = MODEL_EVENT_ACTION_START_RANGE + 3;
 32  
     public static final int MODEL_INITIALISED_LISTENERS = MODEL_EVENT_ACTION_START_RANGE + 4;
 33  
     public static final int MODEL_STARTING = MODEL_EVENT_ACTION_START_RANGE + 5;
 34  
     public static final int MODEL_STARTED = MODEL_EVENT_ACTION_START_RANGE + 6;
 35  
     public static final int MODEL_STOPPING = MODEL_EVENT_ACTION_START_RANGE + 7;
 36  
     public static final int MODEL_STOPPED = MODEL_EVENT_ACTION_START_RANGE + 8;
 37  
     public static final int MODEL_DISPOSING = MODEL_EVENT_ACTION_START_RANGE + 9;
 38  
     public static final int MODEL_DISPOSED = MODEL_EVENT_ACTION_START_RANGE + 10;
 39  
 
 40  0
     private static final transient String[] ACTIONS = new String[]{"initialising", "initialised",
 41  
         "initialising listeners", "initialised listeners", "starting", "started", "stopping", "stopped",
 42  
         "disposing", "disposed"};
 43  
 
 44  
     public ModelNotification(UMOModel model, int action)
 45  
     {
 46  0
         super(model, action);
 47  0
         resourceIdentifier = model.getName();
 48  0
     }
 49  
 
 50  
     protected String getPayloadToString()
 51  
     {
 52  0
         return ((UMOModel) source).getName();
 53  
     }
 54  
 
 55  
     protected String getActionName(int action)
 56  
     {
 57  0
         int i = action - MODEL_EVENT_ACTION_START_RANGE;
 58  0
         if (i - 1 > ACTIONS.length)
 59  
         {
 60  0
             return String.valueOf(action);
 61  
         }
 62  0
         return ACTIONS[i - 1];
 63  
     }
 64  
 }