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.LocateRequestHeader_1_0;
25: import org.omg.GIOP.LocateRequestHeader_1_0Helper;
26: import org.omg.GIOP.LocateRequestHeader_1_2;
27: import org.omg.GIOP.LocateRequestHeader_1_2Helper;
28: import org.omg.GIOP.MsgType_1_1;
29: import org.omg.GIOP.TargetAddress;
30:
31: /**
32: * @author Gerald Brose, FU Berlin
33: * @version $Id: LocateRequestInputStream.java,v 1.18 2006/06/28 12:41:44 alphonse.bendt Exp $
34: */
35: public class LocateRequestInputStream extends MessageInputStream {
36: public final LocateRequestHeader_1_2 req_hdr;
37:
38: public LocateRequestInputStream(org.omg.CORBA.ORB orb, byte[] buf) {
39: super (orb, buf);
40:
41: if (Messages.getMsgType(buffer) == MsgType_1_1._LocateRequest) {
42: switch (giop_minor) {
43: case 0: {
44: //GIOP 1.0 = GIOP 1.1, fall through
45: }
46: case 1: {
47: //GIOP 1.1
48: LocateRequestHeader_1_0 locate_req_hdr = LocateRequestHeader_1_0Helper
49: .read(this );
50:
51: TargetAddress addr = new TargetAddress();
52: addr.object_key(locate_req_hdr.object_key);
53:
54: req_hdr = new LocateRequestHeader_1_2(
55: locate_req_hdr.request_id, addr);
56: break;
57: }
58: case 2: {
59: //GIOP 1.2
60: req_hdr = LocateRequestHeader_1_2Helper.read(this );
61:
62: break;
63: }
64: default: {
65: throw new MARSHAL("Unknown GIOP minor version: "
66: + giop_minor);
67: }
68: }
69: } else {
70: throw new MARSHAL("Not a Locate request!");
71: }
72: }
73:
74: protected void finalize() throws Throwable {
75: try {
76: close();
77: } finally {
78: super.finalize();
79: }
80: }
81: }
|