EclipseUML 2008 reverse engineering of Legacy Jar file.

In this section you will have a look at how to reverse existing Jar files.
The reverse engineering of Jar file is an important stage in order to immediately understand the architecture of existing applications.
With use of Java Web Start, some web pages, for example https://www.womenshealthandfitness.com.au/general/got-a-new-health-product-digital-marketing-can-be-the-answer-to-generate-more-business/ are using jar files backend.

This document is composed of:

  1. How to import Legacy jar files in your project
  2. Jar file reverse engineering process
    1. Package Diagram Views
      1. Reverse the Project Structure
      2. Reverse the Project Packages Dependencies
      3. Conclusion
    2. Class Diagram Views
      1. Inheritance reverse
      2. Dynamic Navigation
  3. Sequence Diagram reverse engineering

1. How to import Legacy Jar files in your project

Click in the package explorer New > Java Project and create a new Java Project (e.g. ReversEngineeringLegacyJarFile).
Copy the following two Jar files in your workspace at the root of your project using windows file manager.
Please not that you need to only select the two jar file and not to unzip the existing project structure at the root of the project.
You also should not copy the jar file at the root of the src. If you don't do exactly the same way, then you will not be able able to see connectors (e.g. dependencies, inheritance, associations) between classiefiers and packages. These instalation requirements are essential because EclipseUML reverse of Jar file is based on byte code analyses mapping the .class classifiers with the model and not on the java src detection. It uses therefore another mecanism and then merge both inside a single model.
  1. javax.servlet.jsp_2.0.0.v200806031607.jar
  2. javax.servlet_2.4.0.v200806031604.jar


Click in the Package Explorer > Refresh in order to display the newly copied Jar files inside your Eclipse Project.




The imported jar files are now at the root of your project.
(Note that you should not import the jar files at the root of the src. A jar could not be considered as a java src code because you can not change and manipulate directly the code).





Click in the Package explorer on the Project > Property > Java Build Path > Libraries > Add JARs..



The internal Jar files have moved to the Referenced Libraries folder and could now be reversed by EclipseUML 2008.



2. Package Diagram reverse

2.1.1
Reverse the Project Structure

Click on the Jar file and select Open / Reverse UML > Nested Package Diagram



Select the depth of the nested package (e.g. 4 )





The  jar file structure diagram is immediately displayed.
We can notice that Javax is the main package containing servlet package and three nested packages named jsp, ressource and http.




If you look at the Package Explorer then you only see two packages javax.servlet and javax.servlet.http but the real structure is different.



So I decided to investigate what is tagext package and its classifiers.
Double Click on the tagext package > Inheritence Explorer > select All
You can now dislpay the classifier structure of your package using a class diagram




I don't see these classes in my jar file :-)
So my investigation is to click on BodyTag Interface and have a look where this interface is  in the Package Explorer



Then I realize that this interface is in another jar file :-)



This example helps to show that the reverse of Package using a Structural view is important in order to understand the project logic and extend jar classifiers.



2.1.2 Reverse the Project packages dependencies


Click on the jar file in the Package Explorer > Open / Reverse UML > Package Diagram




The dependencies are immediately displayed in the package diagram





2.1.3 Conclusion


The EclipseUML 2008 package diagram reverse gives you an immediate view of the structure and the dependencies between packages.
Both views are important because just showing dependencies doesn't explain the logical structure and not showing dependencies doesn't explain the interaction between packages. A good reverse engineering should therefore display both structural and dependencies package views.


2.2. Class Diagram reverse engineering

2.2.1 Inheritance Reverse

Click on the package in the Package Explorer > Open / Reverse UML > Class Diagram View > Class Inheritance Explorer > Fit Diagram to Screen



The class diagram is immediately displayed



2.2.2 Dynamic Navigation

I now would like to immediately display only associations.
Click on the diagram background > Associations > Show all Associations > Manual.




I then click in Inheritance > Hide all Inheritance and after Arrange Diagram > Arrange All
The new association class diagram view is immediately displayed (e.g. dynamic navigation)



I would like to display dependencies inside this class diagram.
Click on the diagram background > Dependencies > Show all Dependencies > Manual
I then click in Association> Hide all Association (e.g. to clean my previous view) and after Arrange Diagram > Arrange All



I would like now to visualize element dependencies, inheritance or association in order to immediately understand classifiers interactions.
Click on a classifier inside the class diagram and open one of the dynamic menu (e.g. click on ServletRequestEvent and select dynamic popup menus)






  1. Sequence Diagram reverse engineering
Click on a method in the Package Explorer or inside your diagram > Open UML > Generate sequence diagram
(Note that it is impossible to reverse method from Interface or Abstract method because you don't have any instance in such classifiers)




The sequence diagram is immediately displayed.


EclipseUML 2008 sequence diagram reverse can reverse methods having calls inside multiple jars.
To be able to reverse such a method you need to import all related jar files in your project inside the Referenced Libraries folder in the Package Explorer.

Omondo is the only UML tool on the market to reverse engineering both dependency and structure of your projects.
Omondo is the only tool to reverse legacy jar files and display it in your package, class and sequence diagrams.