KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > test > interceptor > ctx_passing > ServerInitializer


1 package test.interceptor.ctx_passing;
2
3 import org.omg.PortableInterceptor.*;
4 import org.omg.IOP.*;
5
6 /**
7  * ServerInitializer.java
8  *
9  *
10  * Created: Fri Oct 26 11:14:36 2001
11  *
12  * @author Nicolas Noffke
13  * @version $Id: ServerInitializer.java,v 1.3 2001/11/22 15:59:42 prism Exp $
14  */

15
16 public class ServerInitializer
17     extends org.omg.CORBA.LocalObject JavaDoc
18     implements ORBInitializer
19 {
20     public static int slot_id = -1;
21
22     public ServerInitializer ()
23     {
24     }
25
26     // implementation of org.omg.PortableInterceptor.ORBInitializerOperations interface
27

28     /**
29      *
30      * @param param1 <description>
31      */

32     public void pre_init(ORBInitInfo info)
33     {
34     }
35
36     /**
37      *
38      * @param param1 <description>
39      */

40     public void post_init(ORBInitInfo info)
41     {
42         try
43         {
44             slot_id = info.allocate_slot_id();
45         
46             Encoding encoding = new Encoding(ENCODING_CDR_ENCAPS.value,
47                                              (byte) 1, (byte) 0);
48             Codec codec = info.codec_factory().create_codec(encoding);
49         
50             info.add_server_request_interceptor( new ServerInterceptor( slot_id, codec ));
51         }
52         catch( Exception JavaDoc e )
53         {
54             e.printStackTrace();
55         }
56     }
57 }// ServerInitializer
58

59
Popular Tags