01: /*
02: * Copyright (c) 2002-2003 by OpenSymphony
03: * All rights reserved.
04: */
05: package com.opensymphony.oscache.base.events;
06:
07: /**
08: * The root event class for all cache events. Each subclasses of this class
09: * classifies a particular type of cache event.
10: *
11: * @author <a href="mailto:chris@swebtec.com">Chris Miller</a>
12: * Date: 20-May-2003
13: * Time: 15:25:02
14: */
15: public abstract class CacheEvent {
16: /**
17: * An optional tag that can be attached to the event to specify the event's origin.
18: */
19: protected String origin = null;
20:
21: /**
22: * No-argument constructor so subtypes can easily implement <code>Serializable</code>
23: */
24: public CacheEvent() {
25: }
26:
27: /**
28: * Creates a cache event object that came from the specified origin.
29: *
30: * @param origin A string that indicates where this event was fired from.
31: * This value is optional; <code>null</code> can be passed in if an
32: * origin is not required.
33: */
34: public CacheEvent(String origin) {
35: this .origin = origin;
36: }
37:
38: /**
39: * Retrieves the origin of this event, if one was specified. This is most
40: * useful when an event handler causes another event to fire - by checking
41: * the origin the handler is able to prevent recursive events being
42: * fired.
43: */
44: public String getOrigin() {
45: return origin;
46: }
47: }
|