Platform SDK Java 8.5 API Reference

com.genesyslab.platform.management.protocol
Class LocalControlAgentProtocol

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.management.protocol.LocalControlAgentProtocol
All Implemented Interfaces:
AsyncChannel, AsyncChannelOperations, AsyncInvokerSupport, Channel, ChannelListenerSupport, ConfigurationSupport, ConnectionInvokerSupport, EndpointSupport, InputChannel, InterceptorSupport, LogMessageFilterSupport, MessageReceiver, MessageReceiverManagement, OutputChannel, Protocol, ProtocolDescriptionSupport, Receiver, ReceiverManagement, RequestChannel, LocalControlAgentProtocolHandshakeOptions

@ProtocolDescription.Tag(sdkName="Management",
                         protocolName="LocalControlAgent")
public class LocalControlAgentProtocol
extends ClientChannel
implements LocalControlAgentProtocolHandshakeOptions

Use a LocalControlAgentProtocol object to establish communication between a client application and Genesys Local Control Agent.

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

 LocalControlAgentProtocol lcaProtocol =
   new LocalControlAgentProtocol(
     new Endpoint(
       lcaEPName,
       "localhost",
       lcaPort));
 lcaProtocol.setClientName(clientName);
 lcaProtocol.setClientId(clientDbid);
 lcaProtocol.setApplicationType(23);    // - CFGThirdPartyServer
 lcaProtocol.open();
 
When you are finished communicating with the server, you can close the channel like this:
 lcaProtocol.close();
 

Note: Starting from Platform SDK 8.5.0 version, main protocol channel classes (including LocalControlAgentProtocol) 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
 
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
LocalControlAgentProtocol()
          Creates a new LocalControlAgentProtocol object.
LocalControlAgentProtocol(Endpoint endpoint)
          Creates a new LocalControlAgentProtocol object.
LocalControlAgentProtocol(int lcaPort)
           
 
Method Summary
 java.lang.Integer getApplicationType()
          Returns application type handshake property value.
This value represents ordinal integer value of correspondent enumeration value from the Configuration Protocol - CfgAppType.
 KeyValueCollection getAppParams()
          Returns the application AppParams attribute value for the LCA registration request.
 java.lang.Boolean getAutoRestart()
          Returns application AutoRestart attribute value for the LCA registration request.
 java.lang.Integer getCheckTimeInterval()
          Returns the application CheckTimeInterval attribute value for the LCA registration request.
 int getClientId()
          Returns client id for the LCA connection handshake.
 java.lang.String getClientName()
          Returns the LCA (Management Framework integration interface) client name for connection handshake procedure.
 java.lang.String getCmdLine()
          Returns the application command line attribute value for the LCA registration request.
 java.lang.String getCmdParams()
          Returns the application command line parameters attribute value for the LCA registration request.
 java.lang.Integer getControlStatus()
          Returns initial application status value to be reported on the handshake procedure (connection open).
It represents ordinal number of ApplicationStatus enumeration value.
Default value is defined as ApplicationStatus.Initializing.
 ApplicationExecutionMode getExecutionMode()
          Returns initial execution mode value to be reported to LCA on the handshake procedure (connection open).
Default value is ApplicationExecutionMode.Primary.
 int getProcessId()
          Returns the LCA client application PID handshake option value.
By default this value is initialized by try to parse result of java.lang.management.ManagementFactory.getRuntimeMXBean().getName().
 java.lang.Integer getShutdownTimeout()
          Returns the application shutdown timeout attribute value for the LCA registration request.
 java.lang.Integer getStartupTimeout()
          Returns the application startup timeout attribute value for the LCA registration request.
 java.lang.String getVersion()
          Returns the application version attribute value for the LCA registration request.
 java.lang.String getWorkdir()
          Returns the application working directory attribute value for the LCA registration request.
protected  void onClose(ConnectionClosedEvent event)
           
protected  void onOpen()
          This method is called when channel is opened and just about to call event handler.
protected  void onReceiveMessage(Message event)
          Gives to subclass a chance to perform some operations on incoming message arrival before delivering it to connection user code.
protected  void onSetEndpoint(Endpoint endpoint)
          This method is notified before setting a endpoint to the channel.
 void setApplicationType(java.lang.Integer applicationType)
          Sets application type optional handshake property value.
