Platform SDK Java 8.5 API Reference

com.genesyslab.platform.webmedia.protocol
Class BasicChatProtocol

java.lang.Object
  extended by com.genesyslab.platform.commons.protocol.AbstractChannel
      extended by com.genesyslab.platform.commons.protocol.DuplexChannel
          extended by com.genesyslab.platform.commons.protocol.ClientChannel
              extended by com.genesyslab.platform.webmedia.protocol.WebmediaChannel
                  extended by com.genesyslab.platform.webmedia.protocol.OptionalRegistrationChannel
                      extended by com.genesyslab.platform.webmedia.protocol.BasicChatProtocol
All Implemented Interfaces:
AsyncChannel, AsyncChannelOperations, AsyncInvokerSupport, Channel, ChannelListenerSupport, ConfigurationSupport, ConnectionInvokerSupport, EndpointSupport, InputChannel, InterceptorSupport, LogMessageFilterSupport, MessageReceiver, MessageReceiverManagement, OutputChannel, Protocol, ProtocolDescriptionSupport, Receiver, ReceiverManagement, RequestChannel, BasicChatProtocolHandshakeOptions

@ProtocolDescription.Tag(sdkName="WebMedia",
                         protocolName="BasicChat")
public class BasicChatProtocol
extends OptionalRegistrationChannel
implements BasicChatProtocolHandshakeOptions

By default, BasicChatProtocol has enabled AutoRegister mode. Set AutoRegister to false if you need send client registration message directly.


Nested Class Summary
 
Nested classes/interfaces inherited from class com.genesyslab.platform.commons.protocol.ClientChannel
ClientChannel.BasicClientHandshakeStep, ClientChannel.ClientHandshakeStep, ClientChannel.RegistrationHandler, ClientChannel.SimpleRegistrationHandler
 
Nested classes/interfaces inherited from class com.genesyslab.platform.commons.protocol.AbstractChannel
AbstractChannel.AsyncErrorNotifier
 
Field Summary
 
Fields inherited from class com.genesyslab.platform.webmedia.protocol.WebmediaChannel
OPTION_NAME_ILLEGAL_UNICODE_CHARS_REPLACEMENT, OPTION_NAME_REPLACE_ILLEGAL_UNICODE_CHARS, OPTION_NAME_TARGET_XML_VERSION
 
Fields inherited from class com.genesyslab.platform.commons.protocol.DuplexChannel
messageFilter
 
Fields inherited from interface com.genesyslab.platform.commons.protocol.Receiver
DEF_INPUT_SIZE
 
Fields inherited from interface com.genesyslab.platform.commons.protocol.Channel
DEFAULT_TIMEOUT, INFINITE_TIMEOUT
 
Constructor Summary
BasicChatProtocol()
          Creates instance of BasicChatProtocol.
BasicChatProtocol(Endpoint endpoint)
          Creates instance of BasicChatProtocol.
BasicChatProtocol(Endpoint endpoint, long timeout)
          Creates instance of BasicChatProtocol.
 
Method Summary
protected  com.genesyslab.platform.commons.connection.impl.xml.ProtocolDialect getDialect()
           
protected  ClientChannel.ClientHandshakeStep getHandshakeStart()
          This virtual method returns initial handshake step for this channel.
 java.lang.String getPersonId()
           
 java.lang.String getSecureKey()
          Optional, if set with UserId, channel will use it to restore previously registered session.
 BasicChatServerContext getServerContext()
           
 int getTimeZoneOffset()
          Optional, timezone offset.
 KeyValueCollection getUserData()
          Optional, used for user identification in UCS (Universal Contact Server).
 java.lang.String getUserId()
           
 java.lang.String getUserNickname()
           
 UserType getUserType()
           
 boolean isAutoRegister()
          Returns flag for automatic client registration request on connection open.
By default it is enabled, but sometimes it may be required to do some other operations before client registration request, or there is a need to create custom registration request.
In this case user may disable automatic registration and later (after the connection opened) send own registration request.
protected  void onClose(ConnectionClosedEvent event)
           
