|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.argouml.moduleloader.ModuleLoader2
This is the module loader that loads modules implementing the ModuleInterface.
This is a singleton. There are convenience functions that are static to access the module.
Nested Class Summary | |
(package private) class |
ModuleLoader2.JarFileFilter
|
Field Summary | |
static String |
CLASS_SUFFIX
Class file suffix |
private static ModuleLoader2 |
INSTANCE
The module loader object. |
private static Logger |
LOG
Logger. |
private Map |
moduleStatus
This map contains the module loader information about the module. |
Constructor Summary | |
private |
ModuleLoader2()
Constructor for this object. |
Method Summary | |
private void |
addClass(ClassLoader classLoader,
String classname)
Try to load a module from the given ClassLoader. |
static void |
addClass(String classname)
Add a class from the current class loader. |
private void |
addModule(ModuleInterface mf)
Add a newly found module to moduleStatus . |
static Collection |
allModules()
Get a Collection with all the names. |
private Collection |
availableModules()
Return a collection of all available modules. |
private void |
doInternal(boolean failingAllowed)
Enables all selected modules. |
static void |
doLoad(boolean failingAllowed)
Enables all selected modules and disabling all modules not selected. |
private Map.Entry |
findModule(String name)
Return the ModuleInterface, ModuleStatus pair for the module with the given name or null if there isn't any. |
static String |
getDescription(String name)
Create a description of the module based on the information provided by the module itself. |
private String |
getDescriptionInternal(String name)
|
static ModuleLoader2 |
getInstance()
Get hold of the instance of this object. |
private void |
huntForModules()
Tries to find as many available modules as possible. |
private void |
huntForModulesFromExtensionDir()
Find and enable modules from our "ext" directory and from the directory specified in "argo.ext.dir". |
private void |
huntModulesFromNamedDirectory(String dirname)
Find and enable a module from a given directory. |
static boolean |
isEnabled(String name)
Gets the loaded status for some other module. |
private boolean |
isEnabledInternal(String name)
Gets the loaded status for some other module. |
static boolean |
isSelected(String name)
Get the selected. |
private boolean |
isSelectedInternal(String name)
|
static SortedMap |
notYetLoadedModules()
Get a list of not yet loaded modules. |
private void |
processJarFile(ClassLoader classloader,
File file)
Check the manifest of a jar file for an extension. |
static void |
setSelected(String name,
boolean value)
Set the selected value. |
void |
setSelectedInternal(String name,
boolean value)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
private static final Logger LOG
private Map moduleStatus
The keys is the list of available modules.
The keys are ModuleInterface
.
The values are ModuleStatus
.
private static final ModuleLoader2 INSTANCE
public static final String CLASS_SUFFIX
Constructor Detail |
private ModuleLoader2()
Method Detail |
public static ModuleLoader2 getInstance()
private Collection availableModules()
public static void doLoad(boolean failingAllowed)
In short this attempts to make the modules obey their selection.
failingAllowed
- is true if enabling or disabling of
some of the modules is allowed to fail.public static boolean isEnabled(String name)
name
- is the module name of the queried module
public static Collection allModules()
public static boolean isSelected(String name)
name
- The name of the module.
private boolean isSelectedInternal(String name)
isSelected(String)
public static void setSelected(String name, boolean value)
name
- The name of the module.value
- Selected or not.public void setSelectedInternal(String name, boolean value)
setSelected(String, boolean)
public static String getDescription(String name)
name
- The name of the module.
private String getDescriptionInternal(String name)
getDescription(String)
public static SortedMap notYetLoadedModules()
TODO: For the moment these modules are hardcoded into this file. Eventually they will be available in some config file.
SortedMap
from name (String
)
to classname String
.private void doInternal(boolean failingAllowed)
failingAllowed
- is true if this is not the last attempt at
turning on.private boolean isEnabledInternal(String name)
name
- is the module name of the queried module
private Map.Entry findModule(String name)
name
- The given name.
private void huntForModules()
As the modules are found they are appended to moduleStatus
.
private void huntForModulesFromExtensionDir()
TODO: This does a calculation of where our "ext" directory is. We should eventually make sure that this calculation is only present in one place in the code and not several.
private void huntModulesFromNamedDirectory(String dirname)
dirname
- The name of the directory.private void processJarFile(ClassLoader classloader, File file)
If there isn't a manifest or it isn't readable, we fail silently.
classloader
- The classloader to use.file
- The file to process.public static void addClass(String classname)
classname
- The name of the class (including package).private void addClass(ClassLoader classLoader, String classname)
Only add it as a module if it is a module (i.e. it implements the
ModuleInterface
interface.
classLoader
- The ClassLoader to load from.classname
- The name.private void addModule(ModuleInterface mf)
moduleStatus
. If we already
know about it, don't add it.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
ArgoUML © 1996-2004 (20050222) | ArgoUML Homepage | ArgoUML Developers' page | ArgoUML Cookbook |