KickJava   Java API By Example, From Geeks To Geeks.

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


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

33
34 public class LocateRequestInputStream
35     extends MessageInputStream
36 {
37     public LocateRequestHeader_1_2 req_hdr = null;
38
39     public LocateRequestInputStream( org.omg.CORBA.ORB JavaDoc orb, byte[] buf )
40     {
41         super( orb, buf );
42
43         if( Messages.getMsgType( buffer ) == MsgType_1_1._LocateRequest )
44         {
45             switch( giop_minor )
46             {
47                 case 0 :
48                 {
49                     //GIOP 1.0 = GIOP 1.1, fall through
50
}
51                 case 1 :
52                 {
53                     //GIOP 1.1
54
LocateRequestHeader_1_0 locate_req_hdr =
55                         LocateRequestHeader_1_0Helper.read( this );
56
57                     TargetAddress addr = new TargetAddress();
58                     addr.object_key( locate_req_hdr.object_key );
59
60                     req_hdr =
61                         new LocateRequestHeader_1_2( locate_req_hdr.request_id,
62                                                      addr );
63                     break;
64                 }
65                 case 2 :
66                 {
67                     //GIOP 1.2
68
req_hdr =
69                         LocateRequestHeader_1_2Helper.read( this );
70
71
72                     break;
73                 }
74                 default :
75                 {
76                     throw new MARSHAL JavaDoc("Unknown GIOP minor version: " + giop_minor);
77                 }
78             }
79         }
80         else
81         {
82             throw new MARSHAL JavaDoc("Not a Locate request!");
83         }
84     }
85
86     protected void finalize() throws Throwable JavaDoc
87     {
88         try
89         {
90             close();
91         }
92         catch( java.io.IOException JavaDoc iox )
93         {
94             //ignore
95
}
96         finally
97         {
98             super.finalize();
99         }
100     }
101 }
102
Popular Tags