com.sun.corba.se.spi.orb.ORBVersionFactory Java Examples

The following examples show how to use com.sun.corba.se.spi.orb.ORBVersionFactory. 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: InputStreamHook.java    From JDKSourceCode1.8 with MIT License 6 votes vote down vote up
public void readData(InputStreamHook stream) throws IOException {
    org.omg.CORBA.ORB orb = stream.getOrbStream().orb();
    if ((orb == null) ||
            !(orb instanceof com.sun.corba.se.spi.orb.ORB)) {
        throw new StreamCorruptedException(
                             "Default data must be read first");
    }
    ORBVersion clientOrbVersion =
        ((com.sun.corba.se.spi.orb.ORB)orb).getORBVersion();

    // Fix Date interop bug. For older versions of the ORB don't do
    // anything for readData(). Before this used to throw
    // StreamCorruptedException for older versions of the ORB where
    // calledDefaultWriteObject always returns true.
    if ((ORBVersionFactory.getPEORB().compareTo(clientOrbVersion) <= 0) ||
            (clientOrbVersion.equals(ORBVersionFactory.getFOREIGN()))) {
        // XXX I18N and logging needed.
        throw new StreamCorruptedException("Default data must be read first");
    }
}
 
Example #2
Source File: Util.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
/**
 * This is used to create the TypeCode for a null reference.
 * It also handles backwards compatibility with JDK 1.3.x.
 *
 * This method will not return null.
 */
private TypeCode createTypeCodeForNull(org.omg.CORBA.ORB orb)
{
    if (orb instanceof ORB) {

        ORB ourORB = (ORB)orb;

        // Preserve backwards compatibility with Kestrel and Ladybird
        // by not fully implementing interop issue resolution 3857,
        // and returning a null TypeCode with a tk_value TCKind.
        // If we're not talking to Kestrel or Ladybird, fall through
        // to the abstract interface case (also used for foreign ORBs).
        if (!ORBVersionFactory.getFOREIGN().equals(ourORB.getORBVersion()) &&
            ORBVersionFactory.getNEWER().compareTo(ourORB.getORBVersion()) > 0) {

            return orb.get_primitive_tc(TCKind.tk_value);
        }
    }

    // Use tk_abstract_interface as detailed in the resolution

    // REVISIT: Define this in IDL and get the ID in generated code
    String abstractBaseID = "IDL:omg.org/CORBA/AbstractBase:1.0";

    return orb.create_abstract_interface_tc(abstractBaseID, "");
}
 
Example #3
Source File: InputStreamHook.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
public void readData(InputStreamHook stream) throws IOException {
    org.omg.CORBA.ORB orb = stream.getOrbStream().orb();
    if ((orb == null) ||
            !(orb instanceof com.sun.corba.se.spi.orb.ORB)) {
        throw new StreamCorruptedException(
                             "Default data must be read first");
    }
    ORBVersion clientOrbVersion =
        ((com.sun.corba.se.spi.orb.ORB)orb).getORBVersion();

    // Fix Date interop bug. For older versions of the ORB don't do
    // anything for readData(). Before this used to throw
    // StreamCorruptedException for older versions of the ORB where
    // calledDefaultWriteObject always returns true.
    if ((ORBVersionFactory.getPEORB().compareTo(clientOrbVersion) <= 0) ||
            (clientOrbVersion.equals(ORBVersionFactory.getFOREIGN()))) {
        // XXX I18N and logging needed.
        throw new StreamCorruptedException("Default data must be read first");
    }
}
 
Example #4
Source File: InputStreamHook.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
public void readData(InputStreamHook stream) throws IOException {
    org.omg.CORBA.ORB orb = stream.getOrbStream().orb();
    if ((orb == null) ||
            !(orb instanceof com.sun.corba.se.spi.orb.ORB)) {
        throw new StreamCorruptedException(
                             "Default data must be read first");
    }
    ORBVersion clientOrbVersion =
        ((com.sun.corba.se.spi.orb.ORB)orb).getORBVersion();

    // Fix Date interop bug. For older versions of the ORB don't do
    // anything for readData(). Before this used to throw
    // StreamCorruptedException for older versions of the ORB where
    // calledDefaultWriteObject always returns true.
    if ((ORBVersionFactory.getPEORB().compareTo(clientOrbVersion) <= 0) ||
            (clientOrbVersion.equals(ORBVersionFactory.getFOREIGN()))) {
        // XXX I18N and logging needed.
        throw new StreamCorruptedException("Default data must be read first");
    }
}
 
