Class DynamicClassLoader

  • All Implemented Interfaces:
    java.io.Closeable, java.lang.AutoCloseable

    public class DynamicClassLoader
    extends java.net.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

      Constructors 
      Constructor Description
      DynamicClassLoader​(java.net.URL[] urls)
      Constructor
      DynamicClassLoader​(java.net.URL[] urls, java.lang.ClassLoader parent)
      Constructor
      DynamicClassLoader​(java.net.URL[] urls, java.lang.ClassLoader parent, java.net.URLStreamHandlerFactory factory)
      Constructor
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.net.URL getResource​(java.lang.String name)
      protected java.lang.Class<?> loadClass​(java.lang.String name, boolean resolve)
      protected static void scanDirectoryForJarsRecursively​(java.io.File searchDir, java.util.List<java.net.URL> bufferList)
      Search for Jar files in the specified directory.
      • Methods inherited from class java.net.URLClassLoader

        addURL, close, definePackage, findClass, findResource, findResources, getPermissions, getResourceAsStream, getURLs, newInstance, newInstance
      • Methods inherited from class java.security.SecureClassLoader

        defineClass, defineClass
      • Methods inherited from class java.lang.ClassLoader

        clearAssertionStatus, clone, defineClass, defineClass, defineClass, defineClass, definePackage, findClass, findLibrary, findLoadedClass, findResource, findSystemClass, getClassLoadingLock, getDefinedPackage, getDefinedPackages, getName, getPackage, getPackages, getParent, getPlatformClassLoader, getResources, getSystemClassLoader, getSystemResource, getSystemResourceAsStream, getSystemResources, getUnnamedModule, isRegisteredAsParallelCapable, loadClass, registerAsParallelCapable, resolveClass, resources, setClassAssertionStatus, setDefaultAssertionStatus, setPackageAssertionStatus, setSigners
      • Methods inherited from class java.lang.Object

        equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • DynamicClassLoader

        public DynamicClassLoader​(java.net.URL[] urls)
        Constructor
        Parameters:
        urls - the URLs from which to load classes and resources
      • DynamicClassLoader

        public DynamicClassLoader​(java.net.URL[] urls,
                                  java.lang.ClassLoader parent)
        Constructor
        Parameters:
        urls - the URLs from which to load classes and resources
        parent - The parent class loader.
      • DynamicClassLoader

        public DynamicClassLoader​(java.net.URL[] urls,
                                  java.lang.ClassLoader parent,
                                  java.net.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 java.lang.Class<?> loadClass​(java.lang.String name,
                                               boolean resolve)
                                        throws java.lang.ClassNotFoundException
        Overrides:
        loadClass in class java.lang.ClassLoader
        Throws:
        java.lang.ClassNotFoundException
      • getResource

        public java.net.URL getResource​(java.lang.String name)
        Overrides:
        getResource in class java.lang.ClassLoader
      • scanDirectoryForJarsRecursively

        protected static void scanDirectoryForJarsRecursively​(java.io.File searchDir,
                                                              java.util.List<java.net.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