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

The following examples show how to use com.sun.corba.se.spi.ior.iiop.GIOPVersion. 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: CorbaMessageMediatorImpl.java    From openjdk-8 with GNU General Public License v2.0 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
Source File: CDROutputStream.java    From openjdk-8 with GNU General Public License v2.0 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 #3
Source File: MessageBase.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
public static LocateReplyMessage createLocateReply(
        ORB orb, GIOPVersion gv, byte encodingVersion,
        int request_id, int locate_status, IOR ior) {

    if (gv.equals(GIOPVersion.V1_0)) { // 1.0
        return new LocateReplyMessage_1_0(orb, request_id,
                                          locate_status, ior);
    } else if (gv.equals(GIOPVersion.V1_1)) { // 1.1
        return new LocateReplyMessage_1_1(orb, request_id,
                                          locate_status, ior);
    } else if (gv.equals(GIOPVersion.V1_2)) { // 1.2
        LocateReplyMessage msg =
            new LocateReplyMessage_1_2(orb, request_id,
                                       locate_status, ior);
        msg.setEncodingVersion(encodingVersion);
        return msg;
    } else {
        throw wrapper.giopVersionError(
            CompletionStatus.COMPLETED_MAYBE);
    }
}
 
Example #4
Source File: CDRInputStream.java    From openjdk-jdk8u with GNU General Public License v2.0 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 #5
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 #6
Source File: ServiceContexts.java    From openjdk-8-source with GNU General Public License v2.0 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 #7
Source File: CorbaContactInfoBase.java    From openjdk-jdk9 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)
{
    // 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 #8
Source File: BootstrapResolverImpl.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
public BootstrapResolverImpl(ORB orb, String host, int port) {
    wrapper = ORBUtilSystemException.get( orb,
        CORBALogDomains.ORB_RESOLVER ) ;

    // Create a new IOR with the magic of INIT
    byte[] initialKey = "INIT".getBytes() ;
    ObjectKey okey = orb.getObjectKeyFactory().create(initialKey) ;

    IIOPAddress addr = IIOPFactories.makeIIOPAddress( orb, host, port ) ;
    IIOPProfileTemplate ptemp = IIOPFactories.makeIIOPProfileTemplate(
        orb, GIOPVersion.V1_0, addr);

    IORTemplate iortemp = IORFactories.makeIORTemplate( okey.getTemplate() ) ;
    iortemp.add( ptemp ) ;

    IOR initialIOR = iortemp.makeIOR( (com.sun.corba.se.spi.orb.ORB)orb,
        "", okey.getId() ) ;

    bootstrapDelegate = ORBUtility.makeClientDelegate( initialIOR ) ;
}
 
Example #9
Source File: CorbaMessageMediatorImpl.java    From openjdk-jdk9 with GNU General Public License v2.0 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 #10
Source File: CorbaMessageMediatorImpl.java    From openjdk-8-source with GNU General Public License v2.0 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 #11
Source File: ServiceContexts.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Write the given entry from the scMap to the OutputStream.
 * See note on giopVersion.  The service context should
 * know the GIOP version it is meant for.
 */
private void writeMapEntry(OutputStream os, Integer id, Object scObj, GIOPVersion gv) {

    // If it's still in byte[] form, we don't need to
    // unmarshal it here, just copy the bytes into
    // the new stream.

    if (scObj instanceof byte[]) {
        if (isDebugging(os))
            dprint( "Writing service context bytes for id " + id);

        OctetSeqHelper.write(os, (byte[])scObj);

    } else {

        // We actually unmarshaled it into a ServiceContext
        // at some point.
        ServiceContext sc = (ServiceContext)scObj;

        if (isDebugging(os))
            dprint( "Writing service context " + sc ) ;

        sc.write(os, gv);
    }
}
 
Example #12
Source File: CDROutputStream.java    From openjdk-8 with GNU General Public License v2.0 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 #13
Source File: MessageBase.java    From jdk1.8-source-analysis with Apache License 2.0 6 votes vote down vote up
public static LocateRequestMessage createLocateRequest(
        ORB orb, GIOPVersion gv, byte encodingVersion,
        int request_id, byte[] object_key) {

    if (gv.equals(GIOPVersion.V1_0)) { // 1.0
        return new LocateRequestMessage_1_0(orb, request_id, object_key);
    } else if (gv.equals(GIOPVersion.V1_1)) { // 1.1
        return new LocateRequestMessage_1_1(orb, request_id, object_key);
    } else if (gv.equals(GIOPVersion.V1_2)) { // 1.2
        TargetAddress target = new TargetAddress();
        target.object_key(object_key);
        LocateRequestMessage msg =
            new LocateRequestMessage_1_2(orb, request_id, target);
        msg.setEncodingVersion(encodingVersion);
        return msg;
    } else {
        throw wrapper.giopVersionError(
            CompletionStatus.COMPLETED_MAYBE);
    }
}
 
Example #14
Source File: ParserTable.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
private Operation makeGVOperation() {
    Operation gvHelper = OperationFactory.listAction( ".",
        OperationFactory.integerAction() ) ;
    Operation gvMain = new Operation() {
        public Object operate( Object value )
        {
            Object[] nums = (Object[])value ;
            int major = ((Integer)(nums[0])).intValue() ;
            int minor = ((Integer)(nums[1])).intValue() ;

            return new GIOPVersion( major, minor ) ;
        }
    } ;

    Operation result = OperationFactory.compose( gvHelper, gvMain );
    return result ;
}
 
Example #15
Source File: ORBVersionServiceContext.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
public ORBVersionServiceContext(InputStream is, GIOPVersion gv)
{
    super(is, gv) ;
    // pay particular attention to where the version is being read from!
    // is contains an encapsulation, ServiceContext reads off the
    // encapsulation and leaves the pointer in the variable "in",
    // which points to the long value.

    version = ORBVersionFactory.create( in ) ;
}
 
Example #16
Source File: ReplyMessage_1_1.java    From openjdk-jdk8u with GNU General Public License v2.0 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 #17
Source File: RequestMessage_1_2.java    From hottub with GNU General Public License v2.0 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 #18
Source File: IIOPProfileTemplateImpl.java    From jdk1.8-source-analysis with Apache License 2.0 5 votes vote down vote up
public IIOPProfileTemplateImpl( InputStream istr )
{
    byte major = istr.read_octet() ;
    byte minor = istr.read_octet() ;
    giopVersion = GIOPVersion.getInstance( major, minor ) ;
    primary = new IIOPAddressImpl( istr ) ;
    orb = (ORB)(istr.orb()) ;
    // Handle any tagged components (if applicable)
    if (minor > 0)
        EncapsulationUtility.readIdentifiableSequence(
            this, orb.getTaggedComponentFactoryFinder(), istr ) ;

    makeImmutable() ;
}
 
Example #19
Source File: CDRInputObject.java    From TencentKona-8 with GNU General Public License v2.0 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 #20
Source File: LocateRequestMessage_1_2.java    From jdk1.8-source-analysis with Apache License 2.0 5 votes vote down vote up
LocateRequestMessage_1_2(ORB orb, int _request_id, TargetAddress _target) {
    super(Message.GIOPBigMagic, GIOPVersion.V1_2, FLAG_NO_FRAG_BIG_ENDIAN,
        Message.GIOPLocateRequest, 0);
    this.orb = orb;
    request_id = _request_id;
    target = _target;
}
 
Example #21
Source File: LocateRequestMessage_1_2.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
LocateRequestMessage_1_2(ORB orb, int _request_id, TargetAddress _target) {
    super(Message.GIOPBigMagic, GIOPVersion.V1_2, FLAG_NO_FRAG_BIG_ENDIAN,
        Message.GIOPLocateRequest, 0);
    this.orb = orb;
    request_id = _request_id;
    target = _target;
}
 
Example #22
Source File: CorbaClientRequestDispatcherImpl.java    From openjdk-jdk9 with GNU General Public License v2.0 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 #23
Source File: OutputStreamFactory.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
public static EncapsOutputStream newEncapsOutputStream(
        final ORB orb, final GIOPVersion giopVersion) {
    return AccessController.doPrivileged(
        new PrivilegedAction<EncapsOutputStream>() {
            @Override
            public EncapsOutputStream run() {
                return new EncapsOutputStream(
                    (com.sun.corba.se.spi.orb.ORB)orb, giopVersion);
            }
    });
}
 
Example #24
Source File: EncapsOutputStream.java    From hottub with GNU General Public License v2.0 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 #25
Source File: EncapsInputStreamFactory.java    From TencentKona-8 with GNU General Public License v2.0 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 #26
Source File: Message_1_1.java    From jdk1.8-source-analysis with Apache License 2.0 5 votes vote down vote up
/**
 * Allows us to create a fragment message from any message type.
 */
public FragmentMessage createFragmentMessage() {

    // check for message type validity

    switch (this.message_type) {
    case GIOPCancelRequest :
    case GIOPCloseConnection :
    case GIOPMessageError :
        throw wrapper.fragmentationDisallowed(
            CompletionStatus.COMPLETED_MAYBE);
    case GIOPLocateRequest :
    case GIOPLocateReply :
        if (this.GIOP_version.equals(GIOPVersion.V1_1)) {
            throw wrapper.fragmentationDisallowed(
                CompletionStatus.COMPLETED_MAYBE);
        }
        break;
    }

    /*
    // A fragmented mesg can be created only if the current mesg' fragment
    // bit is set. Otherwise, raise error
    // too stringent check
    if ( (this.flags & MORE_FRAGMENTS_BIT) != MORE_FRAGMENTS_BIT ) {
            throw wrapper.fragmentationDisallowed( CompletionStatus.COMPLETED_MAYBE);
    }
    */
    if (this.GIOP_version.equals(GIOPVersion.V1_1)) {
        return new FragmentMessage_1_1(this);
    } else if (this.GIOP_version.equals(GIOPVersion.V1_2)) {
        return new FragmentMessage_1_2(this);
    }

    throw wrapper.giopVersionError( CompletionStatus.COMPLETED_MAYBE);
}
 
Example #27
Source File: ServiceContext.java    From openjdk-8-source with GNU General Public License v2.0 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
Source File: EncapsOutputStream.java    From jdk8u60 with GNU General Public License v2.0 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 #29
Source File: CDRInputObject.java    From hottub with GNU General Public License v2.0 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 #30
Source File: UEInfoServiceContext.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
public UEInfoServiceContext(InputStream is, GIOPVersion gv)
{
    super(is, gv) ;

    try {
        unknown = (Throwable) in.read_value() ;
    } catch (ThreadDeath d) {
        throw d ;
    } catch (Throwable e) {
        unknown = new UNKNOWN( 0, CompletionStatus.COMPLETED_MAYBE ) ;
    }
}