Login | Register
My pages Projects Community openCollabNet

6.2. Modules

The ArgoUML tool provides a basis for UML design and potentially an executable architecture environment for more specialized applications. This is solved by a clear interfaces between the ArgoUML core and the extensions. Extensions are called modules.

6.2.1. Modules

  • Modules

    A module is a collection of classes and resource files that can be enabled and disabled in ArgoUML. Currently this is decided by the module's availability when ArgoUML starts but in the future it could be made possible to enable modules from within a running ArgoUML.

    This module system is the extension capability to the ArgoUML tool. It gives developers of ArgoUML and developers of applications running within the ArgoUML architecture the ability to add functionality to the ArgoUML environment without modifying the basic ArgoUML tool. This flexibility is designed to encourage additional open source and/or commercial involvement with the open source UML tool.

    The module extensions load when ArgoUML starts. When the modules are loaded they have the capability of attaching to internal ArgoUML architectural elements. Once the plugins are attached, the plugins will receive calls at the right moment and can perform the correct action at that point.

    Modules can be internal and external. The only difference is that the internal modules are part of the argouml.jar and the external are delivered as separate jar-files.

This is essentially and implementation of the Dynamic Linkage pattern as described in Patterns in Java Volume 1 by Mark Grand ISBN 0-471-25839-3. The whole of ArgoUML Core is the Environment, the classes inheriting Pluggable are the AbstractLoadableClass.

6.2.2. Modules

6.2.2.1. Module Architecture

The controlling class for the implementation is org.argouml.moduleloader.ModuleLoader2. It is a singleton created when first used. It is first used in the main initialization routine.

When created it searches through all available modules and creates a list of their main objects (implementing ModuleInterface). Currently (September 2004) this also means that the found modules are by default selected i.e. they are marked to be enabled.

At the end of the main initialization routine the selected modules are enabled. (The original idea was to do this several times during the main routine to allow for modules to add command line arguments, add languages, and make functions available for batch command, but the example used for testing loaded the ProjectBrowser "too early" and the result wasn't so good. I (Linus) hope this can be eventually fixed.)

6.2.2.2. The ModuleInterface interface

Each class used by the ModuleLoader2 must implement the ModuleInterface interface.

This interface has methods for enabling, disabling and identifying the module.

When a module is enabled it is expected to register some class wherever it affects ArgoUML using the interfaces provided there. Since the same interfaces and registration mechanism is used internally within ArgoUML there is a small likelyhood that there already is an interface and a possibility to register. If there isn't, ArgoUML cannot currently be extended at that point. If you still need ArgoUML to be extended at that point you will have to work in getting this interface or registration mechanism implemented within ArgoUML. (This could also be another module that has to be amended.)

Classes administered by the module that registers to whatever place of ArgoUML they are interested in, does not need to have any connection to the module loader. They are written exactly as if they would have been if they were part of the core ArgoUML.

6.2.2.3. Using Modules

When modules are used they can't be distinguished from the rest of the ArgoUML environment.

6.2.2.4. How do I ...?

  • ...tell when a module is enabled?

    The method isEnabled in ModuleLoader2 returns true if the module with that name is enabled and false otherwise.

6.2.3. Tip for creating new modules (from Florent de Lamotte)

[Note]Note

This description is for the old moduleloader.

Florent wrote a small tutorial for creating modules. It can be found on the ArgoPNO website.