1 package org.apache.jcs.auxiliary.disk;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 import java.io.Serializable;
23
24 import org.apache.jcs.engine.behavior.ICacheElement;
25 import org.apache.jcs.engine.behavior.IElementAttributes;
26
27 /***
28 * Wrapper for cache elements in purgatory.
29 * <p>
30 * Elements are stored in purgatory when they are spooled to the auxilliary cache, but have not yet
31 * been written to disk.
32 */
33 public class PurgatoryElement
34 implements ICacheElement, Serializable
35 {
36 /*** Don't change */
37 private static final long serialVersionUID = -8152034342684135628L;
38
39 /*** Is the element ready to be spooled? */
40 protected boolean spoolable = false;
41
42 /*** Wrapped cache Element */
43 protected ICacheElement cacheElement;
44
45 /***
46 * Constructor for the PurgatoryElement object
47 * <p>
48 * @param cacheElement CacheElement to wrap.
49 */
50 public PurgatoryElement( ICacheElement cacheElement )
51 {
52 this.cacheElement = cacheElement;
53 }
54
55 /***
56 * Gets the spoolable property.
57 * <p>
58 * @return The spoolable value
59 */
60 public boolean isSpoolable()
61 {
62 return spoolable;
63 }
64
65 /***
66 * Sets the spoolable property.
67 * <p>
68 * @param spoolable The new spoolable value
69 */
70 public void setSpoolable( boolean spoolable )
71 {
72 this.spoolable = spoolable;
73 }
74
75 /***
76 * Get the wrapped cache element.
77 * <p>
78 * @return ICacheElement
79 */
80 public ICacheElement getCacheElement()
81 {
82 return cacheElement;
83 }
84
85
86
87 /***
88 * @return cacheElement.getCacheName();
89 * @see ICacheElement#getCacheName
90 */
91 public String getCacheName()
92 {
93 return cacheElement.getCacheName();
94 }
95
96 /***
97 * @return cacheElement.getKey();
98 * @see ICacheElement#getKey
99 */
100 public Serializable getKey()
101 {
102 return cacheElement.getKey();
103 }
104
105 /***
106 * @return cacheElement.getVal();
107 * @see ICacheElement#getVal
108 */
109 public Serializable getVal()
110 {
111 return cacheElement.getVal();
112 }
113
114 /***
115 * @return cacheElement.getElementAttributes();
116 * @see ICacheElement#getElementAttributes
117 */
118 public IElementAttributes getElementAttributes()
119 {
120 return cacheElement.getElementAttributes();
121 }
122
123 /***
124 * @param attr
125 * @see ICacheElement#setElementAttributes
126 */
127 public void setElementAttributes( IElementAttributes attr )
128 {
129 cacheElement.setElementAttributes( attr );
130 }
131 }