Java Code Examples for com.sun.corba.se.spi.ior.iiop.GIOPVersion

The following are top voted examples for showing how to use com.sun.corba.se.spi.ior.iiop.GIOPVersion. 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: openjdk-jdk10   File: CorbaMessageMediatorImpl.java   View source code 6 votes vote down vote up
private byte getStreamFormatVersionForThisRequest(IOR ior,
                                                  GIOPVersion giopVersion)
{

    byte localMaxVersion
        = ORBUtility.getMaxStreamFormatVersion();

    IOR effectiveTargetIOR =
        ((CorbaContactInfo)this.contactInfo).getEffectiveTargetIOR();
    IIOPProfileTemplate temp =
        (IIOPProfileTemplate)effectiveTargetIOR.getProfile().getTaggedProfileTemplate();
    Iterator iter = temp.iteratorById(TAG_RMI_CUSTOM_MAX_STREAM_FORMAT.value);
    if (!iter.hasNext()) {
        // Didn't have the max stream format version tagged
        // component.
        if (giopVersion.lessThan(GIOPVersion.V1_3))
            return ORBConstants.STREAM_FORMAT_VERSION_1;
        else
            return ORBConstants.STREAM_FORMAT_VERSION_2;
    }

    byte remoteMaxVersion
        = ((MaxStreamFormatVersionComponent)iter.next()).getMaxStreamFormatVersion();

    return (byte)Math.min(localMaxVersion, remoteMaxVersion);
}
 
Example 2
Project: openjdk-jdk10   File: SharedCDRContactInfoImpl.java   View source code 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 3
Project: openjdk-jdk10   File: MessageBase.java   View source code 6 votes vote down vote up
public static Message createCloseConnection(GIOPVersion gv) {
    if (gv.equals(GIOPVersion.V1_0)) { // 1.0
        return new Message_1_0(Message.GIOPBigMagic, false,
                               Message.GIOPCloseConnection, 0);
    } else if (gv.equals(GIOPVersion.V1_1)) { // 1.1
        return new Message_1_1(Message.GIOPBigMagic, GIOPVersion.V1_1,
                               FLAG_NO_FRAG_BIG_ENDIAN,
                               Message.GIOPCloseConnection, 0);
    } else if (gv.equals(GIOPVersion.V1_2)) { // 1.2
        return new Message_1_1(Message.GIOPBigMagic, GIOPVersion.V1_2,
                               FLAG_NO_FRAG_BIG_ENDIAN,
                               Message.GIOPCloseConnection, 0);
    } else {
        throw wrapper.giopVersionError(
            CompletionStatus.COMPLETED_MAYBE);
    }
}
 
Example 4
Project: OpenJSharp   File: CDROutputObject.java   View source code 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 5
Project: OpenJSharp   File: CorbaMessageMediatorImpl.java   View source code 6 votes vote down vote up
private CDROutputObject createAppropriateOutputObject(
    CorbaMessageMediator messageMediator,
    Message msg, LocateReplyMessage reply)
{
    CDROutputObject outputObject;

    if (msg.getGIOPVersion().lessThan(GIOPVersion.V1_2)) {
        // locate msgs 1.0 & 1.1 :=> grow,
        outputObject = sun.corba.OutputStreamFactory.newCDROutputObject(
                         (ORB) messageMediator.getBroker(),
                         this,
                         GIOPVersion.V1_0,
                         (CorbaConnection) messageMediator.getConnection(),
                         reply,
                         ORBConstants.STREAM_FORMAT_VERSION_1);
    } else {
        // 1.2 :=> stream
        outputObject = sun.corba.OutputStreamFactory.newCDROutputObject(
                         (ORB) messageMediator.getBroker(),
                         messageMediator,
                         reply,
                         ORBConstants.STREAM_FORMAT_VERSION_1);
    }
    return outputObject;
}
 
Example 6
Project: OpenJSharp   File: RequestMessage_1_1.java   View source code 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 7
Project: openjdk-jdk10   File: BufferManagerFactory.java   View source code 6 votes vote down vote up
public static BufferManagerRead newBufferManagerRead(
        GIOPVersion version, byte encodingVersion, ORB orb) {

    // REVISIT - On the reading side, shouldn't we monitor the incoming
    // fragments on a given connection to determine what fragment size
    // they're using, then use that ourselves?

    if (encodingVersion != Message.CDR_ENC_VERSION) {
        return new BufferManagerReadGrow(orb);
    }

    switch (version.intValue())
    {
        case GIOPVersion.VERSION_1_0:
            return new BufferManagerReadGrow(orb);
        case GIOPVersion.VERSION_1_1:
        case GIOPVersion.VERSION_1_2:
            // The stream reader can handle fragmented and
            // non fragmented messages
            return new BufferManagerReadStream(orb);
        default:
            // REVISIT - what is appropriate?
            throw new INTERNAL("Unknown GIOP version: "
                               + version);
    }
}
 
