Additional log on plug-in self-registration and failures.

Whenever a new class is self-registered from a plug-in
additional INFO message is displayed with class name
and listener / exported interface.

Additionally when a Listener fails to get created
from injection into a DynamicSet, an error is logged
allowing the plug-in developer to understand what
was the problem.

Without this patch, you may see your plus-in loading
correctly but then the listeners being discarded
silently and you would spend a lot of time figuring
out where the problem was.

Change-Id: Ief3d3c5a3012136f73296a3afa5c85c22fc38bb7
This commit is contained in:
Luca Milanesio
2012-06-24 21:39:39 +01:00
parent 9d92e48ab0
commit c0732b1301
3 changed files with 15 additions and 1 deletions

View File

@@ -192,10 +192,12 @@ class AutoRegisterModules {
if (is("org.apache.sshd.server.Command", clazz)) {
if (sshGen != null) {
PluginLoader.log.info("Exporting " + clazz + " as SSH Command");
sshGen.export(export, clazz);
}
} else if (is("javax.servlet.http.HttpServlet", clazz)) {
if (httpGen != null) {
PluginLoader.log.info("Exporting " + clazz + " as HTTP Servlet");
httpGen.export(export, clazz);
listen(clazz, clazz);
}
@@ -247,6 +249,7 @@ class AutoRegisterModules {
TypeLiteral<?> tl = TypeLiteral.get(type);
if (env.hasDynamicSet(tl)) {
sysSingletons.add(clazz);
PluginLoader.log.info("Registering " + clazz + " to listener " + tl);
sysListen.put(tl, clazz);
} else if (env.hasDynamicMap(tl)) {
if (clazz.getAnnotation(Export.class) == null) {
@@ -255,6 +258,7 @@ class AutoRegisterModules {
clazz.getName(), rawType.getName()));
}
sysSingletons.add(clazz);
PluginLoader.log.info("Registering " + clazz + " to listener " + tl);
sysListen.put(tl, clazz);
} else {
throw new InvalidPluginException(String.format(