wt.tools.xref
Class pdl.Phase2

java.lang.Object
  extended bywt.tools.xref.pdl
      extended bywt.tools.xref.pdl.Phase2
All Implemented Interfaces:
ProcessFileInterface
Enclosing class:
pdl

class pdl.Phase2
extends pdl

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.


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
(package private) pdl.Phase2()
           
 
Method Summary
(package private)  void addDependency(String currentClassSpec, SimplePackage packageInfo, String dependentClassSpec)
          This method adds the specified dependentClassSpec to the specified SimplePackage object.
(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 dependencyCheck(ClassFile cf, SimplePackage theSimplePackage)
          This method scans the bytecode in methods for more remote dependencies
(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 processCode(ClassFile cf, CodeAttrInfo cai, SimplePackage theSimplePackage)
          This method walks through the ByteCode watching for more subtle dependencies that only show up in the Byte Code.
(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.Phase2

pdl.Phase2()
Method Detail

addDependency

void addDependency(String currentClassSpec,
                   SimplePackage packageInfo,
                   String dependentClassSpec)
This method adds the specified dependentClassSpec to the specified SimplePackage object. This method first checks to see if dependentClassSpec is either a Class or an Interface and then adds it to the appropriate container.


processCode

void processCode(ClassFile cf,
                 CodeAttrInfo cai,
                 SimplePackage theSimplePackage)
This method walks through the ByteCode watching for more subtle dependencies that only show up in the Byte Code. Things like: 1) use of the INSTANCEOF instruction 2) reference to a field in a class 3) instantiation of a class 4) call to a method in a class


dependencyCheck

void dependencyCheck(ClassFile cf,
                     SimplePackage theSimplePackage)
This method scans the bytecode in methods for more remote dependencies


processFile

public void processFile(String fileName)
Description copied from class: pdl
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
Overrides:
processFile in class pdl

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

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)