Platform SDK Java 8.5 API Reference

com.genesyslab.platform.contacts.protocol
Class UniversalContactServerProtocol

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.openmedia.protocol.ExternalServiceProtocol
                  extended by com.genesyslab.platform.contacts.protocol.UniversalContactServerProtocol
All Implemented Interfaces:
AsyncChannel, AsyncChannelOperations, AsyncInvokerSupport, Channel, ChannelListenerSupport, ConfigurationSupport, ConnectionInvokerSupport, EndpointSupport, InputChannel, InterceptorSupport, LogMessageFilterSupport, MessageReceiver, MessageReceiverManagement, OutputChannel, Protocol, ProtocolDescriptionSupport, Receiver, ReceiverManagement, RequestChannel, UniversalContactServerProtocolHandshakeOptions, RequestorInfoSupport

@ProtocolDescription.Tag(sdkName="Contacts",
                         protocolName="ContactServer")
public class UniversalContactServerProtocol
extends ExternalServiceProtocol
implements UniversalContactServerProtocolHandshakeOptions

Use a UniversalContactServerProtocol object to establish communication between an agent application (or other client application) and Universal Contact Server.

Here is a sample of how to establish communication with UCS:

 UniversalContactServerProtocol ucsProtocol =
   new UniversalContactServerProtocol(
     new Endpoint(
       ucsEPName,
       host,
       port));
 ucsProtocol.setClientName(clientName);
 ucsProtocol.open();
 
When you are finished communicating with the server, you can close the channel like this:
 ucsProtocol.close();
 

Note: Starting from Platform SDK 8.5.0 version, main protocol channel classes (including UniversalContactServerProtocol) are no longer "final".
It helps with applications unit testing. At the same time it opens access and allows to override protocols internal protected staff from custom child classes.
Changes or extensions of the protocols functionality in child classes must be done very carefully with clear understanding of affected components and functionality.
Also, protected PSDK methods and elements are not a part of public API, and may be a subject for changes without special notice. So, application, which uses or overrides internal/protected staff, may have compatibility issues on PSDK update.


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
static java.lang.String MULTIBYTES_DEFAULT_KEY
          Deprecated. Use USE_UTF_FOR_RESPONSES (='UseUtfForResponses') constant instead
static ProtocolDescription PROTOCOL_DESCRIPTION
           
static java.lang.String USE_UTF_FOR_REQUESTS
          Optional configuration option.
static java.lang.String USE_UTF_FOR_RESPONSES
          Optional configuration option.
static java.lang.String UTF_STRING_KEY
          Deprecated. Use USE_UTF_FOR_REQUESTS (='UseUtfForRequests') constant instead
 
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
UniversalContactServerProtocol()
          Creates a new UniversalContactServerProtocol object.
UniversalContactServerProtocol(Endpoint endpoint)
          Creates a new UniversalContactServerProtocol object.
UniversalContactServerProtocol(Endpoint endpoint, ReferenceBuilder refBuilder)
          Creates a new UniversalContactServerProtocol object.
 
Method Summary
protected  void applyConfiguration()
           
protected  void doSend(Message message)
          Sends the message unconditionally.
protected static Message fromEsp(DuplexChannel channel, Message esp)
           
 java.lang.String getClientApplicationType()
          Returns client application type for the Universal Contact Server connection.
 java.lang.String getClientName()
          Returns client name for the Universal Contact Server connection handshake.
 ProtocolDescription getProtocolDescription()
           
protected  void onReceiveMessage(Message incom)
          Gives to subclass a chance to perform some operations on incoming message arrival before delivering it to connection user code.
protected static Message processReceivedMessage(DuplexChannel channel, Message incom, ILogger logger)
           
protected static Message processSentMessage(DuplexChannel channel, Message message, boolean useUtf, ReferenceBuilder referenceBuilder)
           
static void registerServiceMethod(java.lang.String service, java.lang.String method)
           
 void setClientApplicationType(java.lang.String clientAppType)
          Sets client application type for the Universal Contact Server connection.
 void setClientName(java.lang.String clientName)
          Sets the Universal Contact Server client name for connection handshake procedure.
protected static Message toEsp(DuplexChannel channel, Message message, boolean useUtfFor)
           
 
Methods inherited from class com.genesyslab.platform.openmedia.protocol.ExternalServiceProtocol
fromEspRequestorInfo, getRequestorInfo, getTKVPrinter, setRequestorInfo, setTKVPrinter, toEspRequestorInfo
 
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, onOpen, onSend, 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, createConnection, createConnectionClosedEvent, doBeginClose, doClose, downgradeConnection, getDefaultRestriction, getEnpointPrefixInfo, getInputSize, getInterceptor, getLocalEndPoint, getLocalEndpointInfo, getLogMessageFilter, getProtocolFactory, getProtocolId, getRemoteEndPoint, getTimeoutException, initPackager, isMessageAllowed, notifyWithObject, onClose, 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, getServerContext, 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.AsyncInvokerSupport
setInvoker
 
Methods inherited from interface com.genesyslab.platform.commons.protocol.ConnectionInvokerSupport
setConnectionInvoker
 

