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_BUNDLE_CONTEXT_H_
21 #define CELIX_BUNDLE_CONTEXT_H_
23 #include "celix_bundle_context_type.h"
24 #include "celix_framework_export.h"
25 #include "celix_filter.h"
26 #include "celix_service_factory.h"
27 #include "celix_bundle_event.h"
28 #include "celix_log_level.h"
38 #define CELIX_OPTS_INIT {}
40 #define CELIX_OPTS_INIT
199 #define CELIX_EMPTY_SERVICE_REGISTRATION_OPTIONS { .svc = NULL, \
201 .serviceName = NULL, \
202 .properties = NULL, \
203 .serviceVersion = NULL, \
205 .asyncCallback = NULL }
268 celix_bundle_context_t*
ctx;
279 celix_serviceRegistrationGuard_init(celix_bundle_context_t* ctx,
long serviceId) {
289 if (reg->
svcId >= 0) {
369 #define CELIX_EMPTY_SERVICE_FILTER_OPTIONS {.serviceName = NULL, .versionRange = NULL, .filter = NULL}
389 CELIX_FRAMEWORK_EXPORT celix_array_list_t*
418 const char* serviceName ,
419 void* callbackHandle,
420 void (*use)(
void* handle,
void* svc));
447 celix_bundle_context_t *ctx,
448 const char* serviceName,
449 void *callbackHandle,
450 void (*use)(
void *handle,
void *svc)
478 celix_bundle_context_t *ctx,
479 const char* serviceName,
480 void *callbackHandle,
481 void (*use)(
void *handle,
void *svc)
530 void (*
useWithOwner)(
void* handle,
void* svc,
const celix_properties_t* props,
const celix_bundle_t* svcOwner)
538 #define CELIX_EMPTY_SERVICE_USE_OPTIONS {.filter.serviceName = NULL, \
539 .filter.versionRange = NULL, \
540 .filter.filter = NULL, \
541 .waitTimeoutInSeconds = 0.0F, \
542 .callbackHandle = NULL, \
544 .useWithProperties = NULL, \
545 .useWithOwner = NULL}
569 celix_bundle_context_t *ctx,
594 celix_bundle_context_t *ctx,
609 const char* serviceName);
659 void (*
setWithOwner)(
void* handle,
void* svc,
const celix_properties_t* props,
const celix_bundle_t* svcOwner)
680 void (*
addWithOwner)(
void* handle,
void* svc,
const celix_properties_t* props,
const celix_bundle_t* svcOwner)
704 void (*
removeWithOwner)(
void* handle,
void* svc,
const celix_properties_t* props,
const celix_bundle_t* svcOwner)
726 #define CELIX_EMPTY_SERVICE_TRACKING_OPTIONS { .filter.serviceName = NULL, \
727 .filter.versionRange = NULL, \
728 .filter.filter = NULL, \
729 .callbackHandle = NULL, \
733 .setWithProperties = NULL, \
734 .addWithProperties = NULL, \
735 .removeWithProperties = NULL, \
736 .setWithOwner = NULL, \
737 .addWithOwner = NULL, \
738 .removeWithOwner = NULL, \
739 .trackerCreatedCallbackData = NULL, \
740 .trackerCreatedCallback = NULL }
755 CELIX_FRAMEWORK_EXPORT
long
789 CELIX_FRAMEWORK_EXPORT
792 void* callbackHandle,
793 void (*use)(
void* handle,
void* svc));
812 CELIX_FRAMEWORK_EXPORT
815 void* callbackHandle,
816 void (*use)(
void* handle,
void* svc));
861 void (*
useWithOwner)(
void* handle,
void* svc,
const celix_properties_t* props,
const celix_bundle_t* svcOwner)
869 #define CELIX_EMPTY_TRACKER_SERVICE_USE_OPTIONS \
870 { .callbackHandle = NULL, .use = NULL, .useWithProperties = NULL, .useWithOwner = NULL }
889 CELIX_FRAMEWORK_EXPORT
910 CELIX_FRAMEWORK_EXPORT
924 CELIX_FRAMEWORK_EXPORT
936 CELIX_FRAMEWORK_EXPORT
952 CELIX_FRAMEWORK_EXPORT
970 celix_bundle_context_t *ctx,
972 void *doneCallbackData,
973 void (*doneCallback)(
void* doneCallbackData));
1015 CELIX_FRAMEWORK_EXPORT
1033 celix_trackerGuard_init(celix_bundle_context_t* ctx,
long trackerId) {
1197 celix_bundle_context_t *ctx,
1198 void* callbackHandle,
1199 void (*onStarted)(
void* handle,
const celix_bundle_t *bundle),
1200 void (*onStopped)(
void *handle,
const celix_bundle_t *bundle)
1217 celix_bundle_context_t *ctx,
1218 void* callbackHandle,
1219 void (*onStarted)(
void* handle,
const celix_bundle_t *bundle),
1220 void (*onStopped)(
void *handle,
const celix_bundle_t *bundle)
1289 #define CELIX_EMPTY_BUNDLE_TRACKING_OPTIONS {.callbackHandle = NULL, .onInstalled = NULL, .onStarted = NULL, .onStopped = NULL, .onBundleEvent = NULL, .includeFrameworkBundle = false, .trackerCreatedCallbackData = NULL, .trackerCreatedCallback = NULL}
1306 celix_bundle_context_t *ctx,
1323 celix_bundle_context_t *ctx,
1341 celix_bundle_context_t *ctx,
1343 void *callbackHandle,
1344 void (*use)(
void *handle,
const celix_bundle_t *bundle));
1358 celix_bundle_context_t *ctx,
1359 void *callbackHandle,
1360 void (*use)(
void *handle,
const celix_bundle_t *bundle));
1410 celix_bundle_context_t *ctx,
1411 const char* serviceName,
1412 void *callbackHandle,
1415 void *doneCallbackData,
1416 void (*doneCallback)(
void* doneCallbackData));
1440 celix_bundle_context_t *ctx,
1441 const char* serviceName,
1442 void *callbackHandle,
1481 void* removeCallbackData
1489 #define CELIX_EMPTY_SCHEDULED_EVENT_OPTIONS {NULL, 0.0, 0.0, NULL, NULL, NULL, NULL}
1533 long scheduledEventId);
1548 long scheduledEventId,
1549 double waitTimeInSeconds);
1564 long scheduledEventId);
1579 long scheduledEventId);
1595 long scheduledEventId);
1618 const celix_bundle_context_t *ctx,
1619 celix_log_level_e level,
1621 ...) __attribute__((format(printf,3,4)));
1627 const celix_bundle_context_t *ctx,
1628 celix_log_level_e level,
1630 va_list formatArgs) __attribute__((format(printf,3,0)));
1638 celix_log_level_e level);
1699 #undef CELIX_OPTS_INIT
1705 #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 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:268
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 bool celix_bundleContext_useTrackedServiceWithOptions(celix_bundle_context_t *ctx, long trackerId, const celix_tracked_service_use_options_t *opts)
Use the highest-ranking service tracked by the specified tracker id by invoking the callbacks specifi...
CELIX_FRAMEWORK_EXPORT void celix_bundleContext_waitForAsyncTracker(celix_bundle_context_t *ctx, long trackerId)
Wait, if able, for (async) creation of a 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 long celix_bundleContext_trackServicesAsync(celix_bundle_context_t *ctx, const char *serviceName)
Track services with the provided serviceName.
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:680
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:1267
Service registration guard.
Definition: celix_bundle_context.h:267
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:1478
void *trackerCreatedCallbackData CELIX_OPTS_INIT
Data for the trackerCreatedCallback.
Definition: celix_bundle_context.h:1272
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:503
void *callbackHandle CELIX_OPTS_INIT
The optional callback pointer used in all the provided callback function (set, add,...
Definition: celix_bundle_context.h:637
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:1261
void *asyncData CELIX_OPTS_INIT
Async data pointer for the async register callback.
Definition: celix_bundle_context.h:180
Service Registration Options when registering services to the Celix framework.
Definition: celix_bundle_context.h:119
CELIX_FRAMEWORK_EXPORT bool celix_bundleContext_useTrackedService(celix_bundle_context_t *ctx, long trackerId, void *callbackHandle, void(*use)(void *handle, void *svc))
Use the highest-ranking service tracked by the specified tracker id by invoking the provided use call...
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:346
CELIX_FRAMEWORK_DEPRECATED_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.
const char *serviceVersion CELIX_OPTS_INIT
The optional service version (in the form of <MAJOR>.<MINOR>.<MICRO>.<QUALIFIER>).
Definition: celix_bundle_context.h:175
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:1282
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:1226
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:651
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.
const CELIX_FRAMEWORK_EXPORT char * celix_bundleContext_getTrackedServiceName(celix_bundle_context_t *ctx, long trackerId)
Get the service name of the tracked services for the provided tracker id.
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.
const CELIX_FRAMEWORK_EXPORT char * celix_bundleContext_getTrackedServiceFilter(celix_bundle_context_t *ctx, long trackerId)
Get the service filter of the tracked services for the provided tracker id.
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:165
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 size_t celix_bundleContext_useTrackedServicesWithOptions(celix_bundle_context_t *ctx, long trackerId, const celix_tracked_service_use_options_t *opts)
Use the services tracked by the specified tracker id by invoking the callbacks specified in the provi...
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:530
void(* useWithProperties)(void *handle, void *svc, const celix_properties_t *props) CELIX_OPTS_INIT
An optional callback invoked for each tracked service that matches the selection criteria,...
Definition: celix_bundle_context.h:851
const char *versionRange CELIX_OPTS_INIT
The optional version range.
Definition: celix_bundle_context.h:355
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:692
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:674
void *removeCallbackData CELIX_OPTS_INIT
Data passed to the done callback function when a scheduled event is removed.
Definition: celix_bundle_context.h:1482
CELIX_FRAMEWORK_EXPORT void celix_bundleContext_waitForEvents(celix_bundle_context_t *ctx)
Wait until all Celix event for this bundle are completed.
CELIX_FRAMEWORK_EXPORT size_t celix_bundleContext_getTrackedServiceCount(celix_bundle_context_t *ctx, long trackerId)
Get the number of tracked services for the provided tracker id.
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.
Tracker guard.
Definition: celix_bundle_context.h:1021
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:1379
CELIX_FRAMEWORK_DEPRECATED_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 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:524
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:362
void *callbackHandle CELIX_OPTS_INIT
An optional pointer to a user-defined context or data structure, passed to all specified callback fun...
Definition: celix_bundle_context.h:830
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.
void(* asyncCallback)(void *data, long serviceId) CELIX_OPTS_INIT
Async callback.
Definition: celix_bundle_context.h:192
struct celix_tracker_guard celix_tracker_guard_t
Tracker guard.
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:631
CELIX_FRAMEWORK_EXPORT void celix_bundleContext_stopTracker(celix_bundle_context_t *ctx, long trackerId)
Stop the tracker with the provided track id.
CELIX_FRAMEWORK_EXPORT long celix_bundleContext_trackServices(celix_bundle_context_t *ctx, const char *serviceName)
Track services with the provided serviceName.
long trackerId
Definition: celix_bundle_context.h:1023
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:719
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:704
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:489
struct celix_tracked_service_use_options celix_tracked_service_use_options_t
Options for using services tracked by a service tracker. These options enable specifying callbacks to...
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:518
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)(meta.info=foo))".
Definition: celix_bundle_context.h:1369
Options for using services tracked by a service tracker. These options enable specifying callbacks to...
Definition: celix_bundle_context.h:823
double initialDelayInSeconds CELIX_OPTS_INIT
Initial delay in seconds before the event is processed.
Definition: celix_bundle_context.h:1470
void *trackerCreatedCallbackData CELIX_OPTS_INIT
Data for the trackerCreatedCallback.
Definition: celix_bundle_context.h:710
Service Tracker Options used to fine tune which services to track and the callback to be used for the...
Definition: celix_bundle_context.h:627
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:1484
CELIX_FRAMEWORK_EXPORT void celix_bundleContext_waitForAsyncStopTracker(celix_bundle_context_t *ctx, long trackerId)
Wait, if able, for (async) stopping of tracking.
long svcId
Definition: celix_bundle_context.h:269
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:340
void(* onStarted)(void *handle, const celix_bundle_t *bundle) CELIX_OPTS_INIT
Tracker callback when a bundle is started.
Definition: celix_bundle_context.h:1246
void *callbackData CELIX_OPTS_INIT
Data passed to the callback function when a event is scheduled.
Definition: celix_bundle_context.h:1476
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:1238
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:698
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:1463
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.
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:645
void(* use)(void *handle, void *svc) CELIX_OPTS_INIT
An optional callback invoked for each tracked service that matches the selection criteria....
Definition: celix_bundle_context.h:840
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.
double intervalInSeconds CELIX_OPTS_INIT
Schedule interval in seconds. 0 means one-shot scheduled event.
Definition: celix_bundle_context.h:1472
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:154
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:493
Service Tracker Info provided to the service tracker tracker callbacks.
Definition: celix_bundle_context.h:1365
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:659
void(* onStopped)(void *handle, const celix_bundle_t *bundle) CELIX_OPTS_INIT
Tracker callback when a bundle is stopped.
Definition: celix_bundle_context.h:1254
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 (use, useWithProperties,...
Definition: celix_bundle_context.h:509
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_FRAMEWORK_DEPRECATED_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_service_factory_t *factory CELIX_OPTS_INIT
The service factory pointer.
Definition: celix_bundle_context.h:146
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 size_t celix_bundleContext_useTrackedServices(celix_bundle_context_t *ctx, long trackerId, void *callbackHandle, void(*use)(void *handle, void *svc))
Use the services tracked by the specified tracker id by invoking the provided use callback.
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 bool celix_bundleContext_isValidTrackerId(celix_bundle_context_t *ctx, long trackerId)
Returns true if the provided tracker id is a tracker id for an existing tracker for the provided bund...
CELIX_FRAMEWORK_EXPORT celix_framework_t * celix_bundleContext_getFramework(const celix_bundle_context_t *ctx)
void(* useWithOwner)(void *handle, void *svc, const celix_properties_t *props, const celix_bundle_t *svcOwner) CELIX_OPTS_INIT
An optional callback invoked for each tracked service that matches the selection criteria,...
Definition: celix_bundle_context.h:861
const char *name CELIX_OPTS_INIT
The name of the event, used for logging and debugging.
Definition: celix_bundle_context.h:1464
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:668
void *callbackHandle CELIX_OPTS_INIT
The optional callback pointer used in all the provided callback function (set, add,...
Definition: celix_bundle_context.h:1230
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.
void *svc CELIX_OPTS_INIT
The service pointer.
Definition: celix_bundle_context.h:129
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:1374
celix_bundle_context_t * ctx
Definition: celix_bundle_context.h:1022