1 7 8 package com.sun.corba.se.impl.protocol.giopmsgheaders; 9 10 import org.omg.CORBA.INTERNAL ; 11 import org.omg.CORBA.SystemException ; 12 import org.omg.CORBA.CompletionStatus ; 13 14 import com.sun.corba.se.spi.orb.ORB; 15 16 import com.sun.corba.se.spi.ior.IOR; 17 import com.sun.corba.se.spi.ior.IORFactories; 18 19 import com.sun.corba.se.spi.ior.iiop.GIOPVersion; 20 21 import com.sun.corba.se.impl.encoding.CDRInputStream; 22 import com.sun.corba.se.impl.encoding.CDROutputStream; 23 24 import com.sun.corba.se.impl.orbutil.ORBUtility; 25 import com.sun.corba.se.impl.orbutil.ORBConstants; 26 import com.sun.corba.se.impl.orbutil.ORBClassLoader; 27 28 import com.sun.corba.se.spi.logging.CORBALogDomains ; 29 import com.sun.corba.se.impl.logging.ORBUtilSystemException ; 30 31 37 38 public final class LocateReplyMessage_1_2 extends Message_1_2 39 implements LocateReplyMessage { 40 41 43 private ORB orb = null; 44 private ORBUtilSystemException wrapper = null ; 45 private int reply_status = (int) 0; 46 private IOR ior = null; 47 private String exClassName = null; 48 private int minorCode = (int) 0; 49 private CompletionStatus completionStatus = null; 50 private short addrDisposition = KeyAddr.value; 52 54 LocateReplyMessage_1_2(ORB orb) { 55 this.orb = orb; 56 this.wrapper = ORBUtilSystemException.get( orb, 57 CORBALogDomains.RPC_PROTOCOL ) ; 58 } 59 60 LocateReplyMessage_1_2(ORB orb, int _request_id, 61 int _reply_status, IOR _ior) { 62 super(Message.GIOPBigMagic, GIOPVersion.V1_2, FLAG_NO_FRAG_BIG_ENDIAN, 63 Message.GIOPLocateReply, 0); 64 this.orb = orb; 65 this.wrapper = ORBUtilSystemException.get( orb, 66 CORBALogDomains.RPC_PROTOCOL ) ; 67 request_id = _request_id; 68 reply_status = _reply_status; 69 ior = _ior; 70 } 71 72 74 public int getRequestId() { 75 return this.request_id; 76 } 77 78 public int getReplyStatus() { 79 return this.reply_status; 80 } 81 82 public short getAddrDisposition() { 83 return this.addrDisposition; 84 } 85 86 public SystemException getSystemException(String message) { 87 return MessageBase.getSystemException( 88 exClassName, minorCode, completionStatus, message, wrapper); 89 } 90 91 public IOR getIOR() { 92 return this.ior; 93 } 94 95 97 public void read(org.omg.CORBA.portable.InputStream istream) { 98 super.read(istream); 99 this.request_id = istream.read_ulong(); 100 this.reply_status = istream.read_long(); 101 isValidReplyStatus(this.reply_status); 103 106 if (this.reply_status == LOC_SYSTEM_EXCEPTION) { 110 111 String reposId = istream.read_string(); 112 this.exClassName = ORBUtility.classNameOf(reposId); 113 this.minorCode = istream.read_long(); 114 int status = istream.read_long(); 115 116 switch (status) { 117 case CompletionStatus._COMPLETED_YES: 118 this.completionStatus = CompletionStatus.COMPLETED_YES; 119 break; 120 case CompletionStatus._COMPLETED_NO: 121 this.completionStatus = CompletionStatus.COMPLETED_NO; 122 break; 123 case CompletionStatus._COMPLETED_MAYBE: 124 this.completionStatus = CompletionStatus.COMPLETED_MAYBE; 125 break; 126 default: 127 throw wrapper.badCompletionStatusInLocateReply( 128 CompletionStatus.COMPLETED_MAYBE, new Integer (status) ); 129 } 130 } else if ( (this.reply_status == OBJECT_FORWARD) || 131 (this.reply_status == OBJECT_FORWARD_PERM) ){ 132 CDRInputStream cdr = (CDRInputStream) istream; 133 this.ior = IORFactories.makeIOR( cdr ) ; 134 } else if (this.reply_status == LOC_NEEDS_ADDRESSING_MODE) { 135 this.addrDisposition = AddressingDispositionHelper.read(istream); 139 } 140 } 141 142 public void write(org.omg.CORBA.portable.OutputStream ostream) { 146 super.write(ostream); 147 ostream.write_ulong(this.request_id); 148 ostream.write_long(this.reply_status); 149 150 151 } 154 155 157 public static void isValidReplyStatus(int replyStatus) { 158 switch (replyStatus) { 159 case UNKNOWN_OBJECT : 160 case OBJECT_HERE : 161 case OBJECT_FORWARD : 162 case OBJECT_FORWARD_PERM : 163 case LOC_SYSTEM_EXCEPTION : 164 case LOC_NEEDS_ADDRESSING_MODE : 165 break; 166 default : 167 ORBUtilSystemException localWrapper = ORBUtilSystemException.get( 168 CORBALogDomains.RPC_PROTOCOL ) ; 169 throw localWrapper.illegalReplyStatus( CompletionStatus.COMPLETED_MAYBE); 170 } 171 } 172 173 public void callback(MessageHandler handler) 174 throws java.io.IOException 175 { 176 handler.handleInput(this); 177 } 178 } | Popular Tags |