Package org.python.core.packagecache
Class PackageManager
java.lang.Object
org.python.core.packagecache.PackageManager
- Direct Known Subclasses:
CachedJarsPackageManager
Abstract package manager.
-
Field Summary
Modifier and TypeFieldDescriptionNominal top-level package of all (Java) packages, containing "java", "com", "org", etc.. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionabstract void
addDirectory
(File dir) Append a directory to the list of directories searched for java packages and java classes.abstract void
Append a jar file to the list of locations searched for java packages and java classes.abstract void
Append a directory to the list of directories searched for java packages and java classes.abstract PyList
doDir
(PyJavaPackage jpkg, boolean instantiate, boolean exclpkgs) Reports the specified package content names.abstract Class
lookupName
(String name) Given the (dotted) name of a package, find thePyJavaPackage
corresponding, by navigating from thetopLevelPackage
, successively applyingPyObject.__findattr__(String)
.makeJavaPackage
(String name, String classes, String jarfile) Create (or ensure we have) aPyJavaPackage
for the named package and add to it the names of classes mentioned here.void
notifyPackageImport
(String pkg, String name) abstract boolean
packageExists
(String pkg, String name) Dynamically check if pkg.name exists as java pkg in the controlled hierarchy.
-
Field Details
-
topLevelPackage
Nominal top-level package of all (Java) packages, containing "java", "com", "org", etc..
-
-
Constructor Details
-
PackageManager
public PackageManager()
-
-
Method Details
-
findClass
-
findClass
-
notifyPackageImport
-
packageExists
Dynamically check if pkg.name exists as java pkg in the controlled hierarchy. Should be overridden.- Parameters:
pkg
- parent pkg namename
- candidate name- Returns:
- true if pkg exists
-
doDir
Reports the specified package content names. Should be overridden. Used byPyJavaPackage.__dir__()
andPyJavaPackage.fillDir()
.- Parameters:
jpkg
- queried packageinstantiate
- if true then instatiate reported names in package dictexclpkgs
- exclude packages (just when instantiate is false)- Returns:
- resulting list of names (PyList of PyString)
-
addDirectory
Append a directory to the list of directories searched for java packages and java classes.- Parameters:
dir
- A directory.
-
addJarDir
Append a directory to the list of directories searched for java packages and java classes.- Parameters:
dir
- A directory name.
-
addJar
Append a jar file to the list of locations searched for java packages and java classes.- Parameters:
jarfile
- A directory name.
-
lookupName
Given the (dotted) name of a package, find thePyJavaPackage
corresponding, by navigating from thetopLevelPackage
, successively applyingPyObject.__findattr__(String)
. This in fact drives the creation ofPyJavaPackage
objects since it indirectly callspackageExists(String, String)
.- Parameters:
name
- (dotted) package name- Returns:
- the package named
-
makeJavaPackage
Create (or ensure we have) aPyJavaPackage
for the named package and add to it the names of classes mentioned here. These classes are added as "place holders" only, so they become members of it, without being instantiated. This method relies onPyJavaPackage.addPackage(java.lang.String, java.lang.String)
andPyJavaPackage.addPlaceholders(java.util.Collection<java.lang.String>)
.- Parameters:
name
- package nameclasses
- comma or @-sign separated stringjarfile
- involved; can be null- Returns:
- created/updated package
-