PengZheng commented on code in PR #721:
URL: https://github.com/apache/celix/pull/721#discussion_r1537103298


##########
bundles/remote_services/rsa_utils/CMakeLists.txt:
##########
@@ -0,0 +1,39 @@
+# 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.
+
+set(RSA_UTILS_SRC
+    src/celix_rsa_utils.c
+)
+
+add_library(rsa_utils STATIC ${RSA_UTILS_SRC})
+set_target_properties(rsa_utils PROPERTIES OUTPUT_NAME "celix_rsa_utils")
+target_include_directories(rsa_utils PRIVATE src)
+target_include_directories(rsa_utils PUBLIC 
$<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/include>)
+target_link_libraries(rsa_utils PUBLIC Celix::framework)
+
+install(TARGETS rsa_utils EXPORT celix LIBRARY DESTINATION 
${CMAKE_INSTALL_LIBDIR} COMPONENT rsa

Review Comment:
   Is this only used for internal compatibility? If so, we don't need to 
install it.
   Otherwise, we need to write test_package to make sure that this is properly 
installed.



##########
bundles/remote_services/rsa_utils/include/celix_rsa_utils.h:
##########
@@ -0,0 +1,51 @@
+/*
+ * 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_CELIX_RSA_UTILS_H
+#define CELIX_CELIX_RSA_UTILS_H
+
+#include "celix_errno.h"
+#include "celix_properties_type.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @brief Create a typed service properties from endpoint properties.
+ *
+ * The conversion ensures that "service.ranking" and "bundle.id" (if present) 
are set as long values and that the
+ * "service.version" (if present) is set as version.
+ *
+ * Note that the "service.id" long "service.bundleid" properties are set 
during service registration and
+ * therefore not set by this function.
+ *
+ * @param[in] endpointProperties
+ * @param[out] serviceProperties
+ * @return CELIX_SUCCESS if successfully, CELIX_ENOMEM if out of memory.

Review Comment:
   And `CELIX_ILLEGAL_ARGUMENT` for invalid version?



##########
libs/utils/include/celix_array_list.h:
##########
@@ -484,6 +525,16 @@ celix_status_t 
celix_arrayList_addVersion(celix_array_list_t* list, const celix_
 CELIX_UTILS_EXPORT
 celix_status_t celix_arrayList_assignVersion(celix_array_list_t* list, 
celix_version_t* value);
 
+/**
+ * @brief add string pointer entry to the back of the array list.
+ * @note The string will *not* be copied.
+ *
+ * @param list The array list.
+ * @param value The string value to add to the array list.
+ * @return CELIX_SUCCESS if the value is added, CELIX_ENOMEM if the array list 
is out of memory.
+ */
+CELIX_UTILS_EXPORT celix_status_t celix_arrayList_addString(celix_array_list_t 
*list, const char* value);

Review Comment:
   This has already been declared in this header file, and thus should be 
removed.
   And the documentation is incorrect, since the string will be copied for 
explicit string-type array.



##########
libs/utils/include/celix_array_list.h:
##########
@@ -599,6 +650,15 @@ void celix_arrayList_removeBool(celix_array_list_t* list, 
bool value);
 CELIX_UTILS_EXPORT
 void celix_arrayList_removeVersion(celix_array_list_t* list, const 
celix_version_t* value);
 
+/**
+ * @brief Remove the first size entry from array list which matches the 
provided value.
+ *
+ * The equals callback provided when the array list was created will be used 
to find the entry.
+ * If there was no equals callback provided a direct memory compare will be 
done.
+ */
+CELIX_UTILS_EXPORT
+void celix_arrayList_removeString(celix_array_list_t *list, const char* value);

Review Comment:
   Duplicated declaration. It should be removed.



##########
bundles/remote_services/rsa_utils/include/celix_rsa_utils.h:
##########
@@ -0,0 +1,51 @@
+/*
+ * 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_CELIX_RSA_UTILS_H
+#define CELIX_CELIX_RSA_UTILS_H
+
+#include "celix_errno.h"
+#include "celix_properties_type.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @brief Create a typed service properties from endpoint properties.
+ *
+ * The conversion ensures that "service.ranking" and "bundle.id" (if present) 
are set as long values and that the

Review Comment:
   I saw no checking for "bundle.id".



##########
libs/utils/include/celix_properties.h:
##########
@@ -40,33 +40,33 @@
 
 #include <stdio.h>
 
+#include "celix_properties_type.h"
 #include "celix_cleanup.h"
 #include "celix_compiler.h"
 #include "celix_errno.h"
 #include "celix_utils_export.h"
 #include "celix_version.h"
+#include "celix_array_list.h"
 
 #ifdef __cplusplus
 extern "C" {
 #endif
 
-/**
- * @brief celix_properties_t is a type that represents a set of key-value 
pairs called properties.
- *
- * @note Not thread safe.
- */
-typedef struct celix_properties celix_properties_t;
-
 /**
  * @brief Enum representing the possible types of a property value.
  */
 typedef enum celix_properties_value_type {
-    CELIX_PROPERTIES_VALUE_TYPE_UNSET = 0,  /**< Property value is not set. */
-    CELIX_PROPERTIES_VALUE_TYPE_STRING = 1, /**< Property value is a string. */
-    CELIX_PROPERTIES_VALUE_TYPE_LONG = 2,   /**< Property value is a long 
integer. */
-    CELIX_PROPERTIES_VALUE_TYPE_DOUBLE = 3, /**< Property value is a double. */
-    CELIX_PROPERTIES_VALUE_TYPE_BOOL = 4,   /**< Property value is a boolean. 
*/
-    CELIX_PROPERTIES_VALUE_TYPE_VERSION = 5 /**< Property value is a Celix 
version. */
+    CELIX_PROPERTIES_VALUE_TYPE_UNSET = 0,     /**< Property value is not set. 
*/
+    CELIX_PROPERTIES_VALUE_TYPE_STRING = 1,    /**< Property value is a 
string. */
+    CELIX_PROPERTIES_VALUE_TYPE_LONG = 2,      /**< Property value is a long 
integer. */
+    CELIX_PROPERTIES_VALUE_TYPE_DOUBLE = 3,    /**< Property value is a 
double. */
+    CELIX_PROPERTIES_VALUE_TYPE_BOOL = 4,      /**< Property value is a 
boolean. */
+    CELIX_PROPERTIES_VALUE_TYPE_VERSION = 5,   /**< Property value is a Celix 
version. */
+    CELIX_PROPERTIES_VALUE_TYPE_STRING_ARRAY = 6, /**< Property value is an 
array of strings. */

Review Comment:
   Why a single array type is not enough?



##########
libs/utils/include/celix_array_list.h:
##########
@@ -368,6 +390,25 @@ bool celix_arrayList_getBool(const celix_array_list_t 
*list, int index);
 CELIX_UTILS_EXPORT
 const celix_version_t* celix_arrayList_getVersion(const celix_array_list_t 
*list, int index);
 
+/**
+ * @brief Returns the value for the provided index.
+ *
+ * @param list The array list.
+ * @param index The entry index to return.
+ * @return Returns the string (const char*) value for the index. Returns NULL 
if index is out of bound.
+ */
+CELIX_UTILS_EXPORT
+const char* celix_arrayList_getString(const celix_array_list_t *list, int 
index);

Review Comment:
   This has already been declared, and thus should be removed.



##########
libs/utils/include/celix_array_list.h:
##########
@@ -290,6 +295,23 @@ celix_array_list_element_type_t 
celix_arrayList_getElementType(const celix_array
 CELIX_UTILS_EXPORT
 int celix_arrayList_size(const celix_array_list_t *list);
 
+/**
+ * @brief Create a shallow copy of the array list.
+ *
+ * The returned array list will be a shallow copy of the provided array list.
+ * If the entries are pointers, the pointers will be copied, but the pointed 
to values will not be copied.
+ * The equals callback provided when the provided array list was created will 
be copied, the removed callback
+ * will not be copied.
+ *
+ * If the provided list is NULL, NULL is returned.
+ * If the return value is NULL, an error message is logged to celix_err.
+ *
+ * @param list The array list.
+ * @return A shallow copy of the array list or NULL if there is not enough 
memory.
+ */
+CELIX_UTILS_EXPORT
+celix_array_list_t* celix_arrayList_copy(const celix_array_list_t *list);

Review Comment:
   Duplicated declaration, and thus should be removed.



##########
libs/utils/src/properties.c:
##########
@@ -138,33 +138,43 @@ static celix_status_t 
celix_properties_fillEntry(celix_properties_t* properties,
                                                  celix_properties_entry_t* 
entry,
                                                  const 
celix_properties_entry_t* prototype) {
     char convertedValueBuffer[21] = {0};
-    *entry = *prototype;
-    if (prototype->valueType == CELIX_PROPERTIES_VALUE_TYPE_VERSION) {
-        bool written = celix_version_fillString(prototype->typed.versionValue, 
convertedValueBuffer, sizeof(convertedValueBuffer));
+    memcpy(entry, prototype, sizeof(*entry));
+    entry->value = NULL;
+    if (entry->valueType == CELIX_PROPERTIES_VALUE_TYPE_VERSION) {
+        bool written = celix_version_fillString(entry->typed.versionValue, 
convertedValueBuffer, sizeof(convertedValueBuffer));
         if (written) {
             entry->value = celix_properties_createString(properties, 
convertedValueBuffer);
         } else {
-            entry->value = 
celix_version_toString(prototype->typed.versionValue);
+            entry->value = celix_version_toString(entry->typed.versionValue);
         }
-    } else if (prototype->valueType == CELIX_PROPERTIES_VALUE_TYPE_LONG) {
+    } else if (entry->valueType == CELIX_PROPERTIES_VALUE_TYPE_LONG) {
         // LONG_MAX str is 19 chars, LONG_MIN str is 20 chars
         (void)snprintf(convertedValueBuffer, sizeof(convertedValueBuffer), 
"%li", entry->typed.longValue);
         entry->value = celix_properties_createString(properties, 
convertedValueBuffer);
-    } else if (prototype->valueType == CELIX_PROPERTIES_VALUE_TYPE_DOUBLE) {
+    } else if (entry->valueType == CELIX_PROPERTIES_VALUE_TYPE_DOUBLE) {
         int written = snprintf(convertedValueBuffer, 
sizeof(convertedValueBuffer), "%f", entry->typed.doubleValue);
-        if (written >= 0 || written < sizeof(convertedValueBuffer)) {
+        if (written >= 0 && written < sizeof(convertedValueBuffer)) {
             entry->value = celix_properties_createString(properties, 
convertedValueBuffer);
         } else {
             char* val = NULL;
             asprintf(&val, "%f", entry->typed.doubleValue);
             entry->value = val;
         }
-    } else if (prototype->valueType == CELIX_PROPERTIES_VALUE_TYPE_BOOL) {
+    } else if (entry->valueType == CELIX_PROPERTIES_VALUE_TYPE_BOOL) {
         entry->value = entry->typed.boolValue ? 
CELIX_PROPERTIES_BOOL_TRUE_STRVAL : CELIX_PROPERTIES_BOOL_FALSE_STRVAL;
+    } else if (entry->valueType == CELIX_PROPERTIES_VALUE_TYPE_LONG_ARRAY) {
+        entry->value = 
celix_utils_longArrayListToString(entry->typed.arrayValue);
+    } else if (entry->valueType == CELIX_PROPERTIES_VALUE_TYPE_DOUBLE_ARRAY) {
+        entry->value = 
celix_utils_doubleArrayListToString(entry->typed.arrayValue);

Review Comment:
   WIll a single `celix_arrayListToString` be enough?



##########
libs/utils/include/celix_array_list.h:
##########
@@ -290,6 +295,23 @@ celix_array_list_element_type_t 
celix_arrayList_getElementType(const celix_array
 CELIX_UTILS_EXPORT
 int celix_arrayList_size(const celix_array_list_t *list);
 
+/**
+ * @brief Create a shallow copy of the array list.

Review Comment:
   This is no longer shallow copy, right?



##########
libs/utils/include/celix_array_list.h:
##########
@@ -368,6 +390,25 @@ bool celix_arrayList_getBool(const celix_array_list_t 
*list, int index);
 CELIX_UTILS_EXPORT
 const celix_version_t* celix_arrayList_getVersion(const celix_array_list_t 
*list, int index);
 
+/**
+ * @brief Returns the value for the provided index.
+ *
+ * @param list The array list.
+ * @param index The entry index to return.
+ * @return Returns the string (const char*) value for the index. Returns NULL 
if index is out of bound.
+ */
+CELIX_UTILS_EXPORT
+const char* celix_arrayList_getString(const celix_array_list_t *list, int 
index);
+
+/**
+ * @brief Returns the entry for the provided index.
+ *
+ * @param list The array list.
+ * @param index The entry index to return.
+ * @return Returns the entry for the index. Returns NULL if index is out of 
bound.
+ */
+celix_array_list_entry_t celix_arrayList_getEntry(const celix_array_list_t 
*list, int index);

Review Comment:
   Missing `CELIX_UTILS_EXPORT`



##########
libs/utils/include/celix_properties.h:
##########
@@ -385,14 +512,264 @@ celix_properties_getVersion(const celix_properties_t* 
properties, const char* ke
  * @param[in] properties The property set to search.
  * @param[in] key The key of the property to get.
  * @param[in] defaultValue The value to return if the property is not set or 
if the value is not a Celix version.
- * @return A copy of the property value if it is a Celix version, or a new 
Celix version created from the property
- *         value string if it can be converted, or a copy of the default value 
if the property is not set or the value
- *         is not a valid Celix version.
- * @retval NULL if version cannot be found/converted and the defaultValue is 
NULL.
+ * @param[out] version A copy of the found version, a new parsed version, or a 
copy of the default value if the
+ *                 property is not set, its value is not an version or its 
value cannot be converted to an version.
+ * @return CELIX_SUCCESS if the operation was successful, CELIX_ENOMEM if 
there was not enough memory to create the
+ *        version. Note if the key is not found, the return status is still 
CELIX_SUCCESS.
+ */
+CELIX_UTILS_EXPORT celix_status_t celix_properties_getAsVersion(const 
celix_properties_t* properties,
+                                                                  const char* 
key,
+                                                                  const 
celix_version_t* defaultValue,
+                                                                  
celix_version_t** version);
+
+/**
+ * @brief Set a pointer, long, double, bool, string or version array list 
array for a property value.
+ *
+ * The set property type cannot be CELIX_ARRAY_LIST_ELEMENT_TYPE_UNDEFINED or 
CELIX_ARRAY_LIST_ELEMENT_TYPE_POINTER
+ *
+ * This function will make a copy of the provided celix_array_list_t object, 
using the celix_arrayList_copy function.
+ *
+ * If an error occurs, the error status is returned and a message is logged to
+ * celix_err.
+ *
+ * @param[in] properties The property set to modify.
+ * @param[in] key The key of the property to set.
+ * @param[in] values An array list of types values to set for the property. 
Cannot be NULL.
+ * @return CELIX_SUCCESS if the operation was successful, CELIX_ENOMEM if 
there was not enough memory to set the entry,
+ *         and CELIX_ILLEGAL_ARGUMENT if the provided key or values is NULL or 
if the array list type is
+ *         valid.
  */
-CELIX_UTILS_EXPORT celix_version_t* celix_properties_getAsVersion(const 
celix_properties_t* properties,
+CELIX_UTILS_EXPORT celix_status_t 
celix_properties_setArrayList(celix_properties_t* properties,
+                                                                const char* 
key,
+                                                                const 
celix_array_list_t* values);
+
+/**
+ * @brief Assign a pointer, long, double, bool, string or version array list 
array for a property value.
+ *
+ * The set property type cannot be CELIX_ARRAY_LIST_ELEMENT_TYPE_UNDEFINED or 
CELIX_ARRAY_LIST_ELEMENT_TYPE_POINTER
+ *
+ * This function stores a reference to the provided celix_array_list_t object 
in the property set and takes
+ * ownership of the array.
+ * If an error occurs, the error status is returned, the provided array is 
destroyed and a
+ * message is logged to celix_err.
+ *
+ * @param[in] properties The property set to modify.
+ * @param[in] key The key of the property to set.
+ * @param[in] values An array list of long values to assign to the property. 
Ownership of the array is transferred
+ *                   to the properties set. Cannot be NULL.
+ * @return CELIX_SUCCESS if the operation was successful, CELIX_ENOMEM if 
there was not enough memory to set the entry,
+ *         and CELIX_ILLEGAL_ARGUMENT if the provided key is NULL, values is 
NULL or the array list type is
+ *         valid. On error, the provided array list is destroyed.
+ */
+CELIX_UTILS_EXPORT celix_status_t 
celix_properties_assignArrayList(celix_properties_t* properties,
+                                                                   const char* 
key,
+                                                                   
celix_array_list_t* values);
+
+/**
+ * @brief Get a property value as an array of longs.
+ *
+ * This function retrieves the value of a property, interpreting it as an 
array of longs. If the underlying type of the
+ * property value is a long array, a copy of the array is returned. If the 
underlying type is a string, the string is
+ * converted to an array of longs if possible.
+ * If the property is not set, its value is not an array of longs or its value 
cannot be converted to a long array,
+ * the default value is returned as a copy.
+ *
+ * @param[in] properties The property set to search.
+ * @param[in] key The key of the property to get.
+ * @param[in] defaultValue The default value to return if the property is not 
set or its value is not an array of longs.
+ * @param[out] list A copy of the found list, a new array list with long 
values or a copy of the default value if the
+ *                 property is not set, its value is not an array of longs or 
its value cannot be converted to an array
+ *                 of longs.
+ * @return CELIX_SUCCESS if the operation was successful, CELIX_ENOMEM if 
there was not enough memory to create the
+ *        array list. Note if the key is not found, the return status is still 
CELIX_SUCCESS.
+ */
+CELIX_UTILS_EXPORT celix_status_t celix_properties_getAsLongArrayList(const 
celix_properties_t* properties,
                                                                   const char* 
key,
-                                                                  const 
celix_version_t* defaultValue);
+                                                                  const 
celix_array_list_t* defaultValue,
+                                                                  
celix_array_list_t** list);
+
+/**
+ * @brief Get the property value as an array of longs without copying.
+ *
+ * This function provides a non-owning, read-only access to a property value 
interpreted as an array of longs.
+ * It returns a const pointer to the array. If the property is not set or its 
value is not an array of longs,
+ * the default value is returned.
+ *
+ * @param[in] properties The property set to search.
+ * @param[in] key The key of the property to get.
+ * @param[in] defaultValue The value to return if the property is not set or 
its value is not an array of longs.
+ * @return A const pointer to the property value interpreted as an array of 
longs, or the default value if the property
+ *         is not set or its value is not an array of longs. The returned 
pointer should not be modified or freed.
+ */
+CELIX_UTILS_EXPORT const celix_array_list_t* 
celix_properties_getLongArrayList(const celix_properties_t* properties,
+                                                                            
const char* key,
+                                                                            
const celix_array_list_t* defaultValue);
+
+/**
+ * @brief Get a property value as an array of doubles, making a copy of the 
array.
+ *
+ * This function retrieves the value of a property, interpreting it as an 
array of doubles. If the underlying type of
+ * the property value is a double array, a copy of the array is returned. If 
the underlying type is a string, the string
+ * is converted to an array of doubles if possible. If the property is not 
set, its value is not an array of doubles or
+ * its value cannot be converted to a double array, the default value is 
returned as a copy.
+ *
+ * @param[in] properties The property set to search.
+ * @param[in] key The key of the property to get.
+ * @param[in] defaultValue The default value to return if the property is not 
set or its value is not an array of
+ * doubles.
+ * @param[out] list A copy of the found list, a new array list with double 
values or a copy of the default value if the
+ *                 property is not set, its value is not an array doubles 
longs or its value cannot be converted to an
+ * array of doubles.
+ * @return CELIX_SUCCESS if the operation was successful, CELIX_ENOMEM if 
there was not enough memory to create the
+ *        array list. Note if the key is not found, the return status is still 
CELIX_SUCCESS.
+ */
+CELIX_UTILS_EXPORT celix_status_t celix_properties_getAsDoubleArrayList(const 
celix_properties_t* properties,
+                                                                        const 
char* key,
+                                                                        const 
celix_array_list_t* defaultValue,
+                                                                        
celix_array_list_t** list);
+
+/**
+ * @brief Get the property value as an array of doubles without copying.
+ *
+ * This function provides a non-owning, read-only access to a property value 
interpreted as an array of doubles.
+ * It returns a const pointer to the array. If the property is not set or its 
value is not an array of doubles,
+ * the default value is returned.
+ *
+ * @param[in] properties The property set to search.
+ * @param[in] key The key of the property to get.
+ * @param[in] defaultValue The value to return if the property is not set or 
its value is not an array of doubles.
+ * @return A const pointer to the property value interpreted as an array of 
doubles, or the default value if the
+ * property is not set or its value is not an array of doubles. The returned 
pointer should not be modified or freed.
+ */
+CELIX_UTILS_EXPORT const celix_array_list_t* 
celix_properties_getDoubleArrayList(
+    const celix_properties_t* properties, const char* key, const 
celix_array_list_t* defaultValue);
+
+/**
+ * @brief Get a property value as an array of booleans, making a copy of the 
array.
+ *
+ * This function retrieves the value of a property, interpreting it as an 
array of booleans. If the underlying type of
+ * the property value is a boolean array, a copy of the array is returned. If 
the underlying type is a string, the
+ * string is converted to an array of booleans if possible. If the property is 
not set, its value is not an array of
+ * booleans or its value cannot be converted to a boolean array, the default 
value is returned as a copy.
+ *
+ * @param[in] properties The property set to search.
+ * @param[in] key The key of the property to get.
+ * @param[in] defaultValue The default value to return if the property is not 
set or its value is not an array of
+ * booleans.
+ * @param[out] list A copy of the found list, a new array list with boolean 
values or a copy of the default value if the
+ *                 property is not set, its value is not an array of booleans 
or its value cannot be converted to an
+ * array of booleans.
+ * @return CELIX_SUCCESS if the operation was successful, CELIX_ENOMEM if 
there was not enough memory to create the
+ *        array list. Note if the key is not found, the return status is still 
CELIX_SUCCESS.
+ */
+CELIX_UTILS_EXPORT celix_status_t celix_properties_getAsBoolArrayList(const 
celix_properties_t* properties,
+                                                                      const 
char* key,
+                                                                      const 
celix_array_list_t* defaultValue,
+                                                                      
celix_array_list_t** list);
+
+/**
+ * @brief Get the property value as an array of booleans without copying.
+ *
+ * This function provides a non-owning, read-only access to a property value 
interpreted as an array of booleans.
+ * It returns a const pointer to the array. If the property is not set or its 
value is not an array of booleans,
+ * the default value is returned.
+ *
+ * @param[in] properties The property set to search.
+ * @param[in] key The key of the property to get.
+ * @param[in] defaultValue The value to return if the property is not set or 
its value is not an array of booleans.
+ * @return A const pointer to the property value interpreted as an array of 
booleans, or the default value if the
+ * property is not set or its value is not an array of booleans. The returned 
pointer should not be modified or freed.
+ */
+CELIX_UTILS_EXPORT const celix_array_list_t* celix_properties_getBoolArrayList(
+    const celix_properties_t* properties, const char* key, const 
celix_array_list_t* defaultValue);
+
+/**
+ * @brief Get a property value as an array of strings, making a copy of the 
array.
+ *
+ * This function retrieves the value of a property, interpreting it as an 
array of strings. If the underlying type of
+ * the property value is a string array, a copy of the array is returned. If 
the underlying type is a string, the string
+ * is converted to an array of strings if possible. If the property is not 
set, its value is not an array of strings or
+ *  its value cannot be converted to a string array, the default value is 
returned as a copy.
+ *
+ * The returned array list is configured with a remove callback so that the 
destruction of the array list will also
+ * free the strings in the array list.
+ *
+ * @param[in] properties The property set to search.
+ * @param[in] key The key of the property to get.
+ * @param[in] defaultValue The default value to return if the property is not 
set or its value is not an array of
+ * strings.
+ * @param[out] list A copy of the found list, a new array list with string 
values or a copy of the default value if the
+ *                 property is not set, its value is not an array of strings 
or its value cannot be converted to an
+ * array of strings.
+ * @return CELIX_SUCCESS if the operation was successful, CELIX_ENOMEM if 
there was not enough memory to create the
+ *        array list. Note if the key is not found, the return status is still 
CELIX_SUCCESS.
+ */
+CELIX_UTILS_EXPORT celix_status_t celix_properties_getAsStringArrayList(const 
celix_properties_t* properties,
+                                                                        const 
char* key,
+                                                                        const 
celix_array_list_t* defaultValue,
+                                                                        
celix_array_list_t** list);
+
+/**
+ * @brief Get the property value as an array of strings without copying.
+ *
+ * This function provides a non-owning, read-only access to a property value 
interpreted as an array of strings.
+ * It returns a const pointer to the array. If the property is not set or its 
value is not an array of strings,
+ * the default value is returned.
+ *
+ * @param[in] properties The property set to search.
+ * @param[in] key The key of the property to get.
+ * @param[in] defaultValue The value to return if the property is not set or 
its value is not an array of strings.
+ * @return A const pointer to the property value interpreted as an array of 
strings, or the default value if the
+ * property is not set or its value is not an array of strings. The returned 
pointer should not be modified or freed.
+ */
+CELIX_UTILS_EXPORT const celix_array_list_t* 
celix_properties_getStringArrayList(
+    const celix_properties_t* properties, const char* key, const 
celix_array_list_t* defaultValue);
+
+/**
+ * @brief Get a property value as an array of celix_version_t entries, making 
a copy of the array.
+ *
+ *
+ * This function retrieves the value of a property, interpreting it as an 
array of celix_version_t* entries. If the
+ * underlying type of the property value is a celix_version_t* array, a copy 
of the array is returned. If the underlying
+ * type is a string, the string is converted to an array of celix_version_t* 
if possible. If the property is not set,
+ * its value is not an array of celix_version_t* entries or its value cannot 
be converted to a celix_version_t* array,
+ * the default value is returned as a copy.
+ *
+ * The returned array list is configured with a remove callback so that the 
destruction of the array list will also
+ * free the celix_version_t entries in the array list.
+ *
+ * @param[in] properties The property set to search.
+ * @param[in] key The key of the property to get.
+ * @param[in] defaultValue The default value to return if the property is not 
set or its value is not an array of
+ * celix_version_t entries.
+ * @param[out] list A copy of the found list, a new array list with 
celix_version_t values or a copy of the default
+ * value if the property is not set, its value is not an array of 
celix_version_t entries or its value cannot be
+ * converted to an array of celix_version_t entries.
+ * @return CELIX_SUCCESS if the operation was successful, CELIX_ENOMEM if 
there was not enough memory to create the
+ *        array list. Note if the key is not found, the return status is still 
CELIX_SUCCESS.
+ */
+CELIX_UTILS_EXPORT celix_status_t celix_properties_getAsVersionArrayList(const 
celix_properties_t* properties,
+                                                                         const 
char* key,
+                                                                         const 
celix_array_list_t* defaultValue,
+                                                                         
celix_array_list_t** list);
+
+/**
+ * @brief Get the property value as an array of celix_version_t entries 
without copying.
+ *
+ * This function provides a non-owning, read-only access to a property value 
interpreted as an array of celix_version_t
+ * entries. It returns a const pointer to the array. If the property is not 
set or its value is not an array of
+ * celix_version_t entries, the default value is returned.
+ *
+ * @param[in] properties The property set to search.
+ * @param[in] key The key of the property to get.
+ * @param[in] defaultValue The value to return if the property is not set or 
its value is not an array of
+ * celix_version_t entries.
+ * @return A const pointer to the property value interpreted as an array of 
celix_version_t entries, or the default
+ * value if the property is not set or its value is not an array of 
celix_version_t entries. The returned pointer should
+ * not be modified or freed.
+ */
+CELIX_UTILS_EXPORT const celix_array_list_t* 
celix_properties_getVersionArrayList(

Review Comment:
   A single `celix_properties_getArrayList` would be better?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscr...@celix.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to