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: import java.util.Date;
10:
11: /**
12: * A <code>CachewideEvent<code> represents and event that occurs on
13: * the the entire cache, eg a cache flush or clear.
14: *
15: * @version $Revision: 254 $
16: * @author <a href="mailto:chris@swebtec.com">Chris Miller</a>
17: */
18: public final class CachewideEvent extends CacheEvent {
19: /**
20: * The cache where the event occurred.
21: */
22: private Cache cache = null;
23:
24: /**
25: * The date/time for when the flush is scheduled
26: */
27: private Date date = null;
28:
29: /**
30: * Constructs a cachewide event with the specified origin.
31: *
32: * @param cache The cache map that the event occurred on.
33: * @param date The date/time that this cachewide event is scheduled for
34: * (eg, the date that the cache is to be flushed).
35: * @param origin An optional tag that can be attached to the event to
36: * specify the event's origin. This is useful to prevent events from being
37: * fired recursively in some situations, such as when an event handler
38: * causes another event to be fired.
39: */
40: public CachewideEvent(Cache cache, Date date, String origin) {
41: super (origin);
42: this .date = date;
43: this .cache = cache;
44: }
45:
46: /**
47: * Retrieve the cache map that the event occurred on.
48: */
49: public Cache getCache() {
50: return cache;
51: }
52:
53: /**
54: * Retrieve the date/time that the cache flush is scheduled for.
55: */
56: public Date getDate() {
57: return date;
58: }
59: }
|