com.edustructures.sifworks
Class Event

java.lang.Object
  extended by com.edustructures.sifworks.Event

public class Event
extends java.lang.Object

Encapsulates a SIF Event.

An Event is a notification to subscribing agents that a data object has been added, changed, or deleted in the reporting application's database. In the Schools Interoperability Framework, any agent may report SIF_Event messages for any object, even if that agent is not the authoritative publisher of the object.

Reporting SIF Events

To report a SIF_Event to a zone, construct an Event instance and call the Zone.reportEvent(Event) method. Supply a SIFDataObject instance and an action code to the Event constructor. You may also call alternative forms of the reportEvent method that accept SIFDataObjects and an action code as parameters. Note Events cannot be reported to a Topic because the ADK cannot determine which of its zones should receive the event. If you're using Topics, you must report events to the specific Zone or Zones to which the data applies.

Subscribing to SIF Events

To subscribe to SIF_Events for a specific object type, register a Subscriber message handler with Zone or Topic instances. Call the setSubscriber method repeatedly for each object type you wish to subscribe to. When the ADK connects to a zone, it sends SIF_Subscribe messages for each object type. When a SIF_Event message is received by the ADK, it is dispatched to your Subscriber.onEvent(Event, Zone, MessageInfo) method for processing. Refer to that method for more information.

Since:
ADK 1.0

Constructor Summary
Event(DataObjectInputStream data, EventAction action, ElementDef objectType)
          Constructs an Event object to encapsulate an inbound SIF Event.
Event(DataObjectInputStream data, java.lang.String action, ElementDef objectType)
          Constructs an Event object to encapsulate an inbound SIF Event.
Event(SIFDataObject[] data, java.lang.String action)
          Constructs an Event object to encapsulate an outbound SIF Event, which describes one or more SIF Data Objects that have been added, changed, or deleted by the local application.
Event(SIFDataObject data, EventAction action)
          Constructs an Event object to encapsulate an outbound SIF Event, which describes one or more SIF Data Objects that have been added, changed, or deleted by the local application.
Event(SIFDataObject data, EventAction action, SIFContext... contexts)
          Constructs an Event object to encapsulate an outbound SIF Event, which describes one or more SIF Data Objects that have been added, changed, or deleted by the local application.
 
Method Summary
 EventAction getAction()
          Gets the action code identifying how the data in the Event payload has changed
 java.lang.String getActionString()
          Gets the action string that was assigned to the SIF_Event/@Action attribute
 SIFContext[] getContexts()
          Gets the SIF Contexts that this event applies to.
 DataObjectInputStream getData()
          Gets the SIF Data Objects in the Event payload
 ElementDef getObjectType()
          Identifies the type of SIF Data Object contained in the Event payload
 Zone getZone()
          Gets the Zone from which an inbound event originated.
 void setContexts(SIFContext... contexts)
          Sets the SIF Contexts to which this event applies.
 void setZone(Zone zone)
          Called internally by the ADK to track the zone from which this event originated.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Event

public Event(DataObjectInputStream data,
             EventAction action,
             ElementDef objectType)
Constructs an Event object to encapsulate an inbound SIF Event. This form of constructor is called internally by the ADK when it receives a SIF_Event message.

Parameters:
data - A DataObjectInputStream that returns SIFDataObjects, all of which must be of the same class type
action - Describes how the data has changed. One of the following flags: ADD, CHANGE, or DELETE
objectType - An ElementDef constant from the SIFDTD class that identifies the type of SIF Data Object contained in the event
See Also:
EventAction

Event

public Event(DataObjectInputStream data,
             java.lang.String action,
             ElementDef objectType)
Constructs an Event object to encapsulate an inbound SIF Event. This form of constructor is called internally by the ADK when it receives a SIF_Event message.

Parameters:
data - A DataObjectInputStream that returns SIFDataObjects, all of which must be of the same class type
action - Describes how the data has changed
objectType - An ElementDef constant from the SIFDTD class that identifies the type of SIF Data Object contained in the event

Event

public Event(SIFDataObject data,
             EventAction action)
Constructs an Event object to encapsulate an outbound SIF Event, which describes one or more SIF Data Objects that have been added, changed, or deleted by the local application. This form of constructor is called by agents when reporting a SIF Event message to a zone.

Parameters:
data - A SIFDataObject
action - Describes how the data has changed. One of the following flags: ADD, CHANGE, or DELETE
See Also:
EventAction, Zone.reportEvent(Event)

Event

public Event(SIFDataObject data,
             EventAction action,
             SIFContext... contexts)
Constructs an Event object to encapsulate an outbound SIF Event, which describes one or more SIF Data Objects that have been added, changed, or deleted by the local application. This form of constructor is called by agents when reporting a SIF Event message to a zone.

Parameters:
data -
action -
contexts -

Event

public Event(SIFDataObject[] data,
             java.lang.String action)
Constructs an Event object to encapsulate an outbound SIF Event, which describes one or more SIF Data Objects that have been added, changed, or deleted by the local application. This form of constructor is called by agents when reporting a SIF Event message to a zone.

Parameters:
data - An array of SIFDataObjects, all of which must be of the same class type
action - Describes how the data has changed: in SIF, this string should be "Add", "Change", or "Delete"
See Also:
Zone.reportEvent(Event)
Method Detail

getData

public DataObjectInputStream getData()
Gets the SIF Data Objects in the Event payload

Returns:
An input stream from which the agent can read the individual SIFDataObjects contained in the event

getObjectType

public ElementDef getObjectType()
Identifies the type of SIF Data Object contained in the Event payload

Returns:
An ElementDef constant from the SIFDTD class that identifies the type of SIF Data Object contained in the event. All objects in an Event must be of the same type.

getAction

public EventAction getAction()
Gets the action code identifying how the data in the Event payload has changed

Returns:
One of the action codes defined by this class. UNDEFINED is returned if the ADK could not parse the value of the @Action attribute specified in the SIF_Event message (call getActionString() to inspect the actual Action attribute value)
See Also:
EventAction, getActionString()

getActionString

public java.lang.String getActionString()
Gets the action string that was assigned to the SIF_Event/@Action attribute

Returns:
An action string (e.g. "Add", "Change", or "Delete")
See Also:
getAction()

setZone

public void setZone(Zone zone)
Called internally by the ADK to track the zone from which this event originated. Note: Calling this method for outbound Events created by an agent has no effect.

Parameters:
zone - The Zone the SIF_Event message was received from

getZone

public Zone getZone()
Gets the Zone from which an inbound event originated.

Returns:
The Zone the SIF_Event message was received from

setContexts

public void setContexts(SIFContext... contexts)
Sets the SIF Contexts to which this event applies. If not set, the event applies to the default SIF Context

Parameters:
fContexts - One or more contexts to which this event applies
See Also:
SIFContext.DEFAULT

getContexts

public SIFContext[] getContexts()
Gets the SIF Contexts that this event applies to. If the context has not been set, it defaults to the SIF Default context

Returns:
An array of SIF contexts to which this event applies
See Also:
SIFContext.DEFAULT


Copyright © 2001-2007 Edustructures LLC. All Rights Reserved. SIFWorks® and ADK® are registered trademarks of Edustructures LLC. SIF™ and Schools Interoperability Framework are trademarks of the Schools Interoperability Framework Association.