protected  void onEventRegistered(EventRegistered event)
          This method is called on successful response to the client Auto-Registration request.
protected  void onOpen()
          This method is called when channel is opened and just about to call event handler.
protected  void onSend(Message message)
          Gives to subclass a chance to modify message before sending it to remote party.
 void setAutoRegister(boolean autoRegister)
          Sets flag for automatic client registration request on connection open.
By default it is enabled, but sometimes it may be required to do some other operations before client registration request, or there is a need to create custom registration request.
In this case user may disable automatic registration and later (after the connection opened) send own registration request.
 void setPersonId(java.lang.String personId)
           
 void setSecureKey(java.lang.String secureKey)
          Optional, if set with UserId, channel will use it to restore previously registered session.
 void setTimeZoneOffset(int timeZoneOffset)
          Optional, timezone offset.
 void setUserData(KeyValueCollection userData)
          Optional, used for user identification in UCS (Universal Contact Server).
 void setUserId(java.lang.String userId)
           
 void setUserNickname(java.lang.String userNickname)
           
 void setUserType(UserType userType)
           
 
Methods inherited from class com.genesyslab.platform.webmedia.protocol.WebmediaChannel
applyConfiguration, createConnection, lookupConnectionParameter
 
Methods inherited from class com.genesyslab.platform.commons.protocol.ClientChannel
beginClose, beginOpen, beginRequest, close, close, closeAsync, closeAsync, disableConnectionOperations, doBeginRequest, doBeginRequest, doRequest, endRequest, endRequest, fireUnsolicitedEvents, getCopyResponse, getInvoker, getOpenTimeoutException, getReferenceBuilder, onReceiveMessage, onUnexpectedHandshakeMessage, open, openAsync, openAsync, request, request, requestAsync, requestAsync, setAddressResolver, setAddressResolverParams, setAddressResolverParams, setCopyResponse, setEndpoint, setHandshakeFinished, setHandshakePhase, setHandshakeUnsolicitedEventsPassLimit, setRegistrationHandler, setState, submitRegMessage, throwOnUnReferenceableRequest
 
Methods inherited from class com.genesyslab.platform.commons.protocol.DuplexChannel
addListener, cancelCloseTimeout, cancelOpenTimeout, clearInput, close, closeAsync, createChannelClosedEvent, createConnectionClosedEvent, doBeginClose, doClose, doSend, downgradeConnection, getDefaultRestriction, getEnpointPrefixInfo, getInputSize, getInterceptor, getLocalEndPoint, getLocalEndpointInfo, getLogMessageFilter, getProtocolDescription, getProtocolFactory, getProtocolId, getRemoteEndPoint, getTimeoutException, initPackager, isMessageAllowed, notifyWithObject, onFireClosed, onFireErrorEvent, onFireOpened, open, openAsync, openAsync, processClose, processCloseAll, receive, receive, receivedMessage, releaseReceivers, removeListener, resetReceiver, resumeReading, send, setConnectionInvoker, setExternalTransport, setInputSize, setLogMessageFilter, setMessageHandler, setProtocolData, setReceiver, startUpgradeConnection, stopReading, toString, triggerWithObject, upgradeConnection, waitForObject
 
Methods inherited from class com.genesyslab.platform.commons.protocol.AbstractChannel
addChannelListener, configure, connectionContext, copyTLSSettings, fireClosed, fireErrorEvent, fireErrorEvent, generateChannelId, getChannelId, getConfiguration, getDefaultInvoker, getEndpoint, getListenerHelper, getState, getStateMods, getTimeout, internal, onSetEndpoint, releaseDefaultInvoker, removeChannelListener, setConfiguration, setInvoker, setServerContext, setState, setTimeout, throwNotClosed, throwNotOpened, throwNotOpenedOnClose, throwNotOpenedOnSend, throwNull, throwNullEndpoint
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.genesyslab.platform.commons.protocol.Protocol
getProtocolId
 
