• No results found

Chapter 9. Analyzing customizations

9.6 Using DXLMagic

9.6.7 Putting it all together

Depending on the number of DDM templates you need to analyze, you might want to automate the process. You have 2 possibilities here: use a batch file or use DXLMagic command file.

Using a batch file has the advantage, that for each step the jvm is loaded separately and you can include checks to skip existing files. Using DXLMagic has the advantage, that the jvm is loaded only once, so execution speed is faster. In Example 9-15 we assume that your standard template names are DomDoc70.ntf and FileCab70.ntf.

Example 9-15 DOS/Windows command file (ddmcompare.cmd)

@echo off

REM the standard templates are domdoc70.ntf and filecab70.ntf REM the two modified databases are %1 and %2

REM the resultpath comes from DXLPATH if x%DXLPATH%x==xx SET DXLPATH=C:\dxl cd %DXLPATH%

if not exist domdoc70.ntf.dxl java com.ibm.sg.dxlmagic.DesignExporter %dxlpath% domdoc70.ntf

if not exist filecab70.ntf.dxl java com.ibm.sg.dxlmagic.DesignExporter %dxlpath% filecab.ntf

if not exist %1.dxl java com.ibm.sg.dxlmagic.DesignExporter %dxlpath% %1 if not exist %2.dxl java com.ibm.sg.dxlmagic.DesignExporter %dxlpath% %2 if not exist %1.compare java com.ibm.sg.dxlmagic.CompareDXL

%dxlpath%\domdoc70.ntf.dxl %dxlpath%\%1.dxl %dxlpath%\%1.compare if not exist %2.compare java com.ibm.sg.dxlmagic.CompareDXL %dxlpath%\filecab70.ntf.dxl %dxlpath%\%2.dxl %dxlpath%\%2.compare REM We generate the reports unconditionally

java com.ibm.sg.dxlmagic.TransformXML %dxlpath%\%1.compare %dxlpath%\ComparisonReportShort.xslt %dxlpath%\%1.short.html java com.ibm.sg.dxlmagic.TransformXML %dxlpath%\%1.compare %dxlpath%\ComparisonReportDetail.xslt %dxlpath%\%1.detail.html REM More reports here....

java com.ibm.sg.dxlmagic.TransformXML %dxlpath%\%2.compare %dxlpath%\ComparisonReportShort.xslt %dxlpath%\%2.short.html java com.ibm.sg.dxlmagic.TransformXML %dxlpath%\%2.compare %dxlpath%\ComparisonReportDetail.xslt %dxlpath%\%2.detail.html REM More reports here....

echo Done!

Chapter 9. Analyzing customizations 163

You would call the file like this: ddmcompare mylibary.nsf mycabinet.nsf

The command file will then compare your library and cabinet file to the base line library and cabinet. The base line gets exported only once. Example 9-16 illustrates the command file to run the compare on either a Macintosh or Linux environment.

Example 9-16 Macintosh/Linux command file ddmcompare.sh

#!/bin/sh #

# Exports File Cabinets and Libraries from a local Notes client and compares them to a base line

#

# the standard templates are domdoc70.ntf and filecab70.ntf # the two modified databases are $1 and $2

# the resultpath comes from $DXLPATH if [ -z "$dxlPath" ]; then

export dxlPath=$HOME/dxl fi

echo Operating from basePath $dxlPath cd $dxlPath

if [ -z "$2" ]; then echo

echo echo

echo Usage: $0 [nameOfLibraryFile] [nameOfCabinetFile]

echo fileName needs to be relative to the Notes data directory and include the extension

echo exit fi

if [ ! -e domdoc70.ntf.dxl ]; then

echo Retrieving base line library domdoc70.ntf

java com.ibm.sg.dxlmagic.DesignExporter $dxlPath domdoc70.ntf fi

if [ ! -e filecab70.ntf.dxl ]; then

echo Retrieving base line cabinet filecab70.ntf

java com.ibm.sg.dxlmagic.DesignExporter $dxlPath filecab70.ntf fi

if [ ! -e $1.dxl ]; then

echo Retrieving library to compare $1

java com.ibm.sg.dxlmagic.DesignExporter $dxlPath $1 fi

if [ ! -e $2.dxl ]; then

echo Retrieving cabinet to compare $2

java com.ibm.sg.dxlmagic.DesignExporter $dxlPath $2 fi

if [ ! -e $1.compare ]; then

echo Generating library comparision baseline to $1

java com.ibm.sg.dxlmagic.CompareDXL $dxlPath/domdoc70.ntf.dxl $dxlPath/$1.dxl $dxlPath/$1.compare

fi

if [ ! -e $2.compare ]; then

java com.ibm.sg.dxlmagic.CompareDXL $dxlPath/filecab70.ntf.dxl $dxlPath/$1.dxl $dxlPath/$2.compare

fi

# Reports are generated unconditionally

java com.ibm.sg.dxlmagic.TransformXML $dxlPath/$1.compare $dxlPath/ComparisonReportShort.xslt $dxlPath/$1.short.html java com.ibm.sg.dxlmagic.TransformXML $dxlPath/$1.compare $dxlPath/ComparisonReportDetail.xslt $dxlPath/$1.detail.html #More reports here....

java com.ibm.sg.dxlmagic.TransformXML $dxlPath/$2.compare $dxlPath/ComparisonReportShort.xslt $dxlPath/$2.short.html java com.ibm.sg.dxlmagic.TransformXML $dxlPath/$2.compare $dxlPath/ComparisonReportDetail.xslt $dxlPath/$2.detail.html #REM More reports here....

echo Done!

Do not forget to make the script executable using chmod +x ddmcompare.sh. You then can use that script like this: ./ddmcompare.sh mylibary.nsf mycabinet.nsf

You can modify the command files to accommodate your specific needs.

The other possibility to automate the process is to use DXLMagic’s command files. You can call them like this: java -Xmx1024 com.ibm.sg.dxlmagic.DXLMagic [PathToCommandFileName]

Using DXLMagic with a command file name loads the JVM™ only once and executes all commands unconditionally. The command file usually gets generated by the DXLMagic Notes front-end (see the OpenNTF download for that), but you can create that file also with a text editor. Example 9-17 shows an example of the command file.

Example 9-17 DXLMagic command file (for example, things2do.txt)

# Command File for dxlMagic workingdirectory=/home/stw/dxl/ projectdirectory=/home/stw/dxl/DDM/ # Action: EXPORT export,domdoc70.ntf export,filecab70.ntf export,myLib.nsf export,myCabinet.nsf # Action: COMPARE compare,domdoc70.ntf.dxl,myLib.nsf.dxl,myLib.nsf.compare compare,filecab70.ntf.dxl,myCabinet.nsf.dxl,myCabinet.nsf.compare

# Action: TRANSFORM / CREATE REPORT

transform,myLib.nsf.compare,ComparisonReportShort.xslt,myLib.nsf.short.html transform,myLib.nsf.compare,ComparisonReportDetail.xslt,myLib.nsf.detail.html transform,myCabinet.nsf.compare,ComparisonReportShort.xslt,myCabinet.nsf.short.htm l transform,myCabinet.nsf.compare,ComparisonReportDetail.xslt,myCabinet.nsf.detail.h tml

Chapter 9. Analyzing customizations 165

One difference in the command files is a distinction between the DXL directory containing stylesheets and static files versus the project directory, which is the default destination for all generated output and source for the variable input files.