Package org.astrogrid.samp.xmlrpc
Class XmlRpcCallableClient
- java.lang.Object
-
- org.astrogrid.samp.xmlrpc.XmlRpcCallableClient
-
- All Implemented Interfaces:
CallableClient
class XmlRpcCallableClient extends java.lang.Object implements CallableClient
CallableClient implementation used to communicate with XML-RPC-based callable clients.- Since:
- 28 Jan 2011
- Author:
- Mark Taylor
-
-
Field Summary
Fields Modifier and Type Field Description private static boolean
isShutdown_
private java.lang.String
privateKey_
private SampXmlRpcClient
xClient_
-
Constructor Summary
Constructors Constructor Description XmlRpcCallableClient(SampXmlRpcClient xClient, java.lang.String privateKey)
Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private void
exec(java.lang.String methodName, java.lang.Object[] params)
Makes an XML-RPC call to the SAMP callable client represented by this receiver.private void
rawExec(java.lang.String fqName, java.util.List paramList)
Actually makes an XML-RPC call to the SAMP callable client represented by this receiver.void
receiveCall(java.lang.String senderId, java.lang.String msgId, Message msg)
Receives a message for which a response is required.void
receiveNotification(java.lang.String senderId, Message msg)
Receives a message for which no response is required.void
receiveResponse(java.lang.String responderId, java.lang.String msgTag, Response response)
Receives a response to a message previously sent by this client.
-
-
-
Field Detail
-
xClient_
private final SampXmlRpcClient xClient_
-
privateKey_
private final java.lang.String privateKey_
-
isShutdown_
private static volatile boolean isShutdown_
-
-
Constructor Detail
-
XmlRpcCallableClient
public XmlRpcCallableClient(SampXmlRpcClient xClient, java.lang.String privateKey)
Constructor.- Parameters:
xClient
- XML-RPC client implementationSAMP
- client's private key
-
-
Method Detail
-
receiveCall
public void receiveCall(java.lang.String senderId, java.lang.String msgId, Message msg) throws SampException
Description copied from interface:CallableClient
Receives a message for which a response is required. The implementation must take care to call the hub'sreply
method at some future point.- Specified by:
receiveCall
in interfaceCallableClient
- Parameters:
senderId
- public ID of sending clientmsgId
- message identifier for later use with replymsg
- message- Throws:
SampException
-
receiveNotification
public void receiveNotification(java.lang.String senderId, Message msg) throws SampException
Description copied from interface:CallableClient
Receives a message for which no response is required.- Specified by:
receiveNotification
in interfaceCallableClient
- Parameters:
senderId
- public ID of sending clientmsg
- message- Throws:
SampException
-
receiveResponse
public void receiveResponse(java.lang.String responderId, java.lang.String msgTag, Response response) throws SampException
Description copied from interface:CallableClient
Receives a response to a message previously sent by this client.- Specified by:
receiveResponse
in interfaceCallableClient
- Parameters:
responderId
- public ID of responding clientmsgTag
- client-defined tag labelling previously-sent messageresponse
- returned response object- Throws:
SampException
-
exec
private void exec(java.lang.String methodName, java.lang.Object[] params) throws SampException
Makes an XML-RPC call to the SAMP callable client represented by this receiver.- Parameters:
methodName
- unqualified SAMP callable client API method nameparams
- array of method parameters- Throws:
SampException
-
rawExec
private void rawExec(java.lang.String fqName, java.util.List paramList) throws java.io.IOException
Actually makes an XML-RPC call to the SAMP callable client represented by this receiver.- Parameters:
fqName
- fully qualified SAMP callable client API method nameparamList
- list of method parameters- Throws:
java.io.IOException
-
-