com.sun.corba.se.spi.protocol.CorbaMessageMediator Java Examples

The following examples show how to use com.sun.corba.se.spi.protocol.CorbaMessageMediator. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SocketOrChannelConnectionImpl.java    From jdk1.8-source-analysis with Apache License 2.0 6 votes vote down vote up
public boolean read()
{
    try {
        if (orb.transportDebugFlag) {
            dprint(".read->: " + this);
        }
        CorbaMessageMediator messageMediator = readBits();
        if (messageMediator != null) {
            // Null can happen when client closes stream
            // causing purgecalls.
            return dispatch(messageMediator);
        }
        return true;
    } finally {
        if (orb.transportDebugFlag) {
            dprint(".read<-: " + this);
        }
    }
}
 
Example #2
Source File: CDROutputObject.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
public CDROutputObject(ORB orb,
                       MessageMediator messageMediator,
                       Message header,
                       byte streamFormatVersion,
                       int strategy)
{
    this(
        orb,
        ((CorbaMessageMediator)messageMediator).getGIOPVersion(),
        header,
        BufferManagerFactory.
            newBufferManagerWrite(strategy,
                                  header.getEncodingVersion(),
                                  orb),
        streamFormatVersion,
        (CorbaMessageMediator)messageMediator);
}
 
Example #3
Source File: CorbaMessageMediatorImpl.java    From JDKSourceCode1.8 with MIT License 6 votes vote down vote up
protected void runInterceptors(CorbaMessageMediator messageMediator,
                               ReplyMessage reply)
{
    if( messageMediator.executePIInResponseConstructor() ) {
        // Invoke server request ending interception points (send_*):
        // Note: this may end up with a SystemException or an internal
        // Runtime ForwardRequest
        ((ORB)messageMediator.getBroker()).getPIHandler().
            invokeServerPIEndingPoint( reply );

        // Note this will be executed even if a ForwardRequest or
        // SystemException is thrown by a Portable Interceptors ending
        // point since we end up in this constructor again anyway.
        ((ORB)messageMediator.getBroker()).getPIHandler().
            cleanupServerPIRequest();

        // See createSystemExceptionResponse for why this is necesary.
        messageMediator.setExecutePIInResponseConstructor(false);
    }
}
 
Example #4
Source File: CDROutputObject.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
public CDROutputObject(ORB orb, CorbaMessageMediator mediator,
                       GIOPVersion giopVersion,
                       CorbaConnection connection, Message header,
                       byte streamFormatVersion)
{
    this(
        orb,
        giopVersion,
        header,
        BufferManagerFactory.
        newBufferManagerWrite(giopVersion,
                              header.getEncodingVersion(),
                              orb),
        streamFormatVersion,
        mediator);
    this.connection = connection ;
}
 
Example #5
Source File: CDROutputObject.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
public CDROutputObject(ORB orb, CorbaMessageMediator mediator,
                       GIOPVersion giopVersion,
                       CorbaConnection connection, Message header,
                       byte streamFormatVersion)
{
    this(
        orb,
        giopVersion,
        header,
        BufferManagerFactory.
        newBufferManagerWrite(giopVersion,
                              header.getEncodingVersion(),
                              orb),
        streamFormatVersion,
        mediator);
    this.connection = connection ;
}
 
Example #6
Source File: CDROutputObject.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
public CDROutputObject(ORB orb,
                       MessageMediator messageMediator,
                       Message header,
                       byte streamFormatVersion,
                       int strategy)
{
    this(
        orb,
        ((CorbaMessageMediator)messageMediator).getGIOPVersion(),
        header,
        BufferManagerFactory.
            newBufferManagerWrite(strategy,
                                  header.getEncodingVersion(),
                                  orb),
        streamFormatVersion,
        (CorbaMessageMediator)messageMediator);
}
 
