Package org.astrogrid.samp.xmlrpc
Class ClientXmlRpcHandler
- java.lang.Object
-
- org.astrogrid.samp.xmlrpc.ActorHandler
-
- org.astrogrid.samp.xmlrpc.ClientXmlRpcHandler
-
- All Implemented Interfaces:
SampXmlRpcHandler
class ClientXmlRpcHandler extends ActorHandler
SampXmlRpcHandler implementation which passes Standard Profile-like XML-RPC calls to one or moreCallableClient
s to provide client callbacks from the hub.- Since:
- 16 Jul 2008
- Author:
- Mark Taylor
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static class
ClientXmlRpcHandler.ClientActorImpl
Implementation of theClientActor
interface which does the work for this class.private static class
ClientXmlRpcHandler.Entry
Utility class to aggregate information about a client.
-
Field Summary
Fields Modifier and Type Field Description private ClientXmlRpcHandler.ClientActorImpl
clientActor_
private static java.util.logging.Logger
logger_
-
Constructor Summary
Constructors Constructor Description ClientXmlRpcHandler()
Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addClient(HubConnection connection, CallableClient callable)
Adds a CallableClient object to this server.int
getClientCount()
Returns the number of clients currently owned by this handler.protected java.lang.Object
invokeMethod(java.lang.reflect.Method method, java.lang.Object obj, java.lang.Object[] args)
Invokes a method reflectively on an object.void
removeClient(HubConnection connection)
Removes a CallableClient object from this server.-
Methods inherited from class org.astrogrid.samp.xmlrpc.ActorHandler
canHandleCall, getActor, handleCall
-
-
-
-
Field Detail
-
clientActor_
private final ClientXmlRpcHandler.ClientActorImpl clientActor_
-
logger_
private static final java.util.logging.Logger logger_
-
-
Method Detail
-
addClient
public void addClient(HubConnection connection, CallableClient callable)
Adds a CallableClient object to this server.- Parameters:
connection
- hub connection for the registered client on behalf of which the client will operatecallable
- callable client object
-
removeClient
public void removeClient(HubConnection connection)
Removes a CallableClient object from this server.- Parameters:
privateKey
- hub connection for which this client was added
-
getClientCount
public int getClientCount()
Returns the number of clients currently owned by this handler.- Returns:
- client count
-
invokeMethod
protected java.lang.Object invokeMethod(java.lang.reflect.Method method, java.lang.Object obj, java.lang.Object[] args) throws java.lang.IllegalAccessException, java.lang.reflect.InvocationTargetException
Description copied from class:ActorHandler
Invokes a method reflectively on an object. This method should be implemented in the obvious way, that isreturn method.invoke(obj,params)
.If the implementation is effectively prescribed, why is this abstract method here? It's tricky. The reason is so that reflective method invocation from this class is done by code within the actor implementation class itself rather than by code in the superclass,
ActorHandler
. That in turn means that theactorType
class specified in the constructor does not need to be visible fromActorHandler
's package, only from the package where the implementation class lives.- Specified by:
invokeMethod
in classActorHandler
- Parameters:
method
- method to invokeobj
- object to invoke the method onargs
- arguments for the method call- Throws:
java.lang.IllegalAccessException
java.lang.reflect.InvocationTargetException
- See Also:
Method.invoke(java.lang.Object, java.lang.Object...)
-
-