OpenCPN Partial API docs
|
Handle plugin install from remote repositories and local operations to Uninstall and list plugins. More...
#include <plugin_handler.h>
Public Member Functions | |
PluginHandler (const PluginHandler &)=delete | |
PluginHandler & | operator= (const PluginHandler &)=delete |
bool | IsPluginWritable (std::string name) |
Check if given plugin can be installed/updated. | |
const std::vector< PluginMetadata > | GetInstalled () |
Return list of all installed and loaded plugins. | |
std::vector< std::string > | GetInstalldataPlugins () |
Return list of installed plugins lower case names, not necessarily loaded. | |
void | SetInstalledMetadata (const PluginMetadata &pm) |
Set metadata for an installed plugin. | |
const std::vector< PluginMetadata > | GetAvailable () |
Update catalog and return list of available, not installed plugins. | |
std::vector< PluginMetadata > | getCompatiblePlugins () |
Return list of available, unique and compatible plugins from configured XML catalog. | |
const std::map< std::string, int > | GetCountByTarget () |
Map of available plugin targets -> number of occurences. | |
std::string | GetPluginByLibrary (const std::string &filename) |
Return plugin containing given filename or "" if not found. | |
std::string | GetMetadataPath () |
Return path to metadata XML file. | |
std::string | GetUserMetadataPath () |
Return path to user, writable metadata XML file. | |
void | setMetadata (std::string path) |
Set path to metadata XML file. | |
bool | InstallPlugin (PluginMetadata plugin) |
Download and install a new, not installed plugin. | |
bool | InstallPlugin (PluginMetadata plugin, std::string path) |
Install a new, downloaded but not installed plugin tarball. | |
bool | ExtractMetadata (const std::string &path, PluginMetadata &metadata) |
Extract metadata in given tarball path. | |
bool | InstallPlugin (const std::string &path) |
bool | Uninstall (const std::string plugin) |
Uninstall an installed and loaded plugin. | |
bool | ClearInstallData (const std::string plugin_name) |
Remove installation data for not loaded plugin. | |
bool | InstallPluginFromCache (PluginMetadata plugin) |
Install plugin tarball from local cache. | |
CatalogData * | GetCatalogData () |
Static Public Member Functions | |
static PluginHandler * | GetInstance () |
Singleton factory. | |
static void | Cleanup (const std::string &filelist, const std::string &plugname) |
Cleanup failed installation attempt using filelist for plugin. | |
static void | CleanupFiles (const std::string &manifestFile, const std::string &plugname) |
static std::string | PluginsInstallDataPath () |
Return base directory for installation data. | |
static std::string | FileListPath (std::string name) |
Return path to installation manifest for given plugin. | |
static std::string | VersionPath (std::string name) |
Return path to file containing version for given plugin. | |
static std::string | ImportedMetadataPath (std::string name) |
Return path to imported metadata for given plugin. | |
static std::vector< std::string > | GetImportPaths () |
List of paths for imported plugins metadata. | |
static bool | IsCompatible (const PluginMetadata &metadata, const char *os=PKG_TARGET, const char *os_version=PKG_TARGET_VERSION) |
Return true if given plugin is loadable on given os/version. | |
Public Attributes | |
EventVar | evt_download_ok |
Notified with plugin name + version string after successful download from repository. | |
EventVar | evt_download_failed |
Notified with plugin name after failed download attempt. | |
Handle plugin install from remote repositories and local operations to Uninstall and list plugins.
The plugin maintains an internal list and is a singleton.
Remote repositories are based on XML files describing metadata and addresses to tarballs with compiled and installed files, basically under there different directories.
The compiled plugins are installed to user-writable location(s)
However, plugins are loaded from multiple locations basically corresponding to new and old lacations:
Definition at line 87 of file plugin_handler.h.
|
protected |
Definition at line 373 of file plugin_handler.cpp.
|
static |
Cleanup failed installation attempt using filelist for plugin.
Definition at line 1103 of file plugin_handler.cpp.
|
static |
Definition at line 1074 of file plugin_handler.cpp.
bool PluginHandler::ClearInstallData | ( | const std::string | plugin_name | ) |
Remove installation data for not loaded plugin.
Definition at line 1292 of file plugin_handler.cpp.
bool PluginHandler::ExtractMetadata | ( | const std::string & | path, |
PluginMetadata & | metadata | ||
) |
Extract metadata in given tarball path.
Definition at line 1257 of file plugin_handler.cpp.
|
static |
Return path to installation manifest for given plugin.
Definition at line 428 of file plugin_handler.cpp.
const std::vector< PluginMetadata > PluginHandler::GetAvailable | ( | ) |
Update catalog and return list of available, not installed plugins.
Definition at line 1153 of file plugin_handler.cpp.
|
inline |
Definition at line 190 of file plugin_handler.h.
std::vector< PluginMetadata > PluginHandler::getCompatiblePlugins | ( | ) |
Return list of available, unique and compatible plugins from configured XML catalog.
Compare two PluginMetadata objects, a named c++ requirement.
Definition at line 1130 of file plugin_handler.cpp.
const std::map< std::string, int > PluginHandler::GetCountByTarget | ( | ) |
Map of available plugin targets -> number of occurences.
Definition at line 1051 of file plugin_handler.cpp.
|
static |
List of paths for imported plugins metadata.
Definition at line 1070 of file plugin_handler.cpp.
std::vector< std::string > PluginHandler::GetInstalldataPlugins | ( | ) |
Return list of installed plugins lower case names, not necessarily loaded.
Definition at line 1170 of file plugin_handler.cpp.
const std::vector< PluginMetadata > PluginHandler::GetInstalled | ( | ) |
Return list of all installed and loaded plugins.
Definition at line 1181 of file plugin_handler.cpp.
|
static |
Singleton factory.
Definition at line 947 of file plugin_handler.cpp.
std::string PluginHandler::GetMetadataPath | ( | ) |
Return path to metadata XML file.
Definition at line 1036 of file plugin_handler.cpp.
std::string PluginHandler::GetPluginByLibrary | ( | const std::string & | filename | ) |
Return plugin containing given filename or "" if not found.
Definition at line 1473 of file plugin_handler.cpp.
std::string PluginHandler::GetUserMetadataPath | ( | ) |
Return path to user, writable metadata XML file.
Definition at line 1045 of file plugin_handler.cpp.
|
static |
Return path to imported metadata for given plugin.
Definition at line 438 of file plugin_handler.cpp.
bool PluginHandler::InstallPlugin | ( | const std::string & | path | ) |
Definition at line 1248 of file plugin_handler.cpp.
bool PluginHandler::InstallPlugin | ( | PluginMetadata | plugin | ) |
Download and install a new, not installed plugin.
Definition at line 1232 of file plugin_handler.cpp.
bool PluginHandler::InstallPlugin | ( | PluginMetadata | plugin, |
std::string | path | ||
) |
Install a new, downloaded but not installed plugin tarball.
Definition at line 1216 of file plugin_handler.cpp.
bool PluginHandler::InstallPluginFromCache | ( | PluginMetadata | plugin | ) |
Install plugin tarball from local cache.
Definition at line 1483 of file plugin_handler.cpp.
|
static |
Return true if given plugin is loadable on given os/version.
Definition at line 375 of file plugin_handler.cpp.
bool PluginHandler::IsPluginWritable | ( | std::string | name | ) |
Check if given plugin can be installed/updated.
Definition at line 955 of file plugin_handler.cpp.
|
static |
Return base directory for installation data.
Definition at line 186 of file plugin_handler.cpp.
void PluginHandler::SetInstalledMetadata | ( | const PluginMetadata & | pm | ) |
Set metadata for an installed plugin.
Definition at line 1207 of file plugin_handler.cpp.
|
inline |
Set path to metadata XML file.
Definition at line 167 of file plugin_handler.h.
bool PluginHandler::Uninstall | ( | const std::string | plugin | ) |
Uninstall an installed and loaded plugin.
Definition at line 1330 of file plugin_handler.cpp.
|
static |
Return path to file containing version for given plugin.
Definition at line 433 of file plugin_handler.cpp.
EventVar PluginHandler::evt_download_failed |
Notified with plugin name after failed download attempt.
Definition at line 102 of file plugin_handler.h.
EventVar PluginHandler::evt_download_ok |
Notified with plugin name + version string after successful download from repository.
Definition at line 99 of file plugin_handler.h.