Class ModuleManager

java.lang.Object
gnu.expr.ModuleManager

public class ModuleManager extends Object
A database of known modules as represented by ModuleInfo. Currently there is only a single global instance of ModuleManager; in the future each different "application" may have their own.
  • Field Details

    • interactiveClassPrefix

      public static final String interactiveClassPrefix
      See Also:
    • evalClassPrefix

      public String evalClassPrefix
    • LAST_MODIFIED_CACHE_TIME

      public static final long LAST_MODIFIED_CACHE_TIME
      See Also:
    • lastModifiedCacheTime

      public long lastModifiedCacheTime
      Number of milliseconds before we re-check file's modified time.
  • Constructor Details

    • ModuleManager

      public ModuleManager()
  • Method Details

    • setCompilationDirectory

      public void setCompilationDirectory(String path)
    • getCompilationDirectory

      public String getCompilationDirectory()
    • getInstance

      public static ModuleManager getInstance()
      For now assumes a single global ModuleManager. Later, might have multiple managers.
    • getNewInteractiveName

      public String getNewInteractiveName()
      Used to generate unique class names for interactive REPLs and loads. This is incremented from Shell.run. Unique class names are essential for Compilation.usedClass(Type). They're also desirable for debugging.
    • getNewEvalName

      public String getNewEvalName()
      Used to generate unique class names for other evals. Equivalent in functionality to getNewInteractiveName, but with a different prefix, for better user-friendliness.
    • getModule

      public ModuleInfo getModule(int index)
    • find

      public ModuleInfo find(Compilation comp)
    • createWithClassName

      public ModuleInfo createWithClassName(String className)
    • searchWithClassName

      public ModuleInfo searchWithClassName(String className)
    • findWithClass

      public static ModuleInfo findWithClass(Class clas)
    • findWithClassName

      public ModuleInfo findWithClassName(String className)
    • findWithSourcePath

      public ModuleInfo findWithSourcePath(gnu.kawa.io.Path sourceAbsPath, String sourcePath)
    • findWithSourcePath

      public ModuleInfo findWithSourcePath(String sourcePath)
    • findWithURL

      public ModuleInfo findWithURL(URL url)
    • register

      public void register(String moduleClass, String moduleSource, String moduleUri)
      Called by compiler-generated code. The compiler generates in each package a class that extends ModuleSet, and that contains a ModuleSet.register(ModuleManager) method that calls back to this method. This method then registers the specified module.
    • loadPackageInfo

      public void loadPackageInfo(String packageName) throws ClassNotFoundException, InstantiationException, IllegalAccessException
      Search for and if needed load the ModuleSet for a package.
      Throws:
      ClassNotFoundException
      InstantiationException
      IllegalAccessException
    • clear

      public void clear()
      Reset the set of known modules.