Java Code Examples for com.sun.corba.se.spi.servicecontext.ServiceContexts

The following are top voted examples for showing how to use com.sun.corba.se.spi.servicecontext.ServiceContexts. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: OpenJSharp   File: CorbaMessageMediatorImpl.java   Source Code and License 6 votes vote down vote up
/**
 * If the RMI-IIOP maximum stream format version service context
 * is present, it indicates the maximum stream format version we
 * could use for the reply.  If it isn't present, the default is
 * 2 for GIOP 1.3 or greater, 1 for lower.
 *
 * This is only sent on requests.  Clients can find out the
 * server's maximum by looking for a tagged component in the IOR.
 */
public byte getStreamFormatVersionForReply() {

    // NOTE: The request service contexts may indicate the max.
    ServiceContexts svc = getRequestServiceContexts();

    MaxStreamFormatVersionServiceContext msfvsc
        = (MaxStreamFormatVersionServiceContext)svc.get(
            MaxStreamFormatVersionServiceContext.SERVICE_CONTEXT_ID);

    if (msfvsc != null) {
        byte localMaxVersion = ORBUtility.getMaxStreamFormatVersion();
        byte remoteMaxVersion = msfvsc.getMaximumStreamFormatVersion();

        return (byte)Math.min(localMaxVersion, remoteMaxVersion);
    } else {
        // Defaults to 1 for GIOP 1.2 or less, 2 for
        // GIOP 1.3 or higher.
        if (getGIOPVersion().lessThan(GIOPVersion.V1_3))
            return ORBConstants.STREAM_FORMAT_VERSION_1;
        else
            return ORBConstants.STREAM_FORMAT_VERSION_2;
    }
}
 
Example 2
Project: OpenJSharp   File: CorbaMessageMediatorImpl.java   Source Code and License 6 votes vote down vote up
private void addExceptionDetailMessage(CorbaMessageMediator mediator,
                                       SystemException ex,
                                       ServiceContexts serviceContexts)
{
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    PrintWriter pw = new PrintWriter(baos);
    ex.printStackTrace(pw);
    pw.flush(); // NOTE: you must flush or baos will be empty.
    EncapsOutputStream encapsOutputStream =
        sun.corba.OutputStreamFactory.newEncapsOutputStream((ORB)mediator.getBroker());
    encapsOutputStream.putEndian();
    encapsOutputStream.write_wstring(baos.toString());
    UnknownServiceContext serviceContext =
        new UnknownServiceContext(ExceptionDetailMessage.value,
                                  encapsOutputStream.toByteArray());
    serviceContexts.put(serviceContext);
}
 
Example 3
Project: OpenJSharp   File: RequestMessage_1_1.java   Source Code and License 6 votes vote down vote up
public void read(org.omg.CORBA.portable.InputStream istream) {
    super.read(istream);
    this.service_contexts
        = new ServiceContexts((org.omg.CORBA_2_3.portable.InputStream) istream);
    this.request_id = istream.read_ulong();
    this.response_expected = istream.read_boolean();
    this.reserved = new byte[3];
    for (int _o0 = 0;_o0 < (3); ++_o0) {
        this.reserved[_o0] = istream.read_octet();
    }
    int _len1 = istream.read_long();
    this.object_key = new byte[_len1];
    istream.read_octet_array(this.object_key, 0, _len1);
    this.operation = istream.read_string();
    this.requesting_principal = istream.read_Principal();
}
 
Example 4
Project: openjdk-jdk10   File: RequestMessage_1_2.java   Source Code and License 6 votes vote down vote up
public void read(org.omg.CORBA.portable.InputStream istream) {
    super.read(istream);
    this.request_id = istream.read_ulong();
    this.response_flags = istream.read_octet();
    this.reserved = new byte[3];
    for (int _o0 = 0;_o0 < (3); ++_o0) {
        this.reserved[_o0] = istream.read_octet();
    }
    this.target = TargetAddressHelper.read(istream);
    getObjectKey(); // this does AddressingDisposition check
    this.operation = istream.read_string();
    this.service_contexts
        = new ServiceContexts((org.omg.CORBA_2_3.portable.InputStream) istream);

    // CORBA formal 00-11-0 15.4.2.2 GIOP 1.2 body must be
    // aligned on an 8 octet boundary.
    // Ensures that the first read operation called from the stub code,
    // during body deconstruction, would skip the header padding, that was
    // inserted to ensure that the body was aligned on an 8-octet boundary.
    ((CDRInputStream)istream).setHeaderPadding(true);

}
 
