View Javadoc

1   /*
2    * $Id: ModelNotification.java 19191 2010-08-25 21:05:23Z tcarlson $
3    * --------------------------------------------------------------------------------------
4    * Copyright (c) MuleSoft, Inc.  All rights reserved.  http://www.mulesoft.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.context.notification;
12  
13  import org.mule.api.context.notification.BlockingServerEvent;
14  import org.mule.api.context.notification.ServerNotification;
15  import org.mule.api.model.Model;
16  
17  /**
18   * <code>ModelNotification</code> is fired when an event such as the model starting
19   * occurs. The payload of this event will always be a reference to the model.
20   * 
21   * @see org.mule.api.model.Model
22   */
23  public class ModelNotification extends ServerNotification implements BlockingServerEvent
24  {
25      /**
26       * Serial version
27       */
28      private static final long serialVersionUID = -1954880336427554435L;
29  
30      public static final int MODEL_INITIALISED = MODEL_EVENT_ACTION_START_RANGE + 2;
31      public static final int MODEL_STARTED = MODEL_EVENT_ACTION_START_RANGE + 6;
32      public static final int MODEL_STOPPED = MODEL_EVENT_ACTION_START_RANGE + 8;
33      public static final int MODEL_DISPOSED = MODEL_EVENT_ACTION_START_RANGE + 10;
34  
35      static {
36          registerAction("model initialised", MODEL_INITIALISED);
37          registerAction("model started", MODEL_STARTED);
38          registerAction("model stopped", MODEL_STOPPED);
39          registerAction("model disposed", MODEL_DISPOSED);
40      }
41  
42      public ModelNotification(Model model, int action)
43      {
44          super(model.getName(), action);
45          resourceIdentifier = model.getName();
46      }
47  }