Top Description Inners Fields Constructors Methods
org.python.core.packagecache

public abstract Class PathPackageManager

extends CachedJarsPackageManager
Class Inheritance
Known Direct Subclasses
org.python.core.packagecache.SysPackageManager
Imports
java.io.BufferedInputStream, .File, .FileInputStream, .FilenameFilter, .IOException, java.util.logging.Level, org.python.core.Py, .PyException, .PyJavaPackage, .PyList, .PyObject, .PyString, .imp, org.python.core.util.RelativeFile

Path package manager. Gathering classes info dynamically from a set of directories in path searchPath, and statically from a set of jars, like CachedJarsPackageManager.

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class

Field Summary

Modifier and TypeField and Description
public PyList
Inherited from org.python.core.packagecache.CachedJarsPackageManager:
logger

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public void
addClassPath(String path)

Scan a Java class-path that may be a mixture of directory and JAR specifiers, and within each path entry index the packages.

public void
addDirectory(File
A directory.
dir
)

Implements abstract org.python.core.packagecache.PackageManager.addDirectory.

Add directory dir (if exists) to searchPath.

protected void
doDir(PyList path, PyList ret, PyJavaPackage jpkg, boolean instantiate, boolean exclpkgs)

Helper for doDir(PyJavaPackage, boolean, boolean).

public PyList
doDir(PyJavaPackage
queried package
jpkg
,
boolean
if true then instatiate reported names in package dict
instantiate
,
boolean
exclude packages (just when instantiate is false)
exclpkgs
)

Implements abstract org.python.core.packagecache.PackageManager.doDir.

Reports the specified package content names.

protected static boolean
public boolean
packageExists(String
parent pkg name
pkg
,
String
candidate name
name
)

Implements abstract org.python.core.packagecache.PackageManager.packageExists.

Dynamically check if pkg.name exists as java pkg in the controlled hierarchy.

Inherited from org.python.core.packagecache.CachedJarsPackageManager:
addJarToPackagesaddJarToPackagesaddJarToPackagesaddJarToPackagesaddModuleToPackagescommentdebugdeleteCacheFilefilterByAccessfilterByNameinitCacheinOpenCacheFileinOpenIndexmessageoutCreateCacheFileoutOpenIndexsaveCachesplitStringuseCacheDirwarning

Field Detail

searchPathback to summary
public PyList searchPath

Constructor Detail

PathPackageManagerback to summary
public PathPackageManager()

Method Detail

addClassPathback to summary
public void addClassPath(String path)

Scan a Java class-path that may be a mixture of directory and JAR specifiers, and within each path entry index the packages. Calls addDirectory if a path entry refers to a dir, addJarToPackages(java.io.File, boolean) with param cache true if the path entry refers to a jar.

addDirectoryback to summary
public void addDirectory(File dir)

Implements abstract org.python.core.packagecache.PackageManager.addDirectory.

Add directory dir (if exists) to searchPath.

Parameters
dir:File

Doc from org.python.core.packagecache.PackageManager.addDirectory.

A directory.

Annotations
@Override
doDirback to summary
protected void doDir(PyList path, PyList ret, PyJavaPackage jpkg, boolean instantiate, boolean exclpkgs)

Helper for doDir(PyJavaPackage, boolean, boolean). Scans for package jpkg content over the directories in path. Add to ret the found classes/pkgs. Filter out classes using filterByName,filterByAccess.

doDirback to summary
public PyList doDir(PyJavaPackage jpkg, boolean instantiate, boolean exclpkgs)

Implements abstract org.python.core.packagecache.PackageManager.doDir.

Doc from org.python.core.packagecache.PackageManager.doDir.

Reports the specified package content names. Should be overridden. Used by PyJavaPackage#__dir__ and PyJavaPackage#fillDir.

Parameters
jpkg:PyJavaPackage

queried package

instantiate:boolean

if true then instatiate reported names in package dict

exclpkgs:boolean

exclude packages (just when instantiate is false)

Returns:PyList

resulting list of names (PyList of PyString)

Annotations
@Override

packageExistsback to summary
protected static boolean packageExists(PyList path, String pkg, String name)

Helper for packageExists(String, String). Scans the directories in the given path for package pkg.name. A directory with a matching name is considered to define a package if it contains no Python (source or compiled), or contains a Java .class file (not compiled from Python).

packageExistsback to summary
public boolean packageExists(String pkg, String name)

Implements abstract org.python.core.packagecache.PackageManager.packageExists.

Doc from org.python.core.packagecache.PackageManager.packageExists.

Dynamically check if pkg.name exists as java pkg in the controlled hierarchy. Should be overridden.

Parameters
pkg:String

parent pkg name

name:String

candidate name

Returns:boolean

true if pkg exists

Annotations
@Override

org.python.core.packagecache back to summary

private Class PathPackageManager.PackageExistsFileFilter

extends Object
implements FilenameFilter
Class Inheritance
  • java.lang.Object
  • org.python.core.packagecache.PathPackageManager.PackageExistsFileFilter
All Implemented Interfaces
java.io.FilenameFilter

Field Summary

Modifier and TypeField and Description
private boolean
private boolean

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public boolean
accept(File
the directory in which the file was found.
dir
,
String
the name of the file.
name
)

Implements java.io.FilenameFilter.accept.

Tests if a specified file should be included in a file list.

public boolean
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

javaback to summary
private boolean java
pythonback to summary
private boolean python

Constructor Detail

PackageExistsFileFilterback to summary
private PackageExistsFileFilter()

Method Detail

acceptback to summary
public boolean accept(File dir, String name)

Implements java.io.FilenameFilter.accept.

Doc from java.io.FilenameFilter.accept.

Tests if a specified file should be included in a file list.

Parameters
dir:File

the directory in which the file was found.

name:String

the name of the file.

Returns:boolean

true if and only if the name should be included in the file list; false otherwise.

Annotations
@Override

packageExistsback to summary
public boolean packageExists()