KickJava   Java API By Example, From Geeks To Geeks.

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


1 package org.jacorb.orb.giop;
2
3 /*
4  * JacORB - a free Java ORB
5  *
6  * Copyright (C) 1997-2004 Gerald Brose.
7  *
8  * This library is free software; you can redistribute it and/or
9  * 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.jacorb.orb.*;
25 import org.jacorb.orb.giop.*;
26
27 import org.omg.GIOP.*;
28 import org.omg.CORBA.MARSHAL JavaDoc;
29 import org.omg.CORBA.portable.ApplicationException JavaDoc;
30 import org.omg.CORBA.portable.RemarshalException JavaDoc;
31
32 /**
33  * @author Gerald Brose, FU Berlin 1999
34  * @version $Id: LocateReplyInputStream.java,v 1.14 2004/05/06 12:40:00 nicolas Exp $
35  *
36  */

37
38 public class LocateReplyInputStream
39     extends MessageInputStream
40 {
41     public LocateReplyHeader_1_2 rep_hdr = null;
42
43     public LocateReplyInputStream( org.omg.CORBA.ORB JavaDoc orb, byte[] buf )
44     {
45     super( orb, buf );
46
47         //check message type
48
if( buffer[7] != (byte) MsgType_1_1._LocateReply )
49         {
50         throw new MARSHAL JavaDoc("Not a reply!");
51         }
52
53         switch( giop_minor )
54         {
55             case 0 :
56             {
57                 //GIOP 1.0 = GIOP 1.1, fall through
58
}
59             case 1 :
60             {
61
62                 //GIOP 1.1
63
LocateReplyHeader_1_0 hdr =
64                     LocateReplyHeader_1_0Helper.read( this );
65
66                 rep_hdr =
67                     new LocateReplyHeader_1_2( hdr.request_id,
68                                                LocateStatusType_1_2.from_int( hdr.locate_status.value() ));
69                 break;
70             }
71             case 2 :
72             {
73                 //GIOP 1.2
74
rep_hdr = LocateReplyHeader_1_2Helper.read( this );
75
76                 break;
77             }
78             default :
79             {
80                 throw new MARSHAL JavaDoc("Unknown GIOP minor version: " + giop_minor);
81             }
82         }
83     }
84 }
85
Popular Tags