net.ponder2.policy
Class Event

java.lang.Object
  extended by net.ponder2.objects.P2Object
      extended by net.ponder2.objects.P2Hash
          extended by net.ponder2.policy.Event
All Implemented Interfaces:
java.io.Serializable, java.util.Map<java.lang.String,P2Object>, P2Serializable, ManagedObject, Ponder2Message

public class Event
extends P2Hash
implements ManagedObject

The actual notification that is sent through the system. An Event is created using an EventTemplate which packages up named arguments and includes them in the Event. Several static methods aid in the creation and sending of Events.

Version:
$Id:$
Author:
Kevin Twidle
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from interface java.util.Map
java.util.Map.Entry<K,V>
 
Constructor Summary
Event()
          Creates an instance of an Event with no contents.
Event(P2Object source, P2Object eventTemplate, P2Array values)
           
Event(P2Object source, P2Object eventTemplate, P2Hash values)
           
Event(P2Object source, P2Object eventTemplate, P2Object... values)
           
Event(P2Object source, java.lang.String eventTemplate, P2Object... values)
           
 
Method Summary
 P2Object getEventTemplate()
          gets the OID of the original event template
 P2Object getSource()
          gets the source OID of this event
protected  boolean isMutable()
          To be overridden by P2Hash subclasses.
 P2Object readXml(com.twicom.qdparser.TaggedElement xml, java.util.Map<java.lang.Integer,P2Serializable> read)
           
 boolean setVisited(P2ManagedObject mo)
          sets and checks the visited status of the current OID.
 com.twicom.qdparser.TaggedElement writeXml(java.util.Set<P2Object> written)
           
 
Methods inherited from class net.ponder2.objects.P2Hash
asHash, asMap, asPonder2Array, clear, containsKey, containsValue, entrySet, get, isEmpty, keySet, names, operation_at_ifAbsent, operation_at_put, operation_at, operation_collect, operation_do, operation_has, operation_has, operation_listNames, operation_listObjects, operation_remove, operation_removeAll, put, putAll, remove, removeObject, set, size, toString, values
 
Methods inherited from class net.ponder2.objects.P2Object
asArray, asBlock, asBoolean, asClass, asDouble, asFloat, asInteger, asLong, asNumber, asP2Array, asString, create, create, create, create, create, create, create, create, create, create, create, create, create, create, create, create, create, fromXml, getManagedObject, getOID, getSMC, operation, operation, setSMC
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.Map
equals, hashCode
 

Constructor Detail

Event

public Event()
Creates an instance of an Event with no contents. The create is necessary for the compiler to generate the correct code, it is not supposed to be used in PonderTalk.


Event

public Event(P2Object source,
             java.lang.String eventTemplate,
             P2Object... values)
      throws Ponder2Exception
Throws:
Ponder2Exception

Event

public Event(P2Object source,
             P2Object eventTemplate,
             P2Array values)
      throws Ponder2Exception
Throws:
Ponder2Exception

Event

public Event(P2Object source,
             P2Object eventTemplate,
             P2Object... values)
      throws Ponder2Exception
Throws:
Ponder2Exception

Event

public Event(P2Object source,
             P2Object eventTemplate,
             P2Hash values)
      throws Ponder2ArgumentException,
             Ponder2OperationException
Throws:
Ponder2ArgumentException
Ponder2OperationException
Method Detail

getEventTemplate

public P2Object getEventTemplate()
gets the OID of the original event template

Returns:
the event template's OID

getSource

public P2Object getSource()
gets the source OID of this event

Returns:
the source OID

setVisited

public boolean setVisited(P2ManagedObject mo)
sets and checks the visited status of the current OID. As the event traverses the managed object tree, each OID is set here. It returns whether it was already set.

Parameters:
mo - the newly visited P2Object
Returns:
true if the P2Object had already been visited

isMutable

protected boolean isMutable()
To be overridden by P2Hash subclasses. Affects whether the hash is copied remotely or a reference is sent

Overrides:
isMutable in class P2Hash
Returns:
true if mutable

writeXml

public com.twicom.qdparser.TaggedElement writeXml(java.util.Set<P2Object> written)
                                           throws Ponder2OperationException
Specified by:
writeXml in interface P2Serializable
Overrides:
writeXml in class P2Hash
Throws:
Ponder2OperationException

readXml

public P2Object readXml(com.twicom.qdparser.TaggedElement xml,
                        java.util.Map<java.lang.Integer,P2Serializable> read)
                 throws Ponder2OperationException,
                        Ponder2ArgumentException
Specified by:
readXml in interface P2Serializable
Overrides:
readXml in class P2Hash
Throws:
Ponder2OperationException
Ponder2ArgumentException


Copyright © 2008 Imperial College. All Rights Reserved.