Login | Register
My pages Projects Community openCollabNet

6.3. How are modules organized in the Java code?

The previous section describes how modules and plug-ins are organized at the Java level independent of how they are actually packaged.

Within the ArgoUML project some parts of the code are developed and packaged separately from the main ArgoUML source code. This section describes how they are organized and how you create such source-code modules.

6.3.1. Requirements on modules

An external module requires:

  1. The module main class implements org.argouml.moduleloader.ModuleInterface

  2. Archive the main class into a jar, with an entry "Name" in MANIFEST.MF specifying the name of the main class. For example, Name:

    Name: your/own/domain/your/package/your.class
    

    The class in question must implement org.argouml.moduleloader.ModuleInterface.

  3. Put the jar file into a directory called "ext" under the home directory of ArgoUML

  4. Run ArgoUML and check if the module appears in Edit -> Settings -> Modules

New modules that are added to ArgoUML shall reside in whole new packages. Either you put your module classes in your.own.domain .your.package.name or if you want to emphasize the connection to ArgoUML you can use org.argouml.your.package.name where your.package.name is the name of your addition.

6.3.2. How do I ...?

  • ...create a new source-code module.

    Suggestion, copy from the menutest module as described here.

    Make a copy of argouml/modules/menutest into argouml/modules/your name.

    Add any jar you need to argouml/modules/your name /lib and add references to each of the jars in argouml/modules/your name/build.xml.

    Edit argouml/modules/your name /module.properties

    Edit argouml/modules/your name/src/org/manifest.mf.

    Reorganize the source files as necessary. Remove the directory argouml/modules/your name /src/org/argouml/ui and create your own classes like org.argouml.your package name in argouml/modules/your name /src/org/argouml/your package name.

  • ...get Argo to use a plug-in?

    [Note]Note

    This description is for the old module loader.

    Once you've created a jar file with a plug-in in it, you need to make sure that Argo can find the jar to be able to execute it.

    If you are using a "standard" ArgoUML source structure, then you should be able to execute build install or ant install in the source directory of the plug-in. This will copy the jar file to the proper directory in the main ArgoUML build target. You can test your plug-in by running build run in the src_new directory.

    If you need to install the jar "the hard way", try the following steps.

    • Start up ArgoUML.

    • Go to the menu Edit->Settings and look at the Environment tab. Find the entry labeled ${argo.ext.dir}. Create that directory if it does not already exist.

    • Copy the plug-in jar and any other jars required by it into that directory.

    • Start up ArgoUML again, and you should see the plug-in's startup banner (if it has one, of course).