celix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pnol...@apache.org
Subject [05/21] celix git commit: CELIX-210: Added Set fucntion to dependency manager and added bundle with shell command to get overview of the depenency-manages components
Date Tue, 03 Nov 2015 11:09:42 GMT
CELIX-210: Added Set fucntion to dependency manager and added bundle with shell command to
get overview of the depenency-manages components


Project: http://git-wip-us.apache.org/repos/asf/celix/repo
Commit: http://git-wip-us.apache.org/repos/asf/celix/commit/9203fddd
Tree: http://git-wip-us.apache.org/repos/asf/celix/tree/9203fddd
Diff: http://git-wip-us.apache.org/repos/asf/celix/diff/9203fddd

Branch: refs/heads/develop
Commit: 9203fdddd03ebc787544863841069e621bdf7edb
Parents: cc6fd43
Author: Erjan Altena <erjan.altena@nl.thalesgroup.com>
Authored: Fri Oct 16 14:09:42 2015 +0200
Committer: Pepijn Noltes <pepijnnoltes@gmail.com>
Committed: Mon Oct 19 20:44:30 2015 +0200

----------------------------------------------------------------------
 dependency_manager/CMakeLists.txt               |  18 +++-
 .../private/include/dm_component_impl.h         |   2 +-
 .../include/dm_dependency_manager_impl.h        |  11 ++
 .../private/include/dm_server_impl.h            |  10 ++
 .../include/dm_service_dependency_impl.h        |   3 +
 .../private/include/dm_shell_list_command.h     |  34 +++++++
 .../private/src/dm_activator_base.c             |  20 +++-
 .../private/src/dm_component_impl.c             |  19 +++-
 .../private/src/dm_dependency_manager_impl.c    |   6 +-
 dependency_manager/private/src/dm_server.c      |  71 +++++++++++++
 .../private/src/dm_service_dependency.c         |  66 +++++++++++-
 .../private/src/dm_shell_activator.c            |  72 +++++++++++++
 .../private/src/dm_shell_list_command.c         | 101 +++++++++++++++++++
 .../public/include/dm_component.h               |   4 +-
 dependency_manager/public/include/dm_server.h   |  36 +++++++
 .../public/include/dm_service_dependency.h      |   6 +-
 examples/deploy.cmake                           |   2 +-
 .../publisherA/private/src/activator.c          |   2 +
 .../publisherB/private/src/activator.c          |   2 +
 .../tracker_depman/private/include/tracker.h    |   4 +-
 .../private/src/dependency_activator.c          |  18 ++--
 .../tracker_depman/private/src/tracker.c        |  27 ++++-
 22 files changed, 496 insertions(+), 38 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/celix/blob/9203fddd/dependency_manager/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/dependency_manager/CMakeLists.txt b/dependency_manager/CMakeLists.txt
index 6b76658..931dd3c 100644
--- a/dependency_manager/CMakeLists.txt
+++ b/dependency_manager/CMakeLists.txt
@@ -16,7 +16,10 @@
 # under the License.
 
 celix_subproject(DEPENDENCY_MANAGER "Option to build the dependency manager static library"
ON DEPS framework)
-if (DEPENDENCY_MANAGER) 
+if (DEPENDENCY_MANAGER)
+    SET(BUNDLE_SYMBOLICNAME "apache_celix_dm_shell")
+    SET(BUNDLE_VERSION "0.0.1")
+    SET(BUNDLE_NAME "Apache Celix DM Shell commands")
     # Add -fPIC for x86_64 Unix platforms; this lib will be linked to a shared lib
     if(UNIX AND NOT WIN32)
       find_program(CMAKE_UNAME uname /bin /usr/bin /usr/local/bin )
@@ -34,15 +37,22 @@ if (DEPENDENCY_MANAGER)
         DESCRIPTION "The Apache Celix dependency manager (static) library"
         GROUP all
     )
-    
+    bundle(dm_shell SOURCES
+            private/src/dm_shell_activator
+            private/src/dm_shell_list_command
+    )
     add_library(dependency_manager STATIC 
     	private/src/dm_activator_base 
     	private/src/dm_component_impl 
     	private/src/dm_service_dependency
     	private/src/dm_event
-    	private/src/dm_dependency_manager_impl)
+    	private/src/dm_dependency_manager_impl
+        private/src/dm_server
+    )
+
    	include_directories("public/include")
    	include_directories("private/include")
+    include_directories("../shell/public/include")
     include_directories("${PROJECT_SOURCE_DIR}/utils/public/include")
     target_link_libraries(dependency_manager celix_framework)
     
@@ -52,10 +62,12 @@ if (DEPENDENCY_MANAGER)
             public/include/dm_component.h
             public/include/dm_dependency_manager.h
             public/include/dm_service_dependency.h
+            public/include/dm_server.h
 		DESTINATION 
 			include/celix/dependency_manager
 		COMPONENT 
 			dependency_manager
 	)
+    install_bundle(dm_shell)
     install(TARGETS dependency_manager DESTINATION lib COMPONENT dependency_manager)
 endif (DEPENDENCY_MANAGER)

