001    /*
002      Copyright (C) 2001 Lionel Seinturier
003    
004      This program is free software; you can redistribute it and/or modify
005      it under the terms of the GNU Lesser General Public License as
006      published by the Free Software Foundation; either version 2 of the
007      License, or (at your option) any later version.
008    
009      This program is distributed in the hope that it will be useful,
010      but WITHOUT ANY WARRANTY; without even the implied warranty of
011      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
012      GNU Lesser General Public License for more details.
013    
014      You should have received a copy of the GNU Lesser Generaly Public License
015      along with this program; if not, write to the Free Software
016      Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */
017    
018    package org.objectweb.jac.core.dist.rmi;
019    
020    import org.objectweb.jac.core.dist.RemoteRef;
021    
022    import java.rmi.Remote;
023    import java.rmi.RemoteException;
024    
025    /**
026     * RMIRemoteContainerInterf is the interface of RMI remote containers
027     * that are used by jac to remotely instantiate objects.
028     *
029     * @author <a href="http://www-src.lip6.fr/homepages/Lionel.Seinturier/index-eng.html">Lionel Seinturier</a>
030     */
031     
032    public interface RMIRemoteContainerInterf extends Remote {
033       
034       /**
035        * This method instantiates a className object.
036        * Clients call it to remotely instantiate an object.
037        * instantiates creates an object and returns its index.
038        *
039        * @param className  the class name to instantiate
040        * @param args       initialization arguments for the instantiation
041        * @param fields     the object fields that are part of the state
042        * @param state      the state to copy
043        * @param collaboration the collaboration of the client
044        * @return           the index of the className object
045        */
046       
047       int instantiates(String name, String className, Object[] args,
048                        String[] fields, byte[] state, 
049                        byte[] collaboration )
050          throws RemoteException;
051       
052       
053       /**
054        * Copy a state into a base object.
055        *
056        * @param index   the callee index (see org.objectweb.jac.core.JacObject)
057        * @param fields  the object fields that are part of the state
058        * @param state   the state to copy
059        * @param collaboration the collaboration of the client
060        */
061        
062       void copy( String name, int index, String[] fields, byte[] state, 
063                  byte[] collaboration )
064          throws RemoteException;
065    
066    
067       /**
068        * Invoke a method on a base object.
069        * The base object is the remote counterpart of a local object
070        * that has been remotely instantiated by a org.objectweb.jac.dist.Distd daemon.
071        *
072        * @param index       the callee index (see org.objectweb.jac.core.JacObject)
073        * @param methodName  the callee method name
074        * @param methodArgs  the callee method arguments
075        */
076       
077       byte[] invoke( int index, String methodName, byte[] methodArgs, 
078                      byte[] collaboration )
079          throws RemoteException;
080    
081       byte[] invokeRoleMethod( int index, String methodName, 
082                                byte[] methodArgs, 
083                                byte[] collaboration )
084          throws RemoteException;
085    
086       byte[] getByteCodeFor ( String className ) throws RemoteException;
087    
088       /**
089        * Returns a remote reference on the object corresponding to the
090        * given name. */
091    
092       RemoteRef bindTo ( String name ) throws RemoteException;
093    
094    //    /**
095    //     * Get a client stub wrapping chain for a given object.
096    //     *
097    //     * This method is called whenever a daemon receives as a parameter
098    //     * a reference to a remote object, to get the wrapping chain
099    //     * (for instance an authentication wrapper, a verbose wrapper, ...)
100    //     * needed to create a client stub for this remote reference.
101    //     *
102    //     * @param index  the base object index (see org.objectweb.jac.core.JacObject)
103    //     * @return       the client stub wrapping chain as a serialized object
104    //     */
105    //    
106    //    Vector getClientStubWrappingChain( int index ) throws RemoteException;
107    
108    }