1 7 8 package com.sun.corba.se.impl.protocol.giopmsgheaders; 9 10 import org.omg.CORBA.Principal ; 11 import com.sun.corba.se.spi.servicecontext.ServiceContexts; 12 import com.sun.corba.se.spi.ior.iiop.GIOPVersion; 13 import com.sun.corba.se.spi.orb.ORB; 14 import com.sun.corba.se.spi.ior.ObjectKey; 15 import com.sun.corba.se.impl.encoding.CDRInputStream; 16 import com.sun.corba.se.impl.encoding.CDROutputStream; 17 import com.sun.corba.se.impl.orbutil.ORBConstants; 18 import com.sun.corba.se.impl.encoding.CDRInputStream_1_2; 19 import com.sun.corba.se.impl.encoding.CDROutputStream_1_2; 20 21 import com.sun.corba.se.spi.logging.CORBALogDomains ; 22 import com.sun.corba.se.impl.logging.ORBUtilSystemException ; 23 24 30 31 public final class RequestMessage_1_2 extends Message_1_2 32 implements RequestMessage { 33 34 36 private ORB orb = null; 37 private ORBUtilSystemException wrapper = null ; 38 private byte response_flags = (byte) 0; 39 private byte reserved[] = null; 40 private TargetAddress target = null; 41 private String operation = null; 42 private ServiceContexts service_contexts = null; 43 private ObjectKey objectKey = null; 44 45 47 RequestMessage_1_2(ORB orb) { 48 this.orb = orb; 49 this.wrapper = ORBUtilSystemException.get( orb, 50 CORBALogDomains.RPC_PROTOCOL ) ; 51 } 52 53 RequestMessage_1_2(ORB orb, int _request_id, byte _response_flags, 54 byte[] _reserved, TargetAddress _target, 55 String _operation, ServiceContexts _service_contexts) { 56 super(Message.GIOPBigMagic, GIOPVersion.V1_2, FLAG_NO_FRAG_BIG_ENDIAN, 57 Message.GIOPRequest, 0); 58 this.orb = orb; 59 this.wrapper = ORBUtilSystemException.get( orb, 60 CORBALogDomains.RPC_PROTOCOL ) ; 61 request_id = _request_id; 62 response_flags = _response_flags; 63 reserved = _reserved; 64 target = _target; 65 operation = _operation; 66 service_contexts = _service_contexts; 67 } 68 69 71 public int getRequestId() { 72 return this.request_id; 73 } 74 75 public boolean isResponseExpected() { 76 87 88 if ( (this.response_flags & RESPONSE_EXPECTED_BIT) == RESPONSE_EXPECTED_BIT ) { 89 return true; 90 } 91 92 return false; 93 } 94 95 public byte[] getReserved() { 96 return this.reserved; 97 } 98 99 public ObjectKey getObjectKey() { 100 if (this.objectKey == null) { 101 this.objectKey = MessageBase.extractObjectKey(target, orb); 103 } 104 105 return this.objectKey; 106 } 107 108 public String getOperation() { 109 return this.operation; 110 } 111 112 public Principal getPrincipal() { 113 return null; 115 } 116 117 public ServiceContexts getServiceContexts() { 118 return this.service_contexts; 119 } 120 121 123 public void read(org.omg.CORBA.portable.InputStream istream) { 124 super.read(istream); 125 this.request_id = istream.read_ulong(); 126 this.response_flags = istream.read_octet(); 127 this.reserved = new byte[3]; 128 for (int _o0 = 0;_o0 < (3); ++_o0) { 129 this.reserved[_o0] = istream.read_octet(); 130 } 131 this.target = TargetAddressHelper.read(istream); 132 getObjectKey(); this.operation = istream.read_string(); 134 this.service_contexts 135 = new ServiceContexts((org.omg.CORBA_2_3.portable.InputStream ) istream); 136 137 ((CDRInputStream)istream).setHeaderPadding(true); 143 144 } 145 146 public void write(org.omg.CORBA.portable.OutputStream ostream) { 147 super.write(ostream); 148 ostream.write_ulong(this.request_id); 149 ostream.write_octet(this.response_flags); 150 nullCheck(this.reserved); 151 if (this.reserved.length != (3)) { 152 throw wrapper.badReservedLength( 153 org.omg.CORBA.CompletionStatus.COMPLETED_MAYBE); 154 } 155 for (int _i0 = 0;_i0 < (3); ++_i0) { 156 ostream.write_octet(this.reserved[_i0]); 157 } 158 nullCheck(this.target); 159 TargetAddressHelper.write(ostream, this.target); 160 ostream.write_string(this.operation); 161 if (this.service_contexts != null) { 162 service_contexts.write( 163 (org.omg.CORBA_2_3.portable.OutputStream ) ostream, 164 GIOPVersion.V1_2); 165 } else { 166 ServiceContexts.writeNullServiceContext( 167 (org.omg.CORBA_2_3.portable.OutputStream ) ostream); 168 } 169 170 ((CDROutputStream)ostream).setHeaderPadding(true); 176 } 177 178 public void callback(MessageHandler handler) 179 throws java.io.IOException 180 { 181 handler.handleInput(this); 182 } 183 } | Popular Tags |