celix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From abroekh...@apache.org
Subject svn commit: r1338052 - in /incubator/celix/trunk: framework/private/src/ framework/public/include/ remote_services/ remote_services/discovery/ remote_services/example_proxy/private/src/ remote_services/example_service/ remote_services/remote_service_ad...
Date Mon, 14 May 2012 08:12:18 GMT
Author: abroekhuis
Date: Mon May 14 08:12:17 2012
New Revision: 1338052

URL: http://svn.apache.org/viewvc?rev=1338052&view=rev
Log:
Small updates to Remote Service Admin

Added:
    incubator/celix/trunk/remote_services/utils/
    incubator/celix/trunk/remote_services/utils/CMakeLists.txt
      - copied, changed from r1333342, incubator/celix/trunk/remote_services/example_service/CMakeLists.txt
    incubator/celix/trunk/remote_services/utils/private/
    incubator/celix/trunk/remote_services/utils/private/src/
    incubator/celix/trunk/remote_services/utils/private/src/remote_services_utils.c
    incubator/celix/trunk/remote_services/utils/public/
    incubator/celix/trunk/remote_services/utils/public/include/
    incubator/celix/trunk/remote_services/utils/public/include/remote_constants.h
      - copied, changed from r1333342, incubator/celix/trunk/remote_services/remote_service_admin/public/include/remote_constants.h
    incubator/celix/trunk/remote_services/utils/public/include/remote_services_utils.h
Removed:
    incubator/celix/trunk/remote_services/remote_service_admin/public/include/remote_constants.h
Modified:
    incubator/celix/trunk/framework/private/src/service_registration.c
    incubator/celix/trunk/framework/private/src/service_registry.c
    incubator/celix/trunk/framework/public/include/service_registry.h
    incubator/celix/trunk/remote_services/CMakeLists.txt
    incubator/celix/trunk/remote_services/discovery/CMakeLists.txt
    incubator/celix/trunk/remote_services/example_proxy/private/src/example_proxy_activator.c
    incubator/celix/trunk/remote_services/example_service/CMakeLists.txt
    incubator/celix/trunk/remote_services/remote_service_admin/CMakeLists.txt
    incubator/celix/trunk/remote_services/remote_service_admin/private/src/import_registration_impl.c
    incubator/celix/trunk/remote_services/remote_service_admin/private/src/remote_service_admin_activator.c
    incubator/celix/trunk/remote_services/topology_manager/CMakeLists.txt
    incubator/celix/trunk/remote_services/topology_manager/private/src/activator.c
    incubator/celix/trunk/remote_services/topology_manager/private/src/topology_manager.c

Modified: incubator/celix/trunk/framework/private/src/service_registration.c
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/framework/private/src/service_registration.c?rev=1338052&r1=1338051&r2=1338052&view=diff
==============================================================================
--- incubator/celix/trunk/framework/private/src/service_registration.c (original)
+++ incubator/celix/trunk/framework/private/src/service_registration.c Mon May 14 08:12:17
2012
@@ -57,6 +57,8 @@ struct serviceRegistration {
 	int nrOfServices;
 };
 
+static celix_status_t serviceRegistration_initializeProperties(SERVICE_REGISTRATION registration,
PROPERTIES properties);
+
 celix_status_t serviceRegistration_createInternal(apr_pool_t *pool, SERVICE_REGISTRY registry,
BUNDLE bundle, char * serviceName, long serviceId,
         void * serviceObject, PROPERTIES dictionary, bool isFactory, SERVICE_REGISTRATION
*registration);
 
