Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/509 remove deprecated properties header #712

Merged
merged 2 commits into from
Jan 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ limitations under the License.
- celix_string/long_hashmap put functions now return a celix_status_t instead of bool (value replaced).
THe celix_status_t is used to indicate an ENOMEM error.
- Embedded bundles are no longer supported.
- properties.h is removed and no longer supported. Use celix_properties.h instead.

## New Features

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
#ifndef ENDPOINT_DESCRIPTION_H_
#define ENDPOINT_DESCRIPTION_H_

#include "properties.h"
#include "celix_properties.h"
#include "array_list.h"
#include "celix_cleanup.h"
#include <stdbool.h>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
#define ENDPOINT_LISTENER_H_

#include "array_list.h"
#include "properties.h"
#include "celix_properties.h"

#include "endpoint_description.h"

Expand Down
2 changes: 1 addition & 1 deletion bundles/remote_services/topology_manager/src/scope.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
#include "celix_threads.h"
#include "hash_map.h"
#include "endpoint_description.h"
#include "properties.h"
#include "celix_properties.h"
#include "service_reference.h"
#include "tm_scope.h"

Expand Down
16 changes: 8 additions & 8 deletions libs/framework/gtest/src/CelixBundleContextServicesTestSuite.cc
Original file line number Diff line number Diff line change
Expand Up @@ -764,13 +764,13 @@ TEST_F(CelixBundleContextServicesTestSuite, ServicesTrackerTestWithAlreadyRegist
TEST_F(CelixBundleContextServicesTestSuite, ServicesTrackerTestWithProperties) {
int count = 0;
int count2 = 0;
auto add = [](void *handle, void *svc, const properties_t *props) {
auto add = [](void *handle, void *svc, const celix_properties_t *props) {
ASSERT_TRUE(svc != nullptr);
ASSERT_TRUE(props != nullptr);
int *c = static_cast<int*>(handle);
*c += 1;
};
auto remove = [](void *handle, void *svc, const properties_t *props) {
auto remove = [](void *handle, void *svc, const celix_properties_t *props) {
ASSERT_TRUE(svc != nullptr);
ASSERT_TRUE(props != nullptr);
int *c = static_cast<int*>(handle);
Expand Down Expand Up @@ -813,14 +813,14 @@ TEST_F(CelixBundleContextServicesTestSuite, ServicesTrackerTestWithProperties) {

TEST_F(CelixBundleContextServicesTestSuite, ServicesTrackerTestWithOwner) {
int count = 0;
auto add = [](void *handle, void *svc, const properties_t *props, const bundle_t *svcOwner) {
auto add = [](void *handle, void *svc, const celix_properties_t *props, const bundle_t *svcOwner) {
ASSERT_TRUE(svc != nullptr);
ASSERT_TRUE(props != nullptr);
ASSERT_TRUE(celix_bundle_getId(svcOwner) >= 0);
int *c = static_cast<int*>(handle);
*c += 1;
};
auto remove = [](void *handle, void *svc, const properties_t *props, const bundle_t *svcOwner) {
auto remove = [](void *handle, void *svc, const celix_properties_t *props, const bundle_t *svcOwner) {
ASSERT_TRUE(svc != nullptr);
ASSERT_TRUE(props != nullptr);
ASSERT_TRUE(celix_bundle_getId(svcOwner) >= 0);
Expand Down Expand Up @@ -1029,12 +1029,12 @@ TEST_F(CelixBundleContextServicesTestSuite, ServicesTrackerSetTest) {
ASSERT_TRUE(trackerId >= 0);

//register svc3 should lead to second set call
properties_t *props3 = celix_properties_create();
celix_properties_t *props3 = celix_properties_create();
celix_properties_set(props3, CELIX_FRAMEWORK_SERVICE_RANKING, "10");
long svcId3 = celix_bundleContext_registerService(ctx, svc3, "NA", props3); //call 2

//register svc4 should lead to no set (lower ranking)
properties_t *props4 = celix_properties_create();
celix_properties_t *props4 = celix_properties_create();
celix_properties_set(props4, CELIX_FRAMEWORK_SERVICE_RANKING, "10");
long svcId4 = celix_bundleContext_registerService(ctx, svc4, "NA", props4); //no update

Expand Down Expand Up @@ -1087,12 +1087,12 @@ TEST_F(CelixBundleContextServicesTestSuite, TrackerOfAllServicesSetTest) {
ASSERT_TRUE(trackerId >= 0);

//register svc3 should lead to second set call
properties_t *props3 = celix_properties_create();
celix_properties_t *props3 = celix_properties_create();
celix_properties_set(props3, CELIX_FRAMEWORK_SERVICE_RANKING, "10");
long svcId3 = celix_bundleContext_registerService(ctx, svc3, "NA", props3); //call 2

//register svc4 should lead to no set (lower ranking)
properties_t *props4 = celix_properties_create();
celix_properties_t *props4 = celix_properties_create();
celix_properties_set(props4, CELIX_FRAMEWORK_SERVICE_RANKING, "10");
long svcId4 = celix_bundleContext_registerService(ctx, svc4, "NA", props4); //no update

Expand Down
2 changes: 1 addition & 1 deletion libs/framework/include/celix_api.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
#ifndef CELIX_CELIX_API_H_
#define CELIX_CELIX_API_H_

#include "properties.h"
#include "celix_properties.h"
#include "array_list.h"

#include "bundle.h"
Expand Down
1 change: 0 additions & 1 deletion libs/framework/include_deprecated/bundle_context.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
#include "celix_service_listener.h"
#include "bundle_listener.h"
#include "framework_listener.h"
#include "properties.h"
#include "array_list.h"
#include "celix_service_listener.h"

Expand Down
2 changes: 1 addition & 1 deletion libs/framework/include_deprecated/dm_component.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@

#include "celix_types.h"
#include "celix_errno.h"
#include "properties.h"
#include "celix_properties.h"
#include "array_list.h"
#include "celix_dm_info.h"
#include "celix_dm_component.h"
Expand Down
2 changes: 1 addition & 1 deletion libs/framework/include_deprecated/framework.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

#include "celix_errno.h"
#include "bundle.h"
#include "properties.h"
#include "celix_properties.h"
#include "bundle_context.h"
#include "celix_framework_export.h"

Expand Down
3 changes: 2 additions & 1 deletion libs/framework/include_deprecated/manifest.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,11 @@
#include <stddef.h>
#include <stdio.h>

#include "properties.h"
#include "celix_cleanup.h"
#include "celix_errno.h"
#include "celix_framework_export.h"
#include "celix_properties.h"
#include "hash_map.h"

#ifdef __cplusplus
extern "C" {
Expand Down
2 changes: 1 addition & 1 deletion libs/framework/include_deprecated/service_registry.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
#ifndef SERVICE_REGISTRY_H_
#define SERVICE_REGISTRY_H_

#include "properties.h"
#include "celix_properties.h"
#include "filter.h"
#include "service_factory.h"
#include "celix_service_event.h"
Expand Down
4 changes: 2 additions & 2 deletions libs/framework/src/bundle_context.c
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ celix_status_t bundleContext_installBundle2(bundle_context_pt context,
}

celix_status_t bundleContext_registerService(bundle_context_pt context, const char * serviceName, const void * svcObj,
properties_pt properties, service_registration_pt *service_registration) {
celix_properties_t* properties, service_registration_pt *service_registration) {
if (context == NULL || service_registration == NULL) {
return CELIX_ILLEGAL_ARGUMENT;
}
Expand All @@ -173,7 +173,7 @@ celix_status_t bundleContext_registerService(bundle_context_pt context, const ch
}

celix_status_t bundleContext_registerServiceFactory(bundle_context_pt context, const char * serviceName, service_factory_pt factory,
properties_pt properties, service_registration_pt *service_registration) {
celix_properties_t* properties, service_registration_pt *service_registration) {
if (context == NULL || service_registration == NULL) {
return CELIX_ILLEGAL_ARGUMENT;
}
Expand Down
4 changes: 2 additions & 2 deletions libs/framework/src/dm_component_impl.c
Original file line number Diff line number Diff line change
Expand Up @@ -442,7 +442,7 @@ celix_status_t celix_dmComponent_setCLanguageProperty(celix_dm_component_t *comp
return CELIX_SUCCESS;
}

celix_status_t component_addInterface(celix_dm_component_t *component, const char* serviceName, const char* serviceVersion, const void* service, properties_pt properties) {
celix_status_t component_addInterface(celix_dm_component_t *component, const char* serviceName, const char* serviceVersion, const void* service, celix_properties_t* properties) {
return celix_dmComponent_addInterface(component, serviceName, serviceVersion, service, properties);
}

Expand Down Expand Up @@ -1151,7 +1151,7 @@ void celix_dmComponent_destroyComponentInfo(celix_dm_component_info_t* info) {
for (i = 0; i < size; i += 1) {
dm_interface_info_pt intfInfo = celix_arrayList_get(info->interfaces, i);
free(intfInfo->name);
properties_destroy(intfInfo->properties);
celix_properties_destroy(intfInfo->properties);
free(intfInfo);
}
celix_arrayList_destroy(info->interfaces);
Expand Down
8 changes: 4 additions & 4 deletions libs/framework/src/framework.c
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,7 @@ celix_status_t framework_destroy(framework_pt framework) {

celix_frameworkLogger_destroy(framework->logger);

properties_destroy(framework->configurationMap);
celix_properties_destroy(framework->configurationMap);

free(framework->dispatcher.eventQueue);
free(framework);
Expand Down Expand Up @@ -778,7 +778,7 @@ celix_status_t fw_registerService(framework_pt framework, service_registration_p
return status;
}

celix_status_t fw_registerServiceFactory(framework_pt framework, service_registration_pt *registration, long bndId, const char* serviceName, service_factory_pt factory, properties_pt properties) {
celix_status_t fw_registerServiceFactory(framework_pt framework, service_registration_pt *registration, long bndId, const char* serviceName, service_factory_pt factory, celix_properties_t* properties) {
celix_status_t status = CELIX_SUCCESS;
char *error = NULL;
if (serviceName == NULL || factory == NULL) {
Expand Down Expand Up @@ -816,11 +816,11 @@ celix_status_t fw_getServiceReferences(framework_pt framework, array_list_pt *re
service_reference_pt ref = (service_reference_pt) arrayList_get(*references, refIdx);
service_registration_pt reg = NULL;
const char* serviceNameObjectClass;
properties_pt props = NULL;
celix_properties_t* props = NULL;
status = CELIX_DO_IF(status, serviceReference_getServiceRegistration(ref, &reg));
status = CELIX_DO_IF(status, serviceRegistration_getProperties(reg, &props));
if (status == CELIX_SUCCESS) {
serviceNameObjectClass = properties_get(props, CELIX_FRAMEWORK_SERVICE_NAME);
serviceNameObjectClass = celix_properties_get(props, CELIX_FRAMEWORK_SERVICE_NAME, NULL);
if (!serviceReference_isAssignableTo(ref, bundle, serviceNameObjectClass)) {
serviceReference_release(ref, NULL);
arrayList_remove(*references, refIdx);
Expand Down
6 changes: 3 additions & 3 deletions libs/framework/src/framework_private.h
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ struct celix_framework {
} installedBundles;


properties_pt configurationMap;
celix_properties_t* configurationMap;


struct {
Expand Down Expand Up @@ -264,8 +264,8 @@ bool celix_framework_getConfigPropertyAsBool(celix_framework_t* framework, const

celix_status_t celix_framework_installBundleInternal(celix_framework_t* framework, const char* bndLoc, long* bndId);

celix_status_t fw_registerService(framework_pt framework, service_registration_pt * registration, long bundleId, const char* serviceName, const void* svcObj, properties_pt properties);
celix_status_t fw_registerServiceFactory(framework_pt framework, service_registration_pt * registration, long bundleId, const char* serviceName, service_factory_pt factory, properties_pt properties);
celix_status_t fw_registerService(framework_pt framework, service_registration_pt * registration, long bundleId, const char* serviceName, const void* svcObj, celix_properties_t* properties);
celix_status_t fw_registerServiceFactory(framework_pt framework, service_registration_pt * registration, long bundleId, const char* serviceName, service_factory_pt factory, celix_properties_t* properties);

celix_status_t fw_getServiceReferences(framework_pt framework, array_list_pt *references, bundle_pt bundle, const char* serviceName, const char* filter);
celix_status_t fw_getBundleRegisteredServices(framework_pt framework, bundle_pt bundle, array_list_pt *services);
Expand Down
6 changes: 3 additions & 3 deletions libs/framework/src/manifest.c
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ manifest_pt manifest_clone(manifest_pt manifest) {

celix_status_t manifest_destroy(manifest_pt manifest) {
if (manifest != NULL) {
properties_destroy(manifest->mainAttributes);
celix_properties_destroy(manifest->mainAttributes);
hash_map_iterator_t iter = hashMapIterator_construct(manifest->attributes);
while (hashMapIterator_hasNext(&iter)) {
hash_map_entry_pt entry = hashMapIterator_nextEntry(&iter);
Expand Down Expand Up @@ -133,7 +133,7 @@ void manifest_clear(manifest_pt manifest) {
}
//LCOV_EXCL_STOP

properties_pt manifest_getMainAttributes(manifest_pt manifest) {
celix_properties_t* manifest_getMainAttributes(manifest_pt manifest) {
return manifest->mainAttributes;
}

Expand Down Expand Up @@ -307,7 +307,7 @@ void manifest_write(manifest_pt manifest, const char * filename) {
//LCOV_EXCL_STOP

const char* manifest_getValue(manifest_pt manifest, const char* name) {
const char* val = properties_get(manifest->mainAttributes, name);
const char* val = celix_properties_get(manifest->mainAttributes, name, NULL);
bool isEmpty = utils_isStringEmptyOrNull(val);
return isEmpty ? NULL : val;
}
4 changes: 2 additions & 2 deletions libs/framework/src/service_reference.c
Original file line number Diff line number Diff line change
Expand Up @@ -184,10 +184,10 @@ long serviceReference_getServiceId(service_reference_pt ref) {
celix_status_t
serviceReference_getPropertyWithDefault(service_reference_pt ref, const char *key, const char* def, const char **value) {
celix_status_t status = CELIX_SUCCESS;
properties_pt props = NULL;
celix_properties_t* props = NULL;
status = serviceRegistration_getProperties(ref->registration, &props);
if (status == CELIX_SUCCESS) {
*value = (char*) properties_getWithDefault(props, key, def);
*value = (char*) celix_properties_get(props, key, def);
}
return status;
}
Expand Down
10 changes: 5 additions & 5 deletions libs/framework/src/service_registration.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,13 @@ static celix_status_t serviceRegistration_createInternal(registry_callback_t cal
enum celix_service_type svcType,
service_registration_t** out);

service_registration_pt serviceRegistration_create(registry_callback_t callback, bundle_pt bundle, const char* serviceName, long serviceId, const void * serviceObject, properties_pt dictionary) {
service_registration_pt serviceRegistration_create(registry_callback_t callback, bundle_pt bundle, const char* serviceName, long serviceId, const void * serviceObject, celix_properties_t* dictionary) {
service_registration_pt registration = NULL;
serviceRegistration_createInternal(callback, bundle, serviceName, serviceId, serviceObject, dictionary, CELIX_PLAIN_SERVICE, &registration);
return registration;
}

service_registration_pt serviceRegistration_createServiceFactory(registry_callback_t callback, bundle_pt bundle, const char* serviceName, long serviceId, const void * serviceObject, properties_pt dictionary) {
service_registration_pt serviceRegistration_createServiceFactory(registry_callback_t callback, bundle_pt bundle, const char* serviceName, long serviceId, const void * serviceObject, celix_properties_t* dictionary) {
service_registration_pt registration = NULL;
serviceRegistration_createInternal(callback, bundle, serviceName, serviceId, serviceObject, dictionary, CELIX_DEPRECATED_FACTORY_SERVICE, &registration);
return registration;
Expand Down Expand Up @@ -99,7 +99,7 @@ static bool serviceRegistration_destroy(struct celix_ref *refCount) {
free(registration->className);
registration->className = NULL;
registration->callback.unregister = NULL;
properties_destroy(registration->properties);
celix_properties_destroy(registration->properties);
celixThreadRwlock_destroy(&registration->lock);
free(registration);
return true;
Expand All @@ -121,7 +121,7 @@ static celix_status_t serviceRegistration_initializeProperties(service_registrat
registration->properties = props;
} else {
celix_err_push("Cannot initialize service registration properties");
properties_destroy(props);
celix_properties_destroy(props);
}

return CELIX_SUCCESS;
Expand Down Expand Up @@ -206,7 +206,7 @@ celix_status_t serviceRegistration_ungetService(service_registration_pt registra
return status;
}

celix_status_t serviceRegistration_getProperties(service_registration_pt registration, properties_pt *properties) {
celix_status_t serviceRegistration_getProperties(service_registration_pt registration, celix_properties_t** properties) {
celix_status_t status = CELIX_SUCCESS;

if (registration != NULL) {
Expand Down
6 changes: 3 additions & 3 deletions libs/framework/src/service_registration_private.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ struct serviceRegistration {

char* className; // read-only
bundle_pt bundle; // read-only
properties_pt properties; // read-only
celix_properties_t* properties; // read-only
long serviceId; // read-only

bool isUnregistering;
Expand All @@ -52,8 +52,8 @@ struct serviceRegistration {
celix_thread_rwlock_t lock; // protects the service object
};

service_registration_pt serviceRegistration_create(registry_callback_t callback, bundle_pt bundle, const char* serviceName, long serviceId, const void * serviceObject, properties_pt dictionary);
service_registration_pt serviceRegistration_createServiceFactory(registry_callback_t callback, bundle_pt bundle, const char* serviceName, long serviceId, const void * serviceObject, properties_pt dictionary);
service_registration_pt serviceRegistration_create(registry_callback_t callback, bundle_pt bundle, const char* serviceName, long serviceId, const void * serviceObject, celix_properties_t* dictionary);
service_registration_pt serviceRegistration_createServiceFactory(registry_callback_t callback, bundle_pt bundle, const char* serviceName, long serviceId, const void * serviceObject, celix_properties_t* dictionary);

void serviceRegistration_retain(service_registration_pt registration);
void serviceRegistration_release(service_registration_pt registration);
Expand Down
Loading
Loading