Skip to content

Commit bedf022

Browse files
committed
adding a comment to class loading
1 parent 206a1d0 commit bedf022

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed

src/org/opensolaris/opengrok/authorization/AuthorizationFramework.java

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -367,6 +367,13 @@ public void unloadAllPlugins() {
367367
}
368368
}
369369

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+
*/
370377
private void handleLoadClass(String classname) {
371378
try {
372379
loadClass(classname);
@@ -383,6 +390,24 @@ private void handleLoadClass(String classname) {
383390
}
384391
}
385392

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+
*/
386411
private void loadClass(String classname) throws ClassNotFoundException,
387412
SecurityException,
388413
InstantiationException,
@@ -409,6 +434,19 @@ private void loadClass(String classname) throws ClassNotFoundException,
409434
}
410435
}
411436

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+
*/
412450
private void loadClasses(List<File> classfiles, List<File> jarfiles) {
413451
for (File file : classfiles) {
414452
String classname = getClassName(file);

0 commit comments

Comments
 (0)