com.ibm.di.loader
Class DynamicClassLoader

java.lang.Object
  extended by java.lang.ClassLoader
      extended by java.security.SecureClassLoader
          extended by java.net.URLClassLoader
              extended by com.ibm.di.loader.DynamicClassLoader

public class DynamicClassLoader
extends URLClassLoader

This is a URL Class Loader that dynamically loads TDI Jars files and resources from the URLs specified. The difference with the pre-TDI 7.1 class loader is that this loader first lets the child find the specified class and then refer to its parent.

Since:
7.1

Constructor Summary
DynamicClassLoader(URL[] urls)
          Constructor
DynamicClassLoader(URL[] urls, ClassLoader parent)
          Constructor
DynamicClassLoader(URL[] urls, ClassLoader parent, URLStreamHandlerFactory factory)
          Constructor
 
Method Summary
 URL getResource(String name)
          
protected  Class<?> loadClass(String name, boolean resolve)
          
protected static void scanDirectoryForJarsRecursively(File searchDir, List<URL> bufferList)
          Search for Jar files in the specified directory.
 
Methods inherited from class java.net.URLClassLoader
addURL, definePackage, findClass, findResource, findResources, getPermissions, getURLs, newInstance, newInstance
 
Methods inherited from class java.security.SecureClassLoader
defineClass, defineClass
 
Methods inherited from class java.lang.ClassLoader
clearAssertionStatus, defineClass, defineClass, defineClass, defineClass, definePackage, findLibrary, findLoadedClass, findSystemClass, getPackage, getPackages, getParent, 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
 

Constructor Detail

DynamicClassLoader

public DynamicClassLoader(URL[] urls)
Constructor

Parameters:
urls - the URLs from which to load classes and resources

DynamicClassLoader

public DynamicClassLoader(URL[] urls,
                          ClassLoader parent)
Constructor

Parameters:
urls - the URLs from which to load classes and resources
parent - The parent class loader.

DynamicClassLoader

public DynamicClassLoader(URL[] urls,
                          ClassLoader parent,
                          URLStreamHandlerFactory factory)
Constructor

Parameters:
urls - the URLs from which to load classes and resources
parent - The parent class loader.
factory - the URLStreamHandlerFactory to use when creating URLs
Method Detail

loadClass

protected Class<?> loadClass(String name,
                             boolean resolve)
                      throws ClassNotFoundException

Overrides:
loadClass in class ClassLoader
Throws:
ClassNotFoundException

getResource

public URL getResource(String name)

Overrides:
getResource in class ClassLoader

scanDirectoryForJarsRecursively

protected static void scanDirectoryForJarsRecursively(File searchDir,
                                                      List<URL> bufferList)
Search for Jar files in the specified directory. Sub-directories are considered, too.

Parameters:
searchDir - directory to search at.
bufferList - List to update with URLs of the Jars