Example 5
Project: OpenJSharp   File: RequestMessage_1_0.java   Source Code and License 6 votes vote down vote up
public void write(org.omg.CORBA.portable.OutputStream ostream) {
    super.write(ostream);
    if (this.service_contexts != null) {
            service_contexts.write(
            (org.omg.CORBA_2_3.portable.OutputStream) ostream,
            GIOPVersion.V1_0);
        } else {
            ServiceContexts.writeNullServiceContext(
            (org.omg.CORBA_2_3.portable.OutputStream) ostream);
    }
    ostream.write_ulong(this.request_id);
    ostream.write_boolean(this.response_expected);
    nullCheck(this.object_key);
    ostream.write_long(this.object_key.length);
    ostream.write_octet_array(this.object_key, 0, this.object_key.length);
    ostream.write_string(this.operation);
    if (this.requesting_principal != null) {
        ostream.write_Principal(this.requesting_principal);
    } else {
        ostream.write_long(0);
    }
}
 
Example 6
Project: OpenJSharp   File: MessageBase.java   Source Code and License 6 votes vote down vote up
public static ReplyMessage createReply(
        ORB orb, GIOPVersion gv, byte encodingVersion, int request_id,
        int reply_status, ServiceContexts service_contexts, IOR ior) {

    if (gv.equals(GIOPVersion.V1_0)) { // 1.0
        return new ReplyMessage_1_0(orb, service_contexts, request_id,
                                    reply_status, ior);
    } else if (gv.equals(GIOPVersion.V1_1)) { // 1.1
        return new ReplyMessage_1_1(orb, service_contexts, request_id,
                                    reply_status, ior);
    } else if (gv.equals(GIOPVersion.V1_2)) { // 1.2
        ReplyMessage msg =
            new ReplyMessage_1_2(orb, request_id, reply_status,
                                 service_contexts, ior);
        msg.setEncodingVersion(encodingVersion);
        return msg;
    } else {
        throw wrapper.giopVersionError(
            CompletionStatus.COMPLETED_MAYBE);
    }
}
 
Example 7
Project: OpenJSharp   File: RequestMessage_1_2.java   Source Code and License 6 votes vote down vote up
public void read(org.omg.CORBA.portable.InputStream istream) {
    super.read(istream);
    this.request_id = istream.read_ulong();
    this.response_flags = istream.read_octet();
    this.reserved = new byte[3];
    for (int _o0 = 0;_o0 < (3); ++_o0) {
        this.reserved[_o0] = istream.read_octet();
    }
    this.target = TargetAddressHelper.read(istream);
    getObjectKey(); // this does AddressingDisposition check
    this.operation = istream.read_string();
    this.service_contexts
        = new ServiceContexts((org.omg.CORBA_2_3.portable.InputStream) istream);

    // CORBA formal 00-11-0 15.4.2.2 GIOP 1.2 body must be
    // aligned on an 8 octet boundary.
    // Ensures that the first read operation called from the stub code,
    // during body deconstruction, would skip the header padding, that was
    // inserted to ensure that the body was aligned on an 8-octet boundary.
    ((CDRInputStream)istream).setHeaderPadding(true);

}
 
Example 8
Project: openjdk-jdk10   File: CorbaMessageMediatorImpl.java   Source Code and License 6 votes vote down vote up
/**
 * If the RMI-IIOP maximum stream format version service context
 * is present, it indicates the maximum stream format version we
 * could use for the reply.  If it isn't present, the default is
 * 2 for GIOP 1.3 or greater, 1 for lower.
 *
 * This is only sent on requests.  Clients can find out the
 * server's maximum by looking for a tagged component in the IOR.
 */
public byte getStreamFormatVersionForReply() {

    // NOTE: The request service contexts may indicate the max.
    ServiceContexts svc = getRequestServiceContexts();

    MaxStreamFormatVersionServiceContext msfvsc
        = (MaxStreamFormatVersionServiceContext)svc.get(
            MaxStreamFormatVersionServiceContext.SERVICE_CONTEXT_ID);

    if (msfvsc != null) {
        byte localMaxVersion = ORBUtility.getMaxStreamFormatVersion();
        byte remoteMaxVersion = msfvsc.getMaximumStreamFormatVersion();

        return (byte)Math.min(localMaxVersion, remoteMaxVersion);
    } else {
        // Defaults to 1 for GIOP 1.2 or less, 2 for
        // GIOP 1.3 or higher.
        if (getGIOPVersion().lessThan(GIOPVersion.V1_3))
            return ORBConstants.STREAM_FORMAT_VERSION_1;
        else
            return ORBConstants.STREAM_FORMAT_VERSION_2;
    }
}
 
