Converting the Java API calls

An API migration tool is provided as a starting point for converting client Java code from the previous version of the Rational® UML modeling product APIs to this API version. Because the tool is only a helper for refactoring the API, after the tool is run there will be errors and TODO tasks that need to be resolved. The plug-ins should be migrated in an appropriate order based upon dependencies.

About this task

The API migration tool is defined in its own capability, the RSx API Migration capability, which is disabled by default.
Note: The tool works best when a small set of related plug-ins is converted at any one time.

To convert the Java API calls:

Procedure

  1. Enable the API migration tool capability.
    1. Click Window > Preferences.
    2. In the Preferences window, expand General and then click Capabilities.
    3. In the Capabilities list, select RSx API Migration.
    4. Click Apply and OK.
  2. Customize the perspective to show the RSx API Migration tool on the main toolbar.
    1. Click Window > Customize Perspective.
    2. In the Customize Perspective - Java window, click Commands.
    3. In the Available command groups list, select API Migration Tool to enable the tool.
    4. Click OK.
    If your perspective is customized, an API Migration Tool button is added to the main toolbar.

    API migration tool icon

  3. Convert a set of classes.
    1. In the Package Explorer view, select the classes, packages or plug-ins that you want to convert.
    2. Click the API Migration Tool button on the main toolbar. An API Migration Rules window opens with a check box for using the default rule set and a table of the rules that will be used. It is assumed that most users will use this default set of rules that were shipped with the plug-in.

      API Migration Rules

      If the Use default rule set check box is cleared, you can browse the file system to select one or more rule files, such as *.java2java, to be used. The default rule set consists of all rule files located in the com.ibm.xtools.apimigrate.ui plug-in in the rules folder.

    3. Click OK. The rules are applied against the Java classes in the current selection.

      Errors will be logged to the default Eclipse log file and also to the APIMigration.log file created in your home directory. On Windows, the directory is typically named with your user name, within the Documents and Settings directory. Additional information is also output to the APIMigration.log file.

      The rules are only applied to Java classes. Fixing the plug-in dependencies and any other changes to non-Java files will have to be performed manually. In general, this API migration tool handles trivial Rational modeling products API changes, and the deprecated API has been maintained for the more complex API constructs that have changed. For example, even though the earlier Xtools MSL model management API still exists, it might be better to migrate the client code to the new transactional model management API.


Feedback