com.sun.billf.tass
Class AddToTassDatabase

java.lang.Object
  extended bycom.sun.billf.tass.AddToTassDatabase
All Implemented Interfaces:
com.sun.billf.tass.Visitee

public class AddToTassDatabase
extends java.lang.Object
implements com.sun.billf.tass.Visitee

This little main uses the TASS classes to create and/or add to a database of member usage. It first attempts to read the named TASS database, which by convention should end in ".tdb". If the file does not exist, a new, empty database will be created. Then, a .zip file containing application classes is read, and static references from the application to platform classes are calculated. Every .class file contained withing the .zip archive is read; no attempt is made to discover unused application classes or methods. Finally, an updated database is written, with the record of referenes for each platform member updated.

Each run of AddToTassDatabase is tracked with an integer ID number, assigned sequentially. This allows the party that runs TASS to anonymously track back to the application that contains a given reference or pattern of references.

See the usage message for details on command-line arguments.

Author:
Bill Foote bill.foote@sun.com

Constructor Summary
AddToTassDatabase(TassDatabase db)
           
 
Method Summary
 boolean addClassFile(java.lang.String fileName)
           
 boolean addZipFile(java.lang.String fileName)
          Add the .class files in the given archive.
 void checkFieldRef(java.lang.String className, java.lang.String fieldName)
          Internal Visitee implementation method
 void checkForClass(java.lang.String name)
          Internal Visitee implementation method
 void checkMethodRef(java.lang.String className, java.lang.String methodName, org.apache.bcel.generic.Type[] args)
          Internal Visitee implementation method
 void checkType(org.apache.bcel.generic.Type t)
          Internal Visitee implementation method
 int getTrackingNumber()
           
 void init(java.lang.String[] packages)
          This must only be called after the database is initialized
static void main(java.lang.String[] args)
           
 void reportError(java.lang.String msg)
          Internal Visitee implementation method
static void usage()
          Print a usage message describing the command-line arguments.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AddToTassDatabase

public AddToTassDatabase(TassDatabase db)
Method Detail

usage

public static void usage()
Print a usage message describing the command-line arguments. Running this program with no arguments (or invalid arguments) will produce this message.


getTrackingNumber

public int getTrackingNumber()

init

public void init(java.lang.String[] packages)
          throws java.io.IOException
This must only be called after the database is initialized

Throws:
java.io.IOException

addZipFile

public boolean addZipFile(java.lang.String fileName)
                   throws java.io.IOException
Add the .class files in the given archive. If an error is found, emits one or more messages to stderr, and returns false.

Parameters:
fileName - The name of the zip archive containing .class files
Returns:
true if no errors found
Throws:
java.io.IOException

addClassFile

public boolean addClassFile(java.lang.String fileName)
                     throws java.io.IOException
Throws:
java.io.IOException

checkForClass

public void checkForClass(java.lang.String name)
Internal Visitee implementation method

Specified by:
checkForClass in interface com.sun.billf.tass.Visitee

checkType

public void checkType(org.apache.bcel.generic.Type t)
Internal Visitee implementation method

Specified by:
checkType in interface com.sun.billf.tass.Visitee
See Also:
Visitee.checkForClass(String)

reportError

public void reportError(java.lang.String msg)
Internal Visitee implementation method

Specified by:
reportError in interface com.sun.billf.tass.Visitee

checkFieldRef

public void checkFieldRef(java.lang.String className,
                          java.lang.String fieldName)
Internal Visitee implementation method

Specified by:
checkFieldRef in interface com.sun.billf.tass.Visitee

checkMethodRef

public void checkMethodRef(java.lang.String className,
                           java.lang.String methodName,
                           org.apache.bcel.generic.Type[] args)
Internal Visitee implementation method

Specified by:
checkMethodRef in interface com.sun.billf.tass.Visitee

main

public static void main(java.lang.String[] args)