View Javadoc

1   /*
2    * $Id: RegistryNotification.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.ServerNotification;
14  import org.mule.api.registry.Registry;
15  
16  /**
17   * <code>RegistryNotification</code> is fired when an event such as a Registry
18   * being started occurs. The payload of this event will always
19   * be a reference to the Registry ID.
20   *
21   * @see org.mule.api.registry.Registry
22   * @see org.mule.api.MuleContext
23   */
24  public class RegistryNotification extends ServerNotification
25  {
26      /**
27       * Serial version
28       */
29      private static final long serialVersionUID = -3246036188021581121L;
30  
31      public static final int REGISTRY_INITIALISING = REGISTRY_EVENT_ACTION_START_RANGE + 1;
32      public static final int REGISTRY_INITIALISED = REGISTRY_EVENT_ACTION_START_RANGE + 2;
33      public static final int REGISTRY_DISPOSING = REGISTRY_EVENT_ACTION_START_RANGE + 3;
34      public static final int REGISTRY_DISPOSED = REGISTRY_EVENT_ACTION_START_RANGE + 4;
35  
36      static {
37          registerAction("registry initialising", REGISTRY_INITIALISING);
38          registerAction("registry initialised", REGISTRY_INITIALISED);
39          registerAction("registry disposing", REGISTRY_DISPOSING);
40          registerAction("registry disposed", REGISTRY_DISPOSED);
41      }
42  
43      public RegistryNotification(Registry registry, String action)
44      {
45          this(registry, getActionId(action));
46      }
47  
48      public RegistryNotification(Registry registry, int action)
49      {
50          super(registry.getRegistryId(), action);
51          resourceIdentifier = registry.getRegistryId();
52      }
53  
54  
55      @Override
56      public String toString()
57      {
58          return EVENT_NAME + "{" + "action=" + getActionName(action) + ", resourceId=" + resourceIdentifier
59                  + ", timestamp=" + timestamp + "}";
60      }
61  }