View Javadoc

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