des.getApplicationBundle().setType(ExtensionBundle.TYPE_PENDING_INSTALLATION);
newPluginsFound = true;
}
}
if (newPluginsFound) {
GlobalWarningManager.getInstance().addMultipleGlobalWarning(new GlobalWarning(GlobalWarning.MANAGEMENT_USERS, new BundleActionMessage("extensions",
"extensionStore.message.pluginInstalledRestartRequired"), DismissType.DISMISS_FOR_USER));
}
// Look for new extensions
Map newLoadedExtensions = getLoadedExtensions();
// Look for extension updates
File updatedExtensionsDir = ExtensionStore.getInstance().getUpdatedExtensionsDirectory();
boolean updatesFound = false;
for (Iterator i = newLoadedExtensions.entrySet().iterator(); i.hasNext();) {
Map.Entry ent = (Map.Entry) i.next();
if (new File(updatedExtensionsDir, (String) ent.getKey()).exists()) {
final ExtensionBundle bundle = (ExtensionBundle) ent.getValue();
for (Iterator j = bundle.iterator(); j.hasNext();) {
ExtensionDescriptor des = (ExtensionDescriptor) j.next();
des.getApplicationBundle().setType(ExtensionBundle.TYPE_PENDING_UPDATE);
}
updatesFound = true;
}
}
if (updatesFound) {
GlobalWarningManager.getInstance().addMultipleGlobalWarning(new GlobalWarning(GlobalWarning.MANAGEMENT_USERS, new BundleActionMessage("extensions",
"extensionStore.message.extensionUpdatedRestartRequired"), DismissType.DISMISS_FOR_USER));
}
// Check for new extensions
for (Iterator i = newLoadedExtensions.entrySet().iterator(); i.hasNext();) {
Map.Entry ent = (Map.Entry) i.next();
if (!currentlyLoadedExtensions.containsKey(ent.getKey())) {
final ExtensionBundle bundle = (ExtensionBundle) ent.getValue();
// If installing, there may be a license agreement to handle
File licenseFile = bundle.getLicenseFile();
if (licenseFile != null && licenseFile.exists()) {
final boolean fNewPluginsFound = newPluginsFound;
CoreUtil.requestLicenseAgreement(request.getSession(), new LicenseAgreement(bundle.getName(),
licenseFile,
new LicenseAgreementCallback() {
public void licenseAccepted(HttpServletRequest request) {
// Dont care
}
public void licenseRejected(HttpServletRequest request) {
try {
ExtensionStore.getInstance().removeExtensionBundle(bundle);
} catch (Exception e) {
}
if (fNewPluginsFound) {
GlobalWarningManager.getInstance().removeGlobalWarning(request.getSession(),
"extensionStore.message.pluginInstalledRestartRequired");
GlobalWarningManager.getInstance().addMultipleGlobalWarning(new GlobalWarning(GlobalWarning.MANAGEMENT_USERS,
new BundleActionMessage("extensions",
"extensionStore.message.pluginLicenseRejectedRestartRequired"), DismissType.DISMISS_FOR_USER));
}
}
},