Example #7
Source File: PIHandlerImpl.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
public void initializeServerPIInfo( CorbaMessageMediator request,
    ObjectAdapter oa, byte[] objectId, ObjectKeyTemplate oktemp )
{
    if( !hasServerInterceptors ) return;

    RequestInfoStack infoStack =
        (RequestInfoStack)threadLocalServerRequestInfoStack.get();
    ServerRequestInfoImpl info = new ServerRequestInfoImpl( orb );
    infoStack.push( info );
    printPush();

    // Notify request object that once response is constructed, make
    // sure we execute ending points.
    request.setExecutePIInResponseConstructor( true );

    info.setInfo( request, oa, objectId, oktemp );
}
 
Example #8
Source File: CorbaContactInfoBase.java    From jdk1.8-source-analysis with Apache License 2.0 6 votes vote down vote up
public MessageMediator createMessageMediator(Broker broker,
                                             ContactInfo contactInfo,
                                             Connection connection,
                                             String methodName,
                                             boolean isOneWay)
{
    // REVISIT: Would like version, ior, requestid, etc., decisions
    // to be in client subcontract.  Cannot pass these to this
    // factory method because it breaks generic abstraction.
    // Maybe set methods on mediator called from subcontract
    // after creation?
    CorbaMessageMediator messageMediator =
        new CorbaMessageMediatorImpl(
            (ORB) broker,
            contactInfo,
            connection,
            GIOPVersion.chooseRequestVersion( (ORB)broker,
                 effectiveTargetIOR),
            effectiveTargetIOR,
            ((CorbaConnection)connection).getNextRequestId(),
            getAddressingDisposition(),
            methodName,
            isOneWay);

    return messageMediator;
}
 
Example #9
Source File: SharedCDRContactInfoImpl.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
public MessageMediator createMessageMediator(Broker broker,
                                             ContactInfo contactInfo,
                                             Connection connection,
                                             String methodName,
                                             boolean isOneWay)
{
    if (connection != null) {
        /// XXX LOGGING
        throw new RuntimeException("connection is not null");
    }

    CorbaMessageMediator messageMediator =
        new CorbaMessageMediatorImpl(
            (ORB) broker,
            contactInfo,
            null, // Connection;
            GIOPVersion.chooseRequestVersion( (ORB)broker,
                 effectiveTargetIOR),
            effectiveTargetIOR,
            requestId++, // Fake RequestId
            getAddressingDisposition(),
            methodName,
            isOneWay);

    return messageMediator;
}
 
Example #10
Source File: CDROutputObject.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
private CDROutputObject(
    ORB orb, GIOPVersion giopVersion, Message header,
    BufferManagerWrite manager, byte streamFormatVersion,
    CorbaMessageMediator mediator)
{
    super(orb, giopVersion, header.getEncodingVersion(),
          false, manager, streamFormatVersion,
          ((mediator != null && mediator.getConnection() != null) ?
           ((CorbaConnection)mediator.getConnection()).
                 shouldUseDirectByteBuffers() : false));

    this.header = header;
    this.orb = orb;
    this.wrapper = ORBUtilSystemException.get( orb, CORBALogDomains.RPC_ENCODING ) ;
    this.omgWrapper = OMGSystemException.get( orb, CORBALogDomains.RPC_ENCODING ) ;

    getBufferManager().setOutputObject(this);
    this.corbaMessageMediator = mediator;
}
 
Example #11
Source File: CDROutputObject.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
public CDROutputObject(ORB orb,
                       MessageMediator messageMediator,
                       Message header,
                       byte streamFormatVersion,
                       int strategy)
{
    this(
        orb,
        ((CorbaMessageMediator)messageMediator).getGIOPVersion(),
        header,
        BufferManagerFactory.
            newBufferManagerWrite(strategy,
                                  header.getEncodingVersion(),
                                  orb),
        streamFormatVersion,
        (CorbaMessageMediator)messageMediator);
}
 
Example #12
Source File: CDROutputObject.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
public CDROutputObject(ORB orb, CorbaMessageMediator mediator,
                       GIOPVersion giopVersion,
                       CorbaConnection connection, Message header,
                       byte streamFormatVersion)
{
    this(
        orb,
        giopVersion,
        header,
        BufferManagerFactory.
        newBufferManagerWrite(giopVersion,
                              header.getEncodingVersion(),
                              orb),
        streamFormatVersion,
        mediator);
    this.connection = connection ;
}
 
