public void loadClass ( String className ) throws Exception { ClassInformation classInfo = classInformation . get ( className ) ; logger . info ( "Loading plugin.: {}, {}" , className , classInfo . pluginPath ) ; // get URL for proxylib // need to load this also otherwise the annotations cannot be found later on File libFile = new File ( proxyLibPath ) ; URL libUrl = libFile . toURI ( ) . toURL ( ) ; // store the last modified time of the plugin File pluginDirectoryFile = new File ( classInfo . pluginPath ) ; classInfo . lastModified = pluginDirectoryFile . lastModified ( ) ; // load the plugin directory URL classURL = new File ( classInfo . pluginPath ) . toURI ( ) . toURL ( ) ; URL [ ] urls = new URL [ ] { classURL } ; URLClassLoader child = new URLClassLoader ( urls , this . getClass ( ) . getClassLoader ( ) ) ; // load the class Class < ? > cls = child . loadClass ( className ) ; // put loaded class into classInfo classInfo . loadedClass = cls ; classInfo . loaded = true ; classInformation . put ( className , classInfo ) ; logger . info ( "Loaded plugin: {}, {} method(s)" , cls . toString ( ) , cls . getDeclaredMethods ( ) . length ) ; }
Loads the specified class name and stores it in the hash