fixed broken links
[javainspect.git] / doc / index.html
1 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">\r
2 <html>\r
3 <head>\r
4 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">\r
5 <title>JavaInspect</title>\r
6 </head>\r
7 <body>\r
8         <h1>JavaInspect - Utility to visualize java software</h1>\r
9         <a\r
10                 href="http://www2.svjatoslav.eu/gitweb/?p=javainspect.git;a=snapshot;h=HEAD;sf=tgz">Download</a>\r
11         &nbsp;&nbsp;\r
12         <a\r
13                 href="http://www2.svjatoslav.eu/gitbrowse/javainspect/doc/index.html">Online\r
14                 homepage</a> &nbsp;&nbsp;\r
15         <a href="http://svjatoslav.eu/programs.jsp">Other applications\r
16                 hosted on svjatoslav.eu</a>\r
17         <pre>\r
18 <b>Program author:</b>\r
19     Svjatoslav Agejenko\r
20     Homepage: <a href="http://svjatoslav.eu">http://svjatoslav.eu</a>\r
21     Email: <a href="mailto:svjatoslav@svjatoslav.eu">svjatoslav@svjatoslav.eu</a>\r
22 \r
23 This software is distributed under <a href="http://www.gnu.org/copyleft/lesser.html">GNU LESSER GENERAL PUBLIC LICENSE version 3 or later</a>.\r
24 \r
25 </pre>\r
26 \r
27         <h2>General</h2>\r
28 \r
29         Goal: simplify/speed up understanding the computer program code by\r
30         automatically visualizing its structure.\r
31 \r
32         <br/><br/>\r
33         JavaInspect is a Java library that you can embed into your Java project\r
34         with a few lines of Maven configuration and then visualize any part of\r
35         your Java program structure with few simple JavaInspect API calls at\r
36         application runtime.\r
37 \r
38         <br />\r
39         <br /> JavaInspect uses Java reflection to discover class relations and\r
40         structure and produces GraphViz dot file that describes your\r
41         application. Then launches GraphViz to generate bitmap graph in PNG\r
42         format on your Desktop directory.\r
43 \r
44 \r
45         <h2>Current status</h2>\r
46 \r
47         This is simple utility, quickly written. Tested on Linux (can be\r
48         relatively simply ported to other operating systems too). So far I used\r
49         it for my own needs. There might be bugs and missing features. Feedback\r
50         and code contributions are welcome.\r
51 \r
52 \r
53         <h2>Example graphs</h2>\r
54 \r
55         Example visualization of\r
56         <a href="http://www2.svjatoslav.eu/gitbrowse/sixth/doc/">Sixth</a>\r
57         project:\r
58         <a\r
59                 href="http://www2.svjatoslav.eu/projects/sixth/codegraphs/">architecture\r
60                 graphs</a>\r
61 \r
62         <br />\r
63         <br /> A very simple example:\r
64         <br />\r
65         <a href="example.png"><img src="example.resized.png" /></a>\r
66 \r
67         <br /> Graph legend:\r
68         <br />\r
69         <img src="legend.png" />\r
70 \r
71 \r
72         <h2>Usage example 1</h2>\r
73 \r
74 <pre>\r
75 <code>\r
76                 /*\r
77                  * This example demonstrates generating of class graph from hand picked\r
78                  * classes.\r
79                  */\r
80 \r
81                 // Create graph\r
82                 final ClassGraph graph = new ClassGraph();\r
83 \r
84                 // While classes and objects can be immediately passed to ClassGraph\r
85                 // constructor as arguments, it is also possible to add then one by one\r
86                 // as in the following example.\r
87 \r
88                 // Add some object to the graph.\r
89                 graph.addObject(graph);\r
90 \r
91                 // Add some class to the graph.\r
92                 graph.addClass(Utils.class);\r
93 \r
94                 // Produce bitmap image titled "JavaInspect.png" to the user Desktop\r
95                 // directory and keep intermediary GraphViz DOT file for reference.\r
96                 graph.generateGraph("JavaInspect", true);\r
97 </code>\r
98 \r
99 \r
100 Result:\r
101     Generated DOT file: <a href="JavaInspect.dot">JavaInspect.dot</a>\r
102     Generated PNG image: <a href="JavaInspect.png">JavaInspect.png</a>\r
103 \r
104 </pre>\r
105 \r
106 \r
107         <h2>Usage example 2</h2>\r
108 \r
109 <pre>\r
110 <code>\r
111                 // Recursively scan current directory for Java source code and attempt\r
112                 // to detect class names from there to be added to the graph.\r
113                 graph.addProject(".");\r
114 \r
115                 // Blacklist example classes from being shown on the graph\r
116                 graph.getFilter().blacklistClassPattern(\r
117                                 "eu.svjatoslav.inspector.java.structure.example.*");\r
118 \r
119                 // do not show single classes with no relationships on the graph\r
120                 graph.hideOrphanedClasses();\r
121 \r
122                 // Produce bitmap image titled "JavaInspect full project.png" to the\r
123                 // user Desktop directory.\r
124                 graph.generateGraph("JavaInspect full project");\r
125 </code>\r
126 \r
127 \r
128 Result:\r
129     Generated PNG image: <a href="JavaInspect full project.png">JavaInspect full project.png</a>\r
130 \r
131 </pre>\r
132 \r
133 \r
134 \r
135         <h2>Embedding JavaInspect in your project</h2>\r
136         <pre>\r
137 \r
138 Declare JavaInspect as dependency:\r
139 \r
140     &lt;dependencies&gt;\r
141 \r
142         ...\r
143 \r
144         &lt;dependency&gt;\r
145             &lt;groupId&gt;eu.svjatoslav&lt;/groupId&gt;\r
146             &lt;artifactId&gt;javainspect&lt;/artifactId&gt;\r
147             &lt;version&gt;1.3&lt;/version&gt;\r
148         &lt;/dependency&gt;\r
149 \r
150     &lt;/dependencies&gt;\r
151 \r
152 \r
153 \r
154 Add Maven repository to retrieve artifact from:\r
155 \r
156     &lt;repositories&gt;\r
157         &lt;repository&gt;\r
158             &lt;id&gt;svjatoslav.eu&lt;/id&gt;\r
159             &lt;name&gt;Svjatoslav repository&lt;/name&gt;\r
160             &lt;url&gt;http://www2.svjatoslav.eu/maven/&lt;/url&gt;\r
161         &lt;/repository&gt;\r
162     &lt;/repositories&gt;\r
163 </pre>\r
164 \r
165 \r
166 \r
167 \r
168         <h2>Requirements</h2>\r
169 \r
170         <br>\r
171         <a href="http://www.graphviz.org/">GraphViz</a> - shall be installed on\r
172         the computer.\r
173 \r
174 \r
175 </body>\r
176 </html>\r