Example #5
Source File: Util.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
/**
 * This is used to create the TypeCode for a null reference.
 * It also handles backwards compatibility with JDK 1.3.x.
 *
 * This method will not return null.
 */
private TypeCode createTypeCodeForNull(org.omg.CORBA.ORB orb)
{
    if (orb instanceof ORB) {

        ORB ourORB = (ORB)orb;

        // Preserve backwards compatibility with Kestrel and Ladybird
        // by not fully implementing interop issue resolution 3857,
        // and returning a null TypeCode with a tk_value TCKind.
        // If we're not talking to Kestrel or Ladybird, fall through
        // to the abstract interface case (also used for foreign ORBs).
        if (!ORBVersionFactory.getFOREIGN().equals(ourORB.getORBVersion()) &&
            ORBVersionFactory.getNEWER().compareTo(ourORB.getORBVersion()) > 0) {

            return orb.get_primitive_tc(TCKind.tk_value);
        }
    }

    // Use tk_abstract_interface as detailed in the resolution

    // REVISIT: Define this in IDL and get the ID in generated code
    String abstractBaseID = "IDL:omg.org/CORBA/AbstractBase:1.0";

    return orb.create_abstract_interface_tc(abstractBaseID, "");
}
 
Example #6
Source File: InputStreamHook.java    From jdk1.8-source-analysis with Apache License 2.0 6 votes vote down vote up
public void readData(InputStreamHook stream) throws IOException {
    org.omg.CORBA.ORB orb = stream.getOrbStream().orb();
    if ((orb == null) ||
            !(orb instanceof com.sun.corba.se.spi.orb.ORB)) {
        throw new StreamCorruptedException(
                             "Default data must be read first");
    }
    ORBVersion clientOrbVersion =
        ((com.sun.corba.se.spi.orb.ORB)orb).getORBVersion();

    // Fix Date interop bug. For older versions of the ORB don't do
    // anything for readData(). Before this used to throw
    // StreamCorruptedException for older versions of the ORB where
    // calledDefaultWriteObject always returns true.
    if ((ORBVersionFactory.getPEORB().compareTo(clientOrbVersion) <= 0) ||
            (clientOrbVersion.equals(ORBVersionFactory.getFOREIGN()))) {
        // XXX I18N and logging needed.
        throw new StreamCorruptedException("Default data must be read first");
    }
}
 
Example #7
Source File: Util.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * This is used to create the TypeCode for a null reference.
 * It also handles backwards compatibility with JDK 1.3.x.
 *
 * This method will not return null.
 */
private TypeCode createTypeCodeForNull(org.omg.CORBA.ORB orb)
{
    if (orb instanceof ORB) {

        ORB ourORB = (ORB)orb;

        // Preserve backwards compatibility with Kestrel and Ladybird
        // by not fully implementing interop issue resolution 3857,
        // and returning a null TypeCode with a tk_value TCKind.
        // If we're not talking to Kestrel or Ladybird, fall through
        // to the abstract interface case (also used for foreign ORBs).
        if (!ORBVersionFactory.getFOREIGN().equals(ourORB.getORBVersion()) &&
            ORBVersionFactory.getNEWER().compareTo(ourORB.getORBVersion()) > 0) {

            return orb.get_primitive_tc(TCKind.tk_value);
        }
    }

    // Use tk_abstract_interface as detailed in the resolution

    // REVISIT: Define this in IDL and get the ID in generated code
    String abstractBaseID = "IDL:omg.org/CORBA/AbstractBase:1.0";

    return orb.create_abstract_interface_tc(abstractBaseID, "");
}
 
Example #8
Source File: InputStreamHook.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
public void readData(InputStreamHook stream) throws IOException {
    org.omg.CORBA.ORB orb = stream.getOrbStream().orb();
    if ((orb == null) ||
            !(orb instanceof com.sun.corba.se.spi.orb.ORB)) {
        throw new StreamCorruptedException(
                             "Default data must be read first");
    }
    ORBVersion clientOrbVersion =
        ((com.sun.corba.se.spi.orb.ORB)orb).getORBVersion();

    // Fix Date interop bug. For older versions of the ORB don't do
    // anything for readData(). Before this used to throw
    // StreamCorruptedException for older versions of the ORB where
    // calledDefaultWriteObject always returns true.
    if ((ORBVersionFactory.getPEORB().compareTo(clientOrbVersion) <= 0) ||
            (clientOrbVersion.equals(ORBVersionFactory.getFOREIGN()))) {
        // XXX I18N and logging needed.
        throw new StreamCorruptedException("Default data must be read first");
    }
}
 