Example 8
Project: openjdk-jdk10   File: CDROutputStream.java   View source code 6 votes vote down vote up
public static CDROutputStreamBase newOutputStream(
        ORB orb, GIOPVersion version, byte encodingVersion) {
    switch(version.intValue()) {
        case GIOPVersion.VERSION_1_0:
            return new CDROutputStream_1_0();
        case GIOPVersion.VERSION_1_1:
            return new CDROutputStream_1_1();
    case GIOPVersion.VERSION_1_2:
        if (encodingVersion != Message.CDR_ENC_VERSION) {
            return
                new IDLJavaSerializationOutputStream(encodingVersion);
        }
        return new CDROutputStream_1_2();
    default:
            ORBUtilSystemException wrapper = ORBUtilSystemException.get( orb,
                CORBALogDomains.RPC_ENCODING ) ;
            // REVISIT - what is appropriate?  INTERNAL exceptions
            // are really hard to track later.
            throw wrapper.unsupportedGiopVersion( version ) ;
    }
}
 
Example 9
Project: openjdk-jdk10   File: ServiceContexts.java   View source code 6 votes vote down vote up
/**
 * Write the service contexts in scMap in a desired order.
 * Right now, the only special case we have is UnknownExceptionInfo,
 * so I'm merely writing it last if present.
 */
private void writeServiceContextsInOrder(OutputStream os, GIOPVersion gv) {

    // Temporarily remove this rather than check it per iteration
    Integer ueInfoId
        = new Integer(UEInfoServiceContext.SERVICE_CONTEXT_ID);

    Object unknownExceptionInfo = scMap.remove(ueInfoId);

    Iterator iter = scMap.keySet().iterator();

    while (iter.hasNext()) {
        Integer id = (Integer)iter.next();

        writeMapEntry(os, id, scMap.get(id), gv);
    }

    // Write the UnknownExceptionInfo service context last
    // (so it will be after the CodeBase) and restore it in
    // the map.
    if (unknownExceptionInfo != null) {
        writeMapEntry(os, ueInfoId, unknownExceptionInfo, gv);

        scMap.put(ueInfoId, unknownExceptionInfo);
    }
}
 
Example 10
Project: OpenJSharp   File: MessageBase.java   View source code 6 votes vote down vote up
public static Message createCloseConnection(GIOPVersion gv) {
    if (gv.equals(GIOPVersion.V1_0)) { // 1.0
        return new Message_1_0(Message.GIOPBigMagic, false,
                               Message.GIOPCloseConnection, 0);
    } else if (gv.equals(GIOPVersion.V1_1)) { // 1.1
        return new Message_1_1(Message.GIOPBigMagic, GIOPVersion.V1_1,
                               FLAG_NO_FRAG_BIG_ENDIAN,
                               Message.GIOPCloseConnection, 0);
    } else if (gv.equals(GIOPVersion.V1_2)) { // 1.2
        return new Message_1_1(Message.GIOPBigMagic, GIOPVersion.V1_2,
                               FLAG_NO_FRAG_BIG_ENDIAN,
                               Message.GIOPCloseConnection, 0);
    } else {
        throw wrapper.giopVersionError(
            CompletionStatus.COMPLETED_MAYBE);
    }
}
 
Example 11
Project: openjdk-jdk10   File: RequestMessage_1_1.java   View source code 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 12
Project: OpenJSharp   File: CDROutputStream.java   View source code 6 votes vote down vote up
public static CDROutputStreamBase newOutputStream(
        ORB orb, GIOPVersion version, byte encodingVersion) {
    switch(version.intValue()) {
        case GIOPVersion.VERSION_1_0:
            return new CDROutputStream_1_0();
        case GIOPVersion.VERSION_1_1:
            return new CDROutputStream_1_1();
    case GIOPVersion.VERSION_1_2:
        if (encodingVersion != Message.CDR_ENC_VERSION) {
            return
                new IDLJavaSerializationOutputStream(encodingVersion);
        }
        return new CDROutputStream_1_2();
    default:
            ORBUtilSystemException wrapper = ORBUtilSystemException.get( orb,
                CORBALogDomains.RPC_ENCODING ) ;
            // REVISIT - what is appropriate?  INTERNAL exceptions
            // are really hard to track later.
            throw wrapper.unsupportedGiopVersion( version ) ;
    }
}
 
