This is an automated email from the ASF dual-hosted git repository.

pnoltes pushed a commit to branch 
feature/685-update-container-config-properties-usage
in repository https://gitbox.apache.org/repos/asf/celix.git

commit b8c6ab5ca9b16e029121c871a6f088342cb65835
Author: Pepijn Noltes <[email protected]>
AuthorDate: Thu May 30 19:23:52 2024 +0200

    gh-685: Change space sep in auto start bundle to comma seperator
---
 CHANGES.md                                         |   2 +
 .../gtest/client.properties.in                     |   2 +-
 .../gtest/config.properties.in                     |   2 +-
 .../gtest/server.properties.in                     |   2 +-
 .../topology_manager/tms_tst/CMakeLists.txt        |   4 +-
 cmake/cmake_celix/ContainerPackaging.cmake         |  32 +++---
 .../gtest/install_and_start_bundles.properties.in  |   6 +-
 libs/framework/include/celix/Constants.h           |   4 +-
 libs/framework/include/celix_constants.h           |  16 +--
 libs/framework/src/framework.c                     | 120 ++++++++++++---------
 10 files changed, 107 insertions(+), 83 deletions(-)

diff --git a/CHANGES.md b/CHANGES.md
index 593decd40..9c06b449e 100644
--- a/CHANGES.md
+++ b/CHANGES.md
@@ -73,6 +73,8 @@ limitations under the License.
   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.
 
 ## New Features
 