http://git-wip-us.apache.org/repos/asf/celix/blob/9203fddd/dependency_manager/private/include/dm_component_impl.h
----------------------------------------------------------------------
diff --git a/dependency_manager/private/include/dm_component_impl.h b/dependency_manager/private/include/dm_component_impl.h
index 133ef06..ad742b8 100644
--- a/dependency_manager/private/include/dm_component_impl.h
+++ b/dependency_manager/private/include/dm_component_impl.h
@@ -60,7 +60,7 @@ struct dm_component {
     init_fpt callbackInit;
     start_fpt callbackStart;
     stop_fpt callbackStop;
-    destroy_fpt callbackDestroy;
+    deinit_fpt callbackDeinit;
 
     array_list_pt dependencies;
     pthread_mutex_t mutex;

http://git-wip-us.apache.org/repos/asf/celix/blob/9203fddd/dependency_manager/private/include/dm_dependency_manager_impl.h
----------------------------------------------------------------------
diff --git a/dependency_manager/private/include/dm_dependency_manager_impl.h b/dependency_manager/private/include/dm_dependency_manager_impl.h
new file mode 100644
index 0000000..8a0cae8
--- /dev/null
+++ b/dependency_manager/private/include/dm_dependency_manager_impl.h
@@ -0,0 +1,11 @@
+
+#ifndef CELIX_DM_DEPENDENCY_MANAGER_IMPL_H
+#define CELIX_DM_DEPENDENCY_MANAGER_IMPL_H
+
+struct dm_dependency_manager {
+    array_list_pt components;
+
+    pthread_mutex_t mutex;
+};
+
+#endif //CELIX_DM_DEPENDENCY_MANAGER_IMPL_H

http://git-wip-us.apache.org/repos/asf/celix/blob/9203fddd/dependency_manager/private/include/dm_server_impl.h
----------------------------------------------------------------------
diff --git a/dependency_manager/private/include/dm_server_impl.h b/dependency_manager/private/include/dm_server_impl.h
new file mode 100644
index 0000000..f54aece
--- /dev/null
+++ b/dependency_manager/private/include/dm_server_impl.h
@@ -0,0 +1,10 @@
+#include "dm_server.h"
+#include "dm_component.h"
+#include "dm_component_impl.h"
+#include "dm_dependency_manager_impl.h"
+
+celix_status_t dmServiceCreate(dm_server_pt * dmServ, bundle_context_pt context, struct dm_dependency_manager
*manager);
+celix_status_t dmServiceAddComponent(dm_server_pt dmServ, dm_component_pt component);
+celix_status_t dmServiceDestroy(dm_server_pt dmServ);
+celix_status_t dmService_getInfo(dm_server_pt dmServ, dm_info_pt info);
+

http://git-wip-us.apache.org/repos/asf/celix/blob/9203fddd/dependency_manager/private/include/dm_service_dependency_impl.h
----------------------------------------------------------------------
diff --git a/dependency_manager/private/include/dm_service_dependency_impl.h b/dependency_manager/private/include/dm_service_dependency_impl.h
index 1396f31..0f80cef 100644
--- a/dependency_manager/private/include/dm_service_dependency_impl.h
+++ b/dependency_manager/private/include/dm_service_dependency_impl.h
@@ -41,11 +41,13 @@ struct dm_service_dependency {
 	bool instanceBound;
 	bool required;
 
+	service_set_fpt set;
 	service_add_fpt add;
 	service_change_fpt change;
 	service_remove_fpt remove;
 	service_swap_fpt swap;
 
+	service_set_with_ref_fpt set_with_ref;
 	service_add_with_ref_fpt add_with_ref;
 	service_change_with_ref_fpt change_with_ref;
 	service_remove_with_ref_fpt remove_with_ref;
@@ -73,6 +75,7 @@ celix_status_t serviceDependency_setAvailable(dm_service_dependency_pt dependenc
 celix_status_t serviceDependency_setComponent(dm_service_dependency_pt dependency, dm_component_pt
component);
 //celix_status_t serviceDependency_removeComponent(dm_service_dependency_pt dependency, dm_component_pt
component);
 
+celix_status_t serviceDependency_invokeSet(dm_service_dependency_pt dependency, dm_event_pt
event);
 celix_status_t serviceDependency_invokeAdd(dm_service_dependency_pt dependency, dm_event_pt
event);
 celix_status_t serviceDependency_invokeChange(dm_service_dependency_pt dependency, dm_event_pt
event);
 celix_status_t serviceDependency_invokeRemove(dm_service_dependency_pt dependency, dm_event_pt
event);

http://git-wip-us.apache.org/repos/asf/celix/blob/9203fddd/dependency_manager/private/include/dm_shell_list_command.h
----------------------------------------------------------------------
diff --git a/dependency_manager/private/include/dm_shell_list_command.h b/dependency_manager/private/include/dm_shell_list_command.h
new file mode 100644
index 0000000..28482e0
--- /dev/null
+++ b/dependency_manager/private/include/dm_shell_list_command.h
@@ -0,0 +1,34 @@
+/**
+ *Licensed to the Apache Software Foundation (ASF) under one
+ *or more contributor license agreements.  See the NOTICE file
+ *distributed with this work for additional information
+ *regarding copyright ownership.  The ASF licenses this file
+ *to you under the Apache License, Version 2.0 (the
+ *"License"); you may not use this file except in compliance
+ *with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *Unless required by applicable law or agreed to in writing,
+ *software distributed under the License is distributed on an
+ *"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ *specific language governing permissions and limitations
+ *under the License.
+ */
+/*
+ * help_command.c
+ *
+ *  \date       Aug 20, 2010
+ *  \author    	<a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
+ *  \copyright	Apache License, Version 2.0
+ */
+#include <stdlib.h>
+#include <string.h>
+
+#include "command_impl.h"
+
+char * dmListCommand_getName(command_pt command);
+char * dmListCommand_getUsage(command_pt command);
+char * dmListCommand_getShortDescription(command_pt command);
+void dmListCommand_execute(command_pt command, char * line, void (*out)(char *), void (*err)(char
*));
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/celix/blob/9203fddd/dependency_manager/private/src/dm_activator_base.c
----------------------------------------------------------------------
diff --git a/dependency_manager/private/src/dm_activator_base.c b/dependency_manager/private/src/dm_activator_base.c
index a97194e..1c00ab1 100644
--- a/dependency_manager/private/src/dm_activator_base.c
+++ b/dependency_manager/private/src/dm_activator_base.c
@@ -30,11 +30,14 @@
 
 #include "bundle_activator.h"
 #include "dm_activator_base.h"
-
+#include "dm_server.h"
+#include "dm_server_impl.h"
 
 struct dm_dependency_activator_base {
 	dm_dependency_manager_pt manager;
 	bundle_context_pt context;
+	dm_service_pt dmService;
+	service_registration_pt reg;
 	void* userData;
 };
 
@@ -67,6 +70,11 @@ celix_status_t bundleActivator_start(void * userData, bundle_context_pt
context)
 		dm_init(dependency_activator->userData, context, dependency_activator->manager);
 	}
 
+	//Create the service
+	dependency_activator->dmService = calloc(sizeof(*(dependency_activator->dmService)),
1);
+	dependency_activator->dmService->getInfo = dmService_getInfo;
+	dmServiceCreate(&(dependency_activator->dmService->server), context, dependency_activator->manager);
+	bundleContext_registerService(context, DM_SERVICE_NAME, dependency_activator->dmService,
NULL, &(dependency_activator->reg));
 	return status;
 }
 
