com.vladium.emma.instr
Class InstrProcessorST

java.lang.Object
  extended bycom.vladium.emma.Processor
      extended bycom.vladium.emma.instr.InstrProcessor
          extended bycom.vladium.emma.instr.InstrProcessorST
All Implemented Interfaces:
IAppErrorCodes, IPathEnumerator.IPathHandler

final class InstrProcessorST
extends InstrProcessor
implements IAppErrorCodes

Author:
Vlad Roubtsov, (C) 2003

Nested Class Summary
private static class InstrProcessorST.EntryWriteJob
           
private static class InstrProcessorST.FileWriteJob
           
private static class InstrProcessorST.Job
           
 
Nested classes inherited from class com.vladium.emma.instr.InstrProcessor
InstrProcessor.OutMode
 
Field Summary
private static int BUF_SIZE
           
private static boolean CLEANUP_TEMP_ARCHIVE_ON_ERRORS
           
private static boolean DO_DEPENDS_CHECKING
           
private static boolean DO_RAF_EXTENSION
           
private static java.lang.Class[] EXPECTED_FAILURES
           
private static int JOB_QUEUE_SIZE
           
private  java.util.jar.JarOutputStream m_archiveOut
           
private  ByteArrayOStream m_baos
           
private  long m_currentArchiveTS
           
private  InstrVisitor.InstrResult m_instrResult
           
private  int m_jobPos
           
private  InstrProcessorST.Job[] m_jobs
           
private  IMetaData m_mdata
           
private  java.io.File m_origArchiveFile
           
private  byte[] m_readbuf
           
private  int m_readpos
           
private  java.io.File m_tempArchiveFile
           
private  long m_timeStamp
           
private  InstrVisitor m_visitor
           
 
Fields inherited from class com.vladium.emma.instr.InstrProcessor
CLASSES, DEFAULT_DO_SUID_COMPENSATION, DEFAULT_EXCLUDE_BRIDGE_METHODS, DEFAULT_EXCLUDE_SYNTHETIC_METHODS, IN_CLASSES, IN_LIB, LIB, m_canonical, m_classCopies, m_classInstrs, m_coverageFilter, m_dependsMode, m_instrPath, m_mdataOutFile, m_mdataOutMerge, m_outDir, m_outMode, PROPERTY_DO_SUID_COMPENSATION, PROPERTY_EXCLUDE_BRIDGE_METHODS, PROPERTY_EXCLUDE_SYNTHETIC_METHODS
 
Fields inherited from class com.vladium.emma.Processor
m_appName, m_log, m_propertyOverrides
 
Fields inherited from interface com.vladium.emma.IAppErrorCodes
ARGS_IO_FAILURE, CLASS_STAMP_MISMATCH, INSTR_IO_FAILURE, INVALID_COLUMN_NAME, INVALID_PARAMETER_VALUE, MAIN_CLASS_BAD_DELEGATION, MAIN_CLASS_LOAD_FAILURE, MAIN_CLASS_NOT_FOUND, MAIN_METHOD_FAILURE, MAIN_METHOD_NOT_FOUND, OUT_IO_FAILURE, OUT_MKDIR_FAILURE, REPORT_GEN_FAILURE, REPORT_IO_FAILURE, REQUIRED_PARAMETER_MISSING, SECURITY_RESTRICTION, UNEXPECTED_FAILURE
 
Constructor Summary
(package private) InstrProcessorST()
           
 
Method Summary
protected  void _run(IProperties toolProperties)
           
private  void addJob(InstrProcessorST.Job job)
           
private  void drainJobQueue()
           
private  void ensureReadCapacity(int capacity)
           
 void handleArchiveEnd(java.io.File parentDir, java.io.File archive)
          Called after the enumerator's zip input stream for this archive has been closed.
 void handleArchiveEntry(java.util.jar.JarInputStream in, java.util.zip.ZipEntry entry)
           
 void handleArchiveStart(java.io.File parentDir, java.io.File archive, java.util.jar.Manifest manifest)
          Called just after the enumerator's zip input stream for this archive is opened and the manifest entry is read.
 void handleDirEnd(java.io.File pathDir, java.io.File dir)
           
 void handleDirStart(java.io.File pathDir, java.io.File dir)
           
 void handleFile(java.io.File pathDir, java.io.File file)
           
private  void readFile(java.io.File file)
           
private  void readZipEntry(java.util.zip.ZipInputStream in, java.util.zip.ZipEntry entry)
           
protected  void reset()
           
(package private) static void writeFile(byte[] data, java.io.File outFile, boolean mkdirs)
           
