|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectuk.ac.rdg.resc.jstyx.messages.StyxMessage
public abstract class StyxMessage
Abstract superclass for all Styx messages.
| Field Summary | |
|---|---|
protected org.apache.mina.common.ByteBuffer |
buf
|
protected int |
length
|
protected static java.lang.String |
lock
|
protected java.lang.String |
name
|
protected int |
tag
|
protected short |
type
|
| Constructor Summary | |
|---|---|
protected |
StyxMessage(int length,
short type,
int tag)
Creates a new instance of StyxMessage. |
| Method Summary | |
|---|---|
static StyxMessage |
createStyxMessage(int length,
short type,
int tag)
Static factory method for creating a StyxMessage. |
protected abstract void |
decodeBody(StyxBuffer styxBuf)
Called when a complete message has arrived; signals that we are ready to interpret the raw bytes in the buffer and turn them into meaningful information. |
void |
dispose()
This is called after the message has been sent (in StyxServerProtocolHandler.messageSent()) and is a signal to free any resources associated with the message (e.g. |
void |
encode()
Called by StyxMessageEncoder when we are about to send a message. |
protected abstract void |
encodeBody(StyxBuffer styxBuf)
Encode the body of the message into bytes in the underlying buffer |
org.apache.mina.common.ByteBuffer |
getBuffer()
|
protected abstract java.lang.String |
getElements()
|
long |
getFid()
|
int |
getLength()
|
java.lang.String |
getName()
|
int |
getTag()
|
short |
getType()
|
boolean |
readBytesFrom(org.apache.mina.common.ByteBuffer in)
Read bytes from the given ByteBuffer into this Message. |
void |
setTag(int newTag)
Sets the tag of the message |
java.lang.String |
toFriendlyString()
|
java.lang.String |
toString()
|
void |
write(org.apache.mina.protocol.ProtocolEncoderOutput out)
Called by StyxMessageEncoder to send a message to the output |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
protected static final java.lang.String lock
protected int length
protected short type
protected int tag
protected java.lang.String name
protected org.apache.mina.common.ByteBuffer buf
| Constructor Detail |
|---|
protected StyxMessage(int length,
short type,
int tag)
| Method Detail |
|---|
public final java.lang.String getName()
public final int getLength()
public final short getType()
public final int getTag()
public final void setTag(int newTag)
public final org.apache.mina.common.ByteBuffer getBuffer()
public long getFid()
public final boolean readBytesFrom(org.apache.mina.common.ByteBuffer in)
throws org.apache.mina.protocol.ProtocolViolationException
in - The org.apache.mina.common.ByteBuffer that contains the data.
org.apache.mina.protocol.ProtocolViolationException - if the bytes do not represent a valid
StyxMessage
protected abstract void decodeBody(StyxBuffer styxBuf)
throws org.apache.mina.protocol.ProtocolViolationException
org.apache.mina.protocol.ProtocolViolationException - if the buffer doesn't contain a valid
StyxMessage body
public void write(org.apache.mina.protocol.ProtocolEncoderOutput out)
throws org.apache.mina.protocol.ProtocolViolationException
org.apache.mina.protocol.ProtocolViolationException
public void encode()
throws org.apache.mina.protocol.ProtocolViolationException
org.apache.mina.protocol.ProtocolViolationException - if a problem occurred encoding the
message (shouldn't happen)
protected abstract void encodeBody(StyxBuffer styxBuf)
throws org.apache.mina.protocol.ProtocolViolationException
org.apache.mina.protocol.ProtocolViolationExceptionpublic java.lang.String toString()
toString in class java.lang.Objectprotected abstract java.lang.String getElements()
public java.lang.String toFriendlyString()
public void dispose()
public static StyxMessage createStyxMessage(int length,
short type,
int tag)
throws org.apache.mina.protocol.ProtocolViolationException
length - The total length of the message (header and body)type - The numeric code representing the message typetag - The message tag
org.apache.mina.protocol.ProtocolViolationException - if the message is of an unknown type
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||