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 service lang support #677

Merged
merged 2 commits into from
Oct 29, 2023
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 @@ -33,6 +33,7 @@ limitations under the License.
- pubsub_serializer.h is removed and no longer supported. Use pubsub_message_serialization_service.h instead.
- C++11 support for dm is removed. C++14 is now the minimum required version.
- C++17 string_view support is removed from the utils and framework lib.
- Support and usage of "service.lang" service property is removed.

# Noteworthy Changes for 2.4.0 (2023-09-27)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ static int pub_start(struct publisherActivator *act, celix_bundle_context_t *ctx
opts.removeWithProperties = publisher_publishSvcRemoved;
opts.filter.serviceName = PUBSUB_PUBLISHER_SERVICE_NAME;
opts.filter.filter = filter;
opts.filter.ignoreServiceLanguage = true;
long trackerId = celix_bundleContext_trackServicesWithOptions(ctx, &opts);

celix_arrayList_addLong(act->trackerList,trackerId);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,6 @@ static int pubsub_start(struct ps_websocketActivator *act, celix_bundle_context_
opts.removeWithProperties = publisher_publishSvcRemoved;
opts.filter.serviceName = PUBSUB_PUBLISHER_SERVICE_NAME;
opts.filter.filter = filter;
opts.filter.ignoreServiceLanguage = true;
long trackerId = celix_bundleContext_trackServicesWithOptions(ctx, &opts);

celix_arrayList_addLong(act->trackerList,trackerId);
Expand Down
1 change: 0 additions & 1 deletion bundles/pubsub/pubsub_admin_tcp/src/psa_activator.c
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ int psa_tcp_start(psa_tcp_activator_t *act, celix_bundle_context_t *ctx) {
if (status == CELIX_SUCCESS) {
celix_service_tracking_options_t opts = CELIX_EMPTY_SERVICE_TRACKING_OPTIONS;
opts.filter.serviceName = PUBSUB_PROTOCOL_SERVICE_NAME;
opts.filter.ignoreServiceLanguage = true;
opts.callbackHandle = act->admin;
opts.addWithProperties = pubsub_tcpAdmin_addProtocolSvc;
opts.removeWithProperties = pubsub_tcpAdmin_removeProtocolSvc;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,6 @@ pubsub_tcp_topic_receiver_t *pubsub_tcpTopicReceiver_create(celix_bundle_context
char buf[size + 1];
snprintf(buf, (size_t) size + 1, "(%s=%s)", PUBSUB_SUBSCRIBER_TOPIC, topic);
celix_service_tracking_options_t opts = CELIX_EMPTY_SERVICE_TRACKING_OPTIONS;
opts.filter.ignoreServiceLanguage = true;
opts.filter.serviceName = PUBSUB_SUBSCRIBER_SERVICE_NAME;
opts.filter.filter = buf;
opts.callbackHandle = receiver;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,6 @@ pubsub_websocket_topic_receiver_t* pubsub_websocketTopicReceiver_create(celix_bu
char buf[size+1];
snprintf(buf, (size_t)size+1, "(%s=%s)", PUBSUB_SUBSCRIBER_TOPIC, topic);
celix_service_tracking_options_t opts = CELIX_EMPTY_SERVICE_TRACKING_OPTIONS;
opts.filter.ignoreServiceLanguage = true;
opts.filter.serviceName = PUBSUB_SUBSCRIBER_SERVICE_NAME;
opts.filter.filter = buf;
opts.callbackHandle = receiver;
Expand Down
1 change: 0 additions & 1 deletion bundles/pubsub/pubsub_admin_zmq/src/psa_activator.c
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ int psa_zmq_start(psa_zmq_activator_t *act, celix_bundle_context_t *ctx) {
if (status == CELIX_SUCCESS) {
celix_service_tracking_options_t opts = CELIX_EMPTY_SERVICE_TRACKING_OPTIONS;
opts.filter.serviceName = PUBSUB_PROTOCOL_SERVICE_NAME;
opts.filter.ignoreServiceLanguage = true;
opts.callbackHandle = act->admin;
opts.addWithProperties = pubsub_zmqAdmin_addProtocolSvc;
opts.removeWithProperties = pubsub_zmqAdmin_removeProtocolSvc;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,6 @@ pubsub_zmq_topic_receiver_t* pubsub_zmqTopicReceiver_create(celix_bundle_context
char buf[size+1];
snprintf(buf, (size_t)size+1, "(%s=%s)", PUBSUB_SUBSCRIBER_TOPIC, topic);
celix_service_tracking_options_t opts = CELIX_EMPTY_SERVICE_TRACKING_OPTIONS;
opts.filter.ignoreServiceLanguage = true;
opts.filter.serviceName = PUBSUB_SUBSCRIBER_SERVICE_NAME;
opts.filter.filter = buf;
opts.callbackHandle = receiver;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ pubsub_interceptors_handler_t* pubsubInterceptorsHandler_create(celix_bundle_con
// Create service tracker here, and not in the activator
celix_service_tracking_options_t opts = CELIX_EMPTY_SERVICE_TRACKING_OPTIONS;
opts.filter.serviceName = PUBSUB_INTERCEPTOR_SERVICE_NAME;
opts.filter.ignoreServiceLanguage = true;
opts.callbackHandle = handler;
opts.addWithProperties = pubsubInterceptorsHandler_addInterceptor;
opts.removeWithProperties = pubsubInterceptorsHandler_removeInterceptor;
Expand Down
2 changes: 0 additions & 2 deletions bundles/pubsub/pubsub_topology_manager/src/pstm_activator.c
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@ static int pstm_start(pstm_activator_t *act, celix_bundle_context_t *ctx) {
opts.removeWithProperties = pubsub_topologyManager_psaRemoved;
opts.callbackHandle = act->manager;
opts.filter.serviceName = PUBSUB_ADMIN_SERVICE_NAME;
opts.filter.ignoreServiceLanguage = true;
act->pubsubAdminTrackerId = celix_bundleContext_trackServicesWithOptions(ctx, &opts);
}

Expand All @@ -90,7 +89,6 @@ static int pstm_start(pstm_activator_t *act, celix_bundle_context_t *ctx) {
opts.removeWithOwner = pubsub_topologyManager_subscriberRemoved;
opts.callbackHandle = act->manager;
opts.filter.serviceName = PUBSUB_SUBSCRIBER_SERVICE_NAME;
opts.filter.ignoreServiceLanguage = true;
act->pubsubSubscribersTrackerId = celix_bundleContext_trackServicesWithOptions(ctx, &opts);
}

Expand Down
1 change: 0 additions & 1 deletion bundles/pubsub/pubsub_utils/src/pubsub_matching.c
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,6 @@ static long getPSProtocol(celix_bundle_context_t *ctx, const char *requested_pro
} else {
celix_service_filter_options_t opts = CELIX_EMPTY_SERVICE_FILTER_OPTIONS;
opts.serviceName = PUBSUB_PROTOCOL_SERVICE_NAME;
opts.ignoreServiceLanguage = true;

//note findService will automatically return the highest ranking service id
svcId = celix_bundleContext_findServiceWithOptions(ctx, &opts);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,6 @@ typedef struct rsa_dfi_exception_test_service {
celix_service_use_options_t opts{};
opts.filter.serviceName = RSA_DIF_EXCEPTION_TEST_SERVICE;
opts.use = testExceptionServiceCallback;
opts.filter.ignoreServiceLanguage = true;
opts.waitTimeoutInSeconds = 2;
bool called = celix_bundleContext_useServiceWithOptions(clientContext, &opts);
ASSERT_TRUE(called);
Expand All @@ -297,7 +296,6 @@ static void test(F&& f) {
celix_service_use_options_t opts{};
opts.filter.serviceName = TST_SERVICE_NAME;
opts.use = f;
opts.filter.ignoreServiceLanguage = true;
opts.waitTimeoutInSeconds = 2;
bool called = celix_bundleContext_useServiceWithOptions(clientContext, &opts);
ASSERT_TRUE(called);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ extern "C" {
celix_service_use_options_t opts{};
opts.filter.serviceName = OSGI_RSA_REMOTE_SERVICE_ADMIN;
opts.use = testServicesCallback;
opts.filter.ignoreServiceLanguage = true;
opts.waitTimeoutInSeconds = 0.25;
bool called = celix_bundleContext_useServiceWithOptions(context, &opts);
ASSERT_TRUE(called);
Expand Down Expand Up @@ -104,7 +103,6 @@ extern "C" {
celix_service_use_options_t opts{};
opts.filter.serviceName = OSGI_RSA_REMOTE_SERVICE_ADMIN;
opts.use = testExportServiceCallback;
opts.filter.ignoreServiceLanguage = true;
opts.waitTimeoutInSeconds = 0.25;
bool called = celix_bundleContext_useServiceWithOptions(context, &opts);
ASSERT_TRUE(called);
Expand Down Expand Up @@ -141,7 +139,6 @@ extern "C" {
celix_service_use_options_t opts{};
opts.filter.serviceName = OSGI_RSA_REMOTE_SERVICE_ADMIN;
opts.use = testImportServiceCallback;
opts.filter.ignoreServiceLanguage = true;
opts.waitTimeoutInSeconds = 0.25;

//first call -> init
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -347,15 +347,13 @@ static celix_status_t bndStart(struct activator *act, celix_bundle_context_t* ct
opts.set = bndSetCalc;
opts.callbackHandle = act;
opts.filter.serviceName = CALCULATOR_SERVICE;
opts.filter.ignoreServiceLanguage = true;
act->trackerId1 = celix_bundleContext_trackServicesWithOptions(ctx, &opts);
}
{
celix_service_tracking_options_t opts = CELIX_EMPTY_SERVICE_TRACKING_OPTIONS;
opts.set = bndSetRemoteExample;
opts.callbackHandle = act;
opts.filter.serviceName = REMOTE_EXAMPLE_NAME;
opts.filter.ignoreServiceLanguage = true;
act->trackerId2 = celix_bundleContext_trackServicesWithOptions(ctx, &opts);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,6 @@ celix_status_t exportRegistration_start(export_registration_t *reg) {
celix_service_tracking_options_t opts = CELIX_EMPTY_SERVICE_TRACKING_OPTIONS;
opts.filter.filter = reg->filter;
opts.filter.serviceName = "*";
opts.filter.ignoreServiceLanguage = true;
opts.callbackHandle = reg;
opts.add = exportRegistration_addServ;
opts.remove = exportRegistration_removeServ;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,6 @@ celix_status_t exportRegistration_create(celix_bundle_context_t *context,
opts.filter.filter = filter;
opts.filter.serviceName = RSA_RPC_FACTORY_NAME;
opts.filter.versionRange = RSA_RPC_FACTORY_USE_RANGE;
opts.filter.ignoreServiceLanguage = true;
opts.callbackHandle = export;
opts.add = exportRegistration_addRpcFac;
opts.remove = exportRegistration_removeRpcFac;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ celix_status_t remoteInterceptorsHandler_create(celix_bundle_context_t *ctx, rem
// Create service tracker here, and not in the activator
celix_service_tracking_options_t opts = CELIX_EMPTY_SERVICE_TRACKING_OPTIONS;
opts.filter.serviceName = REMOTE_INTERCEPTOR_SERVICE_NAME;
opts.filter.ignoreServiceLanguage = true;
opts.callbackHandle = *handler;
opts.addWithProperties = remoteInterceptorsHandler_addInterceptor;
opts.removeWithProperties = remoteInterceptorsHandler_removeInterceptor;
Expand Down
1 change: 0 additions & 1 deletion bundles/shell/shell/src/c_shell_activator.c
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,6 @@ celix_status_t celix_bundleActivator_start(void *activatorData, celix_bundle_con
opts.callbackHandle = activator->shell;
opts.addWithProperties = (void*) shell_addCommand;
opts.removeWithProperties = (void*) shell_removeCommand;
opts.filter.ignoreServiceLanguage = true;
opts.filter.serviceName = CELIX_SHELL_COMMAND_SERVICE_NAME;
activator->trackerId = celix_bundleContext_trackServicesWithOptions(ctx, &opts);
}
Expand Down
5 changes: 0 additions & 5 deletions libs/framework/gtest/src/DependencyManagerTestSuite.cc
Original file line number Diff line number Diff line change
Expand Up @@ -404,7 +404,6 @@ TEST_F(DependencyManagerTestSuite, BuildSvcProvide) {

opts.serviceName = "TestService";
opts.filter = "(key1=value)";
opts.ignoreServiceLanguage = true;
svcId = celix_bundleContext_findServiceWithOptions(ctx, &opts);
EXPECT_GT(svcId, -1); //found, so properties present

Expand Down Expand Up @@ -575,7 +574,6 @@ TEST_F(DependencyManagerTestSuite, RequiredDepsAreInjectedDuringStartStop) {
celix_service_registration_options opts{};
opts.svc = &svc;
opts.serviceName = svcName.c_str();
opts.serviceLanguage = CELIX_FRAMEWORK_SERVICE_CXX_LANGUAGE;
long svcId = celix_bundleContext_registerServiceWithOptions(dm.bundleContext(), &opts);
EXPECT_GE(svcId, 0);

Expand Down Expand Up @@ -867,7 +865,6 @@ TEST_F(DependencyManagerTestSuite, DepsAreInjectedAsSharedPointers) {
celix_service_registration_options opts{};
opts.svc = &svc;
opts.serviceName = svcName.c_str();
opts.serviceLanguage = CELIX_FRAMEWORK_SERVICE_CXX_LANGUAGE;
long svcId = celix_bundleContext_registerServiceWithOptions(dm.bundleContext(), &opts);
EXPECT_GE(svcId, 0);

Expand Down Expand Up @@ -929,7 +926,6 @@ TEST_F(DependencyManagerTestSuite, DepsNoPropsAreInjectedAsSharedPointers) {
celix_service_registration_options opts{};
opts.svc = &svc;
opts.serviceName = svcName.c_str();
opts.serviceLanguage = CELIX_FRAMEWORK_SERVICE_CXX_LANGUAGE;
long svcId = celix_bundleContext_registerServiceWithOptions(dm.bundleContext(), &opts);
EXPECT_GE(svcId, 0);

Expand Down Expand Up @@ -987,7 +983,6 @@ TEST_F(DependencyManagerTestSuite, UnneededSuspendIsPrevented) {
celix_service_registration_options opts{};
opts.svc = &svc;
opts.serviceName = svcName.c_str();
opts.serviceLanguage = CELIX_FRAMEWORK_SERVICE_CXX_LANGUAGE;
long svcId = celix_bundleContext_registerServiceWithOptions(dm.bundleContext(), &opts);
EXPECT_GE(svcId, 0);

Expand Down
1 change: 0 additions & 1 deletion libs/framework/include/celix/UseServiceBuilder.h
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,6 @@ namespace celix {
std::size_t build() {
celix_service_use_options_t opts{};
opts.filter.serviceName = name.empty() ? nullptr : name.c_str();
opts.filter.ignoreServiceLanguage = true;
opts.filter.filter = filter.empty() ? nullptr : filter.getFilterCString();
opts.filter.versionRange = versionRange.empty() ? nullptr : versionRange.c_str();
opts.waitTimeoutInSeconds = timeoutInSeconds;
Expand Down
16 changes: 0 additions & 16 deletions libs/framework/include/celix/dm/ServiceDependency.h
Original file line number Diff line number Diff line change
Expand Up @@ -220,12 +220,6 @@ namespace celix { namespace dm {
std::function<void(const I* service, Properties&& properties)> remove
);

/**
* Specify if the service dependency should add a service.lang filter part if it is not already present
* For C service dependencies 'service.lang=C' will be added.
*/
CServiceDependency<T,I>& setAddLanguageFilter(bool addLang);

/**
* "Build" the service dependency.
* When build the service dependency is active and the service tracker is created.
Expand Down Expand Up @@ -422,16 +416,6 @@ namespace celix { namespace dm {
*/
ServiceDependency<T,I>& setStrategy(DependencyUpdateStrategy strategy);

/**
* Specify if the service dependency should add a service.lang filter part if it is not already present
* For C++ service dependencies 'service.lang=C++' will be added.
* Should be called before
*
* @return the service dependency reference for chaining (fluent API)
*/
ServiceDependency<T,I>& setAddLanguageFilter(bool addLang);


/**
* "Build" the service dependency.
* When build the service dependency is active and the service tracker is created.
Expand Down
15 changes: 0 additions & 15 deletions libs/framework/include/celix/dm/ServiceDependency_Impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -112,13 +112,6 @@ void CServiceDependency<T,I>::setupService() {
celix_dmServiceDependency_setService(this->cServiceDependency(), this->name.c_str(), cversion, cfilter);
}

template<class T, typename I>
CServiceDependency<T,I>& CServiceDependency<T,I>::setAddLanguageFilter(bool addLang) {
celix_serviceDependency_setAddCLanguageFilter(this->cServiceDependency(), addLang);
this->setupService();
return *this;
}

template<class T, typename I>
CServiceDependency<T,I>& CServiceDependency<T,I>::setRequired(bool req) {
celix_dmServiceDependency_setRequired(this->cServiceDependency(), req);
Expand Down Expand Up @@ -310,14 +303,6 @@ ServiceDependency<T,I>& ServiceDependency<T,I>::setVersionRange(const std::strin
return *this;
}


template<class T, class I>
ServiceDependency<T,I>& ServiceDependency<T,I>::setAddLanguageFilter(bool addLang) {
this->addCxxLanguageFilter = addLang;
setupService();
return *this;
}

//set callbacks
template<class T, class I>
ServiceDependency<T,I>& ServiceDependency<T,I>::setCallbacks(void (T::*set)(I* service)) {
Expand Down
34 changes: 2 additions & 32 deletions libs/framework/include/celix_bundle_context.h
Original file line number Diff line number Diff line change
Expand Up @@ -169,13 +169,6 @@ typedef struct celix_service_registration_options {
*/
celix_properties_t *properties CELIX_OPTS_INIT;

/**
* @brief The optional service language.
*
* If this is NULL, CELIX_FRAMEWORK_SERVICE_LANGUAGE_C is used.
*/
const char* serviceLanguage CELIX_OPTS_INIT;

/**
* @brief The optional service version (in the form of <MAJOR>.<MINOR>.<MICRO>.<QUALIFIER>).
*
Expand Down Expand Up @@ -212,7 +205,6 @@ typedef struct celix_service_registration_options {
.factory = NULL, \
.serviceName = NULL, \
.properties = NULL, \
.serviceLanguage = NULL, \
.serviceVersion = NULL, \
.asyncData = NULL, \
.asyncCallback = NULL }
Expand Down Expand Up @@ -373,26 +365,13 @@ typedef struct celix_service_filter_options {
* The filter will be applied to all the user provided and framework provided service properties.
*/
const char* filter CELIX_OPTS_INIT;

/**
* @deprecated This value is not used any more. If a service language filter is still required add it to the
* filter.
*/
const char* serviceLanguage CELIX_OPTS_INIT;


/**
* @deprecated This value is not used any more. If a service language filter is still required add it to the
* filter.
*/
bool ignoreServiceLanguage CELIX_OPTS_INIT;
} celix_service_filter_options_t;

#ifndef __cplusplus
/*!
* @brief C Macro to create a empty celix_service_filter_options_t type.
*/
#define CELIX_EMPTY_SERVICE_FILTER_OPTIONS {.serviceName = NULL, .versionRange = NULL, .filter = NULL, .serviceLanguage = NULL, .ignoreServiceLanguage = false}
#define CELIX_EMPTY_SERVICE_FILTER_OPTIONS {.serviceName = NULL, .versionRange = NULL, .filter = NULL}
#endif

/**
Expand Down Expand Up @@ -602,8 +581,6 @@ typedef struct celix_service_tracking_options {
#define CELIX_EMPTY_SERVICE_TRACKING_OPTIONS { .filter.serviceName = NULL, \
.filter.versionRange = NULL, \
.filter.filter = NULL, \
.filter.serviceLanguage = NULL, \
.filter.ignoreServiceLanguage = false, \
.callbackHandle = NULL, \
.set = NULL, \
.add = NULL, \
Expand Down Expand Up @@ -820,7 +797,6 @@ typedef struct celix_service_use_options {
#define CELIX_EMPTY_SERVICE_USE_OPTIONS {.filter.serviceName = NULL, \
.filter.versionRange = NULL, \
.filter.filter = NULL, \
.filter.serviceLanguage = NULL, \
.waitTimeoutInSeconds = 0.0F, \
.callbackHandle = NULL, \
.use = NULL, \
Expand Down Expand Up @@ -1187,7 +1163,7 @@ CELIX_FRAMEWORK_EXPORT size_t celix_bundleContext_useBundles(
*/
typedef struct celix_service_tracker_info {
/**
* @brief The parsed service filter, e.g. parsed "(&(objectClass=example_calc)(service.language=C)(meta.info=foo))"
* @brief The parsed service filter, e.g. parsed "(&(objectClass=example_calc)(meta.info=foo))"
*/
celix_filter_t *filter;

Expand All @@ -1196,12 +1172,6 @@ typedef struct celix_service_tracker_info {
*/
const char* serviceName;

/**
* @deprecated
* Deprecated. the value will be NULL.
*/
const char* serviceLanguage;

/**
* @brief Bundle id of the owner of the service tracker.
*/
Expand Down
8 changes: 0 additions & 8 deletions libs/framework/include/celix_constants.h
Original file line number Diff line number Diff line change
Expand Up @@ -118,14 +118,6 @@ extern "C" {
*/
#define CELIX_FRAMEWORK_SERVICE_VERSION "service.version"

/**
* The service language property and values are deprecated
*/
#define CELIX_FRAMEWORK_SERVICE_LANGUAGE "service.lang"
#define CELIX_FRAMEWORK_SERVICE_C_LANGUAGE "C"
#define CELIX_FRAMEWORK_SERVICE_CXX_LANGUAGE "C++"
#define CELIX_FRAMEWORK_SERVICE_SHARED_LANGUAGE "shared" //e.g. marker services

#define CELIX_FRAMEWORK_BUNDLE_ACTIVATOR "Bundle-Activator"
#define OSGI_FRAMEWORK_BUNDLE_ACTIVATOR CELIX_FRAMEWORK_BUNDLE_ACTIVATOR

Expand Down
Loading
Loading