|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object edu.rice.cs.cunit.FileInstrumentor
public class FileInstrumentor
Nested Class Summary | |
---|---|
static class |
FileInstrumentor.Tool
Class to perform the command line utility tasks. |
Field Summary | |
---|---|
protected static boolean |
_addAnnotationAttribute
Add an instrumentation describing that this class has been instrumented? |
protected static java.io.FileOutputStream |
_debugOut
File output stream if output is to a file instead of to regular Debug.out. |
protected static java.lang.String |
_defaultCunitRtJarName
Default name of the Concutest jar file that gets mixed in when instrumenting the rt.jar. |
protected static java.lang.String |
_defaultDestRtJarName
Default name of the destination file when instrumenting the rt.jar. |
protected static java.lang.String |
_defaultInstrumentorName
Default instrumentor name. |
protected static java.lang.String |
_defaultSystemInstrumentorName
Default system instrumentor name.. |
protected static boolean |
_forceInstrumentation
Force instrumentation even if the class has already been instrumented? |
protected java.util.ArrayList<IInstrumentationStrategy> |
_instrumentors
List of instrumentors that should be applied to a class. |
static java.lang.String |
INSTRUMENTOR_PACKAGE_PREFIX
Package prefix of where instrumentors are usually located (includes the '.' at the end). |
Constructor Summary | |
---|---|
FileInstrumentor(IInstrumentationStrategy[] instrumentors)
Creates a new instrumenting class loader using specified instrumentors. |
Method Summary | |
---|---|
static void |
addClassJarStream(java.lang.String inFileName,
java.lang.String outFileName,
java.util.jar.JarOutputStream jos,
boolean markAsInstrumented)
Add a class to a Jar stream. |
void |
addJarStream(java.lang.String inJarName,
java.util.jar.JarOutputStream jos,
boolean markAsInstrumented)
Instrument all classes in the specified Jar file and write the output to a Jar stream. |
void |
done()
Call done on all instrumentors. |
static java.lang.String |
getDefaultCunitRtJarName()
|
static java.lang.String |
getDefaultDestRtJarName()
|
static java.lang.String |
getDefaultInstrumentorName()
|
static java.lang.String |
getDefaultSourceRtJarName()
|
static java.lang.String |
getDefaultSystemInstrumentorName()
|
java.util.List<IInstrumentationStrategy> |
getInstrumentors()
Returns a list of instrumentors. |
private static boolean |
instrumentAndRename(java.lang.String classFileName,
FileInstrumentor fi)
|
private static void |
instrumentAndRenameJar(java.lang.String jarFileName,
FileInstrumentor fi)
|
boolean |
instrumentFile(java.lang.String inName,
java.lang.String outName)
Instrument the class in the specified class file and write the output the another class file. |
void |
instrumentJar(java.lang.String inJarName,
java.lang.String outJarName)
Instrument all classes in the specified Jar file and write the output to another Jar file. |
void |
instrumentJarStream(java.lang.String inJarName,
java.util.jar.JarOutputStream jos,
java.util.List<java.lang.String> filters)
Instrument all classes in the specified Jar file and write the output to a Jar stream. |
private static void |
instrumentList(boolean createBackups,
boolean recurse,
FileInstrumentor fi,
java.util.HashMap<java.lang.String,java.io.File> tempDirMap,
ILambda.Binary<java.lang.Void,java.lang.String,java.io.IOException> exceptionAction,
java.lang.String... names)
Instrument a list of files. |
private static void |
instrumentRTJar(java.lang.String sourceRtJarName,
java.lang.String destRtJarName,
java.lang.String cunitRtJarName,
java.util.List<java.lang.String> cunitFilters,
FileInstrumentor fi,
FileInstrumentor fiSystem)
|
boolean |
instrumentStream(java.io.InputStream is,
java.io.OutputStream os)
Instrument the class from the input stream and generate a class for the output stream. |
static void |
main(java.lang.String[] args)
Run the general file instrumentor. |
static void |
setDefaultCunitRtJarName(java.lang.String defaultCunitRtJarName)
Set the name of the CUnit mixin jar file. |
static void |
setDefaultDestRtJarName(java.lang.String defaultDestRtJarName)
Set the name of the default destination rt.jar file. |
static void |
setDefaultInstrumentorName(java.lang.String defaultInstrumentorName)
Set the name of the instrumentor. |
static void |
setDefaultSystemInstrumentorName(java.lang.String defaultSystemInstrumentorName)
Set the name of the system instrumentor. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected java.util.ArrayList<IInstrumentationStrategy> _instrumentors
public static final java.lang.String INSTRUMENTOR_PACKAGE_PREFIX
protected static java.io.FileOutputStream _debugOut
protected static boolean _addAnnotationAttribute
protected static boolean _forceInstrumentation
protected static java.lang.String _defaultDestRtJarName
protected static java.lang.String _defaultCunitRtJarName
protected static java.lang.String _defaultInstrumentorName
protected static java.lang.String _defaultSystemInstrumentorName
Constructor Detail |
---|
public FileInstrumentor(IInstrumentationStrategy[] instrumentors)
instrumentors
- array of instrumentorsMethod Detail |
---|
public java.util.List<IInstrumentationStrategy> getInstrumentors()
public void done()
public boolean instrumentStream(java.io.InputStream is, java.io.OutputStream os) throws java.io.IOException, java.lang.ClassFormatError
is
- input streamos
- output stream
java.io.IOException
java.lang.ClassFormatError
public boolean instrumentFile(java.lang.String inName, java.lang.String outName) throws java.io.IOException, java.lang.ClassFormatError
inName
- input file nameoutName
- output file name
java.io.IOException
java.lang.ClassFormatError
public void instrumentJarStream(java.lang.String inJarName, java.util.jar.JarOutputStream jos, java.util.List<java.lang.String> filters) throws java.io.IOException, java.lang.ClassFormatError
inJarName
- name of the input Jarjos
- Jar output streamfilters
- filters; if non-empty and no filter matches, file is skipped
java.io.IOException
java.lang.ClassFormatError
public void instrumentJar(java.lang.String inJarName, java.lang.String outJarName) throws java.io.IOException, java.lang.ClassFormatError
inJarName
- name of the input JaroutJarName
- name of the output Jar
java.io.IOException
java.lang.ClassFormatError
public static void addClassJarStream(java.lang.String inFileName, java.lang.String outFileName, java.util.jar.JarOutputStream jos, boolean markAsInstrumented) throws java.io.IOException
inFileName
- file name of the class to addoutFileName
- file name inside the Jarjos
- Jar output streammarkAsInstrumented
- mark this class as instrumented
java.io.IOException
public void addJarStream(java.lang.String inJarName, java.util.jar.JarOutputStream jos, boolean markAsInstrumented) throws java.io.IOException, java.lang.ClassFormatError
inJarName
- name of the input Jarjos
- Jar output streammarkAsInstrumented
- true if these classes should be marked as instrumented
java.io.IOException
java.lang.ClassFormatError
public static java.lang.String getDefaultSystemInstrumentorName()
public static void setDefaultSystemInstrumentorName(java.lang.String defaultSystemInstrumentorName)
defaultSystemInstrumentorName
- new namepublic static java.lang.String getDefaultInstrumentorName()
public static void setDefaultInstrumentorName(java.lang.String defaultInstrumentorName)
defaultInstrumentorName
- new namepublic static java.lang.String getDefaultDestRtJarName()
public static void setDefaultDestRtJarName(java.lang.String defaultDestRtJarName)
defaultDestRtJarName
- new namepublic static java.lang.String getDefaultCunitRtJarName()
public static void setDefaultCunitRtJarName(java.lang.String defaultCunitRtJarName)
defaultCunitRtJarName
- new namepublic static java.lang.String getDefaultSourceRtJarName()
private static void instrumentList(boolean createBackups, boolean recurse, FileInstrumentor fi, java.util.HashMap<java.lang.String,java.io.File> tempDirMap, ILambda.Binary<java.lang.Void,java.lang.String,java.io.IOException> exceptionAction, java.lang.String... names) throws java.io.IOException
createBackups
- true if backups should be created (unless in a temporary directory)recurse
- recurse into subdirectoriesfi
- TCFileInstrumentor to usetempDirMap
- map from jar file name to temporary directoryexceptionAction
- action to execute if an IOException occurs; if null, IOExceptions will not be caughtnames
- array of file names
java.io.IOException
- IOException during instrumentationprivate static boolean instrumentAndRename(java.lang.String classFileName, FileInstrumentor fi) throws java.io.IOException
java.io.IOException
private static void instrumentAndRenameJar(java.lang.String jarFileName, FileInstrumentor fi) throws java.io.IOException
java.io.IOException
private static void instrumentRTJar(java.lang.String sourceRtJarName, java.lang.String destRtJarName, java.lang.String cunitRtJarName, java.util.List<java.lang.String> cunitFilters, FileInstrumentor fi, FileInstrumentor fiSystem) throws java.io.IOException
java.io.IOException
public static void main(java.lang.String[] args)
args
- command line arguments.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |