The Java-to-Service-Model transformation uses the comparing and merging functionality to determine the differences between the target model and the temporary model that the transformation generates. When you run the Java-to-Service-Model transformation, the merge editor displays the differences between the two models. In the merge editor window, you can select the changes that the transformation merges into the target model.
| Option | Description |
|---|---|
| Use a transformation configuration | Depending on the view that you are
in, complete one of the following steps:
|
| Run the transformation from the Project Explorer view | To run the transformation from the Project Explorer view,
complete the following steps:
|
| Run the transformation from a class diagram in a Java project | To run the transformation from a class diagram in a Java project, complete the following
steps:
|
| Run the transformation from the command line | To
run a transformation from a command line, use the following syntax:eclipse -data workspace-path -application com.ibm.xtools.transform.core.transformationRunner -transformConfigs "[-R]transformation-configuration-path1,[-R]transformation-configuration-path2,..." In the -transformConfigs parameter, you must specify the complete workspace path and configuration file name, not the file-system path name, of one or more transformation configurations. Running a transformation from a command line suppresses all dialog boxes that the transformation generates. As an example, a transformation configuration called MyConfig.tc is in a project called MyProject in a workspace called MyWorkspace. This transformation configuration specifies the configuration information for a transformation called MyTransformation, and for a corresponding reverse transformation called MyReverseTransformation.
|
| Invoke the transformation API | To run the
transformation as part of an application, you can invoke the transformation
API, as in the following example:IFile file = ResourcesPlugin.getWorkspace().getRoot().getFile(new Path("/MyWorkspace/MyConfig.tc"));
try {
ITransformConfig config = TransformConfigUtil.loadConfiguration(file);
IStatus status = TransformController.getInstance().execute(config, null, false, null);
}
catch (IOException e) {
// The config file could not be read.
}
You can also load a transformation
configuration by specifying a URL, as in the following example:
try {
URL url= new URL(platform:/plugin/myPluginID/myConfig.tc);
ITransformConfig config = TransformConfigUtil.loadConfiguration(url);
}
catch (MalformedURLException malURLEx) {
// Handle exception.
}
catch (IOException ioEx) {
// Handle exception.
}
You can specify a URL that uses
different protocols, as in the following examples:
|
| Run a transformation configuration from an Ant script | To run a transformation from an Ant script or
build.xml file, complete the following steps:
<?xml version="1.0" encoding="UTF-8"?>
<project name="myProject" default="generate" basedir=".">
<target name="generate">
<echo>Running transformation 'myProject/myConfig.tc' ...</echo>
<com.ibm.xtools.transform.core.runTransformation transformConfig="myProject/myConfig.tc" reverse="false"/>
</target>
</project>
In the build.xml file, in the project element, set the default attribute equal to the value that you specify for the name attribute in the target element. The transformConfig attribute must specify a valid workspace path. For transformation types
that support a reverse transformation, to run the reverse transformation,
set the reverse attribute to true.
Note: The transformation
configuration must implement the Reconciled
Modeling design
contract management protocol (DCMP).
To run the Ant script, right-click the build.xml file; then click . |