Example 9
Project: openjdk-jdk10   File: CorbaMessageMediatorImpl.java   Source Code and License 6 votes vote down vote up
private void addExceptionDetailMessage(CorbaMessageMediator mediator,
                                       SystemException ex,
                                       ServiceContexts serviceContexts)
{
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    PrintWriter pw = new PrintWriter(baos);
    ex.printStackTrace(pw);
    pw.flush(); // NOTE: you must flush or baos will be empty.
    EncapsOutputStream encapsOutputStream =
        sun.corba.OutputStreamFactory.newEncapsOutputStream((ORB)mediator.getBroker());
    encapsOutputStream.putEndian();
    encapsOutputStream.write_wstring(baos.toString());
    UnknownServiceContext serviceContext =
        new UnknownServiceContext(ExceptionDetailMessage.value,
                                  encapsOutputStream.toByteArray());
    serviceContexts.put(serviceContext);
}
 
Example 10
Project: openjdk-jdk10   File: RequestMessage_1_1.java   Source Code and License 6 votes vote down vote up
RequestMessage_1_1(ORB orb, ServiceContexts _service_contexts,
        int _request_id, boolean _response_expected, byte[] _reserved,
        byte[] _object_key, String _operation,
        Principal _requesting_principal) {
    super(Message.GIOPBigMagic, GIOPVersion.V1_1, FLAG_NO_FRAG_BIG_ENDIAN,
        Message.GIOPRequest, 0);
    this.orb = orb;
    this.wrapper = ORBUtilSystemException.get( orb,
        CORBALogDomains.RPC_PROTOCOL ) ;
    service_contexts = _service_contexts;
    request_id = _request_id;
    response_expected = _response_expected;
    reserved = _reserved;
    object_key = _object_key;
    operation = _operation;
    requesting_principal = _requesting_principal;
}
 
Example 11
Project: openjdk-jdk10   File: RequestMessage_1_1.java   Source Code and License 6 votes vote down vote up
public void read(org.omg.CORBA.portable.InputStream istream) {
    super.read(istream);
    this.service_contexts
        = new ServiceContexts((org.omg.CORBA_2_3.portable.InputStream) istream);
    this.request_id = istream.read_ulong();
    this.response_expected = istream.read_boolean();
    this.reserved = new byte[3];
    for (int _o0 = 0;_o0 < (3); ++_o0) {
        this.reserved[_o0] = istream.read_octet();
    }
    int _len1 = istream.read_long();
    this.object_key = new byte[_len1];
    istream.read_octet_array(this.object_key, 0, _len1);
    this.operation = istream.read_string();
    this.requesting_principal = istream.read_Principal();
}
 
Example 12
Project: openjdk-jdk10   File: ReplyMessage_1_2.java   Source Code and License 6 votes vote down vote up
public void write(org.omg.CORBA.portable.OutputStream ostream) {
    super.write(ostream);
    ostream.write_ulong(this.request_id);
    ostream.write_long(this.reply_status);
    if (this.service_contexts != null) {
            service_contexts.write(
            (org.omg.CORBA_2_3.portable.OutputStream) ostream,
            GIOPVersion.V1_2);
        } else {
            ServiceContexts.writeNullServiceContext(
            (org.omg.CORBA_2_3.portable.OutputStream) ostream);
    }

    // CORBA formal 00-11-0 15.4.2.2 GIOP 1.2 body must be
    // aligned on an 8 octet boundary.
    // Ensures that the first write operation called from the stub code,
    // during body construction, would insert a header padding, such that
    // the body is aligned on an 8-octet boundary.
    ((CDROutputStream)ostream).setHeaderPadding(true);

}
 
Example 13
Project: openjdk-jdk10   File: RequestMessage_1_0.java   Source Code and License 6 votes vote down vote up
public void write(org.omg.CORBA.portable.OutputStream ostream) {
    super.write(ostream);
    if (this.service_contexts != null) {
            service_contexts.write(
            (org.omg.CORBA_2_3.portable.OutputStream) ostream,
            GIOPVersion.V1_0);
        } else {
            ServiceContexts.writeNullServiceContext(
            (org.omg.CORBA_2_3.portable.OutputStream) ostream);
    }
    ostream.write_ulong(this.request_id);
    ostream.write_boolean(this.response_expected);
    nullCheck(this.object_key);
    ostream.write_long(this.object_key.length);
    ostream.write_octet_array(this.object_key, 0, this.object_key.length);
    ostream.write_string(this.operation);
    if (this.requesting_principal != null) {
        ostream.write_Principal(this.requesting_principal);
    } else {
        ostream.write_long(0);
    }
}
 
