KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > tc > object > msg > ObjectIDBatchRequestResponseMessage


1 /*
2  * All content copyright (c) 2003-2006 Terracotta, Inc., except as may otherwise be noted in a separate copyright notice. All rights reserved.
3  */

4 package com.tc.object.msg;
5
6 import com.tc.bytes.TCByteBuffer;
7 import com.tc.io.TCByteBufferOutput;
8 import com.tc.net.protocol.tcm.MessageChannel;
9 import com.tc.net.protocol.tcm.MessageMonitor;
10 import com.tc.net.protocol.tcm.TCMessageHeader;
11 import com.tc.net.protocol.tcm.TCMessageType;
12 import com.tc.object.session.SessionID;
13
14 import java.io.IOException JavaDoc;
15
16 /**
17  * @author steve
18  */

19 public class ObjectIDBatchRequestResponseMessage extends DSOMessageBase {
20
21   private final static byte REQUEST_ID = 1;
22   private final static byte BATCH_START = 2;
23   private final static byte BATCH_END = 3;
24
25   private long requestID;
26   private long batchStart;
27   private long batchEnd;
28
29   public ObjectIDBatchRequestResponseMessage(MessageMonitor monitor, TCByteBufferOutput out, MessageChannel channel, TCMessageType type) {
30     super(monitor, out, channel, type);
31   }
32
33   public ObjectIDBatchRequestResponseMessage(SessionID sessionID, MessageMonitor monitor, MessageChannel channel, TCMessageHeader header, TCByteBuffer[] data) {
34     super(sessionID, monitor, channel, header, data);
35   }
36
37   protected void dehydrateValues() {
38     putNVPair(REQUEST_ID, requestID);
39     putNVPair(BATCH_START, batchStart);
40     putNVPair(BATCH_END, batchEnd);
41   }
42
43   protected boolean hydrateValue(byte name) throws IOException JavaDoc {
44     switch (name) {
45       case REQUEST_ID:
46         requestID = getLongValue();
47         return true;
48       case BATCH_START:
49         batchStart = getLongValue();
50         return true;
51       case BATCH_END:
52         batchEnd = getLongValue();
53         return true;
54       default:
55         return false;
56     }
57   }
58
59   public void initialize(long reqID, long start, long end) {
60     this.requestID = reqID;
61     this.batchStart = start;
62     this.batchEnd = end;
63   }
64
65   public long getBatchStart() {
66     return batchStart;
67   }
68
69   public long getBatchEnd() {
70     return batchEnd;
71   }
72
73   public long getRequestID() {
74     return requestID;
75   }
76 }
Popular Tags