ClassPath classPath = classPathFactory.create();
ClassLoaderScope loaderScope = parent.createChild();
loaderScope.local(classPath);
loaderScope.lock();
PluginRegistry pluginRegistry = new DefaultPluginRegistry(pluginInspector, loaderScope.getLocalClassLoader());
PotentialPluginWithId lookup = pluginRegistry.lookup(pluginId.toString());
if (lookup == null) {
throw new UnknownPluginException("Plugin with id '" + pluginId + "' not found.");
}
return lookup.asClass();