celix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From abroekh...@apache.org
Subject svn commit: r1210381 - in /incubator/celix/trunk: ./ dependency_manager/ examples/whiteboard/tracker_depman/ framework/private/include/ framework/private/src/ shell/
Date Mon, 05 Dec 2011 09:46:31 GMT
Author: abroekhuis
Date: Mon Dec  5 09:46:30 2011
New Revision: 1210381

URL: http://svn.apache.org/viewvc?rev=1210381&view=rev
Log:
Small bugfixes

Several small bugfixes concerning memory pools etc.

Modified:
    incubator/celix/trunk/CMakeLists.txt
    incubator/celix/trunk/dependency_manager/CMakeLists.txt
    incubator/celix/trunk/dependency_manager/dependency_activator_base.c
    incubator/celix/trunk/dependency_manager/dependency_manager.c
    incubator/celix/trunk/dependency_manager/service_component.c
    incubator/celix/trunk/dependency_manager/service_component_private.h
    incubator/celix/trunk/examples/whiteboard/tracker_depman/tracker.c
    incubator/celix/trunk/framework/private/include/constants.h
    incubator/celix/trunk/framework/private/include/headers.h
    incubator/celix/trunk/framework/private/src/bundle_context.c
    incubator/celix/trunk/framework/private/src/service_registration.c
    incubator/celix/trunk/shell/inspect_command.c
    incubator/celix/trunk/target.cmake

Modified: incubator/celix/trunk/CMakeLists.txt
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/CMakeLists.txt?rev=1210381&r1=1210380&r2=1210381&view=diff
==============================================================================
--- incubator/celix/trunk/CMakeLists.txt (original)
+++ incubator/celix/trunk/CMakeLists.txt Mon Dec  5 09:46:30 2011
@@ -61,5 +61,5 @@ add_subdirectory(remote_services)
 
 add_subdirectory(deployment_admin)
 
-#include(target.cmake)
+include(target.cmake)
 #enable_testing()

