de.root1.simon.codec.messages
Class AbstractMessage

java.lang.Object
  extended by de.root1.simon.codec.messages.AbstractMessage
All Implemented Interfaces:
java.io.Serializable
Direct Known Subclasses:
MsgCloseRawChannel, MsgCloseRawChannelReturn, MsgEquals, MsgEqualsReturn, MsgError, MsgHashCode, MsgHashCodeReturn, MsgInterfaceLookup, MsgInterfaceLookupReturn, MsgInvoke, MsgInvokeReturn, MsgNameLookup, MsgNameLookupReturn, MsgOpenRawChannel, MsgOpenRawChannelReturn, MsgPing, MsgPong, MsgRawChannelData, MsgRawChannelDataReturn, MsgToString, MsgToStringReturn

public abstract class AbstractMessage
extends java.lang.Object
implements java.io.Serializable

A base message for SIMON protocol messages. Error messages are not being sent via the errorMsg field: In case of a problems reading a message, the responsible decoder class will inject the error message, so that the ProcessMessageRunnable can react on that error accordingly.

Author:
ACHR
See Also:
Serialized Form

Constructor Summary
protected AbstractMessage(byte msgType)
          Creates a new message decoder
 
Method Summary
 java.lang.String getErrorMsg()
          Returns the error message.
 byte getMsgType()
          Returns the message type as described by SimonMessageConstants
 int getSequence()
          Returns, guess what, the sequence id of the message
 boolean hasError()
          Returns whether this message has an error or not
 void setErrorMsg(java.lang.String errorMsg)
          Sets the error message related to this message
 void setSequence(int sequence)
          Stores the sequence id in the message
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractMessage

protected AbstractMessage(byte msgType)
Creates a new message decoder

Parameters:
msgType - specifies a unique ID for the type of message
Method Detail

getErrorMsg

public java.lang.String getErrorMsg()
Returns the error message. Contains Statics.NO_ERROR if no error is present.

Returns:
the errorMsg

setErrorMsg

public void setErrorMsg(java.lang.String errorMsg)
Sets the error message related to this message

Parameters:
errorMsg - the errorMsg to set

hasError

public boolean hasError()
Returns whether this message has an error or not

Returns:
true, if error is present, false if not

getMsgType

public byte getMsgType()
Returns the message type as described by SimonMessageConstants

Returns:
the msgType

getSequence

public int getSequence()
Returns, guess what, the sequence id of the message

Returns:
the sequence

setSequence

public void setSequence(int sequence)
Stores the sequence id in the message

Parameters:
sequence - the sequence to set


Copyright © 2011. All Rights Reserved.