|
|||||||||||||||||||
| Source file | Conditionals | Statements | Methods | TOTAL | |||||||||||||||
| ScopeEvent.java | - | 100% | 100% | 100% |
|
||||||||||||||
| 1 | /* | |
| 2 | * Copyright (c) 2002-2003 by OpenSymphony | |
| 3 | * All rights reserved. | |
| 4 | */ | |
| 5 | package com.opensymphony.oscache.base.events; | |
| 6 | ||
| 7 | import java.util.Date; | |
| 8 | ||
| 9 | /** | |
| 10 | * A <code>ScopeEvent</code> is created when an event occurs across one or all scopes. | |
| 11 | * This type of event is only applicable to the <code>ServletCacheAdministrator</code>. | |
| 12 | * | |
| 13 | * @version $Revision: 254 $ | |
| 14 | * @author <a href="mailto:fbeauregard@pyxis-tech.com">Francois Beauregard</a> | |
| 15 | */ | |
| 16 | public final class ScopeEvent extends CacheEvent { | |
| 17 | /** | |
| 18 | * Date that the event applies to. | |
| 19 | */ | |
| 20 | private Date date = null; | |
| 21 | ||
| 22 | /** | |
| 23 | * Type of the event. | |
| 24 | */ | |
| 25 | private ScopeEventType eventType = null; | |
| 26 | ||
| 27 | /** | |
| 28 | * Scope that applies to this event. | |
| 29 | */ | |
| 30 | private int scope = 0; | |
| 31 | ||
| 32 | /** | |
| 33 | * Constructs a scope event object with no specified origin. | |
| 34 | * | |
| 35 | * @param eventType Type of the event. | |
| 36 | * @param scope Scope that applies to the event. | |
| 37 | * @param date Date that the event applies to. | |
| 38 | */ | |
| 39 | 20 | public ScopeEvent(ScopeEventType eventType, int scope, Date date) { |
| 40 | 20 | this(eventType, scope, date, null); |
| 41 | } | |
| 42 | ||
| 43 | /** | |
| 44 | * Constructs a scope event object. | |
| 45 | * | |
| 46 | * @param eventType Type of the event. | |
| 47 | * @param scope Scope that applies to the event. | |
| 48 | * @param date Date that the event applies to. | |
| 49 | * @param origin The origin of this event. | |
| 50 | */ | |
| 51 | 40 | public ScopeEvent(ScopeEventType eventType, int scope, Date date, String origin) { |
| 52 | 40 | super(origin); |
| 53 | 40 | this.eventType = eventType; |
| 54 | 40 | this.scope = scope; |
| 55 | 40 | this.date = date; |
| 56 | } | |
| 57 | ||
| 58 | /** | |
| 59 | * Retrieve the event date | |
| 60 | */ | |
| 61 | 20 | public Date getDate() { |
| 62 | 20 | return date; |
| 63 | } | |
| 64 | ||
| 65 | /** | |
| 66 | * Retrieve the type of the event. | |
| 67 | */ | |
| 68 | 30 | public ScopeEventType getEventType() { |
| 69 | 30 | return eventType; |
| 70 | } | |
| 71 | ||
| 72 | /** | |
| 73 | * Retrieve the scope that applies to the event. | |
| 74 | */ | |
| 75 | 35 | public int getScope() { |
| 76 | 35 | return scope; |
| 77 | } | |
| 78 | } |
|
||||||||||