Example #9
Source File: Util.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * This is used to create the TypeCode for a null reference.
 * It also handles backwards compatibility with JDK 1.3.x.
 *
 * This method will not return null.
 */
private TypeCode createTypeCodeForNull(org.omg.CORBA.ORB orb)
{
    if (orb instanceof ORB) {

        ORB ourORB = (ORB)orb;

        // Preserve backwards compatibility with Kestrel and Ladybird
        // by not fully implementing interop issue resolution 3857,
        // and returning a null TypeCode with a tk_value TCKind.
        // If we're not talking to Kestrel or Ladybird, fall through
        // to the abstract interface case (also used for foreign ORBs).
        if (!ORBVersionFactory.getFOREIGN().equals(ourORB.getORBVersion()) &&
            ORBVersionFactory.getNEWER().compareTo(ourORB.getORBVersion()) > 0) {

            return orb.get_primitive_tc(TCKind.tk_value);
        }
    }

    // Use tk_abstract_interface as detailed in the resolution

    // REVISIT: Define this in IDL and get the ID in generated code
    String abstractBaseID = "IDL:omg.org/CORBA/AbstractBase:1.0";

    return orb.create_abstract_interface_tc(abstractBaseID, "");
}
 
Example #10
Source File: Util.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
/**
 * This is used to create the TypeCode for a null reference.
 * It also handles backwards compatibility with JDK 1.3.x.
 *
 * This method will not return null.
 */
private TypeCode createTypeCodeForNull(org.omg.CORBA.ORB orb)
{
    if (orb instanceof ORB) {

        ORB ourORB = (ORB)orb;

        // Preserve backwards compatibility with Kestrel and Ladybird
        // by not fully implementing interop issue resolution 3857,
        // and returning a null TypeCode with a tk_value TCKind.
        // If we're not talking to Kestrel or Ladybird, fall through
        // to the abstract interface case (also used for foreign ORBs).
        if (!ORBVersionFactory.getFOREIGN().equals(ourORB.getORBVersion()) &&
            ORBVersionFactory.getNEWER().compareTo(ourORB.getORBVersion()) > 0) {

            return orb.get_primitive_tc(TCKind.tk_value);
        }
    }

    // Use tk_abstract_interface as detailed in the resolution

    // REVISIT: Define this in IDL and get the ID in generated code
    String abstractBaseID = "IDL:omg.org/CORBA/AbstractBase:1.0";

    return orb.create_abstract_interface_tc(abstractBaseID, "");
}
 
Example #11
Source File: Util.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
/**
 * This is used to create the TypeCode for a null reference.
 * It also handles backwards compatibility with JDK 1.3.x.
 *
 * This method will not return null.
 */
private TypeCode createTypeCodeForNull(org.omg.CORBA.ORB orb)
{
    if (orb instanceof ORB) {

        ORB ourORB = (ORB)orb;

        // Preserve backwards compatibility with Kestrel and Ladybird
        // by not fully implementing interop issue resolution 3857,
        // and returning a null TypeCode with a tk_value TCKind.
        // If we're not talking to Kestrel or Ladybird, fall through
        // to the abstract interface case (also used for foreign ORBs).
        if (!ORBVersionFactory.getFOREIGN().equals(ourORB.getORBVersion()) &&
            ORBVersionFactory.getNEWER().compareTo(ourORB.getORBVersion()) > 0) {

            return orb.get_primitive_tc(TCKind.tk_value);
        }
    }

    // Use tk_abstract_interface as detailed in the resolution

    // REVISIT: Define this in IDL and get the ID in generated code
    String abstractBaseID = "IDL:omg.org/CORBA/AbstractBase:1.0";

    return orb.create_abstract_interface_tc(abstractBaseID, "");
}
 
Example #12
Source File: GIOPVersion.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
/**
 * This chooses the appropriate GIOP version.
 *
 * @return the GIOP version 13.00 if Java serialization is enabled, or
 *         smallest(profGIOPVersion, orbGIOPVersion)
 */
