Java Code Examples for com.sun.corba.se.impl.protocol.giopmsgheaders.Message#CDR_ENC_VERSION

The following examples show how to use com.sun.corba.se.impl.protocol.giopmsgheaders.Message#CDR_ENC_VERSION . 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: CDROutputStream.java    From jdk8u60 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 2
Source File: BufferManagerFactory.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
public static BufferManagerWrite newBufferManagerWrite(
        int strategy, byte encodingVersion, ORB orb) {
    if (encodingVersion != Message.CDR_ENC_VERSION) {
        if (strategy != BufferManagerFactory.GROW) {
            ORBUtilSystemException wrapper =
                ORBUtilSystemException.get((ORB)orb,
                                           CORBALogDomains.RPC_ENCODING);
            throw wrapper.invalidBuffMgrStrategy("newBufferManagerWrite");
        }
        return new BufferManagerWriteGrow(orb);
    }
    switch (strategy) {
        case BufferManagerFactory.GROW:
            return new BufferManagerWriteGrow(orb);
        case BufferManagerFactory.COLLECT:
            return new BufferManagerWriteCollect(orb);
        case BufferManagerFactory.STREAM:
            return new BufferManagerWriteStream(orb);
        default:
            throw new INTERNAL("Unknown buffer manager write strategy: "
                               + strategy);
    }
}
 
