FileDocCategorySizeDatePackage
LocateReplyMessage_1_2.javaAPI DocJava SE 5 API5823Fri Aug 26 14:54:32 BST 2005com.sun.corba.se.impl.protocol.giopmsgheaders

LocateReplyMessage_1_2

public final class LocateReplyMessage_1_2 extends Message_1_2 implements LocateReplyMessage
This implements the GIOP 1.2 LocateReply header.
author
Ram Jeyaraman 05/14/2000
version
1.0

Fields Summary
private com.sun.corba.se.spi.orb.ORB
orb
private com.sun.corba.se.impl.logging.ORBUtilSystemException
wrapper
private int
reply_status
private com.sun.corba.se.spi.ior.IOR
ior
private String
exClassName
private int
minorCode
private org.omg.CORBA.CompletionStatus
completionStatus
private short
addrDisposition
Constructors Summary
LocateReplyMessage_1_2(com.sun.corba.se.spi.orb.ORB orb)

 // default;

    // Constructors

      
        this.orb = orb;
	this.wrapper = ORBUtilSystemException.get( orb,
	    CORBALogDomains.RPC_PROTOCOL ) ;
    
LocateReplyMessage_1_2(com.sun.corba.se.spi.orb.ORB orb, int _request_id, int _reply_status, com.sun.corba.se.spi.ior.IOR _ior)

        super(Message.GIOPBigMagic, GIOPVersion.V1_2, FLAG_NO_FRAG_BIG_ENDIAN,
            Message.GIOPLocateReply, 0);
        this.orb = orb;
	this.wrapper = ORBUtilSystemException.get( orb,
	    CORBALogDomains.RPC_PROTOCOL ) ;
        request_id = _request_id;
        reply_status = _reply_status;
        ior = _ior;
    
Methods Summary
public voidcallback(MessageHandler handler)

        handler.handleInput(this);
    
public shortgetAddrDisposition()

        return this.addrDisposition;
    
public com.sun.corba.se.spi.ior.IORgetIOR()

        return this.ior;
    
public intgetReplyStatus()

        return this.reply_status;
    
public intgetRequestId()

        return this.request_id;
    
public org.omg.CORBA.SystemExceptiongetSystemException(java.lang.String message)

	return MessageBase.getSystemException(
            exClassName, minorCode, completionStatus, message, wrapper);
    
public static voidisValidReplyStatus(int replyStatus)

        switch (replyStatus) {
        case UNKNOWN_OBJECT :
        case OBJECT_HERE :
        case OBJECT_FORWARD :
        case OBJECT_FORWARD_PERM :
        case LOC_SYSTEM_EXCEPTION :
        case LOC_NEEDS_ADDRESSING_MODE :
            break;
        default :
	    ORBUtilSystemException localWrapper = ORBUtilSystemException.get( 
		CORBALogDomains.RPC_PROTOCOL ) ;
	    throw localWrapper.illegalReplyStatus( CompletionStatus.COMPLETED_MAYBE);
        }
    
public voidread(org.omg.CORBA.portable.InputStream istream)

        super.read(istream);
        this.request_id = istream.read_ulong();
        this.reply_status = istream.read_long();
        isValidReplyStatus(this.reply_status); // raises exception on error

        // GIOP 1.2 LocateReply message bodies are not aligned on
        // 8 byte boundaries.

        // The code below reads the reply body in some cases
        // LOC_SYSTEM_EXCEPTION & OBJECT_FORWARD & OBJECT_FORWARD_PERM &
        // LOC_NEEDS_ADDRESSING_MODE
        if (this.reply_status == LOC_SYSTEM_EXCEPTION) {

            String reposId = istream.read_string();
            this.exClassName = ORBUtility.classNameOf(reposId);
            this.minorCode = istream.read_long();
            int status = istream.read_long();

            switch (status) {
            case CompletionStatus._COMPLETED_YES:
                this.completionStatus = CompletionStatus.COMPLETED_YES;
                break;
            case CompletionStatus._COMPLETED_NO:
                this.completionStatus = CompletionStatus.COMPLETED_NO;
                break;
            case CompletionStatus._COMPLETED_MAYBE:
                this.completionStatus = CompletionStatus.COMPLETED_MAYBE;
                break;
            default:
		throw wrapper.badCompletionStatusInLocateReply( 
		    CompletionStatus.COMPLETED_MAYBE, new Integer(status) );
            }
        } else if ( (this.reply_status == OBJECT_FORWARD) ||
                (this.reply_status == OBJECT_FORWARD_PERM) ){
            CDRInputStream cdr = (CDRInputStream) istream;
	    this.ior = IORFactories.makeIOR( cdr ) ;
        }  else if (this.reply_status == LOC_NEEDS_ADDRESSING_MODE) {
            // read GIOP::AddressingDisposition from body and resend the
            // original request using the requested addressing mode. The
            // resending is transparent to the caller.
            this.addrDisposition = AddressingDispositionHelper.read(istream);
        }
    
public voidwrite(org.omg.CORBA.portable.OutputStream ostream)

        super.write(ostream);
        ostream.write_ulong(this.request_id);
        ostream.write_long(this.reply_status);


        // GIOP 1.2 LocateReply message bodies are not aligned on
        // 8 byte boundaries.