KickJava   Java API By Example, From Geeks To Geeks.

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


1 /*
2  * @(#)LocateRequestMessage_1_1.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
12 import com.sun.corba.se.spi.orb.ORB;
13
14 import com.sun.corba.se.spi.ior.ObjectKey;
15
16 /**
17  * This implements the GIOP 1.1 LocateRequest header.
18  *
19  * @author Ram Jeyaraman 05/14/2000
20  * @version 1.0
21  */

22
23 public final class LocateRequestMessage_1_1 extends Message_1_1
24         implements LocateRequestMessage {
25
26     // Instance variables
27

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

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

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

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