@Override protected String makeEntry(String filename) { if (entries.containsKey(filename)) { return filename; } InputStream is; if (Py.getSystemState().getClassLoader() != null) { is = tryClassLoader(filename, Py.getSystemState().getClassLoader(), "sys"); } else { is = tryClassLoader(filename, imp.getParentClassLoader(), "parent"); } if (is != null) { entries.put(filename, is); return filename; } return null; }
public boolean packageExists(String pkg, String name) { if (packageExists(this.searchPath, pkg, name)) { return true; } PySystemState system = Py.getSystemState(); if (system.getClassLoader() == null && packageExists(Py.getSystemState().path, pkg, name)) { return true; } return false; }
public PyList doDir(PyJavaPackage jpkg, boolean instantiate, boolean exclpkgs) { PyList basic = basicDoDir(jpkg, instantiate, exclpkgs); PyList ret = new PyList(); doDir(this.searchPath, ret, jpkg, instantiate, exclpkgs); PySystemState system = Py.getSystemState(); if (system.getClassLoader() == null) { doDir(system.path, ret, jpkg, instantiate, exclpkgs); } return merge(basic, ret); }
@Override protected PicoContainer createContainerFromScript(final PicoContainer parentContainer, final Object assemblyScope) { ClassLoader oldClassLoader = Thread.currentThread().getContextClassLoader(); ClassLoader pyClassLoader = Py.getSystemState().getClassLoader(); try { Thread.currentThread().setContextClassLoader(getClassLoader()); Py.getSystemState().setClassLoader(getClassLoader()); PythonInterpreter interpreter = new PythonInterpreter(); interpreter.set("parent", parentContainer); interpreter.set("assemblyScope", assemblyScope); interpreter.execfile(getScriptInputStream(), "picocontainer.py"); return interpreter.get("pico", PicoContainer.class); } catch (IOException e) { throw new ScriptedPicoContainerMarkupException(e); } finally { Thread.currentThread().setContextClassLoader(oldClassLoader); Py.getSystemState().setClassLoader(pyClassLoader); } } }
@Override protected Class<?> findClass(String name) throws ClassNotFoundException { PySystemState sys = Py.getSystemState(); ClassLoader sysClassLoader = sys.getClassLoader(); if (sysClassLoader != null) {
ClassLoader classLoader = Py.getSystemState().getClassLoader(); if (classLoader != null) { if (reason != null) {