KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > carol > rmi > multi > DummyPRODelegate


1 /**
2  * Copyright (C) 2002,2005 - INRIA (www.inria.fr)
3  *
4  * CAROL: Common Architecture for RMI ObjectWeb Layer
5  *
6  * This library is developed inside the ObjectWeb Consortium,
7  * http://www.objectweb.org
8  *
9  * This library is free software; you can redistribute it and/or
10  * modify it under the terms of the GNU Lesser General Public
11  * License as published by the Free Software Foundation; either
12  * version 2.1 of the License, or any later version.
13  *
14  * This library is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17  * Lesser General Public License for more details.
18  *
19  * You should have received a copy of the GNU Lesser General Public
20  * License along with this library; if not, write to the Free Software
21  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
22  * USA
23  *
24  * --------------------------------------------------------------------------
25  * $Id: DummyPRODelegate.java,v 1.1 2005/03/10 16:58:30 benoitf Exp $
26  * --------------------------------------------------------------------------
27  */

28 package org.objectweb.carol.rmi.multi;
29
30 import java.rmi.NoSuchObjectException JavaDoc;
31 import java.rmi.Remote JavaDoc;
32 import java.rmi.RemoteException JavaDoc;
33
34 import javax.rmi.CORBA.PortableRemoteObjectDelegate JavaDoc;
35
36 /**
37  * Class <code>DummyPRODelegate</code> is a fake PortableRemoteObject for local
38  * methods call
39  */

40 public class DummyPRODelegate implements PortableRemoteObjectDelegate JavaDoc {
41
42     /**
43      * Export a Remote Object
44      * @param obj to export
45      * @throws RemoteException exporting remote object problem
46      */

47     public void exportObject(Remote JavaDoc obj) throws RemoteException JavaDoc {
48
49     }
50
51     /**
52      * Method for unexport object
53      * @param obj object to unexport
54      * @throws NoSuchObjectException if the object is not currently exported
55      */

56     public void unexportObject(Remote JavaDoc obj) throws NoSuchObjectException JavaDoc {
57
58     }
59
60     /**
61      * Connection method
62      * @param target a remote object;
63      * @param source another remote object;
64      * @throws RemoteException if the connection fail
65      */

66     public void connect(Remote JavaDoc target, Remote JavaDoc source) throws RemoteException JavaDoc {
67
68     }
69
70     /**
71      * Narrow method
72      * @param obj the object to narrow
73      * @param newClass the expected type of the result
74      * @return an object of type newClass
75      * @throws ClassCastException if the obj class is not compatible with a
76      * newClass cast
77      */

78     public Object JavaDoc narrow(Object JavaDoc obj, Class JavaDoc newClass) throws ClassCastException JavaDoc {
79         if (newClass.isAssignableFrom(obj.getClass())) {
80             return obj;
81         } else {
82             throw new ClassCastException JavaDoc("Can't cast " + obj.getClass().getName() + " in " + newClass.getName());
83         }
84     }
85
86     /**
87      * To stub method
88      * @return the stub object
89      * @param obj to unexport
90      * @throws NoSuchObjectException if the object is not currently exported
91      */

92     public Remote JavaDoc toStub(Remote JavaDoc obj) throws NoSuchObjectException JavaDoc {
93         return obj;
94     }
95 }
Popular Tags