Example 13
Project: OpenJSharp   File: CDROutputStream.java   View source code 6 votes vote down vote up
public CDROutputStream(ORB orb,
                       GIOPVersion version,
                       byte encodingVersion,
                       boolean littleEndian,
                       BufferManagerWrite bufferManager,
                       byte streamFormatVersion,
                       boolean usePooledByteBuffers)
{
    impl = OutputStreamFactory.newOutputStream(orb, version,
                                               encodingVersion);
    impl.init(orb, littleEndian, bufferManager,
              streamFormatVersion, usePooledByteBuffers);

    impl.setParent(this);
    this.orb = orb ;
    this.wrapper = ORBUtilSystemException.get( orb,
        CORBALogDomains.RPC_ENCODING ) ;
}
 
Example 14
Project: OpenJSharp   File: CDRInputStream.java   View source code 6 votes vote down vote up
public static CDRInputStreamBase newInputStream(
        ORB orb, GIOPVersion version, byte encodingVersion) {
    switch(version.intValue()) {
        case GIOPVersion.VERSION_1_0:
            return new CDRInputStream_1_0();
        case GIOPVersion.VERSION_1_1:
            return new CDRInputStream_1_1();
        case GIOPVersion.VERSION_1_2:
            if (encodingVersion != Message.CDR_ENC_VERSION) {
                return
                  new IDLJavaSerializationInputStream(encodingVersion);
            }
            return new CDRInputStream_1_2();
            // else fall through and report exception.
        default:
            ORBUtilSystemException wrapper = ORBUtilSystemException.get( orb,
                CORBALogDomains.RPC_ENCODING ) ;
            throw wrapper.unsupportedGiopVersion( version ) ;
    }
}
 
Example 15
Project: openjdk-jdk10   File: ReplyMessage_1_2.java   View source code 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 16
Project: openjdk-jdk10   File: CorbaContactInfoBase.java   View source code 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 17
Project: openjdk-jdk10   File: EncapsOutputStream.java   View source code 6 votes vote down vote up
protected CodeSetConversion.CTBConverter createWCharCTBConverter() {
    if (getGIOPVersion().equals(GIOPVersion.V1_0))
        throw wrapper.wcharDataInGiop10(CompletionStatus.COMPLETED_MAYBE);

    // In the case of GIOP 1.1, we take the byte order of the stream and don't
    // use byte order markers since we're limited to a 2 byte fixed width encoding.
    if (getGIOPVersion().equals(GIOPVersion.V1_1))
        return CodeSetConversion.impl().getCTBConverter(OSFCodeSetRegistry.UTF_16,
                                                        isLittleEndian(),
                                                        false);

    // Assume anything else meets GIOP 1.2 requirements
    //
    // Use byte order markers?  If not, use big endian in GIOP 1.2.
    // (formal 00-11-03 15.3.16)

    boolean useBOM = ((ORB)orb()).getORBData().useByteOrderMarkersInEncapsulations();

    return CodeSetConversion.impl().getCTBConverter(OSFCodeSetRegistry.UTF_16,
                                                    false,
                                                    useBOM);
}
 
Example 18
Project: OpenJSharp   File: EncapsInputStreamFactory.java   View source code 5 votes vote down vote up
public static EncapsInputStream newEncapsInputStream(
        final org.omg.CORBA.ORB orb, final byte[] buf, final int size,
        final boolean littleEndian, final GIOPVersion version) {
    return AccessController
            .doPrivileged(new PrivilegedAction<EncapsInputStream>() {
                @Override
                public EncapsInputStream run() {
                    return new EncapsInputStream(orb, buf, size,
                            littleEndian, version);
                }
            });
}
 
Example 19
Project: OpenJSharp   File: EncapsInputStreamFactory.java   View source code 5 votes vote down vote up
public static EncapsInputStream newEncapsInputStream(
        final org.omg.CORBA.ORB orb, final ByteBuffer byteBuffer,
        final int size, final boolean littleEndian,
        final GIOPVersion version) {
    return AccessController
            .doPrivileged(new PrivilegedAction<EncapsInputStream>() {
                @Override
                public EncapsInputStream run() {
                    return new EncapsInputStream(orb, byteBuffer, size,
                            littleEndian, version);
                }
            });
}
 