Field Detail

PROTOCOL_DESCRIPTION

public static final ProtocolDescription PROTOCOL_DESCRIPTION

USE_UTF_FOR_RESPONSES

public static final java.lang.String USE_UTF_FOR_RESPONSES
Optional configuration option. If set to false, UCSprotocol will add 'tkv.multibytes'='false' pair in Request KVlist of the message. It is false by default.

See Also:
Constant Field Values

MULTIBYTES_DEFAULT_KEY

@Deprecated
public static final java.lang.String MULTIBYTES_DEFAULT_KEY
Deprecated. Use USE_UTF_FOR_RESPONSES (='UseUtfForResponses') constant instead
See Also:
USE_UTF_FOR_RESPONSES, Constant Field Values

USE_UTF_FOR_REQUESTS

public static final java.lang.String USE_UTF_FOR_REQUESTS
Optional configuration option. If set to true, all string values of each KVlist will be packed as UtfStrings (in "UTF-16BE" encoding), instead of common strings. It is true by default.

See Also:
Constant Field Values

UTF_STRING_KEY

@Deprecated
public static final java.lang.String UTF_STRING_KEY
Deprecated. Use USE_UTF_FOR_REQUESTS (='UseUtfForRequests') constant instead
See Also:
USE_UTF_FOR_REQUESTS, Constant Field Values
Constructor Detail

UniversalContactServerProtocol

public UniversalContactServerProtocol()
Creates a new UniversalContactServerProtocol object.


UniversalContactServerProtocol

public UniversalContactServerProtocol(Endpoint endpoint)
Creates a new UniversalContactServerProtocol object.

Parameters:
endpoint - The endpoint (server) you wish to connect to.

UniversalContactServerProtocol

public UniversalContactServerProtocol(Endpoint endpoint,
                                      ReferenceBuilder refBuilder)
Creates a new UniversalContactServerProtocol object.

Parameters:
endpoint - The endpoint (server) you wish to connect to.
refBuilder - External instance of reference builder to be used.
Method Detail

registerServiceMethod

public static void registerServiceMethod(java.lang.String service,
                                         java.lang.String method)

getProtocolDescription

public ProtocolDescription getProtocolDescription()
Specified by:
getProtocolDescription in interface ProtocolDescriptionSupport
Overrides:
getProtocolDescription in class DuplexChannel

getClientName

public java.lang.String getClientName()
Returns client name for the Universal Contact Server connection handshake. Usually it represents application name of this Universal Contact Server client.

Specified by:
getClientName in interface UniversalContactServerProtocolHandshakeOptions
Returns:
client name
See Also:
setClientName(String)

setClientName

public void setClientName(java.lang.String clientName)
Sets the Universal Contact Server client name for connection handshake procedure. Usually it represents application name of this Universal Contact Server client.

Specified by:
setClientName in interface UniversalContactServerProtocolHandshakeOptions
Parameters:
clientName - client name

getClientApplicationType

public java.lang.String getClientApplicationType()
Returns client application type for the Universal Contact Server connection. Usually it represents application type in Configuration Server.

Specified by:
getClientApplicationType in interface UniversalContactServerProtocolHandshakeOptions
Returns:
client application type
See Also:
setClientApplicationType(String)

setClientApplicationType

public void setClientApplicationType(java.lang.String clientAppType)
Sets client application type for the Universal Contact Server connection. Usually it represents application type in Configuration Server.

Specified by:
setClientApplicationType in interface UniversalContactServerProtocolHandshakeOptions
Parameters:
clientAppType - client application type

applyConfiguration

protected void applyConfiguration()
Overrides:
applyConfiguration in class DuplexChannel

doSend

protected void doSend(Message message)
               throws ProtocolException
Description copied from class: DuplexChannel
Sends the message unconditionally. Doesn't check channel state. Use with caution. Intended for using in registration process.

Overrides:
doSend in class DuplexChannel
Parameters:
message - message to send
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.

processSentMessage

protected static Message processSentMessage(DuplexChannel channel,
                                            Message message,
                                            boolean useUtf,
                                            ReferenceBuilder referenceBuilder)
                                     throws ProtocolException
Throws:
ProtocolException

toEsp

protected static Message toEsp(DuplexChannel channel,
                               Message message,
                               boolean useUtfFor)
                        throws ProtocolException
Throws:
ProtocolException

onReceiveMessage

protected void onReceiveMessage(Message incom)
Description copied from class: DuplexChannel
Gives to subclass a chance to perform some operations on incoming message arrival before delivering it to connection user code. We don't use AsyncInvoker here, because the message handling in this class probably doesn't worth it - this method is quick and shouldn't load connection thread too much. But if this method is overridden in some classes and contains some long-running logic, consider using AsyncInvoker

Overrides:
onReceiveMessage in class ClientChannel
Parameters:
incom - received message

processReceivedMessage

protected static Message processReceivedMessage(DuplexChannel channel,
                                                Message incom,
                                                ILogger logger)

fromEsp

protected static Message fromEsp(DuplexChannel channel,
                                 Message esp)

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.