1 22 package org.jboss.tm.iiop; 23 24 import org.jboss.util.NestedRuntimeException; 25 import org.omg.CORBA.Any ; 26 import org.omg.CORBA.LocalObject ; 27 import org.omg.CORBA.ORB ; 28 import org.omg.IOP.Codec ; 29 import org.omg.IOP.TaggedComponent ; 30 import org.omg.IOP.CodecPackage.InvalidTypeForEncoding ; 31 import org.omg.PortableInterceptor.IORInfo ; 32 import org.omg.PortableInterceptor.IORInterceptor ; 33 40 public class TxIORInterceptor extends LocalObject implements IORInterceptor 41 { 42 43 static final long serialVersionUID = -1165643346307852265L; 44 45 public static final int TAG_OTS_POLICY = 31; 46 public static final int TAG_INV_POLICY = 32; 47 public static final short EITHER = 0; 48 public static final short ADAPTS = 3; 49 50 private Codec codec; 51 52 public TxIORInterceptor(Codec codec) 53 { 54 this.codec = codec; 55 } 56 57 59 public String name() 60 { 61 return TxIORInterceptor.class.getName(); 62 } 63 64 public void destroy() 65 { 66 } 67 68 public void establish_components(IORInfo info) 69 { 70 try 71 { 72 Any any = ORB.init().create_any(); 74 any.insert_short(EITHER); 75 byte[] taggedComponentData = codec.encode_value(any); 76 info.add_ior_component(new TaggedComponent (TAG_INV_POLICY, taggedComponentData)); 77 any = ORB.init().create_any(); 79 any.insert_short(ADAPTS); 80 taggedComponentData = codec.encode_value(any); 81 info.add_ior_component(new TaggedComponent (TAG_OTS_POLICY, taggedComponentData)); 82 } 83 catch (InvalidTypeForEncoding e) 84 { 85 throw new NestedRuntimeException("Exception during encoding", e); 86 } 87 } 88 } 89 | Popular Tags |