KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jacorb > orb > giop > LocateReplyOutputStream


1 package org.jacorb.orb.giop;
2 /*
3  * JacORB - a free Java ORB
4  *
5  * Copyright (C) 1997-2004 Gerald Brose.
6  *
7  * This library is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Library General Public
9  * License as published by the Free Software Foundation; either
10  * version 2 of the License, or (at your option) any later version.
11  *
12  * This library is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15  * Library General Public License for more details.
16  *
17  * You should have received a copy of the GNU Library General Public
18  * License along with this library; if not, write to the Free
19  * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20  */

21
22 import java.io.*;
23 import org.omg.CORBA.MARSHAL JavaDoc;
24 import org.omg.GIOP.*;
25 import org.jacorb.orb.*;
26
27 /**
28  * @author Gerald Brose, FU Berlin
29  * @version $Id: LocateReplyOutputStream.java,v 1.16 2004/05/06 12:40:00 nicolas Exp $
30  *
31  */

32
33 public class LocateReplyOutputStream
34     extends MessageOutputStream
35 {
36     public LocateReplyOutputStream ( int request_id,
37                                      int status,
38                                      int giop_minor )
39     {
40         super();
41         setGIOPMinor( giop_minor );
42
43         writeGIOPMsgHeader( MsgType_1_1._LocateReply, giop_minor );
44
45         switch( giop_minor )
46         {
47             case 0 :
48             {
49                 // GIOP 1.0 Reply == GIOP 1.1 Reply, fall through
50
}
51             case 1 :
52             {
53                 //this currently doesn't work because GIOP.idl only
54
//allows either LocateStatusType_1_0 or
55
//LocateStatusType_1_2, but not both. The only solution
56
//would be to go low-level and write directly to the
57
//stream
58

59                 //GIOP 1.1
60
LocateReplyHeader_1_0 repl_hdr =
61                 new LocateReplyHeader_1_0( request_id,
62                                            LocateStatusType_1_0.from_int( status ));
63
64                 LocateReplyHeader_1_0Helper.write( this, repl_hdr );
65
66                 break;
67             }
68             case 2 :
69             {
70                 //GIOP 1.2
71
LocateReplyHeader_1_2 repl_hdr =
72                 new LocateReplyHeader_1_2( request_id,
73                                            LocateStatusType_1_2.from_int( status ));
74
75                 LocateReplyHeader_1_2Helper.write( this, repl_hdr );
76
77                 break;
78             }
79             default :
80             {
81                 throw new MARSHAL JavaDoc( "Unknown GIOP minor: " + giop_minor );
82             }
83         }
84     }
85 }
86
Popular Tags