BundleEvent¶
-
std::ostream &
cppmicroservices::operator<<(std::ostream &os, BundleEvent::Type eventType)¶ Writes a string representation of
eventTypeto the streamos.
-
std::ostream &
cppmicroservices::operator<<(std::ostream &os, const BundleEvent &event)¶ Writes a string representation of
eventto the streamos.
-
class
cppmicroservices::BundleEvent¶ - #include <cppmicroservices/BundleEvent.h>
An event from the Micro Services framework describing a bundle lifecycle change.
BundleEventobjects are delivered to listeners connected via BundleContext::AddBundleListener() when a change occurs in a bundles’s lifecycle. A type code is used to identify the event type for future extendability.Public Types
-
enum
Type¶ The bundle event type.
Values:
-
BUNDLE_INSTALLED= 0x00000001¶ The bundle has been installed.
The bundle has been installed by the Framework.
- See
- BundleContext::InstallBundles(const std::string&)
-
BUNDLE_STARTED= 0x00000002¶ The bundle has been started.
The bundle’s BundleActivator Start method has been executed if the bundle has a bundle activator class.
- See
- Bundle::Start()
-
BUNDLE_STOPPED= 0x00000004¶ The bundle has been stopped.
The bundle’s BundleActivator Stop method has been executed if the bundle has a bundle activator class.
- See
- Bundle::Stop()
-
BUNDLE_UPDATED= 0x00000008¶ The bundle has been updated.
- Note
- This identifier is reserved for future use and not supported yet.
-
BUNDLE_UNINSTALLED= 0x00000010¶ The bundle has been uninstalled.
-
BUNDLE_RESOLVED= 0x00000020¶ The bundle has been resolved.
-
BUNDLE_UNRESOLVED= 0x00000040¶ The bundle has been unresolved.
- See
- Bundle::BUNDLE_INSTALLED
-
BUNDLE_STARTING= 0x00000080¶ The bundle is about to be activated.
The bundle’s BundleActivator start method is about to be called if the bundle has a bundle activator class.
- See
- Bundle::Start()
-
BUNDLE_STOPPING= 0x00000100¶ The bundle is about to deactivated.
The bundle’s BundleActivator stop method is about to be called if the bundle has a bundle activator class.
- See
- Bundle::Stop()
-
BUNDLE_LAZY_ACTIVATION= 0x00000200¶ The bundle will be lazily activated.
The bundle has a lazy activation policy and is waiting to be activated. It is now in the BUNDLE_STARTING state and has a valid
BundleContext.- Note
- This identifier is reserved for future use and not supported yet.
-
Public Functions
-
BundleEvent()¶ Creates an invalid instance.
-
operator bool() const¶ Can be used to check if this BundleEvent instance is valid, or if it has been constructed using the default constructor.
- Return
trueif this event object is valid,falseotherwise.
-
BundleEvent(Type type, const Bundle &bundle)¶ Creates a bundle event of the specified type.
- Parameters
type: The event type.bundle: The bundle which had a lifecycle change. This bundle is used as the origin of the event.
-
BundleEvent(Type type, const Bundle &bundle, const Bundle &origin)¶ Creates a bundle event of the specified type.
- Parameters
type: The event type.bundle: The bundle which had a lifecycle change.origin: The bundle which is the origin of the event. For the event type BUNDLE_INSTALLED, this is the bundle whose context was used to install the bundle. Otherwise it is the bundle itself.
-
Bundle
GetBundle() const¶ Returns the bundle which had a lifecycle change.
- Return
- The bundle that had a change occur in its lifecycle.
-
Type
GetType() const¶ Returns the type of lifecyle event.
The type values are:
- BUNDLE_INSTALLED
- BUNDLE_RESOLVED
- BUNDLE_LAZY_ACTIVATION
- BUNDLE_STARTING
- BUNDLE_STARTED
- BUNDLE_STOPPING
- BUNDLE_STOPPED
- BUNDLE_UNRESOLVED
- BUNDLE_UNINSTALLED
- Return
- The type of lifecycle event.
-
Bundle
GetOrigin() const¶ Returns the bundle that was the origin of the event.
For the event type BUNDLE_INSTALLED, this is the bundle whose context was used to install the bundle. Otherwise it is the bundle itself.
- Return
- The bundle that was the origin of the event.
-
bool
operator==(const BundleEvent &evt) const¶ Compares two bundle events for equality.
- Return
trueif both events originate from the same bundle, describe a life-cycle change for the same bundle, and are of the same type.falseotherwise. Two invalid bundle events are considered to be equal.- Parameters
evt: The bundle event to compare this event with.
-
enum