All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class iBus.MessageEvent

java.lang.Object
   |
   +----iBus.Event
           |
           +----iBus.MessageEvent

public class MessageEvent
extends Event
A Message represents a low level iBus network message. Typically, a iBus posting is marshaled into a byte array and fragmented. The fragments are then packed into ``Message'' objects and passed down the stack. On the reveiver's site, the bottommost protocol object listents for iBus network messages. When a message is received, a ``Message'' object is created for it and passed up the stack.


Variable Index

 o tPullReply
Pull reply message type
 o tPullRequest
Pull request message type
 o tPush
Push message type

Constructor Index

 o MessageEvent()
Create an empty message object.
 o MessageEvent(iBusURL, Stack)
Create a message object for the given channel and data.
 o MessageEvent(MessageEvent)
Create a message by copying the header information from another message.
 o MessageEvent(Stack)
Create an empty message object.

Method Index

 o getEvent()
Return the event encapsulated in this message
 o getHeaderSize()
Return the size of the message header
 o getMsgType()
Get the message type.
 o getSeqNum()
Return the sequence number of the message
 o id()
Returns the identifier of this type of event.
 o inData()
Returns the byte array holding the incoming data.
 o inSize()
Return the size of the input data in this message
 o inStream()
Returns the message input data stream
 o outData()
Returns the byte array holding the outgoing data.
 o outSize()
Return the size of the output data in this message
 o outStream()
Returns the message output data stream.
 o pack()
Write the message into the message's output data stream.
 o setEvent(Event)
set the event that is to be packed into the message.
 o setMsgType(int)
Set the message type to push, pull request, or pull reply:
 o setSeqNum(long)
Set the sequence number of the message.
 o unpack(byte[], int)
Read the message from a byte array.

Variables

 o tPush
 public static final int tPush
Push message type

 o tPullRequest
 public static final int tPullRequest
Pull request message type

 o tPullReply
 public static final int tPullReply
Pull reply message type

Constructors

 o MessageEvent
 public MessageEvent(Stack stack)
Create an empty message object. This constructor is typically used by the bottommost object to create a message that is passed up the stack.

Parameters:
stack - the protocol stack that creates the message
 o MessageEvent
 public MessageEvent()
Create an empty message object. This constructor is used outside the scope of a stack.

 o MessageEvent
 public MessageEvent(iBusURL channel,
                     Stack stack)
Create a message object for the given channel and data. This constructor is typically used by the API object to create a message that is passed down the stack.

Parameters:
channel - the channel the message is sent to
stack - the protocol stack that creates the message
 o MessageEvent
 public MessageEvent(MessageEvent msg)
Create a message by copying the header information from another message. This constructor is typically used by protocol objects such as FRAG that need to duplicate message header information.

Parameters:
msg - the MessageEvent object to copy header information from:

Methods

 o id
 public int id()
Returns the identifier of this type of event.

Returns:
the identifier of this type of event
Overrides:
id in class Event
 o outStream
 public ObjectOutputStream outStream()
Returns the message output data stream. outStream increments an internal counter that is used to keep track of which chunk in the message data was written by a particular object. Hence, a protocol object may call outStream at most once.

Returns:
the message output data stream
 o outData
 public byte[] outData()
Returns the byte array holding the outgoing data.

Returns:
the byte array holding the outgoing data
 o outSize
 public int outSize()
Return the size of the output data in this message

Returns:
the size of the output data in this message
 o getHeaderSize
 public int getHeaderSize()
Return the size of the message header

Returns:
the size of the message header
 o inStream
 public ObjectInputStream inStream()
Returns the message input data stream

Returns:
the message input data stream
 o inData
 public byte[] inData()
Returns the byte array holding the incoming data.

Returns:
the byte array holding the incoming data
 o inSize
 public int inSize()
Return the size of the input data in this message

Returns:
the size of the input data in this message
 o getSeqNum
 public long getSeqNum()
Return the sequence number of the message

Returns:
the sequence number of the message
 o setSeqNum
 public void setSeqNum(long s)
Set the sequence number of the message.

Parameters:
s - the sequence number
 o setMsgType
 public void setMsgType(int mt)
Set the message type to push, pull request, or pull reply:

Parameters:
mt - one of tPush, tPullRequest, tPullReply
 o getMsgType
 public int getMsgType()
Get the message type.

Returns:
the message type (one of tPush, tPullRequest, tPullReply);
 o getEvent
 public Event getEvent()
Return the event encapsulated in this message

Returns:
the the event encapsulated in this message
 o setEvent
 public void setEvent(Event event)
set the event that is to be packed into the message.

Parameters:
event - that is to be packed into the message
 o pack
 public synchronized void pack() throws IOException
Write the message into the message's output data stream.

Throws: IOException
on IO errors
 o unpack
 public synchronized void unpack(byte inData[],
                                 int len) throws IOException, ClassNotFoundException
Read the message from a byte array.

Parameters:
inData - the byte array holding the marshaled message data. MessageEvent assumes ownership of that memory area.
len - the length of inData
Throws: IOException
on IO errors
Throws: ClassNotFoundException
if an unknown class is deserialized

All Packages  Class Hierarchy  This Package  Previous  Next  Index