This value represents ordinal integer value of correspondent enumeration value from the Configuration Protocol - CfgAppType.
 void setAppParams(KeyValueCollection appParams)
          Sets the application AppParams attribute value for the LCA registration request.
 void setAutoRestart(java.lang.Boolean autoRestart)
          Sets the application AutoRestart attribute value for the LCA registration request.
 void setCheckTimeInterval(java.lang.Integer checkTimeInterval)
          Sets the application CheckTimeInterval attribute value for the LCA registration request.
 void setClientId(int clientId)
          Sets client id for the LCA connection handshake.
 void setClientName(java.lang.String clientName)
          Sets the LCA (Management Framework integration interface) client name for connection handshake procedure.
 void setCmdLine(java.lang.String cmdLine)
          Sets the application command line attribute value for the LCA registration request.
 void setCmdParams(java.lang.String cmdParams)
          Sets the application command line parameters attribute value for the LCA registration request.
 void setControlStatus(java.lang.Integer appStatus)
          Sets initial application status value to be reported on the handshake procedure (connection open).
It represents ordinal number of ApplicationStatus enumeration value.
Default value is defined as ApplicationStatus.Initializing.
 void setExecutionMode(ApplicationExecutionMode execMode)
          Sets initial execution mode value to be reported to LCA on the handshake procedure (connection open).
Default value is ApplicationExecutionMode.Primary.
 void setProcessId(int processId)
          Sets the LCA client application system process ID to be passed to local LCA for process status control.
By default this value is initialized by try to parse result of java.lang.management.ManagementFactory.getRuntimeMXBean().getName().
 void setShutdownTimeout(java.lang.Integer shutdownTimeout)
          Sets the application shutdown timeout attribute value for the LCA registration request.
 void setStartupTimeout(java.lang.Integer startupTimeout)
          Sets the application startup timeout attribute value for the LCA registration request.
 void setVersion(java.lang.String version)
          Sets the application version attribute value for the LCA registration request.
 void setWorkdir(java.lang.String workdir)
          Sets the application working directory attribute value for the LCA registration request.
 
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, 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, applyConfiguration, cancelCloseTimeout, cancelOpenTimeout, clearInput, close, closeAsync, createChannelClosedEvent, createConnection, 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, getServerContext, getState, getStateMods, getTimeout, internal, 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

LocalControlAgentProtocol

public LocalControlAgentProtocol()
Creates a new LocalControlAgentProtocol object.


LocalControlAgentProtocol

public LocalControlAgentProtocol(Endpoint endpoint)
                          throws ProtocolException
Creates a new LocalControlAgentProtocol object.

Parameters:
endpoint - The endpoint (server) you wish to connect to. It should be only loopback (localhost or ::1).
Throws:
ProtocolException

LocalControlAgentProtocol

public LocalControlAgentProtocol(int lcaPort)
                          throws ProtocolException
Throws:
ProtocolException
Method Detail

onSetEndpoint

protected void onSetEndpoint(Endpoint endpoint)
Description copied from class: AbstractChannel
This method is notified before setting a endpoint to the channel.

Overrides:
onSetEndpoint in class AbstractChannel
Parameters:
endpoint - new endpoint

getClientName

public java.lang.String getClientName()
Returns the LCA (Management Framework integration interface) client name for connection handshake procedure. Usually it represents own application name.

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

setClientName

public void setClientName(java.lang.String clientName)
Sets the LCA (Management Framework integration interface) client name for connection handshake procedure. Usually it represents own application name.

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

setControlStatus

public void setControlStatus(java.lang.Integer appStatus)
Sets initial application status value to be reported on the handshake procedure (connection open).
It represents ordinal number of ApplicationStatus enumeration value.
Default value is defined as ApplicationStatus.Initializing.

Specified by:
setControlStatus in interface LocalControlAgentProtocolHandshakeOptions
Parameters:
appStatus - initial application status
See Also:
ApplicationStatus

getControlStatus

public java.lang.Integer getControlStatus()
Returns initial application status value to be reported on the handshake procedure (connection open).
It represents ordinal number of ApplicationStatus enumeration value.
Default value is defined as ApplicationStatus.Initializing.

Specified by:
getControlStatus in interface LocalControlAgentProtocolHandshakeOptions
Returns:
initial application status
See Also:
setControlStatus(Integer)

setExecutionMode

public void setExecutionMode(ApplicationExecutionMode execMode)
Sets initial execution mode value to be reported to LCA on the handshake procedure (connection open).
Default value is ApplicationExecutionMode.Primary.

Specified by:
setExecutionMode in interface LocalControlAgentProtocolHandshakeOptions
Parameters:
execMode - initial execution mode value
See Also:
ApplicationExecutionMode

getExecutionMode

public ApplicationExecutionMode getExecutionMode()
Returns initial execution mode value to be reported to LCA on the handshake procedure (connection open).
Default value is ApplicationExecutionMode.Primary.

