public static ORBVersion create(InputStream is) { byte value = is.read_octet(); return byteToVersion(value); }
protected void setORBVersion(InputStream is) { ORBVersion version = ORBVersionFactory.create(is); setORBVersion(version); } }
public ORBVersion getORBVersion() { return ORBVersionFactory.getFOREIGN(); }
/** * Handles ORB versioning of the end tag. Should only be called if chunking. * * If talking to our older ORBs (Standard Extension, Kestrel, and Ladybird), write the end flag that takes into * account all enclosing valuetypes. * * If talking a newer or foreign ORB, or if the orb instance is null, write the end flag that only takes into * account the enclosing chunked valuetypes. */ private void writeNestingLevel() { if (orb == null || ORBVersionFactory.getFOREIGN().equals(orb.getORBVersion()) || ORBVersionFactory.getNEWER().compareTo(orb.getORBVersion()) <= 0) { write_long(chunkedValueNestingLevel); } else { write_long(end_flag); } }
public void readData(InputStreamHook stream) throws IOException { org.omg.CORBA.ORB orb = stream.getOrbStream().orb(); if ((orb == null) || !(orb instanceof org.jboss.com.sun.corba.se.spi.orb.ORB)) { throw new StreamCorruptedException("Default data must be read first"); } ORBVersion clientOrbVersion = ((org.jboss.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"); } } }
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)); } }
public JIDLObjectKeyTemplate(ORB orb, int scid, int serverid) { super(orb, ObjectKeyFactoryImpl.JAVAMAGIC_NEWER, scid, serverid, JIDL_ORB_ID, JIDL_OAID); setORBVersion(ORBVersionFactory.getORBVersion()); }
/** * Returns true if the given ORB could accurately be determined to be a Kestrel or earlier ORB. Note: If passed the * ORBSingleton, this will return false. */ public static boolean isLegacyORB(ORB orb) { try { ORBVersion currentORB = orb.getORBVersion(); return currentORB.equals(ORBVersionFactory.getOLD()); } catch (SecurityException se) { return false; } }
/** * Handles ORB versioning of the end tag. Should only be called if chunking. * * If talking to our older ORBs (Standard Extension, Kestrel, and Ladybird), write the end flag that takes into * account all enclosing valuetypes. * * If talking a newer or foreign ORB, or if the orb instance is null, write the end flag that only takes into * account the enclosing chunked valuetypes. */ private void writeNestingLevel() { if (orb == null || ORBVersionFactory.getFOREIGN().equals(orb.getORBVersion()) || ORBVersionFactory.getNEWER().compareTo(orb.getORBVersion()) <= 0) { write_long(chunkedValueNestingLevel); } else { write_long(end_flag); } }
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)); } }
public void readData(InputStreamHook stream) throws IOException { org.omg.CORBA.ORB orb = stream.getOrbStream().orb(); if ((orb == null) || !(orb instanceof org.jboss.com.sun.corba.se.spi.orb.ORB)) { throw new StreamCorruptedException("Default data must be read first"); } ORBVersion clientOrbVersion = ((org.jboss.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"); } } }
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)); } }
public POAObjectKeyTemplate(ORB orb, int scid, int serverid, String orbid, ObjectAdapterId objectAdapterId) { super(orb, ObjectKeyFactoryImpl.JAVAMAGIC_NEWER, scid, serverid, orbid, objectAdapterId); setORBVersion(ORBVersionFactory.getORBVersion()); }
/** * Returns true if the given ORB could accurately be determined to be a Kestrel or earlier ORB. Note: If passed the * ORBSingleton, this will return false. */ public static boolean isLegacyORB(ORB orb) { try { ORBVersion currentORB = orb.getORBVersion(); return currentORB.equals(ORBVersionFactory.getOLD()); } catch (SecurityException se) { return false; } }
/** * 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, ""); }
public ORBVersion getORBVersion() { return ORBVersionFactory.getFOREIGN(); }
public JIDLObjectKeyTemplate(ORB orb, int scid, int serverid) { super(orb, ObjectKeyFactoryImpl.JAVAMAGIC_NEWER, scid, serverid, JIDL_ORB_ID, JIDL_OAID); setORBVersion(ORBVersionFactory.getORBVersion()); }
public static ORBVersion create(InputStream is) { byte value = is.read_octet(); return byteToVersion(value); }