Sha256: 5a287d2156f4b6a1299a5378c2ea94eef41c6d30816442bc39ec794f67d46608

Contents?: true

Size: 1.76 KB

Versions: 30

Compression:

Stored size: 1.76 KB

Contents

// Copyright 2000 Samuele Pedroni

package jxxload_help;

public class PackageManager extends org.python.core.PathPackageManager {
    
    private JavaLoaderFactory factory;
    private ClassLoader loader;
    
    public synchronized ClassLoader getLoader() {
        if (loader == null) loader = factory.makeLoader();
        return loader;
    }
    
    public synchronized  ClassLoader checkLoader() {
        return loader;
    }
    
    public synchronized void resetLoader() {
        loader = null;
    }
    
    // ??pending add cache support?
    public PackageManager(org.python.core.PyList path,JavaLoaderFactory factory) { 
        this.factory = factory;
        
        for (int i = 0; i < path.__len__(); i++) {
            String entry = path.__finditem__(i).toString();
            if (entry.endsWith(".jar") || entry.endsWith(".zip")) {
                addJarToPackages(new java.io.File(entry),false);
            } else {
                java.io.File dir = new java.io.File(entry);
                if (entry.length() == 0 || dir.isDirectory()) addDirectory(dir);
            }
        }
    }

    public Class findClass(String pkg,String name,String reason) {
        if (pkg != null && pkg.length()>0) name = pkg + '.' + name;
        try {
            return getLoader().loadClass(name);
        } 
        catch(ClassNotFoundException e) {
            return null;
        }
        catch (LinkageError e) {
            throw org.python.core.Py.JavaError(e);
        }
    }

    public void addJarDir(String jdir, boolean cache) {
        throw new RuntimeException("addJarDir not supported for reloadable packages");
    }  

    public void addJar(String jdir, boolean cache) {
        throw new RuntimeException("addDir not supported for reloadable packages");
    }  
}

Version data entries

30 entries across 30 versions & 1 rubygems

Version Path
rubyfox-server-2.12.1.0 lib/rubyfox/server/data/lib/Lib/jxxload_help/PackageManager.java
rubyfox-server-2.11.1.0 lib/rubyfox/server/data/lib/Lib/jxxload_help/PackageManager.java
rubyfox-server-2.9.2.0 lib/rubyfox/server/data/lib/Lib/jxxload_help/PackageManager.java
rubyfox-server-2.9.1.0 lib/rubyfox/server/data/lib/Lib/jxxload_help/PackageManager.java
rubyfox-server-2.9.0.0 lib/rubyfox/server/data/lib/Lib/jxxload_help/PackageManager.java
rubyfox-server-2.8.4.0 lib/rubyfox/server/data/lib/Lib/jxxload_help/PackageManager.java
rubyfox-server-2.8.0.1 lib/rubyfox/server/data/lib/Lib/jxxload_help/PackageManager.java
rubyfox-server-2.8.0.0 lib/rubyfox/server/data/lib/Lib/jxxload_help/PackageManager.java
rubyfox-server-2.3.0.0 lib/rubyfox/server/data/lib/Lib/jxxload_help/PackageManager.java
rubyfox-server-2.3.0.pre2 lib/rubyfox/server/data/lib/Lib/jxxload_help/PackageManager.java