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.
Classes | Typedefs | Functions
celix_bundle.h File Reference
#include "celix_types.h"
#include "celix_bundle_state.h"
#include "celix_properties.h"
#include "celix_array_list.h"
#include "celix_version.h"
#include "celix_framework_export.h"
Include dependency graph for celix_bundle.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  celix_bundle_service_list_entry
 
struct  celix_bundle_service_tracker_list_entry
 

Typedefs

typedef struct celix_bundle_service_list_entry celix_bundle_service_list_entry_t
 
typedef struct celix_bundle_service_tracker_list_entry celix_bundle_service_tracker_list_entry_t
 

Functions

CELIX_FRAMEWORK_EXPORT long celix_bundle_getId (const celix_bundle_t *bnd)
 Return the bundle id. More...
 
CELIX_FRAMEWORK_EXPORT celix_bundle_state_e celix_bundle_getState (const celix_bundle_t *bnd)
 Return the bundle state. More...
 
CELIX_FRAMEWORK_EXPORT char * celix_bundle_getEntry (const celix_bundle_t *bnd, const char *path)
 
CELIX_FRAMEWORK_EXPORT char * celix_bundle_getDataFile (const celix_bundle_t *bnd, const char *path)
 
const CELIX_FRAMEWORK_EXPORT char * celix_bundle_getManifestValue (const celix_bundle_t *bnd, const char *attribute)
 Get a manifest attribute value from the bundle manifest. More...
 
const CELIX_FRAMEWORK_EXPORT char * celix_bundle_getGroup (const celix_bundle_t *bnd)
 Return the group of the bundle. Groups are used to order bundles. Note the return value is valid as long as the bundle is installed. More...
 
const CELIX_FRAMEWORK_EXPORT char * celix_bundle_getSymbolicName (const celix_bundle_t *bnd)
 Return the symbolic name of the bundle. Note the return value is valid as long as the bundle is installed. More...
 
const CELIX_FRAMEWORK_EXPORT char * celix_bundle_getName (const celix_bundle_t *bnd)
 Return the name of the bundle. Note the return value is valid as long as the bundle is installed. More...
 
const CELIX_FRAMEWORK_EXPORT char * celix_bundle_getDescription (const celix_bundle_t *bnd)
 Return the description of the bundle. Note the return value is valid as long as the bundle is installed. More...
 
CELIX_FRAMEWORK_EXPORT char * celix_bundle_getLocation (const celix_bundle_t *bnd)
 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 NULL. More...
 
const CELIX_FRAMEWORK_EXPORT celix_version_t * celix_bundle_getVersion (const celix_bundle_t *bnd)
 Return the bundle version. Note the return value is valid as long as the bundle is installed. More...
 
CELIX_FRAMEWORK_EXPORT bool celix_bundle_isSystemBundle (const celix_bundle_t *bnd)
 Return whether the bundle is the system bundle. More...
 
CELIX_FRAMEWORK_EXPORT celix_array_list_t * celix_bundle_listRegisteredServices (const celix_bundle_t *bnd)
 
CELIX_FRAMEWORK_EXPORT void celix_bundle_destroyRegisteredServicesList (celix_array_list_t *list)
 
CELIX_FRAMEWORK_EXPORT celix_array_list_t * celix_bundle_listServiceTrackers (const celix_bundle_t *bnd)
 

Typedef Documentation

◆ celix_bundle_service_list_entry_t

◆ celix_bundle_service_tracker_list_entry_t

Service Tracker Info provided to the service tracker tracker callbacks.

Function Documentation

◆ celix_bundle_destroyRegisteredServicesList()

CELIX_FRAMEWORK_EXPORT void celix_bundle_destroyRegisteredServicesList ( celix_array_list_t *  list)

Utils function to free memory for the return of a celix_bundle_listRegisteredServices call.

◆ celix_bundle_getDataFile()

CELIX_FRAMEWORK_EXPORT char* celix_bundle_getDataFile ( const celix_bundle_t *  bnd,
const char *  path 
)

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.

The caller is responsible for freeing the returned path entry.

Parameters
pathThe relative path to a bundle persistent storage entry.
bndThe bundle.
Returns
A use-able path to the bundle resource entry or NULL if the entry is not found.

◆ celix_bundle_getDescription()

