1 10 11 package org.mule.impl.space; 12 13 import org.mule.umo.manager.UMOServerNotification; 14 import org.mule.umo.space.UMOSpace; 15 16 19 public class SpaceMonitorNotification extends UMOServerNotification 20 { 21 24 private static final long serialVersionUID = -8723048757928555644L; 25 26 public static final int SPACE_CREATED = SPACE_EVENT_ACTION_START_RANGE + 1; 27 public static final int SPACE_ITEM_ADDED = SPACE_EVENT_ACTION_START_RANGE + 2; 28 public static final int SPACE_ITEM_REMOVED = SPACE_EVENT_ACTION_START_RANGE + 3; 29 public static final int SPACE_ITEM_EXPIRED = SPACE_EVENT_ACTION_START_RANGE + 4; 30 public static final int SPACE_ITEM_MISS = SPACE_EVENT_ACTION_START_RANGE + 5; 31 public static final int SPACE_DISPOSED = SPACE_EVENT_ACTION_START_RANGE + 6; 32 public static final int SPACE_LISTENER_ADDED = SPACE_EVENT_ACTION_START_RANGE + 7; 33 public static final int SPACE_LISTENER_REMOVED = SPACE_EVENT_ACTION_START_RANGE + 8; 34 35 private static final String [] ACTIONS = new String []{"created", "item added", "item removed", 36 "item expired", "item miss", "disposed", "listener added", "listener removed"}; 37 38 private final Object item; 39 40 public SpaceMonitorNotification(UMOSpace space, int action, Object item) 41 { 42 super(space, action); 43 resourceIdentifier = space.getName(); 44 this.item = item; 45 } 46 47 public Object getItem() 48 { 49 return item; 50 } 51 52 protected String getPayloadToString() 53 { 54 return ((UMOSpace)source).getName(); 55 } 56 57 protected String getActionName(int action) 58 { 59 int i = action - SPACE_EVENT_ACTION_START_RANGE; 60 if (i - 1 > ACTIONS.length) 61 { 62 return String.valueOf(action); 63 } 64 return ACTIONS[i - 1]; 65 } 66 67 } 68 | Popular Tags |