@@ -75,7 +77,6 @@ SERVICE_REGISTRATION serviceRegistration
 celix_status_t serviceRegistration_createInternal(apr_pool_t *pool, SERVICE_REGISTRY registry,
BUNDLE bundle, char * serviceName, long serviceId,
         void * serviceObject, PROPERTIES dictionary, bool isFactory, SERVICE_REGISTRATION
*registration) {
     celix_status_t status = CELIX_SUCCESS;
-	char * sId = (char *)malloc(sizeof(serviceId) + 1);
 	SERVICE_REFERENCE reference;
 
     *registration = (SERVICE_REGISTRATION) apr_palloc(pool, sizeof(**registration));
@@ -86,17 +87,6 @@ celix_status_t serviceRegistration_creat
     (*registration)->references = NULL;
     arrayList_create(pool, &(*registration)->references);
 
-	if (dictionary == NULL) {
-		dictionary = properties_create();
-	}
-
-	
-	sprintf(sId, "%ld", serviceId);
-	properties_set(dictionary, (char *) SERVICE_ID, sId);
-	properties_set(dictionary, (char *) OBJECTCLASS, serviceName);
-
-	(*registration)->properties = dictionary;
-
 	(*registration)->serviceId = serviceId;
 	(*registration)->svcObj = serviceObject;
 	if (isFactory) {
@@ -110,7 +100,8 @@ celix_status_t serviceRegistration_creat
 	(*registration)->isUnregistering = false;
 	apr_thread_mutex_create(&(*registration)->mutex, 0, pool);
 
-	free(sId);
+	serviceRegistration_initializeProperties(*registration, dictionary);
+
 	return CELIX_SUCCESS;
 }
 
@@ -126,6 +117,23 @@ void serviceRegistration_destroy(SERVICE
 //	free(registration);
 }
 
+static celix_status_t serviceRegistration_initializeProperties(SERVICE_REGISTRATION registration,
PROPERTIES dictionary) {
+	char * sId = (char *)malloc(sizeof(registration->serviceId) + 1);
+
+	if (dictionary == NULL) {
+		dictionary = properties_create();
+	}
+
+	registration->properties = dictionary;
+
+	sprintf(sId, "%ld", registration->serviceId);
+	properties_set(dictionary, (char *) SERVICE_ID, sId);
+	properties_set(dictionary, (char *) OBJECTCLASS, registration->className);
+	free(sId);
+
+	return CELIX_SUCCESS;
+}
+
 bool serviceRegistration_isValid(SERVICE_REGISTRATION registration) {
 	return registration == NULL ? false : registration->svcObj != NULL;
 }
@@ -178,6 +186,16 @@ celix_status_t serviceRegistration_getPr
 	return status;
 }
 
+celix_status_t serviceRegistration_setProperties(SERVICE_REGISTRATION registration, PROPERTIES
properties) {
+	PROPERTIES oldProps = registration->properties;
+
+	serviceRegistration_initializeProperties(registration, properties);
+
+	serviceRegistry_servicePropertiesModified(registration->registry, registration, oldProps);
+
+	return CELIX_SUCCESS;
+}
+
 celix_status_t serviceRegistration_getRegistry(SERVICE_REGISTRATION registration, SERVICE_REGISTRY
*registry) {
 	celix_status_t status = CELIX_SUCCESS;
 

Modified: incubator/celix/trunk/framework/private/src/service_registry.c
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/framework/private/src/service_registry.c?rev=1338052&r1=1338051&r2=1338052&view=diff
==============================================================================
--- incubator/celix/trunk/framework/private/src/service_registry.c (original)
+++ incubator/celix/trunk/framework/private/src/service_registry.c Mon May 14 08:12:17 2012
@@ -540,3 +540,11 @@ celix_status_t serviceRegistry_getListen
 
 	return status;
 }
+
+celix_status_t serviceRegistry_servicePropertiesModified(SERVICE_REGISTRY registry, SERVICE_REGISTRATION
registration, PROPERTIES oldprops) {
+	if (registry->serviceChanged != NULL) {
+		registry->serviceChanged(registry->framework, MODIFIED, registration, oldprops);
+	}
+
+	return CELIX_SUCCESS;
+}

