public abstract class AbstractInstrumenter extends java.lang.Object implements Instrumenter
| Modifier and Type | Class and Description |
|---|---|
protected class |
AbstractInstrumenter.CustomFieldFilter
Allows control over what exactly to transform.
|
Instrumenter.Options| Modifier and Type | Field and Description |
|---|---|
protected Logger |
logger |
protected Instrumenter.Options |
options |
| Constructor and Description |
|---|
AbstractInstrumenter(Logger logger,
Instrumenter.Options options)
Creates the basic instrumentation strategy.
|
| Modifier and Type | Method and Description |
|---|---|
protected boolean |
checkMagic(java.io.File file,
long magic) |
void |
execute(java.util.Set<java.io.File> files)
The main instrumentation entry point.
|
protected abstract ClassDescriptor |
getClassDescriptor(byte[] byecode)
Given the bytecode of a java class, retrieve the descriptor for that class.
|
protected abstract ClassTransformer |
getClassTransformer(ClassDescriptor descriptor,
java.util.Set classNames)
Create class transformer for the class.
|
protected boolean |
isClassFile(java.io.File file)
Does this file represent a compiled class?
|
protected boolean |
isJarFile(java.io.File file)
Does this file represent a zip file of some format?
|
protected void |
processClassFile(java.io.File file,
java.util.Set<java.lang.String> classNames)
Process a class file.
|
protected void |
processFile(java.io.File file,
java.util.Set<java.lang.String> classNames)
Actually process the file by applying instrumentation transformations to any classes it contains.
|
protected void |
processJarFile(java.io.File file,
java.util.Set<java.lang.String> classNames)
Process an archive file.
|
protected final Logger logger
protected final Instrumenter.Options options
public AbstractInstrumenter(Logger logger, Instrumenter.Options options)
logger - The bridge to the environment's logging system.options - User-supplied options.protected abstract ClassDescriptor getClassDescriptor(byte[] byecode) throws java.lang.Exception
byecode - The class bytecode.java.lang.Exception - Indicates problems access the bytecode.protected abstract ClassTransformer getClassTransformer(ClassDescriptor descriptor, java.util.Set classNames)
descriptor - The descriptor of the class to be instrumented.classNames - The names of all classes to be instrumented; the "pipeline" if you will.public void execute(java.util.Set<java.io.File> files)
execute in interface Instrumenterfiles - The files.protected final boolean isClassFile(java.io.File file)
throws java.io.IOException
file - The file to check.java.io.IOException - Indicates problem access the file.protected final boolean isJarFile(java.io.File file)
throws java.io.IOException
file - The file to check.java.io.IOException - Indicates problem access the file.protected final boolean checkMagic(java.io.File file,
long magic)
throws java.io.IOException
java.io.IOExceptionprotected void processFile(java.io.File file,
java.util.Set<java.lang.String> classNames)
throws java.lang.Exception
collectClassNames(java.io.File, java.util.Set<java.lang.String>) this method can handle both class and archive files.file - The file to process.classNames - The 'pipeline' of classes to be processed. Only actually populated when the user
specifies to perform extended instrumentation.java.lang.Exception - Indicates an issue either access files or applying the transformations.protected void processClassFile(java.io.File file,
java.util.Set<java.lang.String> classNames)
throws java.lang.Exception
processFile(java.io.File, java.util.Set<java.lang.String>) in the case of a class file.file - The class file to process.classNames - The 'pipeline' of classes to be processed. Only actually populated when the user
specifies to perform extended instrumentation.java.lang.Exception - Indicates an issue either access files or applying the transformations.protected void processJarFile(java.io.File file,
java.util.Set<java.lang.String> classNames)
throws java.lang.Exception
processFile(java.io.File, java.util.Set<java.lang.String>) in the case of an archive file.file - The archive file to process.classNames - The 'pipeline' of classes to be processed. Only actually populated when the user
specifies to perform extended instrumentation.java.lang.Exception - Indicates an issue either access files or applying the transformations.Copyright © 2001-2013 Red Hat, Inc. All Rights Reserved.