org.objectweb.fractal.rmi
Class RmiProtocol

java.lang.Object
  extended byorg.objectweb.fractal.rmi.RmiProtocol
All Implemented Interfaces:
BindingController, Protocol

public class RmiProtocol
extends Object
implements Protocol, BindingController

Provides a very simple invocation protocol component. This invocation protocol uses only two kinds of messages:

The request identifier is used to associate request and reply messages correctly. The object key identifies the remote object on which the invocation must be performed. The exception flag is used to indicate if a reply contains a normal result or an exception.


Field Summary
protected  NamingContext adapter
          The naming context used to decode the object key contained in request messages.
protected  Logger logger
          The logger used to log messages.
protected  LoggerFactory loggerFactory
          The optional logger factory used to get a logger for this component.
protected  MarshallerFactory marshallerFactory
          The marshaller factory used to create request or reply messages.
protected  Scheduler scheduler
          The scheduler used to synchronized threads for waiting reply messages.
 
Constructor Summary
RmiProtocol()
          Constructs a new RmiProtocol.
 
Method Summary
 void bindFc(String clientItfName, Object serverItf)
          Binds the client interface whose name is given to a server interface.
 ProtocolGraph createProtocolGraph(ProtocolGraph[] subgraphs, Context hints)
          Creates a new protocol graph with a number of given sub protocol graphs.
 SessionIdentifier createSessionIdentifier(Properties info, SessionIdentifier[] next)
          Creates a new session identifier with the provided info.
 boolean isAnInvocationProtocol()
          Returns true if the target protocol is an invocation protocol.
 String[] listFc()
          Returns the names of the client interfaces of the component to which this interface belongs.
 Object lookupFc(String clientItfName)
          Returns the interface to which the given client interface is bound.
 void unbindFc(String clientItfName)
          Unbinds the given client interface.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

adapter

protected NamingContext adapter
The naming context used to decode the object key contained in request messages.


marshallerFactory

protected MarshallerFactory marshallerFactory
The marshaller factory used to create request or reply messages.


scheduler

protected Scheduler scheduler
The scheduler used to synchronized threads for waiting reply messages.


loggerFactory

protected LoggerFactory loggerFactory
The optional logger factory used to get a logger for this component.


logger

protected Logger logger
The logger used to log messages. May be null.

Constructor Detail

RmiProtocol

public RmiProtocol()
Constructs a new RmiProtocol.

Method Detail

listFc

public String[] listFc()
Description copied from interface: BindingController
Returns the names of the client interfaces of the component to which this interface belongs.

Specified by:
listFc in interface BindingController
Returns:
the names of the client interfaces of the component to which this interface belongs.

lookupFc

public Object lookupFc(String clientItfName)
Description copied from interface: BindingController
Returns the interface to which the given client interface is bound. More precisely, returns the server interface to which the client interface whose name is given is bound. This server interface is necessarily in the same address space as the client interface (see bindFc).

Specified by:
lookupFc in interface BindingController
Parameters:
clientItfName - the name of a client interface of the component to which this interface belongs.
Returns:
the server interface to which the given interface is bound, or null if it is not bound.

bindFc

public void bindFc(String clientItfName,
                   Object serverItf)
Description copied from interface: BindingController
Binds the client interface whose name is given to a server interface. More precisely, binds the client interface of the component to which this interface belongs, and whose name is equal to the given name, to the given server interface. The given server interface must be in the same address space as the client interface.

Specified by:
bindFc in interface BindingController
Parameters:
clientItfName - the name of a client interface of the component to which this interface belongs.
serverItf - a server interface.

unbindFc

public void unbindFc(String clientItfName)
Description copied from interface: BindingController
Unbinds the given client interface. More precisely, unbinds the client interface of the component to which this interface belongs, and whose name is equal to the given name.

Specified by:
unbindFc in interface BindingController
Parameters:
clientItfName - the name of a client interface of the component to which this interface belongs.

isAnInvocationProtocol

public boolean isAnInvocationProtocol()
Returns true if the target protocol is an invocation protocol. An invocation protocol is a protocol able to handle invocations, i.e., requests expecting a reply. In practice, this means that calls to the prepareInvocation method on sessions obtained from the target protocol will not raise an InternalException, but perform the appropriate work.

Specified by:
isAnInvocationProtocol in interface Protocol
Returns:
true if the target protocol is an invocation protocol.

createProtocolGraph

public ProtocolGraph createProtocolGraph(ProtocolGraph[] subgraphs,
                                         Context hints)
                                  throws JonathanException
Creates a new protocol graph with a number of given sub protocol graphs.

Specified by:
createProtocolGraph in interface Protocol
Parameters:
subgraphs - the lower-level graphs.
hints - the information required to build the graph.
Returns:
a new ProtocolGraph.
Throws:
JonathanException - if the hints or the subgraphs are invalid for this protocol.

createSessionIdentifier

public SessionIdentifier createSessionIdentifier(Properties info,
                                                 SessionIdentifier[] next)
                                          throws JonathanException
Creates a new session identifier with the provided info.

Specified by:
createSessionIdentifier in interface Protocol
Throws:
JonathanException