org.argouml.application.modules
Class ModuleLoader

java.lang.Object
  |
  +--org.argouml.application.modules.ModuleLoader

public class ModuleLoader
extends java.lang.Object

Handles loading of modules and plugins for ArgoUML.

Since:
0.9.4

Field Summary
static java.lang.String CLASS_SUFFIX
           
 
Method Summary
 boolean activateModule(ArgoModule module)
          Activate a loaded module.
 void addModuleAction(java.util.Vector popUpActions, java.lang.Object context)
           
 java.lang.String getArgoHome()
           
 java.lang.String getArgoRoot()
           
static ArgoModule getCurrentSingleton(java.lang.Class moduleClass)
          Gets the current singleton of the module type requested.
static ModuleLoader getInstance()
           
 java.lang.Object getModule(java.lang.String key)
           
 java.util.ArrayList getModules()
           
 Pluggable getPlugin(java.lang.Class pluginType, java.lang.Object[] context)
          Returns a plug-in of a given type.
 java.util.ArrayList getPlugins(java.lang.Class pluginType, java.lang.Object[] context)
          Returns all plug-in of a given type.
 boolean hasPlugin(java.lang.Class pluginType, java.lang.Object[] context)
          Indicates whether a requested plug-in is available.
 void initialize()
          Load the internal modules.
 boolean loadInternalModules(java.lang.Class fromClass, java.lang.String rsrcName)
          Load modules listed in Argo resources.
 boolean loadModules(java.io.InputStream is, java.lang.String filename)
           
 void loadModulesFromClassPathJars()
           
 void loadModulesFromExtensionDir()
          Search for and load modules from classpath, and from other places.
 boolean loadModulesFromFile(java.lang.String moduleFile)
           
 void loadModulesFromJar(java.lang.String filename)
           
 void loadModulesFromPredefinedLists()
          Search for and load modules from predefined places.
static boolean requestNewSingleton(java.lang.Class modClass, ArgoSingletonModule moduleInstance)
          Requests the passed singleton to become the current singleton of the module type requested.
 void shutdown()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CLASS_SUFFIX

public static final java.lang.String CLASS_SUFFIX
See Also:
Constant Field Values
Method Detail

getInstance

public static ModuleLoader getInstance()

initialize

public void initialize()
Load the internal modules.


loadModulesFromPredefinedLists

public void loadModulesFromPredefinedLists()
Search for and load modules from predefined places. Look in the following locations in the following order, using System.getProperty() to retrieve the values. Property name ${user.dir} ${user.home} ${java.home}/lib


loadModulesFromExtensionDir

public void loadModulesFromExtensionDir()
Search for and load modules from classpath, and from other places.


loadModulesFromJar

public void loadModulesFromJar(java.lang.String filename)

loadModulesFromClassPathJars

public void loadModulesFromClassPathJars()

loadInternalModules

public boolean loadInternalModules(java.lang.Class fromClass,
                                   java.lang.String rsrcName)
Load modules listed in Argo resources.


loadModulesFromFile

public boolean loadModulesFromFile(java.lang.String moduleFile)

loadModules

public boolean loadModules(java.io.InputStream is,
                           java.lang.String filename)

shutdown

public void shutdown()

addModuleAction

public void addModuleAction(java.util.Vector popUpActions,
                            java.lang.Object context)

getModules

public java.util.ArrayList getModules()

getModule

public java.lang.Object getModule(java.lang.String key)

activateModule

public boolean activateModule(ArgoModule module)
Activate a loaded module.

Returns:
true if the module was activated, false if not or if it was already active.

getCurrentSingleton

public static ArgoModule getCurrentSingleton(java.lang.Class moduleClass)
Gets the current singleton of the module type requested.

Returns:
null if there is some problem.

requestNewSingleton

public static boolean requestNewSingleton(java.lang.Class modClass,
                                          ArgoSingletonModule moduleInstance)
Requests the passed singleton to become the current singleton of the module type requested. Singletons may refuse to be activated. In this case, requestNewSingleton returns false and does not deactivate the current singleton.


getPlugin

public Pluggable getPlugin(java.lang.Class pluginType,
                           java.lang.Object[] context)
Returns a plug-in of a given type. The type of plug-in returned is determined by the class passed.

Parameters:
pluginType - a Class which extends Pluggable and indicates the type of plug-in to return.
context - Additional information used to choose between plugins.
Returns:
A plug-in class which extends the type of class passed as the argument or null if there is some problem.

hasPlugin

public boolean hasPlugin(java.lang.Class pluginType,
                         java.lang.Object[] context)
Indicates whether a requested plug-in is available. This guarantees not to instantiate the plug-in.

Parameters:
pluginType - a Class which extends Pluggable and indicates the type of plug-in to return.
context - Additional information used to choose between plugins.
Returns:
A plug-in class which extends the type of class passed as the argument.

getPlugins

public java.util.ArrayList getPlugins(java.lang.Class pluginType,
                                      java.lang.Object[] context)
Returns all plug-in of a given type. The type of plug-in returned is determined by the class passed.

Parameters:
pluginType - a Class which extends Pluggable and indicates the type of plug-in to return.
context - An object (or null) which allows the plugin to determine if it should be included in a list.
Returns:
A Vector containing all the plugins of the type passed for the passed context, or null if none are available.

getArgoHome

public java.lang.String getArgoHome()

getArgoRoot

public java.lang.String getArgoRoot()


ArgoUML © 1996-2003 (20040216)ArgoUML Project HomeArgoUML Cookbook