1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29 package uk.ac.rdg.resc.jstyx.messages;
30
31 import uk.ac.rdg.resc.jstyx.StyxUtils;
32
33 /***
34 * Message sent to enquire about the attributes of a file on a Styx server
35 *
36 * @author Jon Blower
37 * $Revision: 507 $
38 * $Date: 2005-12-01 08:21:56 +0000 (Thu, 01 Dec 2005) $
39 * $Log$
40 * Revision 1.5 2005/12/01 08:21:56 jonblower
41 * Fixed javadoc comments
42 *
43 * Revision 1.4 2005/03/15 09:01:48 jonblower
44 * Message type now stored as short, not int
45 *
46 * Revision 1.3 2005/03/11 14:02:16 jonblower
47 * Merged MINA-Test_20059309 into main line of development
48 *
49 * Revision 1.2.2.1 2005/03/10 11:50:59 jonblower
50 * Changed to fit with MINA framework
51 *
52 * Revision 1.2 2005/02/24 07:44:44 jonblower
53 * Added getFriendlyString()
54 *
55 * Revision 1.1.1.1 2005/02/16 18:58:29 jonblower
56 * Initial import
57 *
58 */
59 public class TstatMessage extends StyxMessage
60 {
61
62 private long fid;
63
64 /***
65 * Creates a new TstatMessage. This constructor will be called by the
66 * MessageRecognizer.
67 * @param length The total length of the message (including all header info)
68 * @param type The type of the message (a number between 100 and 127)
69 * @param tag The tag that identifies this message
70 */
71 public TstatMessage(int length, short type, int tag)
72 {
73 super(length, type, tag);
74 this.name = "Tstat";
75 }
76
77 /***
78 * This constructor should be called when constructing a TstatMessage from
79 * scratch
80 */
81 public TstatMessage(long fid)
82 {
83 this(0, (short)124, 0);
84 this.fid = fid;
85 this.length = StyxUtils.HEADER_LENGTH + 4;
86 }
87
88 protected final void decodeBody(StyxBuffer buf)
89 {
90
91 this.fid = buf.getUInt();
92 }
93
94 protected final void encodeBody(StyxBuffer buf)
95 {
96
97 buf.putUInt(this.fid);
98 }
99
100 /***
101 * @return The requested maximum size of a message that will
102 * be sent on this connection by either party
103 */
104 public long getFid()
105 {
106 return this.fid;
107 }
108
109 /***
110 * Sets the fid for this TstatMessage
111 * @param fid the fid
112 */
113 public void setFid(long fid)
114 {
115 this.fid = fid;
116 }
117
118 protected String getElements()
119 {
120 return ", " + this.fid;
121 }
122
123 public String toFriendlyString()
124 {
125 return "fid: " + this.fid;
126 }
127
128 }