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