org.tromer.jie
Class InstrumentingFileTransformer

java.lang.Object
  |
  +--org.tromer.jie.FileTransformer
        |
        +--org.tromer.jie.InstrumentingFileTransformer

public class InstrumentingFileTransformer
extends FileTransformer

Instruments a complete directory tree (or single file), according to the instructions in an InstrumConfig object. This class contains the main instrumentation loop of JIE.


Inner Class Summary
 class InstrumentingFileTransformer.Stats
           
 
Field Summary
protected  InstrumConfig config
          Instrumentation configuration used by this object.
protected  java.lang.String currentDest
          Name of current destination file
protected  java.lang.String currentSrc
          Name of current source file
protected  java.lang.String currentSrcRel
          Name of current source file, relative to srcBase
protected  java.io.File srcBase
          The root source directory of the current run() execution
protected  InstrumentingFileTransformer.Stats stats
          Current statistics
 
Constructor Summary
InstrumentingFileTransformer(InstrumConfig config)
           
 
Method Summary
protected  boolean isFileAccepted(java.io.File file)
          Applies a filter to the files that will be handled by transformDirectory().
 InstrumentingFileTransformer.Stats run()
          Carry out the complete job as defined by the instrumentation configuration.
 void transformFile(java.io.File src, java.io.File dest)
          Writes a progress indication message, then continues with normal file transformation.
 void transformStream(java.io.InputStream srcStream, java.io.OutputStream destStream)
          Reads original Java source from an input stream, applies all instrumentation rules and writes it to an output stream.
 
Methods inherited from class org.tromer.jie.FileTransformer
transform, transformDirectory
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

config

protected InstrumConfig config
Instrumentation configuration used by this object.

stats

protected InstrumentingFileTransformer.Stats stats
Current statistics

srcBase

protected java.io.File srcBase
The root source directory of the current run() execution

currentSrc

protected java.lang.String currentSrc
Name of current source file

currentDest

protected java.lang.String currentDest
Name of current destination file

currentSrcRel

protected java.lang.String currentSrcRel
Name of current source file, relative to srcBase
Constructor Detail

InstrumentingFileTransformer

public InstrumentingFileTransformer(InstrumConfig config)
Method Detail

run

public InstrumentingFileTransformer.Stats run()
                                       throws java.io.IOException
Carry out the complete job as defined by the instrumentation configuration.

transformFile

public void transformFile(java.io.File src,
                          java.io.File dest)
                   throws java.io.IOException
Writes a progress indication message, then continues with normal file transformation.
Overrides:
transformFile in class FileTransformer

transformStream

public void transformStream(java.io.InputStream srcStream,
                            java.io.OutputStream destStream)
                     throws java.io.IOException
Reads original Java source from an input stream, applies all instrumentation rules and writes it to an output stream.

This overrides the original transformStream(), which makes a bytewise copy.

Overrides:
transformStream in class FileTransformer

isFileAccepted

protected boolean isFileAccepted(java.io.File file)
Description copied from class: FileTransformer
Applies a filter to the files that will be handled by transformDirectory(). By default, all files.
Overrides:
isFileAccepted in class FileTransformer