© Copyright International Business Machines Corporation 2006. All rights reserved. US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
When authoring a model to model transformation, if the target is a UML 2 model, the default UML profiles are not automatically mapped. For example, the default.epx UML profile is not automatically mapped. You must map these profiles manually, or use the UMLDefaultLibrariesAddRule framework. You can manually add this framework to a transformation if the target is a UML model EClass.
To add the framework to a transformation, add the following code to the transformation:
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated NOT
*/
protected void addTransformElements(Registry registry) {
add(new UMLDefaultLibrariesAddRule());
addGeneratedTransformElements(registry);
// You may add more transform element after the generated ones here
// Remember to remove the @generated tag or add NOT to it
}
In model to model transformation authoring, to have "fuse" support in your target model, you must have the "org.eclipse.core.runtime.contentTypes" extension in a plug-in in your Eclipse workspace. You can specify this extension in a plug-in that has a domain name that is derived from the target model domain. For more information about this extension, refer to the extension point documentation in the Compare/Merge project. This enables you to build a sophisticated fuse strategy for your target model. For a simpler EMF strategy, you can specify the following extension (replace "xxx" with your target file extension):
<extension
point="org.eclipse.core.runtime.contentTypes">
<file-association
content-type="com.ibm.xtools.comparemerge.emf.emfContentType"
file-extensions="xxx"/>
</extension>
When authoring model to model transformations, the Ecore models that you specify as input or output must have corresponding genmodels. To create genmodels, you can use the EMF Model wizard. Ensure that you generate code after creating the genmodels. The genmodels must be registered in the development workbench, or they must be in the same path as the corresponding Ecore models. The genmodels must have a .genmodel file name extension, a similar name, and the same case as the Ecore models. Otherwise the transformation authoring engine cannot find the genmodel. If the transformation authoring engine cannot find the required genmodels, it disables code generation.
When you create a transformation configuration for a model to model transformation, you must specify a file that represents the target model, even if the file is empty. You cannot specify a URI as the target container.
To create an empty Ecore model, on the Main page of the transformation configuration editor or wizard, click the Create New Target Container button and specify a file that has the extension of the target model.
To integrate a model to model transformation as the front end to a JET (model to text) transformation, you must manually add an instance of the JETRule framework to the 'postProcessing' rules of the RootTransformation that is located in the transformation provider. The following example shows the code that you must include in your transformation provide class. You must replace 'xxx' with the id of your JET transformation.
/**
* Creates a root transformation. You may add more rules to the transformation here
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param transform The root transformation
* @generated NOT
*/
protected RootTransformation createRootTransformation(ITransformationDescriptor descriptor) {
return new RootTransformation(descriptor, new MainTransform()) {
protected void addPostProcessingRules() {
add(new JETRule("xxx"));
}
};
}
To generate transformations that input or output UML models, specify a UML metamodel as a root input, root output, or both, of the mapping specification. Adding a UML profile to the mapping specification does not automatically add the UML metamodel.
Workaround: Add the UML metamodel by clicking the Add Model button in the Model-to-Model Transformation Mapping wizard and editor.
Endpoints of mapping connectors might disappear if a user switches feature filtering from "Basic" to either "Intermediate" or "Advanced" mode, then creates mappings, and then switches back to the "Basic" filter mode. This can cause the appearance of mapping connectors that have endpoints that do not connect to anything. This only affects the appearance of the mappings. The mappings and the source code that the transformation generates from the mappings are not affected.
Workaround: Correct the appearance of the mappings by specifying the filter mode that was in effect when the mappings were created.
When a mapping file no longer contains mappings that specify elements from a model as mapping inputs or outputs, the model is "dropped" from the mapping file. The check for unused models is made whenever a mapping input or output is deleted. Separate lists are maintained in the mapping file for inputs and outputs.
Workaround: You must add the model to the mapping file before you can select elements from that model as mapping inputs or outputs. Click the Add Model button in the Mapping Editor to add the model to the mapping file.
In the transform configuration editor for generated model-to-model transformations, the runSilent option can be specified with any merge mode, including 'automatic' or 'visual'. If the merge mode is set equal to automatic or visual, the runSilent option forces the silent merge strategy if fuse support is found for the target model. Otherwise, an override merge strategy is used.
When creating a transformation mapping model from the Ecore metamodel to the UML metamodel with profiles, you should verify the profile URI that will be used in your target UML models. By default, the URI of the profile that you specify in the mapping editor is used. If you specify a resource URI, it is converted into an equivalent plug-in URI.
Workaround: You can specify a different URI in the profileURI override property on the property page. Click on the root section in the mapping editor to display the property page. Note: If you are using a registered profile, you can specify the URI that the profile is registered with, if it is different from the profile that is used automatically. Failing to do this can cause the registered profile to load more than once in the resource set, which can cause problems with merge or fuse.
When generating code from mapping models in model-to-model transformations, the basic project files such as plugin.xml and manifest.mf are generated if they cannot be found. You might need to edit these files after they are generated.
Workaround:
- If you add input models or output models to the mapping file, you must edit the manifest.mf file. Add the dependencies for plug-ins that contain the generated model code for the input/output model. Adding these dependencies should fix the compile errors that result from trying to access the classes that are in these plug-ins. You can add a dependency on the plug-in that contains the generated code for the new input/output model.
- If you create a mapping model in a Java plug-in that contains the plugin.xml and manifest.mf files, you must add the required dependencies to the manifest.mf file. Add the dependency on transform authoring, and the dependency on the input/output models. You must also add the com.ibm.xtools.transform.core.transformationProviders extension to the plugin.xml file.