Skip to content

Instantly share code, notes, and snippets.

@NicoKiaru
Last active January 14, 2022 14:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save NicoKiaru/ec7022acf1967e89e14880a7b8b7d911 to your computer and use it in GitHub Desktop.
Save NicoKiaru/ec7022acf1967e89e14880a7b8b7d911 to your computer and use it in GitHub Desktop.
How to investigate the list of Update Sites enabled #BIOP #Fiji #UpdateSites
/**
* Simple script demoing how to check if an update site is enabled
* and how to list all enabled update sites
*
* @author Nicolas Chiaruttini
* BIOP, EPFL, 2022
**/
#@UpdateService updateService
// To check if an update site is enabled:
if (!updateService.getUpdateSite("Fiji-Legacy").isActive()) {
println("Fiji-legacy is NOT enabled")
} else {
println("Fiji-Legacy is enabled")
}
if (!updateService.getUpdateSite("PTBIOP").isActive()) {
println("PTBIOP is NOT enabled")
} else {
println("PTBIOP is enabled")
}
// Get the list of all update sites:
def Map<String, UpdateSite> sites = AvailableSites.getAvailableSites();
StringBuilder enable_sites_string = new StringBuilder();
sites.values().stream()
.filter(site -> updateService.getUpdateSite(site.getName()).isActive())
.forEach(site -> {
enable_sites_string.append("\t"+site.getName()+"\t"+site.getURL()+"\n");
});
println("Update sites enabled:")
println(enable_sites_string)
import net.imagej.updater.UpdateService
import net.imagej.updater.UpdateSite
import net.imagej.updater.util.AvailableSites
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment