org.iperg.part.core
Class IpEvent

java.lang.Object
  extended by org.iperg.part.core.IpEvent
Direct Known Subclasses:
IpNetworkEvent, IpObjectEvent, IpObjectSearchEvent, IpProcessEvent, IpSubscriptionEvent

public class IpEvent
extends java.lang.Object

IpEvent is the base class of all platform events. Events are identified primarily by their type (a string), which must be given when instantiating the IpEvent class. The class does not define a set of possible event types, and any string may thus be used when creating an event:

 IpEvent event = new IpEvent("aType"); 

All events have a destination, which is identified by an IpIdentifier instance. The destination is typically some kind of object to which the event should be delivered. When IpEvent is instantiated using new, the destination identifier is set to null.

Version:
1.0.0 Initial version
Author:
Olov Stahl - olovs@sics.se

Constructor Summary
protected IpEvent()
          Create a new (empty) event.
  IpEvent(java.lang.String type)
          Create a new event of the given type.
 
Method Summary
 IpIdentifier getDestination()
          Get the identifier of the object to which this event is destined.
 java.lang.String getType()
          Get the event type
protected  void read(IpInputStream stream)
          Read the event state from an input stream.
protected  void setDestination(IpIdentifier destId)
          Set the identifier of the object for which the event is destined.
protected  void write(IpOutputStream stream)
          Write the event state into an output stream.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IpEvent

public IpEvent(java.lang.String type)
Create a new event of the given type. The destination identifier will be set to null.

Parameters:
type - The event type

IpEvent

protected IpEvent()
Create a new (empty) event.

Method Detail

getType

public java.lang.String getType()
Get the event type


getDestination

public IpIdentifier getDestination()
Get the identifier of the object to which this event is destined.

Returns:
The destination identifier

setDestination

protected void setDestination(IpIdentifier destId)
Set the identifier of the object for which the event is destined.

Parameters:
destId - The identifier of the destination object

write

protected void write(IpOutputStream stream)
              throws java.io.IOException
Write the event state into an output stream. Sub-classes of IpEvent must call IpEvent.write if they add a write method. A class specific write method must therefore look like this:
 public void write(IpOutputStream stream)
     throws IOException
 {
     // write class specific state information
     ...

     // then let IpEvent write its state
     super.write(stream); // call IpEvent.write
 } 

Parameters:
stream - The output stream into which the event state should be written
Throws:
java.io.IOException - if an io exception occured while writing the event to the stream

read

protected void read(IpInputStream stream)
             throws java.io.IOException
Read the event state from an input stream. Sub-classes of IpEvent must call IpEvent.read if they add a read method. A class specific read method must therefore look like this:
 public void read(IpInputStream stream)
     throws IOException
 {
     // read class specific state information
     ...

     // then let IpEvent read its state
     super.read(stream); // call IpEvent.read
 } 

Parameters:
stream - The input stream from which the event should be read
Throws:
java.io.IOException - if an io exception occured while reading the event from the stream