public static GIOPVersion chooseRequestVersion(ORB orb, IOR ior ) {

    GIOPVersion orbVersion = orb.getORBData().getGIOPVersion();
    IIOPProfile prof = ior.getProfile() ;
    GIOPVersion profVersion = prof.getGIOPVersion();

    // Check if the profile is from a legacy Sun ORB.

    ORBVersion targetOrbVersion = prof.getORBVersion();
    if (!(targetOrbVersion.equals(ORBVersionFactory.getFOREIGN())) &&
            targetOrbVersion.lessThan(ORBVersionFactory.getNEWER())) {
        // we are dealing with a SUN legacy orb which emits 1.1 IORs,
        // in spite of being able to handle only GIOP 1.0 messages.
        return V1_0;
    }

    // Now the target has to be (FOREIGN | NEWER*)

    byte prof_major = profVersion.getMajor();
    byte prof_minor = profVersion.getMinor();

    byte orb_major = orbVersion.getMajor();
    byte orb_minor = orbVersion.getMinor();

    if (orb_major < prof_major) {
        return orbVersion;
    } else if (orb_major > prof_major) {
        return profVersion;
    } else { // both major version are the same
        if (orb_minor <= prof_minor) {
            return orbVersion;
        } else {
            return profVersion;
        }
    }
}
 
Example #13
Source File: ORBUtility.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Returns true if it was accurately determined that the remote ORB is
 * a foreign (non-JavaSoft) ORB.  Note:  If passed the ORBSingleton, this
 * will return false.
 */
public static boolean isForeignORB(ORB orb)
{
    if (orb == null)
        return false;

    try {
        return orb.getORBVersion().equals(ORBVersionFactory.getFOREIGN());
    } catch (SecurityException se) {
        return false;
    }
}
 
Example #14
Source File: OldJIDLObjectKeyTemplate.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
public OldJIDLObjectKeyTemplate( ORB orb, int magic, int scid,
    InputStream is, OctetSeqHolder osh )
{
    this( orb, magic, scid, is );

    osh.value = readObjectKey( is ) ;

    /**
     * Beginning with JDK 1.3.1_01, a byte was placed at the end of
     * the object key with a value indicating the patch version.
     * JDK 1.3.1_01 had the value 1.  If other patches are necessary
     * which involve ORB versioning changes, they should increment
     * the patch version.
     *
     * Note that if we see a value greater than 1 in this code, we
     * will treat it as if we're talking to the most recent ORB version.
     *
     * WARNING: This code is sensitive to changes in CDRInputStream
     * getPosition.  It assumes that the CDRInputStream is an
     * encapsulation whose position can be compared to the object
     * key array length.
     */
    if (magic == ObjectKeyFactoryImpl.JAVAMAGIC_NEW &&
        osh.value.length > ((CDRInputStream)is).getPosition()) {

        patchVersion = is.read_octet();

        if (patchVersion == ObjectKeyFactoryImpl.JDK1_3_1_01_PATCH_LEVEL)
            setORBVersion(ORBVersionFactory.getJDK1_3_1_01());
        else if (patchVersion > ObjectKeyFactoryImpl.JDK1_3_1_01_PATCH_LEVEL)
            setORBVersion(ORBVersionFactory.getORBVersion());
        else
            throw wrapper.invalidJdk131PatchLevel( new Integer( patchVersion ) ) ;
    }
}
 
Example #15
Source File: GIOPVersion.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
/**
 * This chooses the appropriate GIOP version.
 *
 * @return the GIOP version 13.00 if Java serialization is enabled, or
 *         smallest(profGIOPVersion, orbGIOPVersion)
 */
public static GIOPVersion chooseRequestVersion(ORB orb, IOR ior ) {

    GIOPVersion orbVersion = orb.getORBData().getGIOPVersion();
    IIOPProfile prof = ior.getProfile() ;
    GIOPVersion profVersion = prof.getGIOPVersion();

    // Check if the profile is from a legacy Sun ORB.

    ORBVersion targetOrbVersion = prof.getORBVersion();
    if (!(targetOrbVersion.equals(ORBVersionFactory.getFOREIGN())) &&
            targetOrbVersion.lessThan(ORBVersionFactory.getNEWER())) {
        // we are dealing with a SUN legacy orb which emits 1.1 IORs,
        // in spite of being able to handle only GIOP 1.0 messages.
        return V1_0;
    }

    // Now the target has to be (FOREIGN | NEWER*)

    byte prof_major = profVersion.getMajor();
    byte prof_minor = profVersion.getMinor();

    byte orb_major = orbVersion.getMajor();
    byte orb_minor = orbVersion.getMinor();

    if (orb_major < prof_major) {
        return orbVersion;
    } else if (orb_major > prof_major) {
        return profVersion;
    } else { // both major version are the same
        if (orb_minor <= prof_minor) {
            return orbVersion;
        } else {
            return profVersion;
        }
    }
}
 
