stella
Class MessageBin

java.lang.Object
  extended by java.util.EventObject
      extended by util.rmi.RmiEvent
          extended by stella.MessageEvent
              extended by stella.MessageBin
All Implemented Interfaces:
Serializable

public class MessageBin
extends MessageEvent

A helper class for temporarly collecting all info from a message event into a container. Used for constructing fully-qualified subclasses of the message event class from a string representation. E.g. if a command is sent over its ascii-representation you create a message bin object by reading the wire. The receiving class, which knows which subclass of message to expect (ErrorEvent, CommandEvent, or ReplyEvent), may than create the fully qualified message by passing it to one of the static create... methods in the appropriate subclass.

The command lines read in are stored in a temporarly copy and are retrieved as usually with getLine(). Parsing is not possible. Calling this method accidentally results in a UnsupportedOperationException to be thrown.

See Also:
Serialized Form

Field Summary
private  String[] line
          The command lines read in, unparsed.
 
Fields inherited from class stella.MessageEvent
SEPCHAR
 
Fields inherited from class util.rmi.RmiEvent
localHost, sourceName
 
Fields inherited from class java.util.EventObject
source
 
Constructor Summary
MessageBin(Object src, String type, long time)
          Creates a new message bin object for temporaly reference
 
Method Summary
 String[] getLine()
          Returns the command-line(s) copy read in from the stream.
 boolean isReferAcknowledge()
          Allows classes to judge if this message bin referes to an acknowledge event.
 boolean isReferCommand()
          A helper method that tries to figure out if this message bin is referring to a command event.
 boolean isReferDone()
          Allows classes to judge if this message bin referes to a done event.
 boolean isReferError()
          Allows classes to judge if this message bin referes to an error event.
 boolean isReferInfo()
          Allows classes to judge if this message bin referes to an info event.
 boolean parseLine(String[] dummy)
          Parsing is not allowed.
protected  void setLine(String[] cl)
          Sets the temporarly command line buffer.
 
Methods inherited from class stella.MessageEvent
checkType, equals, equalTime, equalTime, fromAscii, getAllCommandLines, getExecuteGroupKey, getHead, getNr, getTime, getType, hashCode, isValid, parseFromSingleString, readFromBufferedStream, setNr, setTime, setType, setValid, toString
 
Methods inherited from class util.rmi.RmiEvent
getHost, getSourceName, setSourceName
 
Methods inherited from class java.util.EventObject
getSource
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

line

private String[] line
The command lines read in, unparsed.

Constructor Detail

MessageBin

public MessageBin(Object src,
                  String type,
                  long time)
Creates a new message bin object for temporaly reference

Method Detail

getLine

public String[] getLine()
Returns the command-line(s) copy read in from the stream.

Specified by:
getLine in class MessageEvent
Returns:
An array containing all command lines.

setLine

protected void setLine(String[] cl)
Sets the temporarly command line buffer.


parseLine

public boolean parseLine(String[] dummy)
Parsing is not allowed. Throws an UnsupportedOperationException.

Specified by:
parseLine in class MessageEvent
Returns:
True, if parsing was successful.

isReferError

public boolean isReferError()
Allows classes to judge if this message bin referes to an error event. Note that reference to a command event can not be tested because the type field may take various forms in a command event.


isReferInfo

public boolean isReferInfo()
Allows classes to judge if this message bin referes to an info event. Note that reference to a command event can not be tested because the type field may take various forms in a command event.


isReferAcknowledge

public boolean isReferAcknowledge()
Allows classes to judge if this message bin referes to an acknowledge event. Note that reference to a command event can not be tested because the type field may take various forms in a command event.


isReferDone

public boolean isReferDone()
Allows classes to judge if this message bin referes to a done event. Note that reference to a command event can not be tested because the type field may take various forms in a command event.


isReferCommand

public boolean isReferCommand()
A helper method that tries to figure out if this message bin is referring to a command event. Because command events do not have a type field that immediately defines them as a command, we can only check if this message bin is of one of the other types. If not, we say it refers to a command.
This method test the message bin for being isReferError(), isReferInfo(), isReferAcknowledge(), and isReferDone().

Returns:
True if this message bin is not an error, info, acknowledge, or done message.