Package gnu.expr
Class ModuleManager
- java.lang.Object
-
- gnu.expr.ModuleManager
-
public class ModuleManager extends java.lang.ObjectA database of known modules as represented byModuleInfo. Currently there is only a single global instance ofModuleManager; in the future each different "application" may have their own.
-
-
Field Summary
Fields Modifier and Type Field Description java.lang.StringevalClassPrefixstatic java.lang.StringinteractiveClassPrefixstatic longLAST_MODIFIED_CACHE_TIMElonglastModifiedCacheTimeNumber of milliseconds before we re-check file's modified time.
-
Constructor Summary
Constructors Constructor Description ModuleManager()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclear()Reset the set of known modules.ModuleInfocreateWithClassName(java.lang.String className)ModuleInfofind(Compilation comp)static ModuleInfofindWithClass(java.lang.Class clas)ModuleInfofindWithClassName(java.lang.String className)ModuleInfofindWithSourcePath(gnu.kawa.io.Path sourceAbsPath, java.lang.String sourcePath)ModuleInfofindWithSourcePath(java.lang.String sourcePath)ModuleInfofindWithURL(java.net.URL url)java.lang.StringgetCompilationDirectory()static ModuleManagergetInstance()For now assumes a single global ModuleManager.ModuleInfogetModule(int index)java.lang.StringgetNewEvalName()Used to generate unique class names for other evals.java.lang.StringgetNewInteractiveName()Used to generate unique class names for interactive REPLs and loads.voidloadPackageInfo(java.lang.String packageName)Search for and if needed load theModuleSetfor a package.voidregister(java.lang.String moduleClass, java.lang.String moduleSource, java.lang.String moduleUri)Called by compiler-generated code.ModuleInfosearchWithClassName(java.lang.String className)voidsetCompilationDirectory(java.lang.String path)
-
-
-
Field Detail
-
interactiveClassPrefix
public static final java.lang.String interactiveClassPrefix
- See Also:
- Constant Field Values
-
evalClassPrefix
public java.lang.String evalClassPrefix
-
LAST_MODIFIED_CACHE_TIME
public static final long LAST_MODIFIED_CACHE_TIME
- See Also:
- Constant Field Values
-
lastModifiedCacheTime
public long lastModifiedCacheTime
Number of milliseconds before we re-check file's modified time.
-
-
Method Detail
-
setCompilationDirectory
public void setCompilationDirectory(java.lang.String path)
-
getCompilationDirectory
public java.lang.String getCompilationDirectory()
-
getInstance
public static ModuleManager getInstance()
For now assumes a single global ModuleManager. Later, might have multiple managers.
-
getNewInteractiveName
public java.lang.String getNewInteractiveName()
Used to generate unique class names for interactive REPLs and loads. This is incremented from Shell.run. Unique class names are essential forCompilation.usedClass(gnu.bytecode.Type). They're also desirable for debugging.
-
getNewEvalName
public java.lang.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(java.lang.String className)
-
searchWithClassName
public ModuleInfo searchWithClassName(java.lang.String className)
-
findWithClass
public static ModuleInfo findWithClass(java.lang.Class clas)
-
findWithClassName
public ModuleInfo findWithClassName(java.lang.String className)
-
findWithSourcePath
public ModuleInfo findWithSourcePath(gnu.kawa.io.Path sourceAbsPath, java.lang.String sourcePath)
-
findWithSourcePath
public ModuleInfo findWithSourcePath(java.lang.String sourcePath)
-
findWithURL
public ModuleInfo findWithURL(java.net.URL url)
-
register
public void register(java.lang.String moduleClass, java.lang.String moduleSource, java.lang.String moduleUri)Called by compiler-generated code. The compiler generates in each package a class that extendsModuleSet, and that contains aModuleSet.register(ModuleManager)method that calls back to this method. This method then registers the specified module.
-
loadPackageInfo
public void loadPackageInfo(java.lang.String packageName) throws java.lang.ClassNotFoundException, java.lang.InstantiationException, java.lang.IllegalAccessExceptionSearch for and if needed load theModuleSetfor a package.- Throws:
java.lang.ClassNotFoundExceptionjava.lang.InstantiationExceptionjava.lang.IllegalAccessException
-
clear
public void clear()
Reset the set of known modules.
-
-