Example 14
Project: openjdk-jdk10   File: RequestMessage_1_2.java   Source Code and License 5 votes vote down vote up
RequestMessage_1_2(ORB orb, int _request_id, byte _response_flags,
        byte[] _reserved, TargetAddress _target,
        String _operation, ServiceContexts _service_contexts) {
    super(Message.GIOPBigMagic, GIOPVersion.V1_2, FLAG_NO_FRAG_BIG_ENDIAN,
        Message.GIOPRequest, 0);
    this.orb = orb;
    this.wrapper = ORBUtilSystemException.get( orb,
        CORBALogDomains.RPC_PROTOCOL ) ;
    request_id = _request_id;
    response_flags = _response_flags;
    reserved = _reserved;
    target = _target;
    operation = _operation;
    service_contexts = _service_contexts;
}
 
Example 15
Project: OpenJSharp   File: CorbaClientRequestDispatcherImpl.java   Source Code and License 5 votes vote down vote up
protected void addServiceContexts(CorbaMessageMediator messageMediator)
{
    ORB orb = (ORB)messageMediator.getBroker();
    CorbaConnection c = (CorbaConnection) messageMediator.getConnection();
    GIOPVersion giopVersion = messageMediator.getGIOPVersion();

    ServiceContexts contexts = messageMediator.getRequestServiceContexts();

    addCodeSetServiceContext(c, contexts, giopVersion);

    // Add the RMI-IIOP max stream format version
    // service context to every request.  Once we have GIOP 1.3,
    // we could skip it since we now support version 2, but
    // probably safer to always send it.
    contexts.put(MaxStreamFormatVersionServiceContext.singleton);

    // ORBVersion servicecontext needs to be sent
    ORBVersionServiceContext ovsc = new ORBVersionServiceContext(
                    ORBVersionFactory.getORBVersion() ) ;
    contexts.put( ovsc ) ;

    // NOTE : We only want to send the runtime context the first time
    if ((c != null) && !c.isPostInitialContexts()) {
        // Do not do c.setPostInitialContexts() here.
        // If a client interceptor send_request does a ForwardRequest
        // which ends up using the same connection then the service
        // context would not be sent.
        SendingContextServiceContext scsc =
            new SendingContextServiceContext( orb.getFVDCodeBaseIOR() ) ; //d11638
        contexts.put( scsc ) ;
    }
}
 
Example 16
Project: OpenJSharp   File: CorbaMessageMediatorImpl.java   Source Code and License 5 votes vote down vote up
public CorbaMessageMediatorImpl(ORB orb,
                                ContactInfo contactInfo,
                                Connection connection,
                                GIOPVersion giopVersion,
                                IOR ior,
                                int requestId,
                                short addrDisposition,
                                String operationName,
                                boolean isOneWay)
{
    this( orb, connection ) ;

    this.contactInfo = (CorbaContactInfo) contactInfo;
    this.addrDisposition = addrDisposition;

    streamFormatVersion =
        getStreamFormatVersionForThisRequest(
            ((CorbaContactInfo)this.contactInfo).getEffectiveTargetIOR(),
            giopVersion);
    streamFormatVersionSet = true;

    requestHeader = (RequestMessage) MessageBase.createRequest(
        this.orb,
        giopVersion,
        ORBUtility.getEncodingVersion(orb, ior),
        requestId,
        !isOneWay,
        ((CorbaContactInfo)this.contactInfo).getEffectiveTargetIOR(),
        this.addrDisposition,
        operationName,
        new ServiceContexts(orb),
        null);
}
 
Example 17
Project: openjdk-jdk10   File: ReplyMessage_1_1.java   Source Code and License 5 votes vote down vote up
ReplyMessage_1_1(ORB orb, ServiceContexts _service_contexts,
        int _request_id, int _reply_status, IOR _ior) {
    super(Message.GIOPBigMagic, GIOPVersion.V1_1, FLAG_NO_FRAG_BIG_ENDIAN,
        Message.GIOPReply, 0);
    this.orb = orb;
    this.wrapper = ORBUtilSystemException.get( orb,
        CORBALogDomains.RPC_PROTOCOL ) ;
    service_contexts = _service_contexts;
    request_id = _request_id;
    reply_status = _reply_status;
    ior = _ior;
}
 
