Class ClientXmlRpcHandler

  • All Implemented Interfaces:
    SampXmlRpcHandler

    class ClientXmlRpcHandler
    extends ActorHandler
    SampXmlRpcHandler implementation which passes Standard Profile-like XML-RPC calls to one or more CallableClients to provide client callbacks from the hub.
    Since:
    16 Jul 2008
    Author:
    Mark Taylor
    • Constructor Detail

      • ClientXmlRpcHandler

        public ClientXmlRpcHandler()
        Constructor.
    • 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 operate
        callable - 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 is return 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 the actorType class specified in the constructor does not need to be visible from ActorHandler's package, only from the package where the implementation class lives.

        Specified by:
        invokeMethod in class ActorHandler
        Parameters:
        method - method to invoke
        obj - object to invoke the method on
        args - arguments for the method call
        Throws:
        java.lang.IllegalAccessException
        java.lang.reflect.InvocationTargetException
        See Also:
        Method.invoke(java.lang.Object, java.lang.Object...)