Example 3
Source File: EncapsInputStream.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Full constructor with a CodeBase parameter useful for
 * unmarshaling RMI-IIOP valuetypes (technically against the
 * intention of an encapsulation, but necessary due to OMG
 * issue 4795.  Used by ServiceContexts.
 */
public EncapsInputStream(org.omg.CORBA.ORB orb,
                         byte[] data,
                         int size,
                         GIOPVersion version,
                         CodeBase codeBase) {
    super(orb,
          ByteBuffer.wrap(data),
          size,
          false,
          version, Message.CDR_ENC_VERSION,
          BufferManagerFactory.newBufferManagerRead(
                                  BufferManagerFactory.GROW,
                                  Message.CDR_ENC_VERSION,
                                  (ORB)orb));

    this.codeBase = codeBase;

    performORBVersionSpecificInit();
}
 
Example 4
Source File: EncapsInputStream.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Full constructor with a CodeBase parameter useful for
 * unmarshaling RMI-IIOP valuetypes (technically against the
 * intention of an encapsulation, but necessary due to OMG
 * issue 4795.  Used by ServiceContexts.
 */
public EncapsInputStream(org.omg.CORBA.ORB orb,
                         byte[] data,
                         int size,
                         GIOPVersion version,
                         CodeBase codeBase) {
    super(orb,
          ByteBuffer.wrap(data),
          size,
          false,
          version, Message.CDR_ENC_VERSION,
          BufferManagerFactory.newBufferManagerRead(
                                  BufferManagerFactory.GROW,
                                  Message.CDR_ENC_VERSION,
                                  (ORB)orb));

    this.codeBase = codeBase;

    performORBVersionSpecificInit();
}
 
Example 5
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 6
Source File: CDROutputStream.java    From TencentKona-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 7
Source File: CDROutputStream.java    From openjdk-jdk8u 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 8
Source File: BufferManagerFactory.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
public static BufferManagerWrite newBufferManagerWrite(
        int strategy, byte encodingVersion, ORB orb) {
    if (encodingVersion != Message.CDR_ENC_VERSION) {
        if (strategy != BufferManagerFactory.GROW) {
            ORBUtilSystemException wrapper =
                ORBUtilSystemException.get((ORB)orb,
                                           CORBALogDomains.RPC_ENCODING);
            throw wrapper.invalidBuffMgrStrategy("newBufferManagerWrite");
        }
        return new BufferManagerWriteGrow(orb);
    }
    switch (strategy) {
        case BufferManagerFactory.GROW:
            return new BufferManagerWriteGrow(orb);
        case BufferManagerFactory.COLLECT:
            return new BufferManagerWriteCollect(orb);
        case BufferManagerFactory.STREAM:
            return new BufferManagerWriteStream(orb);
        default:
            throw new INTERNAL("Unknown buffer manager write strategy: "
                               + strategy);
    }
}
 
Example 9
Source File: BufferManagerFactory.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
public static BufferManagerWrite newBufferManagerWrite(
        int strategy, byte encodingVersion, ORB orb) {
    if (encodingVersion != Message.CDR_ENC_VERSION) {
        if (strategy != BufferManagerFactory.GROW) {
            ORBUtilSystemException wrapper =
                ORBUtilSystemException.get((ORB)orb,
                                           CORBALogDomains.RPC_ENCODING);
            throw wrapper.invalidBuffMgrStrategy("newBufferManagerWrite");
        }
        return new BufferManagerWriteGrow(orb);
    }
    switch (strategy) {
        case BufferManagerFactory.GROW:
            return new BufferManagerWriteGrow(orb);
        case BufferManagerFactory.COLLECT:
            return new BufferManagerWriteCollect(orb);
        case BufferManagerFactory.STREAM:
            return new BufferManagerWriteStream(orb);
        default:
            throw new INTERNAL("Unknown buffer manager write strategy: "
                               + strategy);
    }
}
 
Example 10
Source File: EncapsInputStream.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Full constructor with a CodeBase parameter useful for
 * unmarshaling RMI-IIOP valuetypes (technically against the
 * intention of an encapsulation, but necessary due to OMG
 * issue 4795.  Used by ServiceContexts.
 */
public EncapsInputStream(org.omg.CORBA.ORB orb,
                         byte[] data,
                         int size,
                         GIOPVersion version,
                         CodeBase codeBase) {
    super(orb,
          ByteBuffer.wrap(data),
          size,
          false,
          version, Message.CDR_ENC_VERSION,
          BufferManagerFactory.newBufferManagerRead(
                                  BufferManagerFactory.GROW,
                                  Message.CDR_ENC_VERSION,
                                  (ORB)orb));

    this.codeBase = codeBase;

    performORBVersionSpecificInit();
}
 
Example 11
Source File: EncapsInputStream.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Full constructor with a CodeBase parameter useful for
 * unmarshaling RMI-IIOP valuetypes (technically against the
 * intention of an encapsulation, but necessary due to OMG
 * issue 4795.  Used by ServiceContexts.
 */
public EncapsInputStream(org.omg.CORBA.ORB orb,
                         byte[] data,
                         int size,
                         GIOPVersion version,
                         CodeBase codeBase) {
    super(orb,
          ByteBuffer.wrap(data),
          size,
          false,
          version, Message.CDR_ENC_VERSION,
          BufferManagerFactory.newBufferManagerRead(
                                  BufferManagerFactory.GROW,
                                  Message.CDR_ENC_VERSION,
                                  (ORB)orb));

    this.codeBase = codeBase;

    performORBVersionSpecificInit();
}
 
Example 12
Source File: BufferManagerFactory.java    From JDKSourceCode1.8 with MIT License 6 votes vote down vote up
public static BufferManagerRead newBufferManagerRead(
        int strategy, byte encodingVersion, ORB orb) {

    if (encodingVersion != Message.CDR_ENC_VERSION) {
        if (strategy != BufferManagerFactory.GROW) {
            ORBUtilSystemException wrapper =
                ORBUtilSystemException.get((ORB)orb,
                                           CORBALogDomains.RPC_ENCODING);
            throw wrapper.invalidBuffMgrStrategy("newBufferManagerRead");
        }
        return new BufferManagerReadGrow(orb);
    }
    switch (strategy) {
        case BufferManagerFactory.GROW:
            return new BufferManagerReadGrow(orb);
        case BufferManagerFactory.COLLECT:
            throw new INTERNAL("Collect strategy invalid for reading");
        case BufferManagerFactory.STREAM:
            return new BufferManagerReadStream(orb);
        default:
            throw new INTERNAL("Unknown buffer manager read strategy: "
                               + strategy);
    }
}
 
Example 13
Source File: BufferManagerFactory.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 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 14
Source File: EncapsInputStream.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
public EncapsInputStream(org.omg.CORBA.ORB orb, ByteBuffer byteBuffer,
                         int size, boolean littleEndian,
                         GIOPVersion version) {
    super(orb, byteBuffer, size, littleEndian,
          version, Message.CDR_ENC_VERSION,
          BufferManagerFactory.newBufferManagerRead(
                                  BufferManagerFactory.GROW,
                                  Message.CDR_ENC_VERSION,
                                  (com.sun.corba.se.spi.orb.ORB)orb));

    performORBVersionSpecificInit();
}
 
Example 15
Source File: BufferManagerFactory.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
public static BufferManagerWrite newBufferManagerWrite(
    GIOPVersion version, byte encodingVersion, ORB orb) {
    if (encodingVersion != Message.CDR_ENC_VERSION) {
        return new BufferManagerWriteGrow(orb);
    }
    return BufferManagerFactory.newBufferManagerWrite(
        orb.getORBData().getGIOPBuffMgrStrategy(version),
        encodingVersion, orb);
}
 
Example 16
Source File: EncapsInputStream.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
public EncapsInputStream(org.omg.CORBA.ORB orb, byte[] buf,
                         int size, boolean littleEndian,
                         GIOPVersion version) {
    super(orb, ByteBuffer.wrap(buf), size, littleEndian,
          version, Message.CDR_ENC_VERSION,
          BufferManagerFactory.newBufferManagerRead(
                                  BufferManagerFactory.GROW,
                                  Message.CDR_ENC_VERSION,
                                  (ORB)orb));

    wrapper = ORBUtilSystemException.get( (ORB)orb,
        CORBALogDomains.RPC_ENCODING ) ;

    performORBVersionSpecificInit();
}
 
Example 17
Source File: EncapsOutputStream.java    From JDKSourceCode1.8 with MIT License 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 18
Source File: BufferManagerFactory.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
public static BufferManagerWrite newBufferManagerWrite(
    GIOPVersion version, byte encodingVersion, ORB orb) {
    if (encodingVersion != Message.CDR_ENC_VERSION) {
        return new BufferManagerWriteGrow(orb);
    }
    return BufferManagerFactory.newBufferManagerWrite(
        orb.getORBData().getGIOPBuffMgrStrategy(version),
        encodingVersion, orb);
}
 
Example 19
Source File: ORBUtility.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * @return the Java serialization encoding version.
 */
public static byte getEncodingVersion(ORB orb, IOR ior) {

    // Is Java serialization enabled?
    // Check the JavaSerializationComponent (tagged component)
    // in the IIOPProfile. If present, the peer ORB's GIOP is capable
    // of using Java serialization instead of CDR serialization.
    // In such a case, use Java serialization, iff the java serialization
    // versions match.

    if (orb.getORBData().isJavaSerializationEnabled()) {
        IIOPProfile prof = ior.getProfile();
        IIOPProfileTemplate profTemp =
            (IIOPProfileTemplate) prof.getTaggedProfileTemplate();
        java.util.Iterator iter = profTemp.iteratorById(
                              ORBConstants.TAG_JAVA_SERIALIZATION_ID);
        if (iter.hasNext()) {
            JavaSerializationComponent jc =
                (JavaSerializationComponent) iter.next();
            byte jcVersion = jc.javaSerializationVersion();
            if (jcVersion >= Message.JAVA_ENC_VERSION) {
                return Message.JAVA_ENC_VERSION;
            } else if (jcVersion > Message.CDR_ENC_VERSION) {
                return jc.javaSerializationVersion();
            } else {
                // throw error?
                // Since encodingVersion is <= 0 (CDR_ENC_VERSION).
            }
        }
    }
    return Message.CDR_ENC_VERSION; // default
}
 
Example 20
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);
}