Example #13
Source File: OutputStreamFactory.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
public static CDROutputObject newCDROutputObject(
        final ORB orb, final CorbaMessageMediator mediator,
        final GIOPVersion giopVersion, final CorbaConnection connection,
        final Message header, final byte streamFormatVersion) {
    return AccessController.doPrivileged(
        new PrivilegedAction<CDROutputObject>() {
            @Override
            public CDROutputObject run() {
                return new CDROutputObject(orb, mediator,
                    giopVersion, connection, header, streamFormatVersion);
            }
    });
}
 
Example #14
Source File: CorbaContactInfoBase.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
public MessageMediator finishCreatingMessageMediator(Broker broker,
                           Connection conn, MessageMediator messageMediator)
{
    ORB orb = (ORB) broker;
    CorbaConnection connection = (CorbaConnection) conn;
    CorbaMessageMediator corbaMessageMediator =
                  (CorbaMessageMediator)messageMediator;

    if (orb.transportDebugFlag) {
        dprint(
        ".finishCreatingMessageMediator: waiting for message body on connection: "
            + connection);
    }

    Message msg = corbaMessageMediator.getDispatchHeader();
    msg.setByteBuffer(corbaMessageMediator.getDispatchBuffer());

    // read giop body only
    msg = MessageBase.readGIOPBody(orb, connection, msg);

    ByteBuffer byteBuffer = msg.getByteBuffer();
    msg.setByteBuffer(null);
    corbaMessageMediator.setDispatchHeader(msg);
    corbaMessageMediator.setDispatchBuffer(byteBuffer);

    return corbaMessageMediator;
}
 
Example #15
Source File: CorbaServerRequestDispatcherImpl.java    From JDKSourceCode1.8 with MIT License 5 votes vote down vote up
protected CorbaMessageMediator handleDynamicResult(
    ServerRequestImpl sreq,
    CorbaMessageMediator req)
{
    try {
        if (orb.subcontractDebugFlag) {
            dprint(".handleDynamicResult->: " + opAndId(req));
        }

        CorbaMessageMediator response = null ;

        // Check if ServerRequestImpl.result() has been called
        Any excany = sreq.checkResultCalled();

        if (excany == null) { // normal return
            if (orb.subcontractDebugFlag) {
                dprint(".handleDynamicResult: " + opAndId(req)
                       + ": handling normal result");
            }

            // Marshal out/inout/return parameters into the ReplyMessage
            response = sendingReply(req);
            OutputStream os = (OutputStream) response.getOutputObject();
            sreq.marshalReplyParams(os);
        }  else {
            if (orb.subcontractDebugFlag) {
                dprint(".handleDynamicResult: " + opAndId(req)
                       + ": handling error");
            }

            response = sendingReply(req, excany);
        }

        return response ;
    } finally {
        if (orb.subcontractDebugFlag) {
            dprint(".handleDynamicResult<-: " + opAndId(req));
        }
    }
}
 
Example #16
Source File: CorbaContactInfoBase.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
public MessageMediator finishCreatingMessageMediator(Broker broker,
                           Connection conn, MessageMediator messageMediator)
{
    ORB orb = (ORB) broker;
    CorbaConnection connection = (CorbaConnection) conn;
    CorbaMessageMediator corbaMessageMediator =
                  (CorbaMessageMediator)messageMediator;

    if (orb.transportDebugFlag) {
        dprint(
        ".finishCreatingMessageMediator: waiting for message body on connection: "
            + connection);
    }

    Message msg = corbaMessageMediator.getDispatchHeader();
    msg.setByteBuffer(corbaMessageMediator.getDispatchBuffer());

    // read giop body only
    msg = MessageBase.readGIOPBody(orb, connection, msg);

    ByteBuffer byteBuffer = msg.getByteBuffer();
    msg.setByteBuffer(null);
    corbaMessageMediator.setDispatchHeader(msg);
    corbaMessageMediator.setDispatchBuffer(byteBuffer);

    return corbaMessageMediator;
}
 
