Package org.astrogrid.samp.bridge
Class ProxyManager.ProxyCallableClient
- java.lang.Object
-
- org.astrogrid.samp.bridge.ProxyManager.ProxyCallableClient
-
- All Implemented Interfaces:
CallableClient
- Enclosing class:
- ProxyManager
private class ProxyManager.ProxyCallableClient extends java.lang.Object implements CallableClient
CallableClient implementation used by remote proxy connections on behalf of local clients. This is the core of the proxy manager. Callbacks received by the remote proxy client are tunnelled back to the local hub and forwarded by the local proxy of the remote sender client to the appropriate local non-proxy client. Since local proxies are managed by other proxy managers (this one manages remote proxies of local clients) this means getting the other proxy managers to do some of the work.
-
-
Field Summary
Fields Modifier and Type Field Description private java.lang.StringlocalClientId_private ProxyManagerlocalManager_private ProxyManagerremoteManager_private HubConnectionremoteProxy_
-
Constructor Summary
Constructors Constructor Description ProxyCallableClient(Client localClient, HubConnection remoteProxy, ProxyManager remoteManager)Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private HubConnectiongetLocalProxy(java.lang.String remoteClientId)Returns the hub connection for the proxy on the local hub which corresponds to a given remote client.private voidproxyProcessMessage(java.lang.String remoteSenderId, Message msg)Performs housekeeping tasks for an incoming message if any.voidreceiveCall(java.lang.String remoteSenderId, java.lang.String remoteMsgId, Message msg)Receives a message for which a response is required.voidreceiveNotification(java.lang.String remoteSenderId, Message msg)Receives a message for which no response is required.voidreceiveResponse(java.lang.String remoteResponderId, java.lang.String remoteMsgTag, Response response)Receives a response to a message previously sent by this client.
-
-
-
Field Detail
-
localClientId_
private final java.lang.String localClientId_
-
remoteProxy_
private final HubConnection remoteProxy_
-
remoteManager_
private final ProxyManager remoteManager_
-
localManager_
private final ProxyManager localManager_
-
-
Constructor Detail
-
ProxyCallableClient
ProxyCallableClient(Client localClient, HubConnection remoteProxy, ProxyManager remoteManager)
Constructor.- Parameters:
localClient- local clientremoteProxy- hub connection to the remote hub for the proxyremoteManager- remote ProxyManager associated with the hub where this proxy is connected
-
-
Method Detail
-
receiveNotification
public void receiveNotification(java.lang.String remoteSenderId, Message msg) throws SampExceptionDescription copied from interface:CallableClientReceives a message for which no response is required.- Specified by:
receiveNotificationin interfaceCallableClient- Parameters:
remoteSenderId- public ID of sending clientmsg- message- Throws:
SampException
-
receiveCall
public void receiveCall(java.lang.String remoteSenderId, java.lang.String remoteMsgId, Message msg) throws SampExceptionDescription copied from interface:CallableClientReceives a message for which a response is required. The implementation must take care to call the hub'sreplymethod at some future point.- Specified by:
receiveCallin interfaceCallableClient- Parameters:
remoteSenderId- public ID of sending clientremoteMsgId- message identifier for later use with replymsg- message- Throws:
SampException
-
receiveResponse
public void receiveResponse(java.lang.String remoteResponderId, java.lang.String remoteMsgTag, Response response) throws SampExceptionDescription copied from interface:CallableClientReceives a response to a message previously sent by this client.- Specified by:
receiveResponsein interfaceCallableClient- Parameters:
remoteResponderId- public ID of responding clientremoteMsgTag- client-defined tag labelling previously-sent messageresponse- returned response object- Throws:
SampException
-
getLocalProxy
private HubConnection getLocalProxy(java.lang.String remoteClientId)
Returns the hub connection for the proxy on the local hub which corresponds to a given remote client.- Parameters:
remoteClientId- client ID of remote client- Returns:
- hub connection for local proxy
-
proxyProcessMessage
private void proxyProcessMessage(java.lang.String remoteSenderId, Message msg)Performs housekeeping tasks for an incoming message if any. This is in addition to forwarding the message to the client for which we are proxying.- Parameters:
remoteSenderId- id of sending client on remote hubmsg- message
-
-