@@ -74,12 +82,18 @@ celix_status_t bundleActivator_stop(void * userData, bundle_context_pt
context _
 	celix_status_t status = CELIX_SUCCESS;
 	dependency_activator_base_pt dependency_activator = (dependency_activator_base_pt) userData;
 
-	dm_deinit(dependency_activator->userData, dependency_activator->context, dependency_activator->manager);
+	dm_destroy(dependency_activator->userData, dependency_activator->context, dependency_activator->manager);
 
 	dependencyManager_destroy(&dependency_activator->manager);
 
+	// Remove the service
+	serviceRegistration_unregister(dependency_activator->reg);
+	dmServiceDestroy(dependency_activator->dmService->server);
+	free(dependency_activator->dmService);
+
 	dependency_activator->userData = NULL;
 	dependency_activator->manager = NULL;
+	dependency_activator->dmService = NULL;
 
 	return status;
 }
@@ -88,8 +102,6 @@ celix_status_t bundleActivator_destroy(void * userData, bundle_context_pt
contex
 	celix_status_t status = CELIX_SUCCESS;
 	dependency_activator_base_pt dependency_activator = (dependency_activator_base_pt) userData;
 
-	dm_destroy(dependency_activator->userData, dependency_activator->context, dependency_activator->manager);
-
 	free(dependency_activator);
 
 	return status;

http://git-wip-us.apache.org/repos/asf/celix/blob/9203fddd/dependency_manager/private/src/dm_component_impl.c
----------------------------------------------------------------------
diff --git a/dependency_manager/private/src/dm_component_impl.c b/dependency_manager/private/src/dm_component_impl.c
index 72fe7eb..801d426 100644
--- a/dependency_manager/private/src/dm_component_impl.c
+++ b/dependency_manager/private/src/dm_component_impl.c
@@ -27,7 +27,10 @@
 #include <stdarg.h>
 #include <stdlib.h>
 #include <string.h>
+#include <limits.h>
 
+#include "constants.h"
+#include "filter.h"
 #include "dm_component_impl.h"
 #include "../../../framework/private/include/framework_private.h"
 
@@ -109,7 +112,7 @@ celix_status_t component_create(bundle_context_pt context, dm_dependency_manager
         (*component)->callbackInit = NULL;
         (*component)->callbackStart = NULL;
         (*component)->callbackStop = NULL;
-        (*component)->callbackDestroy = NULL;
+        (*component)->callbackDeinit = NULL;
 
 
         arrayList_create(&(*component)->dependencies);
@@ -362,6 +365,7 @@ celix_status_t component_handleAdded(dm_component_pt component, dm_service_depen
 
     serviceDependency_setAvailable(dependency, true);
 
+    serviceDependency_invokeSet(dependency, event);
     switch (component->state) {
         case DM_CMP_STATE_WAITING_FOR_REQUIRED: {
             bool required = false;
@@ -418,6 +422,7 @@ celix_status_t component_handleChanged(dm_component_pt component, dm_service_dep
         arrayList_add(events, event);
         pthread_mutex_unlock(&component->mutex);
 
+        serviceDependency_invokeSet(dependency, event);
         switch (component->state) {
             case DM_CMP_STATE_TRACKING_OPTIONAL:
                 serviceDependency_invokeChange(dependency, event);
@@ -467,6 +472,8 @@ celix_status_t component_handleRemoved(dm_component_pt component, dm_service_dep
         dm_event_pt old = arrayList_remove(events, (unsigned int) index);
         pthread_mutex_unlock(&component->mutex);
 
+        serviceDependency_invokeSet(dependency, event);
+
         switch (component->state) {
             case DM_CMP_STATE_INSTANTIATED_AND_WAITING_FOR_REQUIRED: {
                 bool instanceBound = false;
@@ -515,6 +522,8 @@ celix_status_t component_handleSwapped(dm_component_pt component, dm_service_dep
         arrayList_add(events, newEvent);
         pthread_mutex_unlock(&component->mutex);
 
+        serviceDependency_invokeSet(dependency, event);
+
         switch (component->state) {
             case DM_CMP_STATE_WAITING_FOR_REQUIRED:
                 break;
@@ -746,8 +755,8 @@ celix_status_t component_performTransition(dm_component_pt component,
dm_compone
     }
 
     if (oldState == DM_CMP_STATE_INSTANTIATED_AND_WAITING_FOR_REQUIRED && newState
== DM_CMP_STATE_WAITING_FOR_REQUIRED) {
-    	if (component->callbackDestroy) {
-    		component->callbackDestroy(component->implementation);
+    	if (component->callbackDeinit) {
+    		component->callbackDeinit(component->implementation);
     	}
         component_invokeRemoveRequiredDependencies(component);
 //            #TODO Add listener support
@@ -1119,14 +1128,14 @@ celix_status_t component_unregisterService(dm_component_pt component)
{
     return status;
 }
 
-celix_status_t component_setCallbacks(dm_component_pt component, init_fpt init, start_fpt
start, stop_fpt stop, destroy_fpt destroy) {
+celix_status_t component_setCallbacks(dm_component_pt component, init_fpt init, start_fpt
start, stop_fpt stop, deinit_fpt deinit) {
 	if (component->active) {
 		return CELIX_ILLEGAL_STATE;
 	}
 	component->callbackInit = init;
 	component->callbackStart = start;
 	component->callbackStop = stop;
-	component->callbackDestroy = destroy;
+	component->callbackDeinit = deinit;
 	return CELIX_SUCCESS;
 }
 

http://git-wip-us.apache.org/repos/asf/celix/blob/9203fddd/dependency_manager/private/src/dm_dependency_manager_impl.c
----------------------------------------------------------------------
diff --git a/dependency_manager/private/src/dm_dependency_manager_impl.c b/dependency_manager/private/src/dm_dependency_manager_impl.c
index 28b49e9..265ecf0 100644
--- a/dependency_manager/private/src/dm_dependency_manager_impl.c
+++ b/dependency_manager/private/src/dm_dependency_manager_impl.c
@@ -31,12 +31,8 @@
 
 #include "bundle_context.h"
 #include "dm_component_impl.h"
+#include "dm_dependency_manager_impl.h"
 
-struct dm_dependency_manager {
-	array_list_pt components;
-
-	pthread_mutex_t mutex;
-};
 
 celix_status_t dependencyManager_create(bundle_context_pt context __attribute__((unused)),
dm_dependency_manager_pt *manager) {
 	celix_status_t status = CELIX_ENOMEM;

http://git-wip-us.apache.org/repos/asf/celix/blob/9203fddd/dependency_manager/private/src/dm_server.c
----------------------------------------------------------------------
diff --git a/dependency_manager/private/src/dm_server.c b/dependency_manager/private/src/dm_server.c
new file mode 100644
index 0000000..7f86d8d
--- /dev/null
+++ b/dependency_manager/private/src/dm_server.c
@@ -0,0 +1,71 @@
+#include <stdlib.h>
+
+#include "array_list.h"
+
+#include "dm_server.h"
+#include "dm_component.h"
+#include "dm_component_impl.h"
+#include "dm_dependency_manager_impl.h"
+
+struct dm_server {
+    struct dm_dependency_manager *manager;
+};
+
+celix_status_t dmServiceCreate(dm_server_pt * dmServ, bundle_context_pt context, struct dm_dependency_manager
*manager) {
+    *dmServ = calloc(sizeof(struct dm_server), 1);
+    (*dmServ)->manager = manager;
+    return CELIX_SUCCESS;
+}
+
+celix_status_t dmServiceDestroy(dm_server_pt dmServ) {
+    free(dmServ);
+    return CELIX_SUCCESS;
+}
+
+celix_status_t dmService_getInfo(dm_server_pt dmServ, dm_info_pt info) {
+    int compCnt;
+    arrayList_create(&(info->components));
+    array_list_pt  compList = dmServ->manager->components;
+
+    for (compCnt = 0; compCnt < arrayList_size(compList); compCnt++) {
+        int i;
+        struct dm_component *component = arrayList_get(compList, compCnt);
+
+        // Create a component info
+        dm_component_info_pt compInfo = calloc(sizeof(*compInfo),1);
+        arrayList_create(&(compInfo->interface_list));
+        arrayList_create(&(compInfo->dependency_list));
+
+        //Fill in the fields of the component
+        char *outstr;
+        asprintf(&outstr, "%p",component->implementation);
+        compInfo->id = outstr;
+        compInfo->active = component->active;
+
+        array_list_pt interfaces = component->dm_interface;
+        array_list_pt dependencies = component->dependencies;
+
+        for(i = 0; i < arrayList_size(interfaces); i++) {
+            dm_interface * interface = arrayList_get(interfaces, i);
+            arrayList_add(compInfo->interface_list, strdup(interface->serviceName));
+        }
+
+        for(i = 0; i < arrayList_size(dependencies); i++) {
+            dm_service_dependency_pt  dependency = arrayList_get(dependencies, i);
+
+            dependency_info_pt depInfo = calloc(sizeof(*depInfo), 1);
+            depInfo->available = dependency->available;
+            depInfo->required = dependency->required;
+            if(dependency->tracked_filter) {
+                depInfo->interface  = strdup(dependency->tracked_filter);
+            } else {
+                depInfo->interface = strdup(dependency->tracked_service_name);
+            }
+            arrayList_add(compInfo->dependency_list, depInfo);
+        }
+
+        arrayList_add(info->components, compInfo);
+    }
+
+    return CELIX_SUCCESS;
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/celix/blob/9203fddd/dependency_manager/private/src/dm_service_dependency.c
----------------------------------------------------------------------
diff --git a/dependency_manager/private/src/dm_service_dependency.c b/dependency_manager/private/src/dm_service_dependency.c
index 8f65ddb..f89dc94 100644
--- a/dependency_manager/private/src/dm_service_dependency.c
+++ b/dependency_manager/private/src/dm_service_dependency.c
@@ -27,12 +27,15 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
+#include <limits.h>
 
 #include "constants.h"
 
 #include "dm_service_dependency_impl.h"
 #include "dm_component_impl.h"
 
+#define DEFAULT_RANKING     0
+
 static celix_status_t serviceDependency_addedService(void *_ptr, service_reference_pt reference,
void *service);
 static celix_status_t serviceDependency_modifiedService(void *_ptr, service_reference_pt
reference, void *service);
 static celix_status_t serviceDependency_removedService(void *_ptr, service_reference_pt reference,
void *service);
@@ -49,6 +52,7 @@ celix_status_t serviceDependency_create(dm_service_dependency_pt *dependency_ptr
 		(*dependency_ptr)->instanceBound = false;
 		(*dependency_ptr)->required = false;
 
+		(*dependency_ptr)->set = NULL;
 		(*dependency_ptr)->add = NULL;
 		(*dependency_ptr)->change = NULL;
 		(*dependency_ptr)->remove = NULL;
@@ -146,7 +150,7 @@ celix_status_t serviceDependency_setService(dm_service_dependency_pt dependency,
 	return status;
 }
 
-celix_status_t serviceDependency_setCallbacks(dm_service_dependency_pt dependency, service_add_fpt
add, service_change_fpt change, service_remove_fpt remove, service_swap_fpt swap) {
+celix_status_t serviceDependency_setCallbacks(dm_service_dependency_pt dependency, service_set_fpt
set, service_add_fpt add, service_change_fpt change, service_remove_fpt remove, service_swap_fpt
swap) {
 	celix_status_t status = CELIX_SUCCESS;
 
 	if (!dependency) {
@@ -154,6 +158,7 @@ celix_status_t serviceDependency_setCallbacks(dm_service_dependency_pt
dependenc
 	}
 
 	if (status == CELIX_SUCCESS) {
+		dependency->set = set;
 		dependency->add = add;
 		dependency->change = change;
 		dependency->remove = remove;
@@ -163,7 +168,7 @@ celix_status_t serviceDependency_setCallbacks(dm_service_dependency_pt
dependenc
 	return status;
 }
 
-celix_status_t serviceDependency_setCallbacksWithServiceReference(dm_service_dependency_pt
dependency, service_add_with_ref_fpt add, service_change_with_ref_fpt change, service_remove_with_ref_fpt
remove, service_swap_with_ref_fpt swap) {
+celix_status_t serviceDependency_setCallbacksWithServiceReference(dm_service_dependency_pt
dependency, service_set_with_ref_fpt set, service_add_with_ref_fpt add, service_change_with_ref_fpt
change, service_remove_with_ref_fpt remove, service_swap_with_ref_fpt swap) {
 	celix_status_t status = CELIX_SUCCESS;
 
 	if (!dependency) {
@@ -171,6 +176,7 @@ celix_status_t serviceDependency_setCallbacksWithServiceReference(dm_service_dep
 	}
 
 	if (status == CELIX_SUCCESS) {
+		dependency->set_with_ref = set;
 		dependency->add_with_ref = add;
 		dependency->change_with_ref = change;
 		dependency->remove_with_ref = remove;
@@ -308,6 +314,62 @@ celix_status_t serviceDependency_setAvailable(dm_service_dependency_pt
dependenc
 
 	return status;
 }
+celix_status_t serviceDependency_invokeSet(dm_service_dependency_pt dependency, dm_event_pt
event) {
+	celix_status_t status = CELIX_SUCCESS;
+	array_list_pt serviceReferences = NULL;
+	int i;
+	int curRanking = INT_MIN;
+	service_reference_pt curServRef = NULL;
+	void *service = NULL;
+
+	serviceReferences = serviceTracker_getServiceReferences(dependency->tracker);
+
+	fprintf(stderr,"found %d servicereferences\n",arrayList_size(serviceReferences));
+	/* Find the service with the higest ranking */
+	for (i = 0; i < arrayList_size(serviceReferences); i++) {
+		service_reference_pt serviceReference = arrayList_get(serviceReferences, i);
+		char *ranking_value;
+		int ranking = 0;
+
+		status = serviceReference_getProperty(serviceReference, ((char *)OSGI_FRAMEWORK_SERVICE_RANKING),
&ranking_value);
+
+		if(status == CELIX_SUCCESS) {
+			if (ranking_value == NULL) {
+				ranking  = DEFAULT_RANKING;
+			} else {
+				char *end;
+				ranking = strtol(ranking_value, &end, 10);
+				if( end == ranking_value) {
+					ranking = DEFAULT_RANKING;
+				}
+			}
+
+			if (ranking > curRanking) {
+				curRanking = ranking;
+				curServRef = serviceReference;
+			}
+		} else {
+			return status;
+		}
+	}
+
+	if (curServRef) {
+		status = bundleContext_getService(event->context, curServRef, &service);
+	} else {
+		service = NULL;
+	}
+
+	fprintf(stderr, "Ranking found: %d service %p\n", curRanking, service);
+
+	if (dependency->set) {
+		dependency->set(dependency->component->implementation, service);
+	}
+	if (dependency->set_with_ref) {
+		dependency->set_with_ref(dependency->component->implementation, curServRef, service);
+	}
+
+	return status;
+}
 
 celix_status_t serviceDependency_invokeAdd(dm_service_dependency_pt dependency, dm_event_pt
event) {
 	celix_status_t status = CELIX_SUCCESS;

http://git-wip-us.apache.org/repos/asf/celix/blob/9203fddd/dependency_manager/private/src/dm_shell_activator.c
----------------------------------------------------------------------
diff --git a/dependency_manager/private/src/dm_shell_activator.c b/dependency_manager/private/src/dm_shell_activator.c
new file mode 100644
index 0000000..28b4784
--- /dev/null
+++ b/dependency_manager/private/src/dm_shell_activator.c
@@ -0,0 +1,72 @@
+#include "bundle_context.h"
+#include "service_registration.h"
+#include "command.h"
+
+#include "dm_shell_list_command.h"
+
+struct bundle_instance {
+    service_registration_pt reg;
+    command_pt dmListCmd;
+};
+
+typedef struct bundle_instance * bundle_instance_pt;
+
+celix_status_t bundleActivator_create(bundle_context_pt context, void **userData) {
+
+    struct bundle_instance *bi = calloc(sizeof (struct bundle_instance), 1);
+    celix_status_t status = CELIX_SUCCESS;
+
+    if (!bi) {
+        status = CELIX_ENOMEM;
+    }
+    else if (userData == NULL) {
+        status = CELIX_ILLEGAL_ARGUMENT;
+        free(bi);
+    }
+    else {
+        if (status != CELIX_SUCCESS) {
+            printf("DM:LIST Create failed\n");
+            free(bi);
+        }
+
+        (*userData) = bi;
+    }
+
+    return status;
+}
+
+celix_status_t bundleActivator_start(void * userData, bundle_context_pt context) {
+    celix_status_t status = CELIX_SUCCESS;
+    bundle_instance_pt bi = (bundle_instance_pt) userData;
+    command_service_pt commandService = calloc(1, sizeof(*commandService));
+
+    command_pt command = calloc(sizeof(*command),1);
+    command->executeCommand = dmListCommand_execute;
+    command->bundleContext = context;
+    command->handle = NULL;
+    command->name ="dm:list";
+    command->shortDescription ="not_used";
+    command->usage="not_used";
+
+    commandService->getName             = dmListCommand_getName;
+    commandService->command             = command;
+    commandService->executeCommand      = dmListCommand_execute;
+    commandService->getShortDescription = dmListCommand_getShortDescription;
+    commandService->getUsage            = dmListCommand_getUsage;
+
+    bundleContext_registerService(context, (char *) OSGI_SHELL_COMMAND_SERVICE_NAME, commandService,
NULL, &bi->reg);
+
+    return status;
+}
+
+celix_status_t bundleActivator_stop(void * userData, bundle_context_pt context) {
+    bundle_instance_pt bi = (bundle_instance_pt) userData;
+    serviceRegistration_unregister(bi->reg);
+    return CELIX_SUCCESS;
+}
+
+celix_status_t bundleActivator_destroy(void * userData, bundle_context_pt context) {
+    free(userData);
+    return CELIX_SUCCESS;
+}
+

http://git-wip-us.apache.org/repos/asf/celix/blob/9203fddd/dependency_manager/private/src/dm_shell_list_command.c
----------------------------------------------------------------------
diff --git a/dependency_manager/private/src/dm_shell_list_command.c b/dependency_manager/private/src/dm_shell_list_command.c
new file mode 100644
index 0000000..06e5968
--- /dev/null
+++ b/dependency_manager/private/src/dm_shell_list_command.c
@@ -0,0 +1,101 @@
+/**
+ *Licensed to the Apache Software Foundation (ASF) under one
+ *or more contributor license agreements.  See the NOTICE file
+ *distributed with this work for additional information
+ *regarding copyright ownership.  The ASF licenses this file
+ *to you under the Apache License, Version 2.0 (the
+ *"License"); you may not use this file except in compliance
+ *with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *Unless required by applicable law or agreed to in writing,
+ *software distributed under the License is distributed on an
+ *"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ *specific language governing permissions and limitations
+ *under the License.
+ */
+/*
+ * help_command.c
+ *
+ *  \date       Aug 20, 2010
+ *  \author    	<a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
+ *  \copyright	Apache License, Version 2.0
+ */
+#include <stdlib.h>
+#include <string.h>
+#include "dm_server.h"
+#include "service_reference.h"
+#include "command_impl.h"
+#include "array_list.h"
+#include "bundle_context.h"
+#include "bundle.h"
+#include "shell.h"
+
+
+void dmListCommand_execute(command_pt command, char * line, void (*out)(char *), void (*err)(char
*));
+
+
+char * dmListCommand_getName(command_pt command) {
+    return "dm:list";
+}
+
+char * dmListCommand_getUsage(command_pt command) {
+    return "dm:list";
+}
+
+char * dmListCommand_getShortDescription(command_pt command) {
+    return "Get an overview of the dependency-managed components with their dependencies.";
+}
+
+void dmListCommand_execute(command_pt command, char * line, void (*out)(char *), void (*err)(char
*)) {
+    char outString[256];
+    array_list_pt servRefs = NULL;
+    int i;
+    bundleContext_getServiceReferences(command->bundleContext, DM_SERVICE_NAME ,NULL,
&servRefs);
+
+    for(i = 0; i < arrayList_size(servRefs); i++) {
+        struct dm_info info;
+        dm_service_pt dmService = NULL;
+        service_reference_pt servRef = NULL;
+        servRef = arrayList_get(servRefs, i);
+        bundleContext_getService(command->bundleContext,  servRef, (void**)&dmService);
+        dmService->getInfo(dmService->server, &info);
+
+        int cmpCnt;
+        for (cmpCnt = 0; cmpCnt < arrayList_size(info.components); cmpCnt++) {
+            dm_component_info_pt compInfo = arrayList_get(info.components, cmpCnt);
+            sprintf(outString, "Component: ID=%s, Active=%s\n", compInfo->id, compInfo->active
? "true" : "false");
+            out(outString);
+
+            int interfCnt;
+            sprintf(outString, "    Interfaces (%d):\n", arrayList_size(compInfo->interface_list));
+            out(outString);
+            for(interfCnt = 0 ;interfCnt < arrayList_size(compInfo->interface_list);
interfCnt++) {
+                char * interface;
+                interface = arrayList_get(compInfo->interface_list, interfCnt);
+                sprintf(outString, "        Interface: %s\n", interface);
+                out(outString);
+                free(interface);
+            }
+            arrayList_destroy(compInfo->interface_list);
+
+            int depCnt;
+            sprintf(outString, "    Dependencies (%d):\n", arrayList_size(compInfo->dependency_list));
+            out(outString);
+            for(depCnt = 0 ;depCnt < arrayList_size(compInfo->dependency_list); depCnt++)
{
+                dependency_info_pt dependency;
+                dependency = arrayList_get(compInfo->dependency_list, depCnt);
+                sprintf(outString, "         Dependency: Available = %s, Required = %s, Filter
= %s\n",
+                        dependency->available? "true" : "false" ,
+                        dependency->required ? "true" : "false",
+                        dependency->interface);
+                out(outString);
+                free(dependency->interface);
+                free(dependency);
+            }
+            arrayList_destroy(compInfo->dependency_list);
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/celix/blob/9203fddd/dependency_manager/public/include/dm_component.h
----------------------------------------------------------------------
diff --git a/dependency_manager/public/include/dm_component.h b/dependency_manager/public/include/dm_component.h
index f98c3bb..6b875b2 100644
--- a/dependency_manager/public/include/dm_component.h
+++ b/dependency_manager/public/include/dm_component.h
@@ -38,7 +38,7 @@ typedef struct dm_component *dm_component_pt;
 typedef celix_status_t (*init_fpt)(void *userData);
 typedef celix_status_t (*start_fpt)(void *userData);
 typedef celix_status_t (*stop_fpt)(void *userData);
-typedef celix_status_t (*destroy_fpt)(void *userData);
+typedef celix_status_t (*deinit_fpt)(void *userData);
 
 celix_status_t component_create(bundle_context_pt context, dm_dependency_manager_pt manager,
dm_component_pt *component);
 celix_status_t component_destroy(dm_component_pt *component);
@@ -49,6 +49,6 @@ celix_status_t component_setImplementation(dm_component_pt component, void
*impl
 celix_status_t component_addServiceDependency(dm_component_pt component, ...);
 celix_status_t component_removeServiceDependency(dm_component_pt component, dm_service_dependency_pt
dependency);
 
-celix_status_t component_setCallbacks(dm_component_pt component, init_fpt init, start_fpt
start, stop_fpt, destroy_fpt);
+celix_status_t component_setCallbacks(dm_component_pt component, init_fpt init, start_fpt
start, stop_fpt stop, deinit_fpt deinit);
 
 #endif /* COMPONENT_H_ */

http://git-wip-us.apache.org/repos/asf/celix/blob/9203fddd/dependency_manager/public/include/dm_server.h
----------------------------------------------------------------------
diff --git a/dependency_manager/public/include/dm_server.h b/dependency_manager/public/include/dm_server.h
new file mode 100644
index 0000000..fa8da78
--- /dev/null
+++ b/dependency_manager/public/include/dm_server.h
@@ -0,0 +1,36 @@
+
+#ifndef CELIX_DM_SERVICE_H
+#define CELIX_DM_SERVICE_H
+
+#include "bundle_context.h"
+
+#define DM_SERVICE_NAME "dm_server"
+
+typedef struct dm_server * dm_server_pt;
+
+typedef struct dependency_info {
+    char *interface;
+    bool available;
+    bool required;
+} * dependency_info_pt;
+
+typedef struct dm_component_info {
+    char *id;
+    bool active;
+    array_list_pt interface_list;       // type char*
+    array_list_pt dependency_list;  // type interface_info_pt
+} * dm_component_info_pt;
+
+typedef struct dm_info {
+    array_list_pt  components;      // type dm_component_info
+} * dm_info_pt;
+
+struct dm_service {
+    dm_server_pt server;
+    celix_status_t (*getInfo)(dm_server_pt server, dm_info_pt info);
+};
+
+typedef struct dm_service * dm_service_pt;
+
+
+#endif //CELIX_DM_SERVICE_H

http://git-wip-us.apache.org/repos/asf/celix/blob/9203fddd/dependency_manager/public/include/dm_service_dependency.h
----------------------------------------------------------------------
diff --git a/dependency_manager/public/include/dm_service_dependency.h b/dependency_manager/public/include/dm_service_dependency.h
index e9a5513..f267ab7 100644
--- a/dependency_manager/public/include/dm_service_dependency.h
+++ b/dependency_manager/public/include/dm_service_dependency.h
@@ -33,11 +33,13 @@ typedef struct dm_service_dependency *dm_service_dependency_pt;
 
 #include "dm_component.h"
 
+typedef celix_status_t (*service_set_fpt)(void *handle, void *service);
 typedef celix_status_t (*service_add_fpt)(void *handle, void *service);
 typedef celix_status_t (*service_change_fpt)(void *handle, void *service);
 typedef celix_status_t (*service_remove_fpt)(void *handle, void *service);
 typedef celix_status_t (*service_swap_fpt)(void *handle, void *oldService, void *newService);
 
+typedef celix_status_t (*service_set_with_ref_fpt)(void *handle, service_reference_pt reference,
void *service);
 typedef celix_status_t (*service_add_with_ref_fpt)(void *handle, service_reference_pt reference,
void *service);
 typedef celix_status_t (*service_change_with_ref_fpt)(void *handle, service_reference_pt
reference, void *service);
 typedef celix_status_t (*service_remove_with_ref_fpt)(void *handle, service_reference_pt
reference, void *service);
@@ -48,8 +50,8 @@ celix_status_t serviceDependency_destroy(dm_service_dependency_pt *dependency_pt
 
 celix_status_t serviceDependency_setRequired(dm_service_dependency_pt dependency, bool required);
 celix_status_t serviceDependency_setService(dm_service_dependency_pt dependency, char *serviceName,
char *filter);
-celix_status_t serviceDependency_setCallbacks(dm_service_dependency_pt dependency, service_add_fpt
add, service_change_fpt change, service_remove_fpt remove, service_swap_fpt swap);
-celix_status_t serviceDependency_setCallbacksWithServiceReference(dm_service_dependency_pt
dependency, service_add_with_ref_fpt add, service_change_with_ref_fpt change, service_remove_with_ref_fpt
remove, service_swap_with_ref_fpt swap);
+celix_status_t serviceDependency_setCallbacks(dm_service_dependency_pt dependency, service_set_fpt
set, service_add_fpt add, service_change_fpt change, service_remove_fpt remove, service_swap_fpt
swap);
+celix_status_t serviceDependency_setCallbacksWithServiceReference(dm_service_dependency_pt
dependency, service_set_with_ref_fpt set, service_add_with_ref_fpt add, service_change_with_ref_fpt
change, service_remove_with_ref_fpt remove, service_swap_with_ref_fpt swap);
 celix_status_t serviceDependency_setAutoConfigure(dm_service_dependency_pt dependency, celix_thread_mutex_t
*service_lock, void **field);
 
 #endif /* DM_SERVICE_DEPENDENCY_H_ */

http://git-wip-us.apache.org/repos/asf/celix/blob/9203fddd/examples/deploy.cmake
----------------------------------------------------------------------
diff --git a/examples/deploy.cmake b/examples/deploy.cmake
index a8d97a1..24c7a11 100644
--- a/examples/deploy.cmake
+++ b/examples/deploy.cmake
@@ -22,7 +22,7 @@ if (EXAMPLES)
 	
 	deploy("hello_world" BUNDLES shell shell_tui apache_celix_examples_hello_world hello_world_test
log_service log_writer)
 	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 dm_shell)
 	deploy("echo" BUNDLES echo_server echo_client shell shell_tui)
 	deploy("producer_consumer" BUNDLES producer consumer database shell shell_tui)
 	if (NOT ANDROID)

http://git-wip-us.apache.org/repos/asf/celix/blob/9203fddd/examples/whiteboard/publisherA/private/src/activator.c
----------------------------------------------------------------------
diff --git a/examples/whiteboard/publisherA/private/src/activator.c b/examples/whiteboard/publisherA/private/src/activator.c
index fd749d0..663b0b9 100644
--- a/examples/whiteboard/publisherA/private/src/activator.c
+++ b/examples/whiteboard/publisherA/private/src/activator.c
@@ -24,6 +24,7 @@
  *  \copyright	Apache License, Version 2.0
  */
 #include <stdlib.h>
+#include <constants.h>
 
 #include "bundle_activator.h"
 #include "publisher_private.h"
@@ -53,6 +54,7 @@ celix_status_t bundleActivator_start(void * userData, bundle_context_pt
context)
 
 	props = properties_create();
 	properties_set(props, "id", "A");
+	properties_set(props,(char*)OSGI_FRAMEWORK_SERVICE_RANKING , "10");
 
 	status = bundleContext_registerService(context, PUBLISHER_NAME, data->ps, props, &data->reg);
 	if (status != CELIX_SUCCESS) {

http://git-wip-us.apache.org/repos/asf/celix/blob/9203fddd/examples/whiteboard/publisherB/private/src/activator.c
----------------------------------------------------------------------
diff --git a/examples/whiteboard/publisherB/private/src/activator.c b/examples/whiteboard/publisherB/private/src/activator.c
index 06fea8d..f5f1a2e 100644
--- a/examples/whiteboard/publisherB/private/src/activator.c
+++ b/examples/whiteboard/publisherB/private/src/activator.c
@@ -24,6 +24,7 @@
  *  \copyright	Apache License, Version 2.0
  */
 #include <stdlib.h>
+#include <constants.h>
 
 #include "bundle_activator.h"
 #include "publisher_private.h"
@@ -52,6 +53,7 @@ celix_status_t bundleActivator_start(void * userData, bundle_context_pt
context)
 	data->reg = NULL;
 
 	properties_set(props, "id", "B");
+	properties_set(props,(char*)OSGI_FRAMEWORK_SERVICE_RANKING , "20");
 
 	bundleContext_registerService(context, PUBLISHER_NAME, data->ps, props, &data->reg);
     return status;

http://git-wip-us.apache.org/repos/asf/celix/blob/9203fddd/examples/whiteboard/tracker_depman/private/include/tracker.h
----------------------------------------------------------------------
diff --git a/examples/whiteboard/tracker_depman/private/include/tracker.h b/examples/whiteboard/tracker_depman/private/include/tracker.h
index 5918e91..3b078ca 100644
--- a/examples/whiteboard/tracker_depman/private/include/tracker.h
+++ b/examples/whiteboard/tracker_depman/private/include/tracker.h
@@ -44,10 +44,12 @@ struct data {
 	celix_thread_mutex_t publisher_lock;
 };
 
+celix_status_t tracker_setServ(void * handle, service_reference_pt ref, void * service);
 celix_status_t tracker_addedServ(void * handle, service_reference_pt ref, void * service);
 celix_status_t tracker_modifiedServ(void * handle, service_reference_pt ref, void * service);
 celix_status_t tracker_removedServ(void * handle, service_reference_pt ref, void * service);
 
+celix_status_t tracker_setLog(void * handle, service_reference_pt ref, void * service);
 celix_status_t tracker_addLog(void * handle, service_reference_pt ref, void * service);
 celix_status_t tracker_modifiedLog(void * handle, service_reference_pt ref, void * service);
 celix_status_t tracker_removeLog(void * handle, service_reference_pt ref, void * service);
@@ -55,7 +57,7 @@ celix_status_t tracker_removeLog(void * handle, service_reference_pt ref,
void *
 celix_status_t service_init(void * userData);
 celix_status_t service_start(void * userData);
 celix_status_t service_stop(void * userData);
-celix_status_t service_destroy(void * userData);
+celix_status_t service_deinit(void * userData);
 
 
 #endif /* TRACKER_H_ */

http://git-wip-us.apache.org/repos/asf/celix/blob/9203fddd/examples/whiteboard/tracker_depman/private/src/dependency_activator.c
----------------------------------------------------------------------
diff --git a/examples/whiteboard/tracker_depman/private/src/dependency_activator.c b/examples/whiteboard/tracker_depman/private/src/dependency_activator.c
index 84194f8..5dd8d1e 100644
--- a/examples/whiteboard/tracker_depman/private/src/dependency_activator.c
+++ b/examples/whiteboard/tracker_depman/private/src/dependency_activator.c
@@ -49,30 +49,30 @@ celix_status_t dm_init(void * userData, bundle_context_pt context, dm_dependency
 	printf("Init\n");
 	struct data * data = (struct data *) userData;
 	dm_component_pt service = NULL;
-	dm_service_dependency_pt dep = NULL;
+	dm_service_dependency_pt dep1 = NULL;
 	dm_service_dependency_pt dep2 = NULL;
 
 	data->context = context;
 
 	component_create(context, manager, &service);
 	component_setImplementation(service, data);
-	component_setCallbacks(service, service_init, service_start, service_stop, service_destroy);
+	component_setCallbacks(service, service_init, service_start, service_stop, service_deinit);
 
-	serviceDependency_create(&dep);
-	serviceDependency_setRequired(dep, false);
-	serviceDependency_setService(dep, PUBLISHER_NAME, "(|(id=A)(id=B))");
-	serviceDependency_setCallbacksWithServiceReference(dep, tracker_addedServ, tracker_modifiedServ,
tracker_removedServ, NULL);
-	component_addServiceDependency(service, dep, NULL);
+	serviceDependency_create(&dep1);
+	serviceDependency_setRequired(dep1, true);
+	serviceDependency_setService(dep1, PUBLISHER_NAME, "(|(id=A)(id=B))");
+	serviceDependency_setCallbacksWithServiceReference(dep1, NULL /*tracker_setServ*/, tracker_addedServ,
tracker_modifiedServ, tracker_removedServ, NULL);
+	component_addServiceDependency(service, dep1, NULL);
 
 	serviceDependency_create(&dep2);
     serviceDependency_setRequired(dep2, false);
     serviceDependency_setService(dep2, (char *) OSGI_LOGSERVICE_NAME, NULL);
-    serviceDependency_setCallbacksWithServiceReference(dep2, tracker_addLog, tracker_modifiedLog,
tracker_removeLog, NULL);
+    serviceDependency_setCallbacksWithServiceReference(dep2, NULL  /*tracker_setLog*/, tracker_addLog,
tracker_modifiedLog, tracker_removeLog, NULL);
 	serviceDependency_setAutoConfigure(dep2, &data->logger_lock, (void **) &data->logger);
     component_addServiceDependency(service, dep2, NULL);
 
 	data->service = service;
-	data->dep = dep;
+	data->dep = dep1;
 	data->dep2 = dep2;
 
 	dependencyManager_add(manager, service);

http://git-wip-us.apache.org/repos/asf/celix/blob/9203fddd/examples/whiteboard/tracker_depman/private/src/tracker.c
----------------------------------------------------------------------
diff --git a/examples/whiteboard/tracker_depman/private/src/tracker.c b/examples/whiteboard/tracker_depman/private/src/tracker.c
index 2605609..0ada638 100644
--- a/examples/whiteboard/tracker_depman/private/src/tracker.c
+++ b/examples/whiteboard/tracker_depman/private/src/tracker.c
@@ -56,12 +56,13 @@ static void *dp_send(void *handle) {
 }
 
 celix_status_t service_init(void * userData) {
+	fprintf(stderr, "Service init");
 	return CELIX_SUCCESS;
 }
 
 celix_status_t service_start(void * userData) {
 	struct data * data = (struct data *) userData;
-
+	fprintf(stderr, "Service started");
 	data->running = true;
 	pthread_create(&data->sender, NULL, dp_send, data);
 	return CELIX_SUCCESS;
@@ -69,15 +70,23 @@ celix_status_t service_start(void * userData) {
 
 celix_status_t service_stop(void * userData) {
 	struct data * data = (struct data *) userData;
+	fprintf(stderr, "Service stopped");
 	data->running = false;
 	pthread_join(data->sender, NULL);
 	return CELIX_SUCCESS;
 }
 
-celix_status_t service_destroy(void * userData) {
+celix_status_t service_deinit(void * userData) {
+	fprintf(stderr, "Service deinit");
+	return CELIX_SUCCESS;
+}
+
+celix_status_t tracker_setServ(void * handle, service_reference_pt ref, void * service) {
+	printf("Service Set %p\n", service);
 	return CELIX_SUCCESS;
 }
 
+
 celix_status_t tracker_addedServ(void * handle, service_reference_pt ref, void * service)
{
 	struct data * data = (struct data *) handle;
 	arrayList_add(data->publishers, service);
@@ -97,9 +106,21 @@ celix_status_t tracker_removedServ(void * handle, service_reference_pt
ref, void
 	return CELIX_SUCCESS;
 }
 
+celix_status_t tracker_setLog(void *handle, service_reference_pt ref, void *service) {
+	struct data * data = (struct data *) handle;
+
+	printf("SET log %p\n", service);
+	if(service) {
+		data->logger = service;
+		((log_service_pt) service)->log(((log_service_pt) service)->logger, OSGI_LOGSERVICE_DEBUG,
"SET log");
+	}
+	fprintf(stderr, "SET end %p\n", service);
+	return CELIX_SUCCESS;
+}
+
 celix_status_t tracker_addLog(void *handle, service_reference_pt ref, void *service) {
     struct data * data = (struct data *) handle;
-    printf("Add log\n");
+    printf("Add log %p\n", service);
     data->logger = service;
     ((log_service_pt) service)->log(((log_service_pt) service)->logger, OSGI_LOGSERVICE_DEBUG,
"test");
     return CELIX_SUCCESS;


Mime
View raw message