1 21 package org.jacorb.orb.portableInterceptor; 22 23 import org.omg.PortableInterceptor.*; 24 import org.omg.CORBA.UserException ; 25 26 import org.jacorb.orb.SystemExceptionHelper; 27 28 35 36 public class ClientInterceptorIterator 37 extends RequestInterceptorIterator 38 { 39 public static final short SEND_REQUEST = 0; 40 public static final short SEND_POLL = 1; 41 public static final short RECEIVE_REPLY = 2; 42 public static final short RECEIVE_EXCEPTION = 3; 43 public static final short RECEIVE_OTHER = 4; 44 45 private ClientRequestInfoImpl info = null; 46 47 public ClientInterceptorIterator(Interceptor[] interceptors) 48 { 49 super(interceptors); 50 } 51 52 public void iterate(ClientRequestInfoImpl info, short op) 53 throws UserException 54 { 55 this.info = info; 56 this.op = op; 57 58 setDirection((op == SEND_REQUEST) || (op == SEND_POLL)); 61 62 iterate(); 63 64 if (interceptor_ex != null) 66 if (interceptor_ex instanceof ForwardRequest) 67 throw (ForwardRequest) interceptor_ex; 68 else 69 throw (org.omg.CORBA.SystemException ) interceptor_ex; 70 } 71 72 76 protected void invoke(Interceptor interceptor) 77 throws UserException 78 { 79 info.caller_op = op; 80 81 try 82 { 83 switch (op) 84 { 85 case SEND_REQUEST : 86 ((ClientRequestInterceptor) interceptor).send_request(info); 87 break; 88 case SEND_POLL : 89 ((ClientRequestInterceptor) interceptor).send_poll(info); 90 break; 91 case RECEIVE_REPLY : 92 ((ClientRequestInterceptor) interceptor).receive_reply(info); 93 break; 94 case RECEIVE_EXCEPTION : 95 ((ClientRequestInterceptor) interceptor).receive_exception(info); 96 break; 97 case RECEIVE_OTHER : 98 ((ClientRequestInterceptor) interceptor).receive_other(info); 99 } 100 } 101 catch (ForwardRequest _fwd) 102 { 103 reverseDirection(); 104 op = RECEIVE_OTHER; 105 106 info.reply_status = LOCATION_FORWARD.value; 107 108 info.forward_reference = _fwd.forward; 109 interceptor_ex = _fwd; 110 } 111 catch (org.omg.CORBA.SystemException _sysex) 112 { 113 reverseDirection(); 114 op = RECEIVE_EXCEPTION; 115 interceptor_ex = _sysex; 116 117 SystemExceptionHelper.insert(info.received_exception, _sysex); 118 119 try 120 { 121 info.received_exception_id = SystemExceptionHelper.type(_sysex).id(); 122 } 123 catch(org.omg.CORBA.TypeCodePackage.BadKind _bk) 124 { 125 } 126 } 127 catch (Throwable th) 128 { 129 } 130 131 info.caller_op = op; 132 } 133 } 135 136 | Popular Tags |