|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.progeeks.util.ClassSpace
public class ClassSpace
Isolates a classloader and tracks a set of classes that will always be delegated to the parent classloader. Usually these will be interfaces that classes within the class-space will implement... so as to act as a class loader translation layer. Other methods exist for easily accessing contained classes, etc.. The primary purpose for ClassSpace is to be a convenient way for an application to create separate sandboxes that may use classes or jars that would be imcompatible with the rest of the application space.
Constructor Summary | |
---|---|
ClassSpace()
|
Method Summary | |
---|---|
void |
addClassPathEntry(java.io.File entry)
Convenience method for adding a classpath entry. |
void |
addClassPathEntry(java.lang.String entry)
Convenience method for adding a classpath entry. |
void |
addClassPathEntry(java.net.URL entry)
Convenience method for adding a classpath entry. |
void |
addSharedClass(java.lang.Class c)
Adds the name of the specified class to the list of class names that should always be loaded from the parent class loader. |
void |
addSharedClassName(java.lang.String s)
Adds the name to the list of class names that should always be loaded from the parent class loader. |
protected void |
checkInitialized()
|
java.util.List |
getClassPath()
Returns the current classpath list for the classspace as a list of URLs. |
java.lang.ClassLoader |
getParentClassLoader()
Returns the parent classloader for the space. |
PatternSet |
getSharedClassPatterns()
Returns the PatternSet used to determine if a class name should be looked up in the class space classloader or in the parrent classloader. |
PatternSet |
getSharedResourcePatterns()
Returns the PatternSet used to determine if a resource name should be looked up in the class space classloader or in the parrent classloader. |
void |
initialize()
Initializes the internal classloader and prepares this classspace for use. |
java.lang.Class |
loadClass(java.lang.String name)
Convenience method for loading a class without having to grab the space classloader first. |
static void |
main(java.lang.String[] args)
|
void |
setClassPath(java.util.List entries)
Sets the list of class-path entries for the classpace. |
void |
setParentClassLoader(java.lang.ClassLoader parent)
Sets the parent classloader for the space. |
protected boolean |
shouldLoadClassFromParent(java.lang.String name)
|
protected boolean |
shouldLoadResourceFromParent(java.lang.String name)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ClassSpace()
Method Detail |
---|
protected void checkInitialized()
public void setParentClassLoader(java.lang.ClassLoader parent)
public java.lang.ClassLoader getParentClassLoader()
public void setClassPath(java.util.List entries)
public void addClassPathEntry(java.net.URL entry)
public void addClassPathEntry(java.lang.String entry)
public void addClassPathEntry(java.io.File entry)
public java.util.List getClassPath()
public PatternSet getSharedClassPatterns()
public void addSharedClass(java.lang.Class c)
public void addSharedClassName(java.lang.String s)
public PatternSet getSharedResourcePatterns()
protected boolean shouldLoadClassFromParent(java.lang.String name)
protected boolean shouldLoadResourceFromParent(java.lang.String name)
public void initialize()
public java.lang.Class loadClass(java.lang.String name) throws java.lang.ClassNotFoundException
java.lang.ClassNotFoundException
public static void main(java.lang.String[] args) throws java.lang.Exception
java.lang.Exception
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |