Plone 3 Products Development Cookbook
上QQ阅读APP看书,第一时间看更新

Configuring ArgoUML

ArgoUML runs on any Java platform. If you don't have it yet, install JRE version 5 or higher.

The first step in using ArchGenXML from a UML model is to associate a proper profile (with widgets, fields, and stereotypes information) to the UML application.

Getting ready

To get an ArchGenXML profile with all the information we'll use during Plone models generation, we can:

  1. Download it from http://svn.plone.org/svn/archetypes/ArchGenXML/trunk/umltools/argouml/archgenxml_profile.xmi
  2. Generate it with our just installed ArchGenXML application. The following command will create an archgenxml_profile.xmi file in the ./bin folder:
    ~/libexec/argchgenxml/bin/agx_argouml_profile
    

    Whatever method you choose, move the profile file to a new profiles folder inside archgenxml.

    Another better choice is to generate the profile file automatically during ArchGenXML buildout. If you want to, just modify your ArchGenXML buildout.cfg file:

  3. Add a new agx-profile line to the parts definition at the top of the file:
    [buildout]
    parts = 
    
       ...
     agx-profile
    
  4. And then include the new [agx-profile] part definition at the bottom of the file:
    [agx-profile]
    recipe = iw.recipe.cmd 
    on_install=true
    on_update=false
    cmds = 
        mkdir ${buildout:directory}/profiles
        cd ${buildout:directory}/profiles
        ${buildout:directory}/bin/agx_argouml_profile

Note

In Windows, surround all paths with quotation marks to prevent errors when using long directory names including white spaces.

The iw.recipe.cmd recipe runs arbitrary shell commands—the ones listed after the cmds parameter.

The on_install and on_update parameters tell the recipe when it must be executed.

How to do it…

To associate the just generated profile to ArgoUML, we have to add it as a default profile for all upcoming projects, and then change a property in every new project.

Let's edit ArgoUML general settings:

  1. Launch ArgoUML.
  2. Go to the Edit | Settings menu option, and then to the Profiles section.
  3. In the Default XMI Directories list, click on the Add button, then browse to the profiles folder and select it.
  4. Click on the OK button and restart ArgoUML.
  5. Again go to the Edit | Settings menu option, and then to the Profiles section.
  6. You'll now see a new AGXProfile option in the Available Profiles list; select it and click on the >> button to include it in the Default Profiles list.
  7. Remove any other profile in the Default Profiles list, except UML 1.4 (you can't remove it from Profile Settings).
    How to do it…

Every time you create a new project, you have to modify the per-project properties as follows:

  1. Go to the File | Project Properties menu option, and then to the Profiles section.
  2. Select the UML 1.4 option in the Active Profiles list on the right; then click on the << button to make it inactive.
  3. Make sure there is no other profile set as active except AGXProfile.
  4. Click on OK to save these settings.
    How to do it…

How it works…

By leaving just AGXProfile in the Active Profiles list, we make sure no other stereotypes, data types or tags will be available in ArgoUML except the ones we need for ArchGenXML. This will save us from mistakes like typos, or using data types that are not really useful for a Plone project. Moreover, this will give us the chance of learning by seeing tags that we didn't know existed.

Due to a restriction in ArgoUML, we can't remove the UML 1.4 profile from the Active Profiles list in the Settings window. That's why we leave it in Step 1 and then we finally remove it in Step 2, in the project-specific properties.

Once we have applied all these changes, we should see the left-hand navigator as in the screenshot below:

How it works…

There's more…

For more about ArgoUML configuration, see Plone's Developer Manual at: http://plone.org/documentation/manual/archgenxml2.