01: /*
02: * Copyright (c) 2002-2003 by OpenSymphony
03: * All rights reserved.
04: */
05: package com.opensymphony.oscache.base.events;
06:
07: import com.opensymphony.oscache.base.Cache;
08: import com.opensymphony.oscache.base.CacheEntry;
09:
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: 254 $
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 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 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 toString() {
74: return "key=" + entry.getKey();
75: }
76: }
|