KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > enhydra > spi > conf > ConfFilePRODelegate


1 package org.enhydra.spi.conf;
2
3 // rmi import
4
import java.rmi.NoSuchObjectException JavaDoc;
5 import java.rmi.Remote JavaDoc;
6 import java.rmi.RemoteException JavaDoc;
7
8 import javax.rmi.CORBA.PortableRemoteObjectDelegate JavaDoc;
9
10
11 /**
12  * Class <code>ConfFilePRODelegate</code> is a fake PortableRemoteObject for local methods call
13  *
14  */

15 public class ConfFilePRODelegate implements PortableRemoteObjectDelegate JavaDoc {
16
17     /**
18      * Export a Remote Object
19      * @param obj Remote object to export
20      * @exception RemoteException exporting remote object problem
21      */

22     public void exportObject(Remote JavaDoc obj) throws RemoteException JavaDoc {
23
24     }
25
26
27     /**
28      * Method for unexport object
29      * @param obj Remote object to unexport
30      * @exception NoSuchObjectException if the object is not currently exported
31      */

32     public void unexportObject(Remote JavaDoc obj) throws NoSuchObjectException JavaDoc {
33
34     }
35
36     /**
37      * Connection method
38      * @param target a remote object;
39      * @param source another remote object;
40      * @exception RemoteException if the connection fail
41      */

42     public void connect(Remote JavaDoc target,Remote JavaDoc source) throws RemoteException JavaDoc {
43
44     }
45
46
47     /**
48      * Narrow method
49      * @param obj Remote the object to narrow
50      * @param newClass Class the expected type of the result
51      * @return an object of type newClass
52      * @exception ClassCastException if the obj class is not compatible with a newClass cast
53      */

54     public Object JavaDoc narrow(Object JavaDoc obj, Class JavaDoc newClass ) throws ClassCastException JavaDoc {
55     if (newClass.isAssignableFrom(obj.getClass())) {
56         return obj;
57     } else {
58         throw new ClassCastException JavaDoc("Can't cast "+obj.getClass().getName()+" in "+newClass.getName());
59     }
60     }
61
62     /**
63      * To stub method
64      * @return the stub object
65      * @param obj Remote object to unexport
66      * @exception NoSuchObjectException if the object is not currently exported
67      */

68     public Remote JavaDoc toStub(Remote JavaDoc obj) throws NoSuchObjectException JavaDoc {
69         return obj;
70     }
71 }
72
Popular Tags