if (registry.getComponent(name) != null) {
context.err.println("Another component with name '" + name + "' is already installed");
return 1;
}
Class<?> pluginClass = null;
PluginRepository plugins = (PluginRepository) registry.getComponent("pluginRepository");
try {
try {
pluginClass = plugins != null ? plugins.loadClass(className) :
Class.forName(className);
} catch (ClassNotFoundException e) {
String newClassName = "se.sics.mspsim.plugin." + className;
pluginClass = plugins != null ? plugins.loadClass(newClassName) :
Class.forName(newClassName);
}
Object component = pluginClass.newInstance();
registry.registerComponent(name, component);
return 0;