|
|||||||||
| Home >> All >> com >> dghda >> [ module overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
com.dghda.module
Class ModuleLoader

java.lang.Objectcom.dghda.module.ModuleLoader
- public class ModuleLoader
- extends java.lang.Object
A module loader object manages a set of loadable objects. It is given a path string, which can contain directories, files or jar files. Directories and jars are scanned and their contents treated as files. These are then treated as class files containing compiled module providers.
| Field Summary | |
private java.lang.Object[] |
m_ConstructorArgs
|
private com.dghda.log.Logger |
m_Logger
|
private java.lang.Class |
m_ModuleClass
|
private java.util.LinkedList |
m_ModulePaths
|
private java.util.TreeMap |
m_Modules
|
| Constructor Summary | |
ModuleLoader(java.lang.Class modClass,
java.lang.String[] modulePaths,
com.dghda.log.Logger logger)
Create a new module loader for the given class, using the given path(s), and the given constructor arguments. |
|
ModuleLoader(java.lang.Class modClass,
java.lang.String[] modulePaths,
java.lang.Object[] args,
com.dghda.log.Logger logger)
Create a new module loader for the given class, using the given path(s) and constructor arguments. |
|
ModuleLoader(java.lang.Class modClass,
java.lang.String modulePath,
com.dghda.log.Logger logger)
Create a new module loader for the given class, using the given path(s), and no constructor arguments. |
|
ModuleLoader(java.lang.Class modClass,
java.lang.String modulePath,
java.lang.Object[] args,
com.dghda.log.Logger logger)
Create a new module loader for the given class, using the given path(s) and constructor arguments. |
|
| Method Summary | |
boolean |
addModule(Module module)
Attempt to add the given module. |
void |
addModulePath(java.lang.String path)
Add a module path component to the scan list. |
protected boolean |
checkProvidersModules(java.lang.Class providerClass)
(Re)loads the modules provided by the given provider, if appropriate. |
protected boolean |
checkProvidersModules(ModulePathComponent.Provider component)
(Re)loads the modules provided by the given provider, if appropriate. |
static java.lang.String |
constructModulePath(java.lang.String[] paths)
Constructs a path string in the same form as the classpath from an array of paths. |
protected ModulePathComponent |
createPathComponent(java.lang.String path)
Converts a string into a ModulePathComponent object. |
java.util.List |
getAvailableModules()
Returns a list of all modules available to the given user. |
Module |
getModule(java.lang.String id)
Returns the given module. |
static java.lang.String[] |
parseModulePath(java.lang.String paths)
Parses a path string in the same form as the classpath into an array of paths. |
boolean |
removeModulePath(java.lang.String path)
Remove a module path component from the scan list. |
void |
scan(boolean updated)
Scans the module path(s) for any new or updated modules. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
m_ModulePaths
private java.util.LinkedList m_ModulePaths
m_Modules
private java.util.TreeMap m_Modules
m_Logger
private com.dghda.log.Logger m_Logger
m_ModuleClass
private java.lang.Class m_ModuleClass
m_ConstructorArgs
private java.lang.Object[] m_ConstructorArgs
| Constructor Detail |
ModuleLoader
public ModuleLoader(java.lang.Class modClass, java.lang.String modulePath, com.dghda.log.Logger logger) throws InvalidPathException
- Create a new module loader for the given class, using the given path(s), and no constructor arguments.
ModuleLoader
public ModuleLoader(java.lang.Class modClass, java.lang.String[] modulePaths, com.dghda.log.Logger logger) throws InvalidPathException
- Create a new module loader for the given class, using the given path(s), and the given constructor arguments.
ModuleLoader
public ModuleLoader(java.lang.Class modClass, java.lang.String modulePath, java.lang.Object[] args, com.dghda.log.Logger logger) throws InvalidPathException
- Create a new module loader for the given class, using the given path(s) and constructor arguments.
ModuleLoader
public ModuleLoader(java.lang.Class modClass, java.lang.String[] modulePaths, java.lang.Object[] args, com.dghda.log.Logger logger) throws InvalidPathException
- Create a new module loader for the given class, using the given path(s) and constructor arguments.
| Method Detail |
addModulePath
public void addModulePath(java.lang.String path) throws InvalidPathException
- Add a module path component to the scan list.
removeModulePath
public boolean removeModulePath(java.lang.String path)
- Remove a module path component from the scan list.
addModule
public boolean addModule(Module module)
- Attempt to add the given module.
The module will be added if it is not already present, or is with a lower version number.
This method can be used to add non-dynamic reports.
parseModulePath
public static java.lang.String[] parseModulePath(java.lang.String paths)
- Parses a path string in the same form as the classpath into an array of paths.
getAvailableModules
public java.util.List getAvailableModules()
- Returns a list of all modules available to the given user.
getModule
public Module getModule(java.lang.String id)
- Returns the given module.
scan
public void scan(boolean updated)
- Scans the module path(s) for any new or updated modules.
New modules will be added to the list of available modules.
If a module class file has a more recent timestamp than the version that was used to load the module, it will be re-loaded.
constructModulePath
public static java.lang.String constructModulePath(java.lang.String[] paths)
- Constructs a path string in the same form as the classpath from an array of paths.
createPathComponent
protected ModulePathComponent createPathComponent(java.lang.String path) throws InvalidPathException
- Converts a string into a ModulePathComponent object.
checkProvidersModules
protected boolean checkProvidersModules(ModulePathComponent.Provider component)
- (Re)loads the modules provided by the given provider, if appropriate.
Reports are loaded if they don't already exist, or if there is a newer version.
By using new class loaders each time we ensure that we don't use old versions of the module.
checkProvidersModules
protected boolean checkProvidersModules(java.lang.Class providerClass)
- (Re)loads the modules provided by the given provider, if appropriate.
Reports are loaded if they don't already exist, or if there is a newer version.
By using new class loaders each time we ensure that we don't use old versions of the module.
|
|||||||||
| Home >> All >> com >> dghda >> [ module overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
JAVADOC
com.dghda.module.ModuleLoader