(package private) static void writeZipEntry(byte[] data, java.util.zip.ZipOutputStream out, java.util.zip.ZipEntry entry, boolean isCopy)
           
 
Methods inherited from class com.vladium.emma.instr.InstrProcessor
create, createDir, getFullOutDir, getFullOutFile, setDependsMode, setInclExclFilter, setInstrOutDir, setInstrPath, setMetaOutFile, setMetaOutMerge, setOutMode, validateState
 
Methods inherited from class com.vladium.emma.Processor
run, setAppName, setPropertyOverrides, setPropertyOverrides
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

m_jobs

private final InstrProcessorST.Job[] m_jobs

m_instrResult

private final InstrVisitor.InstrResult m_instrResult

m_visitor

private InstrVisitor m_visitor

m_mdata

private IMetaData m_mdata

m_readbuf

private byte[] m_readbuf

m_readpos

private int m_readpos

m_baos

private ByteArrayOStream m_baos

m_jobPos

private int m_jobPos

m_currentArchiveTS

private long m_currentArchiveTS

m_origArchiveFile

private java.io.File m_origArchiveFile

m_tempArchiveFile

private java.io.File m_tempArchiveFile

m_archiveOut

private java.util.jar.JarOutputStream m_archiveOut

m_timeStamp

private long m_timeStamp

BUF_SIZE

private static final int BUF_SIZE
See Also:
Constant Field Values

JOB_QUEUE_SIZE

private static final int JOB_QUEUE_SIZE
See Also:
Constant Field Values

CLEANUP_TEMP_ARCHIVE_ON_ERRORS

private static final boolean CLEANUP_TEMP_ARCHIVE_ON_ERRORS
See Also:
Constant Field Values

DO_RAF_EXTENSION

private static final boolean DO_RAF_EXTENSION
See Also:
Constant Field Values

DO_DEPENDS_CHECKING

private static final boolean DO_DEPENDS_CHECKING
See Also:
Constant Field Values

EXPECTED_FAILURES

private static final java.lang.Class[] EXPECTED_FAILURES
Constructor Detail

InstrProcessorST

InstrProcessorST()
Method Detail

handleArchiveStart

public final void handleArchiveStart(java.io.File parentDir,
                                     java.io.File archive,
                                     java.util.jar.Manifest manifest)
Description copied from interface: IPathEnumerator.IPathHandler
Called just after the enumerator's zip input stream for this archive is opened and the manifest entry is read.

Specified by:
handleArchiveStart in interface IPathEnumerator.IPathHandler

handleArchiveEntry

public final void handleArchiveEntry(java.util.jar.JarInputStream in,
                                     java.util.zip.ZipEntry entry)
Specified by:
handleArchiveEntry in interface IPathEnumerator.IPathHandler

handleArchiveEnd

public final void handleArchiveEnd(java.io.File parentDir,
                                   java.io.File archive)
Description copied from interface: IPathEnumerator.IPathHandler
Called after the enumerator's zip input stream for this archive has been closed.

Specified by:
handleArchiveEnd in interface IPathEnumerator.IPathHandler

handleDirStart

public final void handleDirStart(java.io.File pathDir,
                                 java.io.File dir)
Specified by:
handleDirStart in interface IPathEnumerator.IPathHandler

handleFile

public final void handleFile(java.io.File pathDir,
                             java.io.File file)
Specified by:
handleFile in interface IPathEnumerator.IPathHandler

handleDirEnd

public final void handleDirEnd(java.io.File pathDir,
                               java.io.File dir)
Specified by:
handleDirEnd in interface IPathEnumerator.IPathHandler

reset

protected void reset()
Overrides:
reset in class InstrProcessor

_run

protected void _run(IProperties toolProperties)
Specified by:
_run in class Processor

writeFile

static void writeFile(byte[] data,
                      java.io.File outFile,
                      boolean mkdirs)
               throws java.io.IOException
Throws:
java.io.IOException

writeZipEntry

static void writeZipEntry(byte[] data,
                          java.util.zip.ZipOutputStream out,
                          java.util.zip.ZipEntry entry,
                          boolean isCopy)
                   throws java.io.IOException
Throws:
java.io.IOException

addJob

private void addJob(InstrProcessorST.Job job)
             throws java.io.FileNotFoundException,
                    java.io.IOException
Throws:
java.io.FileNotFoundException
java.io.IOException

drainJobQueue

private void drainJobQueue()
                    throws java.io.IOException
Throws:
java.io.IOException

readFile

private void readFile(java.io.File file)
               throws java.io.IOException
Throws:
java.io.IOException

readZipEntry

private void readZipEntry(java.util.zip.ZipInputStream in,
                          java.util.zip.ZipEntry entry)
                   throws java.io.IOException
Throws:
java.io.IOException

ensureReadCapacity

private void ensureReadCapacity(int capacity)