ContainerManagerInterface Class

A plugin interface for custom container solutions. More...

Header: #include <ContainerManagerInterface>

Public Functions

virtual ContainerInterface *create(bool isQuickLaunch, const QVector<int> &stdioRedirections, const QMap<QString, QString> &debugWrapperEnvironment, const QStringList &debugWrapperCommand) = 0
virtual QString identifier() const = 0
virtual bool initialize(ContainerHelperFunctions *helpers)
virtual void setConfiguration(const QVariantMap &configuration) = 0
virtual bool supportsQuickLaunch() const = 0

Detailed Description

This is the interface that you have to implement, if you want to get your own custom container solution into the application manager.

For an example, please see examples/software-container. This example shows the integration of Pelagicore's SoftwareContainers (which are essentially nice-to-use LXC wrappers).

Member Function Documentation

[pure virtual] ContainerInterface *ContainerManagerInterface::create(bool isQuickLaunch, const QVector<int> &stdioRedirections, const QMap<QString, QString> &debugWrapperEnvironment, const QStringList &debugWrapperCommand)

The application manager will call this function every time it needs to create a specific container for a direct application launch, or a runtime quick-launcher (depending on the value of the isQuickLaunch parameter).

If the stdioRedirections vector is not empty, the plugin should - if possible - redirect standard-io streams: the vector can have 3 entries at most, with the index corresponding to the Unix standard-io file number (0: stdin, 1: stdout and 2: stderr). The values in this vector are either open OS file descriptors for redirections or -1. [-1, 5, 5] would mean: ignore stdin and redirect both stdout and stderr to fd 5.

The ownership of these file descriptors is transferred if, and only if, a new ContainerInterface is successfully instantiated (i.e. the return value is not nullptr). They then have to be closed either immediately, in case this plugin is not able to use them, or latest, when the started application has finished.

The debugWrapperEnvironment is an optional string map for environment variables and their values, if a debug-wrapper is to be used (the debugWrapperCommand is not empty - see below). An empty value in this map means, that the environment variable denoted by its key shall be unset.

In case the debugWrapperCommand is not empty, the plugin is requested to execute the binary set by ContainterInterface::setProgram using this debug-wrapper. The plugin is responsible for combining both and for handling the replacement of %program% and %arguments%. See the debug-wrapper documentation for more information.

[pure virtual] QString ContainerManagerInterface::identifier() const

Should return the unique identifier string for this container plugin.

[virtual] bool ContainerManagerInterface::initialize(ContainerHelperFunctions *helpers)

This function is called by the application manager right after your plugin has been loaded, your interface has been instantiated and the configuration was set via setConfiguration.

The helpers interface gives you access to common functionality that can be shared between different container plugin implementations. The pointer is owned by the application manager and is valid during the lifetime of the interface.

Return true if your plugin is usable, given its configuration and system state. If not, then return false and the application manager will disable this container plugin.

[pure virtual] void ContainerManagerInterface::setConfiguration(const QVariantMap &configuration)

Called by the application manager after parsing its configuration files. The configuration map corresponds to the (optional) container specific configuration as described in the container documentation.

[pure virtual] bool ContainerManagerInterface::supportsQuickLaunch() const

Expected to return true if the interface has support for quick-launching or false otherwise.

© 2023 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.