PathPackageManager (Jython API documentation)
Date: 2022-09-10

org.python.core.packagecache

## Class PathPackageManager

- java.lang.Object
- - org.python.core.packagecache.PackageManager
  - - org.python.core.packagecache.CachedJarsPackageManager
    - - org.python.core.packagecache.PathPackageManager

- Direct Known Subclasses:
    SysPackageManager

      public abstract class PathPackageManager
      extends CachedJarsPackageManager

  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 Class Summary

    - ### Nested classes/interfaces inherited from class org.python.core.packagecache.CachedJarsPackageManager

      `CachedJarsPackageManager.JarXEntry`

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `PyList` | `searchPath`

    - ### Fields inherited from class org.python.core.packagecache.PackageManager

      `topLevelPackage`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `PathPackageManager()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addClassPath(java.lang.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.
    `void` | `addDirectory(java.io.File dir)` Add directory dir (if exists) to `searchPath`.
    `PyList` | `doDir(PyJavaPackage jpkg, boolean instantiate, boolean exclpkgs)` Reports the specified package content names.
    `boolean` | `packageExists(java.lang.String pkg, java.lang.String name)` Dynamically check if pkg.name exists as java pkg in the controlled hierarchy.

    - ### Methods inherited from class org.python.core.packagecache.CachedJarsPackageManager

      `addJarToPackages, addJarToPackages, addJarToPackages, addJarToPackages, saveCache`

    - ### Methods inherited from class org.python.core.packagecache.PackageManager

      `addJar, addJarDir, findClass, findClass, lookupName, makeJavaPackage, notifyPackageImport`

    - ### Methods inherited from class java.lang.Object

      `equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### searchPath

          public PyList searchPath

  - ### Constructor Detail

    - #### PathPackageManager

          public PathPackageManager()

  - ### Method Detail

    - #### addDirectory

          public void addDirectory(java.io.File dir)

      Add directory dir (if exists) to `searchPath`.
      Specified by:
        `addDirectory` in class `PackageManager`
      Parameters:
        `dir` - A directory.

    - #### addClassPath

          public void addClassPath(java.lang.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(java.io.File)` if a path entry refers to a dir, `CachedJarsPackageManager.addJarToPackages(java.io.File, boolean)` with param cache true if the path entry refers to a jar.

    - #### doDir

          public PyList doDir(PyJavaPackage jpkg,
                              boolean instantiate,
                              boolean exclpkgs)

      Description copied from class: `PackageManager`
      Reports the specified package content names. Should be overridden. Used by `PyJavaPackage.__dir__()` and `PyJavaPackage.fillDir()`.
      Specified by:
        `doDir` in class `PackageManager`
      Parameters:
        `jpkg` - queried package
        `instantiate` - if true then instatiate reported names in package dict
        `exclpkgs` - exclude packages (just when instantiate is false)
      Returns:
        resulting list of names (PyList of PyString)

    - #### packageExists

          public boolean packageExists(java.lang.String pkg,
                                       java.lang.String name)

      Description copied from class: `PackageManager`
      Dynamically check if pkg.name exists as java pkg in the controlled hierarchy. Should be overridden.
      Specified by:
        `packageExists` in class `PackageManager`
      Parameters:
        `pkg` - parent pkg name
        `name` - candidate name
      Returns:
        true if pkg exists

Jython homepage