An interface for custom container instances. More...
|virtual bool||attachApplication(const QVariantMap &application) = 0|
|virtual QString||controlGroup() const = 0|
|virtual bool||isReady() const = 0|
|virtual void||kill() = 0|
|virtual QString||mapContainerPathToHost(const QString &containerPath) const = 0|
|virtual QString||mapHostPathToContainer(const QString &hostPath) const = 0|
|virtual qint64||processId() const = 0|
|virtual void||setBaseDirectory(const QString &baseDirectory) = 0|
|virtual bool||setControlGroup(const QString &groupName) = 0|
|virtual bool||setProgram(const QString &program) = 0|
|virtual bool||start(const QStringList &arguments, const QMap<QString, QString> &runtimeEnvironment) = 0|
|virtual QProcess::ProcessState||state() const = 0|
|virtual void||terminate() = 0|
- 32 public functions inherited from QObject
|void||finished(int exitCode, QProcess::ExitStatus exitStatus)|
- 2 signals inherited from QObject
Additional Inherited Members
- 1 property inherited from QObject
- 1 public slot inherited from QObject
- 1 public variable inherited from QObject
- 10 static public members inherited from QObject
- 9 protected functions inherited from QObject
- 2 protected variables inherited from QObject
An interface for custom container instances.
A pointer to this interface should be returned from a successful call to ContainerManagerInterface::create()
Each instance of this class corresponds to a single application or - if supported - a single quick-launcher instance.
Member Function Documentation
Destroys the instance of ContainerInterface. The destructor is virtual.
[pure virtual] bool ContainerInterface::attachApplication(const QVariantMap &application)
The application-manager calls this function, when an application has to be attached to this container instance: the application map closely corresponds to the application's meta-data returned from the ApplicationManager::get() method:
These fields are not available for this function:
These fields are added on top of what ApplicationManager::get() provides:
|The directory where the application's code is located.|
|The directory where the application's manifest (|
|A map with all application properties as seen in the manifest.|
|The installation location id, if this application was installed - empty for built-in applications.|
[pure virtual] QString ContainerInterface::controlGroup() const
This function needs to return which control group the application's container is in. The control group name returned by this function is not the low-level name used by the operating system, but an abstraction. See the container documentation for more details on how to setup this mapping.
Note: If your custom container solution does not support cgroups, then simply return an empty QString here.
See also setControlGroup().
[signal] void ContainerInterface::errorOccured(QProcess::ProcessError processError)
This signal needs to be emitted when an error occurs with the process within the container. The specified processError describes the type of error that occurred.
See also QProcess::errorOccurred().
[signal] void ContainerInterface::finished(int exitCode, QProcess::ExitStatus exitStatus)
This signal has to be emitted when the process within the container finishes. The exitStatus parameter gives an indication why the process exited - in case of a normal exit, the exitCode will be the return value of the process'
See also QProcess::finished().
Needs to return
true if the container is ready for starting the application's program or
See also ready().
Called by the application-manager, if it wants to kills the current process within the container, causing it to exit immediately.
On Unix, the equivalent would be sending a
See also terminate().
[pure virtual] QString ContainerInterface::mapContainerPathToHost(const QString &containerPath) const
The application-manager will call this function whenever paths have to be mapped between the filesystem namespace of the application's container and the application-manager.
You can simply return containerPath, if both are running in the same namespace.
The application-manager will call this function whenever paths have to be mapped between the filesystem namespace of the application-manager and the application's container.
You can simply return hostPath, if both are running in the same namespace.
[pure virtual] qint64 ContainerInterface::processId() const
Should return the native process identifier for the running process, if available. If no process is currently running,
0 is returned.
Note: The process identifier needs to be translated into the application-manager's PID namespace, if the container solution is managing its own, private namespace.
Note: This identifier is needed to support security features within the application-manager: Having a valid PID for every container is necessary (a) in order for Wayland windows to only be accepted when coming from known PIDs and (b) for system services to retrieve meta-data on applications via the D-Bus call ApplicationManager::identifyApplication(). If you need a quick workaround during development for Wayland to accept windows from any PID, then run the application-manager with
If the container implementation needs to do potentially expensive initialization work in the background, it can tell the application-manager to delay calling start() until it has emitted this signal.
In case this is not needed, then you never have to emit this signal, but you are expected to always return
true from isReady().
See also isReady().
[pure virtual] void ContainerInterface::setBaseDirectory(const QString &baseDirectory)
Called by the application-manager to set the initial working directory for the process within the container to baseDirectory.
[pure virtual] bool ContainerInterface::setControlGroup(const QString &groupName)
This function is expected to move the application's container into a control group. The groupName is not the low-level name used by the operating system, but an abstraction. See the container documentation for more details on how to setup this mapping. Returns
true if the call was successful or
Note: If your custom container solution does not support cgroups, then simply return
See also controlGroup().
[pure virtual] bool ContainerInterface::setProgram(const QString &program)
This function is called by the application-manager in order to set the program to execute when starting the process. This function will be called before start(). Needs to return
true if program is valid within this container or
See also start().
[pure virtual] bool ContainerInterface::start(const QStringList &arguments, const QMap<QString, QString> &runtimeEnvironment)
This function will be called to asynchronously start the application's program (as set by setProgram()), with the additional command line arguments and with the additional environment variables from runtimeEnvironment.
The runtimeEnvironment is a string map for environment variables and their values. An empty value in this map means, that the environment variable denoted by its key shall be unset.
The application-manager will only ever call this function once for any given instance.
This function should return
true in case it succeeded or
false otherwise. In case it returns
true, the implementation needs to either emit the started() or errorOccurred() signal (can be delayed) in response to this call.
See also QProcess::start().
See also QProcess::started().
[pure virtual] QProcess::ProcessState ContainerInterface::state() const
This function needs to return the current state of the process within the container.
[signal] void ContainerInterface::stateChanged(QProcess::ProcessState state)
This signal needs to be emitted whenever the state of the process within the container changes.
Called by the application-manager, when attempting to terminate the process within the container.
The process may not exit as a result of calling this function. On Unix, the equivalent would be sending a
See also kill().
© 2018 Pelagicore AG. 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.