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/685 refactor manifest format #765

Open
wants to merge 19 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 18 commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
afc02be
gh-685: Add new manifest impl
pnoltes Jun 8, 2024
a409230
gh-685: Add manifest validation
pnoltes Jul 1, 2024
f79f229
gh-685: Add bundle manifest getter functions
pnoltes Jul 7, 2024
3759c1d
gh-685: Update usage of manifest to celix_bundle_manifest and removes…
pnoltes Jul 21, 2024
c44bbe6
gh-685: Update bundle zip generation for MANIFEST.json instead of MAN…
pnoltes Jul 21, 2024
4678197
gh-685: Add cmake generated celix_framework_version.h
pnoltes Jul 21, 2024
26d14ff
gh-685: Refactor bundle manifest storage
pnoltes Jul 22, 2024
203cbfc
Merge remote-tracking branch 'origin/master' into feature/685-refacto…
pnoltes Jul 22, 2024
75aafbc
gh-685: Add missing includes
pnoltes Jul 26, 2024
7b4b0cc
gh-685: Add additional manifest tests
pnoltes Jul 26, 2024
89bafcb
Merge branch 'refs/heads/master' into feature/685-refactor-manifest-f…
pnoltes Jul 26, 2024
4822eed
gh-685: Removing manifest attribute name from celix_constants.h
pnoltes Jul 26, 2024
150c3dc
gh-685: Remove commented out code
pnoltes Jul 26, 2024
a123d96
gh-685: Fix tests which were broken after the manifest format refactor
pnoltes Jul 26, 2024
28ee4a1
gh-685: Add celix_bundle_getVersion error injection wrapper
pnoltes Jul 26, 2024
297a437
gh-685: Add missing sys/select.h include
pnoltes Jul 26, 2024
dc90776
gh-685: Remove unused deprecated bundle api
pnoltes Jul 26, 2024
3048050
gh-685: Adjust documentation for MANIFEST.MF to MANIFEST.json refactor
pnoltes Jul 27, 2024
d10a983
gh-685: Improve manifest json impl based on review comments
pnoltes Nov 10, 2024
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
9 changes: 6 additions & 3 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,14 +69,17 @@ limitations under the License.
- It is no longer possible to use the `celix_bundleContext_useService*` functions or `celix::BundleContxt::useService*`
methods on the Celix event thread. The calls will now immediately return and log an error if called on the
Celix event thread.
- Apache Celix filter now use the underlying properties value types for matching. This means that it is more important
to add service properties with the correct type.
- Apache Celix filter now uses the underlying `properties` value types for matching.
This means that it is more important to add service properties with the correct type.
- Celix C++ Exception are now defined in the `celix/exceptions.h` header file. The `celix/Exception.h`
and `celix/IOException.h` are removed.
- The seperator for `CELIX_AUTO_START_0` .. `CELIX_AUTO_START_6` and `CELIX_AUTO_INSTALL` is now a comma instead of a
space.
- The launcher now only has 2 public functions: `celix_launcher_launchAndWait` and `celix_launcher_triggerStop`. The
- The launcher now only has two public functions: `celix_launcher_launchAndWait` and `celix_launcher_triggerStop`. The
other functions are removed.
- The manifest format has been changed to JSON, and the manifest attribute names have been changed.
The old manifest format is no longer supported.
The old manifest attribute names are also no longer defined in `celix_constants.h`.

## New Features

Expand Down
3 changes: 0 additions & 3 deletions bundles/http_admin/http_admin/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,6 @@ target_include_directories(http_admin PRIVATE src)

target_link_libraries(http_admin PUBLIC Celix::http_admin_api)

celix_deprecated_utils_headers(http_admin)


install_celix_bundle(http_admin EXPORT celix COMPONENT http_admin)
#Setup target aliases to match external usage
add_library(Celix::http_admin ALIAS http_admin)
2 changes: 1 addition & 1 deletion bundles/http_admin/http_admin/src/http_admin.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@

#include "civetweb.h"

#include "celix_utils_api.h"
#include "celix_compiler.h"
#include "celix_threads.h"


