ServiceComponentRuntime¶
-
class
cppmicroservices::service::component::runtime::
ServiceComponentRuntime
¶ - #include <cppmicroservices/servicecomponent/runtime/ServiceComponentRuntime.hpp>
The ServiceComponentRuntime service represents the Declarative Services actor, known as Service Component Runtime (SCR), that manages the service components and their life cycle.
The ServiceComponentRuntime service allows introspection of the components managed by Service Component Runtime.
This service differentiates between a ComponentDescriptionDTO and a ComponentConfigurationDTO. A ComponentDescriptionDTO is a representation of a declared component description. A ComponentConfigurationDTO is a representation of an actual instance of a declared component description parameterized by component properties.
Public Functions
-
virtual
~ServiceComponentRuntime
()¶
-
virtual std::vector<dto::ComponentDescriptionDTO>
GetComponentDescriptionDTOs
(const std::vector<cppmicroservices::Bundle> &bundles = {}) const = 0¶ Returns the component descriptions declared by the specified active bundles.
Only component descriptions from active bundles are returned. If the specified bundles have no declared components or are not active, an empty collection is returned.
- Return
- The declared component descriptions of the specified active bundles. An empty collection is returned if there are no component descriptions for the specified active bundles.
- Parameters
bundles
: The bundles whose declared component descriptions are to be returned. Specifying no bundles, or the equivalent of an emptyBundle
vector, will return the declared component descriptions from all active bundles.
-
virtual dto::ComponentDescriptionDTO
GetComponentDescriptionDTO
(const cppmicroservices::Bundle &bundle, const std::string &name) const = 0¶ Returns the ComponentDescriptionDTO declared with the specified name by the specified bundle.
Only component descriptions from active bundles are returned. An empty object is returned if no such component is declared by the given bundle or the bundle is not active.
- Return
- The declared component description or empty object if the specified bundle is not active or does not declare a component description with the specified name.
- Parameters
bundle
: The bundle declaring the component description.name
: The name of the component description.
-
virtual std::vector<dto::ComponentConfigurationDTO>
GetComponentConfigurationDTOs
(const dto::ComponentDescriptionDTO &description) const = 0¶ Returns the component configurations for the specified component description.
- Return
- A vector containing a snapshot of the current component configurations for the specified component description. An empty vector is returned if there are none.
- Parameters
description
: The component description.
-
virtual bool
IsComponentEnabled
(const dto::ComponentDescriptionDTO &description) const = 0¶ Returns whether the specified component description is currently enabled.
The enabled state of a component description is initially set by the enabled attribute of the component description.
- Return
true
if the specified component description is currently enabled. Otherwise,false
.- See
- EnableComponent
- See
- DisableComponent
- See
- ComponentContext::DisableComponent(std::string)
- See
- ComponentContext::EnableComponent(std::string)
- Parameters
description
: The component description.
-
virtual std::shared_future<void>
EnableComponent
(const dto::ComponentDescriptionDTO &description) = 0¶ Enables the specified component description.
If the specified component description is currently enabled, this method has no effect.
This method must return after changing the enabled state of the specified component description. Any actions that result from this, such as activating or deactivating a component configuration, must occur asynchronously to this method call.
- Remark
- The shared_future<void> returned can contain a { cppmicroservices::SecurityException if enabling the component caused the bundle’s shared library to be loaded and the bundle failed a security check.
- Return
- A future that will be ready when the actions that result from changing the enabled state of the specified component have completed.
- See
- IsComponentEnabled
- Parameters
description
: The component description to enable.
-
virtual std::shared_future<void>
DisableComponent
(const dto::ComponentDescriptionDTO &description) = 0¶ Disables the specified component description.
If the specified component description is currently disabled, this method has no effect.
This method must return after changing the enabled state of the specified component description. Any actions that result from this, such as activating or deactivating a component configuration, must occur asynchronously to this method call.
- Return
- A future that will be ready when the actions that result from changing the enabled state of the specified component have completed.
- See
- IsComponentEnabled
- Parameters
description
: The component description to disable.
-
virtual