Example #17
Source File: SocketOrChannelAcceptorImpl.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
public OutputObject createOutputObject(Broker broker,
                                       MessageMediator messageMediator)
{
    CorbaMessageMediator corbaMessageMediator = (CorbaMessageMediator)
        messageMediator;
    return sun.corba.OutputStreamFactory.newCDROutputObject((ORB) broker,
                   corbaMessageMediator, corbaMessageMediator.getReplyHeader(),
                   corbaMessageMediator.getStreamFormatVersion());
}
 
Example #18
Source File: CorbaContactInfoBase.java    From JDKSourceCode1.8 with MIT License 5 votes vote down vote up
public MessageMediator createMessageMediator(Broker broker,Connection conn)
{
    ORB orb = (ORB) broker;
    CorbaConnection connection = (CorbaConnection) conn;

    if (orb.transportDebugFlag) {
        if (connection.shouldReadGiopHeaderOnly()) {
            dprint(
            ".createMessageMediator: waiting for message header on connection: "
            + connection);
        } else {
            dprint(
            ".createMessageMediator: waiting for message on connection: "
            + connection);
        }
    }

    Message msg = null;

    if (connection.shouldReadGiopHeaderOnly()) {
        // read giop header only
        msg = MessageBase.readGIOPHeader(orb, connection);
    } else {
        // read entire giop message
        msg = MessageBase.readGIOPMessage(orb, connection);
    }

    ByteBuffer byteBuffer = msg.getByteBuffer();
    msg.setByteBuffer(null);
    CorbaMessageMediator messageMediator =
        new CorbaMessageMediatorImpl(orb, connection, msg, byteBuffer);

    return messageMediator;
}
 
Example #19
Source File: SharedCDRContactInfoImpl.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
public OutputObject createOutputObject(MessageMediator messageMediator)
{
    CorbaMessageMediator corbaMessageMediator = (CorbaMessageMediator)
        messageMediator;
    // NOTE: GROW.
    OutputObject outputObject =
        sun.corba.OutputStreamFactory.newCDROutputObject(orb, messageMediator,
                            corbaMessageMediator.getRequestHeader(),
                            corbaMessageMediator.getStreamFormatVersion(),
                            BufferManagerFactory.GROW);
    messageMediator.setOutputObject(outputObject);
    return outputObject;
}
 
Example #20
Source File: CorbaMessageMediatorImpl.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
private void dispatchError(CorbaMessageMediator messageMediator,
                           String msg, Throwable t)
{
    if (orb.subcontractDebugFlag) {
        dprint(".handleRequest: " + opAndId(messageMediator)
               + ": !!ERROR!!: "
               + msg,
               t);
    }
    // REVISIT - this makes hcks sendTwoObjects fail
    // messageMediator.getConnection().close();
}
 
Example #21
Source File: SpecialMethod.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
public CorbaMessageMediator invoke(java.lang.Object servant,
                                   CorbaMessageMediator request,
                                   byte[] objectId,
                                   ObjectAdapter objectAdapter)
{
    boolean result = (servant == null) || (servant instanceof NullServant) ;
    CorbaMessageMediator response =
        request.getProtocolHandler().createResponse(request, null);
    ((OutputStream)response.getOutputObject()).write_boolean(result);
    return response;
}
 
Example #22
Source File: CorbaContactInfoBase.java    From jdk1.8-source-analysis with Apache License 2.0 5 votes vote down vote up
public OutputObject createOutputObject(MessageMediator messageMediator)
{
    CorbaMessageMediator corbaMessageMediator = (CorbaMessageMediator)
        messageMediator;

    OutputObject outputObject =
        sun.corba.OutputStreamFactory.newCDROutputObject(orb, messageMediator,
                            corbaMessageMediator.getRequestHeader(),
                            corbaMessageMediator.getStreamFormatVersion());

    messageMediator.setOutputObject(outputObject);
    return outputObject;
}
 
Example #23
Source File: CorbaMessageMediatorImpl.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
private void beginRequest(CorbaMessageMediator messageMediator)
{
    ORB orb = (ORB) messageMediator.getBroker();
    if (orb.subcontractDebugFlag) {
        dprint(".handleRequest->:");
    }
    connection.serverRequestProcessingBegins();
}
 
