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

commit f79f229011341d7366ffac84df19a27c561372e0
Author: Pepijn Noltes <[email protected]>
AuthorDate: Sun Jul 7 23:39:13 2024 +0200

    gh-685: Add bundle manifest getter functions
---
 libs/framework/CMakeLists.txt                      |   2 +-
 libs/framework/gtest/src/ManifestTestSuite.cc      | 129 ++++++++++++----
 .../{celix_manifest.c => celix_bundle_manifest.c}  |  98 ++++++++----
 libs/framework/src/celix_bundle_manifest.h         | 166 +++++++++++++++++++++
 libs/framework/src/celix_bundle_manifest_type.h    |  41 +++++
 libs/framework/src/celix_manifest.h                | 108 --------------
 libs/utils/include/celix_array_list.h              |  11 +-
 libs/utils/include/celix_array_list_type.h         |  43 ++++++
 8 files changed, 429 insertions(+), 169 deletions(-)

diff --git a/libs/framework/CMakeLists.txt b/libs/framework/CMakeLists.txt
index 09e739b01..3e5fff719 100644
--- a/libs/framework/CMakeLists.txt
+++ b/libs/framework/CMakeLists.txt
@@ -38,7 +38,7 @@ if (FRAMEWORK)
             src/celix_framework_utils.c
             src/celix_scheduled_event.c
             src/celix_framework_bundle.c
-            src/celix_manifest.c
+            src/celix_bundle_manifest.c
             )
     add_library(framework SHARED ${FRAMEWORK_SRC})
 
diff --git a/libs/framework/gtest/src/ManifestTestSuite.cc 
b/libs/framework/gtest/src/ManifestTestSuite.cc
index 9c6d64135..7053cd634 100644
--- a/libs/framework/gtest/src/ManifestTestSuite.cc
+++ b/libs/framework/gtest/src/ManifestTestSuite.cc
@@ -20,31 +20,44 @@
 
 #include <gtest/gtest.h>
 
-#include "celix_manifest.h"
-#include "celix_properties.h"
+#include "celix_bundle_manifest.h"
 #include "celix_err.h"
