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
33: * @version $Id: LocateRequestOutputStream.java,v 1.13 2006/06/28 12:41:43 alphonse.bendt Exp $
34: */
35: public class LocateRequestOutputStream extends MessageOutputStream {
36: private final int request_id;
37:
38: public LocateRequestOutputStream(byte[] object_key, int request_id,
39: int giop_minor) {
40: super ();
41:
42: this .request_id = request_id;
43:
44: setGIOPMinor(giop_minor);
45:
46: writeGIOPMsgHeader(MsgType_1_1._LocateRequest, giop_minor);
47:
48: switch (giop_minor) {
49: case 0: {
50: // GIOP 1.0 == GIOP 1.1, fall through
51: }
52: case 1: {
53: //GIOP 1.1
54: LocateRequestHeader_1_0 req_hdr = new LocateRequestHeader_1_0(
55: request_id, object_key);
56:
57: LocateRequestHeader_1_0Helper.write(this , req_hdr);
58:
59: break;
60: }
61: case 2: {
62: //GIOP 1.2
63: TargetAddress addr = new TargetAddress();
64: addr.object_key(object_key);
65:
66: LocateRequestHeader_1_2 req_hdr = new LocateRequestHeader_1_2(
67: request_id, addr);
68:
69: LocateRequestHeader_1_2Helper.write(this , req_hdr);
70:
71: break;
72: }
73: default: {
74: throw new MARSHAL("Unknown GIOP minor: " + giop_minor);
75: }
76: }
77: }
78:
79: public int getRequestId() {
80: return request_id;
81: }
82: }
|