Example #24
Source File: CorbaContactInfoBase.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
public InputObject createInputObject(Broker broker,
                                     MessageMediator messageMediator)
{
    // REVISIT: Duplicate of acceptor code.
    CorbaMessageMediator corbaMessageMediator = (CorbaMessageMediator)
        messageMediator;
    return new CDRInputObject((ORB)broker,
                              (CorbaConnection)messageMediator.getConnection(),
                              corbaMessageMediator.getDispatchBuffer(),
                              corbaMessageMediator.getDispatchHeader());
}
 
Example #25
Source File: CorbaMessageMediatorImpl.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 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 #26
Source File: CorbaContactInfoBase.java    From jdk1.8-source-analysis with Apache License 2.0 5 votes vote down vote up
public MessageMediator createMessageMediator(Broker broker,Connection conn)
{
    ORB orb = (ORB) broker;
    CorbaConnection connection = (CorbaConnection) conn;

    if (orb.transportDebugFlag) {
        if (connection.shouldReadGiopHeaderOnly()) {
            dprint(
            ".createMessageMediator: waiting for message header on connection: "
            + connection);
        } else {
            dprint(
            ".createMessageMediator: waiting for message on connection: "
            + connection);
        }
    }

    Message msg = null;

    if (connection.shouldReadGiopHeaderOnly()) {
        // read giop header only
        msg = MessageBase.readGIOPHeader(orb, connection);
    } else {
        // read entire giop message
        msg = MessageBase.readGIOPMessage(orb, connection);
    }

    ByteBuffer byteBuffer = msg.getByteBuffer();
    msg.setByteBuffer(null);
    CorbaMessageMediator messageMediator =
        new CorbaMessageMediatorImpl(orb, connection, msg, byteBuffer);

    return messageMediator;
}
 
Example #27
Source File: CorbaMessageMediatorImpl.java    From jdk1.8-source-analysis with Apache License 2.0 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 #28
Source File: CorbaMessageMediatorImpl.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
private void beginRequest(CorbaMessageMediator messageMediator)
{
    ORB orb = (ORB) messageMediator.getBroker();
    if (orb.subcontractDebugFlag) {
        dprint(".handleRequest->:");
    }
    connection.serverRequestProcessingBegins();
}
 
Example #29
Source File: CorbaMessageMediatorImpl.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
private void sendResponse(CorbaMessageMediator messageMediator)
{
    if (orb.subcontractDebugFlag) {
        dprint(".handleRequest: " + opAndId(messageMediator)
               + ": sending response");
    }
    // REVISIT - type and location
    CDROutputObject outputObject = (CDROutputObject)
        messageMediator.getOutputObject();
    if (outputObject != null) {
        // REVISIT - can be null for TRANSIENT below.
        outputObject.finishSendingMessage();
    }
}
 
Example #30
Source File: CorbaServerRequestDispatcherImpl.java    From jdk1.8-source-analysis with Apache License 2.0 5 votes vote down vote up
protected CorbaMessageMediator handleDynamicResult(
    ServerRequestImpl sreq,
    CorbaMessageMediator req)
{
    try {
        if (orb.subcontractDebugFlag) {
            dprint(".handleDynamicResult->: " + opAndId(req));
        }

        CorbaMessageMediator response = null ;

        // Check if ServerRequestImpl.result() has been called
        Any excany = sreq.checkResultCalled();

        if (excany == null) { // normal return
            if (orb.subcontractDebugFlag) {
                dprint(".handleDynamicResult: " + opAndId(req)
                       + ": handling normal result");
            }

            // Marshal out/inout/return parameters into the ReplyMessage
            response = sendingReply(req);
            OutputStream os = (OutputStream) response.getOutputObject();
            sreq.marshalReplyParams(os);
        }  else {
            if (orb.subcontractDebugFlag) {
                dprint(".handleDynamicResult: " + opAndId(req)
                       + ": handling error");
            }

            response = sendingReply(req, excany);
        }

        return response ;
    } finally {
        if (orb.subcontractDebugFlag) {
            dprint(".handleDynamicResult<-: " + opAndId(req));
        }
    }
}