Example 20
Project: OpenJSharp   File: EncapsInputStreamFactory.java   View source code 5 votes vote down vote up
public static EncapsInputStream newEncapsInputStream(
        final org.omg.CORBA.ORB orb, final byte[] data, final int size,
        final GIOPVersion version) {
    return AccessController
            .doPrivileged(new PrivilegedAction<EncapsInputStream>() {
                @Override
                public EncapsInputStream run() {
                    return new EncapsInputStream(orb, data, size, version);
                }
            });
}
 
Example 21
Project: openjdk-jdk10   File: CorbaMessageMediatorImpl.java   View source code 5 votes vote down vote up
public GIOPVersion getGIOPVersion()
{
    if (messageHeader != null) {
        return messageHeader.getGIOPVersion();
    }
    return getRequestHeader().getGIOPVersion();
}
 
Example 22
Project: OpenJSharp   File: EncapsInputStreamFactory.java   View source code 5 votes vote down vote up
public static TypeCodeInputStream newTypeCodeInputStream(
        final org.omg.CORBA.ORB orb, final byte[] buf, final int size,
        final boolean littleEndian, final GIOPVersion version) {
    return AccessController
            .doPrivileged(new PrivilegedAction<TypeCodeInputStream>() {
                @Override
                public TypeCodeInputStream run() {
                    return new TypeCodeInputStream(orb, buf, size,
                            littleEndian, version);
                }
            });
}
 
Example 23
Project: openjdk-jdk10   File: EncapsInputStreamFactory.java   View source code 5 votes vote down vote up
public static EncapsInputStream newEncapsInputStream(
        final org.omg.CORBA.ORB orb, final byte[] buf, final int size,
        final boolean littleEndian, final GIOPVersion version) {
    return AccessController
            .doPrivileged(new PrivilegedAction<EncapsInputStream>() {
                @Override
                public EncapsInputStream run() {
                    return new EncapsInputStream(orb, buf, size,
                            littleEndian, version);
                }
            });
}
 
Example 24
Project: OpenJSharp   File: OutputStreamFactory.java   View source code 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 25
Project: openjdk-jdk10   File: ReplyMessage_1_0.java   View source code 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 26
Project: openjdk-jdk10   File: CDRInputObject.java   View source code 5 votes vote down vote up
protected CodeSetConversion.BTCConverter createWCharBTCConverter() {

        CodeSetComponentInfo.CodeSetContext codesets = getCodeSets();

        // If the connection doesn't have its negotiated
        // code sets by now, we have to throw an exception.
        // See CORBA formal 00-11-03 13.9.2.6.
        if (codesets == null) {
            if (getConnection().isServer())
                throw omgWrapper.noClientWcharCodesetCtx() ;
            else
                throw omgWrapper.noServerWcharCodesetCmp() ;
        }

        OSFCodeSetRegistry.Entry wcharSet
            = OSFCodeSetRegistry.lookupEntry(codesets.getWCharCodeSet());

        if (wcharSet == null)
            throw wrapper.unknownCodeset( wcharSet ) ;

        // For GIOP 1.2 and UTF-16, use big endian if there is no byte
        // order marker.  (See issue 3405b)
        //
        // For GIOP 1.1 and UTF-16, use the byte order the stream if
        // there isn't (and there shouldn't be) a byte order marker.
        //
        // GIOP 1.0 doesn't have wchars.  If we're talking to a legacy ORB,
        // we do what our old ORBs did.
        if (wcharSet == OSFCodeSetRegistry.UTF_16) {
            if (getGIOPVersion().equals(GIOPVersion.V1_2))
                return CodeSetConversion.impl().getBTCConverter(wcharSet, false);
        }

        return CodeSetConversion.impl().getBTCConverter(wcharSet, isLittleEndian());
    }
 
Example 27
Project: OpenJSharp   File: ServiceContext.java   View source code 5 votes vote down vote up
/** Write the service context to an output stream.  This method
 * must be used for writing the service context to a request or reply
 * header.
 */
public void write(OutputStream s, GIOPVersion gv) throws SystemException
{
    EncapsOutputStream os =
        sun.corba.OutputStreamFactory.newEncapsOutputStream((ORB)(s.orb()), gv);
    os.putEndian() ;
    writeData( os ) ;
    byte[] data = os.toByteArray() ;

    s.write_long(getId());
    s.write_long(data.length);
    s.write_octet_array(data, 0, data.length);
}
 
