org.objectweb.jac.core.dist.rmi
Class RMIRemoteContainer

java.lang.Object
  |
  +--java.rmi.server.RemoteObject
        |
        +--java.rmi.server.RemoteServer
              |
              +--java.rmi.server.UnicastRemoteObject
                    |
                    +--org.objectweb.jac.core.dist.rmi.RMIRemoteContainer
All Implemented Interfaces:
Remote, RMIRemoteContainerInterf, Serializable

public class RMIRemoteContainer
extends UnicastRemoteObject
implements RMIRemoteContainerInterf

RMIRemoteContainer is a container for remote objects that can be accessed with the RMI communication protocol. RMIRemoteContainer delegates most of his job to a RemoteContainer. RMIRemoteContainer instances are created by RMIDistd.

Author:
Lionel Seinturier
See Also:
Serialized Form

Field Summary
protected  RemoteContainer delegate
          The remote container to which most of the job is delegated.
 
Fields inherited from class java.rmi.server.RemoteObject
ref
 
Constructor Summary
RMIRemoteContainer()
          Create a new container.
RMIRemoteContainer(boolean verbose)
          Create a new container.
RMIRemoteContainer(String className, boolean verbose)
          Create a new container.
 
Method Summary
 RemoteRef bindTo(String name)
          Returns a remote reference on the object corresponding to the given name.
 void copy(String name, int index, String[] fields, byte[] state, byte[] collaboration)
          Copy a state into a base object.
 byte[] getByteCodeFor(String className)
           
 RemoteContainer getDelegate()
          Getter method for the delegate field.
 int instantiates(String name, String className, Object[] args, String[] fields, byte[] state, byte[] collaboration)
          This method instantiates a className object.
 byte[] invoke(int index, String methodName, byte[] methodArgs, byte[] collaboration)
          Invoke a method on a base object.
 byte[] invokeRoleMethod(int index, String methodName, byte[] methodArgs, byte[] collaboration)
           
 
Methods inherited from class java.rmi.server.UnicastRemoteObject
clone, exportObject, exportObject, exportObject, unexportObject
 
Methods inherited from class java.rmi.server.RemoteServer
getClientHost, getLog, setLog
 
Methods inherited from class java.rmi.server.RemoteObject
equals, getRef, hashCode, toString, toStub
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

delegate

protected RemoteContainer delegate
The remote container to which most of the job is delegated.

Constructor Detail

RMIRemoteContainer

public RMIRemoteContainer()
                   throws RemoteException
Create a new container.


RMIRemoteContainer

public RMIRemoteContainer(boolean verbose)
                   throws RemoteException
Create a new container.

Parameters:
verbose - true if information messages are to be printed.

RMIRemoteContainer

public RMIRemoteContainer(String className,
                          boolean verbose)
                   throws RemoteException
Create a new container.

Parameters:
className - the name of a class to instantiate
verbose - true if information messages are to be printed.
Method Detail

getDelegate

public RemoteContainer getDelegate()
Getter method for the delegate field.

Returns:
the delegate field value

instantiates

public int instantiates(String name,
                        String className,
                        Object[] args,
                        String[] fields,
                        byte[] state,
                        byte[] collaboration)
                 throws RemoteException
This method instantiates a className object. Clients call it to remotely instantiate an object. instantiates creates an object and returns its index. This method is part of the RMIRemoteContainerInterf interface.

Specified by:
instantiates in interface RMIRemoteContainerInterf
Parameters:
className - the class name to instantiate
args - initialization arguments for the instantiation
fields - the object fields that are part of the state
state - the state to copy
collaboration - the collaboration of the client
Returns:
the index of the className object
RemoteException

copy

public void copy(String name,
                 int index,
                 String[] fields,
                 byte[] state,
                 byte[] collaboration)
          throws RemoteException
Copy a state into a base object. This method is part of the RMIRemoteContainerInterf interface.

Specified by:
copy in interface RMIRemoteContainerInterf
Parameters:
index - the base object index (see org.objectweb.jac.core.JacObject)
fields - the object fields that are part of the state
state - the state to copy
collaboration - the collaboration of the client
RemoteException

invoke

public byte[] invoke(int index,
                     String methodName,
                     byte[] methodArgs,
                     byte[] collaboration)
              throws RemoteException
Invoke a method on a base object. The base object is the remote counterpart of a local object that has been remotely instantiated by a remote container. This method is part of the RMIRemoteContainerInterf interface.

Specified by:
invoke in interface RMIRemoteContainerInterf
Parameters:
index - the callee index (see org.objectweb.jac.core.JacObject)
methodName - the callee method name
methodArgs - the callee method arguments
Returns:
the result
RemoteException

invokeRoleMethod

public byte[] invokeRoleMethod(int index,
                               String methodName,
                               byte[] methodArgs,
                               byte[] collaboration)
                        throws RemoteException
Specified by:
invokeRoleMethod in interface RMIRemoteContainerInterf
RemoteException

getByteCodeFor

public byte[] getByteCodeFor(String className)
                      throws RemoteException
Specified by:
getByteCodeFor in interface RMIRemoteContainerInterf
RemoteException

bindTo

public RemoteRef bindTo(String name)
                 throws RemoteException
Returns a remote reference on the object corresponding to the given name.

Specified by:
bindTo in interface RMIRemoteContainerInterf
RemoteException