01: /*
02: * All content copyright (c) 2003-2006 Terracotta, Inc., except as may otherwise be noted in a separate copyright notice. All rights reserved.
03: */
04: package com.tc.object.msg;
05:
06: import com.tc.bytes.TCByteBuffer;
07: import com.tc.io.TCByteBufferOutput;
08: import com.tc.net.protocol.tcm.MessageChannel;
09: 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;
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(SessionID sessionID,
30: MessageMonitor monitor, TCByteBufferOutput out,
31: MessageChannel channel, TCMessageType type) {
32: super (sessionID, monitor, out, channel, type);
33: }
34:
35: public ObjectIDBatchRequestResponseMessage(SessionID sessionID,
36: MessageMonitor monitor, MessageChannel channel,
37: TCMessageHeader header, TCByteBuffer[] data) {
38: super (sessionID, monitor, channel, header, data);
39: }
40:
41: protected void dehydrateValues() {
42: putNVPair(REQUEST_ID, requestID);
43: putNVPair(BATCH_START, batchStart);
44: putNVPair(BATCH_END, batchEnd);
45: }
46:
47: protected boolean hydrateValue(byte name) throws IOException {
48: switch (name) {
49: case REQUEST_ID:
50: requestID = getLongValue();
51: return true;
52: case BATCH_START:
53: batchStart = getLongValue();
54: return true;
55: case BATCH_END:
56: batchEnd = getLongValue();
57: return true;
58: default:
59: return false;
60: }
61: }
62:
63: public void initialize(long reqID, long start, long end) {
64: this .requestID = reqID;
65: this .batchStart = start;
66: this .batchEnd = end;
67: }
68:
69: public long getBatchStart() {
70: return batchStart;
71: }
72:
73: public long getBatchEnd() {
74: return batchEnd;
75: }
76:
77: public long getRequestID() {
78: return requestID;
79: }
80: }
|