JavaSkeleton

Description  Download  Running  Related software

Description

JavaSkeleton is a command line tool that builds a report about dependencies between java classes. It needs J2SE 1.4 or 1.3 with a JAXP compliant SAX parser for running.

The tool's job consists in first analyzing java classes from source files and then producing an XML document that reports the dependencies between the outer one classes. The structure of the XML document is given by this RELAX NG schema. An XSL style-sheet is also provided in order to produce an HTML report from the XML document. As an example of result, take a look at JavaSkeleton_1_0_skeleton, which has been obtained from the JavaSkeleton source files.

Dependencies are elaborated from class name references through declarations or statements (not in literals). In order to not have to do the whole job of a Java compiler, the tool makes some assumptions about naming : all class names - by speaking about classes, we include interfaces - are supposed to start with an upper case and all package, field and method names are supposed to start with a lower case. In the same way, a list of primary package identifier is used for control. The default list is (java, javax, org, net, com, edu). It may be enriched. All theses pseudo-rules allow some simplifications and make compiling more efficient. A warning is written out when a non respect of one of this rules can be detected.

For the predefined java.lang package and for some packages that some sources may reference in import-on-demand declarations (.*), the tool needs to obtain a list of outer class, as extra input. This extra input is provided through import files. An import file is an XML document that is in accordance with the same schema than the report document. The tool is also used to build import files. Import files for J2SE 1.4, SAX2 and DOM2 are provided.

JavaSkeleton is open source. It is developed as part of the xmloperator project and shares its license but is packaged and can be used independently from the other parts of the project.

Download

GRCDateExecutableSource
1002003-07-16jsk_1_0_0.zip (85Kb)jsk_1_0_0_src.zip (66Kb)

Running

The java class archive is javaSkeleton.jar. Its main class is org.xmloperator.java.skeleton.Compiler.

command line arguments
argumentmultiplicityaction
-v0..1verbose : each step will start with writing out a message.
-nw0..1no warning : no warning will be written out.
-ppi xxx0..nwill add xxx to the list of primary package identifier.
-import xxx.xml0..nwill import the xxx.xml file in order to be able to resolve some import-on-demand declarations.
-si0..1self import : will add a first compilation pass in order to be able to resolve some import-on-demand declarations that reference the analyzed packages.
-fi0..1for import : running purpose is building an import file, which will contain the package contents but no dependencies between classes.
-pu0..1package use : will consolidate the class dependencies at the package level.
-output xxx.xml1will use this pathname for report output.
xxx.java0..nwill analyze this java source file.
xxx.zip0..nwill analyze all the java source files that this archive contains.
<directory>0..nwill analyze all the java source files that this directory contains, recursively.
xxx.xml0..nwill merge this previously obtained skeleton.

As an example, the following command builds a skeleton.xml report file from the jsk_src.zip source archive file :

java -cp javaSkeleton.jar org.xmloperator.java.skeleton.Compiler -import import_j2se_1_4_java.xml -import import_xml_sax_2.xml -output skeleton.xml jsk_src.zip

Related software

You could be interested by the following tools, whose object is near that this one. Both of them analyze the compiled class files rather than the source files, which presents some advantages.


Java is a trademark of Sun Microsystems, Inc.
Last update : 2003-07-16 Copyright (c) 2000 - 2003 The_xmloperator_project