|
|||||||||||||||||||
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: 1.1 $ | |
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 | 8 | public ScopeEvent(ScopeEventType eventType, int scope, Date date) { |
40 | 8 | 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 | 24 | public ScopeEvent(ScopeEventType eventType, int scope, Date date, String origin) { |
52 | 24 | super(origin); |
53 | 24 | this.eventType = eventType; |
54 | 24 | this.scope = scope; |
55 | 24 | this.date = date; |
56 | } | |
57 | ||
58 | /** | |
59 | * Retrieve the event date | |
60 | */ | |
61 | 16 | public Date getDate() { |
62 | 16 | return date; |
63 | } | |
64 | ||
65 | /** | |
66 | * Retrieve the type of the event. | |
67 | */ | |
68 | 24 | public ScopeEventType getEventType() { |
69 | 24 | return eventType; |
70 | } | |
71 | ||
72 | /** | |
73 | * Retrieve the scope that applies to the event. | |
74 | */ | |
75 | 20 | public int getScope() { |
76 | 20 | return scope; |
77 | } | |
78 | } |
|