Modified: incubator/celix/trunk/dependency_manager/CMakeLists.txt
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/dependency_manager/CMakeLists.txt?rev=1210381&r1=1210380&r2=1210381&view=diff
==============================================================================
--- incubator/celix/trunk/dependency_manager/CMakeLists.txt (original)
+++ incubator/celix/trunk/dependency_manager/CMakeLists.txt Mon Dec  5 09:46:30 2011
@@ -31,6 +31,6 @@ add_library(dependency_manager STATIC de
 include_directories("${PROJECT_SOURCE_DIR}/utils/public/include")
 target_link_libraries(dependency_manager framework)
 
-FILE(GLOB files dependency_activator_base.h service.h)
+FILE(GLOB files dependency_activator_base.h service.h dependency_manager.h service_component_private.h
service_component.h service_dependency.h)
 INSTALL(FILES ${files} DESTINATION include/dependency_manager COMPONENT framework)
 install(TARGETS dependency_manager DESTINATION lib COMPONENT framework)

Modified: incubator/celix/trunk/dependency_manager/dependency_activator_base.c
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/dependency_manager/dependency_activator_base.c?rev=1210381&r1=1210380&r2=1210381&view=diff
==============================================================================
--- incubator/celix/trunk/dependency_manager/dependency_activator_base.c (original)
+++ incubator/celix/trunk/dependency_manager/dependency_activator_base.c Mon Dec  5 09:46:30
2011
@@ -39,9 +39,11 @@ typedef struct dependencyActivatorBase *
 
 celix_status_t bundleActivator_create(BUNDLE_CONTEXT context, void **userData) {
 	apr_pool_t *pool;
+	apr_pool_t *npool = NULL;
 	celix_status_t status = bundleContext_getMemoryPool(context, &pool);
+	apr_pool_create(&npool, pool);
 	if (status == CELIX_SUCCESS) {
-		*userData = apr_palloc(pool, sizeof(DEPENDENCY_ACTIVATOR_BASE));
+		*userData = apr_palloc(npool, sizeof(DEPENDENCY_ACTIVATOR_BASE));
 		((DEPENDENCY_ACTIVATOR_BASE)(*userData))->userData = dm_create(context);;
 	} else {
 		status = CELIX_START_ERROR;

Modified: incubator/celix/trunk/dependency_manager/dependency_manager.c
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/dependency_manager/dependency_manager.c?rev=1210381&r1=1210380&r2=1210381&view=diff
==============================================================================
--- incubator/celix/trunk/dependency_manager/dependency_manager.c (original)
+++ incubator/celix/trunk/dependency_manager/dependency_manager.c Mon Dec  5 09:46:30 2011
@@ -33,10 +33,12 @@
 DEPENDENCY_MANAGER dependencyManager_create(BUNDLE_CONTEXT context) {
 	DEPENDENCY_MANAGER manager = (DEPENDENCY_MANAGER) malloc(sizeof(*manager));
 	apr_pool_t *pool = NULL;
+	apr_pool_t *npool = NULL;
 	bundleContext_getMemoryPool(context, &pool);
+	apr_pool_create(&npool, pool);
 	manager->context = context;
 	manager->services = NULL;
-	arrayList_create(pool, &manager->services);
+	arrayList_create(npool, &manager->services);
 	return manager;
 }
 

Modified: incubator/celix/trunk/dependency_manager/service_component.c
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/dependency_manager/service_component.c?rev=1210381&r1=1210380&r2=1210381&view=diff
==============================================================================
--- incubator/celix/trunk/dependency_manager/service_component.c (original)
+++ incubator/celix/trunk/dependency_manager/service_component.c Mon Dec  5 09:46:30 2011
@@ -69,6 +69,7 @@ SERVICE serviceComponent_create(BUNDLE_C
 
 	if (mypool) {
         service = (SERVICE) apr_pcalloc(mypool, sizeof(*service));
+        service->pool = mypool;
         service->impl = NULL;
         service->serviceName = NULL;
         service->serviceRegistration = NULL;
@@ -125,10 +126,8 @@ SERVICE serviceComponent_addServiceDepen
 		serviceDependency_start(dependency, service);
 	}
 
-	apr_pool_t *pool = NULL;
-	bundleContext_getMemoryPool(service->context, &pool);
 	pthread_mutex_lock(&service->mutex);
-	new = state_create(arrayList_clone(pool, service->dependencies), !state_isInactive(old));
+	new = state_create(arrayList_clone(service->pool, service->dependencies), !state_isInactive(old));
 	service->state = new;
 	pthread_mutex_unlock(&service->mutex);
 	serviceComponent_calculateStateChanges(service, old, new);
@@ -148,10 +147,8 @@ SERVICE serviceComponent_removeServiceDe
 		serviceDependency_stop(dependency, service);
 	}
 
-	apr_pool_t *pool = NULL;
-	bundleContext_getMemoryPool(service->context, &pool);
 	pthread_mutex_lock(&service->mutex);
-	new = state_create(arrayList_clone(pool, service->dependencies), !state_isInactive(old));
+	new = state_create(arrayList_clone(service->pool, service->dependencies), !state_isInactive(old));
 	service->state = new;
 	pthread_mutex_unlock(&service->mutex);
 	serviceComponent_calculateStateChanges(service, old, new);
@@ -163,10 +160,8 @@ SERVICE serviceComponent_removeServiceDe
 void serviceComponent_dependencyAvailable(SERVICE service, SERVICE_DEPENDENCY dependency)
{
 	STATE old, new;
 	pthread_mutex_lock(&service->mutex);
-	apr_pool_t *pool = NULL;
-	bundleContext_getMemoryPool(service->context, &pool);
 	old = service->state;
-	new = state_create(arrayList_clone(pool, service->dependencies), !state_isInactive(old));
+	new = state_create(arrayList_clone(service->pool, service->dependencies), !state_isInactive(old));
 	service->state = new;
 	pthread_mutex_unlock(&service->mutex);
 	serviceComponent_calculateStateChanges(service, old, new);
@@ -190,11 +185,9 @@ void serviceComponent_dependencyChanged(
 
 void serviceComponent_dependencyUnavailable(SERVICE service, SERVICE_DEPENDENCY dependency)
{
 	STATE old, new;
-	apr_pool_t *pool = NULL;
-	bundleContext_getMemoryPool(service->context, &pool);
 	pthread_mutex_lock(&service->mutex);
 	old = service->state;
-	new = state_create(arrayList_clone(pool, service->dependencies), !state_isInactive(old));
+	new = state_create(arrayList_clone(service->pool, service->dependencies), !state_isInactive(old));
 	service->state = new;
 	pthread_mutex_unlock(&service->mutex);
 	serviceComponent_calculateStateChanges(service, old, new);
@@ -208,11 +201,9 @@ void serviceComponent_dependencyUnavaila
 void serviceComponent_start(SERVICE service) {
 	bundleContext_registerService(service->context, SERVICE_COMPONENT_NAME, service, NULL,
&service->serviceRegistration);
 	STATE old, new;
-	apr_pool_t *pool = NULL;
-	bundleContext_getMemoryPool(service->context, &pool);
 	pthread_mutex_lock(&service->mutex);
 	old = service->state;
-	new = state_create(arrayList_clone(pool, service->dependencies), true);
+	new = state_create(arrayList_clone(service->pool, service->dependencies), true);
 	service->state = new;
 	pthread_mutex_unlock(&service->mutex);
 	serviceComponent_calculateStateChanges(service, old, new);
@@ -221,11 +212,9 @@ void serviceComponent_start(SERVICE serv
 
 void serviceComponent_stop(SERVICE service) {
 	STATE old, new;
-	apr_pool_t *pool = NULL;
-	bundleContext_getMemoryPool(service->context, &pool);
 	pthread_mutex_lock(&service->mutex);
 	old = service->state;
-	new = state_create(arrayList_clone(pool, service->dependencies), false);
+	new = state_create(arrayList_clone(service->pool, service->dependencies), false);
 	service->state = new;
 	pthread_mutex_unlock(&service->mutex);
 	serviceComponent_calculateStateChanges(service, old, new);
@@ -265,9 +254,7 @@ void serviceComponent_deactivateService(
 }
 
 void serviceComponent_startTrackingOptional(SERVICE service, STATE state) {
-	apr_pool_t *pool = NULL;
-	bundleContext_getMemoryPool(service->context, &pool);
-    ARRAY_LIST deps = arrayList_clone(pool, state->dependencies);
+    ARRAY_LIST deps = arrayList_clone(service->pool, state->dependencies);
 	ARRAY_LIST_ITERATOR i = arrayListIterator_create(deps);
 	while (arrayListIterator_hasNext(i)) {
 		SERVICE_DEPENDENCY dependency = (SERVICE_DEPENDENCY) arrayListIterator_next(i);
@@ -280,9 +267,7 @@ void serviceComponent_startTrackingOptio
 }
 
 void serviceComponent_stopTrackingOptional(SERVICE service, STATE state) {
-	apr_pool_t *pool = NULL;
-	bundleContext_getMemoryPool(service->context, &pool);
-    ARRAY_LIST deps = arrayList_clone(pool, state->dependencies);
+    ARRAY_LIST deps = arrayList_clone(service->pool, state->dependencies);
 	ARRAY_LIST_ITERATOR i = arrayListIterator_create(deps);
 	while (arrayListIterator_hasNext(i)) {
 		SERVICE_DEPENDENCY dependency = (SERVICE_DEPENDENCY) arrayListIterator_next(i);
@@ -296,9 +281,7 @@ void serviceComponent_stopTrackingOption
 
 void serviceComponent_startTrackingRequired(SERVICE service, void * arg) {
 	STATE state = (STATE) arg;
-	apr_pool_t *pool = NULL;
-	bundleContext_getMemoryPool(service->context, &pool);
-	ARRAY_LIST deps = arrayList_clone(pool, state->dependencies);
+	ARRAY_LIST deps = arrayList_clone(service->pool, state->dependencies);
     ARRAY_LIST_ITERATOR i = arrayListIterator_create(deps);
 	while (arrayListIterator_hasNext(i)) {
 		SERVICE_DEPENDENCY dependency = (SERVICE_DEPENDENCY) arrayListIterator_next(i);
@@ -312,9 +295,7 @@ void serviceComponent_startTrackingRequi
 
 void serviceComponent_stopTrackingRequired(SERVICE service, void * arg) {
 	STATE state = (STATE) arg;
-	apr_pool_t *pool = NULL;
-	bundleContext_getMemoryPool(service->context, &pool);
-	ARRAY_LIST deps = arrayList_clone(pool, state->dependencies);
+	ARRAY_LIST deps = arrayList_clone(service->pool, state->dependencies);
     ARRAY_LIST_ITERATOR i = arrayListIterator_create(deps);
 	while (arrayListIterator_hasNext(i)) {
 		SERVICE_DEPENDENCY dependency = (SERVICE_DEPENDENCY) arrayListIterator_next(i);

Modified: incubator/celix/trunk/dependency_manager/service_component_private.h
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/dependency_manager/service_component_private.h?rev=1210381&r1=1210380&r2=1210381&view=diff
==============================================================================
--- incubator/celix/trunk/dependency_manager/service_component_private.h (original)
+++ incubator/celix/trunk/dependency_manager/service_component_private.h Mon Dec  5 09:46:30
2011
@@ -36,6 +36,8 @@ typedef struct state * STATE;
 typedef struct executor * EXECUTOR;
 
 struct service {
+	apr_pool_t *pool;
+
 	ARRAY_LIST dependencies;
 	void (*init)(void * userData);
 	void (*start)(void * userData);

Modified: incubator/celix/trunk/examples/whiteboard/tracker_depman/tracker.c
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/examples/whiteboard/tracker_depman/tracker.c?rev=1210381&r1=1210380&r2=1210381&view=diff
==============================================================================
--- incubator/celix/trunk/examples/whiteboard/tracker_depman/tracker.c (original)
+++ incubator/celix/trunk/examples/whiteboard/tracker_depman/tracker.c Mon Dec  5 09:46:30
2011
@@ -40,7 +40,9 @@ void * dp_send(void * handle) {
 		for (i = 0; i < arrayList_size(data->publishers); i++) {
 			PUBLISHER_SERVICE pub = (PUBLISHER_SERVICE) arrayList_get(data->publishers, i);
 			pub->invoke(pub->publisher, "Tracker message");
-			data->logger->log(data->logger->logger, LOG_INFO, "Sending message to publisher");
+			if (data->logger != NULL) {
+				data->logger->log(data->logger->logger, LOG_INFO, "Sending message to publisher");
+			}
 		}
 		sleep(1);
 	}

Modified: incubator/celix/trunk/framework/private/include/constants.h
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/framework/private/include/constants.h?rev=1210381&r1=1210380&r2=1210381&view=diff
==============================================================================
--- incubator/celix/trunk/framework/private/include/constants.h (original)
+++ incubator/celix/trunk/framework/private/include/constants.h Mon Dec  5 09:46:30 2011
@@ -28,6 +28,7 @@
 
 static const char * const OBJECTCLASS = "objectClass";
 static const char * const SERVICE_ID = "service.id";
+static const char * const SERVICE_RANKING = "service.ranking";
 
 static const char * const BUNDLE_ACTIVATOR_CREATE = "bundleActivator_create";
 static const char * const BUNDLE_ACTIVATOR_START = "bundleActivator_start";

Modified: incubator/celix/trunk/framework/private/include/headers.h
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/framework/private/include/headers.h?rev=1210381&r1=1210380&r2=1210381&view=diff
==============================================================================
--- incubator/celix/trunk/framework/private/include/headers.h (original)
+++ incubator/celix/trunk/framework/private/include/headers.h Mon Dec  5 09:46:30 2011
@@ -147,6 +147,8 @@ struct serviceRegistration {
 	SERVICE_REGISTRY registry;
 	char * className;
 	SERVICE_REFERENCE reference;
+	ARRAY_LIST references;
+	BUNDLE bundle;
 	PROPERTIES properties;
 	void * svcObj;
 	long serviceId;

Modified: incubator/celix/trunk/framework/private/src/bundle_context.c
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/framework/private/src/bundle_context.c?rev=1210381&r1=1210380&r2=1210381&view=diff
==============================================================================
--- incubator/celix/trunk/framework/private/src/bundle_context.c (original)
+++ incubator/celix/trunk/framework/private/src/bundle_context.c Mon Dec  5 09:46:30 2011
@@ -169,12 +169,10 @@ celix_status_t bundleContext_registerSer
 }
 
 celix_status_t bundleContext_getServiceReferences(BUNDLE_CONTEXT context, const char * serviceName,
char * filter, ARRAY_LIST *service_references) {
-    ARRAY_LIST references = NULL;
     celix_status_t status = CELIX_SUCCESS;
 
     if (context != NULL && *service_references == NULL) {
-        fw_getServiceReferences(context->framework, &references, context->bundle,
serviceName, filter);
-        *service_references = references;
+        fw_getServiceReferences(context->framework, service_references, context->bundle,
serviceName, filter);
     } else {
         status = CELIX_ILLEGAL_ARGUMENT;
     }

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=1210381&r1=1210380&r2=1210381&view=diff
==============================================================================
--- incubator/celix/trunk/framework/private/src/service_registration.c (original)
+++ incubator/celix/trunk/framework/private/src/service_registration.c Mon Dec  5 09:46:30
2011
@@ -53,6 +53,9 @@ celix_status_t serviceRegistration_creat
     (*registration)->isServiceFactory = isFactory;
     (*registration)->registry = registry;
     (*registration)->className = serviceName;
+    (*registration)->bundle = bundle;
+    (*registration)->references = NULL;
+    //arrayList_create(pool, &(*registration)->references);
 
 	if (dictionary == NULL) {
 		dictionary = properties_create();

Modified: incubator/celix/trunk/shell/inspect_command.c
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/shell/inspect_command.c?rev=1210381&r1=1210380&r2=1210381&view=diff
==============================================================================
--- incubator/celix/trunk/shell/inspect_command.c (original)
+++ incubator/celix/trunk/shell/inspect_command.c Mon Dec  5 09:46:30 2011
@@ -85,7 +85,6 @@ celix_status_t inspectCommand_printExpor
 	} else {
 		apr_pool_t *pool = NULL;
 		bundleContext_getMemoryPool(command->bundleContext, &pool);
-		ARRAY_LIST ids = NULL;
 		arrayList_create(pool, &bundles);
 		int i;
 		for (i = 0; i < arrayList_size(ids); i++) {

Modified: incubator/celix/trunk/target.cmake
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/target.cmake?rev=1210381&r1=1210380&r2=1210381&view=diff
==============================================================================
--- incubator/celix/trunk/target.cmake (original)
+++ incubator/celix/trunk/target.cmake Mon Dec  5 09:46:30 2011
@@ -20,5 +20,5 @@
 #deploy("hello_world" BUNDLES shell shell_tui hello_world celix.mongoose log_service log_writer)
 #deploy("deployer" BUNDLES shell shell_tui deployer)
 #deploy("wb" BUNDLES tracker publisherA publisherB shell shell_tui log_service log_writer)
-#deploy("wb_dp" BUNDLES tracker_depman publisherA publisherB shell shell_tui log_service
log_writer)
+deploy("wb_dp" BUNDLES tracker_depman publisherA publisherB shell shell_tui log_service log_writer)
 #deploy("echo" BUNDLES echo_server echo_client shell shell_tui)
\ No newline at end of file



Mime
View raw message