Thursday, March 06, 2008

Converting Workbench modules for use with ProjectBuilder

ProjectBuilder is one of the key new features of ControlTier 3.1. This base type allows architects and administrators to manage their projects as a set of (XML) source using development tools of choice as opposed to solely using Workbench.

The thing is, many people already have sets of modules created under Workbench and therefore need to convert them for use with ProjectBuilder. Since this process is not currently well documented on Open.ControlTier, here's a quick cheat sheet:
  • Setup a minimal ProjectBuilder object for your project. By convention, the ProjectBuilder is given a library name ("mymodules" in this case) that reflects the combined intent of the set of modules it manages.

    $ ad -p MyProject -t ProjectBuilder -o mymodules -c Register -- -basedir \${env.CTIER_ROOT}/src/mymodules -installroot \${env.CTIER_ROOT}/target/mymodules -install
    For more information about this object run: ad -p MyProject -t ProjectBuilder -o mymodules -c Get-Properties -- -print

    [command.timer.Deployment.Register: 4.123 sec]
  • By the way, the base directory is usually put under source code control to provide version management for the module source. A good example of this is the structure of the Elements Module Library source on ModuleForge.
  • Create the minimal base directory structure:

    $ mkdir -p $CTIER_ROOT/src/mymodules/modules
  • Copy in the latest version of your module(s) from Workbench's WebDAV working directory (Note that these commands assume you are setting up a ProjectBuilder development environment on the same system where Workbench is deployed. This need not always be the case):

    $ cd $CTIER_ROOT/src/mymodules/modules
    $ cp -r $CATALINA_BASE/webapps/webdav/MyProject/modules/MyBuilder .

  • Convert the module's RDF files to type XML format:

    $ ad -p MyProject -t ProjectBuilder -o mymodules -c convert-rdf -- -type MyBuilder
    convert-rdf completed. execution time: 0.888 sec.

  • Remove extraneous RDF and property files from the module source:

    $ rm MyBuilder/*.rdf MyBuilder/*.properties
  • Test building the module from source and uploading it to the project:

    $ ad -p MyProject -t ProjectBuilder -o mymodules -c build-type -- -type MyBuilder -upload
    Building type using the buildmodule.xml via classloader

    converting type.xml for module: MyBuilder

    packaging module: MyBuilder

    Building jar: /home/anthony/ctier/target/mymodules/modules/MyBuilder-1.jar

    calling repoImport ...

    processing files in directory: /home/anthony/ctier/target/mymodules/modules

    Uploading jar: /home/anthony/ctier/target/mymodules/modules/MyBuilder-1.jar to server: localhost ...

    [command.timer.repoImport: 3.058 sec]

    repoImport completed. execution time: 3.058 sec.

    [ 4.112 sec]

    build-type completed. execution time: 4.112 sec.


Anthony Shortland.

1 comment:

Anthony Shortland said...

I've just added a new posting that describes how to add Setting sub-types to your ProjectBuilder source.