com.edustructures.sifworks
Interface SIFMessagingListener

All Superinterfaces:
MessagingListener

public interface SIFMessagingListener
extends MessagingListener

A MessagingListener that can be implemented to receive notification when when SIF-related messaging activity takes place. An agent can register one or more SIFMessagingListeners with Zone and Topic classes. In some cases a listener instance can be directly passed to a method of those classes, such as Zone.query and Topic.query, so that an anonymous implementation of the listener can be used.

For all types of messages represented by this interface, the framework calls the appropriate function both before and after a message is received or sent to a zone. The messageType parameter will be a value defined by the constants of this interface (e.g. SIF_EVENT).


Field Summary
static byte SIF_EVENT
          MessageType constant identifying a SIF_Event
static byte SIF_PROVIDE
          MessageType constant identifying a SIF_Provide
static byte SIF_REGISTER
          MessageType constant identifying a SIF_Register
static byte SIF_REQUEST
          MessageType constant identifying a SIF_Request
static byte SIF_RESPONSE
          MessageType constant identifying a SIF_Response
static byte SIF_SUBSCRIBE
          MessageType constant identifying a SIF_Subscribe
static byte SIF_SYSTEM_CONTROL
          MessageType constant identifying a SIF_SystemControl
static byte SIF_UNPROVIDE
          MessageType constant identifying a SIF_Unprovide
static byte SIF_UNREGISTER
          MessageType constant identifying a SIF_Unregister
static byte SIF_UNSUBSCRIBE
          MessageType constant identifying a SIF_Unsubscribe
 
Fields inherited from interface com.edustructures.sifworks.MessagingListener
RX_DISCARD, RX_PROCESS, RX_REPARSE
 
Method Summary
 void onMessageProcessed(byte messageType, MessageInfo info)
          Called when a SIF_Message has been received by the framework and successfully dispatched to the ADK's message handlers.
 byte onMessageReceived(byte messageType, java.lang.StringBuffer message)
          Called when a SIF_Message has been received by the framework, before it is dispatched to the ADK's message handlers.
 void onMessageSent(byte messageType, MessageInfo info, java.lang.Object ack)
          Called when a SIF_Message has been sent by the framework and a SIF_Ack received from the server.
 boolean onSendingMessage(byte messageType, MessageInfo info, java.lang.StringBuffer message)
          Called when a SIF_Message is about to be sent by the framework.
 

Field Detail

SIF_EVENT

static final byte SIF_EVENT
MessageType constant identifying a SIF_Event

See Also:
Constant Field Values

SIF_REQUEST

static final byte SIF_REQUEST
MessageType constant identifying a SIF_Request

See Also:
Constant Field Values

SIF_RESPONSE

static final byte SIF_RESPONSE
MessageType constant identifying a SIF_Response

See Also:
Constant Field Values

SIF_SYSTEM_CONTROL

static final byte SIF_SYSTEM_CONTROL
MessageType constant identifying a SIF_SystemControl

See Also:
Constant Field Values

SIF_REGISTER

static final byte SIF_REGISTER
MessageType constant identifying a SIF_Register

See Also:
Constant Field Values

SIF_UNREGISTER

static final byte SIF_UNREGISTER
MessageType constant identifying a SIF_Unregister

See Also:
Constant Field Values

SIF_SUBSCRIBE

static final byte SIF_SUBSCRIBE
MessageType constant identifying a SIF_Subscribe

See Also:
Constant Field Values

SIF_UNSUBSCRIBE

static final byte SIF_UNSUBSCRIBE
MessageType constant identifying a SIF_Unsubscribe

See Also:
Constant Field Values

SIF_PROVIDE

static final byte SIF_PROVIDE
MessageType constant identifying a SIF_Provide

See Also:
Constant Field Values

SIF_UNPROVIDE

static final byte SIF_UNPROVIDE
MessageType constant identifying a SIF_Unprovide

See Also:
Constant Field Values
Method Detail

onMessageReceived

byte onMessageReceived(byte messageType,
                       java.lang.StringBuffer message)
                       throws ADKException
Called when a SIF_Message has been received by the framework, before it is dispatched to the ADK's message handlers.

An agent can implement this method to count the number of messages received, to signal the user interface or other interested parties that a message has arrived, to examine or change the raw content of incoming messages before they're dispatched to the framework, or to prevent the framework from dispatching messages to message handlers. When filtering messages, return true to allow the framework to process this message, false to silently discard the message, or throw an ADKException to return an error to the server.

Specified by:
onMessageReceived in interface MessagingListener
Parameters:
messageType - A message type constant (e.g. SIFMessagingListener.SIF_EVENT)
message - A StringBuffer containing the message to be sent. The contents of the buffer may be modified by this method.
Returns:
One of the following codes: RX_PROCESS to allow the framework to process this message; RX_DISCARD to silently discard the message; or RX_REPARSE if this method has changed the content of the message parameter StringBuffer.
Throws:
ADKException - may be thrown by this method to return an error acknowledgement to the server

onMessageProcessed

void onMessageProcessed(byte messageType,
                        MessageInfo info)
                        throws ADKException
Called when a SIF_Message has been received by the framework and successfully dispatched to the ADK's message handlers. If a message is received but not processed by a message handler, this method is never called.

Specified by:
onMessageProcessed in interface MessagingListener
Parameters:
messageType - A message type constant (e.g. SIFMessagingListener.SIF_EVENT)
info - The MessageInfo instance associated with the message
Throws:
ADKException - may be thrown by this method to return an error acknowledgement to the server

onSendingMessage

boolean onSendingMessage(byte messageType,
                         MessageInfo info,
                         java.lang.StringBuffer message)
Called when a SIF_Message is about to be sent by the framework.

An agent can implement this method to filter outbound messages in order to change the message content or prevent the framework from sending a message to the server. When filtering messages, return true to allow the framework to send this message or false to silently discard the message.

Specified by:
onSendingMessage in interface MessagingListener
Parameters:
messageType - A message type constant (e.g. SIFMessagingListener.SIF_EVENT)
info - The MessageInfo instance associated with the message
message - A StringBuffer containing the message to be sent. The contents of the buffer may be modified by this method.

onMessageSent

void onMessageSent(byte messageType,
                   MessageInfo info,
                   java.lang.Object ack)
Called when a SIF_Message has been sent by the framework and a SIF_Ack received from the server.

An agent can implement this method to count the number of messages sent or to signal the user interface or other interested parties that a message has been sent.

Specified by:
onMessageSent in interface MessagingListener
Parameters:
messageType - A message type constant (e.g. SIFMessagingListener.SIF_EVENT)
info - The MessageInfo instance associated with the message
ack - The SIF_Ack returned by the server


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.