Apache Celix  latest
Apache Celix is a framework for C, C++14 and C++17 to develop dynamic modular software applications using component and in-process service-oriented programming.
Public Member Functions | List of all members
celix::Bundle Class Reference

An installed bundle in the Celix framework. More...

#include <Bundle.h>

Public Member Functions

 Bundle (celix_bundle_t *_cBnd)
 
long getId () const
 get the bundle id. More...
 
std::string getEntry (const std::string &path) const
 Get a use-able entry path for the provided relative path to a bundle resource cache. More...
 
std::string getDataFile (const std::string &path) const
 Return a use-able entry path for the provided relative path to a bundle persistent storage. More...
 
std::string getManifestValue (const std::string &attribute) const
 Get a manifest attribute value from the bundle manifest. More...
 
std::string getSymbolicName () const
 the symbolic name of the bundle. More...
 
std::string getName () const
 The name of the bundle. More...
 
std::string getGroup () const
 The group of the bundle. More...
 
std::string getDescription () const
 The description of the bundle. More...
 
std::string getLocation () const
 Return the update location of the bundle. The location the location passed to celix::BundleContext::installBundle when a bundle is installed. For the framework bundle, the location will be "". More...
 
celix::BundleState getState () const
 The current bundle state. More...
 
bool isSystemBundle () const
 whether the bundle is the system (framework) bundle More...
 
celix_bundle_t * getCBundle () const
 Get the C bundle handle. More...
 

Detailed Description

An installed bundle in the Celix framework.

Each bundle installed in the Celix framework must have an associated Bundle object. A bundle must have a unique identity, a long, chosen by the Celix framework.

Note
Provided std::string_view values must be null terminated strings.
Thread safe.

Constructor & Destructor Documentation

◆ Bundle()

celix::Bundle::Bundle ( celix_bundle_t *  _cBnd)
inlineexplicit

Member Function Documentation

◆ getCBundle()

celix_bundle_t* celix::Bundle::getCBundle ( ) const
inline

Get the C bundle handle.

Warning
Try not the depend on the C API from a C++ bundle. If features are missing these should be added to the C++ API.

◆ getDataFile()

std::string celix::Bundle::getDataFile ( const std::string &  path) const
inline

Return a use-able entry path for the provided relative path to a bundle persistent storage.

For example if there is a resource entry in the bundle persistent storage at path 'resources/counters.txt` this call will return a relative path to entry in the bundle persistent storage. .cache/bundle5/storage/resources/counters.txt

A provided path is always relative to the bundle persistent storage root and can start with a "/". A provided path NULL, "", "." or "/" indicates the root of this bundle cache store.

The returned entry path should can be treated as read-write.

Parameters
pathThe relative path to a bundle persistent storage entry.
Returns
The use-able entry path or an empty string if the entry is not found.

◆ getDescription()

std::string celix::Bundle::getDescription ( ) const
inline

The description of the bundle.

◆ getEntry()

std::string celix::Bundle::getEntry ( const std::string &  path) const
inline

Get a use-able entry path for the provided relative path to a bundle resource cache.

For example if there is a resource entry in the bundle at path 'META-INF/descriptors/foo.descriptor` this call will return a relative path to the extracted location of the bundle resource, e.g.: .cache/bundle5/version0.0/META-INF/descriptors/foo.descriptor

A path is always relative to the bundle root and can start with a "/". A path "." or "/" indicated the root of this bundle.

The returned entry path should be treated as read-only, use celix::Bundle::getDataFile to access the bundle's persistent storage.

Parameters
pathThe relative path to a bundle resource.
Returns
The use-able entry path or an empty string if the entry is not found.

◆ getGroup()

std::string celix::Bundle::getGroup ( ) const
inline

The group of the bundle.

◆ getId()

long celix::Bundle::getId ( ) const
inline

get the bundle id.

Returns

◆ getLocation()

std::string celix::Bundle::getLocation ( ) const
inline

Return the update location of the bundle. The location the location passed to celix::BundleContext::installBundle when a bundle is installed. For the framework bundle, the location will be "".

◆ getManifestValue()

std::string celix::Bundle::getManifestValue ( const std::string &  attribute) const
inline

Get a manifest attribute value from the bundle manifest.

Parameters
attributeThe attribute to get the value from.
Returns
The attribute value or an empty string if the attribute is not present in the bundle manifest.

◆ getName()

std::string celix::Bundle::getName ( ) const
inline

The name of the bundle.

◆ getState()

celix::BundleState celix::Bundle::getState ( ) const
inline

The current bundle state.

◆ getSymbolicName()

std::string celix::Bundle::getSymbolicName ( ) const
inline

the symbolic name of the bundle.

◆ isSystemBundle()

bool celix::Bundle::isSystemBundle ( ) const
inline

whether the bundle is the system (framework) bundle

Returns

The documentation for this class was generated from the following file: