Configuration Platform SDK 7.6 API Reference

com.genesyslab.platform.commons.protocol
Class ClientChannel

java.lang.Object
  extended bycom.genesyslab.platform.commons.protocol.AbstractChannel
      extended bycom.genesyslab.platform.commons.protocol.DuplexChannel
          extended bycom.genesyslab.platform.commons.protocol.ClientChannel
All Implemented Interfaces:
AsyncChannel, AsyncInvokerSupport, Channel, ChannelListenerSupport, ConfigurationSupport, ConnectionInvokerSupport, EndpointSupport, InputChannel, InterceptorSupport, MessageReceiver, MessageReceiverManagement, OutputChannel, Protocol, ProtocolDescriptionSupport, Receiver, ReceiverManagement, RequestChannel
Direct Known Subclasses:
ConfServerProtocol

public class ClientChannel
extends DuplexChannel
implements Protocol

ClientChannel is the parent class of all of the Protocol classes used for client applications in the Platform SDK, such as TServerProtocol and ConfServerProtocol.



For Genesys internal use only.


Field Summary
 
Fields inherited from interface com.genesyslab.platform.commons.protocol.Channel
DEFAULT_TIMEOUT, INFINITE_TIMEOUT
 
Fields inherited from interface com.genesyslab.platform.commons.protocol.Receiver
DEF_INPUT_SIZE
 
Constructor Summary
ClientChannel(Endpoint endpoint, ProtocolFactory protocolFactory, ReferenceBuilder refBuilder)
           
ClientChannel(Endpoint endpoint, ProtocolFactory protocolFactory, ReferenceBuilder refBuilder, long timeout)
           
 
Method Summary
 RequestFuture beginRequest(Message message)
          Start request and exit.
 Message endRequest(RequestFuture future)
          Try to finnish request started with beginRequest(Message)
 Message endRequest(RequestFuture future, long timeout)
          Try to finnish request started with beginRequest(Message)
 boolean getCopyResponse()
          Is responce to request() copied to receive queue.
 ReferenceBuilder getReferenceBuilder()
           
 Message request(Message message)
          This synchronous method sends the specified request to the server, and waits for a response from the server for the length of the timeout property.

Here is a sample of how to use the request() method.

 Message request(Message message, long timeout)
          This synchronous method sends the specified request to the server and waits for a response from the server for the length of the specified timeout value.
 void setCopyResponse(boolean copyResponse)
          Is responce to request() copied to receive queue.
 
Methods inherited from class com.genesyslab.platform.commons.protocol.DuplexChannel
beginClose, beginOpen, clearInput, close, close, getInputSize, getInterceptor, getProtocolDescription, open, open, receive, receive, releaseReceivers, resetReceiver, send, setConnectionInvoker, setInputSize, setReceiver, toString
 
Methods inherited from class com.genesyslab.platform.commons.protocol.AbstractChannel
addChannelListener, configure, getConfiguration, getEndpoint, getState, getTimeout, removeChannelListener, setEndpoint, setInvoker, setTimeout
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.genesyslab.platform.commons.protocol.Channel
close, close, getTimeout, open, open, setTimeout
 
Methods inherited from interface com.genesyslab.platform.commons.protocol.AsyncChannel
beginClose, beginOpen, getState
 
Methods inherited from interface com.genesyslab.platform.commons.protocol.ChannelListenerSupport
addChannelListener, removeChannelListener
 
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
send
 
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, setEndpoint
 
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

ClientChannel

public ClientChannel(Endpoint endpoint,
                     ProtocolFactory protocolFactory,
                     ReferenceBuilder refBuilder,
                     long timeout)

ClientChannel

public ClientChannel(Endpoint endpoint,
                     ProtocolFactory protocolFactory,
                     ReferenceBuilder refBuilder)
Method Detail

request

public Message request(Message message)
                throws ProtocolException,
                       java.lang.IllegalStateException
This synchronous method sends the specified request to the server, and waits for a response from the server for the length of the timeout property.

Here is a sample of how to use the request() method.


 Message response =
  interactionServerProtocol.request(requestAgentLogin);
 

Time to waitResponse is set during channel creation or by setTimeout() method. Only referenceable messages can be awaited, so if message doesn't support referencing this method returns null immediately.

Specified by:
request in interface RequestChannel
Parameters:
message - The request to be sent to the server
Returns:
Response message or null if no response implied.
Throws:
ProtocolException - protocol detected problems
java.lang.IllegalStateException - channel is not in appropriate state for requesting (not Opened)

request

public Message request(Message message,
                       long timeout)
                throws ProtocolException,
                       java.lang.IllegalStateException
This synchronous method sends the specified request to the server and waits for a response from the server for the length of the specified timeout value. See request(Message).

Specified by:
request in interface RequestChannel
Parameters:
message - The request to be sent to the server
timeout - Time to waitResponse for responce
Returns:
Response message or null if no response implied or responce is timed out
Throws:
ProtocolException - protocol detected problems
java.lang.IllegalStateException - channel is not in appropriate state for requesting (not Opened)

beginRequest

public RequestFuture beginRequest(Message message)
                           throws ProtocolException,
                                  java.lang.IllegalStateException
Start request and exit. To waitResponse for request result you can use either returned RequestFuture or endRequest(RequestFuture) method.

Specified by:
beginRequest in interface RequestChannel
Parameters:
message - message to request with
Returns:
future object which allow to get result of the request
Throws:
ProtocolException - if sending of the request fails
java.lang.IllegalStateException - if channel is in inapropriate state to execute the request
See Also:
request(Message)

endRequest

public Message endRequest(RequestFuture future)
                   throws ProtocolException
Try to finnish request started with beginRequest(Message)

Specified by:
endRequest in interface RequestChannel
Parameters:
future - future object obtained from beginRequest(Message)
Returns:
message if request is successful or null if there were no response
Throws:
ProtocolException - if there are protocol related problems
See Also:
request(Message)

endRequest

public Message endRequest(RequestFuture future,
                          long timeout)
                   throws ProtocolException
Try to finnish request started with beginRequest(Message)

Specified by:
endRequest in interface RequestChannel
Parameters:
future - future object obtained from beginRequest(Message)
timeout - timeout to waitResponse for response
Returns:
message if request is successful or null if there were no response
Throws:
ProtocolException - if there are protocol related problems
See Also:
request(Message, long)

getCopyResponse

public boolean getCopyResponse()
Description copied from interface: RequestChannel
Is responce to request() copied to receive queue.

Specified by:
getCopyResponse in interface RequestChannel
Returns:
true if responce goes to recieve queue

setCopyResponse

public void setCopyResponse(boolean copyResponse)
Description copied from interface: RequestChannel
Is responce to request() copied to receive queue.

Specified by:
setCopyResponse in interface RequestChannel
Parameters:
copyResponse - true if responce goes to recieve queue

getReferenceBuilder

public ReferenceBuilder getReferenceBuilder()
Specified by:
getReferenceBuilder in interface Protocol

Configuration Platform SDK 7.6 API Reference

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