stella.net.tpl
Class TplEvent

java.lang.Object
  extended by java.util.EventObject
      extended by stella.net.tpl.TplEvent
All Implemented Interfaces:
Serializable

public class TplEvent
extends EventObject

A reply from the server. Can be issued at any time, thus parsed from a pending input on the socket line. The term is missleading as this is more the general reply from the server rather then the more specific case of a Tpl2Event.

The replies fall into the following categories, discerned by the string token following the ID. This token is the type and it defines also the meaning of the third token, here called state. Additionally to these, some quenched replies due to atuhentication or disconnect request exist. These replies have no leading ID, but rather immediately start with either CONNECT or DISCONNECT. Both are not further explained here.
The main reply object types then fall into these categories:

See Also:
Serialized Form

Field Summary
static String COMMAND
          Events following a command.
static String CONNECT
          Connect event, will always get ID=0.
static String DATA
          Events as reseults to data requests/settings.
static String DEBUG
          Event debug error level.
static String DISCONNECT
          Disconnect event, will always get ID=0.
static String ERROR
          Event severe error level.
static String EVENT
          General events not bound to commands or data.
private  int id
          The command id this event referes to.
private  String info
          The string after the id, type and the event state.
static String INFO
          Event info error level.
private  Object state
          The state of the event object.
private  Object type
          The event type, one of COMMAND, DATA, EVENT, CONNECT or DISCONNECT.
static String WARN
          Event warn error level.
 
Fields inherited from class java.util.EventObject
source
 
Constructor Summary
TplEvent(Object source, String line)
          Constructs a new tpl event from the line read.
 
Method Summary
 int getID()
          Returns the unique integer id-this event follows.
 String getInfo()
          Returns any additional info attached to this event as a space-separated string.
 Object getState()
          Returns the state of the event.
 boolean isCommand()
          Returns true if this tpl-event is a command type.
 boolean isConnect()
          Returns true if this tpl-event is of a general type.
 boolean isData()
          Returns true if this tpl-event is of data type.
 boolean isDisconnect()
          Returns true if this tpl-event is of a general type.
 boolean isEvent()
          Returns true if this tpl-event is of a general type.
private  void parseLine(String read)
          Parses the event out of the reply line read.
 String toString()
          Return the string representation.
 
Methods inherited from class java.util.EventObject
getSource
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

CONNECT

public static final String CONNECT
Connect event, will always get ID=0.

See Also:
Constant Field Values

DISCONNECT

public static final String DISCONNECT
Disconnect event, will always get ID=0.

See Also:
Constant Field Values

COMMAND

public static final String COMMAND
Events following a command.

See Also:
Constant Field Values

DATA

public static final String DATA
Events as reseults to data requests/settings.

See Also:
Constant Field Values

EVENT

public static final String EVENT
General events not bound to commands or data.

See Also:
Constant Field Values

DEBUG

public static final String DEBUG
Event debug error level.

See Also:
Constant Field Values

INFO

public static final String INFO
Event info error level.

See Also:
Constant Field Values

WARN

public static final String WARN
Event warn error level.

See Also:
Constant Field Values

ERROR

public static final String ERROR
Event severe error level.

See Also:
Constant Field Values

id

private int id
The command id this event referes to.


type

private Object type
The event type, one of COMMAND, DATA, EVENT, CONNECT or DISCONNECT.


state

private Object state
The state of the event object. Depends on type.


info

private String info
The string after the id, type and the event state. Specific parsing.

Constructor Detail

TplEvent

public TplEvent(Object source,
                String line)
Constructs a new tpl event from the line read.

Method Detail

getID

public int getID()
Returns the unique integer id-this event follows.


isCommand

public boolean isCommand()
Returns true if this tpl-event is a command type.


isData

public boolean isData()
Returns true if this tpl-event is of data type.


isEvent

public boolean isEvent()
Returns true if this tpl-event is of a general type.


isDisconnect

public boolean isDisconnect()
Returns true if this tpl-event is of a general type.


isConnect

public boolean isConnect()
Returns true if this tpl-event is of a general type.


getState

public Object getState()
Returns the state of the event.


getInfo

public String getInfo()
Returns any additional info attached to this event as a space-separated string.


parseLine

private void parseLine(String read)
Parses the event out of the reply line read. Only supports single-lined events.


toString

public String toString()
Return the string representation.

Overrides:
toString in class EventObject