~ubuntu-branches/ubuntu/trusty/ehcache/trusty

« back to all changes in this revision

Viewing changes to src/main/java/net/sf/ehcache/distribution/RmiEventMessage.java

  • Committer: Package Import Robot
  • Author(s): Emmanuel Bourg
  • Date: 2013-05-06 14:53:07 UTC
  • mfrom: (1.1.7) (2.1.8 sid)
  • Revision ID: package-import@ubuntu.com-20130506145307-v5bhw5yu70re00l3
Tags: 2.6.7-1
* Team upload.
* New upstream release

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/**
 
2
 *  Copyright Terracotta, Inc.
 
3
 *
 
4
 *  Licensed under the Apache License, Version 2.0 (the "License");
 
5
 *  you may not use this file except in compliance with the License.
 
6
 *  You may obtain a copy of the License at
 
7
 *
 
8
 *      http://www.apache.org/licenses/LICENSE-2.0
 
9
 *
 
10
 *  Unless required by applicable law or agreed to in writing, software
 
11
 *  distributed under the License is distributed on an "AS IS" BASIS,
 
12
 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 
13
 *  See the License for the specific language governing permissions and
 
14
 *  limitations under the License.
 
15
 */
 
16
 
 
17
package net.sf.ehcache.distribution;
 
18
 
 
19
import java.io.Serializable;
 
20
import net.sf.ehcache.Ehcache;
 
21
import net.sf.ehcache.Element;
 
22
 
 
23
/**
 
24
 *
 
25
 * @author cdennis
 
26
 */
 
27
public final class RmiEventMessage extends EventMessage {
 
28
 
 
29
    /**
 
30
     * Enumeration of event types.
 
31
     */
 
32
    public enum RmiEventType {
 
33
 
 
34
        /**
 
35
         * A put or update event.
 
36
         */
 
37
        PUT,
 
38
        
 
39
        /**
 
40
         * A remove or invalidate event.
 
41
         */
 
42
        REMOVE,
 
43
        
 
44
        /**
 
45
         * A removeAll, which removes all elements from a cache
 
46
         */
 
47
        REMOVE_ALL;
 
48
    }
 
49
 
 
50
    /**
 
51
     * The event component.
 
52
     */
 
53
    private final RmiEventType type;
 
54
 
 
55
    /**
 
56
     * The element component.
 
57
     */
 
58
    private final Element element;
 
59
 
 
60
    /**
 
61
     * Full constructor.
 
62
     *
 
63
     * @param cache
 
64
     * @param type
 
65
     * @param key
 
66
     * @param element
 
67
     */
 
68
    public RmiEventMessage(Ehcache cache, RmiEventType type, Serializable key, Element element) {
 
69
        super(cache, key);
 
70
        this.type = type;
 
71
        this.element = element;
 
72
    }
 
73
    
 
74
    /**
 
75
     * Gets the event.
 
76
     *
 
77
     * @return either {@link #PUT} or {@link #REMOVE}
 
78
     */
 
79
    public final RmiEventType getType() {
 
80
        return type;
 
81
    }
 
82
 
 
83
    /**
 
84
     * @return the element component of the message. null if a {@link #REMOVE} event
 
85
     */
 
86
    public final Element getElement() {
 
87
        return element;
 
88
    }
 
89
}