You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@celix.apache.org by pn...@apache.org on 2018/10/29 20:03:12 UTC
[2/2] celix git commit: CELIX-433: Moves the generation of
config.properties to the main.c/main.cc program for a celix container.
CELIX-433: Moves the generation of config.properties to the main.c/main.cc program for a celix container.
Also:
- config.properties must now be configured using RUNTIME_PROPERTIES. If no runtime properties are present the config.properties will not be generated.
- Remove the generation of run.sh, release.sh and eclipse launch file. Preferred way of running is just to run the executable.
- Running a celix container with -p/--props argument will now print the config properties info (embedded, runtime and env).
Project: http://git-wip-us.apache.org/repos/asf/celix/repo
Commit: http://git-wip-us.apache.org/repos/asf/celix/commit/33a93db0
Tree: http://git-wip-us.apache.org/repos/asf/celix/tree/33a93db0
Diff: http://git-wip-us.apache.org/repos/asf/celix/diff/33a93db0
Branch: refs/heads/develop
Commit: 33a93db0a71b945aaf2869e250e61b059a3c45c1
Parents: 8345658
Author: Pepijn Noltes <pe...@gmail.com>
Authored: Mon Oct 29 20:59:12 2018 +0100
Committer: Pepijn Noltes <pe...@gmail.com>
Committed: Mon Oct 29 20:59:12 2018 +0100
----------------------------------------------------------------------
cmake/cmake_celix/ContainerPackaging.cmake | 104 ++++++++-----------
.../celix-examples/dm_example/CMakeLists.txt | 4 +-
libs/framework/include/constants.h | 2 +-
libs/framework/src/celix_launcher.c | 37 ++++---
libs/framework/src/framework.c | 5 +-
libs/utils/src/properties.c | 11 +-
6 files changed, 79 insertions(+), 84 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/celix/blob/33a93db0/cmake/cmake_celix/ContainerPackaging.cmake
----------------------------------------------------------------------
diff --git a/cmake/cmake_celix/ContainerPackaging.cmake b/cmake/cmake_celix/ContainerPackaging.cmake
index 0408e8f..4c4e967 100644
--- a/cmake/cmake_celix/ContainerPackaging.cmake
+++ b/cmake/cmake_celix/ContainerPackaging.cmake
@@ -39,7 +39,7 @@ function(add_celix_container)
set(OPTIONS COPY CXX)
set(ONE_VAL_ARGS GROUP NAME LAUNCHER LAUNCHER_SRC DIR)
- set(MULTI_VAL_ARGS BUNDLES PROPERTIES EMBEDDED_PROPERTIES)
+ set(MULTI_VAL_ARGS BUNDLES PROPERTIES EMBEDDED_PROPERTIES RUNTIME_PROPERTIES)
cmake_parse_arguments(CONTAINER "${OPTIONS}" "${ONE_VAL_ARGS}" "${MULTI_VAL_ARGS}" ${ARGN})
##### Check arguments #####
@@ -66,10 +66,6 @@ function(add_celix_container)
list(APPEND CONTAINERDEPS ${CONTAINER_TARGET})
set_target_properties(celix-containers PROPERTIES "CONTAINER_DEPLOYMENTS" "${CONTAINERDEPS}")
- #FILE TARGETS FOR CONTAINER
- set(CONTAINER_PROPS "${CONTAINER_LOC}/config.properties")
- set(CONTAINER_ECLIPSE_LAUNCHER "${CONTAINER_LOC}/${CONTAINER_NAME}.launch")
-
set(LAUNCHER_DEP )
if (CONTAINER_LAUNCHER)
if (IS_ABSOLUTE "${CONTAINER_LAUNCHER}")
@@ -92,20 +88,32 @@ function(add_celix_container)
else()
set(LAUNCHER_SRC "${PROJECT_BINARY_DIR}/celix/gen/containers/${CONTAINER_TARGET}/main.c")
endif()
+ set(STAGE1_LAUNCHER_SRC "${PROJECT_BINARY_DIR}/celix/gen/containers/${CONTAINER_TARGET}/main.stage1.c")
file(GENERATE
- OUTPUT "${LAUNCHER_SRC}"
+ OUTPUT "${STAGE1_LAUNCHER_SRC}"
CONTENT "#include <celix_launcher.h>
int main(int argc, char *argv[]) {
const char * config = \"\\
+CELIX_CONTAINER_NAME=$<TARGET_PROPERTY:${CONTAINER_TARGET},CONTAINER_NAME>\\n\\
+CELIX_BUNDLES_PATH=bundles\\n\\
+$<$<BOOL:$<TARGET_PROPERTY:${CONTAINER_TARGET},CONTAINER_BUNDLES_LEVEL_0>>:CELIX_AUTO_START_0=$<JOIN:$<TARGET_PROPERTY:${CONTAINER_TARGET},CONTAINER_BUNDLES_LEVEL_0>, >\\n>\\
+$<$<BOOL:$<TARGET_PROPERTY:${CONTAINER_TARGET},CONTAINER_BUNDLES_LEVEL_1>>:CELIX_AUTO_START_1=$<JOIN:$<TARGET_PROPERTY:${CONTAINER_TARGET},CONTAINER_BUNDLES_LEVEL_1>, >\\n>\\
+$<$<BOOL:$<TARGET_PROPERTY:${CONTAINER_TARGET},CONTAINER_BUNDLES_LEVEL_2>>:CELIX_AUTO_START_2=$<JOIN:$<TARGET_PROPERTY:${CONTAINER_TARGET},CONTAINER_BUNDLES_LEVEL_2>, >\\n>\\
+$<$<BOOL:$<TARGET_PROPERTY:${CONTAINER_TARGET},CONTAINER_BUNDLES_LEVEL_3>>:CELIX_AUTO_START_3=$<JOIN:$<TARGET_PROPERTY:${CONTAINER_TARGET},CONTAINER_BUNDLES_LEVEL_3>, >\\n>\\
+$<$<BOOL:$<TARGET_PROPERTY:${CONTAINER_TARGET},CONTAINER_BUNDLES_LEVEL_4>>:CELIX_AUTO_START_4=$<JOIN:$<TARGET_PROPERTY:${CONTAINER_TARGET},CONTAINER_BUNDLES_LEVEL_4>, >\\n>\\
+$<$<BOOL:$<TARGET_PROPERTY:${CONTAINER_TARGET},CONTAINER_BUNDLES_LEVEL_5>>:CELIX_AUTO_START_5=$<JOIN:$<TARGET_PROPERTY:${CONTAINER_TARGET},CONTAINER_BUNDLES_LEVEL_5>, >\\n>\\
+$<$<BOOL:$<TARGET_PROPERTY:${CONTAINER_TARGET},CONTAINER_BUNDLES_LEVEL_6>>:CELIX_AUTO_START_5=$<JOIN:$<TARGET_PROPERTY:${CONTAINER_TARGET},CONTAINER_BUNDLES_LEVEL_6>, >\\n>\\
$<JOIN:$<TARGET_PROPERTY:${CONTAINER_TARGET},CONTAINER_EMBEDDED_PROPERTIES>,\\n\\
>\";
- properties_pt packedConfig = properties_loadFromString(config);
- return celixLauncher_launchAndWaitForShutdown(argc, argv, packedConfig);
+ celix_properties_t *embeddedProps = celix_properties_loadFromString(config);
+ return celixLauncher_launchAndWaitForShutdown(argc, argv, embeddedProps);
}
"
)
+
+ file(GENERATE OUTPUT "${LAUNCHER_SRC}" INPUT "${STAGE1_LAUNCHER_SRC}")
endif ()
if (LAUNCHER_SRC) #compilation needed
@@ -121,24 +129,20 @@ $<JOIN:$<TARGET_PROPERTY:${CONTAINER_TARGET},CONTAINER_EMBEDDED_PROPERTIES>,\\n\
)
endif ()
- #generate config.properties
+ #generate config.properties. C
+ set(CONTAINER_PROPS "${CONTAINER_LOC}/config.properties")
set(STAGE1_PROPERTIES "${PROJECT_BINARY_DIR}/celix/gen/containers/${CONTAINER_TARGET}/container-config-stage1.properties")
file(GENERATE
OUTPUT "${STAGE1_PROPERTIES}"
- CONTENT "CELIX_AUTO_START_0=$<JOIN:$<TARGET_PROPERTY:${CONTAINER_TARGET},CONTAINER_BUNDLES_LEVEL_0>, >
-CELIX_AUTO_START_1=$<JOIN:$<TARGET_PROPERTY:${CONTAINER_TARGET},CONTAINER_BUNDLES_LEVEL_1>, >
-CELIX_AUTO_START_2=$<JOIN:$<TARGET_PROPERTY:${CONTAINER_TARGET},CONTAINER_BUNDLES_LEVEL_2>, >
-CELIX_AUTO_START_3=$<JOIN:$<TARGET_PROPERTY:${CONTAINER_TARGET},CONTAINER_BUNDLES_LEVEL_3>, >
-CELIX_AUTO_START_4=$<JOIN:$<TARGET_PROPERTY:${CONTAINER_TARGET},CONTAINER_BUNDLES_LEVEL_4>, >
-CELIX_AUTO_START_5=$<JOIN:$<TARGET_PROPERTY:${CONTAINER_TARGET},CONTAINER_BUNDLES_LEVEL_5>, >
-CELIX_CONTAINER_NAME=$<TARGET_PROPERTY:${CONTAINER_TARGET},CONTAINER_NAME>
-$<JOIN:$<TARGET_PROPERTY:${CONTAINER_TARGET},CONTAINER_PROPERTIES>,
+ CONTENT "$<JOIN:$<TARGET_PROPERTY:${CONTAINER_TARGET},CONTAINER_RUNTIME_PROPERTIES>,
>
"
)
+ #Condition is there so that config.properties file will only be generated if there are runtime properties
file(GENERATE
OUTPUT "${CONTAINER_PROPS}"
INPUT "${STAGE1_PROPERTIES}"
+ CONDITION $<NOT:$<STREQUAL:,$<TARGET_PROPERTY:${CONTAINER_TARGET},CONTAINER_RUNTIME_PROPERTIES>>>
)
#needed in the release.sh & run.sh files
@@ -158,63 +162,37 @@ $<JOIN:$<TARGET_PROPERTY:${CONTAINER_TARGET},CONTAINER_PROPERTIES>,
set(LIB_PATH_NAME "LD_LIBRARY_PATH")
endif()
- set(RELEASE_SH ${CONTAINER_LOC}/release.sh)
- set(RELEASE_CONTENT "#!/bin/sh\nexport ${LIB_PATH_NAME}=${CELIX_LIB_DIRS}:\${${LIB_PATH_NAME}}\nexport PATH=${CELIX_BIN_DIR}:\${PATH}")
- file(GENERATE
- OUTPUT ${RELEASE_SH}
- CONTENT ${RELEASE_CONTENT}
- )
-
- set(RUN_SH ${CONTAINER_LOC}/run.sh)
- set(RUN_CONTENT "${RELEASE_CONTENT}\n${LAUNCHER} \$@\n")
- file(GENERATE
- OUTPUT ${RUN_SH}
- CONTENT ${RUN_CONTENT}
- )
-
- #generate eclipse project launch file
- set(PROGRAM_NAME "${LAUNCHER}")
- set(PROJECT_ATTR "${CMAKE_PROJECT_NAME}-build")
- set(WORKING_DIRECTORY ${CONTAINER_LOC})
- include("${CELIX_CMAKE_DIRECTORY}/RunConfig.in.cmake") #set VAR RUN_CONFIG_IN
- file(GENERATE
- OUTPUT "${CONTAINER_ECLIPSE_LAUNCHER}"
- CONTENT "${RUN_CONFIG_IN}"
- )
#add a custom target which can depend on generation expressions
add_custom_target(${CONTAINER_TARGET}-deps
DEPENDS
- ${RUN_SH}
- ${CONTAINER_ECLIPSE_LAUNCHER}
- ${RELEASE_SH}
- ${CONTAINER_PROPS}
$<TARGET_PROPERTY:${CONTAINER_TARGET},CONTAINER_TARGET_DEPS>
)
add_dependencies(${CONTAINER_TARGET} ${CONTAINER_TARGET}-deps)
-
##### Container Target Properties #####
#internal use
set_target_properties(${CONTAINER_TARGET} PROPERTIES "CONTAINER_TARGET_DEPS" "") #target deps for the container.
- set_target_properties(${CONTAINER_TARGET} PROPERTIES "CONTAINER_BUNDLES_LEVEL_0" "") #bundles to deploy for the container for run level 0
- set_target_properties(${CONTAINER_TARGET} PROPERTIES "CONTAINER_BUNDLES_LEVEL_1" "") #bundles to deploy for the container for run level 0
- set_target_properties(${CONTAINER_TARGET} PROPERTIES "CONTAINER_BUNDLES_LEVEL_2" "") #bundles to deploy for the container for run level 0
- set_target_properties(${CONTAINER_TARGET} PROPERTIES "CONTAINER_BUNDLES_LEVEL_3" "") #bundles to deploy for the container for run level 0
- set_target_properties(${CONTAINER_TARGET} PROPERTIES "CONTAINER_BUNDLES_LEVEL_4" "") #bundles to deploy for the container for run level 0
- set_target_properties(${CONTAINER_TARGET} PROPERTIES "CONTAINER_BUNDLES_LEVEL_5" "") #bundles to deploy for the container for run level 0
+ set_target_properties(${CONTAINER_TARGET} PROPERTIES "CONTAINER_BUNDLES_LEVEL_0" "") #bundles to deploy for the container for startup level 0
+ set_target_properties(${CONTAINER_TARGET} PROPERTIES "CONTAINER_BUNDLES_LEVEL_1" "") #bundles to deploy for the container for startup level 1
+ set_target_properties(${CONTAINER_TARGET} PROPERTIES "CONTAINER_BUNDLES_LEVEL_2" "") #bundles to deploy for the container for startup level 2
+ set_target_properties(${CONTAINER_TARGET} PROPERTIES "CONTAINER_BUNDLES_LEVEL_3" "") #bundles to deploy for the container for startup level 3, the default used startup level
+ set_target_properties(${CONTAINER_TARGET} PROPERTIES "CONTAINER_BUNDLES_LEVEL_4" "") #bundles to deploy for the container for startup level 4
+ set_target_properties(${CONTAINER_TARGET} PROPERTIES "CONTAINER_BUNDLES_LEVEL_5" "") #bundles to deploy for the container for startup level 5
+ set_target_properties(${CONTAINER_TARGET} PROPERTIES "CONTAINER_BUNDLES_LEVEL_6" "") #bundles to deploy for the container for startup level 6
set_target_properties(${CONTAINER_TARGET} PROPERTIES "CONTAINER_COPY_BUNDLES" ${CONTAINER_COPY}) #copy bundles in bundle dir or link using abs paths. NOTE this cannot be changed after a add_deploy command
#deploy specific
set_target_properties(${CONTAINER_TARGET} PROPERTIES "CONTAINER_NAME" "${CONTAINER_NAME}")
set_target_properties(${CONTAINER_TARGET} PROPERTIES "CONTAINER_GROUP" "${CONTAINER_GROUP}")
set_target_properties(${CONTAINER_TARGET} PROPERTIES "CONTAINER_LOC" "${CONTAINER_LOC}")
- set_target_properties(${CONTAINER_TARGET} PROPERTIES "CONTAINER_PROPERTIES" "")
+ set_target_properties(${CONTAINER_TARGET} PROPERTIES "CONTAINER_RUNTIME_PROPERTIES" "")
set_target_properties(${CONTAINER_TARGET} PROPERTIES "CONTAINER_EMBEDDED_PROPERTIES" "")
#####
- celix_container_bundles(${CONTAINER_TARGET} LEVEL 1 ${CONTAINER_BUNDLES})
- celix_container_properties(${CONTAINER_TARGET} ${CONTAINER_PROPERTIES})
+ celix_container_bundles(${CONTAINER_TARGET} LEVEL 3 ${CONTAINER_BUNDLES})
+ celix_container_embedded_properties(${CONTAINER_TARGET} ${CONTAINER_PROPERTIES})
+ celix_container_runtime_properties(${CONTAINER_TARGET} ${CONTAINER_RUNTIME_PROPERTIES})
celix_container_embedded_properties(${CONTAINER_TARGET} ${CONTAINER_EMBEDDED_PROPERTIES})
@@ -327,7 +305,7 @@ function(celix_container_bundles)
set(HANDLED FALSE)
if (IS_ABSOLUTE ${BUNDLE} AND EXISTS ${BUNDLE})
get_filename_component(BUNDLE_FILENAME ${BUNDLE} NAME)
- set(COPY_LOC "bundles/${BUNDLE_FILENAME}")
+ set(COPY_LOC "${BUNDLE_FILENAME}")
set(ABS_LOC "${BUNDLE}")
set(HANDLED TRUE)
elseif (TARGET ${BUNDLE})
@@ -338,7 +316,7 @@ function(celix_container_bundles)
else()
get_target_property(IMP ${BUNDLE} BUNDLE_IMPORTED)
if (IMP) #An imported bundle target -> handle target without DEPENDS
- set(COPY_LOC "bundles/$<TARGET_PROPERTY:${BUNDLE},BUNDLE_FILENAME>")
+ set(COPY_LOC "$<TARGET_PROPERTY:${BUNDLE},BUNDLE_FILENAME>")
set(ABS_LOC "$<TARGET_PROPERTY:${BUNDLE},BUNDLE_FILE>")
set(HANDLED TRUE)
endif ()
@@ -346,7 +324,7 @@ function(celix_container_bundles)
endif ()
if (NOT HANDLED) #not a imported bundle target, so assuming a (future) bundle target
- set(COPY_LOC "bundles/$<TARGET_PROPERTY:${BUNDLE},BUNDLE_FILENAME>")
+ set(COPY_LOC "$<TARGET_PROPERTY:${BUNDLE},BUNDLE_FILENAME>")
set(ABS_LOC "$<TARGET_PROPERTY:${BUNDLE},BUNDLE_FILE>")
if (NOT COPY) #in case of COPY dep will be added in celix_container_bundles_dir
@@ -375,21 +353,21 @@ function(celix_container_bundles)
endfunction()
function(deploy_properties)
- celix_container_properties(${ARGN})
+ celix_container_runtime_properties(${ARGN})
endfunction()
-function(celix_container_properties)
+function(celix_container_runtime_properties)
#0 is container TARGET
#1..n is bundles
list(GET ARGN 0 CONTAINER_TARGET)
list(REMOVE_AT ARGN 0)
- get_target_property(PROPS ${CONTAINER_TARGET} "CONTAINER_PROPERTIES")
+ get_target_property(PROPS ${CONTAINER_TARGET} "CONTAINER_RUNTIME_PROPERTIES")
foreach(PROP IN ITEMS ${ARGN})
list(APPEND PROPS ${PROP})
endforeach()
- set_target_properties(${CONTAINER_TARGET} PROPERTIES "CONTAINER_PROPERTIES" "${PROPS}")
+ set_target_properties(${CONTAINER_TARGET} PROPERTIES "CONTAINER_RUNTIME_PROPERTIES" "${PROPS}")
endfunction()
function(deploy_embedded_properties)
@@ -410,3 +388,7 @@ function(celix_container_embedded_properties)
set_target_properties(${CONTAINER_TARGET} PROPERTIES "CONTAINER_EMBEDDED_PROPERTIES" "${PROPS}")
endfunction()
+
+function(celix_container_properties)
+ celix_container_embedded_properties(${ARGN})
+endfunction()
http://git-wip-us.apache.org/repos/asf/celix/blob/33a93db0/examples/celix-examples/dm_example/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/examples/celix-examples/dm_example/CMakeLists.txt b/examples/celix-examples/dm_example/CMakeLists.txt
index 64b9479..581a17c 100644
--- a/examples/celix-examples/dm_example/CMakeLists.txt
+++ b/examples/celix-examples/dm_example/CMakeLists.txt
@@ -34,8 +34,10 @@ add_celix_container(dm_example
dm_example_phase2a
dm_example_phase2b
dm_example_phase3
- PROPERTIES
+ RUNTIME_PROPERTIES
LOGHELPER_ENABLE_STDOUT_FALLBACK=true
+ PROP2=val2
+ PROP3=val3
)
http://git-wip-us.apache.org/repos/asf/celix/blob/33a93db0/libs/framework/include/constants.h
----------------------------------------------------------------------
diff --git a/libs/framework/include/constants.h b/libs/framework/include/constants.h
index 97d9b47..c099312 100644
--- a/libs/framework/include/constants.h
+++ b/libs/framework/include/constants.h
@@ -74,7 +74,7 @@ static const char *const OSGI_FRAMEWORK_FRAMEWORK_STORAGE_CLEAN_NAME = "org.osgi
static const bool OSGI_FRAMEWORK_FRAMEWORK_STORAGE_CLEAN_DEFAULT = true;
static const char *const OSGI_FRAMEWORK_FRAMEWORK_UUID = "org.osgi.framework.uuid";
-static const char *const CELIX_BUNDLES_PATH_NAME = "CELIX_BUNDLE_PATH";
+static const char *const CELIX_BUNDLES_PATH_NAME = "CELIX_BUNDLES_PATH";
static const char *const CELIX_BUNDLES_PATH_DEFAULT = "bundles";
#define CELIX_AUTO_START_0 "CELIX_AUTO_START_0"
http://git-wip-us.apache.org/repos/asf/celix/blob/33a93db0/libs/framework/src/celix_launcher.c
----------------------------------------------------------------------
diff --git a/libs/framework/src/celix_launcher.c b/libs/framework/src/celix_launcher.c
index 405d646..9fa5c48 100644
--- a/libs/framework/src/celix_launcher.c
+++ b/libs/framework/src/celix_launcher.c
@@ -194,6 +194,8 @@ void celixLauncher_stop(framework_pt framework) {
static void show_properties(celix_properties_t *embeddedProps, const char *configFile) {
const char *key = NULL;
+ celix_properties_t *keys = celix_properties_create(); //only to store the keys
+
printf("Embedded properties:\n");
if (embeddedProps == NULL || celix_properties_size(embeddedProps) == 0) {
printf("|- Empty!\n");
@@ -201,41 +203,48 @@ static void show_properties(celix_properties_t *embeddedProps, const char *confi
CELIX_PROPERTIES_FOR_EACH(embeddedProps, key) {
const char *val = celix_properties_get(embeddedProps, key, "!Error!");
printf("|- %s=%s\n", key, val);
- }
+ celix_properties_set(keys, key, NULL);
+ }
}
printf("\n");
- celix_properties_t *configProps = NULL;
+ celix_properties_t *runtimeProps = NULL;
if (configFile != NULL) {
- configProps = celix_properties_load(configFile);
+ runtimeProps = celix_properties_load(configFile);
}
printf("Runtime properties (input %s):\n", configFile);
- if (configProps == NULL || celix_properties_size(configProps) == 0) {
+ if (runtimeProps == NULL || celix_properties_size(runtimeProps) == 0) {
printf("|- Empty!\n");
} else {
- CELIX_PROPERTIES_FOR_EACH(configProps, key) {
- const char *val = celix_properties_get(configProps, key, "!Error!");
+ CELIX_PROPERTIES_FOR_EACH(runtimeProps, key) {
+ const char *val = celix_properties_get(runtimeProps, key, "!Error!");
printf("|- %s=%s\n", key, val);
+ celix_properties_set(keys, key, NULL);
}
}
printf("\n");
//combined result
- combine_properties(embeddedProps, configProps);
- printf("Resolved (embedded + runtime) properties:\n");
- if (embeddedProps == NULL || celix_properties_size(embeddedProps) == 0) {
+ combine_properties(embeddedProps, runtimeProps);
+ printf("Resolved (env, runtime and embedded) properties:\n");
+ if (celix_properties_size(keys) == 0) {
printf("|- Empty!\n");
} else {
- CELIX_PROPERTIES_FOR_EACH(embeddedProps, key) {
- const char *val = celix_properties_get(embeddedProps, key, "!Error!");
- printf("|- %s=%s\n", key, val);
+ CELIX_PROPERTIES_FOR_EACH(keys, key) {
+ const char *valEm = celix_properties_get(embeddedProps, key, NULL);
+ const char *valRt = celix_properties_get(runtimeProps, key, NULL);
+ const char *envVal = getenv(key);
+ const char *val = envVal != NULL ? envVal : valRt != NULL ? valRt : valEm;
+ const char *source = envVal != NULL ? "environment" : valRt != NULL ? "runtime" : "embedded";
+ printf("|- %s=%s (source %s)\n", key, val, source);
}
}
printf("\n");
- if (configProps != NULL) {
- celix_properties_destroy(configProps);
+ if (runtimeProps != NULL) {
+ celix_properties_destroy(runtimeProps);
}
+ celix_properties_destroy(keys);
}
static void combine_properties(celix_properties_t *orignal, const celix_properties_t *append) {
http://git-wip-us.apache.org/repos/asf/celix/blob/33a93db0/libs/framework/src/framework.c
----------------------------------------------------------------------
diff --git a/libs/framework/src/framework.c b/libs/framework/src/framework.c
index f10b259..2de670c 100644
--- a/libs/framework/src/framework.c
+++ b/libs/framework/src/framework.c
@@ -723,7 +723,7 @@ static void framework_autoStartConfiguredBundlesForList(bundle_context_t *fwCtx,
if (rc == CELIX_SUCCESS) {
arrayList_add(installed, bnd);
} else {
- printf("Could not install bundle from %s\n", location); //TODO use logger
+ printf("Could not install bundle '%s'\n", location);
}
location = strtok_r(NULL, delims, &save_ptr);
}
@@ -813,7 +813,8 @@ celix_status_t fw_installBundle2(framework_pt framework, bundle_pt * bundle, lon
celix_status_t status = CELIX_SUCCESS;
bundle_state_e state = OSGI_FRAMEWORK_BUNDLE_UNKNOWN;
- const char *paths = celix_bundleContext_getProperty(framework->bundle->context, CELIX_BUNDLES_PATH_NAME, CELIX_BUNDLES_PATH_DEFAULT);
+ const char *paths = NULL;
+ fw_getProperty(framework, CELIX_BUNDLES_PATH_NAME, CELIX_BUNDLES_PATH_DEFAULT, &paths);
char *location = resolveBundleLocation(framework, bndLoc, paths);
if (location == NULL) {
fw_log(framework->logger, OSGI_FRAMEWORK_LOG_WARNING, "Cannot find bundle %s. Using %s=%s", bndLoc, CELIX_BUNDLES_PATH_NAME, paths);
http://git-wip-us.apache.org/repos/asf/celix/blob/33a93db0/libs/utils/src/properties.c
----------------------------------------------------------------------
diff --git a/libs/utils/src/properties.c b/libs/utils/src/properties.c
index 33068e6..1519ecc 100644
--- a/libs/utils/src/properties.c
+++ b/libs/utils/src/properties.c
@@ -363,15 +363,16 @@ const char* celix_properties_get(const celix_properties_t *properties, const cha
void celix_properties_set(celix_properties_t *properties, const char *key, const char *value) {
hash_map_entry_pt entry = hashMap_getEntry(properties, key);
- char* oldValue = NULL;
+ char* oldVal = NULL;
+ char *newVal = value == NULL ? NULL : strndup(value, 1024*1024);
if (entry != NULL) {
char* oldKey = hashMapEntry_getKey(entry);
- oldValue = hashMapEntry_getValue(entry);
- hashMap_put(properties, oldKey, strndup(value, 1024*10));
+ oldVal = hashMapEntry_getValue(entry);
+ hashMap_put(properties, oldKey, newVal);
} else {
- hashMap_put(properties, strndup(key, 1024*10), strndup(value, 1024*10));
+ hashMap_put(properties, strndup(key, 1024*1024), newVal);
}
- free(oldValue);
+ free(oldVal);
}
void celix_properties_unset(celix_properties_t *properties, const char *key) {