public class FilesCollection extends LinkedHashMap<String,FileObject> implements Iterable<FileObject>
FileObjects.
By itself, a FilesCollection is fairly naive. If built around an
existing installation, the first action to take after instantiation is often
tryLoadingCollection() - which will then recognize update sites,
etc...
After any updates to the FilesCollection, the write() method
is used to persist configuration state to the db.xml.gz on disk.
To rebuild the FilesCollection after such a modification, use
reloadCollectionAndChecksum(Progress). This will, for example,
provide FileObject instances for newly added update sites that are
not yet installed. To make actual file changes (not just modifications to the
database) you must first stage them with
FileObject.stageForUninstall(FilesCollection) or
FileObject.stageForUpdate(FilesCollection, boolean). At that point,
an Installer can be used to create an
update directory reflecting the staged changes, and apply them if
needed.
Note that which files are incorporated into the FilesCollection is
based on the behavior of the Checksummer.
| Modifier and Type | Class and Description |
|---|---|
static class |
FilesCollection.DependencyMap |
static interface |
FilesCollection.Filter |
static class |
FilesCollection.FilteredIterator |
AbstractMap.SimpleEntry<K,V>, AbstractMap.SimpleImmutableEntry<K,V>| Modifier and Type | Field and Description |
|---|---|
protected List<Conflicts.Conflict> |
conflicts |
static String |
DEFAULT_UPDATE_SITE |
protected Set<FileObject> |
ignoredConflicts |
org.scijava.log.LogService |
log |
| Constructor and Description |
|---|
FilesCollection(File appRoot)
This constructor takes the app root primarily for testing purposes.
|
FilesCollection(org.scijava.log.LogService log,
File appRoot)
This constructor takes the app root primarily for testing purposes.
|
clear, containsValue, entrySet, forEach, getOrDefault, keySet, removeEldestEntry, replaceAll, valuesclone, compute, computeIfAbsent, computeIfPresent, containsKey, isEmpty, merge, putAll, putIfAbsent, remove, replace, replace, sizeequals, hashCodefinalize, getClass, notify, notifyAll, wait, wait, waitforEach, spliteratorcompute, computeIfAbsent, computeIfPresent, containsKey, equals, hashCode, isEmpty, merge, putAll, putIfAbsent, remove, replace, replace, sizepublic static final String DEFAULT_UPDATE_SITE
public final org.scijava.log.LogService log
protected Set<FileObject> ignoredConflicts
protected List<Conflicts.Conflict> conflicts
public FilesCollection(File appRoot)
appRoot - the application base directorypublic FilesCollection(org.scijava.log.LogService log, File appRoot)
log - the log serviceappRoot - the application base directorypublic File getAppRoot()
public UpdateSite addUpdateSite(String name, String url, String sshHost, String uploadDirectory, long timestamp)
public UpdateSite addUpdateSite(UpdateSite site)
protected void addUpdateSite(String name, UpdateSite updateSite)
public void removeUpdateSite(String name)
public void replaceUpdateSites(List<UpdateSite> sites)
@Deprecated public UpdateSite getUpdateSite(String name)
getUpdateSite(String, boolean) insteadpublic UpdateSite getUpdateSite(String name, boolean evenDisabled)
@Deprecated public Collection<String> getUpdateSiteNames()
getUpdateSiteNames(boolean) insteadpublic Collection<String> getUpdateSiteNames(boolean evenDisabled)
public Collection<UpdateSite> getUpdateSites(boolean evenDisabled)
public Collection<String> getSiteNamesToUpload()
public boolean hasUploadableSites()
public boolean hasUpdateSitesChanges()
public void setUpdateSitesChanged(boolean updateSitesChanged)
public int deactivateUpdateSite(UpdateSite site)
site - the site to deactivatepublic void activateUpdateSite(UpdateSite updateSite, Progress progress) throws ParserConfigurationException, IOException, SAXException
updateSite - the update site to activateprogress - the object to display the progressParserConfigurationExceptionIOExceptionSAXExceptionpublic void reReadUpdateSite(String name, Progress progress) throws ParserConfigurationException, IOException, SAXException
public String protocolsMissingUploaders(UploaderService uploaderService, Progress progress)
public Set<GroupAction> getValidActions()
public Set<GroupAction> getValidActions(Iterable<FileObject> selected)
@Deprecated public FileObject.Action[] getActions(FileObject file)
@Deprecated public FileObject.Action[] getActions(Iterable<FileObject> files)
public void read()
throws IOException,
ParserConfigurationException,
SAXException
public void read(File file) throws IOException, ParserConfigurationException, SAXException
public void read(FileInputStream in) throws IOException, ParserConfigurationException, SAXException
public void write()
throws IOException,
SAXException,
TransformerConfigurationException
public FilesCollection clone(Iterable<FileObject> iterable)
public Iterable<FileObject> toUploadOrRemove()
public Iterable<FileObject> toUpload()
public Iterable<FileObject> toUpload(boolean includeMetadataChanges)
public Iterable<FileObject> toUpload(String updateSite)
public Iterable<FileObject> toUninstall()
public Iterable<FileObject> toRemove()
public Iterable<FileObject> toUpdate()
public Iterable<FileObject> upToDate()
public Iterable<FileObject> toInstall()
public Iterable<FileObject> toInstallOrUpdate()
public Iterable<FileObject> notHidden()
public Iterable<FileObject> uninstalled()
public Iterable<FileObject> installed()
public Iterable<FileObject> locallyModified()
public Iterable<FileObject> forUpdateSite(String name)
public Iterable<FileObject> forUpdateSite(String name, boolean includeObsoletes)
public Iterable<FileObject> managedFiles()
public Iterable<FileObject> localOnly()
public Iterable<FileObject> shownByDefault()
public Iterable<FileObject> uploadable()
public Iterable<FileObject> uploadable(boolean assumeModified)
assumeModified - true if we want the potentially uploadable files if
they (or their metadata) were to be changed.public Iterable<FileObject> changes()
public static Iterable<FileObject> filter(FilesCollection.Filter filter, Iterable<FileObject> files)
public static Iterable<FileObject> filter(String search, Iterable<FileObject> files)
public FilesCollection.Filter yes()
public FilesCollection.Filter doesPlatformMatch()
public FilesCollection.Filter is(FileObject.Action action)
public FilesCollection.Filter isNoAction()
public FilesCollection.Filter oneOf(FileObject.Action... actions)
public FilesCollection.Filter is(FileObject.Status status)
public FilesCollection.Filter hasMetadataChanges()
public FilesCollection.Filter isUpdateSite(String updateSite)
public FilesCollection.Filter oneOf(FileObject.Status... states)
public FilesCollection.Filter startsWith(String prefix)
public FilesCollection.Filter startsWith(String... prefixes)
public FilesCollection.Filter endsWith(String suffix)
public FilesCollection.Filter not(FilesCollection.Filter filter)
public FilesCollection.Filter or(FilesCollection.Filter a, FilesCollection.Filter b)
public FilesCollection.Filter and(FilesCollection.Filter a, FilesCollection.Filter b)
public Iterable<FileObject> filter(FilesCollection.Filter filter)
public FileObject getFileFromDigest(String filename, String digest)
public Iterable<String> analyzeDependencies(FileObject file)
public void updateDependencies(FileObject file)
public boolean has(FilesCollection.Filter filter)
public boolean hasChanges()
public boolean hasUploadOrRemove()
public boolean hasForcableUpdates()
public Iterable<FileObject> updateable(boolean evenForcedOnes)
public void markForUpdate(boolean evenForcedUpdates)
public String getURL(FileObject file)
public FilesCollection.DependencyMap getDependencies(boolean overridingOnes)
overridingOnes - whether to include files that override a particular dependencypublic FilesCollection.DependencyMap getDependencies(Iterable<FileObject> files, boolean overridingOnes)
files - the dependenciesoverridingOnes - whether to include files that override a particular dependencypublic void sort()
public String checkConsistency()
public File prefix(FileObject file)
public boolean fileExists(String filename)
public String toString()
toString in class AbstractMap<String,FileObject>@Deprecated public FileObject get(int index)
public void add(FileObject file)
public FileObject get(Object filename)
get in interface Map<String,FileObject>get in class LinkedHashMap<String,FileObject>public FileObject put(String key, FileObject file)
put in interface Map<String,FileObject>put in class HashMap<String,FileObject>public FileObject remove(Object file)
remove in interface Map<String,FileObject>remove in class HashMap<String,FileObject>public Iterator<FileObject> iterator()
iterator in interface Iterable<FileObject>public void tryLoadingCollection()
throws ParserConfigurationException,
SAXException
public String downloadIndexAndChecksum(Progress progress) throws ParserConfigurationException, SAXException
public List<Conflicts.Conflict> getConflicts()
public static String getInstalledVersions(File ijDirectory, Progress progress)
public Collection<String> getProtocols(Iterable<FileObject> selected)
public String platform()
public boolean isActivePlatform(String platform)
public void setActivePlatforms(String... platforms)
Copyright © 2009–2025 ImageJ. All rights reserved.