Module openj9.dtfj
Class DDRInteractiveClassLoader
- java.lang.Object
-
- java.lang.ClassLoader
-
- com.ibm.j9ddr.tools.ddrinteractive.plugins.DDRInteractiveClassLoader
-
public class DDRInteractiveClassLoader extends ClassLoader
DDR Interactive classloader which is responsible for finding all classes specified by the plugins property.
-
-
Field Summary
Fields Modifier and Type Field Description static String
PLUGIN_ENV_VAR
The name of the environment variable which will set the plugin search path.static String
PLUGIN_ENV_VAR_ALT
static String
PLUGIN_SYSTEM_PROPERTY
System property which will be used to scan for plugins.protected static ArrayList<String>
runtimeCommandClasses
-
Constructor Summary
Constructors Constructor Description DDRInteractiveClassLoader(IVMData vmdata)
DDRInteractiveClassLoader(IVMData vmdata, ClassLoader loader)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addCommandClass(String className)
Class<?>
findClass(String className)
Searches for and loads a class from the plugins search path.ArrayList<PluginConfig>
getPluginFailures()
ArrayList<PluginConfig>
getPlugins()
protected boolean
hasCommandIFace(Class<?> clazz)
Check to see if a class implements the command interfacevoid
loadPlugins()
Scans the plugins classpath and loads any DTFJPlugins foundvoid
removeCommandClass(String className)
-
Methods declared in class java.lang.ClassLoader
clearAssertionStatus, clone, defineClass, defineClass, defineClass, defineClass, definePackage, findClass, findLibrary, findLoadedClass, findResource, findResource, findResources, findSystemClass, getClassLoadingLock, getDefinedPackage, getDefinedPackages, getName, getPackage, getPackages, getParent, getPlatformClassLoader, getResource, getResourceAsStream, getResources, getSystemClassLoader, getSystemResource, getSystemResourceAsStream, getSystemResources, getUnnamedModule, isRegisteredAsParallelCapable, loadClass, loadClass, registerAsParallelCapable, resolveClass, resources, setClassAssertionStatus, setDefaultAssertionStatus, setPackageAssertionStatus, setSigners
-
-
-
-
Field Detail
-
PLUGIN_SYSTEM_PROPERTY
public static final String PLUGIN_SYSTEM_PROPERTY
System property which will be used to scan for plugins.- See Also:
- Constant Field Values
-
PLUGIN_ENV_VAR
public static final String PLUGIN_ENV_VAR
The name of the environment variable which will set the plugin search path. An explicitly set system property will override this setting.- See Also:
- Constant Field Values
-
PLUGIN_ENV_VAR_ALT
public static final String PLUGIN_ENV_VAR_ALT
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
DDRInteractiveClassLoader
public DDRInteractiveClassLoader(IVMData vmdata) throws DDRInteractiveCommandException
- Throws:
DDRInteractiveCommandException
-
DDRInteractiveClassLoader
public DDRInteractiveClassLoader(IVMData vmdata, ClassLoader loader) throws DDRInteractiveCommandException
- Throws:
DDRInteractiveCommandException
- if the -Dplugins property contains a bad path
-
-
Method Detail
-
loadPlugins
public void loadPlugins() throws DDRInteractiveCommandException
Scans the plugins classpath and loads any DTFJPlugins found- Throws:
CommandException
- if any location on the plugins search path does not existDDRInteractiveCommandException
-
hasCommandIFace
protected boolean hasCommandIFace(Class<?> clazz)
Check to see if a class implements the command interface- Parameters:
clazz
- class to test- Returns:
- true if the interface is implemented, false if not
-
getPlugins
public ArrayList<PluginConfig> getPlugins()
-
getPluginFailures
public ArrayList<PluginConfig> getPluginFailures()
-
findClass
public Class<?> findClass(String className) throws ClassNotFoundException
Searches for and loads a class from the plugins search path.- Overrides:
findClass
in classClassLoader
- Parameters:
className
- String the name of the class to search for.- Returns:
- the loaded class or null
- Throws:
ClassNotFoundException
- always, unless overridden.
-
addCommandClass
public void addCommandClass(String className)
-
removeCommandClass
public void removeCommandClass(String className)
-
-