KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > corba > se > impl > protocol > giopmsgheaders > LocateRequestMessage_1_0


1 /*
2  * @(#)LocateRequestMessage_1_0.java 1.11 03/12/19
3  *
4  * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
5  * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
6  */

7
8 package com.sun.corba.se.impl.protocol.giopmsgheaders;
9
10 import com.sun.corba.se.spi.ior.iiop.GIOPVersion;
11 import com.sun.corba.se.spi.orb.ORB;
12
13 import com.sun.corba.se.spi.ior.ObjectKey;
14
15 /**
16  * This implements the GIOP 1.0 LocateRequest header.
17  *
18  * @author Ram Jeyaraman 05/14/2000
19  * @version 1.0
20  */

21
22 public final class LocateRequestMessage_1_0 extends Message_1_0
23         implements LocateRequestMessage {
24
25     // Instance variables
26

27     private ORB orb = null;
28     private int request_id = (int) 0;
29     private byte[] object_key = null;
30     private ObjectKey objectKey = null;
31
32     // Constructor
33

34     LocateRequestMessage_1_0(ORB orb) {
35         this.orb = orb;
36     }
37
38     LocateRequestMessage_1_0(ORB orb, int _request_id, byte[] _object_key) {
39         super(Message.GIOPBigMagic, false, Message.GIOPLocateRequest, 0);
40         this.orb = orb;
41         request_id = _request_id;
42         object_key = _object_key;
43     }
44
45     // Accessor methods (LocateRequestMessage interface)
46

47     public int getRequestId() {
48         return this.request_id;
49     }
50
51     public ObjectKey getObjectKey() {
52         if (this.objectKey == null) {
53         // this will raise a MARSHAL exception upon errors.
54
this.objectKey = MessageBase.extractObjectKey(object_key, orb);
55         }
56
57     return this.objectKey;
58     }
59
60     // IO methods
61

62     public void read(org.omg.CORBA.portable.InputStream JavaDoc istream) {
63         super.read(istream);;
64         this.request_id = istream.read_ulong();
65         int _len0 = istream.read_long();
66         this.object_key = new byte[_len0];
67         istream.read_octet_array (this.object_key, 0, _len0);
68     }
69
70     public void write(org.omg.CORBA.portable.OutputStream JavaDoc ostream) {
71         super.write(ostream);
72         ostream.write_ulong(this.request_id);
73         nullCheck(this.object_key);
74         ostream.write_long(this.object_key.length);
75         ostream.write_octet_array(this.object_key, 0, this.object_key.length);
76     }
77
78     public void callback(MessageHandler handler)
79         throws java.io.IOException JavaDoc
80     {
81         handler.handleInput(this);
82     }
83 } // class LocateRequestMessage_1_0
84
Popular Tags