1 4 package com.tc.object.msg; 5 6 import com.tc.async.api.EventContext; 7 import com.tc.bytes.TCByteBuffer; 8 import com.tc.io.TCByteBufferOutput; 9 import com.tc.net.protocol.tcm.MessageChannel; 10 import com.tc.net.protocol.tcm.MessageMonitor; 11 import com.tc.net.protocol.tcm.TCMessageHeader; 12 import com.tc.net.protocol.tcm.TCMessageType; 13 import com.tc.object.ObjectID; 14 import com.tc.object.session.SessionID; 15 16 import java.io.IOException ; 17 18 21 public class RequestRootResponseMessage extends DSOMessageBase implements EventContext { 22 private final static byte ROOT_NAME = 1; 23 private final static byte ROOT_ID = 2; 24 25 private String rootName; 26 private ObjectID rootID; 27 28 public RequestRootResponseMessage(MessageMonitor monitor, TCByteBufferOutput out, MessageChannel channel, TCMessageType type) { 29 super(monitor, out, channel, type); 30 } 31 32 public RequestRootResponseMessage(SessionID sessionID, MessageMonitor monitor, MessageChannel channel, TCMessageHeader header, TCByteBuffer[] data) { 33 super(sessionID, monitor, channel, header, data); 34 } 35 36 protected void dehydrateValues() { 37 putNVPair(ROOT_ID, rootID.toLong()); 38 putNVPair(ROOT_NAME, rootName); 39 } 40 41 protected boolean hydrateValue(byte name) throws IOException { 42 switch (name) { 43 case ROOT_ID: 44 this.rootID = new ObjectID(getLongValue()); 45 return true; 46 case ROOT_NAME: 47 this.rootName = getStringValue(); 48 return true; 49 default: 50 return false; 51 } 52 } 53 54 public String getRootName() { 55 return rootName; 56 } 57 58 public ObjectID getRootID() { 59 return rootID; 60 } 61 62 public void initialize(String name, ObjectID id) { 63 this.rootID = id; 64 this.rootName = name; 65 } 66 } | Popular Tags |