MyModules

MyModules is framework for handling modules (components). It eases modular (component-oriented) development by taking care of Modules' initialization, start, and shutdown. Further, it considers dependencies among modules, and supports multi-threading to speed up module initialization.

Key concepts

Example

This example gives an outline of how MyModules can be used. The example is modular application creating a simple GUI, which of a JFrame and a JLabel. This example is based on a GUI because it visualizes a module composite. MyModules is not limited to GUI/client applications, and actually, the first application built on MyModules is a server.

Download

A "HelloWorld" example is available for download. The following introduction is based on this example.

XML module descriptor

Modules are described using a XML file:

<?xml version="1.0" encoding="UTF-8"?>
<modules>
  <module id="GUI" type="GUIModule" dependencies="Frame,Label"/>
  <module id="Frame" type="FrameModule"/>
  <module id="Label" type="LabelModule"/>
</modules>

Modules

Modules usually implement the 'Module' interface consisting of managing methods. The framework calls these methods when the module is initialized, started, and stopped.

public class GUIModule implements Module
{
  public void moduleInit(Map modules) throws Exception
  {
    MyModules myModules=new MyModules(modules);
    LabelModule label=myModules.getLabel();
    FrameModule frame=myModules.getFrame();
    // Further code here...
  }
  // Further methods here...
}

ModuleManager

After defining modules, the ModuleManager is used to initialize and start the modules:

ModuleManager manager=new ModuleManager();
manager.initModules();
manager.startModules();


(c) 2003 by Markus Oliver Junginger. All rights reserved.
www.junginger.biz/mymodules/ MyModules homepage
www.junginger.biz/ Developer homepage