View Javadoc
1   /*
2    * Copyright (c) MuleSoft, Inc.  All rights reserved.  http://www.mulesoft.com
3    * The software in this package is published under the terms of the CPAL v1.0
4    * license, a copy of which has been included with this distribution in the
5    * LICENSE.txt file.
6    */
7   package org.mule.context.notification;
8   
9   import org.mule.api.context.notification.BlockingServerEvent;
10  import org.mule.api.context.notification.ServerNotification;
11  import org.mule.api.model.Model;
12  
13  /**
14   * <code>ModelNotification</code> is fired when an event such as the model starting
15   * occurs. The payload of this event will always be a reference to the model.
16   * 
17   * @see org.mule.api.model.Model
18   */
19  public class ModelNotification extends ServerNotification implements BlockingServerEvent
20  {
21      /**
22       * Serial version
23       */
24      private static final long serialVersionUID = -1954880336427554435L;
25  
26      public static final int MODEL_INITIALISED = MODEL_EVENT_ACTION_START_RANGE + 2;
27      public static final int MODEL_STARTED = MODEL_EVENT_ACTION_START_RANGE + 6;
28      public static final int MODEL_STOPPED = MODEL_EVENT_ACTION_START_RANGE + 8;
29      public static final int MODEL_DISPOSED = MODEL_EVENT_ACTION_START_RANGE + 10;
30  
31      static {
32          registerAction("model initialised", MODEL_INITIALISED);
33          registerAction("model started", MODEL_STARTED);
34          registerAction("model stopped", MODEL_STOPPED);
35          registerAction("model disposed", MODEL_DISPOSED);
36      }
37  
38      public ModelNotification(Model model, int action)
39      {
40          super(model.getName(), action);
41          resourceIdentifier = model.getName();
42      }
43  }