Monday, March 23, 2009

Setting up a Dynamo Module

Here's how to get your module to appear in the Dynamo DCC. Here are the steps, we'll use the name MyModule in this example

Create the module folders

Create a sub folder for your module in your on my machine that would be: C:\ATG\Dynamo5.1
So our new folder is C:\ATG\Dynamo5.1\MyModule. This folder will contain all the files for your module

Create the following sub folders

classes - your java classes will go here
config - your global module configuration files/layer will go here
doc - your web pages will go here
localconfig - I think this is for machine specific config files/layer
META-INF - your module manifest will go here
bin - your OS specific configuration files will go here
Create a MANIFEST.MF file
Create a file called MANIFEST.MF in the META-INF directory
ATG-Product: MyModule
Manifest-Version: 1.0
ATG-Config-Path: config/
ATG-Class-Path: classes/
ATG-Required: DAS
This has many effects.
ATG-Config-Path: config/
This appends the specified directory to the CONFIGPATH at startup, enabling your modules customizations
ATG-Class-Path: classes/
This pre-pends the classes sub folder to the CLASSPATH enabling your java classes that are placed there ATG-Required: DAS
This forces the DAS modules to be loaded before your module. This is your dependency list, for example if you module relies on DPS as well you would specify..
ATG-Required: DAS DPS
Similarly ATG-Required: DAS DPS DSS DCS CSR Fulfillment
Would force all these modules to load before MyModule
Your module is now set up, we just need to tell Dynamo to use it.
Starting Dynamo with your Module
The module list to load is specified by using the -m flag on the startDynamo command line.
To set this up create a copy of your standard shortcut to Dynamo, then modify the new Shortcutby adding MyModule to the end of the -m portion your link might look like this:
C:\WINNT\System32\cmd.exe /k C:\ATG\Dynamo5.1\home\bin\startDynamo.bat -m MyModule
This tells Dynamo to look for your module at start up.
Optional: Displaying Web Content for your Module
Dynamo does not support multiple document roots, any content to be displayed must be positioned somewhere under the system's doc root. This leaves you with two options
Copy your content into the document root hierarchy
Set the system doc root to your own doc directory
The first of these two is doesn't really need to be explained here, so we'll deal with how to set Dynamo's doc root to your doc directory in the case where your module is active. This is useful for sample applications and allows you to easily test and demonstrate the functionality of your module without polluting the shared file system with sample files.
To get the web server to display our module's content we need to do two things
In your doc directory create a index.html file - some kind of hello world
In your config\atg\ folder create a new folder dynamo, create a file called
Configuration.properties with this line in it
documentRoot=D:\\ATG\\Dynamo5.1\\MyModule\\doc
This configuration layer will tell the web server to use your doc directory as the website root. This will only work for you if MyModule is the last configuration layer which specifies documentRoot.
Optional: Making your configuration layer the default for updates
When you modify the configuration in the DCC the changes are written back to the properties files in the default update layer. You can make your layer the default by specifying the following line in the CONFIG.properties file in your config folder.
defaultForUpdates=true
Optional: Registering your Module with the System
This step is not required for packaging purposes but does allow you to use some advanced module features
Create or modify CONFIG.properties file in your config directory adding the following 2 lines followed by an empty line (Do not delete the defaultForUpdate property if you added it in the previous step)
name=MyModule
module=MyModule
In your config directory create a sub folder 'atg' then inside that another subfolder 'modules'. In that directory (e.g. C:\ATG\Dynamo5.1\MyModule\config\atg\modules)...
Create a file MyModule.properties with the following, followed by an empty line:
$class=atg.service.modules.Module
moduleName=MyModule
(This creates an component MyModule of class atg.service.modules.Module with the moduleName parameter set to MyModule)
Create a file ModuleManager.properties with a the following, followed by an empty line:
modules+=MyModule
This tells adds the MyModule component to the ModuleManager modules list and presents your module in the DCC module list
Optional: Environment setup files
If you need to set some environment variables every time your module is started you can do this via the manifest file.
Add this line to your MANIFEST.MF file:
ATG-Config-Scripts: bin/setup
This causes the file bin/setup.bat to be executed at startup, which can be very handy.
So you'll also need to add that file to the bin directory, including your environment setup
rem Add your start time configuration settings here

No comments:

Post a Comment