*/
public Object initializeModule(String modName, ModuleRegistry.ModuleType type,
Context cx, Scriptable scope)
throws InvocationTargetException, InstantiationException, IllegalAccessException
{
NodeModule mod;
switch (type) {
case PUBLIC:
mod = registry.get(modName);
break;
case INTERNAL:
mod = registry.getInternal(modName);
break;
case NATIVE:
mod = registry.getNative(modName);
break;
default:
throw new AssertionError();
}
if (mod == null) {
return null;
}
Object exp = mod.registerExports(cx, scope, this);
if (exp == null) {
throw new AssertionError("Module " + modName + " returned a null export");
}
return exp;
}