1:
37:
38:
39: package ;
40:
41: import ;
42: import ;
43: import ;
44: import ;
45: import ;
46: import ;
47: import ;
48: import ;
49:
50: import ;
51: import ;
52: import ;
53: import ;
54: import ;
55: import ;
56: import ;
57: import ;
58: import ;
59: import ;
60: import ;
61: import ;
62: import ;
63: import ;
64: import ;
65: import ;
66: import ;
67: import ;
68: import ;
69: import ;
70: import ;
71: import ;
72: import ;
73: import ;
74: import ;
75: import ;
76: import ;
77: import ;
78: import ;
79: import ;
80: import ;
81: import ;
82: import ;
83: import ;
84: import ;
85:
86: import ;
87: import ;
88: import ;
89:
90: import ;
91:
92: import ;
93:
94:
99: public class gnuRequest extends Request implements Cloneable
100: {
101:
104: public static Version MAX_SUPPORTED = new Version(1, 2);
105:
106:
110: public static int PAUSE_INITIAL = 50;
111:
112:
116: public static int PAUSE_STEPS = 12;
117:
118:
122: public static int PAUSE_MAX = 1000;
123:
124:
127: ClientRequestInterceptorOperations m_interceptor;
128:
129:
132: ClientRequestInfo m_info = new gnuClientRequestInfo(this);
133:
134:
137: private static final RawReply EMPTY =
138: new RawReply(null, new MessageHeader(), new byte[ 0 ]);
139:
140:
143: protected Context m_context;
144:
145:
148: protected ContextList m_context_list;
149:
150:
154: protected Environment m_environment = new gnuEnvironment();
155:
156:
159: protected ExceptionList m_exceptions = new gnuExceptionList();
160:
161:
164: protected NamedValue m_result = new gnuNamedValue();
165:
166:
169: protected String m_exception_id;
170:
171:
174: protected SystemException m_sys_ex;
175:
176:
179: protected org.omg.CORBA.Object m_target;
180:
181:
184: protected String m_operation;
185:
186:
191: public IOR m_forward_ior;
192:
193:
196: public org.omg.CORBA.Object m_forwarding_target;
197:
198:
202: protected boolean complete;
203:
204:
208: protected boolean oneWay;
209:
210:
214: protected boolean running;
215:
216:
219: protected gnuNVList m_args = new gnuNVList();
220:
221:
225: protected StreamBasedRequest m_parameter_buffer;
226:
227:
230: protected Any[] m_slots;
231:
232:
235: protected RequestHeader m_rqh;
236:
237:
240: protected ReplyHeader m_rph;
241:
242:
245: private IOR ior;
246:
247:
250: private ORB orb;
251:
252:
260: private boolean Big_endian = true;
261:
262:
268: public void setIor(IOR an_ior)
269: {
270: ior = an_ior;
271: setBigEndian(ior.Big_Endian);
272: }
273:
274:
277: gnuRequest redirected;
278:
279:
284: public IOR getIor()
285: {
286: return ior;
287: }
288:
289:
292: public void setORB(ORB an_orb)
293: {
294: orb = an_orb;
295:
296:
297: if (orb instanceof OrbRestricted)
298: m_interceptor = ((OrbRestricted) orb).iClient;
299:
300: if (m_interceptor != null && orb instanceof ORB_1_4)
301: {
302: m_slots = ((ORB_1_4) orb).ic_current.clone_slots();
303: }
304: }
305:
306:
316: public void setBigEndian(boolean use_big_endian)
317: {
318: Big_endian = use_big_endian;
319: }
320:
321:
326: public void setOperation(String operation)
327: {
328: m_operation = operation;
329: }
330:
331:
335: public StreamBasedRequest getParameterStream()
336: {
337: m_parameter_buffer = new StreamBasedRequest();
338: m_parameter_buffer.request = this;
339: m_parameter_buffer.setVersion(ior.Internet.version);
340: m_parameter_buffer.setCodeSet(CodeSetServiceContext.negotiate(ior.Internet.CodeSets));
341: m_parameter_buffer.setOrb(orb);
342: m_parameter_buffer.setBigEndian(Big_endian);
343:
344:
345:
346: if (ior.Internet.version.until_inclusive(1, 1))
347: {
348: BufferedCdrOutput measure = new BufferedCdrOutput();
349: measure.setOffset(12);
350: if (m_rqh == null)
351: m_rqh = new gnu.CORBA.GIOP.v1_0.RequestHeader();
352: m_rqh.operation = m_operation;
353: m_rqh.object_key = ior.key;
354: m_rqh.write(measure);
355: m_parameter_buffer.setOffset(12 + measure.buffer.size());
356: }
357:
358: return m_parameter_buffer;
359: }
360:
361:
364: public gnuRequest Clone()
365: {
366: try
367: {
368: return (gnuRequest) clone();
369: }
370: catch (CloneNotSupportedException ex)
371: {
372: throw new Unexpected(ex);
373: }
374: }
375:
376:
377: public Any add_in_arg()
378: {
379: gnuNamedValue v = new gnuNamedValue();
380: v.setFlags(ARG_IN.value);
381: m_args.add(v);
382: return v.value();
383: }
384:
385:
386: public Any add_inout_arg()
387: {
388: gnuNamedValue v = new gnuNamedValue();
389: v.setFlags(ARG_INOUT.value);
390: m_args.add(v);
391: return v.value();
392: }
393:
394:
395: public Any add_named_in_arg(String name)
396: {
397: gnuNamedValue v = new gnuNamedValue();
398: v.setFlags(ARG_IN.value);
399: v.setName(name);
400: m_args.add(v);
401: return v.value();
402: }
403:
404:
405: public Any add_named_inout_arg(String name)
406: {
407: gnuNamedValue v = new gnuNamedValue();
408: v.setFlags(ARG_INOUT.value);
409: v.setName(name);
410: m_args.add(v);
411: return v.value();
412: }
413:
414:
415: public Any add_named_out_arg(String name)
416: {
417: gnuNamedValue v = new gnuNamedValue();
418: v.setFlags(ARG_OUT.value);
419: v.setName(name);
420: m_args.add(v);
421: return v.value();
422: }
423:
424:
425: public Any add_out_arg()
426: {
427: gnuNamedValue v = new gnuNamedValue();
428: v.setFlags(ARG_OUT.value);
429: m_args.add(v);
430: return v.value();
431: }
432:
433:
434: public NVList arguments()
435: {
436: return m_args;
437: }
438:
439:
440: public ContextList contexts()
441: {
442: return m_context_list;
443: }
444:
445:
446: public Context ctx()
447: {
448: return m_context;
449: }
450:
451:
452: public void ctx(Context a_context)
453: {
454: m_context = a_context;
455: }
456:
457:
458: public Environment env()
459: {
460: return m_environment;
461: }
462:
463:
464: public ExceptionList exceptions()
465: {
466: return m_exceptions;
467: }
468:
469:
470: public void get_response() throws org.omg.CORBA.WrongTransaction
471: {
472:
476: }
477:
478:
492: public synchronized void invoke() throws BAD_INV_ORDER
493: {
494: waitWhileBusy();
495: complete = false;
496: running = true;
497:
498: if (ior == null)
499: throw new BAD_INV_ORDER("Set IOR property first");
500:
501: try
502: {
503: Forwardings:
504: while (true)
505: {
506: try
507: {
508: p_invoke();
509: break Forwardings;
510: }
511: catch (ForwardRequest e)
512: {
513: try
514: {
515: ObjectImpl impl = (ObjectImpl) e.forward;
516: SimpleDelegate delegate =
517: (SimpleDelegate) impl._get_delegate();
518: ior = delegate.getIor();
519: }
520: catch (Exception ex)
521: {
522: BAD_PARAM bad =
523: new BAD_PARAM("Unsupported forwarding target");
524: bad.initCause(ex);
525: throw bad;
526: }
527: }
528: }
529: }
530: finally
531: {
532: running = false;
533: complete = true;
534: }
535: }
536:
537:
538: public String operation()
539: {
540: return m_operation;
541: }
542:
543:
546: public ORB orb()
547: {
548: return orb;
549: }
550:
551:
552: public boolean poll_response()
553: {
554: return complete && !running;
555: }
556:
557:
558: public NamedValue result()
559: {
560: return m_result;
561: }
562:
563:
567: public Any return_value()
568: {
569: return m_result.value();
570: }
571:
572:
573: public synchronized void send_deferred()
574: {
575: waitWhileBusy();
576: new Thread()
577: {
578: public void run()
579: {
580: invoke();
581: }
582: }.start();
583: }
584:
585:
591: public void send_oneway()
592: {
593: final gnuRequest cloned = Clone();
594: cloned.oneWay = true;
595:
596: new Thread()
597: {
598: public void run()
599: {
600: cloned.invoke();
601: }
602: }.start();
603: }
604:
605:
612: public void set_args(NVList a_args)
613: {
614: if (a_args instanceof gnuNVList)
615: m_args = (gnuNVList) a_args;
616: else
617: {
618: try
619: {
620:
621: m_args.list.clear();
622: for (int i = 0; i < a_args.count(); i++)
623: {
624: m_args.add(a_args.item(i));
625: }
626: }
627: catch (Bounds ex)
628: {
629: Unexpected.error(ex);
630: }
631: }
632: }
633:
634:
640: public void set_context_list(ContextList a_context_list)
641: {
642: m_context_list = a_context_list;
643: }
644:
645:
652: public void set_environment(Environment a_environment)
653: {
654: m_environment = a_environment;
655: }
656:
657:
664: public void set_exceptions(ExceptionList a_exceptions)
665: {
666: m_exceptions = a_exceptions;
667: }
668:
669:
674: public void set_operation(String a_operation)
675: {
676: m_operation = a_operation;
677: }
678:
679:
686: public void set_result(NamedValue a_result)
687: {
688: m_result = a_result;
689: }
690:
691:
695: public void set_return_type(TypeCode returns)
696: {
697: if (m_result == null || !returns.equal(m_result.value().type()))
698: {
699: m_result = new gnuNamedValue();
700: m_result.value().type(returns);
701: }
702: }
703:
704:
709: public void set_target(org.omg.CORBA.Object a_target)
710: {
711: m_target = a_target;
712: }
713:
714:
723: public synchronized RawReply submit()
724: throws ForwardRequest
725: {
726: gnu.CORBA.GIOP.MessageHeader header = new gnu.CORBA.GIOP.MessageHeader();
727:
728: header.setBigEndian(Big_endian);
729:
730:
731: header.message_type = gnu.CORBA.GIOP.MessageHeader.REQUEST;
732: header.version = useVersion(ior.Internet.version);
733:
734: RequestHeader rh = header.create_request_header();
735: rh.operation = m_operation;
736: rh.object_key = ior.key;
737:
738:
739: m_rqh = rh;
740:
741: if (m_interceptor != null)
742: m_interceptor.send_request(m_info);
743:
744:
745: BufferedCdrOutput request_part = new BufferedCdrOutput();
746:
747: request_part.setOffset(header.getHeaderSize());
748: request_part.setVersion(header.version);
749: request_part.setCodeSet(CodeSetServiceContext.negotiate(ior.Internet.CodeSets));
750: request_part.setOrb(orb);
751: request_part.setBigEndian(header.isBigEndian());
752:
753:
754:
755: rh.write(request_part);
756:
757: if (m_args != null && m_args.count() > 0)
758: {
759: write_parameters(header, request_part);
760:
761: if (m_parameter_buffer != null)
762: throw new BAD_INV_ORDER("Please either add parameters or "
763: + "write them into stream, but not both " + "at once.");
764: }
765:
766: if (m_parameter_buffer != null)
767: {
768: write_parameter_buffer(header, request_part);
769: }
770:
771:
772: header.message_size = request_part.buffer.size();
773:
774: Socket socket = null;
775:
776: java.lang.Object key = ior.Internet.host + ":" + ior.Internet.port;
777:
778: synchronized (SocketRepository.class)
779: {
780: socket = SocketRepository.get_socket(key);
781: }
782:
783: try
784: {
785: long pause = PAUSE_INITIAL;
786:
787: if (socket == null)
788: {
789:
790:
791: Open: for (int i = 0; i < PAUSE_STEPS; i++)
792: {
793: try
794: {
795: if (orb instanceof OrbFunctional)
796: socket = ((OrbFunctional) orb).socketFactory.
797: createClientSocket(
798: ior.Internet.host, ior.Internet.port);
799: else
800: socket = new Socket(ior.Internet.host, ior.Internet.port);
801: break Open;
802: }
803: catch (IOException ex)
804: {
805: try
806: {
807:
808: System.gc();
809: Thread.sleep(pause);
810: pause = pause * 2;
811: if (pause > PAUSE_MAX)
812: pause = PAUSE_MAX;
813: }
814: catch (InterruptedException iex)
815: {
816: }
817: }
818: }
819: }
820:
821: if (socket == null)
822: throw new NO_RESOURCES(ior.Internet.host + ":" + ior.Internet.port
823: + " in use");
824: socket.setKeepAlive(true);
825:
826: OutputStream socketOutput = socket.getOutputStream();
827:
828:
829: header.write(socketOutput);
830:
831:
832: request_part.buffer.writeTo(socketOutput);
833:
834: socketOutput.flush();
835: if (!socket.isClosed() && !oneWay)
836: {
837: MessageHeader response_header = new MessageHeader();
838: InputStream socketInput = socket.getInputStream();
839: response_header.read(socketInput);
840:
841: byte[] r;
842: if (orb instanceof OrbFunctional)
843: {
844: OrbFunctional fo = (OrbFunctional) orb;
845: r = response_header.readMessage(socketInput, socket,
846: fo.TOUT_WHILE_READING, fo.TOUT_AFTER_RECEIVING);
847: }
848: else
849: r = response_header.readMessage(socketInput, null, 0, 0);
850:
851: return new RawReply(orb, response_header, r);
852: }
853: else
854: return EMPTY;
855: }
856: catch (IOException io_ex)
857: {
858: COMM_FAILURE m = new COMM_FAILURE("Unable to open a socket at "
859: + ior.Internet.host + ":" + ior.Internet.port, 0xC9,
860: CompletionStatus.COMPLETED_NO);
861: m.initCause(io_ex);
862: throw m;
863: }
864: finally
865: {
866: try
867: {
868: if (socket != null && !socket.isClosed())
869: {
870: socket.setSoTimeout(OrbFunctional.TANDEM_REQUESTS);
871: SocketRepository.put_socket(key, socket);
872: }
873: }
874: catch (IOException scx)
875: {
876: InternalError ierr = new InternalError();
877: ierr.initCause(scx);
878: throw ierr;
879: }
880: }
881: }
882:
883:
884: public org.omg.CORBA.Object target()
885: {
886: return m_target;
887: }
888:
889:
894: public Version useVersion(Version desired)
895: {
896: if (desired.until_inclusive(MAX_SUPPORTED.major, MAX_SUPPORTED.minor))
897: return desired;
898: else
899: return MAX_SUPPORTED;
900: }
901:
902:
910: public synchronized void waitWhileBusy()
911: {
912:
913: long wait = 10;
914: long increment = 2;
915: long max = 5000;
916:
917: while (running)
918: {
919: try
920: {
921: Thread.sleep(wait);
922: if (wait < max)
923: wait = wait * increment;
924: }
925: catch (InterruptedException ex)
926: {
927: }
928: }
929: }
930:
931:
935: private void p_invoke()
936: throws SystemException, ForwardRequest
937: {
938: RawReply response = submit();
939:
940:
941: if (oneWay && response == EMPTY)
942: return;
943:
944: if (m_rph == null)
945: m_rph = response.header.create_reply_header();
946:
947: BufferredCdrInput input = response.getStream();
948: input.setOrb(orb);
949:
950: m_rph.read(input);
951:
952:
953: boolean align = response.header.version.since_inclusive(1, 2);
954:
955: switch (m_rph.reply_status)
956: {
957: case ReplyHeader.NO_EXCEPTION:
958:
959: NamedValue arg;
960:
961:
962: if (m_result != null)
963: {
964: if (align)
965: {
966: input.align(8);
967: align = false;
968: }
969: m_result.value().read_value(input, m_result.value().type());
970: }
971:
972:
973: if (m_args != null)
974: for (int i = 0; i < m_args.count(); i++)
975: {
976: try
977: {
978: arg = m_args.item(i);
979:
980:
981: if ((arg.flags() & ARG_OUT.value) != 0)
982: {
983: if (align)
984: {
985: input.align(8);
986: align = false;
987: }
988:
989: arg.value().read_value(input, arg.value().type());
990: }
991: }
992: catch (Bounds ex)
993: {
994: Unexpected.error(ex);
995: }
996: }
997:
998: if (m_interceptor != null)
999: m_interceptor.receive_reply(m_info);
1000:
1001: break;
1002:
1003: case ReplyHeader.SYSTEM_EXCEPTION:
1004: if (align)
1005: {
1006: input.align(8);
1007: align = false;
1008: }
1009: readExceptionId(input);
1010:
1011: m_sys_ex = ObjectCreator.readSystemException(input,
1012: m_rph.service_context);
1013: m_environment.exception(m_sys_ex);
1014:
1015: if (m_interceptor != null)
1016: m_interceptor.receive_exception(m_info);
1017:
1018: throw m_sys_ex;
1019:
1020: case ReplyHeader.USER_EXCEPTION:
1021: if (align)
1022: {
1023: input.align(8);
1024: align = false;
1025: }
1026: readExceptionId(input);
1027:
1028:
1029: gnuAny exc = new gnuAny();
1030: exc.setOrb(orb);
1031:
1032: exc.insert_Streamable(new StreamHolder(input));
1033:
1034: UnknownUserException unuex = new UnknownUserException(exc);
1035: m_environment.exception(unuex);
1036:
1037: if (m_interceptor != null)
1038: m_interceptor.receive_exception(m_info);
1039:
1040: break;
1041:
1042: case ReplyHeader.LOCATION_FORWARD_PERM:
1043: case ReplyHeader.LOCATION_FORWARD:
1044: if (response.header.version.since_inclusive(1, 2))
1045: input.align(8);
1046:
1047: IOR forwarded = new IOR();
1048: try
1049: {
1050: forwarded._read_no_endian(input);
1051: }
1052: catch (IOException ex)
1053: {
1054: new MARSHAL("Cant read forwarding info", 5103,
1055: CompletionStatus.COMPLETED_NO);
1056: }
1057:
1058: setIor(forwarded);
1059:
1060: m_forward_ior = forwarded;
1061:
1062: if (m_interceptor != null)
1063: m_interceptor.receive_other(m_info);
1064:
1065:
1066: p_invoke();
1067: return;
1068:
1069: default:
1070: throw new MARSHAL("Unknow reply status", 8100 + m_rph.reply_status,
1071: CompletionStatus.COMPLETED_NO);
1072: }
1073: }
1074:
1075:
1078: void readExceptionId(BufferredCdrInput input)
1079: {
1080: input.mark(2048);
1081: m_exception_id = input.read_string();
1082: input.reset();
1083: }
1084:
1085:
1093: protected void write_parameter_buffer(MessageHeader header,
1094: BufferedCdrOutput request_part
1095: ) throws MARSHAL
1096: {
1097: try
1098: {
1099: if (header.version.since_inclusive(1, 2))
1100: {
1101: request_part.align(8);
1102: }
1103: m_parameter_buffer.buffer.writeTo(request_part);
1104: }
1105: catch (IOException ex)
1106: {
1107: MARSHAL m = new MARSHAL("Unable to write method arguments to CDR output.");
1108: m.minor = Minor.CDR;
1109: throw m;
1110: }
1111: }
1112:
1113:
1121: protected void write_parameters(MessageHeader header,
1122: BufferedCdrOutput request_part
1123: ) throws MARSHAL
1124: {
1125:
1126: boolean align = header.version.since_inclusive(1, 2);
1127: NamedValue para;
1128:
1129: try
1130: {
1131:
1132: for (int i = 0; i < m_args.count(); i++)
1133: {
1134: para = m_args.item(i);
1135:
1136:
1137: if ((para.flags() & ARG_IN.value) != 0)
1138: {
1139: if (align)
1140: {
1141: request_part.align(8);
1142: align = false;
1143: }
1144: para.value().write_value(request_part);
1145: }
1146: }
1147: }
1148: catch (Bounds ex)
1149: {
1150: InternalError ierr = new InternalError();
1151: ierr.initCause(ex);
1152: throw ierr;
1153: }
1154: }
1155:
1156:
1157:
1158:
1161: public void add_request_service_context(ServiceContext service_context,
1162: boolean replace
1163: )
1164: {
1165: m_rqh.addContext(service_context, replace);
1166: }
1167:
1168:
1171: public TaggedProfile effective_profile()
1172: {
1173: BufferedCdrOutput buf = new BufferedCdrOutput(512);
1174: buf.setOrb(orb);
1175: ior.Internet.write(buf);
1176:
1177: TaggedProfile p = new TaggedProfile();
1178: p.tag = TAG_INTERNET_IOP.value;
1179: p.profile_data = buf.buffer.toByteArray();
1180: return p;
1181: }
1182:
1183:
1186: public org.omg.CORBA.Object effective_target()
1187: {
1188: return new IorObject(orb, ior);
1189: }
1190:
1191:
1194: public TaggedComponent get_effective_component(int id)
1195: throws BAD_PARAM
1196: {
1197: if (id == TAG_CODE_SETS.value)
1198: {
1199:
1200: BufferedCdrOutput buf = new BufferedCdrOutput(512);
1201: buf.setOrb(orb);
1202: ior.Internet.CodeSets.write(buf);
1203:
1204: TaggedComponent t = new TaggedComponent();
1205: t.tag = TAG_CODE_SETS.value;
1206: t.component_data = buf.buffer.toByteArray();
1207: return t;
1208: }
1209: else
1210: {
1211: for (int i = 0; i < ior.Internet.components.size(); i++)
1212: {
1213: TaggedComponent c =
1214: (TaggedComponent) ior.Internet.components.get(i);
1215: if (c.tag == id)
1216: return c;
1217: }
1218: }
1219: throw new BAD_PARAM("No component " + id + " in the Internet profile", 28,
1220: CompletionStatus.COMPLETED_MAYBE
1221: );
1222: }
1223:
1224:
1227: public TaggedComponent[] get_effective_components(int id)
1228: throws BAD_PARAM
1229: {
1230: if (id == TAG_CODE_SETS.value)
1231: return new TaggedComponent[] { get_effective_component(TAG_CODE_SETS.value) };
1232: else
1233: {
1234: ArrayList components = new ArrayList(ior.Internet.components.size());
1235: for (int i = 0; i < ior.Internet.components.size(); i++)
1236: {
1237: TaggedComponent c =
1238: (TaggedComponent) ior.Internet.components.get(i);
1239: if (c.tag == id)
1240: components.add(c);
1241: }
1242: if (components.size() == 0)
1243: throw new BAD_PARAM("No component " + id +
1244: " in the Internet profile", 28, CompletionStatus.COMPLETED_MAYBE
1245: );
1246: else
1247: {
1248: TaggedComponent[] t = new TaggedComponent[ components.size() ];
1249: for (int i = 0; i < t.length; i++)
1250: t [ i ] = (TaggedComponent) components.get(i);
1251: return t;
1252: }
1253: }
1254: }
1255:
1256:
1259: public Policy get_request_policy(int type) throws INV_POLICY
1260: {
1261: throw new NO_IMPLEMENT();
1262: }
1263:
1264:
1265: public String received_exception_id()
1266: {
1267: return m_exception_id;
1268: }
1269:
1270:
1271: public Any received_exception()
1272: {
1273: if (m_exception_id == null)
1274: return null;
1275:
1276: if (m_sys_ex != null)
1277: {
1278: Any a = orb.create_any();
1279: ObjectCreator.insertSysException(a, m_sys_ex);
1280: return a;
1281: }
1282:
1283: Exception mex = m_environment.exception();
1284:
1285: UnknownUserException ex = (UnknownUserException) mex;
1286: if (ex == null)
1287: return null;
1288: else
1289: return ex.except;
1290: }
1291:
1292:
1295: public org.omg.CORBA.Object forward_reference()
1296: {
1297: if (m_forwarding_target != null)
1298: return m_forwarding_target;
1299:
1300: if (m_forward_ior != null)
1301: return new IorObject(orb, m_forward_ior);
1302: else
1303: return null;
1304: }
1305:
1306:
1309: public Any get_slot(int id) throws InvalidSlot
1310: {
1311: try
1312: {
1313: return m_slots [ id ];
1314: }
1315: catch (Exception e)
1316: {
1317: throw new InvalidSlot("slot id " + id + ":" + e);
1318: }
1319: }
1320:
1321:
1324: public short reply_status()
1325: {
1326: if (m_rph == null)
1327: throw new BAD_INV_ORDER("Request not yet sent", 14,
1328: CompletionStatus.COMPLETED_NO
1329: );
1330: return (short) m_rph.reply_status;
1331: }
1332:
1333:
1336: public int request_id()
1337: {
1338: return m_rqh.request_id;
1339: }
1340:
1341:
1344: public boolean response_expected()
1345: {
1346: return !oneWay;
1347: }
1348:
1349:
1358: public short sync_scope()
1359: {
1360: return org.omg.Messaging.SYNC_WITH_TRANSPORT.value;
1361: }
1362:
1363:
1364: public ServiceContext get_request_service_context(int ctx_name)
1365: throws BAD_PARAM
1366: {
1367: return gnu.CORBA.GIOP.ServiceContext.findContext(ctx_name,
1368: m_rqh.service_context
1369: );
1370: }
1371:
1372:
1373: public ServiceContext get_reply_service_context(int ctx_name)
1374: throws BAD_PARAM
1375: {
1376: if (m_rph == null)
1377: throw new BAD_INV_ORDER("Reply context not yet available");
1378: return gnu.CORBA.GIOP.ServiceContext.findContext(ctx_name,
1379: m_rph.service_context
1380: );
1381: }
1382:
1383:
1384: public String[] operation_context()
1385: {
1386: return ice_contexts();
1387: }
1388:
1389:
1392: public String[] ice_contexts()
1393: {
1394: if (m_context_list == null)
1395: return new String[ 0 ];
1396: else
1397: {
1398: try
1399: {
1400: String[] cn = new String[ m_context_list.count() ];
1401: for (int i = 0; i < cn.length; i++)
1402: cn [ i ] = m_context_list.item(i);
1403: return cn;
1404: }
1405: catch (Bounds e)
1406: {
1407: throw new Unexpected(e);
1408: }
1409: }
1410: }
1411:
1412:
1415: public void checkDii()
1416: {
1417: if (m_parameter_buffer != null)
1418: throw new NO_RESOURCES("The invocation method provides " +
1419: "no access to this resource. DII call required.", 1,
1420: CompletionStatus.COMPLETED_MAYBE
1421: );
1422: }
1423: }