org.vizzini.tool.dependencyanalyzer
Class DependencyAnalyzer

java.lang.Object
  extended by org.vizzini.tool.dependencyanalyzer.DependencyAnalyzer

public class DependencyAnalyzer
extends Object

Provides a tool for analyzing package dependences.

Since:
v0.3
Version:
v0.3
Author:
Jeffrey M. Thompson

Constructor Summary
DependencyAnalyzer(String baseDirectory)
          Construct this object.
DependencyAnalyzer(String baseDirectory, String basePackageDirectory)
          Construct this object.
DependencyAnalyzer(String baseDirectory, String basePackageDirectory, boolean isHighDetail)
          Construct this object.
 
Method Summary
 void analyze()
          Analyze package dependencies.
protected  boolean contains(String content, String pattern)
          Return true if the file at the given URL contains the given pattern.
protected  String createDotString()
          Create a dot string from the previously completed analysis.
protected  Map filter(Map packageToDependencies)
          Filter the given dependency map to the correct level of detail.
 String getBaseDirectory()
           
 String getBasePackage()
           
 String getBasePackageDirectory()
           
protected  Set getDependencySetFor(Map packageToDependencies, String aPackage)
          Return the list of packages upon which the given pacakge depends.
protected  Set getDependencySetFor(String aPackage)
          Return the list of packages upon which the given pacakge depends.
 Set getPackages()
           
 Map getPackageToDependencies()
           
 Map getPackageToUrl()
           
 boolean isHighDetail()
           
protected  boolean isPackageDependentOn(String aPackage, String otherPackage)
          Return true if aPackage is dependent upon other package.
static void main(String[] args)
          Application method.
static void produceDependencyGraph(String baseDirectory, String basePackageDirectory, boolean isHighDetail)
          Process a package directory to produce a dependency graph.
protected  String reducePackage(String aPackage, int packageDepth)
          Reduce the given package name to the given package depth.
 void writeDotFile(File file)
          Write the dot string to the given file.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DependencyAnalyzer

public DependencyAnalyzer(String baseDirectory)
Construct this object.

Since:
v0.3

DependencyAnalyzer

public DependencyAnalyzer(String baseDirectory,
                          String basePackageDirectory)
Construct this object.

Since:
v0.3

DependencyAnalyzer

public DependencyAnalyzer(String baseDirectory,
                          String basePackageDirectory,
                          boolean isHighDetail)
Construct this object.

Since:
v0.3
Method Detail

main

public static final void main(String[] args)
                       throws IOException
Application method. Arguments:
  1. baseDirectory (example: /Users/jthomp/Documents/JavaProjects2/projects/vizzini/src/, default: System.getProperty("user.dir") + "/src")
  2. basePackageDirectory (example: org/vizzini)
System properties:

Throws:
IOException
Since:
v0.3

produceDependencyGraph

public static void produceDependencyGraph(String baseDirectory,
                                          String basePackageDirectory,
                                          boolean isHighDetail)
                                   throws IOException
Process a package directory to produce a dependency graph.

Parameters:
baseDirectory - Base directory (example: /Users/jthomp/Documents/JavaProjects2/projects/vizzini/src/).
basePackageDirectory - Base package directory (example: org/vizzini/game).
Throws:
IOException
Since:
v0.3

analyze

public void analyze()
Analyze package dependencies.

Since:
v0.3

getBaseDirectory

public String getBaseDirectory()
Returns:
Return baseDirectory.

getBasePackage

public String getBasePackage()
Returns:
Return basePackage.

getBasePackageDirectory

public String getBasePackageDirectory()
Returns:
Return basePackageDirectory.

getPackages

public Set getPackages()
Returns:
Return packages.

getPackageToDependencies

public Map getPackageToDependencies()
Returns:
Return packageToDependencies.

getPackageToUrl

public Map getPackageToUrl()
Returns:
Return packageToUrl.

isHighDetail

public boolean isHighDetail()
Returns:
Return isHighDetail.

writeDotFile

public void writeDotFile(File file)
                  throws IOException
Write the dot string to the given file.

Parameters:
file - Output file.
Throws:
IOException
Since:
v0.3

contains

protected boolean contains(String content,
                           String pattern)
Return true if the file at the given URL contains the given pattern.

Parameters:
url - File URL.
pattern - Pattern.
Since:
v0.3

createDotString

protected String createDotString()
Create a dot string from the previously completed analysis.

Since:
v0.3

filter

protected Map filter(Map packageToDependencies)
Filter the given dependency map to the correct level of detail.

Parameters:
packageToDependencies - Packages to dependencies map.
Since:
v0.3

getDependencySetFor

protected Set getDependencySetFor(String aPackage)
Return the list of packages upon which the given pacakge depends.

Parameters:
aPackage - Subject package.
Since:
v0.3

getDependencySetFor

protected Set getDependencySetFor(Map packageToDependencies,
                                  String aPackage)
Return the list of packages upon which the given pacakge depends.

Parameters:
aPackage - Subject package.
Since:
v0.3

isPackageDependentOn

protected boolean isPackageDependentOn(String aPackage,
                                       String otherPackage)
Return true if aPackage is dependent upon other package.

Parameters:
aPackage - Subject package.
otherPackage - Candidate dependency package.
Since:
v0.3

reducePackage

protected String reducePackage(String aPackage,
                               int packageDepth)
Reduce the given package name to the given package depth.

Parameters:
aPackage - Package name.
packageDepth - Desired package depth.
Since:
v0.3


Copyright © 2007 Vizzini.org. All Rights Reserved. 2007.12.25.03.00.02