Example 18
Project: OpenJSharp   File: CorbaMessageMediatorImpl.java   Source Code and License 5 votes vote down vote up
public org.omg.CORBA.portable.OutputStream createExceptionReply()
{
    // Note: relies on side-effect of setting mediator output field.
    // REVISIT - cast - need interface
    getProtocolHandler().createUserExceptionResponse(this, (ServiceContexts) null);
    return (OutputStream) getOutputObject();
}
 
Example 19
Project: OpenJSharp   File: CorbaMessageMediatorImpl.java   Source Code and License 5 votes vote down vote up
public CorbaMessageMediator createResponse(
    CorbaMessageMediator messageMediator,
    ServiceContexts svc)
{
    // REVISIT: ignore service contexts during framework transition.
    // They are set in SubcontractResponseHandler to the wrong connection.
    // Then they would be set again here and a duplicate contexts
    // exception occurs.
    return createResponseHelper(
        messageMediator,
        getServiceContextsForReply(messageMediator, null));
}
 
Example 20
Project: OpenJSharp   File: CorbaMessageMediatorImpl.java   Source Code and License 5 votes vote down vote up
public CorbaMessageMediator createUserExceptionResponse(
    CorbaMessageMediator messageMediator, ServiceContexts svc)
{
    // REVISIT - same as above
    return createResponseHelper(
        messageMediator,
        getServiceContextsForReply(messageMediator, null),
        true);
}
 
Example 21
Project: openjdk-jdk10   File: ReplyMessage_1_1.java   Source Code and License 5 votes vote down vote up
public void read(org.omg.CORBA.portable.InputStream istream) {
    super.read(istream);
    this.service_contexts
        = new ServiceContexts((org.omg.CORBA_2_3.portable.InputStream) istream);
    this.request_id = istream.read_ulong();
    this.reply_status = istream.read_long();
    isValidReplyStatus(this.reply_status); // raises exception on error

    // The code below reads the reply body in some cases
    // SYSTEM_EXCEPTION & LOCATION_FORWARD
    if (this.reply_status == 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.badCompletionStatusInReply(
                CompletionStatus.COMPLETED_MAYBE, new Integer(status) );
        }
    } else if (this.reply_status == USER_EXCEPTION) {
        // do nothing. The client stub will read the exception from body.
    } else if (this.reply_status == LOCATION_FORWARD) {
        CDRInputStream cdr = (CDRInputStream) istream;
        this.ior = IORFactories.makeIOR(cdr) ;
    }
}
 
Example 22
Project: OpenJSharp   File: CorbaMessageMediatorImpl.java   Source Code and License 5 votes vote down vote up
public CorbaMessageMediator createLocationForward(
    CorbaMessageMediator messageMediator, IOR ior, ServiceContexts svc)
{
    ReplyMessage reply
        = MessageBase.createReply(
              (ORB)messageMediator.getBroker(),
              messageMediator.getGIOPVersion(),
              messageMediator.getEncodingVersion(),
              messageMediator.getRequestId(),
              ReplyMessage.LOCATION_FORWARD,
              getServiceContextsForReply(messageMediator, svc),
              ior);

    return createResponseHelper(messageMediator, reply, ior);
}
 
Example 23
Project: OpenJSharp   File: CorbaMessageMediatorImpl.java   Source Code and License 5 votes vote down vote up
protected CorbaMessageMediator createResponseHelper(
    CorbaMessageMediator messageMediator, ServiceContexts svc)
{
    ReplyMessage message =
        MessageBase.createReply(
            (ORB)messageMediator.getBroker(),
            messageMediator.getGIOPVersion(),
            messageMediator.getEncodingVersion(),
            messageMediator.getRequestId(),
            ReplyMessage.NO_EXCEPTION,
            svc,
            null);
    return createResponseHelper(messageMediator, message, null);
}
 
Example 24
Project: OpenJSharp   File: CorbaMessageMediatorImpl.java   Source Code and License 5 votes vote down vote up
protected CorbaMessageMediator createResponseHelper(
    CorbaMessageMediator messageMediator, ServiceContexts svc,boolean user)
{
    ReplyMessage message =
        MessageBase.createReply(
            (ORB)messageMediator.getBroker(),
            messageMediator.getGIOPVersion(),
            messageMediator.getEncodingVersion(),
            messageMediator.getRequestId(),
            user ? ReplyMessage.USER_EXCEPTION :
                   ReplyMessage.SYSTEM_EXCEPTION,
            svc,
            null);
    return createResponseHelper(messageMediator, message, null);
}
 
