org.clazzes.remoting
Interface RemoteInvoker

All Superinterfaces:
InvocationContext
All Known Implementing Classes:
Client

public interface RemoteInvoker
extends InvocationContext

An invoker for remote methods.

Author:
wglas

Method Summary
 void connect()
          Connect to the remote resource.
 void deregisterBroadcastHandler(java.lang.String subSystem)
          Deregister a broadcast handler previously added with registerBroadcastHandler(String, OneWayHandler).
 void deregisterCallback(java.rmi.server.UID handlerUID)
          Deregister a callback previously added with registerCallback(InvocationHandler).
 void disconnect()
          Disconnect from the remote resource.
 OneWayHandler getBroadcastHandler(java.lang.String subSystem)
          Get a broadcast handler previously added with registerBroadcastHandler(String, OneWayHandler).
 InvocationHandler getCallback(java.rmi.server.UID handlerUID)
          Get a callback previously added with registerCallback(InvocationHandler).
 java.lang.Object invoke(java.lang.String subSystem, java.lang.Object arg, java.util.Map<java.lang.String,java.lang.Object> metadata)
           
 boolean isConnected()
           
 ClassBytes loadClass(java.lang.String className)
          Request a binary class from the server.
 void registerBroadcastHandler(java.lang.String subSystem, OneWayHandler handler)
           
 java.rmi.server.UID registerCallback(InvocationHandler handler)
           
 
Methods inherited from interface org.clazzes.remoting.InvocationContext
getClientUID
 

Method Detail

invoke

java.lang.Object invoke(java.lang.String subSystem,
                        java.lang.Object arg,
                        java.util.Map<java.lang.String,java.lang.Object> metadata)
                        throws java.lang.reflect.InvocationTargetException,
                               java.io.IOException
Parameters:
subSystem - The subsystem, on which the method is invoked.
arg - The argument passed to the invocation handler.
metadata - The metadata accompanying the remote call, which is passed to the invocation handler. Metadata may be used to communicate authorization information such as user/password or a session Id.
Returns:
The result of the operation.
Throws:
java.lang.reflect.InvocationTargetException - If InvocationHandler.invoke(InvocationContext, Object, Map) on the server threw an exception. The exception of the server may be retrieved by InvocationTargetException.getCause().
java.io.IOException - Upon errors in the transport layer-

loadClass

ClassBytes loadClass(java.lang.String className)
                     throws java.io.IOException
Request a binary class from the server.

Parameters:
className - The fully qualified name of the class to load.
Returns:
The binary class.
Throws:
java.io.IOException - Upon errors in the transport layer-

registerCallback

java.rmi.server.UID registerCallback(InvocationHandler handler)
Parameters:
handler - An invocation handler for the given callback.
Returns:
The unique ID of the registered handler. The ID is unique in the context of the virtual machine of the client, so the server must be aware of the fact, that multiple clients may register callbacks with the same client side UID.

deregisterCallback

void deregisterCallback(java.rmi.server.UID handlerUID)
Deregister a callback previously added with registerCallback(InvocationHandler).

Parameters:
handlerUID - The handler UID of the callback to deregister as returned by {registerCallback(InvocationHandler).

getCallback

InvocationHandler getCallback(java.rmi.server.UID handlerUID)
Get a callback previously added with registerCallback(InvocationHandler).

Parameters:
handlerUID - The handler UID of the callback to get as returned by {registerCallback(InvocationHandler).

registerBroadcastHandler

void registerBroadcastHandler(java.lang.String subSystem,
                              OneWayHandler handler)
                              throws java.io.IOException
Parameters:
subSystem - The subsystem for which to register a broadcast handler.
handler - A one way invocation handler for the given subsystem.
Throws:
java.io.IOException

deregisterBroadcastHandler

void deregisterBroadcastHandler(java.lang.String subSystem)
Deregister a broadcast handler previously added with registerBroadcastHandler(String, OneWayHandler).

Parameters:
subSystem - The subsystem for which to deregister a broadcast handler.

getBroadcastHandler

OneWayHandler getBroadcastHandler(java.lang.String subSystem)
Get a broadcast handler previously added with registerBroadcastHandler(String, OneWayHandler).

Parameters:
subSystem - The subsystem for which to get a broadcast handler.

isConnected

boolean isConnected()
Returns:
Whether this invoker is connected to the remote resource. If the return value is true, the server-generated client UID may be retrieved by InvocationContext.getClientUID().

disconnect

void disconnect()
Disconnect from the remote resource.


connect

void connect()
             throws java.io.IOException
Connect to the remote resource.

Throws:
java.io.IOException


Copyright © 2010. All Rights Reserved.