public final class PluginMap extends Object
Modifier and Type | Class and Description |
---|---|
static class |
PluginMap.Orphan
Enumeration of unclaimed libraries treatment options.
|
Constructor and Description |
---|
PluginMap(Studio application)
Constructs PluginMap by scanning application extension directories.
|
Modifier and Type | Method and Description |
---|---|
PluginMap |
add(Collection<PluginInfo> plugins)
Creates a PluginMap that can be used to download and install the specified plugins.
|
void |
commit(List<LibInfo> libraries)
Installs specified libraries..
|
Map<String,LibInfo> |
getActiveLibraries()
Returns a map of IDs to descriptors for all currently active libraries.
|
Map<String,LibInfo> |
getActiveLibraries(PluginInfo plugin)
Returns a map of IDs to descriptors for currently active libraries claimed by the specified plugin.
|
LibInfo |
getActiveLibrary(LibInfo library)
Returns active library that corresponds to the specified library.
|
Map<String,PluginInfo> |
getActivePlugins()
Returns a map of names to descriptors for all currently active plugins.
|
Set<PluginInfo> |
getDependentPlugins(PluginInfo plugin)
Returns a set of dependents (direct and transient) of the specified plugin.
|
List<LibInfo> |
getDownloads(Collection<LibInfo> libraries,
boolean checkInstalled)
Returns a list of libraries that need to be downloaded to install specified libraries.
|
List<LibInfo> |
getDownloads(Collection<PluginInfo> plugins)
Returns a list of libraries that need to be downloaded to install specified plugins.
|
List<LibInfo> |
getDownloads(Collection<PluginInfo> plugins,
Map<String,PluginInfo> available)
Returns a list of libraries that need to be downloaded to install specified plugins.
|
URL[] |
getExtensionClasspath()
Returns URLs for all active libraries.
|
List<LibInfo> |
getLibraries()
Returns a list of all non-duplicate libraries in this map.
|
Collection<LibInfo> |
getLibraries(PluginDir dir)
Returns a collection of all non-duplicate libraries in the specified directory.
|
LibInfo |
getLibrary(LibInfo library)
Returns installed library that corresponds to the specified library.
|
LibInfo |
getLibrary(String id,
PluginDir dir)
Returns library descriptor for the specified ID and directory.
|
Map<String,PluginInfo> |
getLoadablePlugins()
Returns a map of names to descriptors for all currently active non-broken load-at-start plugins and their dependencies.
|
List<LibInfo> |
getMissingLibraries()
Returns a list of libraries missed by active plugins.
|
PluginInfo |
getPlugin(String name)
Returns active plugin descriptor with the specified name.
|
PluginInfo |
getPlugin(String name,
PluginDir dir)
Returns a plugin descriptor for the specified plugin name and directory.
|
List<PluginInfo> |
getPlugins()
Returns a list of all plugin descriptors in this map.
|
Map<String,PluginInfo> |
getPlugins(PluginDir dir)
Returns a map of plugin names to descriptors in the specified directory.
|
EnumMap<PluginDir,ArrayList<LibInfo>> |
getUnclaimedLibraries()
Returns mapping of extension directories to lists of unclaimed libraries found in those directories.
|
void |
insertPlugins(Collection<PluginInfo> plugins)
Insert specified plugins into this map without downloading or replacing libraries.
|
void |
invalidate()
Clears all secondary data structures.
|
void |
processUnclaimedLibraries(PluginMap.Orphan action)
Creates plugins for unclaimed libraries if necessary,
and sets their properties to ensure that
purge() method will take appropriate action. |
void |
purge()
Purges unused libraries.
|
boolean |
remove(Collection<PluginInfo> plugins)
Removes the specified plugins from this map and deletes (or marks for deletion) the files that are no longer needed.
|
void |
scan()
Scans all extension directories and constructs primary data structures in this map.
|
public PluginMap(Studio application)
public void scan()
public void insertPlugins(Collection<PluginInfo> plugins)
public void processUnclaimedLibraries(PluginMap.Orphan action)
purge()
method will take appropriate action.public PluginMap add(Collection<PluginInfo> plugins)
#getDownloads()
.
Once the files are downloaded, it can be passed to the master map's #commit()
method to install or update the plugins.
plugins
- Collection of plugins to be installed.
Must contain all required dependencies.public void commit(List<LibInfo> libraries)
update
- public boolean remove(Collection<PluginInfo> plugins)
plugins
- Collection of plugins to be removed.
Should not contain dependencies of other plugins - no checking is done by this method.public void purge()
public void invalidate()
public Map<String,PluginInfo> getActivePlugins()
public Map<String,PluginInfo> getLoadablePlugins()
public Map<String,LibInfo> getActiveLibraries()
public List<LibInfo> getMissingLibraries()
public Map<String,LibInfo> getActiveLibraries(PluginInfo plugin)
IllegalArgumentException
- if there is no active library to satisfy the plugin's requirements.public LibInfo getActiveLibrary(LibInfo library)
library
- Library descriptor, typically part of a plugin descriptor.public URL[] getExtensionClasspath()
public List<PluginInfo> getPlugins()
public Map<String,PluginInfo> getPlugins(PluginDir dir)
public PluginInfo getPlugin(String name)
public PluginInfo getPlugin(String name, PluginDir dir)
public List<LibInfo> getLibraries()
public Collection<LibInfo> getLibraries(PluginDir dir)
public LibInfo getLibrary(String id, PluginDir dir)
public LibInfo getLibrary(LibInfo library)
library
- Library descriptor, typically part of a plugin descriptor.public Set<PluginInfo> getDependentPlugins(PluginInfo plugin)
public EnumMap<PluginDir,ArrayList<LibInfo>> getUnclaimedLibraries()
public List<LibInfo> getDownloads(Collection<PluginInfo> plugins, Map<String,PluginInfo> available)
This method should be called on the application master map, which is not modified as a result of the call.
plugins
- Collection of plugins to be installed.available
- Collection of plugins available for download.public List<LibInfo> getDownloads(Collection<PluginInfo> plugins)
This method should be called on the application master map, which is not modified as a result of the call.
plugins
- Collection of plugins to be installed.public List<LibInfo> getDownloads(Collection<LibInfo> libraries, boolean checkInstalled)
libraries
- List of libraries to download. Objects from this list will not be modified.checkInstalled
- If true, only libraries that do not have same of newer version already installed will be included.Copyright © 2000–2017 FreeHEP. All rights reserved.