/** * Checks for objects that are instances of java.rmi.Remote that need to be serialized as proxy (Stub) objects. */ protected final Object replaceObject(Object obj) throws IOException { try { if ((obj instanceof java.rmi.Remote) && !(StubAdapter.isStub(obj))) { return Utility.autoConnect(obj, orb, true); } } catch (Exception e) { IOException ie = new IOException("replaceObject failed"); ie.initCause(e); throw ie; } return obj; } }
factory = Utility.getFactory(clazz, codebase, orb, repId); BoxedValueHelper helper = Utility.getHelper(clazz, codebase, repId); if (helper instanceof ValueHelper) return readIDLValueWithHelper((ValueHelper) helper, indirection);
/** * Convert strings with ISO Latin 1 escape sequences back to original strings. * <p> * Section 5.5.7 of OBV spec. */ private static String convertFromISOLatin1(String name) { int index = -1; StringBuffer buf = new StringBuffer(name); while ((index = buf.toString().indexOf("\\U")) != -1) { String str = "0000" + buf.toString().substring(index + 2, index + 6); // Convert Hexadecimal byte[] buffer = new byte[(str.length() - 4) / 2]; for (int i = 4, j = 0; i < str.length(); i += 2, j++) { buffer[j] = (byte) ((Utility.hexOf(str.charAt(i)) << 4) & 0xF0); buffer[j] |= (byte) ((Utility.hexOf(str.charAt(i + 1)) << 0) & 0x0F); } buf = new StringBuffer(delete(buf.toString(), index, index + 6)); buf.insert(index, (char) buffer[1]); } return buf.toString(); }
public static Class<?> loadStubClass(String repID, String remoteCodebase, Class<?> expectedType) throws ClassNotFoundException { // Get the repID and check for "" special case. We should never be called with it (See CDRInputStream and the // loadStub() method)... if (repID.length() == 0) { throw new ClassNotFoundException(); } // Get the stubname from the repID and load the class. If we have a valid 'sender', fall back to using its // codebase if we need to... String className = Utility.stubNameFromRepID(repID); ClassLoader expectedTypeClassLoader = (expectedType == null ? null : expectedType.getClassLoader()); try { return loadClassOfType(className, remoteCodebase, expectedTypeClassLoader, expectedType, expectedTypeClassLoader); } catch (ClassNotFoundException e) { return loadClassOfType(PackagePrefixChecker.packagePrefix() + className, remoteCodebase, expectedTypeClassLoader, expectedType, expectedTypeClassLoader); } }
public Tie getTie(Class<?> cls) { Class<?> tieClass = null; String className = Utility.tieName(cls.getName()); // XXX log exceptions at FINE level try { try { // _REVISIT_ The spec does not specify a loadingContext parameter for the following call. Would it be useful to pass one? tieClass = Utility.loadClassForClass(className, Util.getCodebase(cls), null, cls, cls.getClassLoader()); return (Tie) tieClass.newInstance(); } catch (Exception err) { tieClass = Utility.loadClassForClass(PackagePrefixChecker.packagePrefix() + className, Util.getCodebase(cls), null, cls, cls.getClassLoader()); return (Tie) tieClass.newInstance(); } } catch (Exception err) { return null; } }
public static String stubNameFromRepID(String repID) { // Convert the typeid to a RepositoryId instance, get the className and mangle it as needed... RepositoryId id = RepositoryId.cache.getId(repID); String className = id.getClassName(); if (id.isIDLType()) { className = idlStubName(className); } else { className = stubName(className); } return className; }
private static String getIdFromHelper(Class<?> clazz) { try { Class<?> helperClazz = Utility.loadClassForClass(clazz.getName() + "Helper", null, clazz.getClassLoader(), clazz, clazz.getClassLoader()); Method idMethod = helperClazz.getDeclaredMethod("id", kNoParamTypes); return (String) idMethod.invoke(null, kNoArgs); } catch (java.lang.ClassNotFoundException cnfe) { throw new org.omg.CORBA.MARSHAL(cnfe.toString()); } catch (java.lang.NoSuchMethodException nsme) { throw new org.omg.CORBA.MARSHAL(nsme.toString()); } catch (java.lang.reflect.InvocationTargetException ite) { throw new org.omg.CORBA.MARSHAL(ite.toString()); } catch (java.lang.IllegalAccessException iae) { throw new org.omg.CORBA.MARSHAL(iae.toString()); } }
stubName = Utility.idlStubName(className); else stubName = Utility.stubNameForCompiler(className);
return Utility.loadStub(narrowObj, narrowTo);
BoxedValueHelper helper = Utility.getHelper(object.getClass(), null, repID); boolean isCustom = false; if (helper instanceof ValueHelper && object instanceof CustomMarshal)
public final Class<?> getClassFromType(Class<?> expectedType, String codebase) throws ClassNotFoundException { if (clazz != null) return clazz; Class<?> specialCase = kSpecialCasesClasses.get(getClassName()); if (specialCase != null) { clazz = specialCase; return specialCase; } else { ClassLoader expectedTypeClassLoader = (expectedType == null ? null : expectedType.getClassLoader()); return Utility.loadClassOfType(getClassName(), codebase, expectedTypeClassLoader, expectedType, expectedTypeClassLoader); } }
ValueFactory factory = Utility.getFactory(null, codebase_URL, orb, repositoryIDString);
entry = loadStubAndUpdateCache(tie, stubFactory, remoteCodebase, onlyMostDerived); entry = loadStubAndUpdateCache(tie, null, remoteCodebase, true); entry = loadStubAndUpdateCache(tie, null, remoteCodebase, true); entry = loadStubAndUpdateCache(tie, stubFactory, remoteCodebase, onlyMostDerived);
Tie tie = Utility.getAndForgetTie(proxy); if (tie == null) throw wrapper.connectNoTie();
private static String getIdFromHelper(Class<?> clazz) { try { Class<?> helperClazz = Utility.loadClassForClass(clazz.getName() + "Helper", null, clazz.getClassLoader(), clazz, clazz.getClassLoader()); Method idMethod = helperClazz.getDeclaredMethod("id", kNoParamTypes); return (String) idMethod.invoke(null, kNoArgs); } catch (java.lang.ClassNotFoundException cnfe) { throw new org.omg.CORBA.MARSHAL(cnfe.toString()); } catch (java.lang.NoSuchMethodException nsme) { throw new org.omg.CORBA.MARSHAL(nsme.toString()); } catch (java.lang.reflect.InvocationTargetException ite) { throw new org.omg.CORBA.MARSHAL(ite.toString()); } catch (java.lang.IllegalAccessException iae) { throw new org.omg.CORBA.MARSHAL(iae.toString()); } }
public static String stubNameFromRepID(String repID) { // Convert the typeid to a RepositoryId instance, get the className and mangle it as needed... RepositoryId id = RepositoryId.cache.getId(repID); String className = id.getClassName(); if (id.isIDLType()) { className = idlStubName(className); } else { className = stubName(className); } return className; }
public Tie getTie(Class<?> cls) { Class<?> tieClass = null; String className = Utility.tieName(cls.getName()); // XXX log exceptions at FINE level try { try { // _REVISIT_ The spec does not specify a loadingContext parameter for the following call. Would it be useful to pass one? tieClass = Utility.loadClassForClass(className, Util.getCodebase(cls), null, cls, cls.getClassLoader()); return (Tie) tieClass.newInstance(); } catch (Exception err) { tieClass = Utility.loadClassForClass(PackagePrefixChecker.packagePrefix() + className, Util.getCodebase(cls), null, cls, cls.getClassLoader()); return (Tie) tieClass.newInstance(); } } catch (Exception err) { return null; } }
public static Class<?> loadStubClass(String repID, String remoteCodebase, Class<?> expectedType) throws ClassNotFoundException { // Get the repID and check for "" special case. We should never be called with it (See CDRInputStream and the // loadStub() method)... if (repID.length() == 0) { throw new ClassNotFoundException(); } // Get the stubname from the repID and load the class. If we have a valid 'sender', fall back to using its // codebase if we need to... String className = Utility.stubNameFromRepID(repID); ClassLoader expectedTypeClassLoader = (expectedType == null ? null : expectedType.getClassLoader()); try { return loadClassOfType(className, remoteCodebase, expectedTypeClassLoader, expectedType, expectedTypeClassLoader); } catch (ClassNotFoundException e) { return loadClassOfType(PackagePrefixChecker.packagePrefix() + className, remoteCodebase, expectedTypeClassLoader, expectedType, expectedTypeClassLoader); } }