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.module.client.remoting.notification;
8   
9   import org.mule.api.MuleMessage;
10  import org.mule.api.context.notification.ServerNotification;
11  
12  import java.util.HashMap;
13  import java.util.Map;
14  
15  /**
16   * <code>RemoteDispatcherNotification</code> is used to invoke actions on a remote mule server
17   */
18  
19  public class RemoteDispatcherNotification extends ServerNotification
20  {
21      /**
22       * Serial version
23       */
24      private static final long serialVersionUID = -53091546441476249L;
25  
26      /** This is a low range since it was allocated before being refactred into the client module from core */
27      public static final int REMOTE_DISPATCHER_EVENT_ACTION_START_RANGE = 600;
28  
29      public static final int ACTION_RECEIVE = REMOTE_DISPATCHER_EVENT_ACTION_START_RANGE + 1;
30      public static final int ACTION_DISPATCH = REMOTE_DISPATCHER_EVENT_ACTION_START_RANGE + 2;
31      public static final int ACTION_SEND = REMOTE_DISPATCHER_EVENT_ACTION_START_RANGE + 3;
32      public static final int ACTION_INVOKE = REMOTE_DISPATCHER_EVENT_ACTION_START_RANGE + 4;
33      public static final int ACTION_WIRE_FORMAT = REMOTE_DISPATCHER_EVENT_ACTION_START_RANGE + 5;
34  
35      static {
36          registerAction("receive event", ACTION_RECEIVE);
37          registerAction("dispatch event", ACTION_DISPATCH);
38          registerAction("send event", ACTION_SEND);
39          registerAction("invoke component", ACTION_INVOKE);
40          registerAction("request wire format", ACTION_WIRE_FORMAT);
41      }
42  
43      private Map properties = new HashMap();
44      private MuleMessage message;
45  
46      public RemoteDispatcherNotification(MuleMessage message, int action)
47      {
48          super(cloneMessage(message), action);
49      }
50  
51      public RemoteDispatcherNotification(MuleMessage message, int action, String resourceIdentifier)
52      {
53          super(cloneMessage(message), action, resourceIdentifier);
54          this.message = message;
55      }
56  
57      public MuleMessage getMessage()
58      {
59          return message;
60      }
61  
62      public void setProperty(Object key, Object value)
63      {
64          properties.put(key, value);
65      }
66  
67      public Object getProperty(Object key)
68      {
69          return properties.get(key);
70      }
71  
72      public Map getProperties()
73      {
74          return properties;
75      }
76  }