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.
|
Go to the documentation of this file.
20 #ifndef CELIX_FRAMEWORK_H_
21 #define CELIX_FRAMEWORK_H_
25 #include "celix_types.h"
26 #include "celix_properties.h"
27 #include "celix_log_level.h"
28 #include "celix_array_list.h"
29 #include "celix_framework_export.h"
89 bool includeFrameworkBundle,
91 void (*use)(
void* handle,
const celix_bundle_t* bnd));
108 bool includeFrameworkBundle,
109 void* callbackHandle,
110 void (*use)(
void* handle,
const celix_bundle_t* bnd));
132 void* callbackHandle,
133 void (*use)(
void* handle,
const celix_bundle_t* bnd));
327 CELIX_FRAMEWORK_EXPORT
void celix_framework_setLogCallback(celix_framework_t* fw,
void* logHandle,
void (*logFunction)(
void* handle, celix_log_level_e level,
const char* file,
const char *
function,
int line,
const char *format, va_list formatArgs));
390 const char* eventName,
392 void (*processCallback)(
void* data),
394 void (*doneCallback)(
void* doneData));
CELIX_FRAMEWORK_EXPORT bool celix_framework_isBundleInstalled(celix_framework_t *fw, long bndId)
Check whether a bundle is installed.
CELIX_FRAMEWORK_EXPORT bool celix_framework_startBundle(celix_framework_t *fw, long bndId)
Start the bundle with the provided bundle id. Will silently ignore bundle ids < 0.
CELIX_FRAMEWORK_EXPORT void celix_framework_startBundleAsync(celix_framework_t *fw, long bndId)
Start the bundle with the provided bundle id async. Will silently ignore bundle ids < 0.
CELIX_FRAMEWORK_EXPORT bool celix_framework_useBundle(celix_framework_t *fw, bool onlyActive, long bndId, void *callbackHandle, void(*use)(void *handle, const celix_bundle_t *bnd))
Use the bundle with the provided bundle id The provided callback will be called if the bundle is foun...
CELIX_FRAMEWORK_EXPORT long celix_framework_installBundle(celix_framework_t *fw, const char *bundleLoc, bool autoStart)
Install and optional start a bundle. Will silently ignore bundle ids < 0.
CELIX_FRAMEWORK_EXPORT void celix_framework_stopBundleAsync(celix_framework_t *fw, long bndId)
Stop the bundle with the provided bundle id async. Will silently ignore bundle ids < 0.
CELIX_FRAMEWORK_EXPORT celix_array_list_t * celix_framework_listBundles(celix_framework_t *framework)
List the installed and started bundle ids. The bundle ids does not include the framework bundle (bund...
const CELIX_FRAMEWORK_EXPORT char * celix_framework_getUUID(const celix_framework_t *fw)
Returns the framework UUID. This is unique for every created framework and will not be the same if th...
CELIX_FRAMEWORK_EXPORT size_t celix_framework_useActiveBundles(celix_framework_t *fw, bool includeFrameworkBundle, void *callbackHandle, void(*use)(void *handle, const celix_bundle_t *bnd))
Use the currently active bundles. The provided callback will be called for all the currently active b...
CELIX_FRAMEWORK_EXPORT void celix_framework_waitForEmptyEventQueue(celix_framework_t *fw)
Wait until the framework event queue is empty.
CELIX_FRAMEWORK_EXPORT void celix_framework_uninstallBundleAsync(celix_framework_t *fw, long bndId)
Uninstall the bundle with the provided bundle id async. If needed the bundle will be stopped first....
CELIX_FRAMEWORK_EXPORT celix_array_list_t * celix_framework_listInstalledBundles(celix_framework_t *framework)
List the installed bundle ids. The bundle ids does not include the framework bundle (bundle id CELIX_...
CELIX_FRAMEWORK_EXPORT long celix_framework_fireGenericEvent(celix_framework_t *fw, long eventId, long bndId, const char *eventName, void *processData, void(*processCallback)(void *data), void *doneData, void(*doneCallback)(void *doneData))
Fire a generic event. The event will be added to the event loop and handled on the event loop thread.
CELIX_FRAMEWORK_EXPORT bool celix_framework_isEventQueueEmpty(celix_framework_t *fw)
Check if the event queue is empty.
CELIX_FRAMEWORK_EXPORT void celix_framework_waitUntilNoPendingRegistration(celix_framework_t *fw)
wait until all pending service registration are processed.
CELIX_FRAMEWORK_EXPORT bool celix_framework_stopBundle(celix_framework_t *fw, long bndId)
Stop the bundle with the provided bundle id. Will silently ignore bundle ids < 0.
CELIX_FRAMEWORK_EXPORT long celix_framework_installBundleAsync(celix_framework_t *fw, const char *bundleLoc, bool autoStart)
Install and optional start a bundle async. Will silently ignore bundle ids < 0.
CELIX_FRAMEWORK_EXPORT void celix_framework_waitForStop(celix_framework_t *framework)
Wait until the framework is stopped.
CELIX_FRAMEWORK_EXPORT bool celix_framework_unloadBundle(celix_framework_t *fw, long bndId)
Unload the bundle with the provided bundle id. If needed the bundle will be stopped first....
CELIX_FRAMEWORK_EXPORT celix_bundle_t * celix_framework_getFrameworkBundle(const celix_framework_t *fw)
Returns the framework bundle. This is the same as a 'normal' bundle, expect that this bundle cannot b...
CELIX_FRAMEWORK_EXPORT bool celix_framework_isCurrentThreadTheEventLoop(celix_framework_t *fw)
Returns whether the current thread is the Celix framework event loop thread.
CELIX_FRAMEWORK_EXPORT void celix_framework_waitForGenericEvent(celix_framework_t *fw, long eventId)
Wait until a event from the event queue with the provided event id is completely handled....
CELIX_FRAMEWORK_EXPORT long celix_framework_nextEventId(celix_framework_t *fw)
Get the next event id.
CELIX_FRAMEWORK_EXPORT bool celix_framework_updateBundle(celix_framework_t *fw, long bndId, const char *updatedBundleUrl)
Update the bundle with the provided bundle id.
CELIX_FRAMEWORK_EXPORT void celix_framework_waitUntilNoEventsForBnd(celix_framework_t *fw, long bndId)
wait until all events from the event queue for the bundle identified by the bndId are processed.
CELIX_FRAMEWORK_EXPORT size_t celix_framework_useBundles(celix_framework_t *fw, bool includeFrameworkBundle, void *callbackHandle, void(*use)(void *handle, const celix_bundle_t *bnd))
Use the currently installed bundles. The provided callback will be called for all the currently insta...
CELIX_FRAMEWORK_EXPORT bool celix_framework_uninstallBundle(celix_framework_t *fw, long bndId)
Uninstall the bundle with the provided bundle id. If needed the bundle will be stopped first....
CELIX_FRAMEWORK_EXPORT celix_status_t celix_framework_waitForEmptyEventQueueFor(celix_framework_t *fw, double timeoutInSeconds)
Wait until the framework event queue is empty or the provided period is reached.
CELIX_FRAMEWORK_EXPORT void celix_framework_setLogCallback(celix_framework_t *fw, void *logHandle, void(*logFunction)(void *handle, celix_log_level_e level, const char *file, const char *function, int line, const char *format, va_list formatArgs))
Sets the log function for this framework. Default the celix framework will log to stdout/stderr.
CELIX_FRAMEWORK_EXPORT celix_bundle_context_t * celix_framework_getFrameworkContext(const celix_framework_t *fw)
Returns the framework bundle context. This is the same as a 'normal' bundle context and can be used t...
CELIX_FRAMEWORK_EXPORT void celix_framework_unloadBundleAsync(celix_framework_t *fw, long bndId)
Unload the bundle with the provided bundle id async. If needed the bundle will be stopped first....
CELIX_FRAMEWORK_EXPORT bool celix_framework_isBundleActive(celix_framework_t *fw, long bndId)
Check whether the bundle is active.
CELIX_FRAMEWORK_EXPORT void celix_framework_updateBundleAsync(celix_framework_t *fw, long bndId, const char *updatedBundleUrl)
Update the bundle with the provided bundle id async.