Package org.astrogrid.samp.test
Class HubTester.ClientWatcher
- java.lang.Object
-
- org.astrogrid.samp.test.HubTester.ClientWatcher
-
- All Implemented Interfaces:
CallableClient
- Enclosing class:
- HubTester
private static class HubTester.ClientWatcher extends java.lang.Object implements CallableClient
CallableClient implementation which watches hub.event messages concerning the registration and attributes of other clients.
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.MapclientMap_private HubConnectionconnection_private java.lang.Throwableerror_
-
Constructor Summary
Constructors Constructor Description ClientWatcher(HubConnection connection)Constructor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description HubTester.WatchedClientgetClient(java.lang.String id)Returns a WatchedClient object corresponding to a given client public ID.HubConnectiongetConnection()Returns the hub connection used by this client.java.lang.ThrowablegetError()Returns an error if any error has been thrown during processing of hub event messages.static MetadatagetMetadata()Returns a suitable metadata object for this client.static SubscriptionsgetSubscriptions()Returns a suitable subscriptions object for this client.private voidprocessMessage(java.lang.String senderId, Message msg)voidreceiveCall(java.lang.String senderId, java.lang.String msgId, Message msg)Receives a message for which a response is required.voidreceiveNotification(java.lang.String senderId, Message msg)Receives a message for which no response is required.voidreceiveResponse(java.lang.String responderId, java.lang.String msgTag, Response response)Receives a response to a message previously sent by this client.
-
-
-
Field Detail
-
connection_
private final HubConnection connection_
-
clientMap_
private final java.util.Map clientMap_
-
error_
private java.lang.Throwable error_
-
-
Constructor Detail
-
ClientWatcher
ClientWatcher(HubConnection connection)
Constructor.- Parameters:
connection- hub connection
-
-
Method Detail
-
getClient
public HubTester.WatchedClient getClient(java.lang.String id)
Returns a WatchedClient object corresponding to a given client public ID. This will contain information about the hub event messages this watcher has received concerning that client up till now.- Parameters:
id- public id of a client which has been registered- Returns:
- watchedClient object if any messages have been received
about
id, otherwise null
-
getError
public java.lang.Throwable getError()
Returns an error if any error has been thrown during processing of hub event messages.- Returns:
- deferred throwable, or null in case of no problems
-
getConnection
public HubConnection getConnection()
Returns the hub connection used by this client.- Returns:
- hub connection
-
receiveCall
public void receiveCall(java.lang.String senderId, java.lang.String msgId, Message msg)Description 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:
senderId- public ID of sending clientmsgId- message identifier for later use with replymsg- message
-
receiveNotification
public void receiveNotification(java.lang.String senderId, Message msg)Description copied from interface:CallableClientReceives a message for which no response is required.- Specified by:
receiveNotificationin interfaceCallableClient- Parameters:
senderId- public ID of sending clientmsg- message
-
processMessage
private void processMessage(java.lang.String senderId, Message msg) throws java.io.IOException- Throws:
java.io.IOException
-
receiveResponse
public void receiveResponse(java.lang.String responderId, java.lang.String msgTag, Response response)Description copied from interface:CallableClientReceives a response to a message previously sent by this client.- Specified by:
receiveResponsein interfaceCallableClient- Parameters:
responderId- public ID of responding clientmsgTag- client-defined tag labelling previously-sent messageresponse- returned response object
-
getSubscriptions
public static Subscriptions getSubscriptions()
Returns a suitable subscriptions object for this client.- Returns:
- subscriptions
-
getMetadata
public static Metadata getMetadata()
Returns a suitable metadata object for this client.
-
-