Methods inherited from interface com.genesyslab.platform.commons.protocol.InputChannel
setMessageHandler
 
Methods inherited from interface com.genesyslab.platform.commons.protocol.MessageReceiver
receive, receive
 
Methods inherited from interface com.genesyslab.platform.commons.protocol.Receiver
clearInput, getInputSize, releaseReceivers, setInputSize
 
Methods inherited from interface com.genesyslab.platform.commons.protocol.OutputChannel
addListener, removeListener, send
 
Methods inherited from interface com.genesyslab.platform.commons.protocol.Channel
close, getTimeout, open, setTimeout
 
Methods inherited from interface com.genesyslab.platform.commons.protocol.AsyncChannel
getState
 
Methods inherited from interface com.genesyslab.platform.commons.protocol.ChannelListenerSupport
addChannelListener, removeChannelListener
 
Methods inherited from interface com.genesyslab.platform.commons.protocol.InterceptorSupport
getInterceptor
 
Methods inherited from interface com.genesyslab.platform.commons.protocol.MessageReceiverManagement
setReceiver
 
Methods inherited from interface com.genesyslab.platform.commons.protocol.ReceiverManagement
resetReceiver
 
Methods inherited from interface com.genesyslab.platform.commons.protocol.ConfigurationSupport
configure, getConfiguration
 
Methods inherited from interface com.genesyslab.platform.commons.protocol.EndpointSupport
getEndpoint
 
Methods inherited from interface com.genesyslab.platform.commons.protocol.ProtocolDescriptionSupport
getProtocolDescription
 
Methods inherited from interface com.genesyslab.platform.commons.protocol.AsyncInvokerSupport
setInvoker
 
Methods inherited from interface com.genesyslab.platform.commons.protocol.ConnectionInvokerSupport
setConnectionInvoker
 

Constructor Detail

BasicChatProtocol

public BasicChatProtocol(Endpoint endpoint,
                         long timeout)
Creates instance of BasicChatProtocol.

Parameters:
endpoint - Parameters of the connection to create
timeout - Timeout to wait for message (in milliseconds)

BasicChatProtocol

public BasicChatProtocol(Endpoint endpoint)
Creates instance of BasicChatProtocol.

Parameters:
endpoint - Parameters of the connection to create

BasicChatProtocol

public BasicChatProtocol()
Creates instance of BasicChatProtocol.

Method Detail

getTimeZoneOffset

public int getTimeZoneOffset()
Optional, timezone offset.

Specified by:
getTimeZoneOffset in interface BasicChatProtocolHandshakeOptions
Returns:
timezone offset or null

setTimeZoneOffset

public void setTimeZoneOffset(int timeZoneOffset)
Optional, timezone offset.

Specified by:
setTimeZoneOffset in interface BasicChatProtocolHandshakeOptions
Parameters:
timeZoneOffset - timezone offset

getUserData

public KeyValueCollection getUserData()
Optional, used for user identification in UCS (Universal Contact Server).

Specified by:
getUserData in interface BasicChatProtocolHandshakeOptions
Returns:
user data or null

setUserData

public void setUserData(KeyValueCollection userData)
Optional, used for user identification in UCS (Universal Contact Server).

Specified by:
setUserData in interface BasicChatProtocolHandshakeOptions
Parameters:
userData - user data

getUserNickname

public java.lang.String getUserNickname()
Specified by:
getUserNickname in interface BasicChatProtocolHandshakeOptions

setUserNickname

public void setUserNickname(java.lang.String userNickname)
Specified by:
setUserNickname in interface BasicChatProtocolHandshakeOptions

getUserType

public UserType getUserType()
Specified by:
getUserType in interface BasicChatProtocolHandshakeOptions

setUserType

public void setUserType(UserType userType)
Specified by:
setUserType in interface BasicChatProtocolHandshakeOptions

getPersonId

public java.lang.String getPersonId()
Specified by:
getPersonId in interface BasicChatProtocolHandshakeOptions

setPersonId

