return metadataHandler;
}
// Modules
protected void configureModules() throws ConfigurationException {
Module module;
// _todo: use this style of configuration whereever we have enumerations, like the site-commands and the event-handlers
// actually, NO, we're not going to use the .getNode() and then iterate over them approach, because we can't get named access to any nodes, which is utterly useless.
// Node modulesNode = settings.getNode("/modules");
// The only thing we get that kind of access from is an attribute list
String moduleName;
try {
int i = 1;
String clazz;
boolean active;
while(true) {
// loop over the sections in the file
moduleName = settings.get("/modules/module[" + i + "]/name");
if (moduleName == null || "".equals(moduleName)) {
break;
}
clazz = settings.get("/modules/module[" + i + "]/class");
active = settings.getBoolean("/modules/module[" + i + "]/active");
if (active) {
// use a custom class loader to load the file, in case we are using classes from another jar.
Class c = customClassLoader.loadClass(clazz);
if (Module.class.isAssignableFrom(c)) {
module = (Module)c.newInstance();
module.initialize(new XMLSettings(settings.getNode("/modules/module[" + i + "]/settings")));
module.registerActions(siteCommandHandler);
module.registerEventHandlers(eventHandler);
modules.put(moduleName, module);
} else {
throw new ConfigurationException("Class " + clazz + " does not implement interface " + Module.class.toString());
}
}