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:
09: /**
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: 254 $
15: * @author <a href="mailto:chris@swebtec.com">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 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 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 group, String 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 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 toString() {
69: return "groupName=" + group;
70: }
71: }
|