com.sleepycat.je.rep.impl
Class TextProtocol.Message

java.lang.Object
  extended by com.sleepycat.je.rep.impl.TextProtocol.Message
All Implemented Interfaces:
TextProtocol.WireFormatable
Direct Known Subclasses:
TextProtocol.RequestMessage, TextProtocol.ResponseMessage
Enclosing class:
TextProtocol

public abstract class TextProtocol.Message
extends Object
implements TextProtocol.WireFormatable

Base message class for all messages exchanged in the protocol.


Constructor Summary
protected TextProtocol.Message()
          The constructor used for the original non-serialized instance of the message, which does not use the line or tokens.
protected TextProtocol.Message(String line, String[] tokens)
          Every message must define a constructor of this form so that it can be de-serialized.
 
Method Summary
protected  int getCurrentTokenPosition()
          Returns the current token position in the payload.
protected  String getMessagePrefix()
           
abstract  TextProtocol.MessageOp getOp()
           
 TextProtocol getProtocol()
          Returns the protocol associated with this message
 int getSenderId()
           
protected  String nextPayloadToken()
          Returns the next token in the payload.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.sleepycat.je.rep.impl.TextProtocol.WireFormatable
wireFormat
 

Constructor Detail

TextProtocol.Message

protected TextProtocol.Message()
The constructor used for the original non-serialized instance of the message, which does not use the line or tokens.


TextProtocol.Message

protected TextProtocol.Message(String line,
                               String[] tokens)
                        throws TextProtocol.InvalidMessageException
Every message must define a constructor of this form so that it can be de-serialized. The constructor is invoked using reflection by the parse() method.

Parameters:
line - the line constituting the message
tokens - the line in token form
Throws:
TextProtocol.InvalidMessageException
EnvironmentFailureException - on format errors
Method Detail

getSenderId

public int getSenderId()

getMessagePrefix

protected String getMessagePrefix()

getOp

public abstract TextProtocol.MessageOp getOp()

getProtocol

public TextProtocol getProtocol()
Returns the protocol associated with this message


nextPayloadToken

protected String nextPayloadToken()
                           throws TextProtocol.InvalidMessageException
Returns the next token in the payload.

Returns:
the next payload token
Throws:
TextProtocol.InvalidMessageException

getCurrentTokenPosition

protected int getCurrentTokenPosition()
Returns the current token position in the payload.

Returns:
the current token position


Copyright (c) 2004-2010 Oracle. All rights reserved.