fulmine.rpc
Interface IRpcPublishOperations

All Known Subinterfaces:
IFrameworkContext, IFulmineContext, IRpcManager, IRpcRegistry
All Known Implementing Classes:
FTContext, FulmineContext, RpcManager, RpcRegistry

public interface IRpcPublishOperations

Exposes publish and unpublish operations for RPCs. Used as a common holder of publish and unpublish methods required in separate RPC class hierarchies.

Author:
Ramon Servadei

Method Summary
 boolean publishProdedure(IRpcHandler handler, IRpcDefinition rpcDefinition)
          Publish the named procedure to all known remote contexts.
 boolean publishRpcs(Class<?> definition, Object handler)
          Allows application code to remotely enable all methods in a handler object that are implementations of methods in an interface definition.
 boolean unpublishProdedure(IRpcDefinition rpcDefinition)
          Unpublish the procedure from all connected remote contexts.
 boolean unpublishRpcs(Class<?> definition, Object handler)
          Allows application code to remove any previously remotely enabled methods published via publishRpcs(Class, Object)
 

Method Detail

publishProdedure

boolean publishProdedure(IRpcHandler handler,
                         IRpcDefinition rpcDefinition)
Publish the named procedure to all known remote contexts.

There can only be one handler per procedure instance. Different handlers can be used for overloaded procedures. RPC definitions cannot overload the result type, if this method is called with a definition that attempts to overload the result type, the operation is ignored and no publish happens.

After this method has completed, remote contexts will be able to invoke the RPC.

Parameters:
handler - the object that will handle any RPC invocations for this RPC definition. This object must be thread safe.
rpcDefinition - the RPC definition
Returns:
true if the procedure was published, false if has already been published

unpublishProdedure

boolean unpublishProdedure(IRpcDefinition rpcDefinition)
Unpublish the procedure from all connected remote contexts.

Parameters:
rpcDefinition - the RPC definition to unpublish
Returns:
true if the procedure was unpublished

publishRpcs

boolean publishRpcs(Class<?> definition,
                    Object handler)
Allows application code to remotely enable all methods in a handler object that are implementations of methods in an interface definition. This essentially publishes these methods as RPCs for other contexts to invoke.

There are some caveats to methods that can be remotely enabled; the method arguments and return types must be scalar and only the following types are supported:

This is a convenience method in-lieu of calling publishProdedure(IRpcHandler, IRpcDefinition).

Parameters:
definition - an interface that defines all the methods in the handler that should be remotely enabled. This includes all methods in the super-interfaces, if any.
handler - the object that implements the methods declared in the definition interface. The handler does not necessarily have to be an instance of the interface (i.e. does not need to explicitly implement the interface, it only needs to implement all the methods). All remote invocations of these methods will be handled by this object. The remotely enabled methods must be thread safe.
Returns:
true if all methods were successfully published
Throws:
IllegalArgumentException - if the handler does not implement all methods declared in the definition

unpublishRpcs

boolean unpublishRpcs(Class<?> definition,
                      Object handler)
Allows application code to remove any previously remotely enabled methods published via publishRpcs(Class, Object)

Parameters:
definition - an interface that defines all the methods in the handler that should be remotely disabled. This includes all methods in the super-interfaces, if any.
handler - the object that implements the methods declared in the definition interface. These methods will no longer be available for remote invocation.
Returns:
true if all methods were successfully unpublished


Copyright © 2007-2009. All Rights Reserved.