Example 25
Project: OpenJSharp   File: RequestMessage_1_1.java   Source Code and License 5 votes vote down vote up
public void write(org.omg.CORBA.portable.OutputStream ostream) {
    super.write(ostream);
    if (this.service_contexts != null) {
            service_contexts.write(
            (org.omg.CORBA_2_3.portable.OutputStream) ostream,
            GIOPVersion.V1_1);
        } else {
            ServiceContexts.writeNullServiceContext(
            (org.omg.CORBA_2_3.portable.OutputStream) ostream);
    }
    ostream.write_ulong(this.request_id);
    ostream.write_boolean(this.response_expected);
    nullCheck(this.reserved);
    if (this.reserved.length != (3)) {
        throw wrapper.badReservedLength(
            org.omg.CORBA.CompletionStatus.COMPLETED_MAYBE);
    }
    for (int _i0 = 0;_i0 < (3); ++_i0) {
        ostream.write_octet(this.reserved[_i0]);
    }
    nullCheck(this.object_key);
    ostream.write_long(this.object_key.length);
    ostream.write_octet_array(this.object_key, 0, this.object_key.length);
    ostream.write_string(this.operation);
    if (this.requesting_principal != null) {
        ostream.write_Principal(this.requesting_principal);
    } else {
        ostream.write_long(0);
    }
}
 
Example 26
Project: OpenJSharp   File: ReplyMessage_1_0.java   Source Code and License 5 votes vote down vote up
public void read(org.omg.CORBA.portable.InputStream istream) {
    super.read(istream);
    this.service_contexts
        = new ServiceContexts((org.omg.CORBA_2_3.portable.InputStream) istream);
    this.request_id = istream.read_ulong();
    this.reply_status = istream.read_long();
    isValidReplyStatus(this.reply_status); // raises exception on error

    // The code below reads the reply body in some cases
    // SYSTEM_EXCEPTION & LOCATION_FORWARD
    if (this.reply_status == 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.badCompletionStatusInReply(
                CompletionStatus.COMPLETED_MAYBE, new Integer(status) );
        }

    } else if (this.reply_status == USER_EXCEPTION) {
        // do nothing. The client stub will read the exception from body.
    } else if (this.reply_status == LOCATION_FORWARD) {
        CDRInputStream cdr = (CDRInputStream) istream;
        this.ior = IORFactories.makeIOR( cdr ) ;
    }
}
 
Example 27
Project: OpenJSharp   File: ReplyMessage_1_0.java   Source Code and License 5 votes vote down vote up
public void write(org.omg.CORBA.portable.OutputStream ostream) {
    super.write(ostream);
    if (this.service_contexts != null) {
            service_contexts.write(
            (org.omg.CORBA_2_3.portable.OutputStream) ostream,
            GIOPVersion.V1_0);
        } else {
            ServiceContexts.writeNullServiceContext(
            (org.omg.CORBA_2_3.portable.OutputStream) ostream);
    }
    ostream.write_ulong(this.request_id);
    ostream.write_long(this.reply_status);
}
 
Example 28
Project: OpenJSharp   File: ReplyMessage_1_2.java   Source Code and License 5 votes vote down vote up
ReplyMessage_1_2(ORB orb, int _request_id, int _reply_status,
        ServiceContexts _service_contexts, IOR _ior) {
    super(Message.GIOPBigMagic, GIOPVersion.V1_2, FLAG_NO_FRAG_BIG_ENDIAN,
        Message.GIOPReply, 0);
    this.orb = orb;
    this.wrapper = ORBUtilSystemException.get( orb,
        CORBALogDomains.RPC_PROTOCOL ) ;
    request_id = _request_id;
    reply_status = _reply_status;
    service_contexts = _service_contexts;
    ior = _ior;
}
 
Example 29
Project: openjdk-jdk10   File: ReplyMessage_1_1.java   Source Code and License 5 votes vote down vote up
public void write(org.omg.CORBA.portable.OutputStream ostream) {
    super.write(ostream);
    if (this.service_contexts != null) {
            service_contexts.write(
            (org.omg.CORBA_2_3.portable.OutputStream) ostream,
            GIOPVersion.V1_1);
        } else {
            ServiceContexts.writeNullServiceContext(
            (org.omg.CORBA_2_3.portable.OutputStream) ostream);
    }
    ostream.write_ulong(this.request_id);
    ostream.write_long(this.reply_status);
}
 