Specified by:
getExecutionMode in interface LocalControlAgentProtocolHandshakeOptions
Returns:
initial execution mode value
See Also:
setExecutionMode(ApplicationExecutionMode), ApplicationExecutionMode

setClientId

public void setClientId(int clientId)
Sets client id for the LCA connection handshake. Usually it represents DBID of this client application.

Specified by:
setClientId in interface LocalControlAgentProtocolHandshakeOptions
Parameters:
clientId - client id

getClientId

public int getClientId()
Returns client id for the LCA connection handshake. Usually it represents DBID of this client application.

Specified by:
getClientId in interface LocalControlAgentProtocolHandshakeOptions
Returns:
client id
See Also:
setClientId(int)

getProcessId

public int getProcessId()
Returns the LCA client application PID handshake option value.
By default this value is initialized by try to parse result of java.lang.management.ManagementFactory.getRuntimeMXBean().getName(). In case of Sun JVM this value looks like "<jvm-pid>@<hostname>".

Specified by:
getProcessId in interface LocalControlAgentProtocolHandshakeOptions
Returns:
LCA client application PID
See Also:
setProcessId(int)

setProcessId

public void setProcessId(int processId)
Sets the LCA client application system process ID to be passed to local LCA for process status control.
By default this value is initialized by try to parse result of java.lang.management.ManagementFactory.getRuntimeMXBean().getName(). In case of Sun JVM this value looks like "<jvm-pid>@<hostname>".

This method can be used if the PID is not properly extracted from the JVM for some reason or there is a need to override its value.

Specified by:
setProcessId in interface LocalControlAgentProtocolHandshakeOptions
Parameters:
processId - LCA client application PID
See Also:
ManagementFactory.getRuntimeMXBean(), RuntimeMXBean.getName()

getApplicationType

public java.lang.Integer getApplicationType()
Returns application type handshake property value.
This value represents ordinal integer value of correspondent enumeration value from the Configuration Protocol - CfgAppType.

Specified by:
getApplicationType in interface LocalControlAgentProtocolHandshakeOptions
Returns:
application type or null
See Also:
setApplicationType(Integer), CfgAppType

setApplicationType

public void setApplicationType(java.lang.Integer applicationType)
Sets application type optional handshake property value.
This value represents ordinal integer value of correspondent enumeration value from the Configuration Protocol - CfgAppType.

Specified by:
setApplicationType in interface LocalControlAgentProtocolHandshakeOptions
Parameters:
applicationType - type of the client application
See Also:
CfgAppType

setAutoRestart

public void setAutoRestart(java.lang.Boolean autoRestart)
Description copied from interface: LocalControlAgentProtocolHandshakeOptions
Sets the application AutoRestart attribute value for the LCA registration request.

Specified by:
setAutoRestart in interface LocalControlAgentProtocolHandshakeOptions
Parameters:
autoRestart - the auto-restart attribute value, or null (default value) to do not send this attribute.

getAutoRestart

public java.lang.Boolean getAutoRestart()
Description copied from interface: LocalControlAgentProtocolHandshakeOptions
Returns application AutoRestart attribute value for the LCA registration request.

Specified by:
getAutoRestart in interface LocalControlAgentProtocolHandshakeOptions
Returns:
the auto-restart attribute value.

setWorkdir

public void setWorkdir(java.lang.String workdir)
Description copied from interface: LocalControlAgentProtocolHandshakeOptions
Sets the application working directory attribute value for the LCA registration request.

Specified by:
setWorkdir in interface LocalControlAgentProtocolHandshakeOptions
Parameters:
workdir - the application working directory attribute value.

getWorkdir

public java.lang.String getWorkdir()
Description copied from interface: LocalControlAgentProtocolHandshakeOptions
Returns the application working directory attribute value for the LCA registration request.

Specified by:
getWorkdir in interface LocalControlAgentProtocolHandshakeOptions
Returns:
the application working directory attribute value.

setCmdLine

public void setCmdLine(java.lang.String cmdLine)
Description copied from interface: LocalControlAgentProtocolHandshakeOptions
Sets the application command line attribute value for the LCA registration request.

Specified by:
setCmdLine in interface LocalControlAgentProtocolHandshakeOptions
Parameters:
cmdLine - the application command line attribute value.

getCmdLine

public java.lang.String getCmdLine()
Description copied from interface: LocalControlAgentProtocolHandshakeOptions
Returns the application command line attribute value for the LCA registration request.

