com.genesyslab.platform.reporting.protocol
Class StatServerProtocol
java.lang.Object
com.genesyslab.platform.commons.protocol.AbstractChannel
com.genesyslab.platform.commons.protocol.DuplexChannel
com.genesyslab.platform.commons.protocol.ClientChannel
com.genesyslab.platform.reporting.protocol.StatServerProtocol
- All Implemented Interfaces:
- AsyncChannel, AsyncChannelOperations, AsyncInvokerSupport, Channel, ChannelListenerSupport, ConfigurationSupport, ConnectionInvokerSupport, EndpointSupport, InputChannel, InterceptorSupport, LogMessageFilterSupport, MessageReceiver, MessageReceiverManagement, OutputChannel, Protocol, ProtocolDescriptionSupport, Receiver, ReceiverManagement, RequestChannel, StatServerProtocolHandshakeOptions
@ProtocolDescription.Tag(sdkName="Reporting",
protocolName="StatServer")
public class StatServerProtocol
- extends ClientChannel
- implements StatServerProtocolHandshakeOptions
Use a StatServerProtocol
object to establish
communication between a client application and Statistics Server.
Here is a sample of how to establish communication with Statistics
Server:
StatServerProtocol statServerProtocol =
new StatServerProtocol(
new Endpoint(
statServerEPName,
host,
port));
statServerProtocol.setClientName(clientName);
statServerProtocol.open();
When you are finished communicating with the server, you can close the
channel like this:
statServerProtocol.close();
Note: Starting from Platform SDK 8.5.0 version, main protocol channel classes
(including StatServerProtocol
) 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.
Method Summary |
protected void |
doSend(Message msg)
Sends the message unconditionally. |
int |
getClientId()
Returns client id for the StatServer connection handshake. |
java.lang.String |
getClientName()
Returns client name for the StatServer connection handshake. |
StatServerContext |
getServerContext()
|
protected void |
onClose(ConnectionClosedEvent event)
|
protected void |
onOpen()
This method is called when channel is opened and just about
to call event handler. |
void |
setClientId(int id)
Sets the StatServer client id for connection handshake procedure. |
void |
setClientName(java.lang.String name)
Sets the StatServer client name for connection handshake procedure. |
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, 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, 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 |
StatServerProtocol
public StatServerProtocol(Endpoint endpoint,
long timeout)
- Creates instance of StatServerProtocol.
- Parameters:
endpoint
- Parameters of the connection to createtimeout
- Timeout to wait for message (in milliseconds)
StatServerProtocol
public StatServerProtocol(Endpoint endpoint)
- Creates instance of StatServerProtocol.
- Parameters:
endpoint
- Parameters of the connection to create
StatServerProtocol
public StatServerProtocol()
- Creates instance of StatServerProtocol.
getClientName
public java.lang.String getClientName()
- Returns client name for the StatServer connection handshake.
Usually it represents application name of this StatServer client.
- Specified by:
getClientName
in interface StatServerProtocolHandshakeOptions
- Returns:
- client name
- See Also:
setClientName(String)
setClientName
public void setClientName(java.lang.String name)
- Sets the StatServer client name for connection handshake procedure.
Usually it represents application name of this StatServer client.
- Specified by:
setClientName
in interface StatServerProtocolHandshakeOptions
- Parameters:
clientName
- client name
getClientId
public int getClientId()
- Returns client id for the StatServer connection handshake.
Usually it represents DBID of this client application.
- Specified by:
getClientId
in interface StatServerProtocolHandshakeOptions
- Returns:
- client id
- See Also:
setClientId(int)
setClientId
public void setClientId(int id)
- Sets the StatServer client id for connection handshake procedure.
Usually it represents DBID of this client application.
- Specified by:
setClientId
in interface StatServerProtocolHandshakeOptions
- Parameters:
clientId
- client id
getServerContext
public StatServerContext getServerContext()
- Overrides:
getServerContext
in class AbstractChannel
- Returns:
- server context instance or null if server is not connected
doSend
protected void doSend(Message msg)
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:
msg
- 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.
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
Send comments on this topicTechpubs.webadmin@genesys.com.
Document version: 8.5.302.00
Copyright © 2006–2017 Genesys Telecommunications Laboratories, Inc. All rights reserved.