org.objectweb.fractal.rmi.stub
Class MyRmiStubFactory

java.lang.Object
  extended by org.objectweb.fractal.rmi.stub.MyRmiStubFactory
All Implemented Interfaces:
org.objectweb.fractal.api.control.BindingController, SkeletonFactory, StubFactory

public class MyRmiStubFactory
extends java.lang.Object
implements StubFactory, SkeletonFactory, org.objectweb.fractal.api.control.BindingController

A stub and skeleton factory based on ASM. This factory generates the stub and skeleton classes dynamically, when they are needed. It is therefore not necessary for the user to statically generate these classes with a tool such as rmic or idlc.
The stubs and skeletons created by this factory marshall and unmarshall the method invocations by using the following format: a method invocation message contains a four bytes method index, which uniquely and unambiguously identifies a method among the methods provided by a Java interface, followed by the method's arguments, marshalled in the order of their declaration in the method's signature.

In order to be able to manually generate stubs and skeletons before execution and avoid their generation at runtime (typically for performance reasons, although no real testing has been performed), this class can be used as a kind of a stub compiler through its main method, giving as arguments the Java interfaces you want to compile stubs for. Note that this generation is performed at byte code level only, i.e. it takes compiled interfaces as input and generates compiled stubs and skeletons classes. In other words, the interfaces (fully-qualified) names you specify must be compiled and reachable in the classpath, and the result is a corresponding set of stub and skeleton compiled classes (taking current directory as base directory).


Field Summary
protected  org.objectweb.util.monolog.api.Logger logger
          The logger used to log messages.
protected  org.objectweb.util.monolog.api.LoggerFactory loggerFactory
          The optional logger factory used to get a logger for this component.
protected  MarshallerFactory marshallerFactory
          The marshaller factory to be used by the stubs created by this factory.
 
Constructor Summary
MyRmiStubFactory()
          Constructs a new MyRmiStubFactory.
 
Method Summary
 void bindFc(java.lang.String clientItfName, java.lang.Object serverItf)
           
 java.lang.String[] listFc()
           
 java.lang.Object lookupFc(java.lang.String clientItfName)
           
 RequestSession newSkeleton(java.lang.Object target)
          Creates a new skeleton implementing the RequestSession interface.
 java.lang.Object newStub(SessionIdentifier sessionId, Identifier[] ids, Context hints)
          Creates a new stub.
 void unbindFc(java.lang.String clientItfName)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

marshallerFactory

protected MarshallerFactory marshallerFactory
The marshaller factory to be used by the stubs created by this factory.


loggerFactory

protected org.objectweb.util.monolog.api.LoggerFactory loggerFactory
The optional logger factory used to get a logger for this component.


logger

protected org.objectweb.util.monolog.api.Logger logger
The logger used to log messages. May be null.

Constructor Detail

MyRmiStubFactory

public MyRmiStubFactory()
Constructs a new MyRmiStubFactory.

Method Detail

listFc

public java.lang.String[] listFc()
Specified by:
listFc in interface org.objectweb.fractal.api.control.BindingController

lookupFc

public java.lang.Object lookupFc(java.lang.String clientItfName)
Specified by:
lookupFc in interface org.objectweb.fractal.api.control.BindingController

bindFc

public void bindFc(java.lang.String clientItfName,
                   java.lang.Object serverItf)
Specified by:
bindFc in interface org.objectweb.fractal.api.control.BindingController

unbindFc

public void unbindFc(java.lang.String clientItfName)
Specified by:
unbindFc in interface org.objectweb.fractal.api.control.BindingController

newStub

public java.lang.Object newStub(SessionIdentifier sessionId,
                                Identifier[] ids,
                                Context hints)
                         throws JonathanException
Creates a new stub. A stub plays two roles:

Specified by:
newStub in interface StubFactory
Parameters:
sessionId - a session identifier, to be used to send marshalled data to the object represented by the stub;
ids - the set of identifiers of the stub;
hints - other data possibly used to create the stub. This method requires the fully qualified name of the Java interface to which the stub will gives access. This name must be associated to the "interface_type" key.
Returns:
an instance of a sub class of the Stub class.
Throws:
JonathanException - if something goes wrong.

newSkeleton

public RequestSession newSkeleton(java.lang.Object target)
                           throws JonathanException
Description copied from interface: SkeletonFactory
Creates a new skeleton implementing the RequestSession interface.

Specified by:
newSkeleton in interface SkeletonFactory
Parameters:
target - the remote object.
Returns:
the created skeleton.
Throws:
JonathanException - if something goes wrong.


Copyright © 2008 OW2 Consortium. All Rights Reserved.