Modified: incubator/celix/trunk/framework/public/include/service_registry.h
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/framework/public/include/service_registry.h?rev=1338052&r1=1338051&r2=1338052&view=diff
==============================================================================
--- incubator/celix/trunk/framework/public/include/service_registry.h (original)
+++ incubator/celix/trunk/framework/public/include/service_registry.h Mon May 14 08:12:17
2012
@@ -55,4 +55,6 @@ celix_status_t serviceRegistry_createSer
 
 celix_status_t serviceRegistry_getListenerHooks(SERVICE_REGISTRY registry, apr_pool_t *pool,
ARRAY_LIST *hooks);
 
+celix_status_t serviceRegistry_servicePropertiesModified(SERVICE_REGISTRY registry, SERVICE_REGISTRATION
registration, PROPERTIES oldprops);
+
 #endif /* SERVICE_REGISTRY_H_ */

Modified: incubator/celix/trunk/remote_services/CMakeLists.txt
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/remote_services/CMakeLists.txt?rev=1338052&r1=1338051&r2=1338052&view=diff
==============================================================================
--- incubator/celix/trunk/remote_services/CMakeLists.txt (original)
+++ incubator/celix/trunk/remote_services/CMakeLists.txt Mon May 14 08:12:17 2012
@@ -16,6 +16,8 @@
 # under the License.
 
 #add_subdirectory(mongoose)
+add_subdirectory(utils)
+
 add_subdirectory(topology_manager)
 add_subdirectory(remote_service_admin)
 add_subdirectory(discovery)

Modified: incubator/celix/trunk/remote_services/discovery/CMakeLists.txt
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/remote_services/discovery/CMakeLists.txt?rev=1338052&r1=1338051&r2=1338052&view=diff
==============================================================================
--- incubator/celix/trunk/remote_services/discovery/CMakeLists.txt (original)
+++ incubator/celix/trunk/remote_services/discovery/CMakeLists.txt Mon May 14 08:12:17 2012
@@ -17,6 +17,7 @@
 
 include_directories("/opt/local/include")
 include_directories("${PROJECT_SOURCE_DIR}/utils/public/include")
+include_directories("${PROJECT_SOURCE_DIR}/remote_services/utils/public/include")
 include_directories("${PROJECT_SOURCE_DIR}/remote_services/discovery/private/include")
 include_directories("${PROJECT_SOURCE_DIR}/remote_services/endpoint_listener/public/include")
 include_directories("${PROJECT_SOURCE_DIR}/remote_services/remote_service_admin/public/include")

Modified: incubator/celix/trunk/remote_services/example_proxy/private/src/example_proxy_activator.c
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/remote_services/example_proxy/private/src/example_proxy_activator.c?rev=1338052&r1=1338051&r2=1338052&view=diff
==============================================================================
--- incubator/celix/trunk/remote_services/example_proxy/private/src/example_proxy_activator.c
(original)
+++ incubator/celix/trunk/remote_services/example_proxy/private/src/example_proxy_activator.c
Mon May 14 08:12:17 2012
@@ -69,7 +69,10 @@ celix_status_t bundleActivator_start(voi
 	services[1] = REMOTE_PROXY;
 
 	bundleContext_registerService(context, EXAMPLE_SERVICE, exampleService, NULL, &activator->service);
-	bundleContext_registerService(context, REMOTE_PROXY, exampleProxy, NULL, &activator->proxy);
+
+	PROPERTIES props = properties_create();
+	properties_set(props, (char *) "proxy.interface", (char *) EXAMPLE_SERVICE);
+	bundleContext_registerService(context, REMOTE_PROXY, exampleProxy, props, &activator->proxy);
 
 	return status;
 }

Modified: incubator/celix/trunk/remote_services/example_service/CMakeLists.txt
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/remote_services/example_service/CMakeLists.txt?rev=1338052&r1=1338051&r2=1338052&view=diff
==============================================================================
--- incubator/celix/trunk/remote_services/example_service/CMakeLists.txt (original)
+++ incubator/celix/trunk/remote_services/example_service/CMakeLists.txt Mon May 14 08:12:17
2012
@@ -16,6 +16,7 @@
 # under the License.
 
 include_directories("${PROJECT_SOURCE_DIR}/utils/public/include")
