Configuration Platform SDK 7.6 API Reference

com.genesyslab.platform.commons.protocol
Class Message

java.lang.Object
  extended bycom.genesyslab.platform.commons.protocol.DataObject
      extended bycom.genesyslab.platform.commons.protocol.Message
All Implemented Interfaces:
ProtocolDescriptionSupport
Direct Known Subclasses:
EventAuthenticated, EventError, EventHistoryLogSent, EventLocaleRead, EventNotificationRegistered, EventNotificationUnregistered, EventObjectCreated, EventObjectDeleted, EventObjectPermissionsRead, EventObjectsRead, EventObjectsSent, EventObjectUpdated, EventOperationalModeChanged, EventPasswordChanged, EventPermissionsChanged, EventPermissionsNotificationRegistered, EventPermissionsNotificationUnregistered, EventPermissionsRead, EventPermissionsUpdated, RequestAuthenticate, RequestChangePassword, RequestCreateObject, RequestDeleteObject, RequestHistoryLog, RequestReadLocale, RequestReadObjectPermissions, RequestReadObjects, RequestReadPermissions, RequestRegisterNotification, RequestRegisterPermissionsNotification, RequestUnregisterNotification, RequestUnregisterPermissionsNotification, RequestUpdateObject, RequestUpdatePermissions

public abstract class Message
extends DataObject
implements ProtocolDescriptionSupport

This abstract class provides the interface used for all Event classes. When events are received from a server, your application will use this interface to process them.

Here is a sample of how you can solicit and receive an event from a server:

interactionServerProtocol.send(requestAgentLogin);
Message response = interactionServerProtocol.receive();


You can combine the send() and receive() methods into a single method call by using the request() method, like this:

Message response =
  interactionServerProtocol.request(requestAgentLogin);


You can also receive an unsolicited event:

Message unsolicitedEvent = interactionServerProtocol.receive();

As shown in the above code samples, the reponse to your request will come in the form of a Message. This is the interface implemented by all events in the Platform SDK. Some requests will be answered by an event that is specific to the request, while others will receive a more generic response of EventAck, which simply acknowledges that your request was successful. If a request fails, the server will send an EventError.

A successful RequestAgentLogin, for example, will receive an EventAck, while an unsuccessful one will receive an EventError. You can use a switch statement to test which response you received, as outlined here:

switch(response.messageId())
{
  case EventAck.ID:
  // The request succeeded, carry out appropriate processing...
  case EventError.ID:
  // The request failed, carry out appropriate processing...
  ...
}


Method Summary
 Message cloneMessage()
           
abstract  Endpoint getEndpoint()
          Indicates server URI from which current message has been received.
abstract  java.lang.Object getMessageAttribute(java.lang.String index)
          Return message attribute as object by specified index.
 ProtocolDescription getProtocolDescription()
           
abstract  int getProtocolId()
          Return hash code of protocol object which handled the message.
 int messageId()
          Return message id
 java.lang.String messageName()
          Return message name
 
Methods inherited from class com.genesyslab.platform.commons.protocol.DataObject
equals, hashCode, toString, toString
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Method Detail

messageId

public int messageId()
Return message id

Returns:
message id.

messageName

public java.lang.String messageName()
Return message name

Returns:
message name

getMessageAttribute

public abstract java.lang.Object getMessageAttribute(java.lang.String index)
Return message attribute as object by specified index. Returns null if no such attribute in the message.

Parameters:
index - index of attribute
Returns:
attribute or null

getProtocolId

public abstract int getProtocolId()
Return hash code of protocol object which handled the message. When the message is not received from protocol the value of this property is zero.

Returns:
protocol hash code or zero.

getProtocolDescription

public ProtocolDescription getProtocolDescription()
Specified by:
getProtocolDescription in interface ProtocolDescriptionSupport

getEndpoint

public abstract Endpoint getEndpoint()
Indicates server URI from which current message has been received.

Returns:
Endpoint

cloneMessage

public Message cloneMessage()

Configuration Platform SDK 7.6 API Reference

Send comments on this topic.
Copyright © 2006–2008 Genesys Telecommunication Laboratories, Inc. All rights reserved.