org.python.core.packagecache

## Class PackageManager

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

- Direct Known Subclasses:
    CachedJarsPackageManager

      public abstract class PackageManager
      extends java.lang.Object

  Abstract package manager.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `PyJavaPackage` | `topLevelPackage`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `PackageManager()`

  - ### Method Summary

    All Methods Instance Methods Abstract Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `abstract void` | `addDirectory(java.io.File dir)` Append a directory to the list of directories searched for java packages and java classes.
    `abstract void` | `addJar(java.lang.String jarfile, boolean cache)` Append a jar file to the list of locations searched for java packages and java classes.
    `abstract void` | `addJarDir(java.lang.String dir, boolean cache)` 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.
    `java.lang.Class` | `findClass(java.lang.String pkg, java.lang.String name)`
    `abstract java.lang.Class` | `findClass(java.lang.String pkg, java.lang.String name, java.lang.String reason)`
    `PyObject` | `lookupName(java.lang.String name)`
    `PyJavaPackage` | `makeJavaPackage(java.lang.String name, java.lang.String classes, java.lang.String jarfile)` Creates package/updates statically known classes info.
    `void` | `notifyPackageImport(java.lang.String pkg, java.lang.String name)`
    `abstract 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 java.lang.Object

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

- - ### Field Detail

    - #### topLevelPackage

          public PyJavaPackage topLevelPackage

  - ### Constructor Detail

    - #### PackageManager

          public PackageManager()

  - ### Method Detail

    - #### findClass

          public abstract java.lang.Class findClass(java.lang.String pkg,
                                                    java.lang.String name,
                                                    java.lang.String reason)

    - #### findClass

          public java.lang.Class findClass(java.lang.String pkg,
                                           java.lang.String name)

    - #### notifyPackageImport

          public void notifyPackageImport(java.lang.String pkg,
                                          java.lang.String name)

    - #### packageExists

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

      Dynamically check if pkg.name exists as java pkg in the controlled hierarchy. Should be overriden.
      Parameters:
        `pkg` - parent pkg name
        `name` - candidate name
      Returns:
        true if pkg exists

    - #### doDir

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

      Reports the specified package content names. Should be overriden. Used by `PyJavaPackage.__dir__()` and `PyJavaPackage.fillDir()`.
      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)

    - #### addDirectory

          public abstract void addDirectory(java.io.File dir)

      Append a directory to the list of directories searched for java packages and java classes.
      Parameters:
        `dir` - A directory.

    - #### addJarDir

          public abstract void addJarDir(java.lang.String dir,
                                         boolean cache)

      Append a directory to the list of directories searched for java packages and java classes.
      Parameters:
        `dir` - A directory name.

    - #### addJar

          public abstract void addJar(java.lang.String jarfile,
                                      boolean cache)

      Append a jar file to the list of locations searched for java packages and java classes.
      Parameters:
        `jarfile` - A directory name.

    - #### lookupName

          public PyObject lookupName(java.lang.String name)

    - #### makeJavaPackage

          public PyJavaPackage makeJavaPackage(java.lang.String name,
                                               java.lang.String classes,
                                               java.lang.String jarfile)

      Creates package/updates statically known classes info. Uses `PyJavaPackage.addPackage(java.lang.String, java.lang.String)`, `PyJavaPackage.addPlaceholders(java.lang.String)`.
      Parameters:
        `name` - package name
        `classes` - comma-separated string
        `jarfile` - involved jarfile; can be null
      Returns:
        created/updated package

Jython homepage