struct http_admin_manager {
Expand Down
2 changes: 1 addition & 1 deletion bundles/http_admin/http_admin/src/websocket_admin.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@

#include "celix_compiler.h"
#include "celix_stdlib_cleanup.h"
#include "celix_utils_api.h"
#include "celix_threads.h"

struct websocket_admin_manager {
bundle_context_pt context;
Expand Down
2 changes: 0 additions & 2 deletions bundles/logging/log_helper/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,6 @@ if (LOG_HELPER)
install(DIRECTORY include/ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/celix/log_helper COMPONENT logging)

celix_target_hide_symbols(log_helper)
celix_deprecated_utils_headers(log_helper)
celix_deprecated_framework_headers(log_helper)

add_library(Celix::log_helper ALIAS log_helper)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -156,26 +156,9 @@ extern "C" {
}

static void testBundles(void) {
celix_array_list_t* bundles = nullptr;

int rc = bundleContext_getBundles(context, &bundles);
ASSERT_EQ(0, rc);
ASSERT_EQ(3, celix_arrayList_size(bundles)); //framework, rsa_dfi & calc

/*
int size = arrayList_size(bundles);
int i;
for (i = 0; i < size; i += 1) {
celix_bundle_t *bundle = nullptr;
module_pt module = nullptr;
char *name = nullptr;

bundle = (celix_bundle_t *) arrayList_get(bundles, i);
bundle_getCurrentModule(bundle, &module);
module_getSymbolicName(module, &name);
printf("got bundle with symbolic name '%s'", name);
}*/

celix_array_list_t* bundles = celix_bundleContext_listBundles(context);
ASSERT_NE(nullptr, bundles);
ASSERT_EQ(2, celix_arrayList_size(bundles)); //rsa_dfi & calc (note framework bundle is not included)
celix_arrayList_destroy(bundles);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
#include "export_registration_dfi.h"
#include "dfi_utils.h"
#include "remote_interceptors_handler.h"
#include "celix_threads.h"

#include <string.h>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@
#include "remote_interceptors_handler.h"
#include "remote_service_admin_dfi.h"
#include "remote_service_admin_dfi_constants.h"
#include "hash_map.h"
#include "celix_threads.h"

struct import_registration {
celix_bundle_context_t *context;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
#include "utils.h"
#include "celix_utils.h"
#include "celix_ref.h"
#include "hash_map.h"

#include "import_registration_dfi.h"
#include "export_registration_dfi.h"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
#include "celix_log_helper.h"
#include "celix_bundle_context_ei.h"
#include "malloc_ei.h"
#include "bundle_context.h"
#include "celix_threads_ei.h"
#include "celix_framework.h"
#include "celix_bundle_context.h"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
#include "celix_api.h"
#include "celix_stdlib_cleanup.h"
#include "celix_threads.h"
#include "bundle_context.h"
#include <string.h>
#include <assert.h>
#include <stdbool.h>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
#include "rsa_shm_constants.h"
#include "rsa_shm_export_registration.h"
#include "rsa_shm_import_registration.h"
#include "bundle_context.h"
#include "rsa_rpc_factory.h"
#include "rsa_request_sender_service.h"
#include "endpoint_description.h"
Expand Down
44 changes: 20 additions & 24 deletions bundles/remote_services/rsa_common/src/export_registration_impl.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@

#include "export_registration_impl.h"
#include "remote_service_admin_impl.h"
#include "celix_bundle.h"


struct export_reference {
Expand Down Expand Up @@ -179,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
67 changes: 33 additions & 34 deletions bundles/remote_services/rsa_common/src/import_registration_impl.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@

#include "import_registration_impl.h"
#include "remote_service_admin_impl.h"
#include "celix_bundle.h"
#include "celix_bundle_context.h"

struct import_reference {
endpoint_description_t *endpoint;
Expand Down Expand Up @@ -110,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
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ class RsaJsonRpcActivatorUnitTestSuite : public ::testing::Test {
RsaJsonRpcActivatorUnitTestSuite() {
auto* props = celix_properties_create();
celix_properties_set(props, CELIX_FRAMEWORK_CACHE_DIR, ".rsa_json_rpc_impl_cache");
celix_properties_set(props, CELIX_FRAMEWORK_BUNDLE_VERSION, "1.0.0");
celix_properties_set(props, RSA_JSON_RPC_LOG_CALLS_KEY, "true");
celix_properties_set(props, "CELIX_FRAMEWORK_EXTENDER_PATH", RESOURCES_DIR);
auto* fwPtr = celix_frameworkFactory_createFramework(props);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
#include <gtest/gtest.h>

class RsaJsonRpcIntegrationTestSuite : public ::testing::Test {
public:
public:
RsaJsonRpcIntegrationTestSuite() {
auto* props = celix_properties_create();
celix_properties_setBool(props, CELIX_FRAMEWORK_CLEAN_CACHE_DIR_ON_CREATE, true);
Expand All @@ -44,7 +44,7 @@ class RsaJsonRpcIntegrationTestSuite : public ::testing::Test {
};

TEST_F(RsaJsonRpcIntegrationTestSuite, FindRsaJsonRpcService) {
celix_bundleContext_waitForEvents(ctx.get());
long found = celix_bundleContext_findService(ctx.get(), CELIX_RSA_RPC_FACTORY_NAME);
EXPECT_GE(found, 0);
}
celix_bundleContext_waitForEvents(ctx.get());
long found = celix_bundleContext_findService(ctx.get(), CELIX_RSA_RPC_FACTORY_NAME);
EXPECT_GE(found, 0);
}
Loading
Loading