1 28 29 30 package org.objectweb.corba.logservice; 31 32 import org.objectweb.corba.runtime.*; 33 34 41 public class LogSRIImpl 42 extends org.omg.CORBA.LocalObject 43 implements org.omg.PortableInterceptor.ServerRequestInterceptor 44 { 45 private org.omg.IOP.Codec _codec; 47 private int _slot_id; 48 49 public 50 LogSRIImpl(org.omg.IOP.Codec codec, 51 int slotid) 52 { 53 _codec = codec; 54 _slot_id = slotid; 55 } 56 57 61 private void 62 setIdInServiceContext(org.omg.PortableInterceptor.ServerRequestInfo info) 63 { 64 org.omg.CORBA.Any cid = null; 66 try { 67 cid = info.get_slot(_slot_id); 68 } catch (org.omg.PortableInterceptor.InvalidSlot ex) { 69 } 70 71 if (cid==null) { 72 return ; 74 } 75 76 org.omg.IOP.ServiceContext sctx = new org.omg.IOP.ServiceContext (); 78 sctx.context_id = LOG_IOP_SERVICE_ID.value; 79 try { 80 sctx.context_data = _codec.encode(cid); 81 } catch (org.omg.IOP.CodecPackage.InvalidTypeForEncoding ex) { 82 } 83 84 info.add_reply_service_context(sctx, true); 85 } 86 87 91 final public String 92 name() 93 { 94 return "LogSRIImpl"; 95 } 96 97 final public void 98 destroy() 99 { 100 _codec = null; 101 } 102 103 107 final public void 108 receive_request_service_contexts(org.omg.PortableInterceptor.ServerRequestInfo info) 109 throws org.omg.PortableInterceptor.ForwardRequest 110 { 111 System.err.println("### LogSRIImpl::receive_request_service_contexts called"); 112 org.omg.IOP.ServiceContext sctx = null; 114 try { 115 sctx = info.get_request_service_context(LOG_IOP_SERVICE_ID.value); 116 } catch (org.omg.CORBA.SystemException ex) { 117 System.err.println("!!! LogSRIImpl::receive_request_service_contexts: Service context not found"); 118 } 119 120 if (sctx==null) { 121 System.err.println("!!! LogSRIImpl::receive_request_service_contexts: Service context not found"); 122 return ; 123 } 124 125 org.omg.CORBA.Any cid = null; 127 try { 128 cid = _codec.decode(sctx.context_data); 129 } catch (org.omg.IOP.CodecPackage.FormatMismatch ex) { 130 } 131 132 try { 134 info.set_slot(_slot_id, cid); 135 } catch (org.omg.PortableInterceptor.InvalidSlot ex) { 136 } 137 } 138 139 final public void 140 receive_request(org.omg.PortableInterceptor.ServerRequestInfo info) 141 throws org.omg.PortableInterceptor.ForwardRequest 142 { 143 System.err.println("### LogSRIImpl::receive_request called on operation: "+info.operation()); 144 } 145 146 final public void 147 send_reply(org.omg.PortableInterceptor.ServerRequestInfo info) 148 { 149 System.err.println("### LogSRIImpl::send_reply called on operation: "+info.operation()); 150 setIdInServiceContext(info); 152 } 153 154 final public void 155 send_exception(org.omg.PortableInterceptor.ServerRequestInfo info) 156 throws org.omg.PortableInterceptor.ForwardRequest 157 { 158 System.err.println("### LogSRIImpl::send_exception called on operation: "+info.operation()); 159 setIdInServiceContext(info); 161 } 162 163 final public void 164 send_other(org.omg.PortableInterceptor.ServerRequestInfo info) 165 throws org.omg.PortableInterceptor.ForwardRequest 166 { 167 System.err.println("### LogSRIImpl::send_other called on operation: "+info.operation()); 168 setIdInServiceContext(info); 170 } 171 } 172 | Popular Tags |