KickJava   Java API By Example, From Geeks To Geeks.

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


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.omg.CORBA.MARSHAL JavaDoc;
25 import org.omg.GIOP.*;
26 import org.jacorb.orb.*;
27
28 /**
29  * @author Gerald Brose, FU Berlin 1999
30  * @version $Id: LocateRequestOutputStream.java,v 1.12 2004/05/06 12:40:00 nicolas Exp $
31  *
32  */

33
34 public class LocateRequestOutputStream
35     extends MessageOutputStream
36 {
37     private int request_id = -1;
38
39     public LocateRequestOutputStream( byte[] object_key,
40                                       int request_id,
41                                       int giop_minor )
42     {
43         super();
44
45         this.request_id = request_id;
46
47         setGIOPMinor( giop_minor );
48
49         writeGIOPMsgHeader( MsgType_1_1._LocateRequest, giop_minor );
50
51         switch( giop_minor )
52         {
53             case 0 :
54             {
55                 // GIOP 1.0 == GIOP 1.1, fall through
56
}
57             case 1 :
58             {
59                 //GIOP 1.1
60
LocateRequestHeader_1_0 req_hdr =
61                     new LocateRequestHeader_1_0( request_id, object_key );
62
63                 LocateRequestHeader_1_0Helper.write( this, req_hdr );
64
65                 break;
66             }
67             case 2 :
68             {
69                 //GIOP 1.2
70
TargetAddress addr = new TargetAddress();
71                 addr.object_key( object_key );
72
73                 LocateRequestHeader_1_2 req_hdr =
74                     new LocateRequestHeader_1_2( request_id, addr );
75
76                 LocateRequestHeader_1_2Helper.write( this, req_hdr );
77
78                 break;
79             }
80             default :
81             {
82                 throw new MARSHAL JavaDoc( "Unknown GIOP minor: " + giop_minor );
83             }
84         }
85     }
86
87     public int getRequestId()
88     {
89         return request_id;
90     }
91 }
92
Popular Tags