Skip to content

Commit

Permalink
gh-685: Remove unused deprecated bundle api
Browse files Browse the repository at this point in the history
  • Loading branch information
pnoltes committed Jul 26, 2024
1 parent 297a437 commit dc90776
Show file tree
Hide file tree
Showing 5 changed files with 53 additions and 246 deletions.
45 changes: 20 additions & 25 deletions bundles/remote_services/rsa_common/src/export_registration_impl.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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, &registration->bundle);
if (status == CELIX_SUCCESS) {
status = bundle_start(registration->bundle);
if (status == CELIX_SUCCESS) {
}
}
status = bundleContext_installBundle(registration->context, name, &registration->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) {
Expand Down
68 changes: 33 additions & 35 deletions bundles/remote_services/rsa_common/src/import_registration_impl.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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, &registration_factory->bundle);
status = bundleContext_installBundle(registration_factory->context, name, &registration_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;
Expand Down
39 changes: 0 additions & 39 deletions libs/framework/include_deprecated/bundle.h

This file was deleted.

115 changes: 0 additions & 115 deletions libs/framework/src/bundle.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand All @@ -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;
Expand Down Expand Up @@ -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);

Expand Down Expand Up @@ -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);
Expand All @@ -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;
Expand Down
Loading

0 comments on commit dc90776

Please sign in to comment.