private void markForUpdate(final String updateSite, final boolean evenForcedUpdates) { for (final FileObject file : forUpdateSite(updateSite)) { if ((file.isUpdateable(evenForcedUpdates) || file.getStatus().isValid(Action.INSTALL)) && file.isUpdateablePlatform(this)) { file.setFirstValidAction(this, Action.UPDATE, Action.UNINSTALL, Action.INSTALL); } } }
void addDependencies(final FileObject file, final DependencyMap map, final boolean overriding) { for (final Dependency dependency : file.getDependencies()) { final FileObject other = get(dependency.filename); if (other == null || overriding != dependency.overrides || !other.isUpdateablePlatform(this)) continue; if (other.isObsolete() && other.willNotBeInstalled()) { log.warn("Ignoring obsolete dependency " + dependency.filename + " of " + file.filename); continue; } if (dependency.overrides) { if (other.willNotBeInstalled()) continue; } else if (other.willBeUpToDate()) continue; if (!map.add(other, file)) continue; // overriding dependencies are not recursive if (!overriding) addDependencies(other, map, overriding); } }
public String downloadIndexAndChecksum(final Progress progress) throws ParserConfigurationException, SAXException { try { read(); } catch (final FileNotFoundException e) { if (prefix("plugins/Fiji_Updater.jar").exists()) { // make sure that the Fiji update site is enabled UpdateSite fiji = getUpdateSite("Fiji", true); if (fiji == null) { addUpdateSite("Fiji", "http://fiji.sc/update/", null, null, 0); } } } catch (final IOException e) { /* ignore */ } // clear the files clear(); final XMLFileDownloader downloader = new XMLFileDownloader(this); downloader.addProgress(progress); try { downloader.start(false); } catch (final UpdateCanceledException e) { downloader.done(); throw e; } new Checksummer(this, progress).updateFromLocal(); // When upstream fixed dependencies, heed them for (final FileObject file : upToDate()) { for (final FileObject dependency : file.getFileDependencies(this, false)) { if (dependency.getAction() == Action.NOT_INSTALLED && dependency.isUpdateablePlatform(this)) { dependency.setAction(this, Action.INSTALL); } } } return downloader.getWarnings(); }