+include_directories("${PROJECT_SOURCE_DIR}/remote_services/utils/public/include")
 include_directories("${PROJECT_SOURCE_DIR}/remote_services/remote_service_admin/public/include")
 include_directories("${PROJECT_SOURCE_DIR}/remote_services/example_service/private/include")
 include_directories("${PROJECT_SOURCE_DIR}/remote_services/example_service/public/include")

Modified: incubator/celix/trunk/remote_services/remote_service_admin/CMakeLists.txt
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/remote_services/remote_service_admin/CMakeLists.txt?rev=1338052&r1=1338051&r2=1338052&view=diff
==============================================================================
--- incubator/celix/trunk/remote_services/remote_service_admin/CMakeLists.txt (original)
+++ incubator/celix/trunk/remote_services/remote_service_admin/CMakeLists.txt Mon May 14 08:12:17
2012
@@ -18,6 +18,7 @@
 link_directories("/opt/local/lib")
 include_directories("/opt/local/include")
 include_directories("${PROJECT_SOURCE_DIR}/utils/public/include")
+include_directories("${PROJECT_SOURCE_DIR}/remote_services/utils/public/include")
 include_directories("${PROJECT_SOURCE_DIR}/remote_services/remote_service_admin/public/include")
 include_directories("${PROJECT_SOURCE_DIR}/remote_services/remote_service_admin/private/include")
 include_directories("${PROJECT_SOURCE_DIR}/remote_services/endpoint_listener/public/include")

Modified: incubator/celix/trunk/remote_services/remote_service_admin/private/src/import_registration_impl.c
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/remote_services/remote_service_admin/private/src/import_registration_impl.c?rev=1338052&r1=1338051&r2=1338052&view=diff
==============================================================================
--- incubator/celix/trunk/remote_services/remote_service_admin/private/src/import_registration_impl.c
(original)
+++ incubator/celix/trunk/remote_services/remote_service_admin/private/src/import_registration_impl.c
Mon May 14 08:12:17 2012
@@ -9,6 +9,8 @@
 
 #include <apr_strings.h>
 
+#include <constants.h>
+
 #include "celix_errno.h"
 
 #include "import_registration_impl.h"
@@ -83,7 +85,9 @@ celix_status_t importRegistration_create
 		custumizer->modifiedService = importRegistration_proxyModified;
 		custumizer->removedService = importRegistration_proxyRemoved;
 
-		status = serviceTracker_create(registration->pool, registration->context, REMOTE_PROXY,
custumizer, tracker);
+		char *filter = apr_pstrcat(registration->pool, "(&(", OBJECTCLASS, "=", REMOTE_PROXY,
+				")(proxy.interface=", registration->endpointDescription->service, "))", NULL);
+		status = serviceTracker_createWithFilter(registration->pool, registration->context,
filter, custumizer, tracker);
 	}
 
 	return status;

Modified: incubator/celix/trunk/remote_services/remote_service_admin/private/src/remote_service_admin_activator.c
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/remote_services/remote_service_admin/private/src/remote_service_admin_activator.c?rev=1338052&r1=1338051&r2=1338052&view=diff
==============================================================================
--- incubator/celix/trunk/remote_services/remote_service_admin/private/src/remote_service_admin_activator.c
(original)
+++ incubator/celix/trunk/remote_services/remote_service_admin/private/src/remote_service_admin_activator.c
Mon May 14 08:12:17 2012
@@ -35,6 +35,8 @@ celix_status_t bundleActivator_create(BU
 				status = CELIX_ENOMEM;
 			} else {
 				activator->pool = pool;
+				activator->admin = NULL;
+				activator->registration = NULL;
 
 				*userData = activator;
 			}

Modified: incubator/celix/trunk/remote_services/topology_manager/CMakeLists.txt
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/remote_services/topology_manager/CMakeLists.txt?rev=1338052&r1=1338051&r2=1338052&view=diff
==============================================================================
--- incubator/celix/trunk/remote_services/topology_manager/CMakeLists.txt (original)
+++ incubator/celix/trunk/remote_services/topology_manager/CMakeLists.txt Mon May 14 08:12:17
2012
@@ -16,9 +16,10 @@
 # under the License.
 
 include_directories("${PROJECT_SOURCE_DIR}/utils/public/include")
