Apache Celix
2.4.0
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_BUNDLE_CONTEXT_H_
21 #define CELIX_BUNDLE_CONTEXT_H_
25 #include "celix_cleanup.h"
26 #include "celix_types.h"
27 #include "celix_service_factory.h"
28 #include "celix_properties.h"
29 #include "celix_array_list.h"
30 #include "celix_filter.h"
31 #include "celix_bundle_event.h"
32 #include "celix_log_level.h"
33 #include "celix_framework_export.h"
43 #define CELIX_OPTS_INIT {}
45 #define CELIX_OPTS_INIT
211 #define CELIX_EMPTY_SERVICE_REGISTRATION_OPTIONS { .svc = NULL, \
213 .serviceName = NULL, \
214 .properties = NULL, \
215 .serviceLanguage = NULL, \
216 .serviceVersion = NULL, \
218 .asyncCallback = NULL }
281 celix_bundle_context_t*
ctx;
292 celix_serviceRegistrationGuard_init(celix_bundle_context_t* ctx,
long serviceId) {
302 if (reg->
svcId >= 0) {
395 #define CELIX_EMPTY_SERVICE_FILTER_OPTIONS {.serviceName = NULL, .versionRange = NULL, .filter = NULL, .serviceLanguage = NULL, .ignoreServiceLanguage = false}
434 celix_bundle_context_t *ctx,
435 const char* serviceName,
436 void* callbackHandle,
437 void (*set)(
void* handle,
void* svc)
456 celix_bundle_context_t *ctx,
457 const char* serviceName,
458 void* callbackHandle,
459 void (*set)(
void* handle,
void* svc)
477 celix_bundle_context_t *ctx,
478 const char* serviceName,
479 void* callbackHandle,
480 void (*add)(
void* handle,
void* svc),
481 void (*remove)(
void* handle,
void* svc)
498 celix_bundle_context_t *ctx,
499 const char* serviceName,
500 void* callbackHandle,
501 void (*add)(
void* handle,
void* svc),
502 void (*remove)(
void* handle,
void* svc)
602 #define CELIX_EMPTY_SERVICE_TRACKING_OPTIONS { .filter.serviceName = NULL, \
603 .filter.versionRange = NULL, \
604 .filter.filter = NULL, \
605 .filter.serviceLanguage = NULL, \
606 .filter.ignoreServiceLanguage = false, \
607 .callbackHandle = NULL, \
611 .setWithProperties = NULL, \
612 .addWithProperties = NULL, \
613 .removeWithProperties = NULL, \
614 .setWithOwner = NULL, \
615 .addWithOwner = NULL, \
616 .removeWithOwner = NULL, \
617 .trackerCreatedCallbackData = NULL, \
618 .trackerCreatedCallback = NULL }
663 celix_bundle_context_t *ctx,
665 void *doneCallbackData,
666 void (*doneCallback)(
void* doneCallbackData));
707 celix_bundle_context_t *ctx,
709 const char* serviceName ,
710 void *callbackHandle,
711 void (*use)(
void *handle,
void* svc)
732 celix_bundle_context_t *ctx,
733 const char* serviceName,
734 void *callbackHandle,
735 void (*use)(
void *handle,
void *svc)
756 celix_bundle_context_t *ctx,
757 const char* serviceName,
758 void *callbackHandle,
759 void (*use)(
void *handle,
void *svc)
807 #define CELIX_SERVICE_USE_DIRECT (1)
812 #define CELIX_SERVICE_USE_SOD (2)
820 #define CELIX_EMPTY_SERVICE_USE_OPTIONS {.filter.serviceName = NULL, \
821 .filter.versionRange = NULL, \
822 .filter.filter = NULL, \
823 .filter.serviceLanguage = NULL, \
824 .waitTimeoutInSeconds = 0.0F, \
825 .callbackHandle = NULL, \
827 .useWithProperties = NULL, \
828 .useWithOwner = NULL, \
849 celix_bundle_context_t *ctx,
870 celix_bundle_context_t *ctx,
1020 celix_bundle_context_t *ctx,
1021 void* callbackHandle,
1022 void (*onStarted)(
void* handle,
const celix_bundle_t *bundle),
1023 void (*onStopped)(
void *handle,
const celix_bundle_t *bundle)
1040 celix_bundle_context_t *ctx,
1041 void* callbackHandle,
1042 void (*onStarted)(
void* handle,
const celix_bundle_t *bundle),
1043 void (*onStopped)(
void *handle,
const celix_bundle_t *bundle)
1112 #define CELIX_EMPTY_BUNDLE_TRACKING_OPTIONS {.callbackHandle = NULL, .onInstalled = NULL, .onStarted = NULL, .onStopped = NULL, .onBundleEvent = NULL, .includeFrameworkBundle = false, .trackerCreatedCallbackData = NULL, .trackerCreatedCallback = NULL}
1129 celix_bundle_context_t *ctx,
1146 celix_bundle_context_t *ctx,
1164 celix_bundle_context_t *ctx,
1166 void *callbackHandle,
1167 void (*use)(
void *handle,
const celix_bundle_t *bundle));
1181 celix_bundle_context_t *ctx,
1182 void *callbackHandle,
1183 void (*use)(
void *handle,
const celix_bundle_t *bundle));
1239 celix_bundle_context_t *ctx,
1240 const char* serviceName,
1241 void *callbackHandle,
1244 void *doneCallbackData,
1245 void (*doneCallback)(
void* doneCallbackData));
1269 celix_bundle_context_t *ctx,
1270 const char* serviceName,
1271 void *callbackHandle,
1310 void* removeCallbackData
1318 #define CELIX_EMPTY_SCHEDULED_EVENT_OPTIONS {NULL, 0.0, 0.0, NULL, NULL, NULL, NULL}
1362 long scheduledEventId);
1377 long scheduledEventId,
1378 double waitTimeInSeconds);
1393 long scheduledEventId);
1408 long scheduledEventId);
1424 long scheduledEventId);
1447 const celix_bundle_context_t *ctx,
1448 celix_log_level_e level,
1450 ...) __attribute__((format(printf,3,4)));
1456 const celix_bundle_context_t *ctx,
1457 celix_log_level_e level,
1459 va_list formatArgs) __attribute__((format(printf,3,0)));
1467 celix_log_level_e level);
1528 #undef CELIX_OPTS_INIT
1534 #endif //CELIX_BUNDLE_CONTEXT_H_
CELIX_FRAMEWORK_EXPORT size_t celix_bundleContext_useServicesWithOptions(celix_bundle_context_t *ctx, const celix_service_use_options_t *opts)
Use the services with the provided service filter options using the provided callback.
CELIX_FRAMEWORK_EXPORT bool celix_bundleContext_useService(celix_bundle_context_t *ctx, const char *serviceName, void *callbackHandle, void(*use)(void *handle, void *svc))
Use the highest ranking service with the provided service name using the provided callback.
CELIX_FRAMEWORK_EXPORT bool celix_bundleContext_useServiceWithId(celix_bundle_context_t *ctx, long serviceId, const char *serviceName, void *callbackHandle, void(*use)(void *handle, void *svc))
Use the service with the provided service id using the provided callback. The Celix framework will en...
CELIX_FRAMEWORK_EXPORT celix_status_t celix_bundleContext_wakeupScheduledEvent(celix_bundle_context_t *ctx, long scheduledEventId)
Wakeup a scheduled event and returns immediately, not waiting for the scheduled event callback to be ...
celix_bundle_context_t * ctx
Definition: celix_bundle_context.h:281
CELIX_FRAMEWORK_EXPORT long celix_bundleContext_getBundleId(const celix_bundle_context_t *ctx)
Returns the bundle if for the bundle of this bundle context.
CELIX_FRAMEWORK_EXPORT void celix_bundleContext_waitForAsyncTracker(celix_bundle_context_t *ctx, long trackerId)
Wait for (async) creation of tracker.
CELIX_FRAMEWORK_EXPORT long celix_bundleContext_registerService(celix_bundle_context_t *ctx, void *svc, const char *serviceName, celix_properties_t *properties)
Register a service to the Celix framework.
CELIX_FRAMEWORK_EXPORT bool celix_bundleContext_useServiceWithOptions(celix_bundle_context_t *ctx, const celix_service_use_options_t *opts)
Use the highest ranking service satisfying the provided service filter options using the provided cal...
void(* addWithOwner)(void *handle, void *svc, const celix_properties_t *props, const celix_bundle_t *svcOwner) CELIX_OPTS_INIT
The optional addWithOwner callback is handled as the add callback, but with the addition that the ser...
Definition: celix_bundle_context.h:557
bool includeFrameworkBundle CELIX_OPTS_INIT
Default the framework bundle (bundle id 0) will not trigger the callbacks. This is done,...
Definition: celix_bundle_context.h:1090
Service registration guard.
Definition: celix_bundle_context.h:280
void(* callback)(void *callbackData) CELIX_OPTS_INIT
Callback function called to process a scheduled event. Will be called on the event thread.
Definition: celix_bundle_context.h:1307
void *trackerCreatedCallbackData CELIX_OPTS_INIT
Data for the trackerCreatedCallback.
Definition: celix_bundle_context.h:1095
double waitTimeoutInSeconds CELIX_OPTS_INIT
An optional timeout (in seconds), if > 0 the use service call will block until the timeout is expired...
Definition: celix_bundle_context.h:776
void *callbackHandle CELIX_OPTS_INIT
The optional callback pointer used in all the provided callback function (set, add,...
Definition: celix_bundle_context.h:517
CELIX_FRAMEWORK_EXPORT void CELIX_FRAMEWORK_EXPORT void CELIX_FRAMEWORK_EXPORT void celix_bundleContext_logTssErrors(const celix_bundle_context_t *ctx, celix_log_level_e level)
Logs celix thread-specific storage error messages(celix_err) ith the provided celix log level....
CELIX_FRAMEWORK_EXPORT long celix_bundleContext_trackServiceTrackersAsync(celix_bundle_context_t *ctx, const char *serviceName, void *callbackHandle, void(*trackerAdd)(void *handle, const celix_service_tracker_info_t *info), void(*trackerRemove)(void *handle, const celix_service_tracker_info_t *info), void *doneCallbackData, void(*doneCallback)(void *doneCallbackData))
Track the service tracker targeting the provided service name.
void(* onBundleEvent)(void *handle, const celix_bundle_event_t *event) CELIX_OPTS_INIT
Definition: celix_bundle_context.h:1084
void *asyncData CELIX_OPTS_INIT
Async data pointer for the async register callback.
Definition: celix_bundle_context.h:192
Service Registration Options when registering services to the Celix framework.
Definition: celix_bundle_context.h:124
CELIX_FRAMEWORK_EXPORT long celix_bundleContext_trackBundles(celix_bundle_context_t *ctx, void *callbackHandle, void(*onStarted)(void *handle, const celix_bundle_t *bundle), void(*onStopped)(void *handle, const celix_bundle_t *bundle))
Track bundles.
const char *serviceName CELIX_OPTS_INIT
The service name.
Definition: celix_bundle_context.h:359
const char *serviceVersion CELIX_OPTS_INIT
The optional service version (in the form of <MAJOR>.<MINOR>.<MICRO>.<QUALIFIER>).
Definition: celix_bundle_context.h:187
void(* trackerCreatedCallback)(void *trackerCreatedCallbackData) CELIX_OPTS_INIT
The callback called when the tracker has ben created (and is active) when using the track bundles asc...
Definition: celix_bundle_context.h:1105
CELIX_FRAMEWORK_EXPORT celix_status_t celix_bundleContext_waitForScheduledEvent(celix_bundle_context_t *ctx, long scheduledEventId, double waitTimeInSeconds)
Wait until the next scheduled event is processed.
The Service Bundle Tracking options can be used to fine tune the requested bundle tracker options.
Definition: celix_bundle_context.h:1049
void(* setWithProperties)(void *handle, void *svc, const celix_properties_t *props) CELIX_OPTS_INIT
The optional setWithProperties callback is handled as the set callback, but with the addition that th...
Definition: celix_bundle_context.h:531
CELIX_FRAMEWORK_EXPORT long celix_bundleContext_findServiceWithOptions(celix_bundle_context_t *ctx, const celix_service_filter_options_t *opts)
Finds the highest ranking service and returns the service id.
CELIX_FRAMEWORK_EXPORT bool celix_bundleContext_removeScheduledEvent(celix_bundle_context_t *ctx, long scheduledEventId)
Cancel and remove a scheduled event.
struct celix_service_registration_options celix_service_registration_options_t
Service Registration Options when registering services to the Celix framework.
CELIX_FRAMEWORK_EXPORT celix_dependency_manager_t * celix_bundleContext_getDependencyManager(celix_bundle_context_t *ctx)
Gets the dependency manager for this bundle context.
CELIX_FRAMEWORK_EXPORT long celix_bundleContext_registerServiceWithOptions(celix_bundle_context_t *ctx, const celix_service_registration_options_t *opts)
Register a service to the Celix framework using the provided service registration options.
CELIX_FRAMEWORK_EXPORT celix_bundle_t * celix_bundleContext_getBundle(const celix_bundle_context_t *ctx)
Returns the bundle for this bundle context.
CELIX_FRAMEWORK_EXPORT long celix_bundleContext_installBundle(celix_bundle_context_t *ctx, const char *bundleUrl, bool autoStart)
Install and optional start a bundle. Will silently ignore bundle ids < 0.
CELIX_FRAMEWORK_EXPORT celix_array_list_t * celix_bundleContext_findServicesWithOptions(celix_bundle_context_t *ctx, const celix_service_filter_options_t *opts)
Finds the services conform the provider filter options and returns a list of the found service ids.
celix_properties_t *properties CELIX_OPTS_INIT
The optional service properties.
Definition: celix_bundle_context.h:170
struct celix_service_registration_guard celix_service_registration_guard_t
Service registration guard.
struct celix_service_use_options celix_service_use_options_t
Service Use Options used to fine tune which services to use and which callbacks to use.
CELIX_FRAMEWORK_EXPORT celix_array_list_t * celix_bundleContext_listBundles(celix_bundle_context_t *ctx)
List the installed and started bundle ids. The bundle ids does not include the framework bundle (bund...
CELIX_FRAMEWORK_EXPORT char * celix_bundleContext_getBundleSymbolicName(celix_bundle_context_t *ctx, long bndId)
Returns the bundle symbolic name for the provided bundle id. The caller is owner of the return string...
CELIX_FRAMEWORK_EXPORT double celix_bundleContext_getPropertyAsDouble(celix_bundle_context_t *ctx, const char *name, double defaultValue)
Get the config property for the given key converted as double value.
void(* useWithOwner)(void *handle, void *svc, const celix_properties_t *props, const celix_bundle_t *svcOwner) CELIX_OPTS_INIT
The optional useWithOwner callback is handled as the yse callback, but with the addition that the ser...
Definition: celix_bundle_context.h:802
const char *versionRange CELIX_OPTS_INIT
The optional version range.
Definition: celix_bundle_context.h:368
struct celix_service_tracking_options celix_service_tracking_options_t
Service Tracker Options used to fine tune which services to track and the callback to be used for the...
void(* remove)(void *handle, void *svc) CELIX_OPTS_INIT
The optional remove callback will be called for every service conform the provided service filter opt...
Definition: celix_bundle_context.h:568
void(* addWithProperties)(void *handle, void *svc, const celix_properties_t *props) CELIX_OPTS_INIT
The optional addWithProperties callback is handled as the add callback, but with the addition that th...
Definition: celix_bundle_context.h:551
void *removeCallbackData CELIX_OPTS_INIT
Data passed to the done callback function when a scheduled event is removed.
Definition: celix_bundle_context.h:1311
CELIX_FRAMEWORK_EXPORT void celix_bundleContext_waitForEvents(celix_bundle_context_t *ctx)
Wait until all Celix event for this bundle are completed.
const char *serviceLanguage CELIX_OPTS_INIT
Definition: celix_bundle_context.h:381
CELIX_FRAMEWORK_EXPORT bool celix_bundleContext_getPropertyAsBool(celix_bundle_context_t *ctx, const char *name, bool defaultValue)
Get the config property for the given key converted as bool value.
CELIX_FRAMEWORK_EXPORT long celix_bundleContext_trackBundlesAsync(celix_bundle_context_t *ctx, void *callbackHandle, void(*onStarted)(void *handle, const celix_bundle_t *bundle), void(*onStopped)(void *handle, const celix_bundle_t *bundle))
Track bundles.
CELIX_FRAMEWORK_EXPORT long celix_bundleContext_trackServiceTrackers(celix_bundle_context_t *ctx, const char *serviceName, void *callbackHandle, void(*trackerAdd)(void *handle, const celix_service_tracker_info_t *info), void(*trackerRemove)(void *handle, const celix_service_tracker_info_t *info))
Track the service tracker targeting the provided service name.
long bundleId
Bundle id of the owner of the service tracker.
Definition: celix_bundle_context.h:1208
CELIX_FRAMEWORK_EXPORT void celix_bundleContext_stopTrackerAsync(celix_bundle_context_t *ctx, long trackerId, void *doneCallbackData, void(*doneCallback)(void *doneCallbackData))
Stop the tracker with the provided track id.
CELIX_FRAMEWORK_EXPORT bool celix_bundleContext_tryRemoveScheduledEventAsync(celix_bundle_context_t *ctx, long scheduledEventId)
Try to cancel and remove a scheduled event asynchronously.
void(* useWithProperties)(void *handle, void *svc, const celix_properties_t *props) CELIX_OPTS_INIT
The optional useWithProperties callback is handled as the use callback, but with the addition that th...
Definition: celix_bundle_context.h:796
const char *filter CELIX_OPTS_INIT
LDAP filter to use for fine tuning the filtering, e.g. (|(location=middle)(location=front))
Definition: celix_bundle_context.h:375
const char *serviceLanguage CELIX_OPTS_INIT
The optional service language.
Definition: celix_bundle_context.h:177
CELIX_FRAMEWORK_EXPORT long celix_bundleContext_registerServiceFactory(celix_bundle_context_t *ctx, celix_service_factory_t *factory, const char *serviceName, celix_properties_t *props)
Register a service factory in the framework.
CELIX_FRAMEWORK_EXPORT bool celix_bundleContext_stopBundle(celix_bundle_context_t *ctx, long bndId)
Stop the bundle with the provided bundle id. Will silently ignore bundle ids < 0.
CELIX_FRAMEWORK_EXPORT long celix_bundleContext_trackBundlesWithOptions(celix_bundle_context_t *ctx, const celix_bundle_tracking_options_t *opts)
Tracks bundles using the provided bundle tracker options.
CELIX_FRAMEWORK_EXPORT long celix_bundleContext_trackServicesAsync(celix_bundle_context_t *ctx, const char *serviceName, void *callbackHandle, void(*add)(void *handle, void *svc), void(*remove)(void *handle, void *svc))
Track services with the provided serviceName.
void(* asyncCallback)(void *data, long serviceId) CELIX_OPTS_INIT
Async callback.
Definition: celix_bundle_context.h:204
celix_service_filter_options_t filter CELIX_OPTS_INIT
The service filter options, used to setup the filter for the service to track.
Definition: celix_bundle_context.h:512
CELIX_FRAMEWORK_EXPORT void celix_bundleContext_stopTracker(celix_bundle_context_t *ctx, long trackerId)
Stop the tracker with the provided track id.
void(* trackerCreatedCallback)(void *trackerCreatedCallbackData) CELIX_OPTS_INIT
The callback called when the tracker has ben created (and is active) when using a async call.
Definition: celix_bundle_context.h:595
CELIX_FRAMEWORK_EXPORT celix_array_list_t * celix_bundleContext_listInstalledBundles(celix_bundle_context_t *ctx)
List the installed bundle ids. The bundle ids does not include the framework bundle (bundle id CELIX_...
CELIX_FRAMEWORK_EXPORT long celix_bundleContext_getPropertyAsLong(celix_bundle_context_t *ctx, const char *name, long defaultValue)
Get the config property for the given key converted as long value.
void(* removeWithOwner)(void *handle, void *svc, const celix_properties_t *props, const celix_bundle_t *svcOwner) CELIX_OPTS_INIT
The optional removeWithOwner callback is handled as the remove callback, but with the addition that t...
Definition: celix_bundle_context.h:580
CELIX_FRAMEWORK_EXPORT void celix_bundleContext_unregisterService(celix_bundle_context_t *ctx, long serviceId)
Unregister the service or service factory with service id.
Service Use Options used to fine tune which services to use and which callbacks to use.
Definition: celix_bundle_context.h:765
CELIX_FRAMEWORK_EXPORT size_t celix_bundleContext_useBundles(celix_bundle_context_t *ctx, void *callbackHandle, void(*use)(void *handle, const celix_bundle_t *bundle))
Use the currently installed bundles.
CELIX_FRAMEWORK_EXPORT bool celix_bundleContext_uninstallBundle(celix_bundle_context_t *ctx, long bndId)
Uninstall the bundle with the provided bundle id. If needed the bundle will be stopped first....
void(* use)(void *handle, void *svc) CELIX_OPTS_INIT
The optional use callback will be called when for every services found conform the service filter opt...
Definition: celix_bundle_context.h:790
CELIX_FRAMEWORK_EXPORT celix_array_list_t * celix_bundleContext_findServices(celix_bundle_context_t *ctx, const char *serviceName)
Finds the services with the provided service name and returns a list of the found service ids.
CELIX_FRAMEWORK_EXPORT long celix_bundleContext_scheduleEvent(celix_bundle_context_t *ctx, const celix_scheduled_event_options_t *options)
Add a scheduled event to the Celix framework.
celix_filter_t * filter
The parsed service filter, e.g. parsed "(&(objectClass=example_calc)(service.language=C)(meta....
Definition: celix_bundle_context.h:1192
double initialDelayInSeconds CELIX_OPTS_INIT
Initial delay in seconds before the event is processed.
Definition: celix_bundle_context.h:1299
void *trackerCreatedCallbackData CELIX_OPTS_INIT
Data for the trackerCreatedCallback.
Definition: celix_bundle_context.h:586
Service Tracker Options used to fine tune which services to track and the callback to be used for the...
Definition: celix_bundle_context.h:508
void(* removeCallback)(void *removeCallbackData) CELIX_OPTS_INIT
Callback function called when a scheduled event is removed. Will be called on the event thread.
Definition: celix_bundle_context.h:1313
CELIX_FRAMEWORK_EXPORT void celix_bundleContext_waitForAsyncStopTracker(celix_bundle_context_t *ctx, long trackerId)
Wait for (async) stopping of tracking.
long svcId
Definition: celix_bundle_context.h:282
int flags CELIX_OPTS_INIT
Definition: celix_bundle_context.h:813
CELIX_FRAMEWORK_EXPORT bool celix_bundleContext_isBundleActive(celix_bundle_context_t *ctx, long bndId)
Check whether the bundle is active.
Service filter options which can be used to query for certain services.
Definition: celix_bundle_context.h:353
CELIX_FRAMEWORK_EXPORT long celix_bundleContext_trackService(celix_bundle_context_t *ctx, const char *serviceName, void *callbackHandle, void(*set)(void *handle, void *svc))
Track the highest ranking service with the provided serviceName.
void(* onStarted)(void *handle, const celix_bundle_t *bundle) CELIX_OPTS_INIT
Tracker callback when a bundle is started.
Definition: celix_bundle_context.h:1069
void *callbackData CELIX_OPTS_INIT
Data passed to the callback function when a event is scheduled.
Definition: celix_bundle_context.h:1305
CELIX_FRAMEWORK_EXPORT void celix_bundleContext_unregisterServiceAsync(celix_bundle_context_t *ctx, long serviceId, void *doneData, void(*doneCallback)(void *doneData))
Unregister the service or service factory with service id.
CELIX_FRAMEWORK_EXPORT void celix_bundleContext_waitForAsyncUnregistration(celix_bundle_context_t *ctx, long serviceId)
Waits til the async service unregistration for the provided serviceId is done.
CELIX_FRAMEWORK_EXPORT void celix_bundleContext_log(const celix_bundle_context_t *ctx, celix_log_level_e level, const char *format,...) __attribute__((format(printf
Logs a message to Celix framework logger with the provided log level.
CELIX_FRAMEWORK_EXPORT long celix_bundleContext_registerServiceFactoryAsync(celix_bundle_context_t *ctx, celix_service_factory_t *factory, const char *serviceName, celix_properties_t *props)
Register a service factory in the framework.
void(* onInstalled)(void *handle, const celix_bundle_t *bundle) CELIX_OPTS_INIT
Tracker callback when a bundle is installed.
Definition: celix_bundle_context.h:1061
struct celix_scheduled_event_options celix_scheduled_event_options_t
const CELIX_FRAMEWORK_EXPORT char * celix_bundleContext_getProperty(celix_bundle_context_t *ctx, const char *key, const char *defaultVal)
Get the config property for the given key.
CELIX_FRAMEWORK_EXPORT long celix_bundleContext_registerServiceAsync(celix_bundle_context_t *ctx, void *svc, const char *serviceName, celix_properties_t *properties)
Register a service to the Celix framework.
struct celix_service_filter_options celix_service_filter_options_t
Service filter options which can be used to query for certain services.
CELIX_FRAMEWORK_EXPORT void celix_bundleContext_waitForAsyncRegistration(celix_bundle_context_t *ctx, long serviceId)
Waits til the async service registration for the provided serviceId is done.
void(* removeWithProperties)(void *handle, void *svc, const celix_properties_t *props) CELIX_OPTS_INIT
The optional removeWithProperties callback is handled as the remove callback, but with the addition t...
Definition: celix_bundle_context.h:574
CELIX_FRAMEWORK_EXPORT bool celix_bundleContext_updateBundle(celix_bundle_context_t *ctx, long bndId, const char *updatedBundleUrl)
Update the bundle with the provided bundle id.
CELIX_FRAMEWORK_EXPORT bool celix_bundleContext_useBundle(celix_bundle_context_t *ctx, long bundleId, void *callbackHandle, void(*use)(void *handle, const celix_bundle_t *bundle))
Use the bundle with the provided bundle id.
Celix scheduled event options, used for creating scheduling events with the celix framework.
Definition: celix_bundle_context.h:1292
CELIX_FRAMEWORK_EXPORT long celix_bundleContext_findService(celix_bundle_context_t *ctx, const char *serviceName)
Finds the highest ranking service and returns the service id.
CELIX_FRAMEWORK_EXPORT bool celix_bundleContext_removeScheduledEventAsync(celix_bundle_context_t *ctx, long scheduledEventId)
Cancel and remove a scheduled event asynchronously.
CELIX_FRAMEWORK_EXPORT size_t celix_bundleContext_useServices(celix_bundle_context_t *ctx, const char *serviceName, void *callbackHandle, void(*use)(void *handle, void *svc))
Use the services with the provided service name using the provided callback.
void(* set)(void *handle, void *svc) CELIX_OPTS_INIT
The optional set callback will be called when a new highest ranking service is available conform the ...
Definition: celix_bundle_context.h:525
CELIX_FRAMEWORK_EXPORT long celix_bundleContext_trackServicesWithOptionsAsync(celix_bundle_context_t *ctx, const celix_service_tracking_options_t *opts)
Tracks services using the provided tracker options.
bool ignoreServiceLanguage CELIX_OPTS_INIT
Definition: celix_bundle_context.h:388
double intervalInSeconds CELIX_OPTS_INIT
Schedule interval in seconds. 0 means one-shot scheduled event.
Definition: celix_bundle_context.h:1301
struct celix_service_tracker_info celix_service_tracker_info_t
Service Tracker Info provided to the service tracker tracker callbacks.
const char *serviceName CELIX_OPTS_INIT
The required service name.
Definition: celix_bundle_context.h:159
celix_service_filter_options_t filter CELIX_OPTS_INIT
The service filter options, used to setup the filter for the service to track.
Definition: celix_bundle_context.h:769
Service Tracker Info provided to the service tracker tracker callbacks.
Definition: celix_bundle_context.h:1188
struct celix_bundle_tracker_options celix_bundle_tracking_options_t
The Service Bundle Tracking options can be used to fine tune the requested bundle tracker options.
void(* setWithOwner)(void *handle, void *svc, const celix_properties_t *props, const celix_bundle_t *svcOwner) CELIX_OPTS_INIT
The optional setWithOwner callback is handled as the set callback, but with the addition that the ser...
Definition: celix_bundle_context.h:537
void(* onStopped)(void *handle, const celix_bundle_t *bundle) CELIX_OPTS_INIT
Tracker callback when a bundle is stopped.
Definition: celix_bundle_context.h:1077
CELIX_FRAMEWORK_EXPORT long celix_bundleContext_trackBundlesWithOptionsAsync(celix_bundle_context_t *ctx, const celix_bundle_tracking_options_t *opts)
Tracks bundles using the provided bundle tracker options.
void *callbackHandle CELIX_OPTS_INIT
The optional callback pointer used in all the provided callback function (set, add,...
Definition: celix_bundle_context.h:781
CELIX_FRAMEWORK_EXPORT void CELIX_FRAMEWORK_EXPORT void celix_bundleContext_vlog(const celix_bundle_context_t *ctx, celix_log_level_e level, const char *format, va_list formatArgs) __attribute__((format(printf
Logs a message to Celix framework logger with the provided log level.
celix_service_factory_t *factory CELIX_OPTS_INIT
The service factory pointer.
Definition: celix_bundle_context.h:151
CELIX_FRAMEWORK_EXPORT bool celix_bundleContext_isServiceRegistered(celix_bundle_context_t *ctx, long serviceId)
Checks whether a service for the provided service id is registered in the service registry.
CELIX_FRAMEWORK_EXPORT long celix_bundleContext_trackServiceAsync(celix_bundle_context_t *ctx, const char *serviceName, void *callbackHandle, void(*set)(void *handle, void *svc))
Track the highest ranking service with the provided serviceName.
CELIX_FRAMEWORK_EXPORT long celix_bundleContext_trackServicesWithOptions(celix_bundle_context_t *ctx, const celix_service_tracking_options_t *opts)
Tracks services using the provided tracker options.
CELIX_FRAMEWORK_EXPORT celix_framework_t * celix_bundleContext_getFramework(const celix_bundle_context_t *ctx)
const char *name CELIX_OPTS_INIT
The name of the event, used for logging and debugging.
Definition: celix_bundle_context.h:1293
CELIX_FRAMEWORK_EXPORT bool celix_bundleContext_isBundleInstalled(celix_bundle_context_t *ctx, long bndId)
Check whether a bundle is installed.
void(* add)(void *handle, void *svc) CELIX_OPTS_INIT
The optional add callback will be called for every current and future service found conform the provi...
Definition: celix_bundle_context.h:545
void *callbackHandle CELIX_OPTS_INIT
The optional callback pointer used in all the provided callback function (set, add,...
Definition: celix_bundle_context.h:1053
CELIX_FRAMEWORK_EXPORT bool celix_bundleContext_startBundle(celix_bundle_context_t *ctx, long bndId)
Start the bundle with the provided bundle id. Will silently ignore bundle ids < 0.
const char * serviceLanguage
Definition: celix_bundle_context.h:1203
void *svc CELIX_OPTS_INIT
The service pointer.
Definition: celix_bundle_context.h:134
CELIX_FRAMEWORK_EXPORT long celix_bundleContext_registerServiceWithOptionsAsync(celix_bundle_context_t *ctx, const celix_service_registration_options_t *opts)
Register a service to the Celix framework using the provided service registration options.
const char * serviceName
The service name filter attribute parsed from the service filter (i.e. the value of the objectClass a...
Definition: celix_bundle_context.h:1197
CELIX_FRAMEWORK_EXPORT long celix_bundleContext_trackServices(celix_bundle_context_t *ctx, const char *serviceName, void *callbackHandle, void(*add)(void *handle, void *svc), void(*remove)(void *handle, void *svc))
Track services with the provided serviceName.