Wishlist
From OpenCms Wiki
Revision as of 10:35, 17 November 2006 by Cschoenfeld (Talk | contribs)
Custom ClassLoaders for Modules
OpenCms should provide its own ClassLoader for each module.
- The Module ClassLoader is instantiated along with the module and used to load classes, classpath resources and libraries contained in the module directly from VFS.
- The classpath of a Module ClassLoader contains
- /system/modules/<modulename>/classes/
- /system/modules/<modulename>/lib/*.jar
- Module dependencies make up a Module ClassLoader hierarchy. If module B depends on module A, the Module ClassLoader of B has the Module ClassLoader of A as its parent, thereby making A's classpath available to B.
- The Module ClassLoader of a module which does not depend on a different module has the standard Webapp ClassLoader as its parent.
- When a class should be loaded, the Module ClassLoader first looks into the module classpath. If it does not find the class there it delegates class loading to its parent.
- Each time OpenCms detects that a file on the Module ClassLoader classpath changes, the Module ClassLoader is thrown away and a new instance is created.
Benefits:
- No need to export files from the VFS to WEB-INF/lib and WEB-INF/classes.
- It is no longer required to reload OpenCms for each change to a module classpath file.
- Ability to use different and incompatible versions of libraries in different modules.
Open Questions: How would the Module ClassLoader perform JSP loading?