Package uk.ac.starlink.ttools.mode
Class ClientRegWatcher
- java.lang.Object
-
- uk.ac.starlink.ttools.mode.ClientRegWatcher
-
- All Implemented Interfaces:
org.astrogrid.samp.client.CallableClient
public class ClientRegWatcher extends java.lang.Object implements org.astrogrid.samp.client.CallableClientCallable client implementation which can watch for registration of a given named application.- Since:
- 9 Jan 2009
- Author:
- Mark Taylor
-
-
Constructor Summary
Constructors Constructor Description ClientRegWatcher(org.astrogrid.samp.client.HubConnection connection)Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.StringgetIdFromName(java.lang.String name)Returns the client ID of a client with a given name if one is registered.org.astrogrid.samp.SubscriptionsgetSubscriptions()Returns the subscriptions object indicating the MTypes this client can handle.voidreceiveCall(java.lang.String senderId, java.lang.String msgId, org.astrogrid.samp.Message msg)voidreceiveNotification(java.lang.String senderId, org.astrogrid.samp.Message msg)voidreceiveResponse(java.lang.String responderId, java.lang.String msgTag, org.astrogrid.samp.Response response)java.lang.StringwaitForIdFromName(java.lang.String name, long waitMillis)Blocks until a client with a given name is regstered, and then returns its client ID.org.astrogrid.samp.ResponsewaitForResponse(java.lang.String msgTag)Blocks until a response with a given tag is received, then returns that response.
-
-
-
Method Detail
-
getSubscriptions
public org.astrogrid.samp.Subscriptions getSubscriptions()
Returns the subscriptions object indicating the MTypes this client can handle.- Returns:
- subscriptions
-
waitForIdFromName
public java.lang.String waitForIdFromName(java.lang.String name, long waitMillis)Blocks until a client with a given name is regstered, and then returns its client ID. If a given timeout value is exceeded, null is returned- Parameters:
name- client name soughtwaitMillis- maximum number of milliseconds to wait- Returns:
- client ID for client with name
name, or null if timeout is exceeded
-
getIdFromName
public java.lang.String getIdFromName(java.lang.String name)
Returns the client ID of a client with a given name if one is registered.- Parameters:
name- client name- Returns:
- ID of client with name
name, or null if none is currently registered
-
waitForResponse
public org.astrogrid.samp.Response waitForResponse(java.lang.String msgTag)
Blocks until a response with a given tag is received, then returns that response.- Parameters:
msgTag- message tag- Returns:
- response
-
receiveCall
public void receiveCall(java.lang.String senderId, java.lang.String msgId, org.astrogrid.samp.Message msg) throws org.astrogrid.samp.client.SampException- Specified by:
receiveCallin interfaceorg.astrogrid.samp.client.CallableClient- Throws:
org.astrogrid.samp.client.SampException
-
receiveNotification
public void receiveNotification(java.lang.String senderId, org.astrogrid.samp.Message msg)- Specified by:
receiveNotificationin interfaceorg.astrogrid.samp.client.CallableClient
-
receiveResponse
public void receiveResponse(java.lang.String responderId, java.lang.String msgTag, org.astrogrid.samp.Response response)- Specified by:
receiveResponsein interfaceorg.astrogrid.samp.client.CallableClient
-
-