01: package org.jacorb.orb.giop;
02:
03: /*
04: * JacORB - a free Java ORB
05: *
06: * Copyright (C) 1997-2004 Gerald Brose.
07: *
08: * This library is free software; you can redistribute it and/or
09: * modify it under the terms of the GNU Library General Public
10: * License as published by the Free Software Foundation; either
11: * version 2 of the License, or (at your option) any later version.
12: *
13: * This library is distributed in the hope that it will be useful,
14: * but WITHOUT ANY WARRANTY; without even the implied warranty of
15: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16: * Library General Public License for more details.
17: *
18: * You should have received a copy of the GNU Library General Public
19: * License along with this library; if not, write to the Free
20: * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21: */
22:
23: import java.io.*;
24: import org.omg.CORBA.MARSHAL;
25: import org.omg.GIOP.*;
26: import org.jacorb.orb.*;
27:
28: /**
29: * @author Gerald Brose, FU Berlin
30: * @version $Id: LocateReplyOutputStream.java,v 1.16 2004/05/06 12:40:00 nicolas Exp $
31: *
32: */
33:
34: public class LocateReplyOutputStream extends MessageOutputStream {
35: public LocateReplyOutputStream(int request_id, int status,
36: int giop_minor) {
37: super ();
38: setGIOPMinor(giop_minor);
39:
40: writeGIOPMsgHeader(MsgType_1_1._LocateReply, giop_minor);
41:
42: switch (giop_minor) {
43: case 0: {
44: // GIOP 1.0 Reply == GIOP 1.1 Reply, fall through
45: }
46: case 1: {
47: //this currently doesn't work because GIOP.idl only
48: //allows either LocateStatusType_1_0 or
49: //LocateStatusType_1_2, but not both. The only solution
50: //would be to go low-level and write directly to the
51: //stream
52:
53: //GIOP 1.1
54: LocateReplyHeader_1_0 repl_hdr = new LocateReplyHeader_1_0(
55: request_id, LocateStatusType_1_0.from_int(status));
56:
57: LocateReplyHeader_1_0Helper.write(this , repl_hdr);
58:
59: break;
60: }
61: case 2: {
62: //GIOP 1.2
63: LocateReplyHeader_1_2 repl_hdr = new LocateReplyHeader_1_2(
64: request_id, LocateStatusType_1_2.from_int(status));
65:
66: LocateReplyHeader_1_2Helper.write(this , repl_hdr);
67:
68: break;
69: }
70: default: {
71: throw new MARSHAL("Unknown GIOP minor: " + giop_minor);
72: }
73: }
74: }
75: }
|