#include "celix_types.h"
#include "celix_errno.h"
#include "celix_threads.h"
#include "celix_dm_info.h"
Go to the source code of this file.
|
celix_dm_service_dependency_t * | celix_dmServiceDependency_create (void) |
|
void | celix_dmServiceDependency_destroy (celix_dm_service_dependency_t *dep) |
|
celix_status_t | celix_dmServiceDependency_setRequired (celix_dm_service_dependency_t *dependency, bool required) |
|
celix_status_t | celix_dmServiceDependency_setAddCLanguageFilter (celix_dm_service_dependency_t *dependency, bool addCLangFilter) |
|
celix_status_t | celix_dmServiceDependency_setStrategy (celix_dm_service_dependency_t *dependency, celix_dm_service_dependency_strategy_t strategy) |
|
celix_dm_service_dependency_strategy_t | celix_dmServiceDependency_getStrategy (celix_dm_service_dependency_t *dependency) |
|
celix_status_t | celix_dmServiceDependency_setService (celix_dm_service_dependency_t *dependency, const char *serviceName, const char *serviceVersionRange, const char *filter) |
|
const char * | celix_dmServiceDependency_getFilter (celix_dm_service_dependency_t *dependency) |
|
celix_status_t | celix_dmServiceDependency_setCallback (celix_dm_service_dependency_t *dependency, celix_dm_service_update_fp set) |
|
celix_status_t | celix_dmServiceDependency_setCallbackWithProperties (celix_dm_service_dependency_t *dependency, celix_dm_service_update_with_props_fp set) |
|
celix_status_t | celix_dmServiceDependency_setCallbacksWithOptions (celix_dm_service_dependency_t *dependency, const celix_dm_service_dependency_callback_options_t *opts) |
|
celix_status_t | celix_dmServiceDependency_setCallbackHandle (celix_dm_service_dependency_t *dependency, void *handle) |
|
dm_service_dependency_info_t * | celix_dmServiceDependency_createInfo (celix_dm_service_dependency_t *dep) |
|
void | celix_dmServiceDependency_destroyInfo (celix_dm_service_dependency_t *dep, dm_service_dependency_info_t *info) |
|
#define CELIX_EMPTY_DM_SERVICE_DEPENDENCY_CALLBACK_OPTIONS |
Value:{ .set = NULL, \
.add = NULL, \
.remove = NULL, \
.swap = NULL, \
.setWithProps = NULL, \
.addWithProps = NULL, \
.removeWithProps = NULL, \
.swapWithProps = NULL }
typedef int(* celix_dm_service_swap_fp) (void *handle, void *oldService, void *newService) |
typedef int(* celix_dm_service_swap_with_props_fp) (void *handle, void *oldService, void *newService, const celix_properties_t *newProps) |
typedef int(* celix_dm_service_update_fp) (void *handle, void *service) |
typedef int(* celix_dm_service_update_with_props_fp) (void *handle, void *service, const celix_properties_t *props) |
Enumerator |
---|
DM_SERVICE_DEPENDENCY_STRATEGY_LOCKING |
|
DM_SERVICE_DEPENDENCY_STRATEGY_SUSPEND |
|
celix_dm_service_dependency_t* celix_dmServiceDependency_create |
( |
void |
| ) |
|
Create a service dependency. Caller has ownership.
Creates a service dependency info. The service dependency info struct contains information about the service dependency. The caller is the owner
void celix_dmServiceDependency_destroy |
( |
celix_dm_service_dependency_t * |
dep | ) |
|
Destroys a service dependency. Caller has ownership.
Destroy a provided service dependency info struct.
const char* celix_dmServiceDependency_getFilter |
( |
celix_dm_service_dependency_t * |
dependency | ) |
|
Returns the service dependency filter.
Return the service dependency update strategy.
celix_status_t celix_dmServiceDependency_setAddCLanguageFilter |
( |
celix_dm_service_dependency_t * |
dependency, |
|
|
bool |
addCLangFilter |
|
) |
| |
Specify if the service dependency should add a C language filter for this dependency if no "service.lang" part is found the in the provided filter. Default is false
celix_status_t celix_dmServiceDependency_setCallback |
( |
celix_dm_service_dependency_t * |
dependency, |
|
|
celix_dm_service_update_fp |
set |
|
) |
| |
Set the set callbacks when services specified by the service dependency The first argument of the callbacks will be the component implement (
- See also
- component_getImplementation) The second the argument a pointer to an instance of a service struct of the specified service dependency.
celix_status_t celix_dmServiceDependency_setCallbackHandle |
( |
celix_dm_service_dependency_t * |
dependency, |
|
|
void * |
handle |
|
) |
| |
Set the callback handle to be used in the callbacks. Note that this normally should not be set, because the result of component_getImplementation() is used This can be used in rare cases when the callbacks are actually interceptors. e.g. in the case of C++ support.
Set the set, add, change, remove and swap function callbacks when services specified by the service dependency are (respectively) set, added, changed, removed or swapped.
The version with the WithProps suffix will be called with as third argument the service properties.
Set the set function callbacks when services specified by the service dependency The first argument of the callbacks will be the component implement (
- See also
- component_getImplementation) The second argument of th callbacks will be a pointer to an instance of a service struct of the specified service dependency. The third argument of th callbacks will be a pointer to a service properties of the a service instance of the specified service dependency.
celix_status_t celix_dmServiceDependency_setRequired |
( |
celix_dm_service_dependency_t * |
dependency, |
|
|
bool |
required |
|
) |
| |
Specify if the service dependency is required. default is false
celix_status_t celix_dmServiceDependency_setService |
( |
celix_dm_service_dependency_t * |
dependency, |
|
|
const char * |
serviceName, |
|
|
const char * |
serviceVersionRange, |
|
|
const char * |
filter |
|
) |
| |
Set the service name, version range and filter.
- Parameters
-
serviceName | The service name. Must have a value. |
serviceVersionRange | The service version range, can be a NULL pointer. |
filter | The (additional) filter to use (e.g. "(location=front)"). Can be a NULL pointer. |
Specify if the service dependency update strategy.
The DM_SERVICE_DEPENDENCY_STRATEGY_LOCKING strategy notifies the component in case the dependencies set changes (e.g. a dependency is added/removed): the component is responsible for protecting via locks the dependencies list and check (always under lock) if the service he's depending on is still available.
The DM_SERVICE_DEPENDENCY_STRATEGY_SUSPEND (default when no strategy is explicitly set) reliefs the programmer from dealing with service dependencies' consistency issues: in case this strategy is adopted, the component is stopped and restarted (i.e. temporarily suspended) upon service dependencies' changes.
Default strategy is DM_SERVICE_DEPENDENCY_STRATEGY_SUSPEND