Example 28
Project: OpenJSharp   File: UnknownServiceContext.java   View source code 5 votes vote down vote up
public void write( OutputStream os , GIOPVersion gv)
    throws SystemException
{
    os.write_long( id ) ;
    os.write_long( data.length ) ;
    os.write_octet_array( data, 0, data.length ) ;
}
 
Example 29
Project: openjdk-jdk10   File: ServiceContexts.java   View source code 5 votes vote down vote up
/**
 * Write the service contexts to the output stream.
 *
 * If they haven't been unmarshaled, we don't have to
 * unmarshal them.
 */
public void write(OutputStream os, GIOPVersion gv)
{
    if (isDebugging(os)) {
        dprint( "Writing service contexts to output stream" ) ;
        Utility.printStackTrace() ;
    }

    int numsc = scMap.size();

    if (addAlignmentOnWrite) {
        if (isDebugging(os))
            dprint( "Adding alignment padding" ) ;

        numsc++ ;
    }

    if (isDebugging(os))
        dprint( "Service context has " + numsc + " components"  ) ;

    os.write_long( numsc ) ;

    writeServiceContextsInOrder(os, gv);

    if (addAlignmentOnWrite) {
        if (isDebugging(os))
            dprint( "Writing alignment padding" ) ;

        os.write_long( JAVAIDL_ALIGN_SERVICE_ID ) ;
        os.write_long( 4 ) ;
        os.write_octet( (byte)0 ) ;
        os.write_octet( (byte)0 ) ;
        os.write_octet( (byte)0 ) ;
        os.write_octet( (byte)0 ) ;
    }

    if (isDebugging(os))
        dprint( "Service context writing complete" ) ;
}
 
Example 30
Project: OpenJSharp   File: ServiceContexts.java   View source code 5 votes vote down vote up
/**
 * Write the service contexts to the output stream.
 *
 * If they haven't been unmarshaled, we don't have to
 * unmarshal them.
 */
public void write(OutputStream os, GIOPVersion gv)
{
    if (isDebugging(os)) {
        dprint( "Writing service contexts to output stream" ) ;
        Utility.printStackTrace() ;
    }

    int numsc = scMap.size();

    if (addAlignmentOnWrite) {
        if (isDebugging(os))
            dprint( "Adding alignment padding" ) ;

        numsc++ ;
    }

    if (isDebugging(os))
        dprint( "Service context has " + numsc + " components"  ) ;

    os.write_long( numsc ) ;

    writeServiceContextsInOrder(os, gv);

    if (addAlignmentOnWrite) {
        if (isDebugging(os))
            dprint( "Writing alignment padding" ) ;

        os.write_long( JAVAIDL_ALIGN_SERVICE_ID ) ;
        os.write_long( 4 ) ;
        os.write_octet( (byte)0 ) ;
        os.write_octet( (byte)0 ) ;
        os.write_octet( (byte)0 ) ;
        os.write_octet( (byte)0 ) ;
    }

    if (isDebugging(os))
        dprint( "Service context writing complete" ) ;
}
 
Example 31
Project: openjdk-jdk10   File: IIOPProfileImpl.java   View source code 5 votes vote down vote up
private void init( InputStream istr )
{
    // First, read all of the IIOP IOR data
    GIOPVersion version = new GIOPVersion() ;
    version.read( istr ) ;
    IIOPAddress primary = new IIOPAddressImpl( istr ) ;
    byte[] key = EncapsulationUtility.readOctets( istr ) ;

    ObjectKey okey = orb.getObjectKeyFactory().create( key ) ;
    oktemp = okey.getTemplate() ;
    oid = okey.getId() ;

    proftemp = IIOPFactories.makeIIOPProfileTemplate( orb,
        version, primary ) ;

    // Handle any tagged components (if applicable)
    if (version.getMinor() > 0)
        EncapsulationUtility.readIdentifiableSequence( proftemp,
            orb.getTaggedComponentFactoryFinder(), istr ) ;

    // If there is no codebase in this IOR and there IS a
    // java.rmi.server.codebase property set, we need to
    // update the IOR with the local codebase.  Note that
    // there is only one instance of the local codebase, but it
    // can be safely shared in multiple IORs since it is immutable.
    if (uncachedGetCodeBase() == null) {
        JavaCodebaseComponent jcc = LocalCodeBaseSingletonHolder.comp ;

        if (jcc != null) {
            if (version.getMinor() > 0)
                proftemp.add( jcc ) ;

            codebase = jcc.getURLs() ;
        }

        // Whether codebase is null or not, we have it,
        // and so getCodebase ned never call uncachedGetCodebase.
        cachedCodebase = true;
    }
}
 
