i3.dragos.core.services.events
Class DragosEvent

java.lang.Object
  extended by java.util.EventObject
      extended by i3.dragos.core.services.events.DragosEvent
All Implemented Interfaces:
java.io.Serializable
Direct Known Subclasses:
DataEvent, GraphPoolEvent, TransactionEvent

public abstract class DragosEvent
extends java.util.EventObject

Abstract super class for all events used in DRAGOS.

Events are used to communicate with different parts of the system. Each event has been created by some other component which is called the source. Most event classes can signal multiple types of events, which are defined as integer constants and returned by getEventType(). [We wanted to use enums for this, but they are not suitable for cases like these where subclasses will be added by multiple independent parties in independent projects.] Make sure to verify the events class using getEventClass() before interpreting the type values, because subclasses might define other constants with the same value, but a completely different meaning! Only the pair (getEventClass(), getEventType()) will always uniquely identify the event.

Subclasses should provide a constructor that accepts any eventType argument, even if they only encapsulate a single type of event, so that further subclasses can be created. Beyond that, getters for any additional attributes should obviously defined as well.

Author:
Boris Boehlen <boehlen@cs.rwth-aachen.de>, Thorsten Hermes <thermes@i3.informatik.rwth-aachen.de>
See Also:
Serialized Form

Field Summary
 
Fields inherited from class java.util.EventObject
source
 
Constructor Summary
DragosEvent(java.lang.Object source, int eventType)
          Creates a new event.
 
Method Summary
 java.lang.String getEventClass()
          Returns the name of the event class.
 int getEventType()
          Returns the type of the event.
 java.lang.String toString()
          
 
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
 

Constructor Detail

DragosEvent

public DragosEvent(java.lang.Object source,
                   int eventType)
Creates a new event.

Parameters:
source - The source of this event.
eventType - The type of event.
Method Detail

getEventClass

public final java.lang.String getEventClass()
Returns the name of the event class. This final method is implemented as return getClass().getName();

Returns:
the name of the event class.

getEventType

public int getEventType()
Returns the type of the event. All values returned by this method should be defined as constants in the implementing class.

Returns:
the type of the event.

toString

public java.lang.String toString()

Overrides:
toString in class java.util.EventObject


Copyright © 2002-2008 RWTH Aachen, Department of Computer Science 3 (Software Engineering). All Rights Reserved.