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: * A CachePatternEvent is fired when a pattern has been applied to a cache.
11: *
12: * @version $Revision: 254 $
13: * @author <a href="mailto:chris@swebtec.com">Chris Miller</a>
14: */
15: public final class CachePatternEvent extends CacheEvent {
16: /**
17: * The cache the pattern is being applied to.
18: */
19: private Cache map = null;
20:
21: /**
22: * The pattern that is being applied.
23: */
24: private String pattern = null;
25:
26: /**
27: * Constructs a cache pattern event with no origin
28: *
29: * @param map The cache map that the pattern was applied to
30: * @param pattern The pattern that was applied
31: */
32: public CachePatternEvent(Cache map, String pattern) {
33: this (map, pattern, null);
34: }
35:
36: /**
37: * Constructs a cache pattern event
38: *
39: * @param map The cache map that the pattern was applied to
40: * @param pattern The cache pattern that the event applies to.
41: * @param origin An optional tag that can be attached to the event to
42: * specify the event's origin. This is useful to prevent events from being
43: * fired recursively in some situations, such as when an event handler
44: * causes another event to be fired, or for logging purposes.
45: */
46: public CachePatternEvent(Cache map, String pattern, String origin) {
47: super (origin);
48: this .map = map;
49: this .pattern = pattern;
50: }
51:
52: /**
53: * Retrieve the cache map that had the pattern applied.
54: */
55: public Cache getMap() {
56: return map;
57: }
58:
59: /**
60: * Retrieve the pattern that was applied to the cache.
61: */
62: public String getPattern() {
63: return pattern;
64: }
65:
66: public String toString() {
67: return "pattern=" + pattern;
68: }
69: }
|