KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > demo > interceptors > ClientInitializer


1 package demo.interceptors;
2
3 import org.omg.PortableInterceptor.*;
4 import org.omg.CosNaming.*;
5
6 /**
7  * This class registers the ClientForwardInterceptor
8  * with the ORB.
9  *
10  * @author Nicolas Noffke
11  * @version
12  */

13
14 public class ClientInitializer
15     extends org.omg.CORBA.LocalObject JavaDoc
16     implements ORBInitializer
17 {
18
19     public ClientInitializer() {
20     }
21
22     /**
23      * This method resolves the NameService and registers the
24      * interceptor.
25      */

26
27     public void post_init(ORBInitInfo info)
28     {
29         try
30         {
31             NamingContextExt nc = NamingContextExtHelper.narrow
32                 (info.resolve_initial_references("NameService"));
33
34             info.add_client_request_interceptor
35                 (new ClientForwardInterceptor(nc));
36         }
37         catch (Exception JavaDoc e)
38         {
39             e.printStackTrace();
40         }
41     }
42
43     public void pre_init(ORBInitInfo info) {
44     }
45 } // ClientInitializer
46
Popular Tags