A Framework instance.
A Framework is itself a bundle and is known as the “System Bundle”. The System Bundle differs from other bundles in the following ways:
- The system bundle is always assigned a bundle identifier of zero (0).
- The system bundle
GetLocationmethod returns the string: “System Bundle”.
- The system bundle’s life cycle cannot be managed like normal bundles. Its life cycle methods behave as follows:
- Start - Initialize the framework and start installed bundles.
- Stop - Stops all installed bundles.
- Uninstall - The Framework throws a std::runtime_error exception indicating that the system bundle cannot be uninstalled.
Framework instances are created using a FrameworkFactory. The methods of this class can be used to manage and control the created framework instance.
- This class is thread-safe.
- FrameworkFactory::NewFramework(const std::map<std::string, Any>& configuration)
Inherits from cppmicroservices::Bundle
Bundlerepresenting the system bundle to a
b: The system bundle
std::logic_error: If the bundle is not the system bundle.
Initialize this Framework.
After calling this method, this Framework has:
- Generated a new framework UUID.
- Moved to the STATE_STARTING state.
- A valid Bundle Context.
- Event handling enabled.
- Reified Bundle objects for all installed bundles.
- Registered any framework services.
This Framework will not actually be started until Start is called.
This method does nothing if called when this Framework is in the STATE_STARTING, STATE_ACTIVE or STATE_STOPPING states.
std::runtime_error: If this Framework could not be initialized.
WaitForStop(const std::chrono::milliseconds &timeout)¶
Wait until this Framework has completely stopped.
Stopmethod on a Framework performs an asynchronous stop of the Framework if it was built with threading support.
This method can be used to wait until the asynchronous stop of this Framework has completed. This method will only wait if called when this Framework is in the STATE_STARTING, STATE_ACTIVE, or STATE_STOPPING states. Otherwise it will return immediately.
A Framework Event is returned to indicate why this Framework has stopped.
- A Framework Event indicating the reason this method returned. The following
FrameworkEventtypes may be returned by this method.
FRAMEWORK_STOPPED - This Framework has been stopped.
FRAMEWORK_ERROR - The Framework encountered an error while shutting down or an error has occurred which forced the framework to shutdown.
FRAMEWORK_WAIT_TIMEDOUT - This method has timed out and returned before this Framework has stopped.
timeout: Maximum time duration to wait until this Framework has completely stopped. A value of zero will wait indefinitely.