01: package org.objectweb.celtix;
02:
03: import java.util.*;
04:
05: /**
06: * Caches all bus events that do not have a listener associated with them.
07: * The bus events will be stored until the cache limit is reached.
08: * After reaching the cache size, events will be discarded using first in,
09: * first out semantics.
10: */
11: public interface BusEventCache {
12: /**
13: * Add the <code>BusEvent</code> to the cache.
14: * If the maximum size of the cache is reached, the first <code>BusEvent</code>
15: * added will be removed from the cache(FIFO)
16: * @param e The <code>BusEvent</code> to be added to the cache.
17: */
18: void addEvent(BusEvent e);
19:
20: /**
21: * Flushes the cache of all the <code>BusEvent</code>.
22: * @return List Containing all the <code>BusEvent</code>s cached.
23: */
24: List<BusEvent> flushEvents();
25:
26: /**
27: * Flushes the <code>BusEvent</code> from the cache matching the event id.
28: * @param eventID The unique event id that identifies the <code>BusEvent</code>.
29: * @return List Containing all <code>BusEvent</code>s matching the event id.
30: */
31: List<BusEvent> flushEvents(String eventID);
32:
33: /**
34: * Flushes the <code>BusEvent</code> from the cache matching the event class.
35: * @param eventClass The class of the event that identifies the <code>BusEvent</code>.
36: * @return List Containing all <code>BusEvent</code>s matching the event class.
37: */
38: List<BusEvent> flushEvents(Class<?> eventClass);
39:
40: /**
41: * Returns all the bus events. This method doesn't remove the
42: * events from the cache.
43: * @return List Containing all bus events stored in the cache.
44: */
45: List<BusEvent> getEvents();
46:
47: /**
48: * Returns all the bus events matching the event id. This method doesn't
49: * remove the events from the cache.
50: * @param eventID Unique bus event id that identifies the <code>BusEvent</code>.
51: * @return List Containing all of <code>BusEvent</code>s matching the event id.
52: */
53: List<BusEvent> getEvents(String eventID);
54:
55: /**
56: * Sets the cache size. This method can be used to dynamically change the
57: * cache size from the configured size.
58: * @param size Indicates the new size of the cache.
59: */
60: void setCacheSize(int size);
61: }
|