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.CacheEntry;
08:
09: /**
10: * Cache map access event. This is the object created when an event occurs on a
11: * cache map (cache Hit, cache miss). It contains the entry that was referenced
12: * by the event and the event type.
13: *
14: * @version $Revision: 254 $
15: * @author <a href="mailto:fbeauregard@pyxis-tech.com">Francois Beauregard</a>
16: */
17: public final class CacheMapAccessEvent extends CacheEvent {
18: /**
19: * The cache entry that the event applies to.
20: */
21: private CacheEntry entry = null;
22:
23: /**
24: * Type of the event.
25: */
26: private CacheMapAccessEventType eventType = null;
27:
28: /**
29: * Constructor.
30: * <p>
31: * @param eventType Type of the event.
32: * @param entry The cache entry that the event applies to.
33: */
34: public CacheMapAccessEvent(CacheMapAccessEventType eventType,
35: CacheEntry entry) {
36: this (eventType, entry, null);
37: }
38:
39: /**
40: * Constructor.
41: * <p>
42: * @param eventType Type of the event.
43: * @param entry The cache entry that the event applies to.
44: * @param origin The origin of the event
45: */
46: public CacheMapAccessEvent(CacheMapAccessEventType eventType,
47: CacheEntry entry, String origin) {
48: super (origin);
49: this .eventType = eventType;
50: this .entry = entry;
51: }
52:
53: /**
54: * Retrieve the cache entry that the event applies to.
55: */
56: public CacheEntry getCacheEntry() {
57: return entry;
58: }
59:
60: /**
61: * Retrieve the cache entry key that the event applies to.
62: */
63: public String getCacheEntryKey() {
64: return entry.getKey();
65: }
66:
67: /**
68: * Retrieve the type of the event.
69: */
70: public CacheMapAccessEventType getEventType() {
71: return eventType;
72: }
73: }
|