My Stuff

2010 Conferences

OSGi DevCon @ JAX London

February 23 - Keynote titled OSGi in the Enterprise: Agility, Modularity, and Architecture’s Paradox

EclipseCon

March 22 - 25 - Tutorial on Modular Architecture

Über Conf

June 14 - 17 - Sessions titled Turtles and Architecture and Patterns of Modular Architecture

Catalyst

July 26 - 30 - Two sessions on rich mobile applications and one on agile development. Half day tutorial on software process improvement.

Tweets @ Twitter

Apple's profits for its latest quarter are $1 billion. That's $1 billion per week, by the way. http://t.co/wE6RglA5 1 week ago

If you know JavaScript and HTML, you can crete your own custom widgets in iBooks Author. That's pretty cool…#Apple 2 weeks ago

High School Textbooks also available. Major publishers are on board. Several volumes available today…#Apple 2 weeks ago

#Apple announces iBooks Author for OS X and iBooks 2. Using author, you can create your own interactive books for iBooks. 2 weeks ago

Nice #HTML5 site (html5rocks.com). Check out the Interactive Presentation & HTML5 vs. native comparison (http://t.co/UFTuafAE) via @mahemoff 2 weeks ago

LinkedIn Profile

The opinions expressed on this site are my own, and not necessarily those of my employer.

New JarAnalyzer XSL

Filed Under Development, Java, Metrics, Platforms |  

JarAnalyzer has always had the ability to create a dot-compliant output file that could be used with GraphViz to generate a component diagram. In the past, this had always been done using the DOTSummary class. Unfortunately, this meant that if you wanted to generate output files in both xml and dot, you had to run JarAnalyzer twice. Now, thanks to a stylesheet that I graciously stole from JDepend and modified to work with JarAnalyzer, there’s a new way to generate a dot-compliant output file that is much nicer than what you’ll get when using DOTSummary. Plus, you only have to run JarAnalyzer once, then apply two stylesheets to the xml file generated to get both the html report and component diagram.

Old Component DiagramIn addition to being a bit more efficient, it’s also cleaner. The old component diagram is shown at left on top, while the new component diagram using the stylesheet is shown at bottom left. The stylesheet avoids the confusion where DOTSummary changed the name of the .jar file and stripped off the .jar extension. As seen on the diagrams, a .jar file named bill.jar now actually appears as bill.jar on the component diagram, not bill.

New Component DiagramThe new stylesheet isn’t part of the JarAnalyzer distribution…yet, but you can download the stylesheet. To run JarAnalyzer as part of your Ant build script and get both the html and component diagram output, drop the stylesheet in the directory containing JarAnalyzer (the same directory with jaranalyzer.xsl), and modify your build script similar to the following (you need GraphViz installed to run dot):

<target name="dotanalyzerapp.new" depends="bundle">
   <taskdef name="jaranalyzer"
             classname="com.kirkk.analyzer.textui.JarAnalyzerTask">
       <classpath>
           <pathelement path="${buildlib}/jaranalyzer-1.2.jar"/>
           <pathelement path="${buildlib}/lib/bcel-5.2.jar"/>
           <pathelement path="${buildlib}/lib/jakarta-regexp-1.3.jar"/>
           <pathelement path="${buildlib}/lib"/>
       </classpath>

   </taskdef>

   <jaranalyzer srcdir="${buildstats}"
                destfile="${buildstats}/appdependencies.xml"
                summaryclass="com.kirkk.analyzer.textui.XMLUISummary"/>

   <style in="${buildstats}/appdependencies.xml"
                    out="${buildstats}/appdependencies.html"
                    style="${buildlib}/jaranalyzer.xsl">
   </style>

   <style in="${buildstats}/appdependencies.xml"
                    out="${buildstats}/appdependencies.grph"
                    style="${buildlib}/jaranalyzer2dot.xsl">
   </style>

   <exec executable="dot" >
       <arg line="-Tpng -Nshape=box -Nfontsize=30 -Nwidth=1.5
              -Nheight=1.25<br></arg> ./buildstats/appdependencies.grph
              -o ./buildstats/appdependencies.png">
   </exec>

 </target>

Comments

One Response to “New JarAnalyzer XSL”

  1. JarAnalyzer in Google Code : Software & Technology @kirkk.com on November 20th, 2008 5:01 pm

    [...] JarAnalyzer now has it’s own Google Code location. You can browse the source code online, check the source code out, and do all of the other exciting things that you can do with a subversion repository. The source in the google code repository is the same as can be found at the JarAnalyzer homepage (which is also where the binary is still found), except that the Google Code location also contains the JarAnalyzer XSLT. [...]

Leave a Reply