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.service.Service;
12  
13  /**
14   * <code>ServiceNotification</code> is fired when an event such as the service
15   * starting occurs. The payload of this event will always be a reference to the
16   * service.
17   */
18  public class ServiceNotification extends ServerNotification implements BlockingServerEvent
19  {
20      /**
21       * Serial version
22       */
23      private static final long serialVersionUID = -8575741816897936674L;
24      public static final int SERVICE_INITIALISED = SERVICE_EVENT_ACTION_START_RANGE + 1;
25      public static final int SERVICE_STARTED = SERVICE_EVENT_ACTION_START_RANGE + 2;
26      public static final int SERVICE_STOPPED = SERVICE_EVENT_ACTION_START_RANGE + 3;
27      public static final int SERVICE_PAUSED = SERVICE_EVENT_ACTION_START_RANGE + 4;
28      public static final int SERVICE_RESUMED = SERVICE_EVENT_ACTION_START_RANGE + 5;
29      public static final int SERVICE_DISPOSED = SERVICE_EVENT_ACTION_START_RANGE + 6;
30  
31      static {
32          registerAction("service initialised", SERVICE_INITIALISED);
33          registerAction("service started", SERVICE_STARTED);
34          registerAction("service stopped", SERVICE_STOPPED);
35          registerAction("service paused", SERVICE_PAUSED);
36          registerAction("service resumed", SERVICE_RESUMED);
37          registerAction("service disposed", SERVICE_DISPOSED);
38      }
39  
40      public ServiceNotification(Service message, int action)
41      {
42          super(message.getName(), action);
43          resourceIdentifier = message.getName();
44      }
45  }