1 20 21 package org.jacorb.orb.giop; 22 23 import org.omg.PortableInterceptor.*; 24 import org.omg.IOP.Codec ; 25 import org.omg.IIOP.*; 26 import org.omg.IOP.*; 27 28 import org.jacorb.orb.*; 29 import org.jacorb.orb.iiop.*; 30 import org.jacorb.orb.portableInterceptor.*; 31 32 import org.apache.avalon.framework.logger.*; 33 34 35 44 45 public class BiDirConnectionServerInterceptor 46 extends DefaultServerInterceptor 47 { 48 private String name = "BiDirConnectionServerInterceptor"; 49 50 private ORB orb = null; 51 private Codec codec = null; 52 private Logger logger; 53 54 private ClientConnectionManager conn_mg = null; 55 56 public BiDirConnectionServerInterceptor( ORB orb, 57 Codec codec ) 58 { 59 this.orb = orb; 60 this.codec = codec; 61 this.logger = orb.getConfiguration().getNamedLogger("jacorb.giop.bidir.interceptor"); 62 63 64 conn_mg = orb.getClientConnectionManager(); 65 } 66 67 public String name() 68 { 69 return name; 70 } 71 72 public void destroy() 73 { 74 } 75 76 public void receive_request_service_contexts( ServerRequestInfo ri ) 77 throws ForwardRequest 78 { 79 if( orb.useBiDirGIOP() ) 80 { 81 ServiceContext ctx = null; 82 83 try 84 { 85 ctx = ri.get_request_service_context( BI_DIR_IIOP.value ); 86 } 87 catch( org.omg.CORBA.BAD_PARAM bp ) 88 { 89 } 91 92 if( ctx == null ) 93 { 94 return; } 96 97 BiDirIIOPServiceContext bidir_ctx = null; 98 99 CDRInputStream cdr_in = 100 new CDRInputStream( orb, ctx.context_data ); 101 102 cdr_in.openEncapsulatedArray(); 103 104 bidir_ctx = 105 BiDirIIOPServiceContextHelper.read( cdr_in ); 106 107 GIOPConnection connection = 108 ((ServerRequestInfoImpl) ri).request.getConnection(); 109 110 for( int i = 0; i < bidir_ctx.listen_points.length; i++ ) 111 { 112 ListenPoint p = bidir_ctx.listen_points[i]; 113 114 IIOPAddress addr = new IIOPAddress (p.host, p.port); 115 116 if (logger.isDebugEnabled()) 117 logger.debug("Client conn. added to target " + addr ); 118 119 conn_mg.addConnection( connection, new IIOPProfile (addr, null) ); 120 } 121 } 122 } 123 } 125 126 127 | Popular Tags |