KickJava   Java API By Example, From Geeks To Geeks.

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


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  * A CachePatternEvent is fired when a pattern has been applied to a cache.
11  *
12  * @version $Revision: 1.1 $
13  * @author <a HREF="&#109;a&#105;&#108;&#116;&#111;:chris&#64;swebtec.&#99;&#111;&#109;">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 JavaDoc 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 JavaDoc 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 JavaDoc pattern, String JavaDoc 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 JavaDoc getPattern() {
63         return pattern;
64     }
65
66     public String JavaDoc toString() {
67         return "pattern=" + pattern;
68     }
69 }
70
Popular Tags