1 package org.apache.jcs.auxiliary.lateral;
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
26 /***
27 * This class wraps command to other laterals. It is essentially a
28 * JCS-TCP-Lateral packet. The headers specify the action the receiver should
29 * take.
30 */
31 public class LateralElementDescriptor
32 implements Serializable
33 {
34 private static final long serialVersionUID = 5268222498076063575L;
35
36 /*** The int for updates */
37 public final static int UPDATE = 1;
38
39 /*** The int for removes */
40 public final static int REMOVE = 2;
41
42 /*** The int instructing us to remove all */
43 public final static int REMOVEALL = 3;
44
45 /*** The int for disposing the cache. */
46 public final static int DISPOSE = 4;
47
48 /*** Command to return an object. */
49 public final static int GET = 5;
50
51 /*** The Cache Element that we are distributing. */
52 public ICacheElement ce;
53
54 /***
55 * The id of the the source of the request. This is used to prevent infinite
56 * loops.
57 */
58 public long requesterId;
59
60 /*** The operation has been requested by the client. */
61 public int command = UPDATE;
62
63 /***
64 * The hashcode value for this element.
65 */
66 public int valHashCode = -1;
67
68 /*** Constructor for the LateralElementDescriptor object */
69 public LateralElementDescriptor()
70 {
71 super();
72 }
73
74 /***
75 * Constructor for the LateralElementDescriptor object
76 * <p>
77 * @param ce ICacheElement payload
78 */
79 public LateralElementDescriptor( ICacheElement ce )
80 {
81 this.ce = ce;
82 }
83
84 /***
85 * @return String, all the important values that can be configured
86 */
87 public String toString()
88 {
89 StringBuffer buf = new StringBuffer();
90 buf.append( "\n LateralElementDescriptor " );
91 buf.append( "\n command = [" + this.command + "]" );
92 buf.append( "\n valHashCode = [" + this.valHashCode + "]" );
93 buf.append( "\n ICacheElement = [" + this.ce + "]" );
94 return buf.toString();
95 }
96 }