public void setPersonId(java.lang.String personId)
Specified by:
setPersonId in interface BasicChatProtocolHandshakeOptions

getUserId

public java.lang.String getUserId()
Specified by:
getUserId in interface BasicChatProtocolHandshakeOptions

setUserId

public void setUserId(java.lang.String userId)
Specified by:
setUserId in interface BasicChatProtocolHandshakeOptions

getSecureKey

public java.lang.String getSecureKey()
Optional, if set with UserId, channel will use it to restore previously registered session.

Specified by:
getSecureKey in interface BasicChatProtocolHandshakeOptions
Returns:
secure key or null

setSecureKey

public void setSecureKey(java.lang.String secureKey)
Optional, if set with UserId, channel will use it to restore previously registered session.

Specified by:
setSecureKey in interface BasicChatProtocolHandshakeOptions
Parameters:
secureKey - secure key

isAutoRegister

public boolean isAutoRegister()
Returns flag for automatic client registration request on connection open.
By default it is enabled, but sometimes it may be required to do some other operations before client registration request, or there is a need to create custom registration request.
In this case user may disable automatic registration and later (after the connection opened) send own registration request.

Specified by:
isAutoRegister in interface BasicChatProtocolHandshakeOptions
Overrides:
isAutoRegister in class OptionalRegistrationChannel
Returns:
flag for automatic client registration request allowing
See Also:
setAutoRegister(boolean), RequestRegister

setAutoRegister

public void setAutoRegister(boolean autoRegister)
Sets flag for automatic client registration request on connection open.
By default it is enabled, but sometimes it may be required to do some other operations before client registration request, or there is a need to create custom registration request.
In this case user may disable automatic registration and later (after the connection opened) send own registration request.

Specified by:
setAutoRegister in interface BasicChatProtocolHandshakeOptions
Overrides:
setAutoRegister in class OptionalRegistrationChannel
Parameters:
autoRegister - flag for automatic client registration request allowing
See Also:
RequestRegister

getServerContext

public BasicChatServerContext getServerContext()
Overrides:
getServerContext in class AbstractChannel

onSend

protected void onSend(Message message)
               throws ProtocolException
Description copied from class: DuplexChannel
Gives to subclass a chance to modify message before sending it to remote party.

Overrides:
onSend in class ClientChannel
Parameters:
message - Message to modify
Throws:
ProtocolException - In the case of an unrecoverable protocol error. Client applications should not try to deal with these exceptions, except for logging or displaying to users or technical administrators. Check the exception cause for more details.

onOpen

protected void onOpen()
               throws ProtocolException
Description copied from class: DuplexChannel
This method is called when channel is opened and just about to call event handler. You usually will need to add some logic here and call super.onOpen() at the end of your method. Please note, that calling super.onOpen() on the thread other then open() was called will most probably result in deadlock for some scenarios (like calling close() inside of onChannelOpened())

Overrides:
onOpen in class OptionalRegistrationChannel
Throws:
ProtocolException - if there are problems during post open operations (e.g. registration)

onClose

protected void onClose(ConnectionClosedEvent event)
Overrides:
onClose in class DuplexChannel

onEventRegistered

protected void onEventRegistered(EventRegistered event)
This method is called on successful response to the client Auto-Registration request.


getDialect

protected com.genesyslab.platform.commons.connection.impl.xml.ProtocolDialect getDialect()
Specified by:
getDialect in class WebmediaChannel

getHandshakeStart

protected ClientChannel.ClientHandshakeStep getHandshakeStart()
Description copied from class: OptionalRegistrationChannel
This virtual method returns initial handshake step for this channel. Used in onOpen() as variable part of "template" pattern.

Specified by:
getHandshakeStart in class OptionalRegistrationChannel
Returns:
handshake initial registration step

Platform SDK Java 8.5 API Reference

Send comments on this topicTechpubs.webadmin@genesys.com.
Document version: 8.5.302.00
Copyright © 2006–2017 Genesys Telecommunications Laboratories, Inc. All rights reserved.