Transformation programs created with TM can be run on almost any system where a Java run-time is installed. They can be started at a command prompt or within a script or batch file by supplying arguments to a command that starts the Test Tool without displaying the GUI. (Because neither TM Design Tool nor the Test Tool GUI is used, this method of running the transformation programs appears to be independent of TM, so it is sometimes referred to as ‘stand-alone’ use.)
The following steps describe how to run transformation programs from a command prompt.
Step 1
Identify the executable files required. The generated files are written to a subdirectory of the TM installation directory:
<install_dir>\com\prismt\transform\transforms\<project>\<major>\<minor>where:
<install_dir> is the path to the TM installation<project> is the name entered when the project was created in the TM Design Tool<major> is the major version number (as generated by TM Design Tool)
preceded by an upper-case ‘V’ (for example, V1)<minor> is the minor version number (as generated by TM Design Tool)
preceded by a lower-case ‘m’ (for example, m0)For example, the generated files for the first version of a project called
ErrorTrapping would be stored in the following directory on a Windows
system:
<install_dir>\com\prismt\transform\transforms\ErrorTrapping\V1\m0
This directory contains individual Java source and compiled .class files, plus
the <project_name>.jar file that is actually required for running the
transformation.
By way of a contrast the generated files for the first version of a
project called Ch2.Sec1.Project1 would be stored in the following
directory on a Windows system:
<install_dir>\com\prismt\transform\transforms\Ch2\Sec1\Project1\V1\m0
Please refer to Generated Project Files for additional information.
Step 2
Identify the configuration file required. The TM installation comes with a
commented Exec.properties file that is divided into sections with headings such
as XML, relational sources, relational targets, logging, and more. Copy the
Exec.properties file, located in the tm directory of the TM installation, to
another name (such as myExec.properties) within this same directory.
Step 3
Edit the myExec.properties file to point to the correct source and target
models, and to the correct project. Comment out the irrelevant sections and fill
in the relevant properties as described in the file. Note - The copy of Exec.properties that is installed with the Test Tool is fully commented.
Click here to see that file. However, the comments are not preserved when the
Test Tool runs. A copy of
Exec.properties is therefore also installed to <TM_directory>\originals.
Step 4
In Windows, open the Command Prompt from the Start | Programs | Transformation
Manager menu. This sets the CLASSPATH environment variable so that the
transformation programs can be run from the above location. The TM Command
Prompt contains absolute references to the necessary libraries, so it
does not need to be modified when the transform project is run from a different
directory.
In Unix, ensure that the CLASSPATH environment variable includes a reference to
a copy of tmr.jar.
Step 5
Run the transforms with this command line:
java –Dfile=myExec.properties com.prismt.transform.run-time.exec.RunMaps
The following command line executes the original Exec.properties file and can be
used when that file has been edited directly:
java com.prismt.transform.run-time.exec.RunMapsNote The original Exec.properties file is overwritten each time a
transformation is run using the
Test Tool and will therefore need to be edited
repeatedly. Editing and running a copy of it avoids constant editing.
You can write this file from the Test Tool without actually executing the
transform by using the
Setup
menu option.
It is also possible to specify properties on the command line:
java com.prismt.transform.run-time.exec.RunMaps source.url=mysource.xml
target.url=mytarget.xmlProperties specified on the command line override values in the Exec.properties file.
See further for: