background image
MANAGEMENT AND TECHNOLOGY SCHOOL OF THE POLYTECHNIC INSTITUTE OF BEJA (PORTUGAL), 31 OCTOBER OF 2007
2
objects and methods found in real time, when
the program is running on the virtual machine.
The technology Java Platform Debugger Ar-
chitecture
or simply JPDA [16], developed by
Sun Microsystems, facilitates this type of work,
through various types of interfaces or APIs
(Application Program Interfaces) to retrieve
information about the status of many types of
data at some point during the execution of
a Java
TM
application. There is an interesting
study [14] made on development of a reverse
engineering tool for UML sequence diagrams
using the Java
TM
platform technology, which
explains how we can implement such a tool
in order to analyse the behavior of any kind of
Java
TM
program.
1.2
Objectives
The main goal of this project was to develop
an application in the Java
TM
language which
will function like a reverse engineering tool and
allow us to generate automatically and in real
time a Sequence Diagram, which graphically
represents the execution sequence of any kind
of Java
TM
program. The project focus on col-
lecting data during Java
TM
program execution
and creating the Sequence Diagram structure
in memory. Then we can export the sequence
diagram to several image formats for represen-
tation or visualization. This allow us to analyse
(do some kind of debugging) effectivily, on the
works and implementation of various parts of
the code, help to find errors and bugs faster
or, even code optimization, in a development
process. The implementation of the code of this
application relies heavily on several advanced
features of the Java
TM
platform and uses the
JDI [15] (Java Debug Interface) API which is
part of the JPDA [16] (Java
TM
Platform Debug-
ger Architecture
), to analyse and retrieve the
information needed to construct the behaviour
of a running Java
TM
program into a Sequence
Diagram. This API interface is easily accessible
from developed Java
TM
code and the applica-
tion does not need to use functions of a low-
level layer, like the JVMTI [17] (Java Virtual
Machine Tool Interface
). So, the main purpose
of such a tool is to provide a mapping from
a Java
TM
code execution, mainly events of call
and return methods, to a UML2 [13] sequence
diagram. The methods that are called when
there is an event of input or output method are
used to extract the information at the time the
event occurs and create the respective arrows
to insert into the sequence diagram.
2
A
BOUT THE
A
PPLICATION
T
HE
application developed in Java
TM
[18]
within this project, can generate a graphi-
cal representation of the UML2 (Unified Mod-
eling Language) [13] Sequence Diagram, by ex-
ecuting the code of a Java
TM
program. That is,
this tool can generate automatically and in real-
time, a schematic presentation of all sequence
execution. This allows accurate values to be
shown at the moment of every event of call
or return method of the Java
TM
program to
be analyzed. This possibility is very valuable
in any analysis and when debugging Java
TM
code. But nevertheless, the functionality of the
application goes far beyond the simple gen-
eration of Sequence Diagrams. There is also
the opportunity to interact with other similar
applications, in order to increase its flexibility
of use. The result diagram can be exported to
various image formats, such as PIC [6], JPEG
[4] or EPS [1], and visualize it on external
tools. It can also save the Sequence Diagram
description to a XML [2] format which can be
loaded and visualized in the future. The value
of some variables necessary for the operation
of the application, can be modified using a
configuration file of the Application. This ap-
plication can be used by Java
TM
programmers
to view and analyze (debugging) of various
functional parts of the executed code, helping
to quickly find errors, bugs or even make some
optimization on code instructions.
2.1
Main Features
·
Uses JDI (Java Debug Interface) [15] to get
real time Sequence Diagram trace informa-
tion.
·
Can load/save the Sequence Diagram pre-
sentation in a based XML [2] format de-
scription.
·
The information of sequence diagram con-
struction operations are saved to a LOG file