const CELIX_FRAMEWORK_EXPORT char* celix_bundle_getDescription ( const celix_bundle_t *  bnd)

Return the description of the bundle. Note the return value is valid as long as the bundle is installed.

◆ celix_bundle_getEntry()

CELIX_FRAMEWORK_EXPORT char* celix_bundle_getEntry ( const celix_bundle_t *  bnd,
const char *  path 
)

Return 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 provided path is always relative to the bundle root and can start with a "/". A provided path NULL, "", "." or "/" indicates 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.

The caller is responsible for freeing the returned path entry.

Parameters
pathThe relative path to a bundle resource.
bndThe bundle.
Returns
A use-able path to the bundle resource entry or NULL if the entry is not found.

◆ celix_bundle_getGroup()

const CELIX_FRAMEWORK_EXPORT char* celix_bundle_getGroup ( const celix_bundle_t *  bnd)

Return the group of the bundle. Groups are used to order bundles. Note the return value is valid as long as the bundle is installed.

◆ celix_bundle_getId()

CELIX_FRAMEWORK_EXPORT long celix_bundle_getId ( const celix_bundle_t *  bnd)

Return the bundle id.

Parameters
bndThe bundle
Returns
The bundle id or < 0 if something went wrong.

◆ celix_bundle_getLocation()

CELIX_FRAMEWORK_EXPORT char* celix_bundle_getLocation ( const celix_bundle_t *  bnd)

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 NULL.

Returns
The update location of the bundle or NULL if the bundle is the framework bundle. The caller is responsible for freeing the returned string.

◆ celix_bundle_getManifestValue()

const CELIX_FRAMEWORK_EXPORT char* celix_bundle_getManifestValue ( const celix_bundle_t *  bnd,
const char *  attribute 
)

Get a manifest attribute value from the bundle manifest.

Parameters
bndThe bundle.
attributeThe attribute to get the value from.
Returns
The attribute value or NULL if the attribute is not present in the bundle manifest. The returned value is valid as long as the bundle is not uninstalled.

◆ celix_bundle_getName()

const CELIX_FRAMEWORK_EXPORT char* celix_bundle_getName ( const celix_bundle_t *  bnd)

Return the name of the bundle. Note the return value is valid as long as the bundle is installed.

◆ celix_bundle_getState()

CELIX_FRAMEWORK_EXPORT celix_bundle_state_e celix_bundle_getState ( const celix_bundle_t *  bnd)

Return the bundle state.

Parameters
bndThe bundle
Returns
The bundle state or OSGI_FRAMEWORK_BUNDLE_UNKNOWN if something went wrong.

◆ celix_bundle_getSymbolicName()

const CELIX_FRAMEWORK_EXPORT char* celix_bundle_getSymbolicName ( const celix_bundle_t *  bnd)

Return the symbolic name of the bundle. Note the return value is valid as long as the bundle is installed.

◆ celix_bundle_getVersion()

const CELIX_FRAMEWORK_EXPORT celix_version_t* celix_bundle_getVersion ( const celix_bundle_t *  bnd)

Return the bundle version. Note the return value is valid as long as the bundle is installed.

◆ celix_bundle_isSystemBundle()

CELIX_FRAMEWORK_EXPORT bool celix_bundle_isSystemBundle ( const celix_bundle_t *  bnd)

Return whether the bundle is the system bundle.

◆ celix_bundle_listRegisteredServices()

CELIX_FRAMEWORK_EXPORT celix_array_list_t* celix_bundle_listRegisteredServices ( const celix_bundle_t *  bnd)

Return a array list of registered service info entries for this bundle.

Parameters
ctxThe bundle context
bndIdThe bundle id for which the services should be listed
Returns
A celix array list with celix_bundle_service_list_entry_t*. Caller is owner of the celix array.

◆ celix_bundle_listServiceTrackers()

CELIX_FRAMEWORK_EXPORT celix_array_list_t* celix_bundle_listServiceTrackers ( const celix_bundle_t *  bnd)

Returns a array list of service tracker info entries for this bundle.

Warning
It requires a valid bundle context. Calling it for an inactive bundle will lead to crash.
Parameters
ctxThe bundle context
bndIdThe bundle id for which the services should be listed
Returns
A celix array list with celix_bundle_service_tracker_list_entry_t*. Caller is owner of the celix array. The returned list should be freed using celix_arrayList_destroy.