KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > enhydra > spi > webxml > WebXmlPRODelegate


1 package org.enhydra.spi.webxml;
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>WebXmlPRODelegate</code> is a fake PortableRemoteObject for
13  * local methods call.
14  */

15 public class WebXmlPRODelegate implements PortableRemoteObjectDelegate JavaDoc {
16
17     /**
18      * Exports a Remote Object.
19      * @param obj Remote object to export.
20      * @exception RemoteException If problem in exporting remote object problem
21      * occures.
22      */

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

31     public void unexportObject(Remote JavaDoc obj) throws NoSuchObjectException JavaDoc {
32     }
33
34     /**
35      * Connection method.
36      * @param target Target remote object.
37      * @param source Another remote object.
38      * @exception RemoteException If the connection fails.
39      */

40     public void connect(Remote JavaDoc target,Remote JavaDoc source) throws RemoteException JavaDoc {
41     }
42
43     /**
44      * Narrow method.
45      * @param obj Object to narrow.
46      * @param newClass Expected type of the result.
47      * @return Object of type newClass.
48      * @exception ClassCastException If the obj class is not compatible with a
49      * newClass cast.
50      */

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

65     public Remote JavaDoc toStub(Remote JavaDoc obj) throws NoSuchObjectException JavaDoc {
66         return obj;
67     }
68 }
69
Popular Tags