KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > celtix > BusEventCache


1 package org.objectweb.celtix;
2
3 import java.util.*;
4
5
6 /**
7  * Caches all bus events that do not have a listener associated with them.
8  * The bus events will be stored until the cache limit is reached.
9  * After reaching the cache size, events will be discarded using first in,
10  * first out semantics.
11  */

12 public interface BusEventCache {
13     /**
14      * Add the <code>BusEvent</code> to the cache.
15      * If the maximum size of the cache is reached, the first <code>BusEvent</code>
16      * added will be removed from the cache(FIFO)
17      * @param e The <code>BusEvent</code> to be added to the cache.
18      */

19     void addEvent(BusEvent e);
20
21
22     /**
23      * Flushes the cache of all the <code>BusEvent</code>.
24      * @return List Containing all the <code>BusEvent</code>s cached.
25      */

26     List<BusEvent> flushEvents();
27
28
29     /**
30      * Flushes the <code>BusEvent</code> from the cache matching the event id.
31      * @param eventID The unique event id that identifies the <code>BusEvent</code>.
32      * @return List Containing all <code>BusEvent</code>s matching the event id.
33      */

34     List<BusEvent> flushEvents(String JavaDoc eventID);
35
36
37     /**
38      * Flushes the <code>BusEvent</code> from the cache matching the event class.
39      * @param eventClass The class of the event that identifies the <code>BusEvent</code>.
40      * @return List Containing all <code>BusEvent</code>s matching the event class.
41      */

42     List<BusEvent> flushEvents(Class JavaDoc<?> eventClass);
43
44     /**
45      * Returns all the bus events. This method doesn't remove the
46      * events from the cache.
47      * @return List Containing all bus events stored in the cache.
48      */

49     List<BusEvent> getEvents();
50
51
52     /**
53      * Returns all the bus events matching the event id. This method doesn't
54      * remove the events from the cache.
55      * @param eventID Unique bus event id that identifies the <code>BusEvent</code>.
56      * @return List Containing all of <code>BusEvent</code>s matching the event id.
57      */

58     List<BusEvent> getEvents(String JavaDoc eventID);
59
60
61     /**
62      * Sets the cache size. This method can be used to dynamically change the
63      * cache size from the configured size.
64      * @param size Indicates the new size of the cache.
65      */

66     void setCacheSize(int size);
67 }
68
Popular Tags