diff --git 
a/bundles/remote_services/remote_service_admin_dfi/gtest/client.properties.in 
b/bundles/remote_services/remote_service_admin_dfi/gtest/client.properties.in
index 00ef4e8cd..76433350f 100644
--- 
a/bundles/remote_services/remote_service_admin_dfi/gtest/client.properties.in
+++ 
b/bundles/remote_services/remote_service_admin_dfi/gtest/client.properties.in
@@ -1,5 +1,5 @@
 {
-    "CELIX_AUTO_START_1":"@rsa_bundle_file@ @discovery_bundle_file@ 
@topology_manager_bundle_file@ @tst_bundle_file@",
+    
"CELIX_AUTO_START_1":"@rsa_bundle_file@,@discovery_bundle_file@,@topology_manager_bundle_file@,@tst_bundle_file@",
     "LOGHELPER_ENABLE_STDOUT_FALLBACK":true,
     "CELIX_FRAMEWORK_CLEAN_CACHE_DIR_ON_CREATE":true,
     "CELIX_FRAMEWORK_CACHE_DIR":".cacheClient",
diff --git 
a/bundles/remote_services/remote_service_admin_dfi/gtest/config.properties.in 
b/bundles/remote_services/remote_service_admin_dfi/gtest/config.properties.in
index cac7390d2..864e1cbdd 100644
--- 
a/bundles/remote_services/remote_service_admin_dfi/gtest/config.properties.in
+++ 
b/bundles/remote_services/remote_service_admin_dfi/gtest/config.properties.in
@@ -1,5 +1,5 @@
 {
-    "CELIX_AUTO_START_1":"@rsa_bundle_file@ @calc_bundle_file@",
+    "CELIX_AUTO_START_1":"@rsa_bundle_file@,@calc_bundle_file@",
     "LOGHELPER_ENABLE_STDOUT_FALLBACK":true,
     "CELIX_FRAMEWORK_CLEAN_CACHE_DIR_ON_CREATE":true
 }
diff --git 
a/bundles/remote_services/remote_service_admin_dfi/gtest/server.properties.in 
b/bundles/remote_services/remote_service_admin_dfi/gtest/server.properties.in
index 8d74011aa..b15507049 100644
--- 
a/bundles/remote_services/remote_service_admin_dfi/gtest/server.properties.in
+++ 
b/bundles/remote_services/remote_service_admin_dfi/gtest/server.properties.in
@@ -1,5 +1,5 @@
 {
-    "CELIX_AUTO_START_1":"@rsa_bundle_file@ @calc_bundle_file@ 
@remote_example_bundle_file@ @discovery_bundle_file@ 
@topology_manager_bundle_file@",
+    
"CELIX_AUTO_START_1":"@rsa_bundle_file@,@calc_bundle_file@,@remote_example_bundle_file@,@discovery_bundle_file@,@topology_manager_bundle_file@",
     "LOGHELPER_ENABLE_STDOUT_FALLBACK":true,
     "CELIX_FRAMEWORK_CLEAN_CACHE_DIR_ON_CREATE":true,
     "CELIX_FRAMEWORK_CACHE_DIR":".cacheServer",
diff --git a/bundles/remote_services/topology_manager/tms_tst/CMakeLists.txt 
b/bundles/remote_services/topology_manager/tms_tst/CMakeLists.txt
index 332677cc1..c6884b0a5 100644
--- a/bundles/remote_services/topology_manager/tms_tst/CMakeLists.txt
+++ b/bundles/remote_services/topology_manager/tms_tst/CMakeLists.txt
@@ -55,7 +55,7 @@ add_celix_bundle_dependencies(test_tm_scoped Celix::rsa_dfi 
Celix::rsa_topology_
 file(GENERATE 
     OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/config.properties"
     CONTENT "{
-    \"CELIX_AUTO_START_1\":\"$<TARGET_PROPERTY:Celix::rsa_dfi,BUNDLE_FILE> 
$<TARGET_PROPERTY:calculator,BUNDLE_FILE> 
$<TARGET_PROPERTY:Celix::rsa_topology_manager,BUNDLE_FILE> 
$<TARGET_PROPERTY:topology_manager_disc_mock_bundle,BUNDLE_FILE>\",
+    
\"CELIX_AUTO_START_1\":\"$<TARGET_PROPERTY:Celix::rsa_dfi,BUNDLE_FILE>,$<TARGET_PROPERTY:calculator,BUNDLE_FILE>,$<TARGET_PROPERTY:Celix::rsa_topology_manager,BUNDLE_FILE>,$<TARGET_PROPERTY:topology_manager_disc_mock_bundle,BUNDLE_FILE>\",
     \"LOGHELPER_ENABLE_STDOUT_FALLBACK\":true,
     \"CELIX_FRAMEWORK_CLEAN_CACHE_DIR_ON_CREATE\":true
 }")
@@ -63,7 +63,7 @@ file(GENERATE
 file(GENERATE 
     OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/config_import.properties"
     CONTENT "{
-    \"CELIX_AUTO_START_1\":\"$<TARGET_PROPERTY:Celix::rsa_dfi,BUNDLE_FILE> 
$<TARGET_PROPERTY:calculator,BUNDLE_FILE> 
$<TARGET_PROPERTY:Celix::rsa_topology_manager,BUNDLE_FILE> 
$<TARGET_PROPERTY:topology_manager_test_bundle,BUNDLE_FILE>\",
+    
\"CELIX_AUTO_START_1\":\"$<TARGET_PROPERTY:Celix::rsa_dfi,BUNDLE_FILE>,$<TARGET_PROPERTY:calculator,BUNDLE_FILE>,$<TARGET_PROPERTY:Celix::rsa_topology_manager,BUNDLE_FILE>,$<TARGET_PROPERTY:topology_manager_test_bundle,BUNDLE_FILE>\",
     \"LOGHELPER_ENABLE_STDOUT_FALLBACK\":true,
     \"CELIX_FRAMEWORK_CLEAN_CACHE_DIR_ON_CREATE\":true
 }")
diff --git a/cmake/cmake_celix/ContainerPackaging.cmake 
b/cmake/cmake_celix/ContainerPackaging.cmake
index 31a3e7f26..e37e8a8d9 100644
--- a/cmake/cmake_celix/ContainerPackaging.cmake
+++ b/cmake/cmake_celix/ContainerPackaging.cmake
@@ -224,14 +224,14 @@ function(add_celix_container)
 int main(int argc, char *argv[]) {
     const char * config = CELIX_MULTI_LINE_STRING(
 {
-    
$<$<BOOL:$<TARGET_PROPERTY:${CONTAINER_TARGET},CONTAINER_BUNDLES_LEVEL_0>>:\"CELIX_AUTO_START_0\":\"$<JOIN:$<TARGET_PROPERTY:${CONTAINER_TARGET},CONTAINER_BUNDLES_LEVEL_0>,
 >\"$<COMMA>>
-    
$<$<BOOL:$<TARGET_PROPERTY:${CONTAINER_TARGET},CONTAINER_BUNDLES_LEVEL_1>>:\"CELIX_AUTO_START_1\":\"$<JOIN:$<TARGET_PROPERTY:${CONTAINER_TARGET},CONTAINER_BUNDLES_LEVEL_1>,
 >\"$<COMMA>>
-    
$<$<BOOL:$<TARGET_PROPERTY:${CONTAINER_TARGET},CONTAINER_BUNDLES_LEVEL_2>>:\"CELIX_AUTO_START_2\":\"$<JOIN:$<TARGET_PROPERTY:${CONTAINER_TARGET},CONTAINER_BUNDLES_LEVEL_2>,
 >\"$<COMMA>>
-    
$<$<BOOL:$<TARGET_PROPERTY:${CONTAINER_TARGET},CONTAINER_BUNDLES_LEVEL_3>>:\"CELIX_AUTO_START_3\":\"$<JOIN:$<TARGET_PROPERTY:${CONTAINER_TARGET},CONTAINER_BUNDLES_LEVEL_3>,
 >\"$<COMMA>>
-    
$<$<BOOL:$<TARGET_PROPERTY:${CONTAINER_TARGET},CONTAINER_BUNDLES_LEVEL_4>>:\"CELIX_AUTO_START_4\":\"$<JOIN:$<TARGET_PROPERTY:${CONTAINER_TARGET},CONTAINER_BUNDLES_LEVEL_4>,
 >\"$<COMMA>>
-    
$<$<BOOL:$<TARGET_PROPERTY:${CONTAINER_TARGET},CONTAINER_BUNDLES_LEVEL_5>>:\"CELIX_AUTO_START_5\":\"$<JOIN:$<TARGET_PROPERTY:${CONTAINER_TARGET},CONTAINER_BUNDLES_LEVEL_5>,
 >\"$<COMMA>>
-    
$<$<BOOL:$<TARGET_PROPERTY:${CONTAINER_TARGET},CONTAINER_BUNDLES_LEVEL_6>>:\"CELIX_AUTO_START_6\":\"$<JOIN:$<TARGET_PROPERTY:${CONTAINER_TARGET},CONTAINER_BUNDLES_LEVEL_6>,
 >\"$<COMMA>>
-    
$<$<BOOL:$<TARGET_PROPERTY:${CONTAINER_TARGET},CONTAINER_BUNDLES_INSTALL>>:\"CELIX_AUTO_INSTALL\":\"$<JOIN:$<TARGET_PROPERTY:${CONTAINER_TARGET},CONTAINER_BUNDLES_INSTALL>,
 >\"$<COMMA>>
+    
$<$<BOOL:$<TARGET_PROPERTY:${CONTAINER_TARGET},CONTAINER_BUNDLES_LEVEL_0>>:\"CELIX_AUTO_START_0\":\"$<JOIN:$<TARGET_PROPERTY:${CONTAINER_TARGET},CONTAINER_BUNDLES_LEVEL_0>,$<COMMA>>\"$<COMMA>>
+    
$<$<BOOL:$<TARGET_PROPERTY:${CONTAINER_TARGET},CONTAINER_BUNDLES_LEVEL_1>>:\"CELIX_AUTO_START_1\":\"$<JOIN:$<TARGET_PROPERTY:${CONTAINER_TARGET},CONTAINER_BUNDLES_LEVEL_1>,$<COMMA>>\"$<COMMA>>
+    
$<$<BOOL:$<TARGET_PROPERTY:${CONTAINER_TARGET},CONTAINER_BUNDLES_LEVEL_2>>:\"CELIX_AUTO_START_2\":\"$<JOIN:$<TARGET_PROPERTY:${CONTAINER_TARGET},CONTAINER_BUNDLES_LEVEL_2>,$<COMMA>>\"$<COMMA>>
+    
$<$<BOOL:$<TARGET_PROPERTY:${CONTAINER_TARGET},CONTAINER_BUNDLES_LEVEL_3>>:\"CELIX_AUTO_START_3\":\"$<JOIN:$<TARGET_PROPERTY:${CONTAINER_TARGET},CONTAINER_BUNDLES_LEVEL_3>,$<COMMA>>\"$<COMMA>>
+    
$<$<BOOL:$<TARGET_PROPERTY:${CONTAINER_TARGET},CONTAINER_BUNDLES_LEVEL_4>>:\"CELIX_AUTO_START_4\":\"$<JOIN:$<TARGET_PROPERTY:${CONTAINER_TARGET},CONTAINER_BUNDLES_LEVEL_4>,$<COMMA>>\"$<COMMA>>
+    
$<$<BOOL:$<TARGET_PROPERTY:${CONTAINER_TARGET},CONTAINER_BUNDLES_LEVEL_5>>:\"CELIX_AUTO_START_5\":\"$<JOIN:$<TARGET_PROPERTY:${CONTAINER_TARGET},CONTAINER_BUNDLES_LEVEL_5>,$<COMMA>>\"$<COMMA>>
+    
$<$<BOOL:$<TARGET_PROPERTY:${CONTAINER_TARGET},CONTAINER_BUNDLES_LEVEL_6>>:\"CELIX_AUTO_START_6\":\"$<JOIN:$<TARGET_PROPERTY:${CONTAINER_TARGET},CONTAINER_BUNDLES_LEVEL_6>,$<COMMA>>\"$<COMMA>>
+    
$<$<BOOL:$<TARGET_PROPERTY:${CONTAINER_TARGET},CONTAINER_BUNDLES_INSTALL>>:\"CELIX_AUTO_INSTALL\":\"$<JOIN:$<TARGET_PROPERTY:${CONTAINER_TARGET},CONTAINER_BUNDLES_INSTALL>,$<COMMA>>\"$<COMMA>>
     
$<JOIN:$<TARGET_PROPERTY:${CONTAINER_TARGET},CONTAINER_EMBEDDED_PROPERTIES>,$<COMMA>
     
>$<$<BOOL:$<TARGET_PROPERTY:${CONTAINER_TARGET},CONTAINER_EMBEDDED_PROPERTIES>>:$<COMMA>>
     \"CELIX_BUNDLES_PATH\":\"bundles\"$<COMMA>
@@ -278,14 +278,14 @@ int main(int argc, char *argv[]) {
         file(GENERATE
                 OUTPUT "${STAGE1_PROPERTIES}"
                 CONTENT "{
-    
$<$<BOOL:$<TARGET_PROPERTY:${CONTAINER_TARGET},CONTAINER_BUNDLES_LEVEL_0>>:\"CELIX_AUTO_START_0\":\"$<JOIN:$<TARGET_PROPERTY:${CONTAINER_TARGET},CONTAINER_BUNDLES_LEVEL_0>,
 >\"$<COMMA>>
-    
$<$<BOOL:$<TARGET_PROPERTY:${CONTAINER_TARGET},CONTAINER_BUNDLES_LEVEL_1>>:\"CELIX_AUTO_START_1\":\"$<JOIN:$<TARGET_PROPERTY:${CONTAINER_TARGET},CONTAINER_BUNDLES_LEVEL_1>,
 >\"$<COMMA>>
-    
$<$<BOOL:$<TARGET_PROPERTY:${CONTAINER_TARGET},CONTAINER_BUNDLES_LEVEL_2>>:\"CELIX_AUTO_START_2\":\"$<JOIN:$<TARGET_PROPERTY:${CONTAINER_TARGET},CONTAINER_BUNDLES_LEVEL_2>,
 >\"$<COMMA>>
-    
$<$<BOOL:$<TARGET_PROPERTY:${CONTAINER_TARGET},CONTAINER_BUNDLES_LEVEL_3>>:\"CELIX_AUTO_START_3\":\"$<JOIN:$<TARGET_PROPERTY:${CONTAINER_TARGET},CONTAINER_BUNDLES_LEVEL_3>,
 >\"$<COMMA>>
-    
$<$<BOOL:$<TARGET_PROPERTY:${CONTAINER_TARGET},CONTAINER_BUNDLES_LEVEL_4>>:\"CELIX_AUTO_START_4\":\"$<JOIN:$<TARGET_PROPERTY:${CONTAINER_TARGET},CONTAINER_BUNDLES_LEVEL_4>,
 >\"$<COMMA>>
-    
$<$<BOOL:$<TARGET_PROPERTY:${CONTAINER_TARGET},CONTAINER_BUNDLES_LEVEL_5>>:\"CELIX_AUTO_START_5\":\"$<JOIN:$<TARGET_PROPERTY:${CONTAINER_TARGET},CONTAINER_BUNDLES_LEVEL_5>,
 >\"$<COMMA>>
-    
$<$<BOOL:$<TARGET_PROPERTY:${CONTAINER_TARGET},CONTAINER_BUNDLES_LEVEL_6>>:\"CELIX_AUTO_START_6\":\"$<JOIN:$<TARGET_PROPERTY:${CONTAINER_TARGET},CONTAINER_BUNDLES_LEVEL_6>,
 >\"$<COMMA>>
-    
$<$<BOOL:$<TARGET_PROPERTY:${CONTAINER_TARGET},CONTAINER_BUNDLES_INSTALL>>:\"CELIX_AUTO_INSTALL\":\"$<JOIN:$<TARGET_PROPERTY:${CONTAINER_TARGET},CONTAINER_BUNDLES_INSTALL>,
 >\"$<COMMA>>
+    
$<$<BOOL:$<TARGET_PROPERTY:${CONTAINER_TARGET},CONTAINER_BUNDLES_LEVEL_0>>:\"CELIX_AUTO_START_0\":\"$<JOIN:$<TARGET_PROPERTY:${CONTAINER_TARGET},CONTAINER_BUNDLES_LEVEL_0>,$<COMMA>>\"$<COMMA>>
+    
$<$<BOOL:$<TARGET_PROPERTY:${CONTAINER_TARGET},CONTAINER_BUNDLES_LEVEL_1>>:\"CELIX_AUTO_START_1\":\"$<JOIN:$<TARGET_PROPERTY:${CONTAINER_TARGET},CONTAINER_BUNDLES_LEVEL_1>,$<COMMA>>\"$<COMMA>>
+    
$<$<BOOL:$<TARGET_PROPERTY:${CONTAINER_TARGET},CONTAINER_BUNDLES_LEVEL_2>>:\"CELIX_AUTO_START_2\":\"$<JOIN:$<TARGET_PROPERTY:${CONTAINER_TARGET},CONTAINER_BUNDLES_LEVEL_2>,$<COMMA>>\"$<COMMA>>
+    
$<$<BOOL:$<TARGET_PROPERTY:${CONTAINER_TARGET},CONTAINER_BUNDLES_LEVEL_3>>:\"CELIX_AUTO_START_3\":\"$<JOIN:$<TARGET_PROPERTY:${CONTAINER_TARGET},CONTAINER_BUNDLES_LEVEL_3>,$<COMMA>>\"$<COMMA>>
+    
$<$<BOOL:$<TARGET_PROPERTY:${CONTAINER_TARGET},CONTAINER_BUNDLES_LEVEL_4>>:\"CELIX_AUTO_START_4\":\"$<JOIN:$<TARGET_PROPERTY:${CONTAINER_TARGET},CONTAINER_BUNDLES_LEVEL_4>,$<COMMA>>\"$<COMMA>>
+    
$<$<BOOL:$<TARGET_PROPERTY:${CONTAINER_TARGET},CONTAINER_BUNDLES_LEVEL_5>>:\"CELIX_AUTO_START_5\":\"$<JOIN:$<TARGET_PROPERTY:${CONTAINER_TARGET},CONTAINER_BUNDLES_LEVEL_5>,$<COMMA>>\"$<COMMA>>
+    
$<$<BOOL:$<TARGET_PROPERTY:${CONTAINER_TARGET},CONTAINER_BUNDLES_LEVEL_6>>:\"CELIX_AUTO_START_6\":\"$<JOIN:$<TARGET_PROPERTY:${CONTAINER_TARGET},CONTAINER_BUNDLES_LEVEL_6>,$<COMMA>>\"$<COMMA>>
+    
$<$<BOOL:$<TARGET_PROPERTY:${CONTAINER_TARGET},CONTAINER_BUNDLES_INSTALL>>:\"CELIX_AUTO_INSTALL\":\"$<JOIN:$<TARGET_PROPERTY:${CONTAINER_TARGET},CONTAINER_BUNDLES_INSTALL>,$<COMMA>>\"$<COMMA>>
     
$<JOIN:$<TARGET_PROPERTY:${CONTAINER_TARGET},CONTAINER_EMBEDDED_PROPERTIES>,$<COMMA>
     
>$<$<BOOL:$<TARGET_PROPERTY:${CONTAINER_TARGET},CONTAINER_EMBEDDED_PROPERTIES>>:$<COMMA>>
     \"CELIX_BUNDLES_PATH\":\"bundles\"$<COMMA>
diff --git a/libs/framework/gtest/install_and_start_bundles.properties.in 
b/libs/framework/gtest/install_and_start_bundles.properties.in
index f7fdc6dca..b730adb94 100644
--- a/libs/framework/gtest/install_and_start_bundles.properties.in
+++ b/libs/framework/gtest/install_and_start_bundles.properties.in
@@ -1,8 +1,8 @@
 {
     "CELIX_FRAMEWORK_CLEAN_CACHE_DIR_ON_CREATE":true,
-    "CELIX_AUTO_START_1":"@SIMPLE_TEST_BUNDLE1@ @SIMPLE_TEST_BUNDLE2@ 
Invalid1.zip",
-    "CELIX_AUTO_START_3":"@SIMPLE_TEST_BUNDLE2@ @SIMPLE_TEST_BUNDLE3@ 
Invalid2.zip",
-    "CELIX_AUTO_INSTALL":"@SIMPLE_TEST_BUNDLE3@ @SIMPLE_TEST_BUNDLE4@ 
@SIMPLE_TEST_BUNDLE5@ Invalid3.zip"
+    
"CELIX_AUTO_START_1":"@SIMPLE_TEST_BUNDLE1@,@SIMPLE_TEST_BUNDLE2@,Invalid1.zip",
+    
"CELIX_AUTO_START_3":"@SIMPLE_TEST_BUNDLE2@,@SIMPLE_TEST_BUNDLE3@,Invalid2.zip",
+    
"CELIX_AUTO_INSTALL":"@SIMPLE_TEST_BUNDLE3@,@SIMPLE_TEST_BUNDLE4@,@SIMPLE_TEST_BUNDLE5@,Invalid3.zip"
 }
 
 
diff --git a/libs/framework/include/celix/Constants.h 
b/libs/framework/include/celix/Constants.h
index 9d5cccbac..b00fe8059 100644
--- a/libs/framework/include/celix/Constants.h
+++ b/libs/framework/include/celix/Constants.h
@@ -139,7 +139,7 @@ namespace celix {
     constexpr const char * const FRAMEWORK_STATIC_EVENT_QUEUE_SIZE = 
CELIX_FRAMEWORK_STATIC_EVENT_QUEUE_SIZE;
 
     /**
-     * @brief Celix framework environment property (named 
"CELIX_AUTO_START_0") which specified a (ordered) space
+     * @brief Celix framework environment property (named 
"CELIX_AUTO_START_0") which specified a (ordered) comma
      * separated set of bundles to load and auto start when the Celix 
framework is started.
      *
      * The Celix framework will first start bundles in for AUTO_START_0 and 
lastly start bundles in AUTO_START_6.
@@ -181,7 +181,7 @@ namespace celix {
     constexpr const char * const AUTO_START_6 = CELIX_AUTO_START_6;
 
     /**
-     * @brief Celix framework environment property (named 
"CELIX_AUTO_INSTALL") which specified a (ordered) space
+     * @brief Celix framework environment property (named 
"CELIX_AUTO_INSTALL") which specified a (ordered) comma
      * separated set of bundles to install when the Celix framework is started.
      *
      * The Celix framework will first install and start bundles defined in the 
properties CELIX_AUTO_START_0 till
diff --git a/libs/framework/include/celix_constants.h 
b/libs/framework/include/celix_constants.h
index ae98e626e..ffc0abcfb 100644
--- a/libs/framework/include/celix_constants.h
+++ b/libs/framework/include/celix_constants.h
@@ -221,16 +221,16 @@ extern "C" {
 #define CELIX_FRAMEWORK_STATIC_EVENT_QUEUE_SIZE 
"CELIX_FRAMEWORK_STATIC_EVENT_QUEUE_SIZE"
 
 /**
- * @brief Celix framework environment property (named "CELIX_AUTO_START_0") 
which specified a (ordered) space
+ * @brief Celix framework environment property (named "CELIX_AUTO_START_0") 
which specified a (ordered) comma
  * separated set of bundles to load and auto start when the Celix framework is 
started.
  *
- * Note: Because the list is space separated path with spaces are not allowed.
+ * Note: Because the list is comma separated, paths with commas are not 
supported.
  *
- * The Celix framework will first start bundles in for CELIX_AUTO_START_0 and 
lastly start bundles in CELIX_AUTO_START_6.
- * Bundles which are also started in the order they appear in the AUTO_START 
set; first bundles mentioned is started
+ * The Celix framework will first start bundles in for CELIX_AUTO_START_0 and 
lastly start bundles in
+ * CELIX_AUTO_START_6. Bundles which are also started in the order they appear 
in the AUTO_START set; first bundles
+ * mentioned is started first. When the Celix framework stops the bundles are 
stopped in the reverse order. Bundles in
+ * CELIX_AUTO_START_6 are stopped first and of those bundles, the bundle 
mentioned last in a AUTO_START set is stopped
  * first.
- * When the Celix framework stops the bundles are stopped in the reverse 
order. Bundles in CELIX_AUTO_START_6 are stopped
- * first and of those bundles, the bundle mentioned last in a AUTO_START set 
is stopped first.
  */
 #define CELIX_AUTO_START_0 "CELIX_AUTO_START_0"
 
@@ -265,11 +265,11 @@ extern "C" {
 #define CELIX_AUTO_START_6 "CELIX_AUTO_START_6"
 
 /**
- * @brief Celix framework environment property (named "CELIX_AUTO_INSTALL") 
which specified a (ordered) space
+ * @brief Celix framework environment property (named "CELIX_AUTO_INSTALL") 
which specified a (ordered) comma
  * separated set of bundles to install when the Celix framework is started.
  *
  * The Celix framework will first install and start bundles defined in the 
properties CELIX_AUTO_START_0 till
- * CELIX_AUTO_START_6 and then install (ano not start!) the bundles listed in 
CELIX_AUTO_INSTALL.
+ * CELIX_AUTO_START_6 and then install (and not start!) the bundles listed in 
CELIX_AUTO_INSTALL.
  *
  * When the Celix framework stops the bundles are stopped in the reverse 
order. Started bundles in CELIX_AUTO_INSTALL
  * are stopped first and of those bundles, the bundle mentioned last in a 
CELIX_AUTO_INSTALL set is stopped first.
diff --git a/libs/framework/src/framework.c b/libs/framework/src/framework.c
index 99d4946f1..5d2044a8b 100644
--- a/libs/framework/src/framework.c
+++ b/libs/framework/src/framework.c
@@ -159,10 +159,10 @@ static void *fw_eventDispatcher(void *fw);
 celix_status_t fw_invokeBundleListener(framework_pt framework, 
bundle_listener_pt listener, bundle_event_pt event, bundle_pt bundle);
 celix_status_t fw_invokeFrameworkListener(framework_pt framework, 
framework_listener_pt listener, framework_event_pt event, bundle_pt bundle);
 
-static celix_status_t framework_autoStartConfiguredBundles(celix_framework_t 
*fw);
-static celix_status_t framework_autoInstallConfiguredBundles(celix_framework_t 
*fw);
-static celix_status_t 
framework_autoInstallConfiguredBundlesForList(celix_framework_t *fw, const char 
*autoStart, celix_array_list_t *installedBundles);
-static celix_status_t 
framework_autoStartConfiguredBundlesForList(celix_framework_t* fw, const 
celix_array_list_t *installedBundles);
+static celix_status_t framework_autoStartConfiguredBundles(celix_framework_t 
*fw, bool* startedAllBundles);
+static celix_status_t framework_autoInstallConfiguredBundles(celix_framework_t 
*fw, bool* installedAllBundles);
+static bool framework_autoInstallConfiguredBundlesForList(celix_framework_t 
*fw, const char *autoStart, celix_array_list_t *installedBundles);
+static bool framework_autoStartConfiguredBundlesForList(celix_framework_t* fw, 
const celix_array_list_t *installedBundles);
 static void celix_framework_addToEventQueue(celix_framework_t *fw, const 
celix_framework_event_t* event);
 static void celix_framework_stopAndJoinEventQueue(celix_framework_t* fw);
 
@@ -458,71 +458,83 @@ celix_status_t framework_start(celix_framework_t* 
framework) {
     fw_fireBundleEvent(framework, OSGI_FRAMEWORK_BUNDLE_EVENT_STARTED, entry);
     celix_framework_bundleEntry_decreaseUseCount(entry);
 
-    celix_status_t startStatus = 
framework_autoStartConfiguredBundles(framework);
-    celix_status_t installStatus = 
framework_autoInstallConfiguredBundles(framework);
+    bool allStarted = false;
+    status = framework_autoStartConfiguredBundles(framework, &allStarted);
+    bool allInstalled = false;
+    status = CELIX_DO_IF(status, 
framework_autoInstallConfiguredBundles(framework, &allInstalled));
 
-    if (startStatus == CELIX_SUCCESS && installStatus == CELIX_SUCCESS) {
-        //fire started event if all bundles are started/installed and the 
event queue is empty
+    if (status != CELIX_SUCCESS) {
+        fw_log(framework->logger, CELIX_LOG_LEVEL_ERROR, "Celix framework 
failed to start");
+        return status;
+    }
+
+    if (allStarted && allInstalled) {
+        // fire started event if all bundles are started/installed and the 
event queue is empty
         celix_framework_waitForEmptyEventQueue(framework);
         fw_fireFrameworkEvent(framework, OSGI_FRAMEWORK_EVENT_STARTED, 
CELIX_SUCCESS);
     } else {
-        //note not returning an error, because the framework is started, but 
not all bundles are started/installed
-        fw_logCode(framework->logger, CELIX_LOG_LEVEL_ERROR, status, "Could 
not auto start or install all configured bundles");
+        // note not returning an error, because the framework is started, but 
not all bundles are started/installed
+        fw_logCode(
+            framework->logger, CELIX_LOG_LEVEL_ERROR, status, "Could not auto 
start or install all configured bundles");
         fw_fireFrameworkEvent(framework, OSGI_FRAMEWORK_EVENT_ERROR, 
CELIX_BUNDLE_EXCEPTION);
     }
 
-    if (status == CELIX_SUCCESS) {
-        fw_log(framework->logger, CELIX_LOG_LEVEL_INFO, "Celix framework 
started");
-        fw_log(framework->logger,
-               CELIX_LOG_LEVEL_TRACE,
-               "Celix framework started with uuid %s",
-               celix_framework_getUUID(framework));
-    } else {
-        fw_log(framework->logger, CELIX_LOG_LEVEL_ERROR, "Celix framework 
failed to start");
-    }
+    fw_log(framework->logger, CELIX_LOG_LEVEL_INFO, "Celix framework started");
+    fw_log(framework->logger,
+           CELIX_LOG_LEVEL_TRACE,
+           "Celix framework started with uuid %s",
+           celix_framework_getUUID(framework));
 
-    return status;
+    return CELIX_SUCCESS;
 }
 
-static celix_status_t framework_autoStartConfiguredBundles(celix_framework_t* 
fw) {
+static celix_status_t framework_autoStartConfiguredBundles(celix_framework_t* 
fw, bool *startedAllBundles) {
     celix_status_t status = CELIX_SUCCESS;
     const char* const celixKeys[] = {CELIX_AUTO_START_0, CELIX_AUTO_START_1, 
CELIX_AUTO_START_2, CELIX_AUTO_START_3, CELIX_AUTO_START_4, CELIX_AUTO_START_5, 
CELIX_AUTO_START_6, NULL};
-    celix_array_list_t *installedBundles = celix_arrayList_create();
+    celix_autoptr(celix_array_list_t) installedBundles = 
celix_arrayList_create();
+    if (!installedBundles) {
+        celix_framework_logTssErrors(fw->logger, CELIX_LOG_LEVEL_ERROR);
+        return ENOMEM;
+    }
+
+    bool allStarted = true;
     for (int i = 0; celixKeys[i] != NULL; ++i) {
         const char *autoStart = celix_framework_getConfigProperty(fw, 
celixKeys[i], NULL, NULL);
         if (autoStart != NULL) {
-            if (framework_autoInstallConfiguredBundlesForList(fw, autoStart, 
installedBundles) != CELIX_SUCCESS) {
-                status = CELIX_BUNDLE_EXCEPTION;
+            if (!framework_autoInstallConfiguredBundlesForList(fw, autoStart, 
installedBundles)) {
+                allStarted = false;
             }
         }
     }
-    celix_status_t startStatus = 
framework_autoStartConfiguredBundlesForList(fw, installedBundles);
-    if (status == CELIX_SUCCESS) {
-        status = startStatus;
+    if (!framework_autoStartConfiguredBundlesForList(fw, installedBundles)) {
+        allStarted = false;
     }
-    celix_arrayList_destroy(installedBundles);
+    *startedAllBundles = allStarted;
     return status;
 }
 
-static celix_status_t 
framework_autoInstallConfiguredBundles(celix_framework_t* fw) {
+static celix_status_t 
framework_autoInstallConfiguredBundles(celix_framework_t* fw, bool* 
installedAllBundles) {
+    *installedAllBundles = true;
     const char* autoInstall = celix_framework_getConfigProperty(fw, 
CELIX_AUTO_INSTALL, NULL, NULL);
     if (autoInstall != NULL) {
-        return framework_autoInstallConfiguredBundlesForList(fw, autoInstall, 
NULL);
+        *installedAllBundles = 
framework_autoInstallConfiguredBundlesForList(fw, autoInstall, NULL);
     }
     return CELIX_SUCCESS;
 }
 
-
-static celix_status_t 
framework_autoInstallConfiguredBundlesForList(celix_framework_t* fw, const char 
*autoStartIn, celix_array_list_t *installedBundles) {
-    celix_status_t status = CELIX_SUCCESS;
-    char delims[] = " ";
-    char *save_ptr = NULL;
+static bool framework_autoInstallConfiguredBundlesForList(celix_framework_t* 
fw,
+                                                          const char* 
autoStartIn,
+                                                          celix_array_list_t* 
installedBundles) {
+    bool allInstalled = true;
+    const char* delim = ",";
+    char* save_ptr = NULL;
     char autoStartBuffer[CELIX_DEFAULT_STRING_CREATE_BUFFER_SIZE];
     char* autoStart = celix_utils_writeOrCreateString(autoStartBuffer, 
sizeof(autoStartBuffer), "%s", autoStartIn);
+    celix_auto(celix_utils_string_guard_t) grd = 
celix_utils_stringGuard_init(autoStartBuffer, autoStart);
     if (autoStart != NULL) {
-        char *location = strtok_r(autoStart, delims, &save_ptr);
+        char* location = strtok_r(autoStart, delim, &save_ptr);
         while (location != NULL) {
-            //first install
+            // first install
             long id = -1L;
             if (celix_framework_installBundleInternal(fw, location, &id) == 
CELIX_SUCCESS) {
                 if (installedBundles) {
@@ -530,19 +542,21 @@ static celix_status_t 
framework_autoInstallConfiguredBundlesForList(celix_framew
                 }
             } else {
                 fw_log(fw->logger, CELIX_LOG_LEVEL_ERROR, "Could not install 
bundle from location '%s'.", location);
-                status = CELIX_BUNDLE_EXCEPTION;
+                allInstalled = false;
             }
-            location = strtok_r(NULL, delims, &save_ptr);
+            location = strtok_r(NULL, delim, &save_ptr);
         }
     } else {
-        fw_log(fw->logger, CELIX_LOG_LEVEL_ERROR, "Could not auto install 
bundles, out of memory.");
+        fw_log(fw->logger, CELIX_LOG_LEVEL_ERROR, "Could create auto install 
bundle list, out of memory.");
+        allInstalled = false;
+        // note out of memory, but framework can continue
     }
-    celix_utils_freeStringIfNotEqual(autoStartBuffer, autoStart);
-    return status;;
+    return allInstalled;
 }
 
-static celix_status_t 
framework_autoStartConfiguredBundlesForList(celix_framework_t* fw, const 
celix_array_list_t *installedBundles) {
-    celix_status_t status = CELIX_SUCCESS;
+static bool framework_autoStartConfiguredBundlesForList(celix_framework_t* fw,
+                                                        const 
celix_array_list_t* installedBundles) {
+    bool allStarted = true;
     assert(!celix_framework_isCurrentThreadTheEventLoop(fw));
     for (int i = 0; i < celix_arrayList_size(installedBundles); ++i) {
         long bndId = celix_arrayList_getLong(installedBundles, i);
@@ -550,14 +564,23 @@ static celix_status_t 
framework_autoStartConfiguredBundlesForList(celix_framewor
         if (celix_bundle_getState(bnd) != OSGI_FRAMEWORK_BUNDLE_ACTIVE) {
             bool started = celix_framework_startBundle(fw, bndId);
             if (!started) {
-                fw_log(fw->logger, CELIX_LOG_LEVEL_ERROR, "Could not start 
bundle %s (bnd id = %li)\n", bnd->symbolicName, bndId);
+                fw_log(fw->logger,
+                       CELIX_LOG_LEVEL_ERROR,
+                       "Could not start bundle %s (bnd id = %li)\n",
+                       bnd->symbolicName,
+                       bndId);
+                allStarted = false;
             }
         } else {
-            fw_log(fw->logger, CELIX_LOG_LEVEL_TRACE, "Cannot start bundle %s 
(bnd id = %li), because it is already started\n", bnd->symbolicName, bndId);
-            status = CELIX_BUNDLE_EXCEPTION;
+            fw_log(fw->logger,
+                   CELIX_LOG_LEVEL_TRACE,
+                   "Cannot start bundle %s (bnd id = %li), because it is 
already started\n",
+                   bnd->symbolicName,
+                   bndId);
+            allStarted = false;
         }
     }
-    return status;
+    return allStarted;
 }
 
 celix_status_t framework_stop(framework_pt framework) {
@@ -1596,7 +1619,6 @@ bool celix_framework_useBundle(framework_t *fw, bool 
onlyActive, long bundleId,
     if (bundleId >= 0) {
         celix_framework_bundle_entry_t *entry = 
celix_framework_bundleEntry_getBundleEntryAndIncreaseUseCount(fw,
                                                                                
                               bundleId);
-
         if (entry != NULL) {
             if (onlyActive) {
                 celixThreadRwlock_readLock(&entry->fsmMutex);

Reply via email to