celix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bpe...@apache.org
Subject celix git commit: CELIX-326: Add service version support to dependency manager
Date Tue, 15 Dec 2015 08:19:55 GMT
Repository: celix
Updated Branches:
  refs/heads/develop 82933b2b5 -> f2417eace


CELIX-326: Add service version support to dependency manager


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

Branch: refs/heads/develop
Commit: f2417eace630496e9207603ad359eeb5910a6423
Parents: 82933b2
Author: Bjoern Petri <bpetri@apache.org>
Authored: Tue Dec 15 09:19:19 2015 +0100
Committer: Bjoern Petri <bpetri@apache.org>
Committed: Tue Dec 15 09:19:19 2015 +0100

----------------------------------------------------------------------
 .../include/dm_service_dependency_impl.h        |   2 +-
 .../private/src/dm_component_impl.c             |  30 +-
 .../private/src/dm_service_dependency.c         | 928 ++++++++++---------
 .../public/include/dm_component.h               |   2 +-
 .../public/include/dm_service_dependency.h      |   2 +-
 .../phase1/private/src/phase1_activator.c       |   2 +-
 .../phase2a/private/src/phase2a_activator.c     |   4 +-
 .../phase2a/private/src/phase2a_cmp.c           |   3 +-
 .../phase2b/private/src/phase2b_activator.c     |   4 +-
 .../phase3/private/src/phase3_activator.c       |   2 +-
 examples/dm_example/services/phase1.h           |   3 +-
 examples/dm_example/services/phase2.h           |   3 +-
 .../private/src/dependency_activator.c          |   4 +-
 framework/public/include/constants.h            |   2 +
 14 files changed, 508 insertions(+), 483 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/celix/blob/f2417eac/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 e018ab1..60bb113 100644
