softwarecontainer
0.18.0-739e8d7 2017-05-04
|
Environment Gateway is used to define environment variables to the container. More...
#include <envgateway.h>
Public Types | |
enum | GatewayState : unsigned int { CREATED, CONFIGURED, ACTIVATED } |
Public Member Functions | |
EnvironmentGateway (std::shared_ptr< ContainerAbstractInterface > container) | |
bool | readConfigElement (const json_t *element) |
Gateway specific parsing of config elements. More... | |
bool | activateGateway () |
bool | teardownGateway () |
virtual std::string | id () const |
Returns the ID of the gateway. More... | |
virtual bool | setConfig (const json_t *config) |
Configure this gateway according to the supplied JSON configuration string. More... | |
virtual bool | activate () |
Applies any configuration set by setConfig() More... | |
virtual bool | teardown () |
Restore system to the state prior to launching of gateway. More... | |
virtual bool | isConfigured () |
Is the gateway configured or not? More... | |
virtual bool | isActivated () |
Is the gateway activated or not? More... | |
Static Public Attributes | |
static constexpr const char * | ID |
Protected Member Functions | |
std::shared_ptr< ContainerAbstractInterface > | getContainer () |
Get a handle to the associated container. More... | |
bool | setEnvironmentVariable (const std::string &variable, const std::string &value) |
Set an environment variable in the associated container. More... | |
Protected Attributes | |
bool | m_activatedOnce |
Environment Gateway is used to define environment variables to the container.
Definition at line 28 of file envgateway.h.
|
virtual |
Gateway specific parsing of config elements.
All gateways implement this method in order to provide gateway specific parsing of the configuration content.
element | A JSON configuration item. |
Implements softwarecontainer::Gateway.
Definition at line 37 of file envgateway.cpp.
|
virtualinherited |
Returns the ID of the gateway.
Definition at line 36 of file gateway.cpp.
Referenced by softwarecontainer::Gateway::activate(), softwarecontainer::DBusGatewayInstance::DBusGatewayInstance(), softwarecontainer::Gateway::setConfig(), and softwarecontainer::Gateway::teardown().
|
virtualinherited |
Configure this gateway according to the supplied JSON configuration string.
config | JSON string containing gateway-specific JSON configuration |
config
was successfully parsed, false otherwiseGatewayError | If called on an already activated gateway. |
Reimplemented in softwarecontainer::DBusGateway.
Definition at line 41 of file gateway.cpp.
References softwarecontainer::Gateway::id(), and softwarecontainer::Gateway::readConfigElement().
|
virtualinherited |
Applies any configuration set by setConfig()
GatewayError | If called on an already activated gateway, or if the gateway has not been previously configured, or if there is not container instance set. |
Reimplemented in softwarecontainer::DBusGateway.
Definition at line 78 of file gateway.cpp.
References softwarecontainer::Gateway::id().
|
virtualinherited |
Restore system to the state prior to launching of gateway.
Any cleanup code (removal of files, virtual interfaces, etc) should be placed here.
GatewayError | If called on a non activated gateway. |
Reimplemented in softwarecontainer::DBusGateway.
Definition at line 103 of file gateway.cpp.
References softwarecontainer::Gateway::id().
Referenced by softwarecontainer::DBusGatewayInstance::DBusGatewayInstance().
|
virtualinherited |
Is the gateway configured or not?
Reimplemented in softwarecontainer::DBusGateway.
Definition at line 134 of file gateway.cpp.
|
virtualinherited |
Is the gateway activated or not?
Dynamic gateways will return true if they have been activated at least once. Non-dynamic gateways will return true if they are in state ACTIVATED
Reimplemented in softwarecontainer::DBusGateway.
Definition at line 139 of file gateway.cpp.
Referenced by softwarecontainer::DBusGatewayInstance::DBusGatewayInstance().
|
protectedinherited |
Get a handle to the associated container.
GatewayError | If called before setContainer() has been called. |
Definition at line 128 of file gateway.cpp.
Referenced by softwarecontainer::NetworkGateway::activateGateway(), softwarecontainer::DBusGatewayInstance::activateGateway(), softwarecontainer::WaylandGateway::readConfigElement(), and softwarecontainer::NetworkGateway::teardownGateway().
|
protectedinherited |
Set an environment variable in the associated container.