wt.tools.xref
Class pdl

java.lang.Object
  extended bywt.tools.xref.pdl
All Implemented Interfaces:
ProcessFileInterface
Direct Known Subclasses:
pdl.Phase1, pdl.Phase2

class pdl
extends Object
implements ProcessFileInterface

This class creates a Package Dependency List in a particular codebase Two inner classes, Phase1 and Phase2 are used to encapsulate the functionality required by two distinct phases. TO DO: From Ben Grommes: Need to add code that watches for use of the instanceof operator in the bytecode as another source of class/package dependency information. DONE! From Mike Murray: The next helpful step would be to see what kind of package layering there is. (I know it is currently one big ball of circular dependencies.) Maybe it would be helpful to identify what packages each package is not directly, or indirectly, depend on. :o) More seriously, it might be informative to see the list of all indirect dependencies also. That would be quite telling regarding the ball that we have created. From Tim David: I would like a feature so I could see just the other packages a specific Windchill package is dependent upon, instead of the classes. This would be useful in creating package diagrams for Rose. Kevin Hedrick: It would be nice to see specific classes in the left hand pane, and it would also be nice to be able to click on any class in the right hand pane. In any case, I have been thinking that we should use a tool like this to assign each class a number. Each class gets 1 point for all of its dependent classes, and 1 point for each of its dependent classes and so on- like a pyrmid scheme. Then we have a pretty concrete way of knowing how risky a change is. I responded to Kevin, suggesting a 3-pane Javadoc 1.2 like display with 1) packages in the upper left 2) classes/interfaces for package in lower left 3) dependent classes for selected class in main pane


Nested Class Summary
(package private)  class pdl.Phase1
          In phase 1 we simply go through the entire codebase, reading all of the .class files to determine whether to add each class into the class list or the interface list.
(package private)  class pdl.Phase2
          In phase 2 we go through the entire codebase again and get the dependent classes for each class and store this information in a SimplePackage object.
 
Field Summary
(package private) static Vector d_baseTypesList
          This list contains the name of all the base data types and is used to skip these types when they are encountered in the Phase2.ProcessFile() method.
(package private) static Hashtable d_classDeps
          This contains is used to track dependencies between classes.
(package private) static Vector d_classList
           
(package private)  String d_currentPackageName
          This field is used by multiple methods in this class.
(package private) static boolean d_includeWindchillClassesOnly
           
(package private) static Hashtable d_interfaceDeps
          This contains is used to track dependencies between interfaces The KEY is an interfaceSpec, the VALUE is an InterfaceDeps object.
(package private) static Vector d_interfaceList
           
(package private) static String d_outputDirectory
           
(package private) static Hashtable d_packages
           
(package private) static String d_startingDirectory
           
 
Constructor Summary
pdl()
           
 
Method Summary
(package private)  void addToMasterList(ClassFile cf, String classSpec)
          This convenience method checks to see if the current class is an INTERFACE or a CLASS and then adds it to the appropriate Vector.
(package private)  void deserialize()
           
(package private)  void directoryCheck(String dirName)
           
 boolean directoryNameOk(String directoryName)
          Make sure the user specifies a directory in the Windchill codebase at the wt level or below
(package private)  void displayClassDeps(PrintWriter pw, String classSpec)
          This method locates the specified classSpec in d_classDeps and recurses 'upward' through the inheritance hierarchy all the way to java.lang.Object, displaying each class along the way.
(package private)  void displayInterfaceDeps(PrintWriter pw, String interfaceSpec)
          This method locates the specified interfaceSpec in d_interfaceDeps and recurses 'upward' through the inheritance hierarchy displaying each interface along the way.
 boolean fileTypeOk(String fileName)
          This method acts like a filter so that only .class files are processed.
(package private)  void fillBaseTypesList()
           
static void main(String[] args)
           
(package private)  void noneMsg(PrintWriter pw, String title, String noneMsg)
          This is a simple convenience method used by summary().
(package private)  void processCommandLineArgs(String[] args)
           
 void processDirectory(String directoryName)
          output the name of the package
 void processFile(String fileName)
          This method is defined here to meet the requirements of the ProcessFileInterface interface BUT it doesn't do anything.
