01: package demo.interceptors;
02:
03: import org.omg.PortableInterceptor.*;
04: import org.omg.CosNaming.*;
05:
06: /**
07: * This class registers the ClientForwardInterceptor
08: * with the ORB.
09: *
10: * @author Nicolas Noffke
11: * @version
12: */
13:
14: public class ClientInitializer extends org.omg.CORBA.LocalObject
15: implements ORBInitializer {
16:
17: public ClientInitializer() {
18: }
19:
20: /**
21: * This method resolves the NameService and registers the
22: * interceptor.
23: */
24:
25: public void post_init(ORBInitInfo info) {
26: try {
27: NamingContextExt nc = NamingContextExtHelper.narrow(info
28: .resolve_initial_references("NameService"));
29:
30: info
31: .add_client_request_interceptor(new ClientForwardInterceptor(
32: nc));
33: } catch (Exception e) {
34: e.printStackTrace();
35: }
36: }
37:
38: public void pre_init(ORBInitInfo info) {
39: }
40: } // ClientInitializer
|