@@ -367,6 +367,13 @@ public void unloadAllPlugins() {
367
367
}
368
368
}
369
369
370
+ /**
371
+ * Wrapper around the class loading. Report all exceptions into the log.
372
+ *
373
+ * @param classname full name of the class
374
+ *
375
+ * @see #loadClass(String)
376
+ */
370
377
private void handleLoadClass (String classname ) {
371
378
try {
372
379
loadClass (classname );
@@ -383,6 +390,24 @@ private void handleLoadClass(String classname) {
383
390
}
384
391
}
385
392
393
+ /**
394
+ * Load a class into JVM with custom class loader. Call a non-parametric
395
+ * constructor to create a new instance of that class.
396
+ *
397
+ * <p>
398
+ * The classes implementing the {@link IAuthorizationPlugin} interface are
399
+ * automatically added among the discovered plugins.
400
+ * </p>
401
+ *
402
+ * @param classname the full name of the class to load
403
+ *
404
+ * @throws ClassNotFoundException when the class can not be found
405
+ * @throws SecurityException when it is prohibited to load such class
406
+ * @throws InstantiationException when it is impossible to create a new
407
+ * instance of that class
408
+ * @throws IllegalAccessException when the constructor of the class is not
409
+ * accessible
410
+ */
386
411
private void loadClass (String classname ) throws ClassNotFoundException ,
387
412
SecurityException ,
388
413
InstantiationException ,
@@ -409,6 +434,19 @@ private void loadClass(String classname) throws ClassNotFoundException,
409
434
}
410
435
}
411
436
437
+ /**
438
+ * Traverse list of files which possibly contain a java class and then
439
+ * traverse a list of jar files to load all classes which are contained
440
+ * within them. Each class is loaded with {@link #handleLoadClass(String)}
441
+ * which delegates the loading to the custom class loader
442
+ * {@link #loadClass(String)}.
443
+ *
444
+ * @param classfiles list of files which possibly contain a java class
445
+ * @param jarfiles list of jar files containing java classes
446
+ *
447
+ * @see #handleLoadClass(String)
448
+ * @see #loadClass(String)
449
+ */
412
450
private void loadClasses (List <File > classfiles , List <File > jarfiles ) {
413
451
for (File file : classfiles ) {
414
452
String classname = getClassName (file );
0 commit comments