Example 32
Project: OpenJSharp   File: CorbaOutputObject.java   View source code 5 votes vote down vote up
public CorbaOutputObject(
    ORB orb, GIOPVersion version, byte encodingVersion,
    boolean littleEndian, BufferManagerWrite bufferManager,
    byte streamFormatVersion, boolean usePooledByteBuffers)
{
    super(orb, version, encodingVersion, littleEndian, bufferManager,
          streamFormatVersion, usePooledByteBuffers);
}
 
Example 33
Project: openjdk-jdk10   File: RequestMessage_1_1.java   View source code 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 34
Project: openjdk-jdk10   File: Message_1_2.java   View source code 5 votes vote down vote up
public void write(org.omg.CORBA.portable.OutputStream ostream) {
    if (this.encodingVersion == Message.CDR_ENC_VERSION) {
        super.write(ostream);
        return;
    }
    GIOPVersion gv = this.GIOP_version; // save
    this.GIOP_version = GIOPVersion.getInstance((byte)13,
                                                this.encodingVersion);
    super.write(ostream);
    this.GIOP_version = gv; // restore
}
 
Example 35
Project: openjdk-jdk10   File: EncapsOutputStream.java   View source code 5 votes vote down vote up
public EncapsOutputStream(ORB orb,
                          GIOPVersion version,
                          boolean isLittleEndian)
{
    super(orb, version, Message.CDR_ENC_VERSION, isLittleEndian,
          BufferManagerFactory.newBufferManagerWrite(
                                    BufferManagerFactory.GROW,
                                    Message.CDR_ENC_VERSION,
                                    orb),
          ORBConstants.STREAM_FORMAT_VERSION_1,
          usePooledByteBuffers);
}
 
Example 36
Project: openjdk-jdk10   File: EncapsInputStreamFactory.java   View source code 5 votes vote down vote up
public static TypeCodeInputStream newTypeCodeInputStream(
        final org.omg.CORBA.ORB orb, final ByteBuffer byteBuffer,
        final int size, final boolean littleEndian,
        final GIOPVersion version) {
    return AccessController
            .doPrivileged(new PrivilegedAction<TypeCodeInputStream>() {
                @Override
                public TypeCodeInputStream run() {
                    return new TypeCodeInputStream(orb, byteBuffer, size,
                            littleEndian, version);
                }
            });
}
 
Example 37
Project: openjdk-jdk10   File: ServiceContext.java   View source code 5 votes vote down vote up
/** Write the service context to an output stream.  This method
 * must be used for writing the service context to a request or reply
 * header.
 */
public void write(OutputStream s, GIOPVersion gv) throws SystemException
{
    EncapsOutputStream os =
        sun.corba.OutputStreamFactory.newEncapsOutputStream((ORB)(s.orb()), gv);
    os.putEndian() ;
    writeData( os ) ;
    byte[] data = os.toByteArray() ;

    s.write_long(getId());
    s.write_long(data.length);
    s.write_octet_array(data, 0, data.length);
}
 
Example 38
Project: openjdk-jdk10   File: SocketOrChannelConnectionImpl.java   View source code 5 votes vote down vote up
public void sendCancelRequestWithLock(GIOPVersion giopVersion,
                                      int requestId)
    throws IOException
{
    writeLock();
    try {
        sendCancelRequest(giopVersion, requestId);
    } finally {
        writeUnlock();
    }
}
 
Example 39
Project: OpenJSharp   File: Message_1_2.java   View source code 5 votes vote down vote up
public void write(org.omg.CORBA.portable.OutputStream ostream) {
    if (this.encodingVersion == Message.CDR_ENC_VERSION) {
        super.write(ostream);
        return;
    }
    GIOPVersion gv = this.GIOP_version; // save
    this.GIOP_version = GIOPVersion.getInstance((byte)13,
                                                this.encodingVersion);
    super.write(ostream);
    this.GIOP_version = gv; // restore
}
 
Example 40
Project: openjdk-jdk10   File: LocateReplyMessage_1_2.java   View source code 5 votes vote down vote up
LocateReplyMessage_1_2(ORB orb, int _request_id,
        int _reply_status, 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;
}