net.sf.cscc
Class CommunicationEvent

java.lang.Object
  |
  +--net.sf.cscc.CommunicationEvent

public class CommunicationEvent
extends java.lang.Object

This class represents a communication event. A communication event describes events that occur between the communication of two communication partners. This specific type of event is identified by a numeric id which can be retrieved with the method getEventId(). The event can also contain some additional data, for example the id of the communication partner.

Author
Silvio Meier (SM)

Copyright
Silvio Meier, Tobias Reinhard, 2003

History
2003-05-14 SM First Version
2003-05-14 SM working on additional methods and events,
correction of some comments.
2003-05-20 TR Comments corrected
2006-10-29 SM Comments revised.

Version
$Date: 2007/07/02 21:26:17 $, $Author: reode_orm $, $Revision: 1.2 $

Responsibilities
Represents a communication event.


Field Summary
protected  java.lang.Object additionalData
          Stores additional data about the communication event.
static int CONNECTION_BROKEN
          Describes the type of event which occurs if the connection breaks.
static int CONNECTION_CLOSED
          Describes the normal closing of connection by one of the communication partners.
static int CONNECTION_ESTABLISHED
          Constant describes if the connection was established.
static int CONNECTION_START_LISTENING
          Constant describes the start of a listener thread.
static int CONNECTION_STOP_LISTENING
          Constant describes the end of a listening thread.
protected  int eventId
          Stores a numeric id about the event.
 
Constructor Summary
CommunicationEvent(int id)
          Constructor initializes the object.
CommunicationEvent(int id, java.lang.Object data)
          Constructor initializes the object.
 
Method Summary
 java.lang.Object getData()
          This method returns the additional data of the message.
 int getEventId()
          This method returns the event id.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CONNECTION_ESTABLISHED

public static final int CONNECTION_ESTABLISHED
Constant describes if the connection was established.

CONNECTION_BROKEN

public static final int CONNECTION_BROKEN
Describes the type of event which occurs if the connection breaks.

CONNECTION_CLOSED

public static final int CONNECTION_CLOSED
Describes the normal closing of connection by one of the communication partners.

CONNECTION_START_LISTENING

public static final int CONNECTION_START_LISTENING
Constant describes the start of a listener thread.

CONNECTION_STOP_LISTENING

public static final int CONNECTION_STOP_LISTENING
Constant describes the end of a listening thread.

eventId

protected int eventId
Stores a numeric id about the event.

additionalData

protected java.lang.Object additionalData
Stores additional data about the communication event.
Constructor Detail

CommunicationEvent

public CommunicationEvent(int id,
                          java.lang.Object data)
Constructor initializes the object.
Pre
data != null
Post
true
Parameters:
id - Identifies the communication event uniquely.
data - Some additional data which can also be provided with the event. This can be, for example, an identification object for the communication partner which caused the event.


CommunicationEvent

public CommunicationEvent(int id)
Constructor initializes the object.
Pre
true
Post
true
Parameters:
id - Identifies the communication event uniquely.

Method Detail

getData

public java.lang.Object getData()
This method returns the additional data of the message.
Pre
true
Post
true
Returns:
Returns the object containing the data which is associated to the occurred event.


getEventId

public int getEventId()
This method returns the event id. This event id can be used to determine which kind of event happened.
Pre
true
Post
true
Returns:
Returns the event key of this event.



Copyright © 2003, Silvio Meier and Tobias Reinhard. All Rights Reserved.