KickJava   Java API By Example, From Geeks To Geeks.

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


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 import java.util.Date JavaDoc;
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: 1.1 $
16  * @author <a HREF="&#109;a&#105;&#108;&#116;&#111;:chris&#64;swebtec.&#99;&#111;&#109;">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 JavaDoc 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 JavaDoc date, String JavaDoc 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 JavaDoc getDate() {
57         return date;
58     }
59 }
60
Popular Tags