Hi Pepijn,

solved my problem - thanks for your help!

Regards,
  Bjoern




Am 2013-02-17 21:11, schrieb Pepijn Noltes:
Hi Bjorn,


On Fri, Feb 15, 2013 at 6:12 PM, Björn Petri <[email protected]>wrote:



Hi!

I tried to get the celix framework uuid by using the following:

   /* get framework uuid */
   status = bundleContext_getProperty(bi->**context,
"endpoint.framework.uuid", &uuidStr)

Unfortunately it does not work ;(. Does anyone have an idea how
to get the framework uuid?


The property endpoint.framework.uuid is used in the remote service admin, I
think the property you are looking for is FRAMEWORK_UUID
(org.osgi.framework.uuid). Apache Celix does not support this yet. I will
try to add this in the coming days.

In the meantime if you just need a unique id, you could also generate one
with apr_utils. The endpoint.framework.uuid is generated in same way:

celix_status_t remoteServicesUtils_getUUID(apr_pool_t *pool, BUNDLE_CONTEXT
context, char **uuidStr) {
        celix_status_t status = CELIX_SUCCESS;

        status = bundleContext_getProperty(context,
ENDPOINT_FRAMEWORK_UUID, uuidStr);
        if (status == CELIX_SUCCESS) {
                if (*uuidStr == NULL) {
                        *uuidStr = apr_palloc(pool,
APR_UUID_FORMATTED_LENGTH + 1);
                        if (!*uuidStr) {
                                status = CELIX_ENOMEM;
                        } else {
                                apr_uuid_t uuid;
                                apr_uuid_get(&uuid);
                                apr_uuid_format(*uuidStr, &uuid);
setenv(ENDPOINT_FRAMEWORK_UUID, *uuidStr,
1);
                        }
                }
        }

        return status;
}


I hope this helps.

Greetings,
Pepijn

Reply via email to