|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.gridsystems.launcher.CLBuilder
public class CLBuilder
Builds an URLClassLoader with a "dynamically" constructed classpath.
IMPORTANT: Do not use classes from external libraries here, as they will probably not be in the classpath.
| Constructor Summary | |
|---|---|
CLBuilder()
Creates a new instance with null parent class loader. |
|
CLBuilder(java.lang.ClassLoader parent)
Creates a new instance with the specified class loader. |
|
| Method Summary | |
|---|---|
void |
addClassPath(java.lang.ClassLoader cl)
Adds the classpath of the specified classloader instance. |
void |
addContextClassPath()
Adds the classpath of the current context classloader. |
void |
addDir(java.io.File dir)
Adds the specified directory to the classpath. |
void |
addFile(java.io.File f)
Adds the specified file to the classpath. |
void |
addJars(java.io.File f,
boolean recursive)
Adds all jar files in the specified directory to the classpath. |
void |
addUrl(java.net.URL url)
Adds a single URL to the path set. |
void |
addWar(java.io.File f)
Adds a war to the classpath. |
void |
addWebApp(java.io.File f)
Adds WEB-INF/classes and WEB-INF/lib/*.jar to
the classpath. |
java.lang.ClassLoader |
getClassLoader()
Constructs a classloader with the current classpath. |
java.lang.Object |
invoke(java.lang.String clazz,
java.lang.String method,
java.lang.Class[] types,
java.lang.Object[] args)
Invokes the specified method within the context of the currently built classloader. |
void |
setParent(java.lang.ClassLoader parent)
Sets the parent classloader. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public CLBuilder()
public CLBuilder(java.lang.ClassLoader parent)
parent - The parent classloader for the generated one| Method Detail |
|---|
public void setParent(java.lang.ClassLoader parent)
parent - The new parent classloaderpublic void addClassPath(java.lang.ClassLoader cl)
cl - The classloader whose classpath we want to obtainpublic void addContextClassPath()
public void addDir(java.io.File dir)
dir - The directory to addpublic void addFile(java.io.File f)
f - The file to add
public void addJars(java.io.File f,
boolean recursive)
f - The directory containing the jars to addrecursive - flag indicating if subdirectories must be scanned toopublic void addUrl(java.net.URL url)
url - The URL to addpublic void addWebApp(java.io.File f)
WEB-INF/classes and WEB-INF/lib/*.jar to
the classpath.
f - The webapp context directorypublic void addWar(java.io.File f)
f - The war filepublic java.lang.ClassLoader getClassLoader()
public java.lang.Object invoke(java.lang.String clazz,
java.lang.String method,
java.lang.Class[] types,
java.lang.Object[] args)
throws java.lang.Exception
If the method is not static, it will attempt to create a new instance before invoking it.
clazz - The class namemethod - The method name.types - The argument types listargs - The arguments list
java.lang.Exception - In case of any reflection error
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||