(package private)  void run(String[] args)
           
(package private)  void serialize()
           
protected  boolean skipThisClass(String dependentClassSpec)
          This method is used to determine whether or not a particular class should be included in the dependency information containers.
(package private)  void summary()
          This method outputs a summary of dependency information for all packages in the codebase.
(package private) static void usage()
           
(package private)  void writeHtml()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

d_includeWindchillClassesOnly

static boolean d_includeWindchillClassesOnly

d_interfaceList

static Vector d_interfaceList

d_classList

static Vector d_classList

d_interfaceDeps

static Hashtable d_interfaceDeps
This contains is used to track dependencies between interfaces The KEY is an interfaceSpec, the VALUE is an InterfaceDeps object.


d_classDeps

static Hashtable d_classDeps
This contains is used to track dependencies between classes. The KEY is a classSpec, the VALUE is a ClassDeps object.


d_packages

static Hashtable d_packages

d_startingDirectory

static String d_startingDirectory

d_outputDirectory

static String d_outputDirectory

d_baseTypesList

static Vector d_baseTypesList
This list contains the name of all the base data types and is used to skip these types when they are encountered in the Phase2.ProcessFile() method. This container is filled by the fillBaseTypesList() method.


d_currentPackageName

String d_currentPackageName
This field is used by multiple methods in this class.

Constructor Detail

pdl

public pdl()
Method Detail

serialize

void serialize()

deserialize

void deserialize()

addToMasterList

void addToMasterList(ClassFile cf,
                     String classSpec)
This convenience method checks to see if the current class is an INTERFACE or a CLASS and then adds it to the appropriate Vector.


processDirectory

public void processDirectory(String directoryName)
output the name of the package

Specified by:
processDirectory in interface ProcessFileInterface

directoryNameOk

public boolean directoryNameOk(String directoryName)
Make sure the user specifies a directory in the Windchill codebase at the wt level or below

Specified by:
directoryNameOk in interface ProcessFileInterface

fileTypeOk

public boolean fileTypeOk(String fileName)
This method acts like a filter so that only .class files are processed. This method is required by the ProcessFileInterface.

Specified by:
fileTypeOk in interface ProcessFileInterface

processFile

public void processFile(String fileName)
This method is defined here to meet the requirements of the ProcessFileInterface interface BUT it doesn't do anything. The reason I took this approach is that I wanted this outer class (pdl) to contain common methods that could be used by the derived inner classes in this file, i.e., processDirectory(), directoryNameOk() & fileTypeOk(). Since this outer class (pdl) will not get used directly with a ProcessDirectory instance, then I won't be causing any problems. Only instances of of the derived classes, Phase1 and Phase2 get used with ProcessDirectory instances. But I need to be able to instantiate a pdl instance down below in main() and then call the run() method ...

Specified by:
processFile in interface ProcessFileInterface

skipThisClass

protected boolean skipThisClass(String dependentClassSpec)
This method is used to determine whether or not a particular class should be included in the dependency information containers.


noneMsg

void noneMsg(PrintWriter pw,
             String title,
             String noneMsg)
This is a simple convenience method used by summary().


displayInterfaceDeps

void displayInterfaceDeps(PrintWriter pw,
                          String interfaceSpec)
This method locates the specified interfaceSpec in d_interfaceDeps and recurses 'upward' through the inheritance hierarchy displaying each interface along the way.


displayClassDeps

void displayClassDeps(PrintWriter pw,
                      String classSpec)
This method locates the specified classSpec in d_classDeps and recurses 'upward' through the inheritance hierarchy all the way to java.lang.Object, displaying each class along the way.


summary

void summary()
This method outputs a summary of dependency information for all packages in the codebase.


writeHtml

void writeHtml()

directoryCheck

void directoryCheck(String dirName)

processCommandLineArgs

void processCommandLineArgs(String[] args)

fillBaseTypesList

void fillBaseTypesList()

run

void run(String[] args)

usage

static void usage()

main

public static void main(String[] args)