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 org.omg.CORBA.MARSHAL;
24: import org.omg.GIOP.LocateReplyHeader_1_0;
25: import org.omg.GIOP.LocateReplyHeader_1_0Helper;
26: import org.omg.GIOP.LocateReplyHeader_1_2;
27: import org.omg.GIOP.LocateReplyHeader_1_2Helper;
28: import org.omg.GIOP.LocateStatusType_1_2;
29: import org.omg.GIOP.MsgType_1_1;
30:
31: /**
32: * @author Gerald Brose
33: * @version $Id: LocateReplyInputStream.java,v 1.15 2006/06/28 12:41:43 alphonse.bendt Exp $
34: */
35: public class LocateReplyInputStream extends MessageInputStream {
36: public LocateReplyHeader_1_2 rep_hdr = null;
37:
38: public LocateReplyInputStream(org.omg.CORBA.ORB orb, byte[] buf) {
39: super (orb, buf);
40:
41: //check message type
42: if (buffer[7] != (byte) MsgType_1_1._LocateReply) {
43: throw new MARSHAL("Not a reply!");
44: }
45:
46: switch (giop_minor) {
47: case 0: {
48: //GIOP 1.0 = GIOP 1.1, fall through
49: }
50: case 1: {
51:
52: //GIOP 1.1
53: LocateReplyHeader_1_0 hdr = LocateReplyHeader_1_0Helper
54: .read(this );
55:
56: rep_hdr = new LocateReplyHeader_1_2(hdr.request_id,
57: LocateStatusType_1_2.from_int(hdr.locate_status
58: .value()));
59: break;
60: }
61: case 2: {
62: //GIOP 1.2
63: rep_hdr = LocateReplyHeader_1_2Helper.read(this );
64:
65: break;
66: }
67: default: {
68: throw new MARSHAL("Unknown GIOP minor version: "
69: + giop_minor);
70: }
71: }
72: }
73: }
|