+include_directories("${PROJECT_SOURCE_DIR}/remote_services/utils/public/include")
 include_directories("${PROJECT_SOURCE_DIR}/remote_services/topology_manager/private/include")
 include_directories("${PROJECT_SOURCE_DIR}/remote_services/endpoint_listener/public/include")
 include_directories("${PROJECT_SOURCE_DIR}/remote_services/remote_service_admin/public/include")
 
 bundle(topology_manager SOURCES private/src/topology_manager private/src/activator)
-target_link_libraries(topology_manager framework ${APRUTIL_LIBRARY})
+target_link_libraries(topology_manager framework remote_services_utils ${APRUTIL_LIBRARY})

Modified: incubator/celix/trunk/remote_services/topology_manager/private/src/activator.c
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/remote_services/topology_manager/private/src/activator.c?rev=1338052&r1=1338051&r2=1338052&view=diff
==============================================================================
--- incubator/celix/trunk/remote_services/topology_manager/private/src/activator.c (original)
+++ incubator/celix/trunk/remote_services/topology_manager/private/src/activator.c Mon May
14 08:12:17 2012
@@ -9,7 +9,6 @@
 #include <stdlib.h>
 
 #include <apr_strings.h>
-#include <apr_uuid.h>
 
 #include "constants.h"
 #include "bundle_activator.h"
@@ -21,6 +20,8 @@
 #include "remote_constants.h"
 #include "listener_hook_service.h"
 
