public abstract class AbstractInstrumenter extends 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(File file,
long magic) |
void |
execute(Set<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,
Set classNames)
Create class transformer for the class.
|
protected boolean |
isClassFile(File file)
Does this file represent a compiled class?
|
protected boolean |
isJarFile(File file)
Does this file represent a zip file of some format?
|
protected void |
processClassFile(File file,
Set<String> classNames)
Process a class file.
|
protected void |
processFile(File file,
Set<String> classNames)
Actually process the file by applying instrumentation transformations to any classes it contains.
|
protected void |
processJarFile(File file,
Set<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 Exception
byecode
- The class bytecode.Exception
- Indicates problems access the bytecode.protected abstract ClassTransformer getClassTransformer(ClassDescriptor descriptor, 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(Set<File> files)
execute
in interface Instrumenter
files
- The files.protected final boolean isClassFile(File file) throws IOException
file
- The file to check.IOException
- Indicates problem access the file.protected final boolean isJarFile(File file) throws IOException
file
- The file to check.IOException
- Indicates problem access the file.protected final boolean checkMagic(File file, long magic) throws IOException
IOException
protected void processFile(File file, Set<String> classNames) throws Exception
collectClassNames(java.io.File, java.util.Set<java.lang.String>)
this method can handle both class and archive files.protected void processClassFile(File file, Set<String> classNames) throws Exception
processFile(java.io.File, java.util.Set<java.lang.String>)
in the case of a class file.protected void processJarFile(File file, Set<String> classNames) throws Exception
processFile(java.io.File, java.util.Set<java.lang.String>)
in the case of an archive file.Copyright © 2016 JBoss by Red Hat. All rights reserved.