Example 30
Project: OpenJSharp   File: RequestMessage_1_0.java   Source Code and License 5 votes vote down vote up
RequestMessage_1_0(ORB orb, ServiceContexts _service_contexts,
        int _request_id, boolean _response_expected, byte[] _object_key,
        String _operation, Principal _requesting_principal) {
    super(Message.GIOPBigMagic, false, Message.GIOPRequest, 0);
    this.orb = orb;
    service_contexts = _service_contexts;
    request_id = _request_id;
    response_expected = _response_expected;
    object_key = _object_key;
    operation = _operation;
    requesting_principal = _requesting_principal;
}
 
Example 31
Project: OpenJSharp   File: RequestMessage_1_0.java   Source Code and License 5 votes vote down vote up
public void read(org.omg.CORBA.portable.InputStream istream) {
    super.read(istream);
    this.service_contexts
        = new ServiceContexts((org.omg.CORBA_2_3.portable.InputStream) istream);
    this.request_id = istream.read_ulong();
    this.response_expected = istream.read_boolean();
    int _len0 = istream.read_long();
    this.object_key = new byte[_len0];
    istream.read_octet_array(this.object_key, 0, _len0);
    this.operation = istream.read_string();
    this.requesting_principal = istream.read_Principal();
}
 
Example 32
Project: OpenJSharp   File: RequestMessage_1_2.java   Source Code and License 5 votes vote down vote up
RequestMessage_1_2(ORB orb, int _request_id, byte _response_flags,
        byte[] _reserved, TargetAddress _target,
        String _operation, ServiceContexts _service_contexts) {
    super(Message.GIOPBigMagic, GIOPVersion.V1_2, FLAG_NO_FRAG_BIG_ENDIAN,
        Message.GIOPRequest, 0);
    this.orb = orb;
    this.wrapper = ORBUtilSystemException.get( orb,
        CORBALogDomains.RPC_PROTOCOL ) ;
    request_id = _request_id;
    response_flags = _response_flags;
    reserved = _reserved;
    target = _target;
    operation = _operation;
    service_contexts = _service_contexts;
}
 
Example 33
Project: OpenJSharp   File: RequestMessage_1_2.java   Source Code and License 5 votes vote down vote up
public void write(org.omg.CORBA.portable.OutputStream ostream) {
    super.write(ostream);
    ostream.write_ulong(this.request_id);
    ostream.write_octet(this.response_flags);
    nullCheck(this.reserved);
    if (this.reserved.length != (3)) {
        throw wrapper.badReservedLength(
            org.omg.CORBA.CompletionStatus.COMPLETED_MAYBE);
    }
    for (int _i0 = 0;_i0 < (3); ++_i0) {
        ostream.write_octet(this.reserved[_i0]);
    }
    nullCheck(this.target);
    TargetAddressHelper.write(ostream, this.target);
    ostream.write_string(this.operation);
    if (this.service_contexts != null) {
            service_contexts.write(
            (org.omg.CORBA_2_3.portable.OutputStream) ostream,
            GIOPVersion.V1_2);
        } else {
            ServiceContexts.writeNullServiceContext(
            (org.omg.CORBA_2_3.portable.OutputStream) ostream);
    }

    // CORBA formal 00-11-0 15.4.2.2 GIOP 1.2 body must be
    // aligned on an 8 octet boundary.
    // Ensures that the first write operation called from the stub code,
    // during body construction, would insert a header padding, such that
    // the body is aligned on an 8-octet boundary.
    ((CDROutputStream)ostream).setHeaderPadding(true);
}
 
Example 34
Project: OpenJSharp   File: ReplyMessage_1_1.java   Source Code and License 5 votes vote down vote up
ReplyMessage_1_1(ORB orb, ServiceContexts _service_contexts,
        int _request_id, int _reply_status, IOR _ior) {
    super(Message.GIOPBigMagic, GIOPVersion.V1_1, FLAG_NO_FRAG_BIG_ENDIAN,
        Message.GIOPReply, 0);
    this.orb = orb;
    this.wrapper = ORBUtilSystemException.get( orb,
        CORBALogDomains.RPC_PROTOCOL ) ;
    service_contexts = _service_contexts;
    request_id = _request_id;
    reply_status = _reply_status;
    ior = _ior;
}
 
Example 35
Project: OpenJSharp   File: ReplyMessage_1_1.java   Source Code and License 5 votes vote down vote up
public void write(org.omg.CORBA.portable.OutputStream ostream) {
    super.write(ostream);
    if (this.service_contexts != null) {
            service_contexts.write(
            (org.omg.CORBA_2_3.portable.OutputStream) ostream,
            GIOPVersion.V1_1);
        } else {
            ServiceContexts.writeNullServiceContext(
            (org.omg.CORBA_2_3.portable.OutputStream) ostream);
    }
    ostream.write_ulong(this.request_id);
    ostream.write_long(this.reply_status);
}
 