+#include "celix_properties.h"
+#include "celix_stdlib_cleanup.h"
 
 class ManifestTestSuite : public ::testing::Test {
   public:
     ManifestTestSuite() { celix_err_resetErrors(); }
+
+    static celix_properties_t* createAttributes(const char* manifestVersion,
+                                                const char* bundleVersion,
+                                                const char* bundleName,
+                                                const char* symbolicName) {
+        celix_properties_t* properties = celix_properties_create();
+        celix_properties_set(properties, "CELIX_BUNDLE_MANIFEST_VERSION", 
manifestVersion);
+        celix_properties_set(properties, "CELIX_BUNDLE_VERSION", 
bundleVersion);
+        celix_properties_set(properties, "CELIX_BUNDLE_NAME", bundleName);
+        celix_properties_set(properties, "CELIX_BUNDLE_SYMBOLIC_NAME", 
symbolicName);
+        return properties;
+    }
 };
 
 TEST_F(ManifestTestSuite, CreateManifestTest) {
     //Given a properties set with all the mandatory manifest attributes
     celix_properties_t *properties = celix_properties_create();
     celix_version_t* v = celix_version_create(2, 0, 0, nullptr);
-    celix_properties_assignVersion(properties, "CELIX_MANIFEST_VERSION", v);
+    celix_properties_assignVersion(properties, 
"CELIX_BUNDLE_MANIFEST_VERSION", v);
     celix_properties_set(properties, "CELIX_BUNDLE_VERSION", "1.0.0");
     celix_properties_set(properties, "CELIX_BUNDLE_NAME", "my_bundle");
     celix_properties_set(properties, "CELIX_BUNDLE_SYMBOLIC_NAME", 
"celix_my_bundle");
 
     //When creating a manifest from the attributes
-    celix_autoptr(celix_manifest_t) manifest = nullptr;
-    celix_status_t status = celix_manifest_create(properties, &manifest);
+    celix_autoptr(celix_bundle_manifest_t) manifest = nullptr;
+    celix_status_t status = celix_bundleManifest_create(properties, &manifest);
 
     //Then the creation is successful
-    EXPECT_EQ(CELIX_SUCCESS, status);
-    EXPECT_EQ(4, 
celix_properties_size(celix_manifest_getAttributes(manifest)));
+    ASSERT_EQ(CELIX_SUCCESS, status);
+    EXPECT_EQ(4, 
celix_properties_size(celix_bundleManifest_getAttributes(manifest)));
 }
 
 TEST_F(ManifestTestSuite, MissingOrInvalidMandatoryManifestAttributesTest) {
@@ -52,8 +65,8 @@ TEST_F(ManifestTestSuite, 
MissingOrInvalidMandatoryManifestAttributesTest) {
     celix_properties_t *properties = celix_properties_create();
 
     //When creating a manifest from the attributes
-    celix_autoptr(celix_manifest_t) manifest = nullptr;
-    celix_status_t status = celix_manifest_create(properties, &manifest);
+    celix_autoptr(celix_bundle_manifest_t) manifest = nullptr;
+    celix_status_t status = celix_bundleManifest_create(properties, &manifest);
 
     //Then the creation fails
     EXPECT_EQ(CELIX_ILLEGAL_ARGUMENT, status);
@@ -65,13 +78,13 @@ TEST_F(ManifestTestSuite, 
MissingOrInvalidMandatoryManifestAttributesTest) {
     //Given a properties set with not versions attributes for bundle/manifest 
version.
     properties = celix_properties_create();
     celix_properties_set(properties, "CELIX_BUNDLE_VERSION", "not a version");
-    celix_properties_setBool(properties, "CELIX_MANIFEST_VERSION", false);
+    celix_properties_setBool(properties, "CELIX_BUNDLE_MANIFEST_VERSION", 
false);
     celix_properties_set(properties, "CELIX_BUNDLE_NAME", "my_bundle");
     celix_properties_set(properties, "CELIX_BUNDLE_SYMBOLIC_NAME", 
"celix_my_bundle");
 
     //When creating a manifest from the attributes
-    celix_autoptr(celix_manifest_t) manifest2 = nullptr;
-    status = celix_manifest_create(properties, &manifest2);
+    celix_autoptr(celix_bundle_manifest_t) manifest2 = nullptr;
+    status = celix_bundleManifest_create(properties, &manifest2);
 
     //Then the creation fails
     EXPECT_EQ(CELIX_ILLEGAL_ARGUMENT, status);
@@ -81,15 +94,11 @@ TEST_F(ManifestTestSuite, 
MissingOrInvalidMandatoryManifestAttributesTest) {
     celix_err_printErrors(stdout, "Expect Errors: ", nullptr);
 
     //Given a properties with an unsupported manifest version
-    properties = celix_properties_create();
-    celix_properties_set(properties, "CELIX_MANIFEST_VERSION", "1.0.0"); 
//note must be 2.0.*
-    celix_properties_set(properties, "CELIX_BUNDLE_VERSION", "1.0.0");
-    celix_properties_set(properties, "CELIX_BUNDLE_NAME", "my_bundle");
-    celix_properties_set(properties, "CELIX_BUNDLE_SYMBOLIC_NAME", 
"celix_my_bundle");
+    properties = createAttributes("1.0.0" /* note must be 2.0.**/, "1.0.0", 
"my_bundle", "celix_my_bundle");
 
     //When creating a manifest from the attributes
-    celix_autoptr(celix_manifest_t) manifest3 = nullptr;
-    status = celix_manifest_create(properties, &manifest2);
+    celix_autoptr(celix_bundle_manifest_t) manifest3 = nullptr;
+    status = celix_bundleManifest_create(properties, &manifest3);
 
     //Then the creation fails
     EXPECT_EQ(CELIX_ILLEGAL_ARGUMENT, status);
@@ -99,16 +108,12 @@ TEST_F(ManifestTestSuite, 
MissingOrInvalidMandatoryManifestAttributesTest) {
     celix_err_printErrors(stdout, "Expect Errors: ", nullptr);
 
     //Given a properties set with an invalid private libraries list
-    properties = celix_properties_create();
-    celix_properties_set(properties, "CELIX_MANIFEST_VERSION", "2.0.2");
-    celix_properties_set(properties, "CELIX_BUNDLE_VERSION", "1.0.0");
-    celix_properties_set(properties, "CELIX_BUNDLE_NAME", "my_bundle");
-    celix_properties_set(properties, "CELIX_BUNDLE_SYMBOLIC_NAME", 
"celix_my_bundle");
+    properties = createAttributes("2.0.2", "1.0.0", "my_bundle", 
"celix_my_bundle");
     celix_properties_setBool(properties, "CELIX_BUNDLE_PRIVATE_LIBRARIES", 
true);
 
     //When creating a manifest from the attributes
-    celix_autoptr(celix_manifest_t) manifest4 = nullptr;
-    status = celix_manifest_create(properties, &manifest2);
+    celix_autoptr(celix_bundle_manifest_t) manifest4 = nullptr;
+    status = celix_bundleManifest_create(properties, &manifest4);
 
     //Then the creation fails
     EXPECT_EQ(CELIX_ILLEGAL_ARGUMENT, status);
@@ -118,4 +123,74 @@ TEST_F(ManifestTestSuite, 
MissingOrInvalidMandatoryManifestAttributesTest) {
     celix_err_printErrors(stdout, "Expect Errors: ", nullptr);
 }
 
-//TODO check if the mandatory and optional attributes are set and can be 
retreived with getters
+TEST_F(ManifestTestSuite, InvalidBundleSymbolicNameTest) {
+        //Given a properties set with an invalid bundle symbolic name
+        celix_properties_t *properties = createAttributes("2.0.0", "1.0.0", 
"my_bundle", "celix_my_bundle$$$$");
+
+        //When creating a manifest from the attributes
+        celix_autoptr(celix_bundle_manifest_t) manifest = nullptr;
+        celix_status_t status = celix_bundleManifest_create(properties, 
&manifest);
+
+        //Then the creation fails
+        EXPECT_EQ(CELIX_ILLEGAL_ARGUMENT, status);
+
+        //And 1 celix err log entries is logged
+        EXPECT_EQ(celix_err_getErrorCount(), 1);
+        celix_err_printErrors(stdout, "Expect Errors: ", nullptr);
+}
+
+
+TEST_F(ManifestTestSuite, GetBuiltinAttributes) {
+        //Given a properties set with all the mandatory and manifest attributes
+        celix_properties_t *properties = createAttributes("2.0.0", "1.0.0", 
"my_bundle", "celix_my_bundle");
+
+        //When creating a manifest from the attributes
+        celix_autoptr(celix_bundle_manifest_t) manifest = nullptr;
+        celix_status_t status = celix_bundleManifest_create(properties, 
&manifest);
+
+        //Then the creation is successful
+        EXPECT_EQ(CELIX_SUCCESS, status);
+
+        //And the manifest contains the mandatory attributes
+        EXPECT_EQ(4, 
celix_properties_size(celix_bundleManifest_getAttributes(manifest)));
+        EXPECT_STREQ("my_bundle", 
celix_bundleManifest_getBundleName(manifest));
+        EXPECT_STREQ("celix_my_bundle", 
celix_bundleManifest_getSymbolicName(manifest));
+
+        const auto* mv = celix_bundleManifest_getManifestVersion(manifest);
+        const auto* bv = celix_bundleManifest_getBundleVersion(manifest);
+        ASSERT_NE(nullptr, mv);
+        ASSERT_NE(nullptr, bv);
+
+        celix_autofree char* manifestVersion = celix_version_toString(mv);
+        celix_autofree char* bundleVersion = celix_version_toString(bv);
+        EXPECT_STREQ("2.0.0", manifestVersion);
+        EXPECT_STREQ("1.0.0", bundleVersion);
+
+        //And the manifest does not contain optional attributes
+        EXPECT_EQ(nullptr, 
celix_bundleManifest_getBundleActivatorLibrary(manifest));
+        EXPECT_EQ(nullptr, 
celix_bundleManifest_getBundlePrivateLibraries(manifest));
+        EXPECT_EQ(nullptr, celix_bundleManifest_getBundleGroup(manifest));
+
+        //Given a properties set with all the mandatory and optional attributes
+        properties = createAttributes("2.0.0", "1.0.0", "my_bundle", 
"celix_my_bundle");
+        celix_properties_set(properties, "CELIX_BUNDLE_ACTIVATOR_LIBRARY", 
"my_activator");
+        celix_properties_set(properties, "CELIX_BUNDLE_PRIVATE_LIBRARIES", 
"lib1,lib2");
+        celix_properties_set(properties, "CELIX_BUNDLE_GROUP", "my_group");
+
+        //When creating a manifest from the attributes
+        celix_autoptr(celix_bundle_manifest_t) manifest2 = nullptr;
+        status = celix_bundleManifest_create(properties, &manifest2);
+
+        //Then the creation is successful
+        celix_err_printErrors(stdout, "Expect Errors: ", nullptr);
+        ASSERT_EQ(CELIX_SUCCESS, status);
+
+        //And the manifest contains the optional attributes
+        EXPECT_STREQ("my_activator", 
celix_bundleManifest_getBundleActivatorLibrary(manifest2));
+        const celix_array_list_t* privateLibraries = 
celix_bundleManifest_getBundlePrivateLibraries(manifest2);
+        ASSERT_NE(nullptr, privateLibraries);
+        EXPECT_EQ(2, celix_arrayList_size(privateLibraries));
+        EXPECT_STREQ("lib1", celix_arrayList_getString(privateLibraries, 0));
+        EXPECT_STREQ("lib2", celix_arrayList_getString(privateLibraries, 1));
+        EXPECT_STREQ("my_group", 
celix_bundleManifest_getBundleGroup(manifest2));
+}
diff --git a/libs/framework/src/celix_manifest.c 
b/libs/framework/src/celix_bundle_manifest.c
similarity index 62%
rename from libs/framework/src/celix_manifest.c
rename to libs/framework/src/celix_bundle_manifest.c
index 31e5db809..2d4c8c2d9 100644
--- a/libs/framework/src/celix_manifest.c
+++ b/libs/framework/src/celix_bundle_manifest.c
@@ -17,7 +17,9 @@
  * under the License.
  */
 
-#include "celix_manifest.h"
+#include "celix_bundle_manifest.h"
+#include <ctype.h>
+#include <string.h>
 
 #include "celix_err.h"
 #include "celix_properties.h"
@@ -26,17 +28,17 @@
 #include "celix_version.h"
 
 // Mandatory manifest attributes
-#define CELIX_MANIFEST_VERSION "CELIX_MANIFEST_VERSION"
+#define CELIX_BUNDLE_MANIFEST_VERSION "CELIX_BUNDLE_MANIFEST_VERSION"
 #define CELIX_BUNDLE_SYMBOLIC_NAME "CELIX_BUNDLE_SYMBOLIC_NAME"
 #define CELIX_BUNDLE_VERSION "CELIX_BUNDLE_VERSION"
 #define CELIX_BUNDLE_NAME "CELIX_BUNDLE_NAME"
 
 // Optional manifest attributes
-#define CELIX_BUNDLE_PRIVATE_LIBRARIES "CELIX_BUNDLE_PRIVATE_LIBRARIES"
 #define CELIX_BUNDLE_ACTIVATOR_LIBRARY "CELIX_BUNDLE_ACTIVATOR_LIBRARY"
+#define CELIX_BUNDLE_PRIVATE_LIBRARIES "CELIX_BUNDLE_PRIVATE_LIBRARIES"
 #define CELIX_BUNDLE_GROUP "CELIX_BUNDLE_GROUP"
 
-struct celix_manifest{
+struct celix_bundle_manifest {
     celix_properties_t* attributes;
 
     //Mandatory fields
@@ -55,14 +57,14 @@ struct celix_manifest{
  * @brief Set and validate the provided manifest by checking if all mandatory 
attributes are present and of the correct
  * type and checking if the optional attributes, when present, are of the 
correct type.
  */
-static celix_status_t celix_manifest_setAttributes(celix_manifest_t* manifest);
+static celix_status_t 
celix_bundleManifest_setAttributes(celix_bundle_manifest_t* manifest);
 
-celix_status_t celix_manifest_create(celix_properties_t* attributes, 
celix_manifest_t** manifestOut) {
+celix_status_t celix_bundleManifest_create(celix_properties_t* attributes, 
celix_bundle_manifest_t** manifestOut) {
     if (!attributes) {
         return CELIX_ILLEGAL_ARGUMENT;
     }
 
-    celix_autofree celix_manifest_t* manifest = calloc(1, sizeof(*manifest));
+    celix_autoptr(celix_bundle_manifest_t) manifest = calloc(1, 
sizeof(*manifest));
     if (!manifest) {
         celix_properties_destroy(attributes);
         celix_err_push("Failed to allocate memory for manifest");
@@ -70,23 +72,26 @@ celix_status_t celix_manifest_create(celix_properties_t* 
attributes, celix_manif
     }
     manifest->attributes = attributes;
 
-    CELIX_EPROP(celix_manifest_setAttributes(manifest));
+    celix_status_t status = celix_bundleManifest_setAttributes(manifest);
+    if (status != CELIX_SUCCESS) {
+        return status;
+    }
 
     *manifestOut = celix_steal_ptr(manifest);
     return CELIX_SUCCESS;
 }
 
 
-celix_status_t celix_manifest_createFromFile(const char* filename, 
celix_manifest_t** manifestOut) {
+celix_status_t celix_bundleManifest_createFromFile(const char* filename, 
celix_bundle_manifest_t** manifestOut) {
     celix_properties_t* properties = NULL;
     celix_status_t status = celix_properties_load(filename, 0, &properties);
     if (status != CELIX_SUCCESS) {
         return status;
     }
-    return celix_manifest_create(properties, manifestOut);
+    return celix_bundleManifest_create(properties, manifestOut);
 }
 
-void celix_manifest_destroy(celix_manifest_t* manifest) {
+void celix_bundleManifest_destroy(celix_bundle_manifest_t* manifest) {
     if (manifest) {
         celix_properties_destroy(manifest->attributes);
 
@@ -103,17 +108,17 @@ void celix_manifest_destroy(celix_manifest_t* manifest) {
     }
 }
 
-const celix_properties_t* celix_manifest_getAttributes(celix_manifest_t* 
manifest) {
+const celix_properties_t* 
celix_bundleManifest_getAttributes(celix_bundle_manifest_t* manifest) {
     return manifest->attributes;
 }
 
-static celix_status_t celix_manifest_setMandatoryAttributes(celix_manifest_t* 
manifest) {
+static celix_status_t 
celix_bundleManifest_setMandatoryAttributes(celix_bundle_manifest_t* manifest) {
     const char* symbolicName = celix_properties_get(manifest->attributes, 
CELIX_BUNDLE_SYMBOLIC_NAME, NULL);
     const char* bundleName = celix_properties_get(manifest->attributes, 
CELIX_BUNDLE_NAME, NULL);
 
     celix_autoptr(celix_version_t) manifestVersion = NULL;
     celix_status_t getVersionStatus =
-        celix_properties_getAsVersion(manifest->attributes, 
CELIX_MANIFEST_VERSION, NULL, &manifestVersion);
+        celix_properties_getAsVersion(manifest->attributes, 
CELIX_BUNDLE_MANIFEST_VERSION, NULL, &manifestVersion);
     CELIX_ERR_RET_IF_ENOMEM(getVersionStatus);
 
     celix_autoptr(celix_version_t) bundleVersion = NULL;
@@ -128,9 +133,18 @@ static celix_status_t 
celix_manifest_setMandatoryAttributes(celix_manifest_t* ma
     if (!symbolicName) {
         celix_err_push(CELIX_BUNDLE_SYMBOLIC_NAME " is missing");
         status = CELIX_ILLEGAL_ARGUMENT;
+    } else {
+        //check if bundle symbolic name only contains the following 
characters: [a-zA-Z0-9_-:]
+        for (size_t i = 0; symbolicName[i] != '\0'; ++i) {
+            if (!isalnum(symbolicName[i]) && strchr("-_:", symbolicName[i]) == 
NULL) {
+                celix_err_pushf(CELIX_BUNDLE_SYMBOLIC_NAME " contains invalid 
character '%c'", symbolicName[i]);
+                status = CELIX_ILLEGAL_ARGUMENT;
+                break;
+            }
+        }
     }
     if (!manifestVersion) {
-        celix_err_push(CELIX_MANIFEST_VERSION " is missing or not a version");
+        celix_err_push(CELIX_BUNDLE_MANIFEST_VERSION " is missing or not a 
version");
         status = CELIX_ILLEGAL_ARGUMENT;
     }
     if (!bundleVersion) {
@@ -139,7 +153,7 @@ static celix_status_t 
celix_manifest_setMandatoryAttributes(celix_manifest_t* ma
     }
 
     if (manifestVersion && celix_version_compareToMajorMinor(manifestVersion, 
2, 0) != 0) {
-        celix_err_push(CELIX_MANIFEST_VERSION " is not 2.0.*");
+        celix_err_push(CELIX_BUNDLE_MANIFEST_VERSION " is not 2.0.*");
         status = CELIX_ILLEGAL_ARGUMENT;
     }
 
@@ -155,26 +169,26 @@ static celix_status_t 
celix_manifest_setMandatoryAttributes(celix_manifest_t* ma
     return status;
 }
 
-static celix_status_t celix_manifest_setOptionalAttributes(celix_manifest_t* 
manifest) {
+static celix_status_t 
celix_bundleManifest_setOptionalAttributes(celix_bundle_manifest_t* manifest) {
     celix_status_t status = CELIX_SUCCESS;
 
-    const char* l = celix_properties_getAsString(manifest->attributes, 
CELIX_BUNDLE_ACTIVATOR_LIBRARY, NULL);
+    const char* lib = celix_properties_getAsString(manifest->attributes, 
CELIX_BUNDLE_ACTIVATOR_LIBRARY, NULL);
     celix_autofree char* activatorLib = NULL;
-    if (l) {
-        activatorLib = celix_utils_strdup(l);
+    if (lib) {
+        activatorLib = celix_utils_strdup(lib);
         CELIX_ERR_RET_IF_NULL(activatorLib);
     }
 
-    const char* g = celix_properties_getAsString(manifest->attributes, 
CELIX_BUNDLE_GROUP, NULL);
+    const char* group = celix_properties_getAsString(manifest->attributes, 
CELIX_BUNDLE_GROUP, NULL);
     celix_autofree char* bundleGroup = NULL;
-    if (g) {
-        bundleGroup = celix_utils_strdup(g);
+    if (group) {
+        bundleGroup = celix_utils_strdup(group);
         CELIX_ERR_RET_IF_NULL(bundleGroup);
     }
 
     celix_autoptr(celix_array_list_t) privateLibraries = NULL;
     celix_status_t getStatus = celix_properties_getAsStringArrayList(
-        manifest->attributes, CELIX_BUNDLE_ACTIVATOR_LIBRARY, NULL, 
&privateLibraries);
+        manifest->attributes, CELIX_BUNDLE_PRIVATE_LIBRARIES, NULL, 
&privateLibraries);
     CELIX_ERR_RET_IF_ENOMEM(getStatus);
     if (celix_properties_hasKey(manifest->attributes, 
CELIX_BUNDLE_PRIVATE_LIBRARIES) && !privateLibraries) {
         celix_err_pushf(CELIX_BUNDLE_PRIVATE_LIBRARIES " is not a string 
array. Got: '%s'",
@@ -191,8 +205,36 @@ static celix_status_t 
celix_manifest_setOptionalAttributes(celix_manifest_t* man
     return status;
 }
 
-static celix_status_t celix_manifest_setAttributes(celix_manifest_t* manifest) 
{
-    celix_status_t mStatus = celix_manifest_setMandatoryAttributes(manifest);
-    celix_status_t oStatus = celix_manifest_setOptionalAttributes(manifest);
+static celix_status_t 
celix_bundleManifest_setAttributes(celix_bundle_manifest_t* manifest) {
+    celix_status_t mStatus = 
celix_bundleManifest_setMandatoryAttributes(manifest);
+    celix_status_t oStatus = 
celix_bundleManifest_setOptionalAttributes(manifest);
     return mStatus != CELIX_SUCCESS ? mStatus : oStatus;
-}
\ No newline at end of file
+}
+
+const char* celix_bundleManifest_getBundleName(celix_bundle_manifest_t* 
manifest) {
+    return manifest->bundleName;
+}
+
+const char* celix_bundleManifest_getSymbolicName(celix_bundle_manifest_t* 
manifest) {
+    return manifest->symbolicName;
+}
+
+const celix_version_t* 
celix_bundleManifest_getBundleVersion(celix_bundle_manifest_t* manifest) {
+    return manifest->bundleVersion;
+}
+
+const celix_version_t* 
celix_bundleManifest_getManifestVersion(celix_bundle_manifest_t* manifest) {
+    return manifest->manifestVersion;
+}
+
+const char* 
celix_bundleManifest_getBundleActivatorLibrary(celix_bundle_manifest_t* 
manifest) {
+    return manifest->activatorLibrary;
+}
+
+const celix_array_list_t* 
celix_bundleManifest_getBundlePrivateLibraries(celix_bundle_manifest_t* 
manifest) {
+    return manifest->privateLibraries;
+}
+
+const char* celix_bundleManifest_getBundleGroup(celix_bundle_manifest_t* 
manifest) {
+    return manifest->bundleGroup;
+}
diff --git a/libs/framework/src/celix_bundle_manifest.h 
b/libs/framework/src/celix_bundle_manifest.h
new file mode 100644
index 000000000..662f2804d
--- /dev/null
+++ b/libs/framework/src/celix_bundle_manifest.h
@@ -0,0 +1,166 @@
+/*
+ * 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 CELIX_MANIFEST_H_
+#define CELIX_MANIFEST_H_
+
+#include "celix_array_list.h"
+#include "celix_cleanup.h"
+#include "celix_errno.h"
+#include "celix_properties_type.h"
+#include "celix_version_type.h"
+#include "celix_array_list_type.h"
+#include "celix_bundle_manifest_type.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @file celix_bundle_manifest.h
+ * @brief Header file for celix_bundle_manifest_t.
+ *
+ *
+ * The bundle manifest consists of a set of attributes, including a set of 
mandatory attributes.
+ * A bundle manifest is used to describe the contents of a bundle.
+ *
+ * A bundle manifest must contain the following attributes:
+ * - CELIX_BUNDLE_MANIFEST_VERSION, type celix_version_t, the version of the 
manifest.
+ * - CELIX_BUNDLE_SYMBOLIC_NAME, type string, the symbolic name of the bundle.
+ * - CELIX_BUNDLE_VERSION, type celix_version_t, the version of the bundle.
+ * - CELIX_BUNDLE_NAME, type string, the name of the bundle.
+ *
+ * The bundle manifest may contain the following attributes:
+ * - CELIX_BUNDLE_ACTIVATOR_LIBRARY, type string, the activator library of the 
bundle.
+ * - CELIX_BUNDLE_PRIVATE_LIBRARIES, type string array, the private libraries 
of the bundle.
+ * - CELIX_BUNDLE_GROUP, type string, the group of the bundle. Helps in 
grouping sets of bundles.
+ *
+ * And a manifest may contain any other attributes of any type, this can be 
retrieved using
+ * celix_bundleManifest_getAttributes.
+ *
+ * A bundle symbolic name can only contain the following characters: 
[a-zA-Z0-9_-:]
+ */
+
+/**
+ * Create a new manifest using the provided properties.
+ *
+ * If an error occurs, an error message is logged on celix_err and in case of 
an CELIX_ILLEGAL_ARGUMENT error, there
+ * can be multiple error messages.
+ *
+ * @param[in] properties The properties to use for the manifest. Takes 
ownership of the properties.
+ * @param[out] manifest The created manifest.
+ * @return CELIX_SUCCESS if no errors occurred, ENOMEM if memory allocation 
failed and CELIX_ILLEGAL_ARGUMENT if the
+ * provided attributes is incorrect. In case of an error, the provided 
attributes are destroyed.
+ */
+celix_status_t celix_bundleManifest_create(celix_properties_t* attributes, 
celix_bundle_manifest_t** manifest);
+
+/**
+ * Create a new manifest by reading the manifest from the provided file.
+ *
+ * If an error occurs, an error message is logged on celix_err.
+ *
+ * @param[in] filename The file to read the manifest from.
+ * @param[out] manifest The created manifest.
+ * @return CELIX_SUCCESS if no errors occurred, ENOMEM if memory allocation 
failed, CELIX_FILE_IO_EXCEPTION if the file
+ * could not be read and CELIX_ILLEGAL_ARGUMENT if the manifest file is 
invalid.
+ */
+celix_status_t celix_bundleManifest_createFromFile(const char* filename, 
celix_bundle_manifest_t** manifest);
+
+/**
+ * @brief Destroy the provided manifest.
+ */
+void celix_bundleManifest_destroy(celix_bundle_manifest_t* manifest);
+
+/**
+ * Define the cleanup function for a celix_bundleManifest_t, so that it can be 
used with celix_autoptr.
+ */
+CELIX_DEFINE_AUTOPTR_CLEANUP_FUNC(celix_bundle_manifest_t, 
celix_bundleManifest_destroy)
+
+/**
+ * @brief Get the manifest attributes.
+ * The manifest attributes are valid as long as the manifest is valid.
+ *
+ * @param[in] manifest The bundle manifest to get the manifest version from. 
Cannot be NULL.
+ * @return The manifest attributes. Will never be NULL.
+ */
+const celix_properties_t* 
celix_bundleManifest_getAttributes(celix_bundle_manifest_t* manifest);
+
+/**
+ * @brief Get the manifest version. Returned value is valid as long as the 
manifest is valid.
+ *
+ * @param[in] manifest The bundle manifest to get the manifest version from. 
Cannot be NULL.
+ * @return The bundle name. Will never be NULL.
+ */
+const char* celix_bundleManifest_getBundleName(celix_bundle_manifest_t* 
manifest);
+
+/**
+ * @brief Get the manifest version. Returned value is valid as long as the 
manifest is valid.
+ *
+ * @param[in] manifest The bundle manifest to get the manifest version from. 
Cannot be NULL.
+ * @return The bundle symbolic name. Will never be NULL.
+ */
+const char* celix_bundleManifest_getSymbolicName(celix_bundle_manifest_t* 
manifest);
+
+/**
+ * @brief Get the bundle version. Returned value is valid as long as the 
manifest is valid.
+ *
+ * @param[in] manifest The bundle manifest to get the manifest version from. 
Cannot be NULL.
+ * @return The bundle version. Will never be NULL.
+ */
+const celix_version_t* 
celix_bundleManifest_getBundleVersion(celix_bundle_manifest_t* manifest);
+
+/**
+ * @brief Get the bundle version. Returned value is valid as long as the 
manifest is valid.
+ *
+ * @param[in] manifest The bundle manifest to get the manifest version from. 
Cannot be NULL.
+ * @return The manifest version. Will never be NULL.
+ */
+const celix_version_t* 
celix_bundleManifest_getManifestVersion(celix_bundle_manifest_t* manifest);
+
+/**
+ * @brief Get the bundle activator library. Returned value is valid as long as 
the manifest is valid.
+ *
+ * @param[in] manifest The bundle manifest to get the manifest version from. 
Cannot be NULL.
+ * @return The bundle activator library. Will be NULL if the manifest does not 
contain the attribute.
+ */
+const char* 
celix_bundleManifest_getBundleActivatorLibrary(celix_bundle_manifest_t* 
manifest);
+
+/**
+ * @brief Get the bundle private libraries. Returned value is valid as long as 
the manifest is valid.
+ *
+ * @param[in] manifest The bundle manifest to get the manifest version from. 
Cannot be NULL.
+ * @return The bundle private libraries as a celix_array_list_t* with strings. 
Will be NULL if the manifest does not
+ * contain the attribute.
+ */
+const celix_array_list_t* 
celix_bundleManifest_getBundlePrivateLibraries(celix_bundle_manifest_t* 
manifest);
+
+/**
+ * @brief Get the bundle group. Returned value is valid as long as the 
manifest is valid.
+ *
+ * @param[in] manifest The bundle manifest to get the manifest version from. 
Cannot be NULL.
+ * @return The bundle group. Will be NULL if the manifest does not contain the 
attribute.
+ */
+const char* celix_bundleManifest_getBundleGroup(celix_bundle_manifest_t* 
manifest);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* CELIX_MANIFEST_H_ */
diff --git a/libs/framework/src/celix_bundle_manifest_type.h 
b/libs/framework/src/celix_bundle_manifest_type.h
new file mode 100644
index 000000000..affea1f3b
--- /dev/null
+++ b/libs/framework/src/celix_bundle_manifest_type.h
@@ -0,0 +1,41 @@
+/*
+ * 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 CELIX_MANIFEST_TYPE_H_
+#define CELIX_MANIFEST_TYPE_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @file celix_bundle_manifest_type.h
+ * @brief Header file for celix_bundle_manifest_t type.
+ */
+
+/**
+ * @brief The definition of the celix_bundleManifest_t* abstract data type.
+ */
+typedef struct celix_bundle_manifest celix_bundle_manifest_t;
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* CELIX_MANIFEST_TYPE_H_ */
diff --git a/libs/framework/src/celix_manifest.h 
b/libs/framework/src/celix_manifest.h
deleted file mode 100644
index 8704c645c..000000000
--- a/libs/framework/src/celix_manifest.h
+++ /dev/null
@@ -1,108 +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 CELIX_MANIFEST_H_
-#define CELIX_MANIFEST_H_
-
-#include "celix_errno.h"
-#include "celix_properties_type.h"
-#include "celix_cleanup.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * @file celix_manifest.h
- * @brief Header file for celix_manifest_t.
- *
- *
- * The manifest consists of a set of attributes, including a set of mandatory 
attributes.
- * A manifest is used to describe the contents of a bundle.
- *
- * A manifest must contain the following attributes:
- * - CELIX_MANIFEST_VERSION, type celix_version_t, the version of the manifest.
- * - CELIX_BUNDLE_SYMBOLIC_NAME, type string, the symbolic name of the bundle.
- * - CELIX_BUNDLE_VERSION, type celix_version_t, the version of the bundle.
- * - CELIX_BUNDLE_NAME, type string, the name of the bundle.
- *
- * The manifest may contain the following attributes:
- * - CELIX_BUNDLE_ACTIVATOR_LIBRARY, type string, the activator library of the 
bundle.
- * - CELIX_BUNDLE_PRIVATE_LIBRARIES, type string array, the private libraries 
of the bundle.
- * - CELIX_BUNDLE_GROUP, type string, the group of the bundle. Helps in 
grouping sets of bundles.
- *
- * And a manifest may contain any other attributes of any type, this can be 
retrieved using
- * celix_manifest_getAttributes.
- *
- * A bundle symbolic name can only contain the following characters: 
[a-zA-Z0-9_-:]
- */
-
-/**
- * @brief The definition of the celix_manifest_t* abstract data type.
- */
-typedef struct celix_manifest celix_manifest_t;
-
-/**
- * Create a new manifest using the provided properties.
- *
- * If an error occurs, an error message is logged on celix_err and in case of 
an CELIX_ILLEGAL_ARGUMENT error, there
- * can be multiple error messages.
- *
- * @param[in] properties The properties to use for the manifest. Takes 
ownership of the properties.
- * @param[out] manifest The created manifest.
- * @return CELIX_SUCCESS if no errors occurred, ENOMEM if memory allocation 
failed and CELIX_ILLEGAL_ARGUMENT if the
- * provided attributes is incorrect. In case of an error, the provided 
attributes are destroyed.
- */
-celix_status_t celix_manifest_create(celix_properties_t* attributes, 
celix_manifest_t** manifest);
-
-/**
- * Create a new manifest by reading the manifest from the provided file.
- *
- * If an error occurs, an error message is logged on celix_err.
- *
- * @param[in] filename The file to read the manifest from.
- * @param[out] manifest The created manifest.
- * @return CELIX_SUCCESS if no errors occurred, ENOMEM if memory allocation 
failed, CELIX_FILE_IO_EXCEPTION if the file
- * could not be read and CELIX_ILLEGAL_ARGUMENT if the manifest file is 
invalid.
- */
-celix_status_t celix_manifest_createFromFile(const char* filename, 
celix_manifest_t** manifest);
-
-/**
- * @brief Destroy the provided manifest.
- */
-void celix_manifest_destroy(celix_manifest_t* manifest);
-
-/**
- * Define the cleanup function for a celix_manifest_t, so that it can be used 
with celix_autoptr.
- */
-CELIX_DEFINE_AUTOPTR_CLEANUP_FUNC(celix_manifest_t, celix_manifest_destroy)
-
-/**
- * @brief Get the manifest attributes.
- * The manifest attributes are valid as long as the manifest is valid.
- */
-const celix_properties_t* celix_manifest_getAttributes(celix_manifest_t* 
manifest);
-
-//TODO getters for mandatory and optional attributes
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* CELIX_MANIFEST_H_ */
diff --git a/libs/utils/include/celix_array_list.h 
b/libs/utils/include/celix_array_list.h
index 6c41f2af2..8393bc238 100644
--- a/libs/utils/include/celix_array_list.h
+++ b/libs/utils/include/celix_array_list.h
@@ -19,6 +19,7 @@
 
 #include <stdbool.h>
 
+#include "celix_array_list_type.h"
 #include "celix_utils_export.h"
 #include "celix_cleanup.h"
 #include "celix_errno.h"
@@ -41,6 +42,11 @@
 extern "C" {
 #endif
 
+/**
+ * @file celix_array_list.h
+ * @brief Header file for celix_array_list_t functions and celix_array_list_t 
specific types.
+ */
+
 /**
  * @enum celix_array_list_element_type_t
  * @brief An enumeration of the types of elements that can be stored in a 
Celix array list.
@@ -77,11 +83,6 @@ typedef union celix_array_list_entry {
                                    CELIX_ARRAY_LIST_ELEMENT_TYPE_VERSION or 
CELIX_ARRAY_LIST_ELEMENT_TYPE_UNDEFINED. */
 } celix_array_list_entry_t;
 
-/**
- * @brief A celix array list, which can store a list of undefined elements.
- */
-typedef struct celix_array_list celix_array_list_t;
-
 /**
  * @brief Equals function for array list entries, can be provided when 
creating a array list.
  */
diff --git a/libs/utils/include/celix_array_list_type.h 
b/libs/utils/include/celix_array_list_type.h
new file mode 100644
index 000000000..a7e4e60a6
--- /dev/null
+++ b/libs/utils/include/celix_array_list_type.h
@@ -0,0 +1,43 @@
+/*
+ * 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 CELIX_ARRAY_LIST_TYPE_H_
+#define CELIX_ARRAY_LIST_TYPE_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @file celix_array_list_type.h
+ * @brief Header file for celix_array_list_t type.
+ */
+
+/**
+ * @brief A celix array list, which can store a list of undefined elements.
+ */
+typedef struct celix_array_list celix_array_list_t;
+
+#ifdef __cplusplus
+}
+#endif
+
+#undef CELIX_OPTS_INIT
+
+#endif /* CELIX_ARRAY_LIST_TYPE_H_ */


Reply via email to