Example #16
Source File: GIOPVersion.java    From JDKSourceCode1.8 with MIT License 5 votes vote down vote up
/**
 * This chooses the appropriate GIOP version.
 *
 * @return the GIOP version 13.00 if Java serialization is enabled, or
 *         smallest(profGIOPVersion, orbGIOPVersion)
 */
public static GIOPVersion chooseRequestVersion(ORB orb, IOR ior ) {

    GIOPVersion orbVersion = orb.getORBData().getGIOPVersion();
    IIOPProfile prof = ior.getProfile() ;
    GIOPVersion profVersion = prof.getGIOPVersion();

    // Check if the profile is from a legacy Sun ORB.

    ORBVersion targetOrbVersion = prof.getORBVersion();
    if (!(targetOrbVersion.equals(ORBVersionFactory.getFOREIGN())) &&
            targetOrbVersion.lessThan(ORBVersionFactory.getNEWER())) {
        // we are dealing with a SUN legacy orb which emits 1.1 IORs,
        // in spite of being able to handle only GIOP 1.0 messages.
        return V1_0;
    }

    // Now the target has to be (FOREIGN | NEWER*)

    byte prof_major = profVersion.getMajor();
    byte prof_minor = profVersion.getMinor();

    byte orb_major = orbVersion.getMajor();
    byte orb_minor = orbVersion.getMinor();

    if (orb_major < prof_major) {
        return orbVersion;
    } else if (orb_major > prof_major) {
        return profVersion;
    } else { // both major version are the same
        if (orb_minor <= prof_minor) {
            return orbVersion;
        } else {
            return profVersion;
        }
    }
}
 
Example #17
Source File: ORBVersionServiceContext.java    From JDKSourceCode1.8 with MIT License 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 #18
Source File: ORBVersionServiceContext.java    From jdk1.8-source-analysis with Apache License 2.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 #19
Source File: ORBUtility.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Returns true if it was accurately determined that the remote ORB is
 * a foreign (non-JavaSoft) ORB.  Note:  If passed the ORBSingleton, this
 * will return false.
 */
public static boolean isForeignORB(ORB orb)
{
    if (orb == null)
        return false;

    try {
        return orb.getORBVersion().equals(ORBVersionFactory.getFOREIGN());
    } catch (SecurityException se) {
        return false;
    }
}
 
Example #20
Source File: POAObjectKeyTemplate.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
public POAObjectKeyTemplate( ORB orb, int scid, int serverid, String orbid,
    ObjectAdapterId objectAdapterId)
{
    super( orb, ObjectKeyFactoryImpl.JAVAMAGIC_NEWER, scid, serverid, orbid,
        objectAdapterId ) ;

    setORBVersion( ORBVersionFactory.getORBVersion() ) ;
}
 
Example #21
Source File: OldObjectKeyTemplateBase.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
public OldObjectKeyTemplateBase( ORB orb, int magic, int scid, int serverid,
    String orbid, ObjectAdapterId oaid )
{
    super( orb, magic, scid, serverid, orbid, oaid ) ;

    // set version based on magic
    if (magic == ObjectKeyFactoryImpl.JAVAMAGIC_OLD)
        setORBVersion( ORBVersionFactory.getOLD() ) ;
    else if (magic == ObjectKeyFactoryImpl.JAVAMAGIC_NEW)
        setORBVersion( ORBVersionFactory.getNEW() ) ;
    else // any other magic should not be here
        throw wrapper.badMagic( new Integer( magic ) ) ;
}
 
Example #22
Source File: CorbaClientRequestDispatcherImpl.java    From hottub 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: POAObjectKeyTemplate.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
public POAObjectKeyTemplate( ORB orb, int scid, int serverid, String orbid,
    ObjectAdapterId objectAdapterId)
{
    super( orb, ObjectKeyFactoryImpl.JAVAMAGIC_NEWER, scid, serverid, orbid,
        objectAdapterId ) ;

    setORBVersion( ORBVersionFactory.getORBVersion() ) ;
}
 
