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