--- a/dependency_manager/private/include/dm_service_dependency_impl.h
+++ b/dependency_manager/private/include/dm_service_dependency_impl.h
@@ -60,7 +60,7 @@ struct dm_service_dependency {
 
 	bool isStarted;
 
-	char *tracked_service_name;
+	char *tracked_service;
 	char *tracked_filter_unmodified;
 	char *tracked_filter;
 

http://git-wip-us.apache.org/repos/asf/celix/blob/f2417eac/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 699c9e4..9b5cdbe 100644
--- a/dependency_manager/private/src/dm_component_impl.c
+++ b/dependency_manager/private/src/dm_component_impl.c
@@ -28,6 +28,7 @@
 #include <stdlib.h>
 #include <string.h>
 
+#include "constants.h"
 #include "filter.h"
 #include "dm_component_impl.h"
 
@@ -325,27 +326,30 @@ celix_status_t component_stopTask(dm_component_pt component, void *data __attrib
     return status;
 }
 
-celix_status_t component_addInterface(dm_component_pt component, char *serviceName, void *service, properties_pt properties) {
+celix_status_t component_addInterface(dm_component_pt component, char *serviceName, char *serviceVersion, void *service, properties_pt properties) {
     celix_status_t status = CELIX_SUCCESS;
 
     if (component->active) {
         return CELIX_ILLEGAL_STATE;
     } else {
-	dm_interface_t *interface = (dm_interface_t *) calloc(1, sizeof(*interface));
-	char *name = strdup (serviceName);
+        dm_interface_t *interface = (dm_interface_t *) calloc(1, sizeof(*interface));
+        char *name = strdup(serviceName);
 
-	if (interface && name) {
+        if ((properties_get(properties, (char*) CELIX_FRAMEWORK_SERVICE_VERSION) == NULL) && (serviceVersion != NULL)) {
+            properties_set(properties, (char*) CELIX_FRAMEWORK_SERVICE_VERSION, serviceVersion);
+        }
+
+        if (interface && name) {
             interface->serviceName = name;
             interface->service = service;
             interface->properties = properties;
             interface->registration = NULL;
-	    arrayList_add(component->dm_interfaces, interface);
-	}
-	else {
-	   free (interface);
-	   free (name);
-	   status = CELIX_ENOMEM;
-	}
+            arrayList_add(component->dm_interfaces, interface);
+        } else {
+            free(interface);
+            free(name);
+            status = CELIX_ENOMEM;
+        }
     }
 
     return status;
@@ -794,7 +798,7 @@ celix_status_t component_calculateNewState(dm_component_pt component, dm_compone
 
 celix_status_t component_performTransition(dm_component_pt component, dm_component_state_t oldState, dm_component_state_t newState, bool *transition) {
     celix_status_t status = CELIX_SUCCESS;
-    //printf("performing transition for %s in thread %i from %i to %i\n", component->name, pthread_self(), oldState, newState);
+    //printf("performing transition for %s in thread %i from %i to %i\n", component->name, (int) pthread_self(), oldState, newState);
 
     if (oldState == newState) {
         *transition = false;
@@ -1410,4 +1414,4 @@ void component_destroyComponentInfo(dm_component_info_pt info) {
         }
     }
     free(info);
-}
\ No newline at end of file
+}

http://git-wip-us.apache.org/repos/asf/celix/blob/f2417eac/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 a85567b..aba8bfb 100644
--- a/dependency_manager/private/src/dm_service_dependency.c
+++ b/dependency_manager/private/src/dm_service_dependency.c
@@ -43,652 +43,668 @@ static celix_status_t serviceDependency_modifiedService(void *_ptr, service_refe
 static celix_status_t serviceDependency_removedService(void *_ptr, service_reference_pt reference, void *service);
 
 celix_status_t serviceDependency_create(dm_service_dependency_pt *dependency_ptr) {
-	celix_status_t status = CELIX_SUCCESS;
-
-	*dependency_ptr = calloc(1, sizeof(**dependency_ptr));
-	if (!*dependency_ptr) {
-		status = CELIX_ENOMEM;
-	} else {
-		(*dependency_ptr)->component = NULL;
-		(*dependency_ptr)->available = false;
-		(*dependency_ptr)->instanceBound = false;
-		(*dependency_ptr)->required = false;
-		(*dependency_ptr)->strategy = DM_SERVICE_DEPENDENCY_DEFAULT_STRATEGY;
-
-		(*dependency_ptr)->set = NULL;
-		(*dependency_ptr)->add = NULL;
-		(*dependency_ptr)->change = NULL;
-		(*dependency_ptr)->remove = NULL;
-		(*dependency_ptr)->swap = NULL;
-
-		(*dependency_ptr)->add_with_ref = NULL;
-		(*dependency_ptr)->change_with_ref = NULL;
-		(*dependency_ptr)->remove_with_ref = NULL;
-		(*dependency_ptr)->swap_with_ref = NULL;
-
-		(*dependency_ptr)->autoConfigure = NULL;
-
-		(*dependency_ptr)->isStarted = false;
-
-		(*dependency_ptr)->tracked_service_name = NULL;
-		(*dependency_ptr)->tracked_filter_unmodified = NULL;
-		(*dependency_ptr)->tracked_filter = NULL;
-
-		(*dependency_ptr)->tracker = NULL;
-		(*dependency_ptr)->tracker_customizer = NULL;
-	}
+    celix_status_t status = CELIX_SUCCESS;
+
+    *dependency_ptr = calloc(1, sizeof(**dependency_ptr));
+    if (!*dependency_ptr) {
+        status = CELIX_ENOMEM;
+    } else {
+        (*dependency_ptr)->component = NULL;
+        (*dependency_ptr)->available = false;
+        (*dependency_ptr)->instanceBound = false;
+        (*dependency_ptr)->required = false;
+        (*dependency_ptr)->strategy = DM_SERVICE_DEPENDENCY_DEFAULT_STRATEGY;
+
+        (*dependency_ptr)->set = NULL;
+        (*dependency_ptr)->add = NULL;
+        (*dependency_ptr)->change = NULL;
+        (*dependency_ptr)->remove = NULL;
+        (*dependency_ptr)->swap = NULL;
+
+        (*dependency_ptr)->add_with_ref = NULL;
+        (*dependency_ptr)->change_with_ref = NULL;
+        (*dependency_ptr)->remove_with_ref = NULL;
+        (*dependency_ptr)->swap_with_ref = NULL;
+
+        (*dependency_ptr)->autoConfigure = NULL;
+
+        (*dependency_ptr)->isStarted = false;
+
+        (*dependency_ptr)->tracked_service = NULL;
+        (*dependency_ptr)->tracked_filter_unmodified = NULL;
+        (*dependency_ptr)->tracked_filter = NULL;
+
+        (*dependency_ptr)->tracker = NULL;
+        (*dependency_ptr)->tracker_customizer = NULL;
+    }
 
-	return status;
+    return status;
 }
 
 celix_status_t serviceDependency_destroy(dm_service_dependency_pt *dependency_ptr) {
-	celix_status_t status = CELIX_SUCCESS;
+    celix_status_t status = CELIX_SUCCESS;
 
-	if (!*dependency_ptr) {
-		status = CELIX_ENOMEM;
-	}
+    if (!*dependency_ptr) {
+        status = CELIX_ENOMEM;
+    }
 
-	if (status == CELIX_SUCCESS) {
-		free((*dependency_ptr)->tracked_service_name);
-		free((*dependency_ptr)->tracked_filter);
-		free((*dependency_ptr)->tracked_filter_unmodified);
-		free(*dependency_ptr);
-		*dependency_ptr = NULL;
-	}
+    if (status == CELIX_SUCCESS) {
+        free((*dependency_ptr)->tracked_service);
+        free((*dependency_ptr)->tracked_filter);
+        free((*dependency_ptr)->tracked_filter_unmodified);
+        free(*dependency_ptr);
+        *dependency_ptr = NULL;
+    }
 
-	return status;
+    return status;
 }
 
 celix_status_t serviceDependency_lock(dm_service_dependency_pt dependency) {
-	celixThreadMutex_lock(&dependency->lock);
-	return CELIX_SUCCESS;
+    celixThreadMutex_lock(&dependency->lock);
+    return CELIX_SUCCESS;
 }
 
 celix_status_t serviceDependency_unlock(dm_service_dependency_pt dependency) {
-	celixThreadMutex_unlock(&dependency->lock);
-	return CELIX_SUCCESS;
+    celixThreadMutex_unlock(&dependency->lock);
+    return CELIX_SUCCESS;
 }
 
 celix_status_t serviceDependency_setRequired(dm_service_dependency_pt dependency, bool required) {
-	celix_status_t status = CELIX_SUCCESS;
+    celix_status_t status = CELIX_SUCCESS;
 
-	if (!dependency) {
-		status = CELIX_ILLEGAL_ARGUMENT;
-	}
+    if (!dependency) {
+        status = CELIX_ILLEGAL_ARGUMENT;
+    }
 
-	if (status == CELIX_SUCCESS) {
-		dependency->required = required;
-	}
+    if (status == CELIX_SUCCESS) {
+        dependency->required = required;
+    }
 
-	return status;
+    return status;
 }
 
 celix_status_t serviceDependency_setStrategy(dm_service_dependency_pt dependency, dm_service_dependency_strategy_t strategy) {
-	celix_status_t status = CELIX_SUCCESS;
+    celix_status_t status = CELIX_SUCCESS;
 
-	if (!dependency) {
-		status = CELIX_ILLEGAL_ARGUMENT;
-	}
-	else{
-		dependency->strategy = strategy;
-	}
+    if (!dependency) {
+        status = CELIX_ILLEGAL_ARGUMENT;
+    } else {
+        dependency->strategy = strategy;
+    }
 
-	return status;
+    return status;
 }
 
-celix_status_t serviceDependency_getStrategy(dm_service_dependency_pt dependency, dm_service_dependency_strategy_t* strategy){
-	celix_status_t status = CELIX_SUCCESS;
+celix_status_t serviceDependency_getStrategy(dm_service_dependency_pt dependency, dm_service_dependency_strategy_t* strategy) {
+    celix_status_t status = CELIX_SUCCESS;
 
-	if (!dependency) {
-		status = CELIX_ILLEGAL_ARGUMENT;
-	}
-	else{
-		*strategy = dependency->strategy;
-	}
+    if (!dependency) {
+        status = CELIX_ILLEGAL_ARGUMENT;
+    } else {
+        *strategy = dependency->strategy;
+    }
 
-	return status;
+    return status;
 
 }
 
-celix_status_t serviceDependency_setService(dm_service_dependency_pt dependency, char *serviceName, char *filter) {
-	celix_status_t status = CELIX_SUCCESS;
+celix_status_t serviceDependency_setService(dm_service_dependency_pt dependency, char *serviceName, char *serviceVersion, char *filter) {
+    celix_status_t status = CELIX_SUCCESS;
+    if (!dependency) {
+        status = CELIX_ILLEGAL_ARGUMENT;
+    }
+
+    if (status == CELIX_SUCCESS) {
+        array_list_pt filterElements = NULL;
+        arrayList_create(&filterElements);
+
+        if (serviceName != NULL) {
+            dependency->tracked_service = strdup(serviceName);
+        }
+
+        if (serviceVersion != NULL) {
+            size_t len = strlen(CELIX_FRAMEWORK_SERVICE_VERSION) + strlen(serviceVersion) + 4;
+            char serviceVersionFilter[len];
+            snprintf(serviceVersionFilter, len, "(%s=%s)", CELIX_FRAMEWORK_SERVICE_VERSION, serviceVersion);
+            arrayList_add(filterElements, strdup(serviceVersionFilter));
+        }
+
+        if (filter != NULL) {
+            dependency->tracked_filter_unmodified = strdup(filter);
+            arrayList_add(filterElements, strdup(filter));
+        }
 
-	if (!dependency) {
-		status = CELIX_ILLEGAL_ARGUMENT;
-	}
+        if (arrayList_size(filterElements) > 0) {
+            array_list_iterator_pt filterElementsIter = arrayListIterator_create(filterElements);
 
-	if (status == CELIX_SUCCESS) {
-		if (serviceName != NULL) {
-			dependency->tracked_service_name = strdup(serviceName);
-		}
-		if (filter != NULL) {
-			dependency->tracked_filter_unmodified = strdup(filter);
-			if (serviceName == NULL) {
-				dependency->tracked_filter = strdup(filter);
-			} else {
-				size_t len = strlen(serviceName) + strlen(OSGI_FRAMEWORK_OBJECTCLASS) + strlen(filter) + 7;
-				char new_filter[len];
-				snprintf(new_filter, len, "(&(%s=%s)%s)", OSGI_FRAMEWORK_OBJECTCLASS, serviceName, filter);
-				dependency->tracked_filter = strdup(new_filter);
-			}
-		} else {
-			dependency->tracked_filter_unmodified = NULL;
-			dependency->tracked_filter = NULL;
-		}
-	}
+            size_t len = strlen(serviceName) + strlen(OSGI_FRAMEWORK_OBJECTCLASS) + 4;
+            dependency->tracked_filter = calloc(len, sizeof(*dependency->tracked_filter));
+            snprintf(dependency->tracked_filter, len, "(%s=%s)", OSGI_FRAMEWORK_OBJECTCLASS, serviceName);
 
-	return status;
+            while (arrayListIterator_hasNext(filterElementsIter) == true) {
+                char* filterElement = (char*) arrayListIterator_next(filterElementsIter);
+                size_t len = strlen(dependency->tracked_filter) + strlen(filterElement) + 4;
+                char* newFilter = calloc(len, sizeof(*newFilter));
+                snprintf(newFilter, len, "(&%s%s)", dependency->tracked_filter, filterElement);
+                dependency->tracked_filter = newFilter;
+            }
+
+            arrayListIterator_destroy(filterElementsIter);
+        }
+        else {
+            dependency->tracked_filter = NULL;
+        }
+    }
+
+    return status;
 }
 
 celix_status_t serviceDependency_getFilter(dm_service_dependency_pt dependency, char **filter) {
-	*filter = dependency->tracked_filter;
-	return CELIX_SUCCESS;
+    *filter = dependency->tracked_filter;
+    return CELIX_SUCCESS;
 }
 
 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;
+    celix_status_t status = CELIX_SUCCESS;
 
-	if (!dependency) {
-		status = CELIX_ILLEGAL_ARGUMENT;
-	}
+    if (!dependency) {
+        status = CELIX_ILLEGAL_ARGUMENT;
+    }
 
-	if (status == CELIX_SUCCESS) {
-		dependency->set = set;
-		dependency->add = add;
-		dependency->change = change;
-		dependency->remove = remove;
-		dependency->swap = swap;
-	}
+    if (status == CELIX_SUCCESS) {
+        dependency->set = set;
+        dependency->add = add;
+        dependency->change = change;
+        dependency->remove = remove;
+        dependency->swap = swap;
+    }
 
-	return status;
+    return status;
 }
 
-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;
+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) {
-		status = CELIX_ILLEGAL_ARGUMENT;
-	}
+    if (!dependency) {
+        status = CELIX_ILLEGAL_ARGUMENT;
+    }
 
-	if (status == CELIX_SUCCESS) {
-		dependency->set_with_ref = set;
-		dependency->add_with_ref = add;
-		dependency->change_with_ref = change;
-		dependency->remove_with_ref = remove;
-		dependency->swap_with_ref = swap;
-	}
+    if (status == CELIX_SUCCESS) {
+        dependency->set_with_ref = set;
+        dependency->add_with_ref = add;
+        dependency->change_with_ref = change;
+        dependency->remove_with_ref = remove;
+        dependency->swap_with_ref = swap;
+    }
 
-	return status;
+    return status;
 }
 
 celix_status_t serviceDependency_setAutoConfigure(dm_service_dependency_pt dependency, celix_thread_mutex_t *service_lock, void **field) {
-	celix_status_t status = CELIX_SUCCESS;
+    celix_status_t status = CELIX_SUCCESS;
 
-	celix_thread_mutex_t lock;
+    celix_thread_mutex_t lock;
 
-	if (!dependency) {
-		status = CELIX_ILLEGAL_ARGUMENT;
-	}
+    if (!dependency) {
+        status = CELIX_ILLEGAL_ARGUMENT;
+    }
 
-	if (status == CELIX_SUCCESS) {
-		dependency->autoConfigure = field;
-		celixThreadMutex_create(&lock, NULL);
-		*service_lock = lock;
-		dependency->lock = lock;
-	}
+    if (status == CELIX_SUCCESS) {
+        dependency->autoConfigure = field;
+        celixThreadMutex_create(&lock, NULL);
+        *service_lock = lock;
+        dependency->lock = lock;
+    }
 
-	return status;
+    return status;
 }
 
 celix_status_t serviceDependency_setComponent(dm_service_dependency_pt dependency, dm_component_pt component) {
-	celix_status_t status = CELIX_SUCCESS;
+    celix_status_t status = CELIX_SUCCESS;
 
-	if (!dependency) {
-		status = CELIX_ILLEGAL_ARGUMENT;
-	}
+    if (!dependency) {
+        status = CELIX_ILLEGAL_ARGUMENT;
+    }
 
-	if (status == CELIX_SUCCESS) {
-		dependency->component = component;
-	}
+    if (status == CELIX_SUCCESS) {
+        dependency->component = component;
+    }
 
-	return status;
+    return status;
 }
 
 celix_status_t serviceDependency_start(dm_service_dependency_pt dependency) {
-	celix_status_t status = CELIX_SUCCESS;
-	bundle_context_pt context = NULL;
-
-	if (!dependency || !dependency->component || (!dependency->tracked_service_name && !dependency->tracked_filter)) {
-		status = CELIX_ILLEGAL_ARGUMENT;
-	}
-
-	if (status == CELIX_SUCCESS) {
-		status = component_getBundleContext(dependency->component, &context);
-		if (!context) {
-			status = CELIX_BUNDLE_EXCEPTION;
-		}
-	}
+    celix_status_t status = CELIX_SUCCESS;
+    bundle_context_pt context = NULL;
 
-	if (status == CELIX_SUCCESS) {
-		dependency->tracker_customizer = NULL;
-		status = serviceTrackerCustomizer_create(dependency, NULL, serviceDependency_addedService, serviceDependency_modifiedService,
-				serviceDependency_removedService, &dependency->tracker_customizer);
-	}
-
-	if (status == CELIX_SUCCESS) {
-		if (dependency->tracked_filter) {
-			status = serviceTracker_createWithFilter(context, dependency->tracked_filter, dependency->tracker_customizer, &dependency->tracker);
-		} else if (dependency->tracked_service_name) {
-			status = serviceTracker_create(context, dependency->tracked_service_name, dependency->tracker_customizer, &dependency->tracker);
-		}
-	}
+    if (!dependency || !dependency->component || (!dependency->tracked_service && !dependency->tracked_filter)) {
+        status = CELIX_ILLEGAL_ARGUMENT;
+    }
+    if (status == CELIX_SUCCESS) {
+        status = component_getBundleContext(dependency->component, &context);
+        if (!context) {
+            status = CELIX_BUNDLE_EXCEPTION;
+        }
+    }
+    if (status == CELIX_SUCCESS) {
+        dependency->tracker_customizer = NULL;
+        status = serviceTrackerCustomizer_create(dependency, NULL, serviceDependency_addedService, serviceDependency_modifiedService, serviceDependency_removedService, &dependency->tracker_customizer);
+    }
+    if (status == CELIX_SUCCESS) {
+        if (dependency->tracked_filter) {
+            status = serviceTracker_createWithFilter(context, dependency->tracked_filter, dependency->tracker_customizer, &dependency->tracker);
+        } else if (dependency->tracked_service) {
+            status = serviceTracker_create(context, dependency->tracked_service, dependency->tracker_customizer, &dependency->tracker);
+        }
+    }
 
-	if (status == CELIX_SUCCESS) {
-		status = serviceTracker_open(dependency->tracker);
-	}
+    if (status == CELIX_SUCCESS) {
+        status = serviceTracker_open(dependency->tracker);
+    }
 
-	if (status == CELIX_SUCCESS) {
-		dependency->isStarted = true;
-	}
+    if (status == CELIX_SUCCESS) {
+        dependency->isStarted = true;
+    }
 
-	return status;
+    return status;
 }
 
 celix_status_t serviceDependency_stop(dm_service_dependency_pt dependency) {
-	celix_status_t status = CELIX_SUCCESS;
+    celix_status_t status = CELIX_SUCCESS;
     celix_status_t tmp_status;
 
-	if (!dependency) {
-		status = CELIX_ILLEGAL_ARGUMENT;
-	}
+    if (!dependency) {
+        status = CELIX_ILLEGAL_ARGUMENT;
+    }
 
-	if (status == CELIX_SUCCESS) {
-		dependency->isStarted = false;
-	}
+    if (status == CELIX_SUCCESS) {
+        dependency->isStarted = false;
+    }
 
-	if (status == CELIX_SUCCESS) {
-		if (dependency->tracker) {
+    if (status == CELIX_SUCCESS) {
+        if (dependency->tracker) {
             tmp_status = serviceTracker_close(dependency->tracker);
             if (tmp_status != CELIX_SUCCESS) {
                 status = tmp_status;
             }
-			tmp_status = serviceTracker_destroy(dependency->tracker);
+            tmp_status = serviceTracker_destroy(dependency->tracker);
             if (tmp_status != CELIX_SUCCESS && status == CELIX_SUCCESS) {
                 status = tmp_status;
             }
-		}
-	}
+        }
+    }
 
-	return status;
+    return status;
 }
 
 celix_status_t serviceDependency_setInstanceBound(dm_service_dependency_pt dependency, bool instanceBound) {
-	celix_status_t status = CELIX_SUCCESS;
+    celix_status_t status = CELIX_SUCCESS;
 
-	if (!dependency) {
-		status = CELIX_ILLEGAL_ARGUMENT;
-	}
+    if (!dependency) {
+        status = CELIX_ILLEGAL_ARGUMENT;
+    }
 
-	if (status == CELIX_SUCCESS) {
-		dependency->instanceBound = instanceBound;
-	}
+    if (status == CELIX_SUCCESS) {
+        dependency->instanceBound = instanceBound;
+    }
 
-	return status;
+    return status;
 }
 
 celix_status_t serviceDependency_setAvailable(dm_service_dependency_pt dependency, bool available) {
-	celix_status_t status = CELIX_SUCCESS;
+    celix_status_t status = CELIX_SUCCESS;
 
-	if (!dependency) {
-		status = CELIX_ILLEGAL_ARGUMENT;
-	}
+    if (!dependency) {
+        status = CELIX_ILLEGAL_ARGUMENT;
+    }
 
-	if (status == CELIX_SUCCESS) {
-		dependency->available = available;
-	}
+    if (status == CELIX_SUCCESS) {
+        dependency->available = available;
+    }
 
-	return status;
+    return status;
 }
 
 celix_status_t serviceDependency_invokeSet(dm_service_dependency_pt dependency, dm_event_pt event) {
-	celix_status_t status = CELIX_SUCCESS;
-	assert(dependency->isStarted == true);
-	array_list_pt serviceReferences = NULL;
-	int i;
-	int curRanking = INT_MIN;
-	service_reference_pt curServRef = NULL;
-	void *service = NULL;
-
-	serviceReferences = serviceTracker_getServiceReferences(dependency->tracker);
-
-	/* 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;
-		}
-	}
+    celix_status_t status = CELIX_SUCCESS;
+    assert(dependency->isStarted == true);
+    array_list_pt serviceReferences = NULL;
+    int i;
+    int curRanking = INT_MIN;
+    service_reference_pt curServRef = NULL;
+    void *service = NULL;
+
+    serviceReferences = serviceTracker_getServiceReferences(dependency->tracker);
+
+    /* 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;
+        }
+    }
 
     arrayList_destroy(serviceReferences);
 
-	if (curServRef) {
-		status = bundleContext_getService(event->context, curServRef, &service);
-	} else {
-		service = NULL;
-	}
+    if (curServRef) {
+        status = bundleContext_getService(event->context, curServRef, &service);
+    } else {
+        service = NULL;
+    }
 
-	if (dependency->set) {
-		dependency->set(component_getImplementation(dependency->component), service);
-	}
-	if (dependency->set_with_ref) {
-		dependency->set_with_ref(component_getImplementation(dependency->component), curServRef, service);
-	}
+    if (dependency->set) {
+        dependency->set(component_getImplementation(dependency->component), service);
+    }
+    if (dependency->set_with_ref) {
+        dependency->set_with_ref(component_getImplementation(dependency->component), curServRef, service);
+    }
 
-	return status;
+    return status;
 }
 
 celix_status_t serviceDependency_invokeAdd(dm_service_dependency_pt dependency, dm_event_pt event) {
-	celix_status_t status = CELIX_SUCCESS;
+    celix_status_t status = CELIX_SUCCESS;
 
-	if (!dependency) {
-		status = CELIX_ILLEGAL_ARGUMENT;
-	}
+    if (!dependency) {
+        status = CELIX_ILLEGAL_ARGUMENT;
+    }
 
-	if (status == CELIX_SUCCESS) {
-		if (dependency->add) {
-			dependency->add(component_getImplementation(dependency->component), event->service);
-		}
-		if (dependency->add_with_ref) {
-			dependency->add_with_ref(component_getImplementation(dependency->component), event->reference, event->service);
-		}
-	}
+    if (status == CELIX_SUCCESS) {
+        if (dependency->add) {
+            dependency->add(component_getImplementation(dependency->component), event->service);
+        }
+        if (dependency->add_with_ref) {
+            dependency->add_with_ref(component_getImplementation(dependency->component), event->reference, event->service);
+        }
+    }
 
-	return status;
+    return status;
 }
 
 celix_status_t serviceDependency_invokeChange(dm_service_dependency_pt dependency, dm_event_pt event) {
-	celix_status_t status = CELIX_SUCCESS;
+    celix_status_t status = CELIX_SUCCESS;
 
-	if (!dependency) {
-		status = CELIX_ILLEGAL_ARGUMENT;
-	}
+    if (!dependency) {
+        status = CELIX_ILLEGAL_ARGUMENT;
+    }
 
-	if (status == CELIX_SUCCESS) {
-		if (dependency->change) {
-			dependency->change(component_getImplementation(dependency->component), event->service);
-		}
-		if (dependency->change_with_ref) {
-			dependency->change_with_ref(component_getImplementation(dependency->component), event->reference, event->service);
-		}
-	}
+    if (status == CELIX_SUCCESS) {
+        if (dependency->change) {
+            dependency->change(component_getImplementation(dependency->component), event->service);
+        }
+        if (dependency->change_with_ref) {
+            dependency->change_with_ref(component_getImplementation(dependency->component), event->reference, event->service);
+        }
+    }
 
-	return status;
+    return status;
 }
 
 celix_status_t serviceDependency_invokeRemove(dm_service_dependency_pt dependency, dm_event_pt event) {
-	celix_status_t status = CELIX_SUCCESS;
+    celix_status_t status = CELIX_SUCCESS;
 
-	if (!dependency) {
-		status = CELIX_ILLEGAL_ARGUMENT;
-	}
+    if (!dependency) {
+        status = CELIX_ILLEGAL_ARGUMENT;
+    }
 
-	if (status == CELIX_SUCCESS) {
-		if (dependency->remove) {
-			dependency->remove(component_getImplementation(dependency->component), event->service);
-		}
-		if (dependency->remove_with_ref) {
-			dependency->remove_with_ref(component_getImplementation(dependency->component), event->reference, event->service);
-		}
-	}
+    if (status == CELIX_SUCCESS) {
+        if (dependency->remove) {
+            dependency->remove(component_getImplementation(dependency->component), event->service);
+        }
+        if (dependency->remove_with_ref) {
+            dependency->remove_with_ref(component_getImplementation(dependency->component), event->reference, event->service);
+        }
+    }
 
-	return status;
+    return status;
 }
 
 celix_status_t serviceDependency_invokeSwap(dm_service_dependency_pt dependency, dm_event_pt event, dm_event_pt newEvent) {
-	celix_status_t status = CELIX_SUCCESS;
+    celix_status_t status = CELIX_SUCCESS;
 
-	if (!dependency) {
-		status = CELIX_ILLEGAL_ARGUMENT;
-	}
+    if (!dependency) {
+        status = CELIX_ILLEGAL_ARGUMENT;
+    }
 
-	if (status == CELIX_SUCCESS) {
-		if (dependency->swap) {
-			dependency->swap(component_getImplementation(dependency->component), event->service, newEvent->service);
-		}
-		if (dependency->swap_with_ref) {
-			dependency->swap_with_ref(component_getImplementation(dependency->component), event->reference, event->service, newEvent->reference, newEvent->service);
-		}
-	}
+    if (status == CELIX_SUCCESS) {
+        if (dependency->swap) {
+            dependency->swap(component_getImplementation(dependency->component), event->service, newEvent->service);
+        }
+        if (dependency->swap_with_ref) {
+            dependency->swap_with_ref(component_getImplementation(dependency->component), event->reference, event->service, newEvent->reference, newEvent->service);
+        }
+    }
 
-	return status;
+    return status;
 }
 
 celix_status_t serviceDependency_isAvailable(dm_service_dependency_pt dependency, bool *available) {
-	celix_status_t status = CELIX_SUCCESS;
+    celix_status_t status = CELIX_SUCCESS;
 
-	if (!dependency) {
-		status = CELIX_ILLEGAL_ARGUMENT;
-	}
+    if (!dependency) {
+        status = CELIX_ILLEGAL_ARGUMENT;
+    }
 
-	if (status == CELIX_SUCCESS) {
-		*available = dependency->available;
-	}
+    if (status == CELIX_SUCCESS) {
+        *available = dependency->available;
+    }
 
-	return status;
+    return status;
 }
 
 celix_status_t serviceDependency_isRequired(dm_service_dependency_pt dependency, bool *required) {
-	celix_status_t status = CELIX_SUCCESS;
+    celix_status_t status = CELIX_SUCCESS;
 
-	if (!dependency) {
-		status = CELIX_ILLEGAL_ARGUMENT;
-	}
+    if (!dependency) {
+        status = CELIX_ILLEGAL_ARGUMENT;
+    }
 
-	if (status == CELIX_SUCCESS) {
-		*required = dependency->required;
-	}
+    if (status == CELIX_SUCCESS) {
+        *required = dependency->required;
+    }
 
-	return status;
+    return status;
 }
 
 celix_status_t serviceDependency_isInstanceBound(dm_service_dependency_pt dependency, bool *instanceBound) {
-	celix_status_t status = CELIX_SUCCESS;
+    celix_status_t status = CELIX_SUCCESS;
 
-	if (!dependency) {
-		status = CELIX_ILLEGAL_ARGUMENT;
-	}
+    if (!dependency) {
+        status = CELIX_ILLEGAL_ARGUMENT;
+    }
 
-	if (status == CELIX_SUCCESS) {
-		*instanceBound = dependency->instanceBound;
-	}
+    if (status == CELIX_SUCCESS) {
+        *instanceBound = dependency->instanceBound;
+    }
 
-	return status;
+    return status;
 }
 
 celix_status_t serviceDependency_isAutoConfig(dm_service_dependency_pt dependency, bool *autoConfig) {
-	celix_status_t status = CELIX_SUCCESS;
+    celix_status_t status = CELIX_SUCCESS;
 
-	if (!dependency) {
-		status = CELIX_ILLEGAL_ARGUMENT;
-	}
+    if (!dependency) {
+        status = CELIX_ILLEGAL_ARGUMENT;
+    }
 
-	if (status == CELIX_SUCCESS) {
-		*autoConfig = dependency->autoConfigure != NULL;
-	}
+    if (status == CELIX_SUCCESS) {
+        *autoConfig = dependency->autoConfigure != NULL;
+    }
 
-	return status;
+    return status;
 }
 
 celix_status_t serviceDependency_getAutoConfig(dm_service_dependency_pt dependency, void ***autoConfigure) {
-	celix_status_t status = CELIX_SUCCESS;
+    celix_status_t status = CELIX_SUCCESS;
 
-	if (!dependency) {
-		status = CELIX_ILLEGAL_ARGUMENT;
-	}
+    if (!dependency) {
+        status = CELIX_ILLEGAL_ARGUMENT;
+    }
 
-	if (status == CELIX_SUCCESS) {
-		*autoConfigure = dependency->autoConfigure;
-	}
+    if (status == CELIX_SUCCESS) {
+        *autoConfigure = dependency->autoConfigure;
+    }
 
-	return status;
+    return status;
 }
 
 celix_status_t serviceDependency_addedService(void *_ptr, service_reference_pt reference, void *service) {
-	celix_status_t status = CELIX_SUCCESS;
-	bundle_context_pt context = NULL;
-	bundle_pt bundle = NULL;
-	dm_event_pt event = NULL;
-	dm_service_dependency_pt dependency = _ptr;
-
-	if (!dependency || !reference || !service) {
-		status = CELIX_ILLEGAL_ARGUMENT;
-	}
+    celix_status_t status = CELIX_SUCCESS;
+    bundle_context_pt context = NULL;
+    bundle_pt bundle = NULL;
+    dm_event_pt event = NULL;
+    dm_service_dependency_pt dependency = _ptr;
+
+    if (!dependency || !reference || !service) {
+        status = CELIX_ILLEGAL_ARGUMENT;
+    }
 
-	if (status == CELIX_SUCCESS) {
-		status = component_getBundleContext(dependency->component, &context);
-		if (!context) {
-			status = CELIX_BUNDLE_EXCEPTION;
-		}
-	}
+    if (status == CELIX_SUCCESS) {
+        status = component_getBundleContext(dependency->component, &context);
+        if (!context) {
+            status = CELIX_BUNDLE_EXCEPTION;
+        }
+    }
 
-	if (status == CELIX_SUCCESS) {
-		status = bundleContext_getBundle(context, &bundle);
-		if (!bundle) {
-			status = CELIX_BUNDLE_EXCEPTION;
-		}
-	}
+    if (status == CELIX_SUCCESS) {
+        status = bundleContext_getBundle(context, &bundle);
+        if (!bundle) {
+            status = CELIX_BUNDLE_EXCEPTION;
+        }
+    }
 
-	if (status == CELIX_SUCCESS) {
-		status = event_create(DM_EVENT_ADDED, bundle, context, reference, service, &event);
-	}
+    if (status == CELIX_SUCCESS) {
+        status = event_create(DM_EVENT_ADDED, bundle, context, reference, service, &event);
+    }
 
-	if (status == CELIX_SUCCESS) {
-		component_handleEvent(dependency->component, dependency, event);
-	}
+    if (status == CELIX_SUCCESS) {
+        component_handleEvent(dependency->component, dependency, event);
+    }
 
-	return status;
+    return status;
 }
 
 celix_status_t serviceDependency_modifiedService(void *_ptr, service_reference_pt reference, void *service) {
-	celix_status_t status = CELIX_SUCCESS;
-	bundle_context_pt context = NULL;
-	bundle_pt bundle = NULL;
-	dm_event_pt event = NULL;
-	dm_service_dependency_pt dependency = _ptr;
-
-	if (!dependency || !reference || !service) {
-		status = CELIX_ILLEGAL_ARGUMENT;
-	}
+    celix_status_t status = CELIX_SUCCESS;
+    bundle_context_pt context = NULL;
+    bundle_pt bundle = NULL;
+    dm_event_pt event = NULL;
+    dm_service_dependency_pt dependency = _ptr;
+
+    if (!dependency || !reference || !service) {
+        status = CELIX_ILLEGAL_ARGUMENT;
+    }
 
-	if (status == CELIX_SUCCESS) {
-		status = component_getBundleContext(dependency->component, &context);
-		if (!context) {
-			status = CELIX_BUNDLE_EXCEPTION;
-		}
-	}
+    if (status == CELIX_SUCCESS) {
+        status = component_getBundleContext(dependency->component, &context);
+        if (!context) {
+            status = CELIX_BUNDLE_EXCEPTION;
+        }
+    }
 
-	if (status == CELIX_SUCCESS) {
-		status = bundleContext_getBundle(context, &bundle);
-		if (!bundle) {
-			status = CELIX_BUNDLE_EXCEPTION;
-		}
-	}
+    if (status == CELIX_SUCCESS) {
+        status = bundleContext_getBundle(context, &bundle);
+        if (!bundle) {
+            status = CELIX_BUNDLE_EXCEPTION;
+        }
+    }
 
-	if (status == CELIX_SUCCESS) {
-		status = event_create(DM_EVENT_CHANGED, bundle, context, reference, service, &event);
-	}
+    if (status == CELIX_SUCCESS) {
+        status = event_create(DM_EVENT_CHANGED, bundle, context, reference, service, &event);
+    }
 
-	if (status == CELIX_SUCCESS) {
-		component_handleEvent(dependency->component, dependency, event);
-	}
+    if (status == CELIX_SUCCESS) {
+        component_handleEvent(dependency->component, dependency, event);
+    }
 
-	return status;
+    return status;
 }
 
 celix_status_t serviceDependency_removedService(void *_ptr, service_reference_pt reference, void *service) {
-	celix_status_t status = CELIX_SUCCESS;
-	bundle_context_pt context = NULL;
-	bundle_pt bundle = NULL;
-	dm_event_pt event = NULL;
-	dm_service_dependency_pt dependency = _ptr;
-
-	if (!dependency || !reference || !service) {
-		status = CELIX_ILLEGAL_ARGUMENT;
-	}
+    celix_status_t status = CELIX_SUCCESS;
+    bundle_context_pt context = NULL;
+    bundle_pt bundle = NULL;
+    dm_event_pt event = NULL;
+    dm_service_dependency_pt dependency = _ptr;
+
+    if (!dependency || !reference || !service) {
+        status = CELIX_ILLEGAL_ARGUMENT;
+    }
 
-	if (status == CELIX_SUCCESS) {
-		status = component_getBundleContext(dependency->component, &context);
-		if (!context) {
-			status = CELIX_BUNDLE_EXCEPTION;
-		}
-	}
+    if (status == CELIX_SUCCESS) {
+        status = component_getBundleContext(dependency->component, &context);
+        if (!context) {
+            status = CELIX_BUNDLE_EXCEPTION;
+        }
+    }
 
-	if (status == CELIX_SUCCESS) {
-		status = bundleContext_getBundle(context, &bundle);
-		if (!bundle) {
-			status = CELIX_BUNDLE_EXCEPTION;
-		}
-	}
+    if (status == CELIX_SUCCESS) {
+        status = bundleContext_getBundle(context, &bundle);
+        if (!bundle) {
+            status = CELIX_BUNDLE_EXCEPTION;
+        }
+    }
 
-	if (status == CELIX_SUCCESS) {
-		status = event_create(DM_EVENT_REMOVED, bundle, context, reference, service, &event);
-	}
+    if (status == CELIX_SUCCESS) {
+        status = event_create(DM_EVENT_REMOVED, bundle, context, reference, service, &event);
+    }
 
-	if (status == CELIX_SUCCESS) {
-		component_handleEvent(dependency->component, dependency, event);
-	}
+    if (status == CELIX_SUCCESS) {
+        component_handleEvent(dependency->component, dependency, event);
+    }
 
-	return status;
+    return status;
 }
 
 celix_status_t serviceDependency_getServiceDependencyInfo(dm_service_dependency_pt dep, dm_service_dependency_info_pt *out) {
-	celix_status_t status = CELIX_SUCCESS;
-	dm_service_dependency_info_pt  info = calloc(1, sizeof(*info));
-	if (info != NULL) {
-		celixThreadMutex_lock(&dep->lock);
-		info->available = dep->available;
-		info->filter = dep->tracked_filter != NULL ? strdup(dep->tracked_filter) : NULL;
+    celix_status_t status = CELIX_SUCCESS;
+    dm_service_dependency_info_pt info = calloc(1, sizeof(*info));
+    if (info != NULL) {
+        celixThreadMutex_lock(&dep->lock);
+        info->available = dep->available;
+        info->filter = dep->tracked_filter != NULL ? strdup(dep->tracked_filter) : NULL;
         if (info->filter == NULL) {
-            info->filter = dep->tracked_service_name != NULL ? strdup(dep->tracked_service_name) : NULL;
+            info->filter = dep->tracked_service != NULL ? strdup(dep->tracked_service) : NULL;
         }
         info->required = dep->required;
 
-		array_list_pt refs = serviceTracker_getServiceReferences(dep->tracker);
-		if (refs != NULL) {
-			info->count = arrayList_size(refs);
-		}
-		arrayList_destroy(refs);
+        array_list_pt refs = serviceTracker_getServiceReferences(dep->tracker);
+        if (refs != NULL) {
+            info->count = arrayList_size(refs);
+        }
+        arrayList_destroy(refs);
 
-		celixThreadMutex_unlock(&dep->lock);
-	} else {
-		status = CELIX_ENOMEM;
-	}
+        celixThreadMutex_unlock(&dep->lock);
+    } else {
+        status = CELIX_ENOMEM;
+    }
 
-	if (status == CELIX_SUCCESS) {
-		*out = info;
-	}
+    if (status == CELIX_SUCCESS) {
+        *out = info;
+    }
 
-	return status;
+    return status;
 }
 
 void dependency_destroyDependencyInfo(dm_service_dependency_info_pt info) {
@@ -696,4 +712,4 @@ void dependency_destroyDependencyInfo(dm_service_dependency_info_pt info) {
         free(info->filter);
     }
     free(info);
-}
\ No newline at end of file
+}

http://git-wip-us.apache.org/repos/asf/celix/blob/f2417eac/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 014247e..5e2b277 100644
--- a/dependency_manager/public/include/dm_component.h
+++ b/dependency_manager/public/include/dm_component.h
@@ -52,7 +52,7 @@ typedef int (*deinit_fpt)(void *userData);
 celix_status_t component_create(bundle_context_pt context, const char *name, dm_component_pt *component);
 void component_destroy(dm_component_pt component);
 
-celix_status_t component_addInterface(dm_component_pt component, char *serviceName, void *service, properties_pt properties);
+celix_status_t component_addInterface(dm_component_pt component, char *serviceName, char *serviceVersion, void *service, properties_pt properties);
 celix_status_t component_setImplementation(dm_component_pt component, void *implementation);
 
 /**

http://git-wip-us.apache.org/repos/asf/celix/blob/f2417eac/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 0e3f780..d3eeed4 100644
--- a/dependency_manager/public/include/dm_service_dependency.h
+++ b/dependency_manager/public/include/dm_service_dependency.h
@@ -56,7 +56,7 @@ 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_setStrategy(dm_service_dependency_pt dependency,dm_service_dependency_strategy_t strategy);
 celix_status_t serviceDependency_getStrategy(dm_service_dependency_pt dependency,dm_service_dependency_strategy_t* strategy);
-celix_status_t serviceDependency_setService(dm_service_dependency_pt dependency, char *serviceName, char *filter);
+celix_status_t serviceDependency_setService(dm_service_dependency_pt dependency, char *serviceName, char *serviceVersion, char *filter);
 celix_status_t serviceDependency_getFilter(dm_service_dependency_pt dependency, char **filter);
 
 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);

http://git-wip-us.apache.org/repos/asf/celix/blob/f2417eac/examples/dm_example/phase1/private/src/phase1_activator.c
----------------------------------------------------------------------
diff --git a/examples/dm_example/phase1/private/src/phase1_activator.c b/examples/dm_example/phase1/private/src/phase1_activator.c
index 4d20c97..299228a 100644
--- a/examples/dm_example/phase1/private/src/phase1_activator.c
+++ b/examples/dm_example/phase1/private/src/phase1_activator.c
@@ -62,7 +62,7 @@ celix_status_t dm_init(void * userData, bundle_context_pt context, dm_dependency
 		component_create(context, "PHASE1_PROCESSING_COMPONENT", &cmp);
 		component_setImplementation(cmp, act->phase1Cmp);
 		component_setCallbacksSafe(cmp, phase1_cmp_t *, phase1_init, phase1_start, phase1_stop, phase1_deinit);
-		component_addInterface(cmp, PHASE1_NAME, &act->phase1Serv, props);
+		component_addInterface(cmp, PHASE1_NAME, PHASE1_VERSION, &act->phase1Serv, props);
 
 		dependencyManager_add(manager, cmp);
 	} else {

http://git-wip-us.apache.org/repos/asf/celix/blob/f2417eac/examples/dm_example/phase2a/private/src/phase2a_activator.c
----------------------------------------------------------------------
diff --git a/examples/dm_example/phase2a/private/src/phase2a_activator.c b/examples/dm_example/phase2a/private/src/phase2a_activator.c
index 9202a1f..4a3051f 100644
--- a/examples/dm_example/phase2a/private/src/phase2a_activator.c
+++ b/examples/dm_example/phase2a/private/src/phase2a_activator.c
@@ -63,12 +63,12 @@ celix_status_t dm_init(void * userData, bundle_context_pt context, dm_dependency
 		component_create(context, "PHASE2A_PROCESSING_COMPONENT", &cmp);
 		component_setImplementation(cmp, act->phase2aCmp);
 		component_setCallbacksSafe(cmp, phase2a_cmp_t *, phase2a_init, phase2a_start, phase2a_stop, phase2a_deinit);
-		component_addInterface(cmp, PHASE2_NAME, &act->phase2Serv, props);
+		component_addInterface(cmp, PHASE2_NAME, PHASE2_VERSION, &act->phase2Serv, props);
 
 
 		dm_service_dependency_pt dep;
 		serviceDependency_create(&dep);
-		serviceDependency_setService(dep, PHASE1_NAME, NULL);
+		serviceDependency_setService(dep, PHASE1_NAME, PHASE1_VERSION, NULL);
         serviceDependency_setCallbacksSafe(dep, phase2a_cmp_t *, phase1_t *, phase2a_setPhase1, NULL, NULL, NULL, NULL);
 		serviceDependency_setRequired(dep, true);
 		component_addServiceDependency(cmp, dep);

http://git-wip-us.apache.org/repos/asf/celix/blob/f2417eac/examples/dm_example/phase2a/private/src/phase2a_cmp.c
----------------------------------------------------------------------
diff --git a/examples/dm_example/phase2a/private/src/phase2a_cmp.c b/examples/dm_example/phase2a/private/src/phase2a_cmp.c
index 27c610a..b18ea99 100644
--- a/examples/dm_example/phase2a/private/src/phase2a_cmp.c
+++ b/examples/dm_example/phase2a/private/src/phase2a_cmp.c
@@ -86,6 +86,7 @@ void phase2a_destroy(phase2a_cmp_t *cmp) {
 }
 
 int phase2a_setPhase1(phase2a_cmp_t *cmp, phase1_t *phase1) {
+    printf("phase2a_setPhase1 called!\n\n");
     celixThreadMutex_lock(&cmp->mutex);
     cmp->phase1Serv = phase1;
     celixThreadMutex_unlock(&cmp->mutex);
@@ -113,4 +114,4 @@ static void *phase2a_thread(void *data) {
 int phase2a_getData(phase2a_cmp_t *cmp, double *data) {
     *data = cmp->currentValue;
     return 0;
-}
\ No newline at end of file
+}

http://git-wip-us.apache.org/repos/asf/celix/blob/f2417eac/examples/dm_example/phase2b/private/src/phase2b_activator.c
----------------------------------------------------------------------
diff --git a/examples/dm_example/phase2b/private/src/phase2b_activator.c b/examples/dm_example/phase2b/private/src/phase2b_activator.c
index c715bf5..2beb45a 100644
--- a/examples/dm_example/phase2b/private/src/phase2b_activator.c
+++ b/examples/dm_example/phase2b/private/src/phase2b_activator.c
@@ -63,12 +63,12 @@ celix_status_t dm_init(void * userData, bundle_context_pt context, dm_dependency
 		component_create(context, "PHASE2B_PROCESSING_COMPONENT", &cmp);
 		component_setImplementation(cmp, act->phase2bCmp);
 		component_setCallbacksSafe(cmp, phase2b_cmp_t *, phase2b_init, phase2b_start, phase2b_stop, phase2b_deinit);
-		component_addInterface(cmp, PHASE2_NAME, &act->phase2Serv, props);
+		component_addInterface(cmp, PHASE2_NAME, PHASE2_VERSION, &act->phase2Serv, props);
 
 
 		dm_service_dependency_pt dep;
 		serviceDependency_create(&dep);
-		serviceDependency_setService(dep, PHASE1_NAME, NULL);
+		serviceDependency_setService(dep, PHASE1_NAME, PHASE1_VERSION, NULL);
 		serviceDependency_setCallbacksSafe(dep, phase2b_cmp_t *, phase1_t *, phase2b_setPhase1, NULL, NULL, NULL, NULL);
 		serviceDependency_setRequired(dep, true);
 		component_addServiceDependency(cmp, dep);

http://git-wip-us.apache.org/repos/asf/celix/blob/f2417eac/examples/dm_example/phase3/private/src/phase3_activator.c
----------------------------------------------------------------------
diff --git a/examples/dm_example/phase3/private/src/phase3_activator.c b/examples/dm_example/phase3/private/src/phase3_activator.c
index 94f1433..d2a1b9c 100644
--- a/examples/dm_example/phase3/private/src/phase3_activator.c
+++ b/examples/dm_example/phase3/private/src/phase3_activator.c
@@ -57,7 +57,7 @@ celix_status_t dm_init(void * userData, bundle_context_pt context, dm_dependency
 
 		dm_service_dependency_pt dep;
 		serviceDependency_create(&dep);
-		serviceDependency_setService(dep, PHASE2_NAME, NULL);
+		serviceDependency_setService(dep, PHASE2_NAME, NULL, NULL);
 		serviceDependency_setStrategy(dep, DM_SERVICE_DEPENDENCY_STRATEGY_SUSPEND);
         serviceDependency_setCallbacksSafe(dep, phase3_cmp_t *, phase2_t *, NULL, phase3_addPhase2, NULL, phase3_removePhase2, NULL);
 		serviceDependency_setRequired(dep, true);

http://git-wip-us.apache.org/repos/asf/celix/blob/f2417eac/examples/dm_example/services/phase1.h
----------------------------------------------------------------------
diff --git a/examples/dm_example/services/phase1.h b/examples/dm_example/services/phase1.h
index 0261d14..5714553 100644
--- a/examples/dm_example/services/phase1.h
+++ b/examples/dm_example/services/phase1.h
@@ -27,7 +27,8 @@
 #ifndef PHASE1_H_
 #define PHASE1_H_
 
-#define PHASE1_NAME "PHASE1"
+#define PHASE1_NAME     "PHASE1"
+#define PHASE1_VERSION  "1.0.0.0"
 
 struct phase1_struct {
 	void *handle;

http://git-wip-us.apache.org/repos/asf/celix/blob/f2417eac/examples/dm_example/services/phase2.h
----------------------------------------------------------------------
diff --git a/examples/dm_example/services/phase2.h b/examples/dm_example/services/phase2.h
index 9318bc0..2f4df86 100644
--- a/examples/dm_example/services/phase2.h
+++ b/examples/dm_example/services/phase2.h
@@ -27,7 +27,8 @@
 #ifndef PHASE2_H
 #define PHASE2_H
 
-#define PHASE2_NAME "PHASE2"
+#define PHASE2_NAME     "PHASE2"
+#define PHASE2_VERSION  "1.0.0.0"
 
 struct phase2_struct {
 	void *handle;

http://git-wip-us.apache.org/repos/asf/celix/blob/f2417eac/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 a5cf185..2e17daf 100644
--- a/examples/whiteboard/tracker_depman/private/src/dependency_activator.c
+++ b/examples/whiteboard/tracker_depman/private/src/dependency_activator.c
@@ -60,13 +60,13 @@ celix_status_t dm_init(void * userData, bundle_context_pt context, dm_dependency
 
 	serviceDependency_create(&dep1);
 	serviceDependency_setRequired(dep1, true);
-	serviceDependency_setService(dep1, PUBLISHER_NAME, "(|(id=A)(id=B))");
+	serviceDependency_setService(dep1, PUBLISHER_NAME, NULL, "(|(id=A)(id=B))");
 	serviceDependency_setCallbacksWithServiceReference(dep1, NULL /*tracker_setServ*/, tracker_addedServ, tracker_modifiedServ, tracker_removedServ, NULL);
 	component_addServiceDependency(service, dep1);
 
 	serviceDependency_create(&dep2);
     serviceDependency_setRequired(dep2, false);
-    serviceDependency_setService(dep2, (char *) OSGI_LOGSERVICE_NAME, NULL);
+    serviceDependency_setService(dep2, (char *) OSGI_LOGSERVICE_NAME, NULL,  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);

http://git-wip-us.apache.org/repos/asf/celix/blob/f2417eac/framework/public/include/constants.h
----------------------------------------------------------------------
diff --git a/framework/public/include/constants.h b/framework/public/include/constants.h
index eb3ca29..eb29233 100644
--- a/framework/public/include/constants.h
+++ b/framework/public/include/constants.h
@@ -32,6 +32,8 @@ static const char * const OSGI_FRAMEWORK_SERVICE_ID = "service.id";
 static const char * const OSGI_FRAMEWORK_SERVICE_PID = "service.pid";
 static const char * const OSGI_FRAMEWORK_SERVICE_RANKING = "service.ranking";
 
+static const char * const CELIX_FRAMEWORK_SERVICE_VERSION = "service.version";
+
 static const char * const OSGI_FRAMEWORK_BUNDLE_ACTIVATOR = "Bundle-Activator";
 static const char * const OSGI_FRAMEWORK_BUNDLE_ACTIVATOR_CREATE = "bundleActivator_create";
 static const char * const OSGI_FRAMEWORK_BUNDLE_ACTIVATOR_START = "bundleActivator_start";


Mime
View raw message