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