setInstallRoot(installRoot);
File addonDir = new File(installRoot, ADDONS);
File[] files =
addonDir.listFiles(new InstallerFileFilter(addonName));
if (files == null || files.length == 0 ) {
throw new AddonFatalException
(localStrings.getString("addon.installernotfound", addonName));
}
if (files.length > 1 ) {
throw new AddonFatalException
(localStrings.getString("addon.morethanoneinstaller", addonName));
}
String service = findApiBasedService(new JarFile(files[0]));
if (service != null) {
Object obj =
createClassLoader(files[0].toURI().toURL()).
loadClass(service).newInstance();
_uninstall(obj, addonName);
} else {
throw new AddonFatalException
(localStrings.getString("addon.servicenotfound",
addonName, getServiceInterface()));
}
} catch (Exception e) {
throw new AddonFatalException(e);
}
}