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.
celix_bundle_context.h
Go to the documentation of this file.
1 /*
2  * Licensed to the Apache Software Foundation (ASF) under one
3  * or more contributor license agreements. See the NOTICE file
4  * distributed with this work for additional information
5  * regarding copyright ownership. The ASF licenses this file
6  * to you under the Apache License, Version 2.0 (the
7  * "License"); you may not use this file except in compliance
8  * with the License. You may obtain a copy of the License at
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing,
13  * software distributed under the License is distributed on an
14  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15  * KIND, either express or implied. See the License for the
16  * specific language governing permissions and limitations
17  * under the License.
18  */
19 
20 #ifndef CELIX_BUNDLE_CONTEXT_H_
21 #define CELIX_BUNDLE_CONTEXT_H_
22 
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"
29 
30 #ifdef __cplusplus
31 extern "C" {
32 #endif
33 
37 #ifdef __cplusplus
38 #define CELIX_OPTS_INIT {}
39 #else
40 #define CELIX_OPTS_INIT
41 #endif
42 
57 CELIX_FRAMEWORK_EXPORT long celix_bundleContext_registerServiceAsync(celix_bundle_context_t *ctx, void *svc, const char* serviceName, celix_properties_t *properties);
58 
70 CELIX_FRAMEWORK_EXPORT long celix_bundleContext_registerService(celix_bundle_context_t *ctx, void *svc, const char* serviceName, celix_properties_t *properties);
71 
94 CELIX_FRAMEWORK_EXPORT long celix_bundleContext_registerServiceFactoryAsync(celix_bundle_context_t *ctx, celix_service_factory_t *factory, const char* serviceName, celix_properties_t *props);
95 
114 CELIX_FRAMEWORK_EXPORT long celix_bundleContext_registerServiceFactory(celix_bundle_context_t *ctx, celix_service_factory_t *factory, const char* serviceName, celix_properties_t *props);
115 
129  void *svc CELIX_OPTS_INIT;
130 
146  celix_service_factory_t *factory CELIX_OPTS_INIT;
147 
154  const char* serviceName CELIX_OPTS_INIT;
155 
165  celix_properties_t *properties CELIX_OPTS_INIT;
166 
175  const char* serviceVersion CELIX_OPTS_INIT;
176 
180  void *asyncData CELIX_OPTS_INIT;
181 
192  void (*asyncCallback)(void *data, long serviceId) CELIX_OPTS_INIT;
194 
195 #ifndef __cplusplus
196 
199 #define CELIX_EMPTY_SERVICE_REGISTRATION_OPTIONS { .svc = NULL, \
200  .factory = NULL, \
201  .serviceName = NULL, \
202  .properties = NULL, \
203  .serviceVersion = NULL, \
204  .asyncData = NULL, \
205  .asyncCallback = NULL }
206 #endif
207 
220 CELIX_FRAMEWORK_EXPORT long celix_bundleContext_registerServiceWithOptionsAsync(celix_bundle_context_t *ctx, const celix_service_registration_options_t *opts);
221 
231 CELIX_FRAMEWORK_EXPORT long celix_bundleContext_registerServiceWithOptions(celix_bundle_context_t *ctx, const celix_service_registration_options_t *opts);
232 
239 CELIX_FRAMEWORK_EXPORT void celix_bundleContext_waitForAsyncRegistration(celix_bundle_context_t *ctx, long serviceId);
240 
249 CELIX_FRAMEWORK_EXPORT bool celix_bundleContext_isServiceRegistered(celix_bundle_context_t *ctx, long serviceId);
250 
251 
262 CELIX_FRAMEWORK_EXPORT void celix_bundleContext_unregisterService(celix_bundle_context_t *ctx, long serviceId);
263 
268  celix_bundle_context_t* ctx;
269  long svcId;
271 
278 static CELIX_UNUSED inline celix_service_registration_guard_t
279 celix_serviceRegistrationGuard_init(celix_bundle_context_t* ctx, long serviceId) {
280  return (celix_service_registration_guard_t) { .ctx = ctx, .svcId = serviceId };
281 }
282 
288 static CELIX_UNUSED inline void celix_serviceRegistrationGuard_deinit(celix_service_registration_guard_t* reg) {
289  if (reg->svcId >= 0) {
291  }
292 }
293 
294 CELIX_DEFINE_AUTO_CLEANUP_CLEAR_FUNC(celix_service_registration_guard_t, celix_serviceRegistrationGuard_deinit)
295 
296 
310 CELIX_FRAMEWORK_EXPORT void celix_bundleContext_unregisterServiceAsync(celix_bundle_context_t *ctx, long serviceId, void* doneData, void (*doneCallback)(void* doneData));
311 
317 CELIX_FRAMEWORK_EXPORT void celix_bundleContext_waitForAsyncUnregistration(celix_bundle_context_t *ctx, long serviceId);
318 
326 CELIX_FRAMEWORK_EXPORT long celix_bundleContext_findService(celix_bundle_context_t *ctx, const char* serviceName);
327 
335 CELIX_FRAMEWORK_EXPORT celix_array_list_t* celix_bundleContext_findServices(celix_bundle_context_t *ctx, const char* serviceName);
336 
346  const char* serviceName CELIX_OPTS_INIT;
347 
355  const char* versionRange CELIX_OPTS_INIT;
356 
362  const char* filter CELIX_OPTS_INIT;
364 
365 #ifndef __cplusplus
366 
369 #define CELIX_EMPTY_SERVICE_FILTER_OPTIONS {.serviceName = NULL, .versionRange = NULL, .filter = NULL}
370 #endif
371 
379 CELIX_FRAMEWORK_EXPORT long celix_bundleContext_findServiceWithOptions(celix_bundle_context_t* ctx,
380  const celix_service_filter_options_t* opts);
381 
389 CELIX_FRAMEWORK_EXPORT celix_array_list_t*
390 celix_bundleContext_findServicesWithOptions(celix_bundle_context_t* ctx, const celix_service_filter_options_t* opts);
391 
416 CELIX_FRAMEWORK_DEPRECATED_EXPORT bool celix_bundleContext_useServiceWithId(celix_bundle_context_t* ctx,
417  long serviceId,
418  const char* serviceName /*sanity check*/,
419  void* callbackHandle,
420  void (*use)(void* handle, void* svc));
421 
446 CELIX_FRAMEWORK_DEPRECATED_EXPORT bool celix_bundleContext_useService(
447  celix_bundle_context_t *ctx,
448  const char* serviceName,
449  void *callbackHandle,
450  void (*use)(void *handle, void *svc)
451 );
452 
477 CELIX_FRAMEWORK_DEPRECATED_EXPORT size_t celix_bundleContext_useServices(
478  celix_bundle_context_t *ctx,
479  const char* serviceName,
480  void *callbackHandle,
481  void (*use)(void *handle, void *svc)
482 );
483 
494 
503  double waitTimeoutInSeconds CELIX_OPTS_INIT;
504 
509  void* callbackHandle CELIX_OPTS_INIT;
510 
518  void (*use)(void* handle, void* svc) CELIX_OPTS_INIT;
519 
524  void (*useWithProperties)(void* handle, void* svc, const celix_properties_t* props) CELIX_OPTS_INIT;
525 
530  void (*useWithOwner)(void* handle, void* svc, const celix_properties_t* props, const celix_bundle_t* svcOwner)
533 
534 #ifndef __cplusplus
535 
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, \
543  .use = NULL, \
544  .useWithProperties = NULL, \
545  .useWithOwner = NULL}
546 #endif
547 
568 CELIX_FRAMEWORK_EXPORT bool celix_bundleContext_useServiceWithOptions(
569  celix_bundle_context_t *ctx,
570  const celix_service_use_options_t *opts);
571 
572 
593 CELIX_FRAMEWORK_EXPORT size_t celix_bundleContext_useServicesWithOptions(
594  celix_bundle_context_t *ctx,
595  const celix_service_use_options_t *opts);
596 
608 CELIX_FRAMEWORK_EXPORT long celix_bundleContext_trackServicesAsync(celix_bundle_context_t* ctx,
609  const char* serviceName);
610 
621 CELIX_FRAMEWORK_EXPORT long celix_bundleContext_trackServices(celix_bundle_context_t* ctx, const char* serviceName);
622 
632 
637  void* callbackHandle CELIX_OPTS_INIT;
638 
645  void (*set)(void* handle, void* svc) CELIX_OPTS_INIT;
646 
651  void (*setWithProperties)(void* handle,
652  void* svc,
653  const celix_properties_t* props) CELIX_OPTS_INIT; // highest ranking
654 
659  void (*setWithOwner)(void* handle, void* svc, const celix_properties_t* props, const celix_bundle_t* svcOwner)
661 
668  void (*add)(void* handle, void* svc) CELIX_OPTS_INIT;
669 
674  void (*addWithProperties)(void* handle, void* svc, const celix_properties_t* props) CELIX_OPTS_INIT;
675 
680  void (*addWithOwner)(void* handle, void* svc, const celix_properties_t* props, const celix_bundle_t* svcOwner)
682 
692  void (*remove)(void* handle, void* svc) CELIX_OPTS_INIT;
693 
698  void (*removeWithProperties)(void* handle, void* svc, const celix_properties_t* props) CELIX_OPTS_INIT;
699 
704  void (*removeWithOwner)(void* handle, void* svc, const celix_properties_t* props, const celix_bundle_t* svcOwner)
706 
710  void* trackerCreatedCallbackData CELIX_OPTS_INIT;
711 
719  void (*trackerCreatedCallback)(void* trackerCreatedCallbackData) CELIX_OPTS_INIT;
721 
722 #ifndef __cplusplus
723 
726 #define CELIX_EMPTY_SERVICE_TRACKING_OPTIONS { .filter.serviceName = NULL, \
727  .filter.versionRange = NULL, \
728  .filter.filter = NULL, \
729  .callbackHandle = NULL, \
730  .set = NULL, \
731  .add = NULL, \
732  .remove = 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 }
741 #endif
742 
755 CELIX_FRAMEWORK_EXPORT long
756 celix_bundleContext_trackServicesWithOptionsAsync(celix_bundle_context_t* ctx,
758 
769 CELIX_FRAMEWORK_EXPORT long celix_bundleContext_trackServicesWithOptions(celix_bundle_context_t* ctx,
771 
789 CELIX_FRAMEWORK_EXPORT
790 bool celix_bundleContext_useTrackedService(celix_bundle_context_t* ctx,
791  long trackerId,
792  void* callbackHandle,
793  void (*use)(void* handle, void* svc));
794 
812 CELIX_FRAMEWORK_EXPORT
813 size_t celix_bundleContext_useTrackedServices(celix_bundle_context_t* ctx,
814  long trackerId,
815  void* callbackHandle,
816  void (*use)(void* handle, void* svc));
817 
830  void* callbackHandle CELIX_OPTS_INIT;
831 
840  void (*use)(void* handle, void* svc) CELIX_OPTS_INIT;
841 
851  void (*useWithProperties)(void* handle, void* svc, const celix_properties_t* props) CELIX_OPTS_INIT;
852 
861  void (*useWithOwner)(void* handle, void* svc, const celix_properties_t* props, const celix_bundle_t* svcOwner)
864 
865 #ifndef __cplusplus
866 
869 #define CELIX_EMPTY_TRACKER_SERVICE_USE_OPTIONS \
870  { .callbackHandle = NULL, .use = NULL, .useWithProperties = NULL, .useWithOwner = NULL }
871 #endif
872 
889 CELIX_FRAMEWORK_EXPORT
890 bool celix_bundleContext_useTrackedServiceWithOptions(celix_bundle_context_t* ctx,
891  long trackerId,
893 
910 CELIX_FRAMEWORK_EXPORT
911 size_t celix_bundleContext_useTrackedServicesWithOptions(celix_bundle_context_t* ctx,
912  long trackerId,
914 
924 CELIX_FRAMEWORK_EXPORT
925 size_t celix_bundleContext_getTrackedServiceCount(celix_bundle_context_t *ctx, long trackerId);
926 
936 CELIX_FRAMEWORK_EXPORT
937 const char* celix_bundleContext_getTrackedServiceName(celix_bundle_context_t *ctx, long trackerId);
938 
952 CELIX_FRAMEWORK_EXPORT
953 const char* celix_bundleContext_getTrackedServiceFilter(celix_bundle_context_t* ctx, long trackerId);
954 
969 CELIX_FRAMEWORK_EXPORT void celix_bundleContext_stopTrackerAsync(
970  celix_bundle_context_t *ctx,
971  long trackerId,
972  void *doneCallbackData,
973  void (*doneCallback)(void* doneCallbackData));
974 
984 CELIX_FRAMEWORK_EXPORT void celix_bundleContext_waitForAsyncTracker(celix_bundle_context_t *ctx, long trackerId);
985 
995 CELIX_FRAMEWORK_EXPORT void celix_bundleContext_waitForAsyncStopTracker(celix_bundle_context_t *ctx, long trackerId);
996 
1006 CELIX_FRAMEWORK_EXPORT void celix_bundleContext_stopTracker(celix_bundle_context_t *ctx, long trackerId);
1007 
1015 CELIX_FRAMEWORK_EXPORT
1016 bool celix_bundleContext_isValidTrackerId(celix_bundle_context_t* ctx, long trackerId);
1017 
1021 typedef struct celix_tracker_guard {
1022  celix_bundle_context_t* ctx;
1025 
1032 static CELIX_UNUSED inline celix_tracker_guard_t
1033 celix_trackerGuard_init(celix_bundle_context_t* ctx, long trackerId) {
1034  return (celix_tracker_guard_t) { .ctx = ctx, .trackerId = trackerId };
1035 }
1036 
1042 static CELIX_UNUSED inline void celix_trackerGuard_deinit(celix_tracker_guard_t* trackerGuard) {
1043  if (trackerGuard->trackerId >= 0) {
1044  celix_bundleContext_stopTracker(trackerGuard->ctx, trackerGuard->trackerId);
1045  }
1046 }
1047 
1048 CELIX_DEFINE_AUTO_CLEANUP_CLEAR_FUNC(celix_tracker_guard_t, celix_trackerGuard_deinit)
1049 
1050 
1057 CELIX_FRAMEWORK_EXPORT celix_array_list_t* celix_bundleContext_listBundles(celix_bundle_context_t *ctx);
1058 
1066 CELIX_FRAMEWORK_EXPORT celix_array_list_t* celix_bundleContext_listInstalledBundles(celix_bundle_context_t *ctx);
1067 
1068 
1075 CELIX_FRAMEWORK_EXPORT bool celix_bundleContext_isBundleInstalled(celix_bundle_context_t *ctx, long bndId);
1076 
1083 CELIX_FRAMEWORK_EXPORT bool celix_bundleContext_isBundleActive(celix_bundle_context_t *ctx, long bndId);
1084 
1099 CELIX_FRAMEWORK_EXPORT long celix_bundleContext_installBundle(celix_bundle_context_t *ctx, const char* bundleUrl, bool autoStart);
1100 
1114 CELIX_FRAMEWORK_EXPORT bool celix_bundleContext_uninstallBundle(celix_bundle_context_t *ctx, long bndId);
1115 
1129 CELIX_FRAMEWORK_EXPORT bool celix_bundleContext_stopBundle(celix_bundle_context_t *ctx, long bndId);
1130 
1144 CELIX_FRAMEWORK_EXPORT bool celix_bundleContext_startBundle(celix_bundle_context_t *ctx, long bndId);
1145 
1170 CELIX_FRAMEWORK_EXPORT bool celix_bundleContext_updateBundle(celix_bundle_context_t *ctx, long bndId, const char* updatedBundleUrl);
1171 
1180 CELIX_FRAMEWORK_EXPORT char* celix_bundleContext_getBundleSymbolicName(celix_bundle_context_t *ctx, long bndId);
1181 
1196 CELIX_FRAMEWORK_EXPORT long celix_bundleContext_trackBundlesAsync(
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)
1201 );
1202 
1216 CELIX_FRAMEWORK_EXPORT long celix_bundleContext_trackBundles(
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)
1221 );
1222 
1230  void* callbackHandle CELIX_OPTS_INIT;
1231 
1238  void (*onInstalled)(void *handle, const celix_bundle_t *bundle) CELIX_OPTS_INIT;
1239 
1246  void (*onStarted)(void *handle, const celix_bundle_t *bundle) CELIX_OPTS_INIT;
1247 
1254  void (*onStopped)(void *handle, const celix_bundle_t *bundle) CELIX_OPTS_INIT;
1255 
1261  void (*onBundleEvent)(void *handle, const celix_bundle_event_t *event) CELIX_OPTS_INIT;
1262 
1267  bool includeFrameworkBundle CELIX_OPTS_INIT;
1268 
1272  void *trackerCreatedCallbackData CELIX_OPTS_INIT;
1273 
1282  void (*trackerCreatedCallback)(void *trackerCreatedCallbackData) CELIX_OPTS_INIT;
1284 
1285 #ifndef __cplusplus
1286 
1289 #define CELIX_EMPTY_BUNDLE_TRACKING_OPTIONS {.callbackHandle = NULL, .onInstalled = NULL, .onStarted = NULL, .onStopped = NULL, .onBundleEvent = NULL, .includeFrameworkBundle = false, .trackerCreatedCallbackData = NULL, .trackerCreatedCallback = NULL}
1290 #endif
1291 
1305 CELIX_FRAMEWORK_EXPORT long celix_bundleContext_trackBundlesWithOptionsAsync(
1306  celix_bundle_context_t *ctx,
1308 );
1309 
1322 CELIX_FRAMEWORK_EXPORT long celix_bundleContext_trackBundlesWithOptions(
1323  celix_bundle_context_t *ctx,
1325 );
1326 
1340 CELIX_FRAMEWORK_EXPORT bool celix_bundleContext_useBundle(
1341  celix_bundle_context_t *ctx,
1342  long bundleId,
1343  void *callbackHandle,
1344  void (*use)(void *handle, const celix_bundle_t *bundle));
1345 
1357 CELIX_FRAMEWORK_EXPORT size_t celix_bundleContext_useBundles(
1358  celix_bundle_context_t *ctx,
1359  void *callbackHandle,
1360  void (*use)(void *handle, const celix_bundle_t *bundle));
1361 
1369  celix_filter_t *filter;
1370 
1374  const char* serviceName;
1375 
1379  long bundleId;
1381 
1409 CELIX_FRAMEWORK_EXPORT long celix_bundleContext_trackServiceTrackersAsync(
1410  celix_bundle_context_t *ctx,
1411  const char* serviceName,
1412  void *callbackHandle,
1413  void (*trackerAdd)(void *handle, const celix_service_tracker_info_t *info),
1414  void (*trackerRemove)(void *handle, const celix_service_tracker_info_t *info),
1415  void *doneCallbackData,
1416  void (*doneCallback)(void* doneCallbackData));
1417 
1439 CELIX_FRAMEWORK_EXPORT long celix_bundleContext_trackServiceTrackers(
1440  celix_bundle_context_t *ctx,
1441  const char* serviceName,
1442  void *callbackHandle,
1443  void (*trackerAdd)(void *handle, const celix_service_tracker_info_t *info),
1444  void (*trackerRemove)(void *handle, const celix_service_tracker_info_t *info));
1445 
1451 CELIX_FRAMEWORK_EXPORT celix_dependency_manager_t* celix_bundleContext_getDependencyManager(celix_bundle_context_t *ctx);
1452 
1453 
1457 CELIX_FRAMEWORK_EXPORT void celix_bundleContext_waitForEvents(celix_bundle_context_t *ctx);
1458 
1464  const char* name CELIX_OPTS_INIT;
1470  double initialDelayInSeconds CELIX_OPTS_INIT;
1472  double intervalInSeconds CELIX_OPTS_INIT;
1476  void* callbackData CELIX_OPTS_INIT;
1478  void (*callback)(void* callbackData) CELIX_OPTS_INIT;
1481  void* removeCallbackData
1484  void (*removeCallback)(void* removeCallbackData)
1485  CELIX_OPTS_INIT;
1488 
1489 #define CELIX_EMPTY_SCHEDULED_EVENT_OPTIONS {NULL, 0.0, 0.0, NULL, NULL, NULL, NULL}
1490 
1519 CELIX_FRAMEWORK_EXPORT long celix_bundleContext_scheduleEvent(celix_bundle_context_t* ctx,
1520  const celix_scheduled_event_options_t* options);
1521 
1532 CELIX_FRAMEWORK_EXPORT celix_status_t celix_bundleContext_wakeupScheduledEvent(celix_bundle_context_t* ctx,
1533  long scheduledEventId);
1534 
1547 CELIX_FRAMEWORK_EXPORT celix_status_t celix_bundleContext_waitForScheduledEvent(celix_bundle_context_t* ctx,
1548  long scheduledEventId,
1549  double waitTimeInSeconds);
1550 
1563 CELIX_FRAMEWORK_EXPORT bool celix_bundleContext_removeScheduledEvent(celix_bundle_context_t* ctx,
1564  long scheduledEventId);
1565 
1578 CELIX_FRAMEWORK_EXPORT bool celix_bundleContext_removeScheduledEventAsync(celix_bundle_context_t* ctx,
1579  long scheduledEventId);
1580 
1594 CELIX_FRAMEWORK_EXPORT bool celix_bundleContext_tryRemoveScheduledEventAsync(celix_bundle_context_t* ctx,
1595  long scheduledEventId);
1596 
1600 CELIX_FRAMEWORK_EXPORT celix_bundle_t* celix_bundleContext_getBundle(const celix_bundle_context_t *ctx);
1601 
1602 
1606 CELIX_FRAMEWORK_EXPORT long celix_bundleContext_getBundleId(const celix_bundle_context_t *ctx);
1607 
1608 CELIX_FRAMEWORK_EXPORT celix_framework_t* celix_bundleContext_getFramework(const celix_bundle_context_t *ctx);
1609 
1617 CELIX_FRAMEWORK_EXPORT void celix_bundleContext_log(
1618  const celix_bundle_context_t *ctx,
1619  celix_log_level_e level,
1620  const char* format,
1621  ...) __attribute__((format(printf,3,4)));
1622 
1626 CELIX_FRAMEWORK_EXPORT void celix_bundleContext_vlog(
1627  const celix_bundle_context_t *ctx,
1628  celix_log_level_e level,
1629  const char* format,
1630  va_list formatArgs) __attribute__((format(printf,3,0)));
1631 
1637 CELIX_FRAMEWORK_EXPORT void celix_bundleContext_logTssErrors(const celix_bundle_context_t* ctx,
1638  celix_log_level_e level);
1639 
1652 CELIX_FRAMEWORK_EXPORT const char* celix_bundleContext_getProperty(celix_bundle_context_t *ctx, const char* key, const char* defaultVal);
1653 
1667 CELIX_FRAMEWORK_EXPORT long celix_bundleContext_getPropertyAsLong(celix_bundle_context_t *ctx, const char* name, long defaultValue);
1668 
1682 CELIX_FRAMEWORK_EXPORT double celix_bundleContext_getPropertyAsDouble(celix_bundle_context_t *ctx, const char* name, double defaultValue);
1683 
1697 CELIX_FRAMEWORK_EXPORT bool celix_bundleContext_getPropertyAsBool(celix_bundle_context_t *ctx, const char* name, bool defaultValue);
1698 
1699 #undef CELIX_OPTS_INIT
1700 
1701 #ifdef __cplusplus
1702 }
1703 #endif
1704 
1705 #endif //CELIX_BUNDLE_CONTEXT_H_
celix_bundleContext_useServicesWithOptions
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_bundleContext_wakeupScheduledEvent
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_service_registration_guard::ctx
celix_bundle_context_t * ctx
Definition: celix_bundle_context.h:268
celix_bundleContext_getBundleId
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_bundleContext_useTrackedServiceWithOptions
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_bundleContext_waitForAsyncTracker
CELIX_FRAMEWORK_EXPORT void celix_bundleContext_waitForAsyncTracker(celix_bundle_context_t *ctx, long trackerId)
Wait, if able, for (async) creation of a tracker.
celix_bundleContext_registerService
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_bundleContext_trackServicesAsync
CELIX_FRAMEWORK_EXPORT long celix_bundleContext_trackServicesAsync(celix_bundle_context_t *ctx, const char *serviceName)
Track services with the provided serviceName.
celix_bundleContext_useServiceWithOptions
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...
celix_service_tracking_options::addWithOwner
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
celix_bundle_tracker_options::CELIX_OPTS_INIT
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
celix_service_registration_guard
Service registration guard.
Definition: celix_bundle_context.h:267
celix_scheduled_event_options::callback
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
celix_bundle_tracker_options::CELIX_OPTS_INIT
void *trackerCreatedCallbackData CELIX_OPTS_INIT
Data for the trackerCreatedCallback.
Definition: celix_bundle_context.h:1272
celix_service_use_options::CELIX_OPTS_INIT
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
celix_service_tracking_options::CELIX_OPTS_INIT
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_bundleContext_logTssErrors
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_bundleContext_trackServiceTrackersAsync
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.
celix_bundle_tracker_options::onBundleEvent
void(* onBundleEvent)(void *handle, const celix_bundle_event_t *event) CELIX_OPTS_INIT
Definition: celix_bundle_context.h:1261
celix_service_registration_options::CELIX_OPTS_INIT
void *asyncData CELIX_OPTS_INIT
Async data pointer for the async register callback.
Definition: celix_bundle_context.h:180
celix_service_registration_options
Service Registration Options when registering services to the Celix framework.
Definition: celix_bundle_context.h:119
celix_bundleContext_useTrackedService
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_bundleContext_trackBundles
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.
celix_service_filter_options::CELIX_OPTS_INIT
const char *serviceName CELIX_OPTS_INIT
The service name.
Definition: celix_bundle_context.h:346
celix_bundleContext_useServices
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.
celix_service_registration_options::CELIX_OPTS_INIT
const char *serviceVersion CELIX_OPTS_INIT
The optional service version (in the form of <MAJOR>.<MINOR>.<MICRO>.<QUALIFIER>).
Definition: celix_bundle_context.h:175
celix_bundle_tracker_options::trackerCreatedCallback
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_bundleContext_waitForScheduledEvent
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.
celix_bundle_tracker_options
The Service Bundle Tracking options can be used to fine tune the requested bundle tracker options.
Definition: celix_bundle_context.h:1226
celix_service_tracking_options::setWithProperties
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_bundleContext_findServiceWithOptions
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_bundleContext_removeScheduledEvent
CELIX_FRAMEWORK_EXPORT bool celix_bundleContext_removeScheduledEvent(celix_bundle_context_t *ctx, long scheduledEventId)
Cancel and remove a scheduled event.
celix_service_registration_options_t
struct celix_service_registration_options celix_service_registration_options_t
Service Registration Options when registering services to the Celix framework.
celix_bundleContext_getDependencyManager
CELIX_FRAMEWORK_EXPORT celix_dependency_manager_t * celix_bundleContext_getDependencyManager(celix_bundle_context_t *ctx)
Gets the dependency manager for this bundle context.
celix_bundleContext_registerServiceWithOptions
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_bundleContext_getTrackedServiceName
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_bundleContext_getBundle
CELIX_FRAMEWORK_EXPORT celix_bundle_t * celix_bundleContext_getBundle(const celix_bundle_context_t *ctx)
Returns the bundle for this bundle context.
celix_bundleContext_installBundle
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_bundleContext_getTrackedServiceFilter
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_bundleContext_findServicesWithOptions
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_service_registration_options::CELIX_OPTS_INIT
celix_properties_t *properties CELIX_OPTS_INIT
The optional service properties.
Definition: celix_bundle_context.h:165
celix_service_registration_guard_t
struct celix_service_registration_guard celix_service_registration_guard_t
Service registration guard.
celix_service_use_options_t
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_bundleContext_listBundles
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_bundleContext_useTrackedServicesWithOptions
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_bundleContext_getBundleSymbolicName
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_bundleContext_getPropertyAsDouble
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.
celix_service_use_options::useWithOwner
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
celix_tracked_service_use_options::useWithProperties
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
celix_service_filter_options::CELIX_OPTS_INIT
const char *versionRange CELIX_OPTS_INIT
The optional version range.
Definition: celix_bundle_context.h:355
celix_service_tracking_options_t
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...
celix_service_tracking_options::remove
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
celix_service_tracking_options::addWithProperties
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
celix_scheduled_event_options::CELIX_OPTS_INIT
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_bundleContext_waitForEvents
CELIX_FRAMEWORK_EXPORT void celix_bundleContext_waitForEvents(celix_bundle_context_t *ctx)
Wait until all Celix event for this bundle are completed.
celix_bundleContext_getTrackedServiceCount
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_bundleContext_getPropertyAsBool
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_tracker_guard
Tracker guard.
Definition: celix_bundle_context.h:1021
celix_bundleContext_trackBundlesAsync
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_bundleContext_trackServiceTrackers
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.
celix_service_tracker_info::bundleId
long bundleId
Bundle id of the owner of the service tracker.
Definition: celix_bundle_context.h:1379
celix_bundleContext_useService
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_bundleContext_stopTrackerAsync
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_bundleContext_tryRemoveScheduledEventAsync
CELIX_FRAMEWORK_EXPORT bool celix_bundleContext_tryRemoveScheduledEventAsync(celix_bundle_context_t *ctx, long scheduledEventId)
Try to cancel and remove a scheduled event asynchronously.
celix_service_use_options::useWithProperties
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
celix_service_filter_options::CELIX_OPTS_INIT
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
celix_tracked_service_use_options::CELIX_OPTS_INIT
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_bundleContext_registerServiceFactory
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_bundleContext_stopBundle
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_bundleContext_trackBundlesWithOptions
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_service_registration_options::asyncCallback
void(* asyncCallback)(void *data, long serviceId) CELIX_OPTS_INIT
Async callback.
Definition: celix_bundle_context.h:192
celix_tracker_guard_t
struct celix_tracker_guard celix_tracker_guard_t
Tracker guard.
celix_service_tracking_options::CELIX_OPTS_INIT
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_bundleContext_stopTracker
CELIX_FRAMEWORK_EXPORT void celix_bundleContext_stopTracker(celix_bundle_context_t *ctx, long trackerId)
Stop the tracker with the provided track id.
celix_bundleContext_trackServices
CELIX_FRAMEWORK_EXPORT long celix_bundleContext_trackServices(celix_bundle_context_t *ctx, const char *serviceName)
Track services with the provided serviceName.
celix_tracker_guard::trackerId
long trackerId
Definition: celix_bundle_context.h:1023
celix_service_tracking_options::trackerCreatedCallback
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_bundleContext_listInstalledBundles
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_bundleContext_getPropertyAsLong
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.
celix_service_tracking_options::removeWithOwner
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_bundleContext_unregisterService
CELIX_FRAMEWORK_EXPORT void celix_bundleContext_unregisterService(celix_bundle_context_t *ctx, long serviceId)
Unregister the service or service factory with service id.
celix_service_use_options
Service Use Options used to fine tune which services to use and which callbacks to use.
Definition: celix_bundle_context.h:489
celix_tracked_service_use_options_t
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_bundleContext_useBundles
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_bundleContext_uninstallBundle
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....
celix_service_use_options::use
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_bundleContext_findServices
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_bundleContext_scheduleEvent
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_service_tracker_info::filter
celix_filter_t * filter
The parsed service filter, e.g. parsed "(&(objectClass=example_calc)(meta.info=foo))".
Definition: celix_bundle_context.h:1369
celix_tracked_service_use_options
Options for using services tracked by a service tracker. These options enable specifying callbacks to...
Definition: celix_bundle_context.h:823
celix_scheduled_event_options::CELIX_OPTS_INIT
double initialDelayInSeconds CELIX_OPTS_INIT
Initial delay in seconds before the event is processed.
Definition: celix_bundle_context.h:1470
celix_service_tracking_options::CELIX_OPTS_INIT
void *trackerCreatedCallbackData CELIX_OPTS_INIT
Data for the trackerCreatedCallback.
Definition: celix_bundle_context.h:710
celix_service_tracking_options
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
celix_scheduled_event_options::removeCallback
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_bundleContext_waitForAsyncStopTracker
CELIX_FRAMEWORK_EXPORT void celix_bundleContext_waitForAsyncStopTracker(celix_bundle_context_t *ctx, long trackerId)
Wait, if able, for (async) stopping of tracking.
celix_service_registration_guard::svcId
long svcId
Definition: celix_bundle_context.h:269
celix_bundleContext_isBundleActive
CELIX_FRAMEWORK_EXPORT bool celix_bundleContext_isBundleActive(celix_bundle_context_t *ctx, long bndId)
Check whether the bundle is active.
celix_service_filter_options
Service filter options which can be used to query for certain services.
Definition: celix_bundle_context.h:340
celix_bundle_tracker_options::onStarted
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
celix_scheduled_event_options::CELIX_OPTS_INIT
void *callbackData CELIX_OPTS_INIT
Data passed to the callback function when a event is scheduled.
Definition: celix_bundle_context.h:1476
celix_bundleContext_unregisterServiceAsync
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_bundleContext_waitForAsyncUnregistration
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_bundleContext_log
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_bundleContext_registerServiceFactoryAsync
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.
celix_bundle_tracker_options::onInstalled
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
celix_scheduled_event_options_t
struct celix_scheduled_event_options celix_scheduled_event_options_t
celix_bundleContext_getProperty
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_bundleContext_registerServiceAsync
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.
celix_service_filter_options_t
struct celix_service_filter_options celix_service_filter_options_t
Service filter options which can be used to query for certain services.
celix_bundleContext_waitForAsyncRegistration
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.
celix_service_tracking_options::removeWithProperties
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_bundleContext_updateBundle
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_bundleContext_useBundle
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
Celix scheduled event options, used for creating scheduling events with the celix framework.
Definition: celix_bundle_context.h:1463
celix_bundleContext_findService
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_bundleContext_removeScheduledEventAsync
CELIX_FRAMEWORK_EXPORT bool celix_bundleContext_removeScheduledEventAsync(celix_bundle_context_t *ctx, long scheduledEventId)
Cancel and remove a scheduled event asynchronously.
celix_service_tracking_options::set
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
celix_tracked_service_use_options::use
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_bundleContext_trackServicesWithOptionsAsync
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.
celix_scheduled_event_options::CELIX_OPTS_INIT
double intervalInSeconds CELIX_OPTS_INIT
Schedule interval in seconds. 0 means one-shot scheduled event.
Definition: celix_bundle_context.h:1472
celix_service_tracker_info_t
struct celix_service_tracker_info celix_service_tracker_info_t
Service Tracker Info provided to the service tracker tracker callbacks.
celix_service_registration_options::CELIX_OPTS_INIT
const char *serviceName CELIX_OPTS_INIT
The required service name.
Definition: celix_bundle_context.h:154
celix_service_use_options::CELIX_OPTS_INIT
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
celix_service_tracker_info
Service Tracker Info provided to the service tracker tracker callbacks.
Definition: celix_bundle_context.h:1365
celix_bundle_tracking_options_t
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.
celix_service_tracking_options::setWithOwner
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
celix_bundle_tracker_options::onStopped
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_bundleContext_trackBundlesWithOptionsAsync
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.
celix_service_use_options::CELIX_OPTS_INIT
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_bundleContext_vlog
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_bundleContext_useServiceWithId
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_registration_options::CELIX_OPTS_INIT
celix_service_factory_t *factory CELIX_OPTS_INIT
The service factory pointer.
Definition: celix_bundle_context.h:146
celix_bundleContext_isServiceRegistered
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_bundleContext_useTrackedServices
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_bundleContext_trackServicesWithOptions
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_bundleContext_isValidTrackerId
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_bundleContext_getFramework
CELIX_FRAMEWORK_EXPORT celix_framework_t * celix_bundleContext_getFramework(const celix_bundle_context_t *ctx)
celix_tracked_service_use_options::useWithOwner
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
celix_scheduled_event_options::CELIX_OPTS_INIT
const char *name CELIX_OPTS_INIT
The name of the event, used for logging and debugging.
Definition: celix_bundle_context.h:1464
celix_bundleContext_isBundleInstalled
CELIX_FRAMEWORK_EXPORT bool celix_bundleContext_isBundleInstalled(celix_bundle_context_t *ctx, long bndId)
Check whether a bundle is installed.
celix_service_tracking_options::add
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
celix_bundle_tracker_options::CELIX_OPTS_INIT
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_bundleContext_startBundle
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.
celix_service_registration_options::CELIX_OPTS_INIT
void *svc CELIX_OPTS_INIT
The service pointer.
Definition: celix_bundle_context.h:129
celix_bundleContext_registerServiceWithOptionsAsync
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.
celix_service_tracker_info::serviceName
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_tracker_guard::ctx
celix_bundle_context_t * ctx
Definition: celix_bundle_context.h:1022