/** * 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; } }
/** * 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; } }
/** * 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; } }
/** * 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; } }
/** * Checks the version of the ORB and returns the appropriate RepositoryIdStrings instance. */ public static RepositoryIdStrings getRepIdStringsFactory(ORB orb) { if (orb != null) { switch (orb.getORBVersion().getORBType()) { case ORBVersion.NEWER : case ORBVersion.FOREIGN : case ORBVersion.JDK1_3_1_01 : return currentDelegator; case ORBVersion.OLD : return legacyDelegator; case ORBVersion.NEW : return ladybirdDelegator; default : return currentDelegator; } } else return currentDelegator; }
/** * Checks the version of the ORB and returns the appropriate RepositoryIdStrings instance. */ public static RepositoryIdStrings getRepIdStringsFactory(ORB orb) { if (orb != null) { switch (orb.getORBVersion().getORBType()) { case ORBVersion.NEWER : case ORBVersion.FOREIGN : case ORBVersion.JDK1_3_1_01 : return currentDelegator; case ORBVersion.OLD : return legacyDelegator; case ORBVersion.NEW : return ladybirdDelegator; default : return currentDelegator; } } else return currentDelegator; }
/** * Checks the version of the ORB and returns the appropriate RepositoryIdUtility instance. */ public static RepositoryIdUtility getRepIdUtility(ORB orb) { if (orb != null) { switch (orb.getORBVersion().getORBType()) { case ORBVersion.NEWER : case ORBVersion.FOREIGN : case ORBVersion.JDK1_3_1_01 : return currentDelegator; case ORBVersion.OLD : return legacyDelegator; case ORBVersion.NEW : return ladybirdDelegator; default : return currentDelegator; } } else return currentDelegator; } }
/** * Checks the version of the ORB and returns the appropriate RepositoryIdUtility instance. */ public static RepositoryIdUtility getRepIdUtility(ORB orb) { if (orb != null) { switch (orb.getORBVersion().getORBType()) { case ORBVersion.NEWER : case ORBVersion.FOREIGN : case ORBVersion.JDK1_3_1_01 : return currentDelegator; case ORBVersion.OLD : return legacyDelegator; case ORBVersion.NEW : return ladybirdDelegator; default : return currentDelegator; } } else return currentDelegator; } }
/** * 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); } }
/** * 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); } }
/** * 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, ""); }
/** * 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 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 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"); } } }
/** * Creates the correct ValueHandler for the given ORB, querying ORBVersion information. If the ORB or ORBVersion is * null, gets the ValueHandler from Util.createValueHandler. */ public static ValueHandler createValueHandler(ORB orb) { if (orb == null) return Util.createValueHandler(); ORBVersion version = orb.getORBVersion(); if (version == null) return Util.createValueHandler(); if (version.equals(ORBVersionFactory.getOLD())) return new ValueHandlerImpl_1_3(); if (version.equals(ORBVersionFactory.getNEW())) return new ValueHandlerImpl_1_3_1(); return Util.createValueHandler(); }
/** * Creates the correct ValueHandler for the given ORB, querying ORBVersion information. If the ORB or ORBVersion is * null, gets the ValueHandler from Util.createValueHandler. */ public static ValueHandler createValueHandler(ORB orb) { if (orb == null) return Util.createValueHandler(); ORBVersion version = orb.getORBVersion(); if (version == null) return Util.createValueHandler(); if (version.equals(ORBVersionFactory.getOLD())) return new ValueHandlerImpl_1_3(); if (version.equals(ORBVersionFactory.getNEW())) return new ValueHandlerImpl_1_3_1(); return Util.createValueHandler(); }
private void writeClassBody(Class<?> clz) { if (orb == null || ORBVersionFactory.getFOREIGN().equals(orb.getORBVersion()) || ORBVersionFactory.getNEWER().compareTo(orb.getORBVersion()) <= 0) { write_value(Util.getCodebase(clz)); write_value(repIdStrs.createForAnyType(clz)); } else { write_value(repIdStrs.createForAnyType(clz)); write_value(Util.getCodebase(clz)); } }
private void writeClassBody(Class<?> clz) { if (orb == null || ORBVersionFactory.getFOREIGN().equals(orb.getORBVersion()) || ORBVersionFactory.getNEWER().compareTo(orb.getORBVersion()) <= 0) { write_value(Util.getCodebase(clz)); write_value(repIdStrs.createForAnyType(clz)); } else { write_value(repIdStrs.createForAnyType(clz)); write_value(Util.getCodebase(clz)); } }
if (orb == null || ORBVersionFactory.getFOREIGN().equals(orb.getORBVersion()) || ORBVersionFactory.getNEWER().compareTo(orb.getORBVersion()) <= 0)
if (orb == null || ORBVersionFactory.getFOREIGN().equals(orb.getORBVersion()) || ORBVersionFactory.getNEWER().compareTo(orb.getORBVersion()) <= 0)