Specified by:
getCmdLine in interface LocalControlAgentProtocolHandshakeOptions
Returns:
the application command line attribute value.

setCmdParams

public void setCmdParams(java.lang.String cmdParams)
Description copied from interface: LocalControlAgentProtocolHandshakeOptions
Sets the application command line parameters attribute value for the LCA registration request.

Specified by:
setCmdParams in interface LocalControlAgentProtocolHandshakeOptions
Parameters:
cmdParams - the application command line parameters attribute value.

getCmdParams

public java.lang.String getCmdParams()
Description copied from interface: LocalControlAgentProtocolHandshakeOptions
Returns the application command line parameters attribute value for the LCA registration request.

Specified by:
getCmdParams in interface LocalControlAgentProtocolHandshakeOptions
Returns:
the application command line parameters attribute value.

setVersion

public void setVersion(java.lang.String version)
Description copied from interface: LocalControlAgentProtocolHandshakeOptions
Sets the application version attribute value for the LCA registration request.

Specified by:
setVersion in interface LocalControlAgentProtocolHandshakeOptions
Parameters:
version - the application version attribute value.

getVersion

public java.lang.String getVersion()
Description copied from interface: LocalControlAgentProtocolHandshakeOptions
Returns the application version attribute value for the LCA registration request.

Specified by:
getVersion in interface LocalControlAgentProtocolHandshakeOptions
Returns:
the application version attribute value.

setAppParams

public void setAppParams(KeyValueCollection appParams)
Description copied from interface: LocalControlAgentProtocolHandshakeOptions
Sets the application AppParams attribute value for the LCA registration request.

Specified by:
setAppParams in interface LocalControlAgentProtocolHandshakeOptions
Parameters:
appParams - the application AppParams attribute value.

getAppParams

public KeyValueCollection getAppParams()
Description copied from interface: LocalControlAgentProtocolHandshakeOptions
Returns the application AppParams attribute value for the LCA registration request.

Specified by:
getAppParams in interface LocalControlAgentProtocolHandshakeOptions
Returns:
the application AppParams attribute value.

setCheckTimeInterval

public void setCheckTimeInterval(java.lang.Integer checkTimeInterval)
Description copied from interface: LocalControlAgentProtocolHandshakeOptions
Sets the application CheckTimeInterval attribute value for the LCA registration request.

Specified by:
setCheckTimeInterval in interface LocalControlAgentProtocolHandshakeOptions
Parameters:
checkTimeInterval - the application CheckTimeInterval attribute value.

getCheckTimeInterval

public java.lang.Integer getCheckTimeInterval()
Description copied from interface: LocalControlAgentProtocolHandshakeOptions
Returns the application CheckTimeInterval attribute value for the LCA registration request.

Specified by:
getCheckTimeInterval in interface LocalControlAgentProtocolHandshakeOptions
Returns:
the application CheckTimeInterval attribute value.

setStartupTimeout

public void setStartupTimeout(java.lang.Integer startupTimeout)
Description copied from interface: LocalControlAgentProtocolHandshakeOptions
Sets the application startup timeout attribute value for the LCA registration request.

Specified by:
setStartupTimeout in interface LocalControlAgentProtocolHandshakeOptions
Parameters:
startupTimeout - the application startup timeout attribute value.

getStartupTimeout

public java.lang.Integer getStartupTimeout()
Description copied from interface: LocalControlAgentProtocolHandshakeOptions
Returns the application startup timeout attribute value for the LCA registration request.

Specified by:
getStartupTimeout in interface LocalControlAgentProtocolHandshakeOptions
Returns:
the application startup timeout attribute value.

setShutdownTimeout

public void setShutdownTimeout(java.lang.Integer shutdownTimeout)
Description copied from interface: LocalControlAgentProtocolHandshakeOptions
Sets the application shutdown timeout attribute value for the LCA registration request.

Specified by:
setShutdownTimeout in interface LocalControlAgentProtocolHandshakeOptions
Parameters:
shutdownTimeout - the application shutdown timeout attribute value.

getShutdownTimeout

public java.lang.Integer getShutdownTimeout()
Description copied from interface: LocalControlAgentProtocolHandshakeOptions
Returns the application shutdown timeout attribute value for the LCA registration request.

Specified by:
getShutdownTimeout in interface LocalControlAgentProtocolHandshakeOptions
Returns:
the application shutdown timeout attribute value.

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 ClientChannel
Throws:
ProtocolException - if there are problems during post open operations (e.g. registration)

onClose

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

onReceiveMessage

protected void onReceiveMessage(Message event)
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:
event - received message

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.