1 28 29 30 package org.objectweb.ccm.runtime; 31 32 import org.objectweb.corba.runtime.*; 33 34 37 public class ClientCallContextImpl 38 extends org.omg.CORBA.LocalObject 39 implements org.coach.ECA.ClientCallContext 40 { 41 static private String _class_name = "ClientCallContextImpl"; 43 private java.util.Hashtable _call_infos; private ORBService _orb_service; 45 private ServicesSet _services_set; 46 private org.omg.CORBA.Object _real_stub; 47 48 public 50 ClientCallContextImpl(ORBService orbs, 51 ServicesSet services, 52 org.omg.CORBA.Object rstub) 53 { 54 _orb_service = orbs; 55 _services_set = services; 56 _real_stub = rstub; 57 _call_infos = new java.util.Hashtable (); 58 } 59 60 64 final public org.coach.ECA.ClientCallController 65 popController() 66 { 67 ClientCallInformation callinfo = (ClientCallInformation)_call_infos.get(Thread.currentThread().getName()); 68 return (org.coach.ECA.ClientCallController)callinfo.controller_stack.pop(); 69 } 70 71 final public void 72 pushController(org.coach.ECA.ClientCallController ctrl) 73 { 74 ClientCallInformation callinfo = (ClientCallInformation)_call_infos.get(Thread.currentThread().getName()); 75 callinfo.controller_stack.push(ctrl); 76 } 77 78 final public boolean 79 isEmpty() 80 { 81 ClientCallInformation callinfo = (ClientCallInformation)_call_infos.get(Thread.currentThread().getName()); 82 return callinfo.controller_stack.isEmpty(); 83 } 84 85 final public void 86 addEntry(CallInformation cinfo, String opname) 87 { 88 ClientCallInformation callinfo = new ClientCallInformation(); 90 91 callinfo.call_information = cinfo; 93 callinfo.result = null; 94 callinfo.system_exception = null; 95 callinfo.user_exception = null; 96 callinfo.eca_call_information.operation_name = opname; 97 98 _call_infos.put(Thread.currentThread().getName(), callinfo); 100 } 101 102 final public void 103 removeEntry() 104 { 105 _call_infos.remove(Thread.currentThread().getName()); 107 } 108 109 final public void 110 setResult(org.omg.CORBA.Any res) 111 { 112 ClientCallInformation callinfo = (ClientCallInformation)_call_infos.get(Thread.currentThread().getName()); 113 callinfo.result = res; 114 } 115 116 120 final public org.coach.ECA.CallInformation 121 call_information() 122 { 123 ClientCallInformation callinfo = (ClientCallInformation)_call_infos.get(Thread.currentThread().getName()); 124 return callinfo.eca_call_information; 125 } 126 127 final public org.omg.CORBA.Any 128 result() 129 { 130 ClientCallInformation callinfo = (ClientCallInformation)_call_infos.get(Thread.currentThread().getName()); 131 return callinfo.result; 132 } 133 134 final public org.omg.CORBA.Any 135 system_exception() 136 { 137 ClientCallInformation callinfo = (ClientCallInformation)_call_infos.get(Thread.currentThread().getName()); 138 return callinfo.system_exception; 139 } 140 141 final public org.omg.CORBA.Any 142 user_exception() 143 { 144 ClientCallInformation callinfo = (ClientCallInformation)_call_infos.get(Thread.currentThread().getName()); 145 return callinfo.user_exception; 146 } 147 148 final public void 149 send_system_exception(org.omg.CORBA.Any exc) 150 { 151 ClientCallInformation callinfo = (ClientCallInformation)_call_infos.get(Thread.currentThread().getName()); 152 callinfo.system_exception = exc; 153 } 154 155 final public void 156 send_user_exception(org.omg.CORBA.Any exc) 157 { 158 ClientCallInformation callinfo = (ClientCallInformation)_call_infos.get(Thread.currentThread().getName()); 159 callinfo.user_exception = exc; 160 } 161 162 final public org.omg.CORBA.Object 163 get_service_internal(String sid, String internal_id) 164 { 165 Service s = _services_set.find_service(sid); 166 if (s==null) { 167 return null; 168 } 169 170 return s.get_service_internal(internal_id); 171 } 172 173 final public org.omg.CORBA.Object 174 get_service_callback(String sid, String callback_id) 175 throws org.coach.ECM.UnknownService, 176 org.coach.ECM.UnknownServiceCallback 177 { 178 181 188 throw new org.coach.ECM.UnknownService(); 189 199 } 200 201 final public org.coach.ECA.Slot 202 get_slot(int slot_id) 203 { 204 return ComponentRuntime.getSlotFactory().getSlot(slot_id); 205 } 206 207 final public org.omg.CORBA.Any 208 create_any() 209 { 210 return _orb_service.create_any(); 211 } 212 213 217 final public org.omg.CORBA.Object 218 target() 219 { 220 return _real_stub; 221 } 222 223 final public org.omg.CORBA.Policy 224 get_request_policy(int ptype) 225 { 226 ClientCallInformation callinfo = (ClientCallInformation)_call_infos.get(Thread.currentThread().getName()); 227 CallInformation cinfo = callinfo.call_information; 228 Policy[] pols = cinfo.policies; 229 for (int i=0;i<pols.length;i++) { 230 if (pols[i].corba_policy().policy_type()==ptype) { 231 return pols[i].corba_policy(); 232 } 233 } 234 235 return null; 236 } 237 } 238 239 class ClientCallInformation 240 { 241 public org.omg.CORBA.Any result; 242 public org.omg.CORBA.Any system_exception; 243 public org.omg.CORBA.Any user_exception; 244 public CallInformation call_information; 245 public java.util.Stack controller_stack; 246 public org.coach.ECA.CallInformation eca_call_information; 247 248 public 249 ClientCallInformation() 250 { 251 result = null; 252 system_exception = null; 253 user_exception = null; 254 call_information = null; 255 controller_stack = new java.util.Stack (); 256 eca_call_information = new org.coach.ECA.CallInformation(); 257 } 258 } 259 | Popular Tags |