Class ClassDependencies

java.lang.Object
eu.bandm.tools.util3.ClassDependencies

public class ClassDependencies extends Object
// FIXME tree/subset pairs necessary !?!? Classname stored in .class ? // FIXME give filenames as CLI-parameters !? // FIXME give first/latest generation as CLI-parameters !? FIXME DOC
  • Field Details

    • ALLPACKAGES

      public static final String ALLPACKAGES
      See Also:
    • INNER_CLASS_SEPARATOR

      public static final String INNER_CLASS_SEPARATOR
      See Also:
    • FILENAME_DIAGRAM

      public static final String FILENAME_DIAGRAM
      See Also:
    • FILENAME_ANALYSES

      public static final String FILENAME_ANALYSES
      See Also:
    • TOOL_UMOD

      public static final String TOOL_UMOD
      See Also:
    • TOOL_TDOM_BOOT

      public static final String TOOL_TDOM_BOOT
      See Also:
    • TOOL_TDOM

      public static final String TOOL_TDOM
      See Also:
    • GENERATOR_REPRESENTATIVE

      public static final String GENERATOR_REPRESENTATIVE
      See Also:
    • between_lljava_live_BOOT_and_lljava_live

      public static final String[] between_lljava_live_BOOT_and_lljava_live
      HACK FIXME RAUS ! According to Makefile as of 20240124
    • uses

      protected Multimap<String,String> uses
      Maps a calling class to a called class.
    • package2package

      final Multimap<String,String> package2package
      Maps a calling package to a called package.
    • generatedBy

      protected Multimap<String,String> generatedBy
      Maps a class to its generator, as named in the annotation.
    • readsProperty

      final Multimap<String,String> readsProperty
      Maps a class to a read (Java system) property, as named in the annotation.
    • readsEnvironment

      final Multimap<String,String> readsEnvironment
      Maps a class to a read envirnonment variable, as named in the annotation.
    • cycleReasons

      protected Map<String,String> cycleReasons
      Maps a class to the given reason. All marked classes are in the keySet. Empty string is possible as value.
    • generations_early

      final Multimap<Integer,String> generations_early
      Maps a class to its early generation number.
    • generations_late

      final Multimap<Integer,String> generations_late
      Maps a class to its late generation number.
    • pwa

      Output to the generated xml file with tabular data.
    • cnum

      int cnum
      Number of current chapter in the XML analysis output.
    • bandmClasses

      public static final Predicate<String> bandmClasses
  • Constructor Details

    • ClassDependencies

      public ClassDependencies()
  • Method Details

    • chapter

      void chapter(PrintWriter pw, String s)
      Print the heading of a chapter in the XML analysis output. GLO IN cnum
    • printList

      void printList(PrintWriter pw, String indent, Collection<String> data)
      Print an alphabetically sorted list of qualified class names. Separate them by one blank or newline. Asserts to start and stop working at the beginning of a line.
    • formatNameColumn

      String formatNameColumn(String s)
      Bring the name of the classes into a field of fixed width for the leftmost column of the HTML output.
    • printTransPackage

      public void printTransPackage(Collection<String> pkg)
      Print a cycle between different packages (which can only be compiled by irregular compiler usage) and the class relations which cross package limits.
      Parameters:
      pkg - packages involved
    • collectClasses

      public void collectClasses(String[] roots, Predicate<String> filter) throws IOException, ClassNotFoundException
      Visit all files the names of which end with ".class" in the given directory trees and extracts info from their contents. Store the result in the global variables uses, generatedBy, readsEnvironment, readsProperty, and cycleReasons.
      Parameters:
      roots - list of pairs: each one directory of class files and one sub-directory, or »-«.
      filter - on the names of the classes to select the analysed classes.
      Throws:
      IOException
      ClassNotFoundException
    • adjustMetatoolsHacks_1

      public void adjustMetatoolsHacks_1()
      Break some bootstrap-cycles introduced by backward code-patching in the metatools make-based architecture. Assume that "generatedBy" is still relevant and has not yet been added to "uses" or "package2package", etc.
    • printUsageAndCycles

      void printUsageAndCycles()
      Execute analysis for cyclic imports between classes and packages. Print annotation information and the found cycles to the output file.
    • printProperties

      void printProperties()
      Prints reading of Java system properties and envirnonment variables the the analysis file.
    • makeGenerations

      void makeGenerations()
    • printInteractiveHTML

      void printInteractiveHTML() throws IOException
      Print the interactive import graph into a HTML table and install the necessary CSS and JS files.
      Throws:
      IOException
    • analyze

      public void analyze(String[] roots, Predicate<String> filter) throws IOException, ClassNotFoundException
      Make the analysis and print results to files.
      Parameters:
      roots - list of pairs: directories of class files and their sub-directories or »-«
      filter - on the names of the classes to select the analysed classes
      Throws:
      IOException
      ClassNotFoundException
    • main

      public static void main(String[] args) throws IOException, ClassNotFoundException
      Command line tool which analyses the relations between the class files contained in the given root directories. Generates two files with fixed names in the working directory, namely "classUsageAnalyses.xml" and "packageDependencyDiagram.html".

      Parameters:
      args - sequence of PAIRS of Strings. The first gives a top-of-classtree directory as it appears in a Java classpath. The second is "-" for "all files", or a subdirectory which further restricts the analyzed packages. Both use "/" as separator. ((FIXME auch Windows??))

      Example restricting the analysed source tree: bandm/tools/util3$ make run_ClassDependencies RUN_PARAMS="~/metatools/lib/classes eu/bandm/tools/util3"
      Example without restriction: bandm/tools/util3$ make run_ClassDependencies RUN_PARAMS="~/metatools/lib/classes -"

      Throws:
      IOException
      ClassNotFoundException