Example 36
Project: OpenJSharp   File: CorbaServerRequestDispatcherImpl.java   Source Code and License 5 votes vote down vote up
protected CorbaMessageMediator sendingReply(CorbaMessageMediator req)
{
    try {
        if (orb.subcontractDebugFlag) {
            dprint(".sendingReply->: " + opAndId(req));
        }

        ServiceContexts scs = new ServiceContexts(orb);
        return req.getProtocolHandler().createResponse(req, scs);
    } finally {
        if (orb.subcontractDebugFlag) {
            dprint(".sendingReply<-: " + opAndId(req));
        }
    }
}
 
Example 37
Project: openjdk-jdk10   File: CorbaClientRequestDispatcherImpl.java   Source Code and License 5 votes vote down vote up
protected void addServiceContexts(CorbaMessageMediator messageMediator)
{
    ORB orb = (ORB)messageMediator.getBroker();
    CorbaConnection c = (CorbaConnection) messageMediator.getConnection();
    GIOPVersion giopVersion = messageMediator.getGIOPVersion();

    ServiceContexts contexts = messageMediator.getRequestServiceContexts();

    addCodeSetServiceContext(c, contexts, giopVersion);

    // Add the RMI-IIOP max stream format version
    // service context to every request.  Once we have GIOP 1.3,
    // we could skip it since we now support version 2, but
    // probably safer to always send it.
    contexts.put(MaxStreamFormatVersionServiceContext.singleton);

    // ORBVersion servicecontext needs to be sent
    ORBVersionServiceContext ovsc = new ORBVersionServiceContext(
                    ORBVersionFactory.getORBVersion() ) ;
    contexts.put( ovsc ) ;

    // NOTE : We only want to send the runtime context the first time
    if ((c != null) && !c.isPostInitialContexts()) {
        // Do not do c.setPostInitialContexts() here.
        // If a client interceptor send_request does a ForwardRequest
        // which ends up using the same connection then the service
        // context would not be sent.
        SendingContextServiceContext scsc =
            new SendingContextServiceContext( orb.getFVDCodeBaseIOR() ) ; //d11638
        contexts.put( scsc ) ;
    }
}
 
Example 38
Project: openjdk-jdk10   File: CorbaServerRequestDispatcherImpl.java   Source Code and License 5 votes vote down vote up
protected CorbaMessageMediator sendingReply(CorbaMessageMediator req)
{
    try {
        if (orb.subcontractDebugFlag) {
            dprint(".sendingReply->: " + opAndId(req));
        }

        ServiceContexts scs = new ServiceContexts(orb);
        return req.getProtocolHandler().createResponse(req, scs);
    } finally {
        if (orb.subcontractDebugFlag) {
            dprint(".sendingReply<-: " + opAndId(req));
        }
    }
}
 
Example 39
Project: openjdk-jdk10   File: CorbaMessageMediatorImpl.java   Source Code and License 5 votes vote down vote up
public CorbaMessageMediatorImpl(ORB orb,
                                ContactInfo contactInfo,
                                Connection connection,
                                GIOPVersion giopVersion,
                                IOR ior,
                                int requestId,
                                short addrDisposition,
                                String operationName,
                                boolean isOneWay)
{
    this( orb, connection ) ;

    this.contactInfo = (CorbaContactInfo) contactInfo;
    this.addrDisposition = addrDisposition;

    streamFormatVersion =
        getStreamFormatVersionForThisRequest(
            ((CorbaContactInfo)this.contactInfo).getEffectiveTargetIOR(),
            giopVersion);
    streamFormatVersionSet = true;

    requestHeader = (RequestMessage) MessageBase.createRequest(
        this.orb,
        giopVersion,
        ORBUtility.getEncodingVersion(orb, ior),
        requestId,
        !isOneWay,
        ((CorbaContactInfo)this.contactInfo).getEffectiveTargetIOR(),
        this.addrDisposition,
        operationName,
        new ServiceContexts(orb),
        null);
}
 
Example 40
Project: openjdk-jdk10   File: CorbaMessageMediatorImpl.java   Source Code and License 5 votes vote down vote up
public org.omg.CORBA.portable.OutputStream createReply()
{
    // Note: relies on side-effect of setting mediator output field.
    // REVISIT - cast - need interface
    getProtocolHandler().createResponse(this, (ServiceContexts) null);
    return (OutputStream) getOutputObject();
}