IBM Support

Reverse engineering *.war files into XDE for the Java Platform

Troubleshooting


Problem

This technote explains how to reverse engineer a war file into a model in Rational® XDE™ for the Java™ Platform without having to unzip the war file to a project.

Resolving The Problem

In a scenario where there is a Java code model open in XDE and you need to reverse engineer into this model a *.war file, the war file has to be available in a project.

The steps to accomplish this are:

  1. Open File->Import. An Import window appears.
  2. On the first screen of the Import window select File system as your import source. Click Next.
  3. On this screen you will select and add the appropriate war file to your project.

    First specify the location of your war file by selecting the directory where the war file is located using the Directory box.

    Second, change the file type filter to allow you to select the *.war file by clicking the 'Select Types...' button. The .war extension is not listed as an option and you need to add the *.war extension type using the 'Other Extensions' text box.
    Selecting the file type(s) will cause all files of those types that are present in the selected directory to become visible in the list box found on the right hand side. Select the *.war file type and you will see all war files that are present in the selected directory and its sub directories.
  4. In the destination folder specify the Java project to which you wish to add the war file. Then click Finish. If you navigate over to the project workspace in the file system you will notice that the war file has actually been physically copied into the project workspace.
  5. In the Navigator tab (of the Modeling Perspective) you can now see that the war file has been added to the desired Java project. We now need to reverse engineer the file into our Java Code Model.
  6. In the Model Explorer tab right click on the top level Java Code Model package and select More Java Actions -> Add/Remove Modeled files from the context menu.
  7. In the resultant Add/Remove Modeled files dialog box set the File Types to '*.jar,*.war,*.ear' and click on the 'Add Recursively' button. Let the starting folder be the root Java project folder (or any sub folder within the workspace if you prefer). Click OK.
  8. The contents of the war file will now get reverse engineered into your Java Code Model and will be visible in the Model Explorer.

    Note that while it is possible to reverse engineer war files into a model in XDE you cannot generate code from the classes found in the war files. This is because source (or *.class) files are in the .war file. If the intent is to roundtrip engineer the code in XDE, assuming the source files are included in the war file, it is necessary to un-jar the war file prior to reverse engineering them into XDE.



[{"Product":{"code":"SSSJ2Z","label":"Rational XDE Java"},"Business Unit":{"code":"BU053","label":"Cloud & Data Platform"},"Component":"--","Platform":[{"code":"PF033","label":"Windows"}],"Version":"2002 Release 2;2002.05.20;2002 Release 2.1;2002.05.21;2003;2003.06.00;2003.06.01;2003.06.12;2003.06.13","Edition":"","Line of Business":{"code":"","label":""}},{"Product":{"code":"SSSHYJ","label":"Rational XDE Developer"},"Business Unit":{"code":"BU053","label":"Cloud & Data Platform"},"Component":" ","Platform":[{"code":"","label":""}],"Version":"2002.05.20;2002.05.21;2003.06.00;2003.06.01;2003.06.12;2003.06.13","Edition":"","Line of Business":{"code":"","label":""}}]

Historical Number

115728123

Document Information

Modified date:
16 June 2018

UID

swg21135387