1 package org.jacorb.util.tracing; 2 3 23 24 import java.io.PrintStream ; 25 import org.omg.IOP.Codec ; 26 import org.omg.PortableInterceptor.ServerRequestInfo ; 27 import org.omg.PortableInterceptor.ServerRequestInterceptor ; 28 29 public class ServerTraceInterceptor 30 extends org.omg.CORBA.LocalObject 31 implements ServerRequestInterceptor 32 { 33 34 35 private int slot_id; 36 private PrintStream logStream = null; 37 private Codec codec = null; 38 39 public ServerTraceInterceptor( int slot_id, Codec codec ) 40 { 41 this(slot_id, codec, System.out); 42 } 43 44 public ServerTraceInterceptor( int slot_id, Codec codec, 45 PrintStream logStream ) 46 { 47 this.slot_id = slot_id; 48 this.codec = codec; 49 this.logStream = logStream; 50 } 51 52 public String name() 53 { 54 return "ServerTraceInterceptor"; 55 } 56 57 public void destroy() 58 { 59 } 60 61 public void receive_request_service_contexts( ServerRequestInfo ri ) 62 throws org.omg.PortableInterceptor.ForwardRequest 63 { 64 System.out.println("SI in operation <" + ri.operation() + ">"); 65 try 66 { 67 System.out.println("Request for op " + ri.operation()); 68 69 org.omg.IOP.ServiceContext ctx = 70 ri.get_request_service_context( TracingContextID.value ); 71 72 ri.set_slot(slot_id, codec.decode(ctx.context_data)); 73 74 ri.add_reply_service_context( ctx, true ); 75 } 76 catch (org.omg.CORBA.BAD_PARAM bp) 77 { 78 80 System.out.println("ServerRequestInterceptor: " + bp); 81 82 } 83 catch( Exception e ) 84 { 85 System.err.println("No service context in operation <" + ri.operation() + ">"); 86 e.printStackTrace(); 87 } 88 } 89 90 public void receive_request( ServerRequestInfo ri ) 91 throws org.omg.PortableInterceptor.ForwardRequest 92 { 93 } 94 95 public void send_reply(org.omg.PortableInterceptor.ServerRequestInfo ri) 96 { 97 98 } 99 100 public void send_exception(org.omg.PortableInterceptor.ServerRequestInfo ri) 101 throws org.omg.PortableInterceptor.ForwardRequest 102 { 103 104 } 105 106 public void send_other(org.omg.PortableInterceptor.ServerRequestInfo ri) 107 throws org.omg.PortableInterceptor.ForwardRequest 108 { 109 110 } 111 112 113 } 114 | Popular Tags |