KickJava   Java API By Example, From Geeks To Geeks.

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


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

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

27     private ORB orb = null;
28     private ObjectKey objectKey = null;
29     private TargetAddress target = null;
30
31     // Constructors
32

33     LocateRequestMessage_1_2(ORB orb) {
34         this.orb = orb;
35     }
36
37     LocateRequestMessage_1_2(ORB orb, int _request_id, TargetAddress _target) {
38         super(Message.GIOPBigMagic, GIOPVersion.V1_2, FLAG_NO_FRAG_BIG_ENDIAN,
39             Message.GIOPLocateRequest, 0);
40         this.orb = orb;
41         request_id = _request_id;
42         target = _target;
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(target, 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         this.target = TargetAddressHelper.read(istream);
66         getObjectKey(); // this does AddressingDisposition check
67
}
68
69     public void write(org.omg.CORBA.portable.OutputStream JavaDoc ostream) {
70         super.write(ostream);
71         ostream.write_ulong (this.request_id);
72         nullCheck(this.target);
73         TargetAddressHelper.write(ostream, this.target);
74     }
75
76     public void callback(MessageHandler handler)
77         throws java.io.IOException JavaDoc
78     {
79         handler.handleInput(this);
80     }
81 } // class LocateRequestMessage_1_2
82
Popular Tags