Configurable framework UUID
Closed this issue · 1 comments
In the interface description of CELIX_FRAMEWORK_UUID(https://github.com/apache/celix/blob/master/libs/framework/include/celix_constants.h#L175), CELIX_FRAMEWORK_UUID should be configurable, but in the implementation, it is not configurable(https://github.com/apache/celix/blob/master/libs/framework/src/framework.c#L252).
If CELIX_FRAMEWORK_UUID is designed to be configurable, what should be considered?
If CELIX_FRAMEWORK_UUID is designed to be configurable, what should be considered?
Currently, a random UUID is generated in framework_create using the following snippet:
//create and store framework uuid
char uuid[37];
uuid_t uid;
uuid_generate(uid);
uuid_unparse(uid, uuid);
celix_properties_set(framework->configurationMap, CELIX_FRAMEWORK_UUID, uuid);
In my opinion, this code snippet should be extracted into a private function (e.g., celix_framework_createFrameworkUUID
). In this function, a check should be performed to see if a UUID-parsable configuration property already exists before generating a random UUID. I think this is enough to add configurable framework UUID support.
Additionally, I suggest updating the original property name from "org.osgi.framework.uuid" to something like "CELIX_FRAMEWORK_CONFIGURED_UUID," as Celix configuration properties, today, typically follow a naming scheme more aligned with shell environment variables.
Note that configurable framework UUIDs were likely supported in the past and may have been removed accidentally.