bsh.classpath
public class ClassManagerImpl extends BshClassManager
Manage all classloading in BeanShell. Allows classpath extension and class file reloading. This class holds the implementation of the BshClassManager so that it can be separated from the core package. This class currently relies on 1.2 for BshClassLoader and weak references. Is there a workaround for weak refs? If so we could make this work with 1.1 by supplying our own classloader code... See "http://www.beanshell.org/manual/classloading.html" for details on the bsh classloader architecture. Bsh has a multi-tiered class loading architecture. No class loader is used unless/until the classpath is modified or a class is reloaded. Note: we may need some synchronization in here Note on jdk1.2 dependency: We are forced to use weak references here to accomodate all of the fleeting namespace listeners. (NameSpaces must be informed if the class space changes so that they can un-cache names). I had the interesting thought that a way around this would be to implement BeanShell's own garbage collector... Then I came to my senses and said - screw it, class re-loading will require 1.2.
Constructor Summary | |
---|---|
ClassManagerImpl()
Used by BshClassManager singleton constructor |
Method Summary | |
---|---|
void | addClassPath(URL path) |
void | addListener(Listener l) |
Class | classForName(String name) |
protected void | classLoaderChanged()
Clear global class cache and notify namespaces to clear their
class caches.
|
void | doSuperImport()
Support for "import *;"
Hide details in here as opposed to NameSpace. |
void | dump(PrintWriter i) |
ClassLoader | getBaseLoader() |
String | getClassNameByUnqName(String name)
Return the name or null if none is found,
Throw an ClassPathException containing detail if name is ambigous. |
BshClassPath | getClassPath()
Get the full blown classpath. |
URL | getResource(String path)
Get a resource URL using the BeanShell classpath |
InputStream | getResourceAsStream(String path)
Get a resource stream using the BeanShell classpath |
protected boolean | hasSuperImport() |
Class | plainClassForName(String name)
Delegate for bottom level implementation of Class.forName().
|
void | reloadAllClasses()
Overlay the entire path with a new class loader.
|
void | reloadClasses(String[] classNames)
Reloading classes means creating a new classloader and using it
whenever we are asked for classes in the appropriate space.
|
void | reloadPackage(String pack)
Reload all classes in the specified package: e.g. |
void | removeListener(Listener l) |
void | reset()
Clear all classloading behavior and class caches and reset to
initial state. |
void | setClassPath(URL[] cp)
Set a new base classpath and create a new base classloader.
|
Returns: the class or null
Parameters: path should be an absolute path
Parameters: path should be an absolute path
See Also: BshClassManager.plainClassForName()