1 22 package org.jboss.iiop.csiv2; 23 24 32 33 import org.omg.CORBA.LocalObject ; 34 import org.omg.IOP.Codec ; 35 import org.omg.IOP.ENCODING_CDR_ENCAPS ; 36 import org.omg.IOP.Encoding ; 37 import org.omg.PortableInterceptor.ORBInitInfo ; 38 import org.omg.PortableInterceptor.ORBInitInfoPackage.InvalidName ; 39 import org.omg.PortableInterceptor.ORBInitializer ; 40 41 48 public class SASClientInitializer 49 extends LocalObject 50 implements ORBInitializer 51 { 52 53 public SASClientInitializer() 54 { 55 } 57 58 60 public void pre_init(ORBInitInfo info) 61 { 62 try 63 { 64 SASCurrent sasCurrent = new SASCurrentImpl(); 66 info.register_initial_reference("SASCurrent", sasCurrent); 67 68 } 72 catch(InvalidName e) 73 { 74 throw new RuntimeException ("Could not register initial " + 75 "reference for SASCurrent: " + e); 76 } 77 } 78 79 public void post_init(ORBInitInfo info) 80 { 81 try 82 { 83 org.omg.CORBA.Object obj; 84 85 Encoding encoding = new Encoding (ENCODING_CDR_ENCAPS.value, 87 (byte) 1, 88 (byte) 0 ); 89 Codec codec = info.codec_factory().create_codec(encoding); 90 91 obj = info.resolve_initial_references("SASCurrent"); 93 SASCurrentImpl sasCurrentImpl = (SASCurrentImpl) obj; 94 SASClientInterceptor clientInterceptor = 95 new SASClientInterceptor(codec); 96 info.add_client_request_interceptor(clientInterceptor); 97 98 SASTargetInterceptor serverInterceptor = 100 new SASTargetInterceptor(codec); 101 info.add_server_request_interceptor(serverInterceptor); 102 103 sasCurrentImpl.init(serverInterceptor); 105 } 106 catch(Exception e) 107 { 108 throw new RuntimeException ("Unexpected " + e); 109 } 110 } 111 112 } 113 | Popular Tags |