KickJava   Java API By Example, From Geeks To Geeks.

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


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.CacheEntry;
8
9 /**
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: 1.1 $
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, CacheEntry entry) {
35         this(eventType, entry, null);
36     }
37
38     /**
39      * Constructor.
40      * <p>
41      * @param eventType Type of the event.
42      * @param entry The cache entry that the event applies to.
43      * @param origin The origin of the event
44      */

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

54     public CacheEntry getCacheEntry() {
55         return entry;
56     }
57
58     /**
59      * Retrieve the cache entry key that the event applies to.
60      */

61     public String JavaDoc getCacheEntryKey() {
62         return entry.getKey();
63     }
64
65     /**
66      * Retrieve the type of the event.
67      */

68     public CacheMapAccessEventType getEventType() {
69         return eventType;
70     }
71 }
72
Popular Tags