KickJava   Java API By Example, From Geeks To Geeks.

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


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
9 /**
10  * CacheGroupEvent is an event that occurs at the cache group level
11  * (Add, update, remove, flush). It contains the group name and the
12  * originating cache object.
13  *
14  * @version $Revision: 1.1 $
15  * @author <a HREF="&#109;a&#105;&#108;&#116;&#111;:chris&#64;swebtec.&#99;&#111;&#109;">Chris Miller</a>
16  */

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

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

26     private String JavaDoc group = null;
27
28     /**
29      * Constructs a cache group event with no origin
30      *
31      * @param map The cache map of the cache entry
32      * @param group The cache group that the event applies to.
33      */

34     public CacheGroupEvent(Cache map, String JavaDoc group) {
35         this(map, group, null);
36     }
37
38     /**
39      * Constructs a cache group event
40      *
41      * @param map The cache map of the cache entry
42      * @param group The cache group that the event applies to.
43      * @param origin An optional tag that can be attached to the event to
44      * specify the event's origin. This is useful to prevent events from being
45      * fired recursively in some situations, such as when an event handler
46      * causes another event to be fired.
47      */

48     public CacheGroupEvent(Cache map, String JavaDoc group, String JavaDoc origin) {
49         super(origin);
50         this.map = map;
51         this.group = group;
52     }
53
54     /**
55      * Retrieve the cache group that the event applies to.
56      */

57     public String JavaDoc getGroup() {
58         return group;
59     }
60
61     /**
62      * Retrieve the cache map where the group resides.
63      */

64     public Cache getMap() {
65         return map;
66     }
67
68     public String JavaDoc toString() {
69         return "groupName=" + group;
70     }
71 }
72
Popular Tags