Tuesday, December 9, 2008

Reverse-engineer Source Code into UML Diagrams









How to use in maven










org.apache.maven.plugins
maven-javadoc-plugin

org.exoplatform.services.portletcontainer.test
org.umlgraph.doclet.UmlGraphDoc
/home/alexey/java/eXoProjects/portlet-container/trunk/component/core/UmlGraph.jar
-views




































































Install dependency program:

sudo apt-get install graphviz

Maven command:

mvn site












PACKAGE org.exoplatform.services.portletcontainer.pci


1. views
2. inferrel and inferdep
3. inferrel, inferdep, operations and constructors




CLASS ActionInput

1. views
2. inferrel and inferdep

3. inferrel, inferdep, operations and constructors

CLASS Input

1. views
2. inferrel and inferdep
3. inferrel, inferdep, operations and constructors


http://java.dzone.com/articles/reverse-engineer-source-code-u

It works pretty good!!!

Documentation here

What Gets Drawn

-all
Same as -attributes -operations -visibility -types -enumerations -enumconstants
-attributes
Show class attributes (Java fields)
-commentname
Name the element using the text in the javadoc comment, instead of the name of its class.
-constructors
Show a class's constructors
-enumconstants
When showing enumerations, also show the values they can take.
-enumerations
Show enumarations as separate stereotyped primitive types.
-hide
Specify entities to hide from the graph. Matching is done using a non-anchored regular match. For instance, "-hide (Big|\.)Widget" would hide "com.foo.widgets.Widget" and "com.foo.widgets.BigWidget". Can also be used without arguments, in this case it will hide everything (useful in the context of views to selectively unhide some portions of the graph, see the view chapter for further details).
-operations
Show class operations (Java methods)
-qualify
Produce fully-qualified class names.
-types
Add type information to attributes and operations
-view
Specify the fully qualified name of a class that contains a view definition. Only the class diagram specified by this view will be generated.
See the views chapter for more details.
-views
Generate a class diagram for every view found in the source path.
-visibility
Adorn class elements according to their visibility (private, public, protected, package)


Relationship Inference

-collpackages
Specify the classes that will be treated as containers for one to many relationships when inference is enabled. Matching is done using a non-anchored regular match. Empty by default.
-inferdep
Try to automatically infer dependencies between classes by inspecting methods and fields. See the class diagram inference chapter for more details. Disabled by default.
-inferdepinpackage
Enable or disable dependency inference among classes in the same package. This option is disabled by default, because classes in the same package are supposed to be related anyway, and also because there's no working mechanism to actually detect all of these dependencies since imports are not required to use classes in the same package.
-inferdepvis
Specifies the lowest visibility level of elements used to infer dependencies among classes. Possible values are private, package, protected, public, in this order. The default value is private. Use higher levels to limit the number of inferred dependencies.
-inferrel
Try to automatically infer relationships between classes by inspecting field values. See the class diagram inference chapter for further details. Disabled by default.
-inferreltype
The type of relationship inferred when -inferrel is activated. Defaults to "navassoc" (see the class modelling chapter for a list of relationship types).
-useimports
Will also use imports to infer dependencies. Disabled by default, since it does not work properly if there are multiple classes in the same source file (will add dependencies to every class in the source file).










google codesearch ? pom.xml + UmlGraphDoc
google codesearch ? pom.xml + org.umlgraph.doclet.UmlGraphDoc

2 comments:

Anonymous said...

i am very much interested in your blog...... but i dont understand the message coz itz a russian i think.. but i like it... by http://neodrops.blogspot.com

Alexey Zavizionov said...

Updated with help information.

Sample of usage this plugin
here