|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--java.lang.ClassLoader | +--java.security.SecureClassLoader | +--java.net.URLClassLoader | +--org.quilt.cl.QuiltClassLoader
Quilt's transforming class loader. Can be directed to instrument a set of classes, matching class names against a list of prefixes and another list excluding classes from instrumentation, the exclusion list taking priority. Will delegate loading to a parent class loader where explicitly directed to; otherwise will be the defining loader. By default the loading of classes whose names begin with java., javax., junit., org.apache.bcel., org.apache.tools.ant. and org.quilt. is delegated.
Classes whose names begin with a reserved prefix, currently test.data.Test, are synthesized instead of being loaded. This must be specifically enabled.
ClassFactory
Field Summary | |
static char |
CLASSPATH_DELIM_CHAR
|
static java.lang.String |
CLASSPATH_DELIM_STR
|
static java.lang.String[] |
DELEGATED
Names of classes which must be loaded by the parent. |
static char |
FILE_PATH_DELIM_CHAR
Operating system specific |
static java.lang.String |
FILE_PATH_DELIM_STR
|
java.util.Map |
regMap
Map of registries by String name. |
static java.lang.String |
SYNTH_PREFIX
Prefix indicating that the class should be synthesized. |
static java.lang.String |
THIS_DIR
Convert domain name in classpath to file name, allowing for initial dots. |
static int |
THIS_DIR_LEN
|
static java.lang.String |
UP_DIR
|
static int |
UP_DIR_LEN
|
ClassTransformer |
xformer
Responsible for instrumenting classes. |
Constructor Summary | |
QuiltClassLoader(java.net.URL[] cp,
java.lang.ClassLoader parent,
java.lang.String[] del,
java.lang.String[] inc,
java.lang.String[] exc)
Constructor with full argument list. |
|
QuiltClassLoader(java.net.URL[] cp,
java.lang.String[] inc)
Constructor with abbreviated argument list. |
Method Summary | |
void |
addClassXformer(ClassXformer xf)
Add a class transformer. |
void |
addDelegated(java.lang.String prefix)
Add a class name prefix to the list of those to be delegated to the parent. |
void |
addExcluded(java.lang.String prefix)
Add a class name prefix to the list of those to be excluded from instrumentation. |
void |
addGraphXformer(GraphXformer xf)
Add a graph transformer. |
void |
addIncluded(java.lang.String prefix)
Add a class name prefix to the list of those to be instrumented. |
void |
addMethodXformer(MethodXformer xf)
Add a method transformer. |
void |
addPath(java.net.URL url)
Add a path to the class loader's classpath. |
QuiltRegistry |
addQuiltRegistry(java.lang.String regName)
Add a new QuiltRegistry to the list. |
static java.lang.String |
classFileName(java.lang.String className)
Convert a class name into a file name by replacing dots with forward slashes and appending ".class". |
static java.net.URL[] |
cpToURLs(java.lang.String cp)
Convert classpath in normal form to URL[] |
static java.lang.String |
domainToFileName(java.lang.String name)
Convert a dotted domain name to its path form, allowing for leading ./ and ../ and terminating .jar |
protected java.lang.Class |
findClass(java.lang.String name)
Locate the class whose name is passed and define it. |
protected byte[] |
getClassData(java.lang.String className)
Find a class along the class path and load it as a byte array. |
java.net.URL[] |
getClassPath()
|
java.lang.String[] |
getDelegated()
|
java.lang.String[] |
getExcluded()
|
java.lang.String[] |
getIncluded()
|
QuiltRegistry |
getRegistry(java.lang.String regName)
Get a reference to a Quilt registry. |
java.lang.String |
getReport()
Get reports from any or all registries. |
boolean |
getSynthEnabled()
Get synthesizing-enabled flag. |
java.lang.String |
getSynthPrefix()
|
java.lang.Class |
loadClass(java.lang.String name)
Class loader. |
void |
setClassPath(java.lang.String cp)
Convert classpath in normal form to URL[] and sets loader classpath to the corresponding value. |
void |
setExcluded(java.lang.String s)
Sets the list of classes to be excluded from instrumentation. |
void |
setIncluded(java.lang.String s)
Sets the list of classes to be instrumented. |
void |
setSynthEnabled(boolean b)
Enable class synthesizing. |
java.lang.String |
urlsToString()
|
Methods inherited from class java.net.URLClassLoader |
addURL, definePackage, findResource, findResources, getPermissions, getURLs, newInstance, newInstance |
Methods inherited from class java.security.SecureClassLoader |
defineClass |
Methods inherited from class java.lang.ClassLoader |
clearAssertionStatus, defineClass, defineClass, defineClass, definePackage, findLibrary, findLoadedClass, findSystemClass, getPackage, getPackages, getParent, getResource, getResourceAsStream, getResources, getSystemClassLoader, getSystemResource, getSystemResourceAsStream, getSystemResources, loadClass, resolveClass, setClassAssertionStatus, setDefaultAssertionStatus, setPackageAssertionStatus, setSigners |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final char FILE_PATH_DELIM_CHAR
public static final java.lang.String FILE_PATH_DELIM_STR
public static final char CLASSPATH_DELIM_CHAR
public static final java.lang.String CLASSPATH_DELIM_STR
public static final java.lang.String[] DELEGATED
public static final java.lang.String SYNTH_PREFIX
public ClassTransformer xformer
public static final java.lang.String THIS_DIR
public static final java.lang.String UP_DIR
public static final int THIS_DIR_LEN
public static final int UP_DIR_LEN
public java.util.Map regMap
Constructor Detail |
public QuiltClassLoader(java.net.URL[] cp, java.lang.String[] inc)
public QuiltClassLoader(java.net.URL[] cp, java.lang.ClassLoader parent, java.lang.String[] del, java.lang.String[] inc, java.lang.String[] exc)
cp
- Class path, an array of pathsparent
- Class loader which we delegate to.del
- String array, names of classes to be delegatedinc
- String array, names of classes to be instrumentedexc
- String array, names of classes not to be instrumented.Method Detail |
public static java.lang.String classFileName(java.lang.String className)
public java.lang.Class loadClass(java.lang.String name) throws java.lang.ClassNotFoundException
findClass.
loadClass
in class java.lang.ClassLoader
java.lang.ClassNotFoundException
protected java.lang.Class findClass(java.lang.String name) throws java.lang.ClassNotFoundException
findClass
in class java.net.URLClassLoader
name
- Class name in embedded dot (.) form.
java.lang.ClassNotFoundException
public java.lang.String urlsToString()
protected byte[] getClassData(java.lang.String className) throws java.io.IOException
java.io.IOException
public void addPath(java.net.URL url)
url
- Path to be added.public java.net.URL[] getClassPath()
public static java.lang.String domainToFileName(java.lang.String name)
public static java.net.URL[] cpToURLs(java.lang.String cp)
public void setClassPath(java.lang.String cp)
cp
- Class path in colon- or semicolon-delimited form.public void addDelegated(java.lang.String prefix)
prefix
- Prefix to be added.public java.lang.String[] getDelegated()
public void addExcluded(java.lang.String prefix)
prefix
- Prefix to be added.public java.lang.String[] getExcluded()
public void setExcluded(java.lang.String s)
s
- List of classes in comma-separated String form.public void addIncluded(java.lang.String prefix)
prefix
- Prefix to be added.public java.lang.String[] getIncluded()
public void setIncluded(java.lang.String s)
s
- List of classes in comma-separated String form.public boolean getSynthEnabled()
public void setSynthEnabled(boolean b)
public java.lang.String getSynthPrefix()
public void addClassXformer(ClassXformer xf)
public void addMethodXformer(MethodXformer xf)
public void addGraphXformer(GraphXformer xf)
public QuiltRegistry getRegistry(java.lang.String regName)
public QuiltRegistry addQuiltRegistry(java.lang.String regName)
regName
- The domain name of the registry in dotted form.public java.lang.String getReport()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |