This is an automated email from the ASF dual-hosted git repository.
pnoltes pushed a commit to branch feature/685-refactor-manifest-format
in repository https://gitbox.apache.org/repos/asf/celix.git
The following commit(s) were added to
refs/heads/feature/685-refactor-manifest-format by this push:
new dc9077624 gh-685: Remove unused deprecated bundle api
dc9077624 is described below
commit dc90776246684e314cf3c9e455cbb19fb745f9ad
Author: Pepijn Noltes <[email protected]>
AuthorDate: Fri Jul 26 22:39:51 2024 +0200
gh-685: Remove unused deprecated bundle api
---
.../rsa_common/src/export_registration_impl.c | 45 ++++----
.../rsa_common/src/import_registration_impl.c | 68 ++++++------
libs/framework/include_deprecated/bundle.h | 39 -------
libs/framework/src/bundle.c | 115 ---------------------
libs/framework/src/celix_bundle_private.h | 32 ------
5 files changed, 53 insertions(+), 246 deletions(-)
diff --git a/bundles/remote_services/rsa_common/src/export_registration_impl.c
b/bundles/remote_services/rsa_common/src/export_registration_impl.c
index 7925275dc..43cad1e91 100644
--- a/bundles/remote_services/rsa_common/src/export_registration_impl.c
+++ b/bundles/remote_services/rsa_common/src/export_registration_impl.c
@@ -32,7 +32,7 @@
#include "export_registration_impl.h"
#include "remote_service_admin_impl.h"
-#include "bundle.h"
+#include "celix_bundle.h"
struct export_reference {
@@ -180,38 +180,33 @@ celix_status_t exportRegistration_endpointRemoved(void *
handle, service_referen
return status;
}
-celix_status_t exportRegistration_open(export_registration_t *registration) {
- celix_status_t status = CELIX_SUCCESS;
- const char *bundleStore = NULL;
+celix_status_t exportRegistration_open(export_registration_t* registration) {
+ celix_status_t status = CELIX_SUCCESS;
+ const char* bundleStore = NULL;
- bundleContext_getProperty(registration->context,
BUNDLE_STORE_PROPERTY_NAME, &bundleStore);
+ bundleContext_getProperty(registration->context,
BUNDLE_STORE_PROPERTY_NAME, &bundleStore);
- if (bundleStore == NULL) {
- bundleStore = DEFAULT_BUNDLE_STORE;
- }
- char name[256];
+ if (bundleStore == NULL) {
+ bundleStore = DEFAULT_BUNDLE_STORE;
+ }
+ char name[256];
- snprintf(name, 256, "%s/%s_endpoint.zip", bundleStore,
registration->endpointDescription->serviceName);
+ snprintf(name, 256, "%s/%s_endpoint.zip", bundleStore,
registration->endpointDescription->serviceName);
- status = bundleContext_installBundle(registration->context, name,
®istration->bundle);
- if (status == CELIX_SUCCESS) {
- status = bundle_start(registration->bundle);
- if (status == CELIX_SUCCESS) {
- }
- }
+ status = bundleContext_installBundle(registration->context, name,
®istration->bundle);
+ if (status == CELIX_SUCCESS) {
+ status = celix_bundleContext_startBundle(registration->context,
celix_bundle_getId(registration->bundle));
+ }
- return status;
+ return status;
}
-celix_status_t exportRegistration_close(export_registration_t *registration) {
- celix_status_t status = CELIX_SUCCESS;
-
- exportRegistration_stopTracking(registration);
+celix_status_t exportRegistration_close(export_registration_t* registration) {
+ celix_status_t status = CELIX_SUCCESS;
- bundle_uninstall(registration->bundle);
-
-
- return status;
+ exportRegistration_stopTracking(registration);
+ (void)celix_bundleContext_uninstallBundle(registration->context,
celix_bundle_getId(registration->bundle));
+ return status;
}
celix_status_t exportRegistration_getException(export_registration_t
*registration) {
diff --git a/bundles/remote_services/rsa_common/src/import_registration_impl.c
b/bundles/remote_services/rsa_common/src/import_registration_impl.c
index 3288489dd..cea5ca365 100644
--- a/bundles/remote_services/rsa_common/src/import_registration_impl.c
+++ b/bundles/remote_services/rsa_common/src/import_registration_impl.c
@@ -33,7 +33,8 @@
#include "import_registration_impl.h"
#include "remote_service_admin_impl.h"
-#include "bundle.h"
+#include "celix_bundle.h"
+#include "celix_bundle_context.h"
struct import_reference {
endpoint_description_t *endpoint;
@@ -111,53 +112,50 @@ celix_status_t
importRegistrationFactory_destroy(import_registration_factory_t *
return status;
}
+celix_status_t importRegistrationFactory_open(import_registration_factory_t*
registration_factory) {
+ celix_status_t status;
-celix_status_t importRegistrationFactory_open(import_registration_factory_t
*registration_factory)
-{
- celix_status_t status;
+ const char* bundleStore = NULL;
+ bundleContext_getProperty(registration_factory->context,
BUNDLE_STORE_PROPERTY_NAME, &bundleStore);
- const char *bundleStore = NULL;
- bundleContext_getProperty(registration_factory->context,
BUNDLE_STORE_PROPERTY_NAME, &bundleStore);
-
- if (bundleStore == NULL) {
- bundleStore = DEFAULT_BUNDLE_STORE;
- }
+ if (bundleStore == NULL) {
+ bundleStore = DEFAULT_BUNDLE_STORE;
+ }
- char name[256];
- snprintf(name, 256, "%s/%s_proxy.zip", bundleStore,
registration_factory->serviceName);
+ char name[256];
+ snprintf(name, 256, "%s/%s_proxy.zip", bundleStore,
registration_factory->serviceName);
- status = bundleContext_installBundle(registration_factory->context,
name, ®istration_factory->bundle);
+ status = bundleContext_installBundle(registration_factory->context, name,
®istration_factory->bundle);
- if (status == CELIX_SUCCESS) {
- status = bundle_start(registration_factory->bundle);
- if (status == CELIX_SUCCESS) {
- celix_logHelper_log(registration_factory->loghelper,
CELIX_LOG_LEVEL_INFO, "%s successfully started.", name);
- }
- }
- else {
- celix_logHelper_log(registration_factory->loghelper,
CELIX_LOG_LEVEL_ERROR, "%s could not be installed.", name);
- }
+ if (status == CELIX_SUCCESS) {
+ status = celix_bundleContext_startBundle(registration_factory->context,
+
celix_bundle_getId(registration_factory->bundle));
+ if (status == CELIX_SUCCESS) {
+ celix_logHelper_log(
+ registration_factory->loghelper, CELIX_LOG_LEVEL_INFO, "%s
successfully started.", name);
+ }
+ } else {
+ celix_logHelper_log(registration_factory->loghelper,
CELIX_LOG_LEVEL_ERROR, "%s could not be installed.", name);
+ }
- return status;
+ return status;
}
-celix_status_t importRegistrationFactory_close(import_registration_factory_t
*registration_factory)
-{
- celix_status_t status = CELIX_SUCCESS;
-
+celix_status_t importRegistrationFactory_close(import_registration_factory_t*
registration_factory) {
+ celix_status_t status = CELIX_SUCCESS;
- if (registration_factory->proxyFactoryTracker != NULL) {
- serviceTracker_close(registration_factory->proxyFactoryTracker);
- }
+ if (registration_factory->proxyFactoryTracker != NULL) {
+ serviceTracker_close(registration_factory->proxyFactoryTracker);
+ }
- if (registration_factory->bundle != NULL) {
- bundle_uninstall(registration_factory->bundle);
- }
+ if (registration_factory->bundle != NULL) {
+
(void)celix_bundleContext_uninstallBundle(registration_factory->context,
+
celix_bundle_getId(registration_factory->bundle));
+ }
- return status;
+ return status;
}
-
celix_status_t
importRegistration_createProxyFactoryTracker(import_registration_factory_t
*registration_factory, service_tracker_t **tracker) {
celix_status_t status;
service_tracker_customizer_t *customizer = NULL;
diff --git a/libs/framework/include_deprecated/bundle.h
b/libs/framework/include_deprecated/bundle.h
deleted file mode 100644
index 66261e093..000000000
--- a/libs/framework/include_deprecated/bundle.h
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
-* Licensed to the Apache Software Foundation (ASF) under one
-* or more contributor license agreements. See the NOTICE file
-* distributed with this work for additional information
-* regarding copyright ownership. The ASF licenses this file
-* to you under the Apache License, Version 2.0 (the
-* "License"); you may not use this file except in compliance
-* with the License. You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing,
-* software distributed under the License is distributed on an
-* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-* KIND, either express or implied. See the License for the
-* specific language governing permissions and limitations
-* under the License.
-*/
-
-#ifndef BUNDLE_H_
-#define BUNDLE_H_
-
-#include "celix_errno.h"
-#include "celix_framework_export.h"
-#include "celix_bundle.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-CELIX_FRAMEWORK_DEPRECATED_EXPORT celix_status_t bundle_start(celix_bundle_t
*bundle);
-
-CELIX_FRAMEWORK_DEPRECATED_EXPORT celix_status_t
bundle_uninstall(celix_bundle_t *bundle);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* BUNDLE_H_ */
diff --git a/libs/framework/src/bundle.c b/libs/framework/src/bundle.c
index b739998de..ef0d9e5bb 100644
--- a/libs/framework/src/bundle.c
+++ b/libs/framework/src/bundle.c
@@ -121,10 +121,6 @@ celix_status_t bundle_getCurrentModule(const_bundle_pt
bundle, celix_module_t**
return status;
}
-celix_array_list_t* bundle_getModules(const_bundle_pt bundle) {
- return bundle->modules;
-}
-
void * bundle_getHandle(bundle_pt bundle) {
return bundle->handle;
}
@@ -146,11 +142,6 @@ celix_bundle_context_t*
celix_bundle_getContext(const_bundle_pt bundle) { return
void celix_bundle_setContext(bundle_pt bundle, bundle_context_pt context) {
bundle->context = context; }
-celix_status_t bundle_getEntry(const_bundle_pt bundle, const char* name,
char** entry) {
- *entry = celix_bundle_getBundleOrPersistentStoreEntry(bundle, true,
name);
- return *entry == NULL ? CELIX_ILLEGAL_ARGUMENT : CELIX_SUCCESS;
-}
-
celix_status_t bundle_getState(const_bundle_pt bundle, bundle_state_e *state) {
if (bundle==NULL) {
*state = CELIX_BUNDLE_STATE_UNKNOWN;
@@ -207,62 +198,6 @@ celix_status_t bundle_createModule(bundle_pt bundle,
celix_module_t** moduleOut)
return status;
}
-celix_status_t bundle_start(celix_bundle_t* bundle) {
- //note deprecated call use celix_bundleContext_startBundle instead
- return celix_framework_startBundle(bundle->framework,
celix_bundle_getId(bundle));
-}
-
-celix_status_t bundle_update(bundle_pt bundle, const char* updatedBundleUrl) {
- return celix_framework_updateBundle(bundle->framework,
celix_bundle_getId(bundle), updatedBundleUrl);
-}
-
-celix_status_t bundle_stop(bundle_pt bundle) {
- //note deprecated call use celix_bundleContext_stopBundle instead
- return celix_framework_stopBundle(bundle->framework,
celix_bundle_getId(bundle));
-}
-
-celix_status_t bundle_uninstall(bundle_pt bundle) {
- //note deprecated call use celix_bundleContext_uninstallBundle instead
- return celix_framework_uninstallBundle(bundle->framework,
celix_bundle_getId(bundle));
-}
-
-celix_status_t bundle_setPersistentStateInactive(bundle_pt bundle) {
- celix_status_t status;
- bool systemBundle;
-
- status = bundle_isSystemBundle(bundle, &systemBundle);
- if (status == CELIX_SUCCESS) {
- if (!systemBundle) {
- status =
bundleArchive_setPersistentState(bundle->archive, CELIX_BUNDLE_STATE_INSTALLED);
- }
- }
-
- framework_logIfError(bundle->framework->logger, status, NULL, "Failed
to set persistent state to inactive");
-
- return status;
-}
-
-celix_status_t bundle_setPersistentStateUninstalled(bundle_pt bundle) {
- celix_status_t status;
- bool systemBundle;
-
- status = bundle_isSystemBundle(bundle, &systemBundle);
- if (status == CELIX_SUCCESS) {
- if (!systemBundle) {
- status =
bundleArchive_setPersistentState(bundle->archive,
CELIX_BUNDLE_STATE_UNINSTALLED);
- }
- }
-
- framework_logIfError(bundle->framework->logger, status, NULL, "Failed
to set persistent state to uninstalled");
-
- return status;
-}
-
-celix_status_t bundle_revise(bundle_pt bundle, const char * location, const
char *inputFile) {
- fw_log(bundle->framework->logger, CELIX_LOG_LEVEL_DEBUG, "Usage of
bundle_revise is deprecated and no longer needed. Called for bundle %s",
bundle->symbolicName);
- return CELIX_SUCCESS;
-}
-
celix_status_t bundle_addModule(bundle_pt bundle, celix_module_t* module) {
celix_arrayList_add(bundle->modules, module);
@@ -308,36 +243,6 @@ celix_status_t bundle_isSystemBundle(const_bundle_pt
bundle, bool *systemBundle)
return status;
}
-celix_status_t bundle_close(const_bundle_pt bundle) {
- fw_log(bundle->framework->logger, CELIX_LOG_LEVEL_DEBUG, "Usage of
bundle_close is deprecated and no longer needed. Called for bundle %s",
bundle->symbolicName);
- return CELIX_SUCCESS;
-}
-
-celix_status_t bundle_closeAndDelete(const_bundle_pt bundle) {
- fw_log(bundle->framework->logger, CELIX_LOG_LEVEL_DEBUG, "Usage of
bundle_closeAndDelete is deprecated and no longer needed. Called for bundle
%s", bundle->symbolicName);
- return CELIX_SUCCESS;
-}
-
-celix_status_t bundle_closeRevisions(const_bundle_pt bundle) {
- celix_status_t status = CELIX_SUCCESS;
- return status;
-}
-
-celix_status_t bundle_refresh(bundle_pt bundle) {
- celix_module_t* module;
- celix_arrayList_clear(bundle->modules);
- celix_status_t status = bundle_createModule(bundle, &module);
- if (status == CELIX_SUCCESS) {
- status = bundle_addModule(bundle, module);
- if (status == CELIX_SUCCESS) {
- __atomic_store_n(&bundle->state,
CELIX_BUNDLE_STATE_INSTALLED, __ATOMIC_RELEASE);
- }
- }
-
- framework_logIfError(bundle->framework->logger, status, NULL, "Failed to
refresh bundle");
- return status;
-}
-
celix_status_t bundle_getBundleId(const bundle_t *bundle, long *bndId) {
celix_status_t status = CELIX_SUCCESS;
long id = celix_bundle_getId(bundle);
@@ -350,26 +255,6 @@ celix_status_t bundle_getBundleId(const bundle_t *bundle,
long *bndId) {
return status;
}
-celix_status_t bundle_getRegisteredServices(bundle_pt bundle,
celix_array_list_t** list) {
- celix_status_t status;
-
- status = fw_getBundleRegisteredServices(bundle->framework, bundle,
list);
-
- framework_logIfError(bundle->framework->logger, status, NULL, "Failed
to get registered services");
-
- return status;
-}
-
-celix_status_t bundle_getServicesInUse(bundle_pt bundle, celix_array_list_t**
list) {
- celix_status_t status;
-
- status = fw_getBundleServicesInUse(bundle->framework, bundle, list);
-
- framework_logIfError(bundle->framework->logger, status, NULL, "Failed
to get in use services");
-
- return status;
-}
-
celix_status_t bundle_getFramework(const_bundle_pt bundle, framework_pt
*framework) {
if (bundle == NULL || framework == NULL) {
return CELIX_ILLEGAL_ARGUMENT;
diff --git a/libs/framework/src/celix_bundle_private.h
b/libs/framework/src/celix_bundle_private.h
index d866f3119..9bad00dde 100644
--- a/libs/framework/src/celix_bundle_private.h
+++ b/libs/framework/src/celix_bundle_private.h
@@ -88,8 +88,6 @@ CELIX_FRAMEWORK_DEPRECATED celix_status_t
bundle_getArchive(const celix_bundle_t
CELIX_FRAMEWORK_DEPRECATED celix_status_t bundle_getCurrentModule(const
celix_bundle_t *bundle, celix_module_t** module);
-CELIX_FRAMEWORK_DEPRECATED celix_array_list_t *bundle_getModules(const
celix_bundle_t *bundle);
-
CELIX_FRAMEWORK_DEPRECATED void *bundle_getHandle(celix_bundle_t *bundle);
CELIX_FRAMEWORK_DEPRECATED void bundle_setHandle(celix_bundle_t *bundle, void
*handle);
@@ -98,44 +96,14 @@ CELIX_FRAMEWORK_DEPRECATED celix_bundle_activator_t
*bundle_getActivator(const c
CELIX_FRAMEWORK_DEPRECATED celix_status_t bundle_setActivator(celix_bundle_t
*bundle, celix_bundle_activator_t *activator);
-CELIX_FRAMEWORK_DEPRECATED celix_status_t bundle_getEntry(const celix_bundle_t
*bundle, const char *name, char **entry);
-
-CELIX_FRAMEWORK_DEPRECATED celix_status_t bundle_update(celix_bundle_t
*bundle, const char *inputFile);
-
-CELIX_FRAMEWORK_DEPRECATED celix_status_t bundle_stop(celix_bundle_t *bundle);
-
CELIX_FRAMEWORK_DEPRECATED celix_status_t bundle_setState(celix_bundle_t
*bundle, bundle_state_e state);
-CELIX_FRAMEWORK_DEPRECATED celix_status_t
bundle_setPersistentStateInactive(celix_bundle_t *bundle);
-
-CELIX_FRAMEWORK_DEPRECATED celix_status_t
bundle_setPersistentStateUninstalled(celix_bundle_t *bundle);
-
-CELIX_FRAMEWORK_DEPRECATED void uninstallBundle(celix_bundle_t *bundle);
-
-CELIX_FRAMEWORK_DEPRECATED celix_status_t bundle_revise(celix_bundle_t
*bundle, const char *location, const char *inputFile);
-
CELIX_FRAMEWORK_DEPRECATED celix_status_t bundle_addModule(celix_bundle_t
*bundle, celix_module_t* celix_module);
-// Service Reference Functions
-CELIX_FRAMEWORK_DEPRECATED celix_array_list_t
*getUsingBundles(service_reference_pt reference);
-
-CELIX_FRAMEWORK_DEPRECATED int compareTo(service_reference_pt a,
service_reference_pt b);
-
CELIX_FRAMEWORK_DEPRECATED celix_status_t bundle_getState(const celix_bundle_t
*bundle, bundle_state_e *state);
-CELIX_FRAMEWORK_DEPRECATED celix_status_t bundle_closeAndDelete(const
celix_bundle_t *bundle);
-
-CELIX_FRAMEWORK_EXPORT celix_status_t bundle_close(const celix_bundle_t
*bundle)
- __attribute__((deprecated("bundle_close is deprecated and does nothing")));
-
-CELIX_FRAMEWORK_DEPRECATED celix_status_t bundle_refresh(celix_bundle_t
*bundle);
-
CELIX_FRAMEWORK_DEPRECATED celix_status_t bundle_getBundleId(const
celix_bundle_t *bundle, long *id);
-CELIX_FRAMEWORK_DEPRECATED celix_status_t
bundle_getRegisteredServices(celix_bundle_t *bundle, celix_array_list_t **list);
-
-CELIX_FRAMEWORK_DEPRECATED celix_status_t
bundle_getServicesInUse(celix_bundle_t *bundle, celix_array_list_t **list);
-
CELIX_FRAMEWORK_DEPRECATED celix_status_t bundle_getFramework(const
celix_bundle_t *bundle, celix_framework_t **framework);
CELIX_FRAMEWORK_DEPRECATED celix_status_t bundle_getBundleLocation(const
celix_bundle_t *bundle, const char **location);