View Javadoc

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