Added all important commandline options. Updated documentation.
[javainspect.git] / doc / index.html
index f011ad8..a9ae900 100644 (file)
@@ -2,7 +2,7 @@
 <html lang="en">
 <head>
 <title>JavaInspect - Utility to visualize java software</title>
-<!-- 2017-11-29 Wed 23:51 -->
+<!-- 2017-12-26 Tue 23:30 -->
 <meta charset="utf-8">
 <meta name="viewport" content="width=device-width, initial-scale=1">
 <meta name="generator" content="Org-mode">
@@ -206,10 +206,10 @@ it under the terms of version 3 of the <a href="https://www.gnu.org/licenses/lgp
 License</a> or later as published by the Free Software Foundation.
 </li>
 
-<li>Program author:
+<li>Program authors:
 <ul class="org-ul">
 <li>Svjatoslav Agejenko
-</li>
+<ul class="org-ul">
 <li>Homepage: <a href="http://svjatoslav.eu">http://svjatoslav.eu</a>
 </li>
 <li>Email: <a href="mailto://svjatoslav@svjatoslav.eu">mailto://svjatoslav@svjatoslav.eu</a>
@@ -217,6 +217,16 @@ License</a> or later as published by the Free Software Foundation.
 </ul>
 </li>
 
+<li>Tony Bargnesi
+<ul class="org-ul">
+<li>GitHub fork for the project:
+<a href="https://github.com/abargnesi/javainspect">https://github.com/abargnesi/javainspect</a>
+</li>
+</ul>
+</li>
+</ul>
+</li>
+
 <li><a href="http://www.svjatoslav.eu/programs.jsp">other applications hosted at svjatoslav.eu</a>
 </li>
 </ul>
@@ -230,38 +240,27 @@ automatically visualizing its structure.
 </p>
 
 <p>
-JavaInspect is a Java library that primarily uses Java reflection to
-discover and visualize any part of Java program provided that
-classes to be visualised are available in the classpath.
+JavaInspect is a Java library/commandline utility that primarily uses
+Java reflection to discover and visualize any part of Java program.
 </p>
 
 <p>
 JavaInspect currently has no GUI, configuration files, embedded
-scripting support, direct Maven or Ant integration. The only way to
-instuct Javainspect what to do is by using its Java API.
+scripting support, direct Maven or Ant integration. See <a href="#sec-3">usage</a> to learn
+how to instuct Javainspect what to do.
 </p>
 
