Configuration Platform SDK 7.6 API Reference

com.genesyslab.platform.commons.connection
Class ConnectionMessage

java.lang.Object
  extended bycom.genesyslab.platform.commons.connection.ConnectionMessage
All Implemented Interfaces:
java.lang.Cloneable

public final class ConnectionMessage
extends java.lang.Object
implements java.lang.Cloneable

Message to/from server. The message usually consists of its id and set of attributes. Each attribute has its own id (or type). The message can't contain two (or more) attributes with the same id, so calling put method several times with the same id will replace attributes in the message.


Constructor Summary
ConnectionMessage(int id)
          Creates the message.
ConnectionMessage(int id, int attrCount)
          Creates the message with known attribute count.
 
Method Summary
 void add(int id, byte[] val)
          Add binary (byte array) attribute to this message.
 void add(int id, int val)
          Add integer attribute to this message.
 void add(int id, java.lang.Integer val)
          Add integer attribute to this message.
 void add(int id, KeyValueCollection val)
          Add KeyValueCollection attribute to this message.
 void add(int id, KeyValueCollection val, java.lang.String encoding)
          Add KeyValueCollection attribute to this message.
 void add(int id, long val)
          Add long attribute to this message.
 void add(int id, java.lang.Long val)
          Add long attribute to this message.
 void add(int id, java.lang.String val)
          Add string attribute to this message.
 java.lang.Object clone()
           
 java.lang.Object deleteAttrib(int id)
          Delete attribyte by ID.
 int getAttributeCount()
          Get number of attributes in this Message
 java.util.Iterator getAttributeIds()
          Get attribute ids in this message as Iterator through Integer objects.
 byte[] getBinary(int id)
          Get binary (byte array) attribute value from the Message by ID.
 java.util.Iterator getEntries()
          Get attributes and their ids in this message as Iterator through Map.Entry objects.
 java.lang.Integer getInt(int id)
          Get integer attribute value from the essage by ID.
 KeyValueCollection getKeyValueCollection(int id)
          Get KeyValueCollection attribute value from the Message by ID.
 KeyValueCollection getKeyValueCollection(int id, java.lang.String encoding)
          Get KeyValueCollection attribute value from the Message by ID.
 java.lang.Long getLong(int id)
          Get long attribute value from the Message by ID.
 int getMessageId()
          Return message id (type)
 java.lang.Object getObject(int id)
          Get attribute value from the Message by ID.
 java.lang.String getString(int id)
          Get string attribute value from the Message by ID.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ConnectionMessage

public ConnectionMessage(int id)
Creates the message.

Parameters:
id - message id (or type)

ConnectionMessage

public ConnectionMessage(int id,
                         int attrCount)
Creates the message with known attribute count.

Parameters:
id - message id (or type)
Method Detail

getMessageId

public int getMessageId()
Return message id (type)

Returns:
message id

add

public void add(int id,
                int val)
Add integer attribute to this message.

Parameters:
id - Attribute ID.
val - Attribute value.

add

public void add(int id,
                java.lang.Integer val)
Add integer attribute to this message.

Parameters:
id - Attribute ID.
val - Attribute value.

add

public void add(int id,
                long val)
Add long attribute to this message.

Parameters:
id - Attribute ID.
val - Attribute value.

add

public void add(int id,
                java.lang.Long val)
Add long attribute to this message.

Parameters:
id - Attribute ID.
val - Attribute value.

add

public void add(int id,
                java.lang.String val)
Add string attribute to this message.

Parameters:
id - Attribute ID.
val - Attribute value.

add

public void add(int id,
                byte[] val)
Add binary (byte array) attribute to this message.

Parameters:
id - Attribute ID.
val - Attribute value.

add

public void add(int id,
                KeyValueCollection val)
Add KeyValueCollection attribute to this message.

Parameters:
id - Attribute ID.
val - Attribute value.

add

public void add(int id,
                KeyValueCollection val,
                java.lang.String encoding)
         throws java.io.UnsupportedEncodingException
Add KeyValueCollection attribute to this message.

Parameters:
id - Attribute ID.
val - Attribute value.
Throws:
java.io.UnsupportedEncodingException

deleteAttrib

public java.lang.Object deleteAttrib(int id)
Delete attribyte by ID.

Parameters:
id - Attribute ID.
Returns:
deleted attribute as an Object, or null if no such attribute in the ConnectionMessage

getInt

public java.lang.Integer getInt(int id)
Get integer attribute value from the essage by ID.

Parameters:
id - Attribute ID.
Returns:
attribute value, or null if there is no such attribute in the ConnectionMessage or it has wrong type.

getLong

public java.lang.Long getLong(int id)
Get long attribute value from the Message by ID.

Parameters:
id - Attribute ID.
Returns:
attribute value, or null if there is no such attribute in the ConnectionMessage or it has wrong type.

getString

public java.lang.String getString(int id)
Get string attribute value from the Message by ID.

Parameters:
id - Attribute ID.
Returns:
attribute value, or null if there is no such attribute in the ConnectionMessage or it has wrong type.

getBinary

public byte[] getBinary(int id)
Get binary (byte array) attribute value from the Message by ID.

Parameters:
id - Attribute ID.
Returns:
attribute value, or null if there is no such attribute in the ConnectionMessage or it has wrong type.

getKeyValueCollection

public KeyValueCollection getKeyValueCollection(int id)
Get KeyValueCollection attribute value from the Message by ID.

Parameters:
id - Attribute ID.
Returns:
attribute value, or null if there is no such attribute in the ConnectionMessage or it has wrong type.

getKeyValueCollection

public KeyValueCollection getKeyValueCollection(int id,
                                                java.lang.String encoding)
                                         throws java.io.UnsupportedEncodingException
Get KeyValueCollection attribute value from the Message by ID.

Parameters:
id - Attribute ID.
Returns:
attribute value, or null if there is no such attribute in the ConnectionMessage or it has wrong type.
Throws:
java.io.UnsupportedEncodingException

getObject

public java.lang.Object getObject(int id)
Get attribute value from the Message by ID.

Parameters:
id - Attribute ID.
Returns:
attribute value, or null if there is no such attribute in the ConnectionMessage.

getAttributeIds

public java.util.Iterator getAttributeIds()
Get attribute ids in this message as Iterator through Integer objects.

Returns:
Iterator of ids

getEntries

public java.util.Iterator getEntries()
Get attributes and their ids in this message as Iterator through Map.Entry objects. The key in the entry is Integer object and the value is Object.

Returns:
Enumeration of ids

getAttributeCount

public int getAttributeCount()
Get number of attributes in this Message

Returns:
number of attributes

clone

public java.lang.Object clone()
                       throws java.lang.CloneNotSupportedException
Throws:
java.lang.CloneNotSupportedException

toString

public java.lang.String toString()

Configuration Platform SDK 7.6 API Reference

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