Example #24
Source File: CorbaClientRequestDispatcherImpl.java    From jdk8u60 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 #25
Source File: GIOPVersion.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * This chooses the appropriate GIOP version.
 *
 * @return the GIOP version 13.00 if Java serialization is enabled, or
 *         smallest(profGIOPVersion, orbGIOPVersion)
 */
public static GIOPVersion chooseRequestVersion(ORB orb, IOR ior ) {

    GIOPVersion orbVersion = orb.getORBData().getGIOPVersion();
    IIOPProfile prof = ior.getProfile() ;
    GIOPVersion profVersion = prof.getGIOPVersion();

    // Check if the profile is from a legacy Sun ORB.

    ORBVersion targetOrbVersion = prof.getORBVersion();
    if (!(targetOrbVersion.equals(ORBVersionFactory.getFOREIGN())) &&
            targetOrbVersion.lessThan(ORBVersionFactory.getNEWER())) {
        // we are dealing with a SUN legacy orb which emits 1.1 IORs,
        // in spite of being able to handle only GIOP 1.0 messages.
        return V1_0;
    }

    // Now the target has to be (FOREIGN | NEWER*)

    byte prof_major = profVersion.getMajor();
    byte prof_minor = profVersion.getMinor();

    byte orb_major = orbVersion.getMajor();
    byte orb_minor = orbVersion.getMinor();

    if (orb_major < prof_major) {
        return orbVersion;
    } else if (orb_major > prof_major) {
        return profVersion;
    } else { // both major version are the same
        if (orb_minor <= prof_minor) {
            return orbVersion;
        } else {
            return profVersion;
        }
    }
}
 
Example #26
Source File: ORBVersionServiceContext.java    From jdk8u60 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 #27
Source File: ORBVersionServiceContext.java    From openjdk-jdk9 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 #28
Source File: JIDLObjectKeyTemplate.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
public JIDLObjectKeyTemplate( ORB orb, int scid, int serverid )
{
    super( orb, ObjectKeyFactoryImpl.JAVAMAGIC_NEWER, scid, serverid,
        JIDL_ORB_ID, JIDL_OAID ) ;

    setORBVersion( ORBVersionFactory.getORBVersion() ) ;
}
 
Example #29
Source File: OldObjectKeyTemplateBase.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
public OldObjectKeyTemplateBase( ORB orb, int magic, int scid, int serverid,
    String orbid, ObjectAdapterId oaid )
{
    super( orb, magic, scid, serverid, orbid, oaid ) ;

    // set version based on magic
    if (magic == ObjectKeyFactoryImpl.JAVAMAGIC_OLD)
        setORBVersion( ORBVersionFactory.getOLD() ) ;
    else if (magic == ObjectKeyFactoryImpl.JAVAMAGIC_NEW)
        setORBVersion( ORBVersionFactory.getNEW() ) ;
    else // any other magic should not be here
        throw wrapper.badMagic( new Integer( magic ) ) ;
}
 
Example #30
Source File: OldJIDLObjectKeyTemplate.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
public OldJIDLObjectKeyTemplate( ORB orb, int magic, int scid,
    InputStream is, OctetSeqHolder osh )
{
    this( orb, magic, scid, is );

    osh.value = readObjectKey( is ) ;

    /**
     * Beginning with JDK 1.3.1_01, a byte was placed at the end of
     * the object key with a value indicating the patch version.
     * JDK 1.3.1_01 had the value 1.  If other patches are necessary
     * which involve ORB versioning changes, they should increment
     * the patch version.
     *
     * Note that if we see a value greater than 1 in this code, we
     * will treat it as if we're talking to the most recent ORB version.
     *
     * WARNING: This code is sensitive to changes in CDRInputStream
     * getPosition.  It assumes that the CDRInputStream is an
     * encapsulation whose position can be compared to the object
     * key array length.
     */
    if (magic == ObjectKeyFactoryImpl.JAVAMAGIC_NEW &&
        osh.value.length > ((CDRInputStream)is).getPosition()) {

        patchVersion = is.read_octet();

        if (patchVersion == ObjectKeyFactoryImpl.JDK1_3_1_01_PATCH_LEVEL)
            setORBVersion(ORBVersionFactory.getJDK1_3_1_01());
        else if (patchVersion > ObjectKeyFactoryImpl.JDK1_3_1_01_PATCH_LEVEL)
            setORBVersion(ORBVersionFactory.getORBVersion());
        else
            throw wrapper.invalidJdk131PatchLevel( new Integer( patchVersion ) ) ;
    }
}