-<p>
-To get JavaInspect into same classpath with your projecs I so far came
-up with 2 solutions:
-</p>
-
-<ol class="org-ol">
-<li>Add JavaInspect library in your project as a dependency.
-</li>
-<li>Create new Java project for the purpose visualizing your other
-projects and include JavaInspect and your projecs binary artifacts
-(Jar's) into new project classpath. Built binary Jar's (with no
-source code) are sufficient because JavaInspect operates via
-reflection.
-</li>
-</ol>
-
 <p>
 After discovering application structure and optionally filtering out
 unimportant parts, JavaInspect produces GraphViz dot file that
 describes data to be visualized. Then launches GraphViz to generate
-bitmap graph in PNG format. By default on your Desktop directory.
+bitmap graph in PNG or SVG format.
+</p>
+
+<p>
+By default on your Desktop directory when operated in library mode or
+current working directory when operated as standalone commandline
+application.
 </p>
 
 <p>
@@ -300,12 +299,93 @@ Graph legend:
 </div>
 
 <div id="outline-container-sec-3" class="outline-2">
-<h2 id="sec-3"><span class="section-number-2">3</span> Usage</h2>
+<h2 id="sec-3"><a id="ID-2ad2889e-6c95-4662-b3f4-2c341fc74522" name="ID-2ad2889e-6c95-4662-b3f4-2c341fc74522"></a><span class="section-number-2">3</span> Usage</h2>
 <div class="outline-text-2" id="text-3">
 <p>
-Currently the only way to control JavaInspect is by using Java
-API. Simple Java based control/configuration code needs to be written
-for each project. I usually put such code into directories devoted for
+JavaInspect can be controlled in 2 different ways:
+</p>
+<ul class="org-ul">
+<li><a href="#sec-3-1">as standalone commandline utility</a>
+</li>
+<li><a href="#sec-3-2">as embedded Java library via Java API</a>
+</li>
+</ul>
+</div>
+
+<div id="outline-container-sec-3-1" class="outline-3">
+<h3 id="sec-3-1"><a id="ID-acf1896a-74b4-4914-acf6-a77075e07f25" name="ID-acf1896a-74b4-4914-acf6-a77075e07f25"></a><span class="section-number-3">3.1</span> usage as commandline utility</h3>
+<div class="outline-text-3" id="text-3-1">
+<p>
+To enable commandline support, (study and) execute script:
+</p>
+<pre class="example">
+commandline launcher/install
+</pre>
+
+<p>
+Warning: It was tested only on Debian Stretch linux.
+</p>
+
+<p>
+Available commandline arguments:
+</p>
+<p class="verse">
+-j (existing files)&#x2026;<br >
+&#xa0;&#xa0;&#xa0;&#xa0;JAR file(s) to render.<br >
+<br >
+-n (mandatory, string)<br >
+&#xa0;&#xa0;&#xa0;&#xa0;Graph name.<br >
+<br >
+&#x2013;debug<br >
+&#xa0;&#xa0;&#xa0;&#xa0;Show debug info.<br >
+<br >
+-k<br >
+&#xa0;&#xa0;&#xa0;&#xa0;Keep dot file.<br >
+<br >
+-h<br >
+&#xa0;&#xa0;&#xa0;&#xa0;Hide orphaned classes.<br >
+<br >
+-w (one to many strings)&#x2026;<br >
+&#xa0;&#xa0;&#xa0;&#xa0;Whitelist glob(s).<br >
+<br >
+-b (one to many strings)&#x2026;<br >
+&#xa0;&#xa0;&#xa0;&#xa0;Blacklist glob(s).<br >
+<br >
+-d (existingdirectory)<br >
+&#xa0;&#xa0;&#xa0;&#xa0;Target directory. Default is current directory.<br >
+<br >
+-t (options: png, svg)<br >
+&#xa0;&#xa0;&#xa0;&#xa0;Target image type. Default is: svg.<br >
+</p>
+</div>
+</div>
+<div id="outline-container-sec-3-2" class="outline-3">
+<h3 id="sec-3-2"><a id="ID-bbeeffc8-3767-440d-8d93-ec9124dd60ee" name="ID-bbeeffc8-3767-440d-8d93-ec9124dd60ee"></a><span class="section-number-3">3.2</span> usage via Java API</h3>
+<div class="outline-text-3" id="text-3-2">
+<p>
+Requires that classes to be visualised are available in the classpath.
+</p>
+
+<p>
+To get JavaInspect into same classpath with your projecs I so far came
+up with 2 solutions:
+</p>
+
+<ol class="org-ol">
+<li>Add JavaInspect library in your project as a dependency.
+</li>
+
+<li>Create new Java project for the purpose visualizing your other
+projects and include JavaInspect and your projecs binary artifacts
+(Jar's) into new project classpath. Built binary Jar's (with no
+source code) are sufficient because JavaInspect operates via
+reflection.
+</li>
+</ol>
+
+<p>
+Simple Java based control/configuration code needs to be written for
+each project. I usually put such code into directories devoted for
 JUnit tests. Because it needs not to be compiled/embedded into final
 product or project artifact I'm just willing to visualize.
 </p>
@@ -352,9 +432,9 @@ files. (Default is user desktop directory)
 </div>
 
 
-<div id="outline-container-sec-3-1" class="outline-3">
-<h3 id="sec-3-1"><span class="section-number-3">3.1</span> example 1: individually picked objects</h3>
-<div class="outline-text-3" id="text-3-1">
+<div id="outline-container-sec-3-2-1" class="outline-4">
+<h4 id="sec-3-2-1"><span class="section-number-4">3.2.1</span> example 1: individually picked objects</h4>
+<div class="outline-text-4" id="text-3-2-1">
 <p>
 This example demonstrates generating of class graph from hand picked
 classes and visualizing GraphViz itself.
@@ -404,9 +484,9 @@ Result:
 </div>
 </div>
 
-<div id="outline-container-sec-3-2" class="outline-3">
-<h3 id="sec-3-2"><span class="section-number-3">3.2</span> example 2: scan java code, apply filters</h3>
-<div class="outline-text-3" id="text-3-2">
+<div id="outline-container-sec-3-2-2" class="outline-4">
+<h4 id="sec-3-2-2"><span class="section-number-4">3.2.2</span> example 2: scan java code, apply filters</h4>
+<div class="outline-text-4" id="text-3-2-2">
 <div class="org-src-container">
 
 <pre class="src src-java"><span style="color: #8C8C8C;">// </span><span style="color: #8C8C8C;">Create graph</span>
@@ -437,9 +517,9 @@ Result:
 </div>
 </div>
 
-<div id="outline-container-sec-3-3" class="outline-3">
-<h3 id="sec-3-3"><span class="section-number-3">3.3</span> example 3: GraphViz embedded in another project</h3>
-<div class="outline-text-3" id="text-3-3">
+<div id="outline-container-sec-3-2-3" class="outline-4">
+<h4 id="sec-3-2-3"><span class="section-number-4">3.2.3</span> example 3: GraphViz embedded in another project</h4>
+<div class="outline-text-4" id="text-3-2-3">
 <ol class="org-ol">
 <li>Download project Sixth <a href="http://www2.svjatoslav.eu/gitweb/?p=sixth.git;a=snapshot;h=HEAD;sf=tgz">code snapshot</a>.
 </li>
@@ -448,11 +528,10 @@ Result:
 </ol>
 </div>
 </div>
-</div>
 
-<div id="outline-container-sec-4" class="outline-2">
-<h2 id="sec-4"><span class="section-number-2">4</span> Embedding JavaInspect in your Maven project</h2>
-<div class="outline-text-2" id="text-4">
+<div id="outline-container-sec-3-2-4" class="outline-4">
+<h4 id="sec-3-2-4"><span class="section-number-4">3.2.4</span> Embedding JavaInspect in your Maven project</h4>
+<div class="outline-text-4" id="text-3-2-4">
 <p>
 Declare JavaInspect as dependency:
 </p>
@@ -489,10 +568,12 @@ Add Maven repository to retrieve artifact from:
 </div>
 </div>
 </div>
+</div>
+</div>
 
-<div id="outline-container-sec-5" class="outline-2">
-<h2 id="sec-5"><span class="section-number-2">5</span> Requirements</h2>
-<div class="outline-text-2" id="text-5">
+<div id="outline-container-sec-4" class="outline-2">
+<h2 id="sec-4"><span class="section-number-2">4</span> Requirements</h2>
+<div class="outline-text-2" id="text-4">
 <p>
 <a href="http://www.graphviz.org/">GraphViz</a> - shall be installed on the computer.
 </p>
@@ -507,38 +588,121 @@ On Ubuntu/Debian use:
 </div>
 </div>
 </div>
-<div id="outline-container-sec-6" class="outline-2">
-<h2 id="sec-6"><span class="section-number-2">6</span> TO DO</h2>
-<div class="outline-text-2" id="text-6">
+<div id="outline-container-sec-5" class="outline-2">
+<h2 id="sec-5"><span class="section-number-2">5</span> TO DO</h2>
+<div class="outline-text-2" id="text-5">
+<p>
+Note: Because this is side project (and I have many of them) I can
+only contribute few hours per year at average. Any help is welcome.  A
+LOT of cool ideas could be implemented. For intstance:
+</p>
+
+<ul class="org-ul">
+<li>BUG: Should not hide references if there are too many of them to
+classes if referring classes are not visible anyway because of
+blacklist/whitelist rules. Basically reference counting should
+exclude not visible classes.
+</li>
+
+<li>BUG: Orphaned class removal does not work always. There are many
+bugs and corner cases to find and fix still.
+</li>
+
+<li>BUG: Code is not very readable. Document and refactor for better
+maintainability.
+</li>
+
+<li>FEATURE: Create installable DEB package.
+<ul class="org-ul">
+<li>Submit it to some Debian developer for integration or become
+Debian package maintainer.
+</li>
+</ul>
+</li>
+
+<li>FEATURE: Make it modular. That is: central part, an application
+model could be standalone and serializable.
+
 <ul class="org-ul">
-<li>BUG: Should not hide references if there are too many of them to classes if
-referring classes are not visible anyway because of blacklist/whitelist rules.
-Basically reference counting should exclude not visible classes.
+<li>There could be multiple ways to acquire model:
+<ul class="org-ul">
+<li>By introspecting application via Java reflections (current mode
+of operation).
+</li>
+<li>By parsing java source. (unfinished)
+</li>
+</ul>
+</li>
+
+<li>There could be ways to manipulate model:
+<ul class="org-ul">
+<li>Store/load/compare.
+</li>
+<li>Trim uninteresting parts.
+</li>
+<li>Highlight important parts.
+</li>
+</ul>
+</li>
+
+<li>There could be multiple ways to render model:
+<ul class="org-ul">
+<li>PNG/SVG (currently implemented)
+</li>
+<li>PlantUML (TODO)
+</li>
+<li>Interactive 3D visualization (TODO)
+</li>
+</ul>
 </li>
-<li>FEATURE: integarte with <a href="http://plantuml.com/class-diagram">PlantUML</a>.
+</ul>
 </li>
-<li>FEATURE: add dark theme
+
+<li>FEATURE: Replace internal java parser in package
+eu.svjatoslav.inspector.java.methods with: <a href="https://javaparser.org/">https://javaparser.org/</a>
 </li>
-<li>FEATURE: sort Class fields by alphabet
+
+<li>FEATURE: Integarte with <a href="http://plantuml.com/class-diagram">PlantUML</a>.
 </li>
-<li>FEATURE: visualize also concrete field values so it could be used as
-ultra cool runtime logging framework
+
+<li>FEATURE: Add dark theme for generated graphs.
 </li>
-<li>FEATURE: possibility to visualize structure and data from JVM
-snapshot
+
+<li>FEATURE: Sort Class fields by alphabet.
+</li>
+
+<li>FEATURE: Visualize also concrete field values so it could be used as
+ultra cool runtime logging/debugging framework.
 </li>
-<li>FEATURE: possibility to attach to remote process to visualize
+
+<li>FEATURE: Possibility to visualize structure and data from JVM
+snapshot.
+</li>
+
+<li>FEATURE: Possibility to attach to remote process to visualize
 data/structure using JVM debug port and mechanism.
 </li>
-<li>FEATURE: possibility to attach to JVM using JVM agent
+
+<li>FEATURE: Possibility to attach to JVM using JVM agent.
+</li>
+
+<li>FEATURE: Possibility to inspect graphs in 3D using <a href="http://www2.svjatoslav.eu/gitbrowse/sixth-3d/doc/index.html">Sixth 3D engine</a>.
 </li>
-<li>FEATURE: possibility to script javainspect behavior
+
+<li>FEATURE: Possibility to select classes/fields/values to be
+visualized in some graph query language. For greater flexibility in
+comparison to currently supported glob syntax.
 </li>
-<li>FEATURE: possibility to select classes/fields/values to be
-visualized in SQL like syntax
+
+<li>FEATURE: Add option to control JavaInspect via JSON or XML config
+file. For example different graphs for given project could be
+defined once in plain text config, possibly with the aid of some
+interactive utility. Then defined graphs could be updated as part of
+project build or release process.
 </li>
-<li>FEATURE: configurable maven plugin to generate graphs as part of the
-project build/release process
+
+<li>FEATURE: Configurable maven plugin to generate graphs as part of the
+project build/release process.
 </li>
 </ul>
 </div>
@@ -550,21 +714,19 @@ project build/release process
 <li><a href="#sec-2">2. Example graphs</a></li>
 <li><a href="#sec-3">3. Usage</a>
 <ul class="nav">
-<li><a href="#sec-3-1">3.1. example 1: individually picked objects</a></li>
-<li><a href="#sec-3-2">3.2. example 2: scan java code, apply filters</a></li>
-<li><a href="#sec-3-3">3.3. example 3: GraphViz embedded in another project</a></li>
+<li><a href="#sec-3-1">3.1. usage as commandline utility</a></li>
+<li><a href="#sec-3-2">3.2. usage via Java API</a></li>
 </ul>
 </li>
-<li><a href="#sec-4">4. Embedding JavaInspect in your Maven project</a></li>
-<li><a href="#sec-5">5. Requirements</a></li>
-<li><a href="#sec-6">6. TO DO</a></li>
+<li><a href="#sec-4">4. Requirements</a></li>
+<li><a href="#sec-5">5. TO DO</a></li>
 </ul>
 </div>
 </nav>
 </div></div></div>
 <footer id="postamble" class="">
 <div><p class="author">Author: Svjatoslav Agejenko</p>
-<p class="date">Created: 2017-11-29 Wed 23:51</p>
+<p class="date">Created: 2017-12-26 Tue 23:30</p>
 <p class="creator"><a href="http://www.gnu.org/software/emacs/">Emacs</a> 25.1.1 (<a href="http://orgmode.org">Org-mode</a> 8.2.10)</p>
 </div>
 </footer>