KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > opensymphony > oscache > base > events > CacheEntryEvent


1 /*
2  * Copyright (c) 2002-2003 by OpenSymphony
3  * All rights reserved.
4  */

5 package com.opensymphony.oscache.base.events;
6
7 import com.opensymphony.oscache.base.Cache;
8 import com.opensymphony.oscache.base.CacheEntry;
9
10 /**
11  * CacheEntryEvent is the object created when an event occurs on a
12  * cache entry (Add, update, remove, flush). It contains the entry itself and
13  * its map.
14  *
15  * @version $Revision: 1.1 $
16  * @author <a HREF="mailto:fbeauregard@pyxis-tech.com">Francois Beauregard</a>
17  */

18 public final class CacheEntryEvent extends CacheEvent {
19     /**
20      * The cache where the entry resides.
21      */

22     private Cache map = null;
23
24     /**
25      * The entry that the event applies to.
26      */

27     private CacheEntry entry = null;
28
29     /**
30      * Constructs a cache entry event object with no specified origin
31      *
32      * @param map The cache map of the cache entry
33      * @param entry The cache entry that the event applies to
34      */

35     public CacheEntryEvent(Cache map, CacheEntry entry) {
36         this(map, entry, null);
37     }
38
39     /**
40      * Constructs a cache entry event object
41      *
42      * @param map The cache map of the cache entry
43      * @param entry The cache entry that the event applies to
44      * @param origin The origin of this event
45      */

46     public CacheEntryEvent(Cache map, CacheEntry entry, String JavaDoc origin) {
47         super(origin);
48         this.map = map;
49         this.entry = entry;
50     }
51
52     /**
53      * Retrieve the cache entry that the event applies to.
54      */

55     public CacheEntry getEntry() {
56         return entry;
57     }
58
59     /**
60      * Retrieve the cache entry key
61      */

62     public String JavaDoc getKey() {
63         return entry.getKey();
64     }
65
66     /**
67      * Retrieve the cache map where the entry resides.
68      */

69     public Cache getMap() {
70         return map;
71     }
72
73     public String JavaDoc toString() {
74         return "key=" + entry.getKey();
75     }
76 }
77
Popular Tags