+#include "remote_services_utils.h"
+
 struct activator {
 	apr_pool_t *pool;
 	BUNDLE_CONTEXT context;
@@ -34,9 +35,8 @@ struct activator {
 	SERVICE_REGISTRATION hook;
 };
 
-celix_status_t bundleActivator_createRSATracker(struct activator *activator, SERVICE_TRACKER
*tracker);
-celix_status_t bundleActivator_createServiceListener(struct activator *activator, SERVICE_LISTENER
*listener);
-celix_status_t topologyManagerActivator_getUUID(struct activator *activator, char **uuidStr);
+static celix_status_t bundleActivator_createRSATracker(struct activator *activator, SERVICE_TRACKER
*tracker);
+static celix_status_t bundleActivator_createServiceListener(struct activator *activator,
SERVICE_LISTENER *listener);
 
 celix_status_t bundleActivator_create(BUNDLE_CONTEXT context, void **userData) {
 	celix_status_t status = CELIX_SUCCESS;
@@ -45,31 +45,38 @@ celix_status_t bundleActivator_create(BU
 	struct activator *activator = NULL;
 
 	bundleContext_getMemoryPool(context, &parentPool);
-	apr_pool_create(&pool, parentPool);
-	activator = apr_palloc(pool, sizeof(*activator));
-	if (!activator) {
-		status = CELIX_ENOMEM;
+	if (apr_pool_create(&pool, parentPool) != APR_SUCCESS) {
+		status = CELIX_BUNDLE_EXCEPTION;
 	} else {
-		activator->pool = pool;
-		activator->context = context;
-		activator->endpointListenerService = NULL;
-		activator->hook = NULL;
-		activator->manager = NULL;
-		activator->remoteServiceAdminTracker = NULL;
-		activator->serviceListener = NULL;
-
-		topologyManager_create(context, pool, &activator->manager);
-
-		bundleActivator_createRSATracker(activator, &activator->remoteServiceAdminTracker);
-		bundleActivator_createServiceListener(activator, &activator->serviceListener);
-
-		*userData = activator;
+		activator = apr_palloc(pool, sizeof(*activator));
+		if (!activator) {
+			status = CELIX_ENOMEM;
+		} else {
+			activator->pool = pool;
+			activator->context = context;
+			activator->endpointListenerService = NULL;
+			activator->hook = NULL;
+			activator->manager = NULL;
+			activator->remoteServiceAdminTracker = NULL;
+			activator->serviceListener = NULL;
+
+			status = topologyManager_create(context, pool, &activator->manager);
+			if (status == CELIX_SUCCESS) {
+				status = bundleActivator_createRSATracker(activator, &activator->remoteServiceAdminTracker);
+				if (status == CELIX_SUCCESS) {
+					status = bundleActivator_createServiceListener(activator, &activator->serviceListener);
+					if (status == CELIX_SUCCESS) {
+						*userData = activator;
+					}
+				}
+			}
+		}
 	}
 
 	return status;
 }
 
-celix_status_t bundleActivator_createRSATracker(struct activator *activator, SERVICE_TRACKER
*tracker) {
+static celix_status_t bundleActivator_createRSATracker(struct activator *activator, SERVICE_TRACKER
*tracker) {
 	celix_status_t status = CELIX_SUCCESS;
 
 	SERVICE_TRACKER_CUSTOMIZER custumizer = (SERVICE_TRACKER_CUSTOMIZER) apr_palloc(activator->pool,
sizeof(*custumizer));
@@ -88,7 +95,7 @@ celix_status_t bundleActivator_createRSA
 	return status;
 }
 
-celix_status_t bundleActivator_createServiceListener(struct activator *activator, SERVICE_LISTENER
*listener) {
+static celix_status_t bundleActivator_createServiceListener(struct activator *activator,
SERVICE_LISTENER *listener) {
 	celix_status_t status = CELIX_SUCCESS;
 	apr_pool_t *pool;
 	apr_pool_create(&pool, activator->pool);
@@ -117,7 +124,7 @@ celix_status_t bundleActivator_start(voi
 
 	PROPERTIES props = properties_create();
 	char *uuid = NULL;
-	topologyManagerActivator_getUUID(activator, &uuid);
+	remoteServicesUtils_getUUID(pool, context, &uuid);
 	char *scope = apr_pstrcat(pool, "(&(", OBJECTCLASS, "=*)(!(", ENDPOINT_FRAMEWORK_UUID,
"=", uuid, ")))", NULL);
 	properties_set(props, (char *) ENDPOINT_LISTENER_SCOPE, scope);
 
@@ -152,22 +159,3 @@ celix_status_t bundleActivator_destroy(v
 	celix_status_t status = CELIX_SUCCESS;
 	return status;
 }
-
-celix_status_t topologyManagerActivator_getUUID(struct activator *activator, char **uuidStr)
{
-	celix_status_t status = CELIX_SUCCESS;
-	apr_pool_t *pool = NULL;
-	apr_pool_create(&pool, activator->pool);
-
-	status = bundleContext_getProperty(activator->context, ENDPOINT_FRAMEWORK_UUID, uuidStr);
-	if (status == CELIX_SUCCESS) {
-		if (*uuidStr == NULL) {
-			apr_uuid_t uuid;
-			apr_uuid_get(&uuid);
-			*uuidStr = apr_palloc(pool, APR_UUID_FORMATTED_LENGTH + 1);
-			apr_uuid_format(*uuidStr, &uuid);
-			setenv(ENDPOINT_FRAMEWORK_UUID, *uuidStr, 1);
-		}
-	}
-
-	return status;
-}

Modified: incubator/celix/trunk/remote_services/topology_manager/private/src/topology_manager.c
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/remote_services/topology_manager/private/src/topology_manager.c?rev=1338052&r1=1338051&r2=1338052&view=diff
==============================================================================
--- incubator/celix/trunk/remote_services/topology_manager/private/src/topology_manager.c
(original)
+++ incubator/celix/trunk/remote_services/topology_manager/private/src/topology_manager.c
Mon May 14 08:12:17 2012
@@ -131,7 +131,6 @@ celix_status_t topologyManager_endpointA
 
 	status = topologyManager_importService(manager, endpoint);
 
-
 	return status;
 }
 

Copied: incubator/celix/trunk/remote_services/utils/CMakeLists.txt (from r1333342, incubator/celix/trunk/remote_services/example_service/CMakeLists.txt)
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/remote_services/utils/CMakeLists.txt?p2=incubator/celix/trunk/remote_services/utils/CMakeLists.txt&p1=incubator/celix/trunk/remote_services/example_service/CMakeLists.txt&r1=1333342&r2=1338052&rev=1338052&view=diff
==============================================================================
--- incubator/celix/trunk/remote_services/example_service/CMakeLists.txt (original)
+++ incubator/celix/trunk/remote_services/utils/CMakeLists.txt Mon May 14 08:12:17 2012
@@ -16,12 +16,7 @@
 # under the License.
 
 include_directories("${PROJECT_SOURCE_DIR}/utils/public/include")
-include_directories("${PROJECT_SOURCE_DIR}/remote_services/remote_service_admin/public/include")
-include_directories("${PROJECT_SOURCE_DIR}/remote_services/example_service/private/include")
-include_directories("${PROJECT_SOURCE_DIR}/remote_services/example_service/public/include")
+include_directories("${PROJECT_SOURCE_DIR}/remote_services/utils/public/include")
 
-bundle(example SOURCES 
-	private/src/example_impl
-	private/src/example_activator  
-)
-target_link_libraries(example framework)
+add_library(remote_services_utils STATIC private/src/remote_services_utils.c)
+target_link_libraries(remote_services_utils ${APRUTIL_LIBRARY})

Added: incubator/celix/trunk/remote_services/utils/private/src/remote_services_utils.c
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/remote_services/utils/private/src/remote_services_utils.c?rev=1338052&view=auto
==============================================================================
--- incubator/celix/trunk/remote_services/utils/private/src/remote_services_utils.c (added)
+++ incubator/celix/trunk/remote_services/utils/private/src/remote_services_utils.c Mon May
14 08:12:17 2012
@@ -0,0 +1,36 @@
+/*
+ * remote_services_utils.c
+ *
+ *  Created on: Apr 23, 2012
+ *      Author: alexander
+ */
+#include <stdlib.h>
+#include <stdio.h>
+
+#include <apr_strings.h>
+#include <apr_uuid.h>
+
+#include "remote_constants.h"
+#include "remote_services_utils.h"
+
+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;
+}
+

Copied: incubator/celix/trunk/remote_services/utils/public/include/remote_constants.h (from
r1333342, incubator/celix/trunk/remote_services/remote_service_admin/public/include/remote_constants.h)
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/remote_services/utils/public/include/remote_constants.h?p2=incubator/celix/trunk/remote_services/utils/public/include/remote_constants.h&p1=incubator/celix/trunk/remote_services/remote_service_admin/public/include/remote_constants.h&r1=1333342&r2=1338052&rev=1338052&view=diff
==============================================================================
    (empty)

Added: incubator/celix/trunk/remote_services/utils/public/include/remote_services_utils.h
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/remote_services/utils/public/include/remote_services_utils.h?rev=1338052&view=auto
==============================================================================
--- incubator/celix/trunk/remote_services/utils/public/include/remote_services_utils.h (added)
+++ incubator/celix/trunk/remote_services/utils/public/include/remote_services_utils.h Mon
May 14 08:12:17 2012
@@ -0,0 +1,17 @@
+/*
+ * remote_services_utils.h
+ *
+ *  Created on: Apr 23, 2012
+ *      Author: alexander
+ */
+
+#ifndef REMOTE_SERVICES_UTILS_H_
+#define REMOTE_SERVICES_UTILS_H_
+
+#include <apr_general.h>
+#include <bundle_context.h>
+#include <celix_errno.h>
+
+celix_status_t remoteServicesUtils_getUUID(apr_pool_t *pool, BUNDLE_CONTEXT context, char
**uuidStr);
+
+#endif /* REMOTE_SERVICES_UTILS_H_ */



Mime
View raw message