You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@celix.apache.org by pn...@apache.org on 2017/11/20 20:33:41 UTC

[44/46] celix git commit: CELIX-417: Initial refactoring for CMake usage

http://git-wip-us.apache.org/repos/asf/celix/blob/a1c30887/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
deleted file mode 100644
index 65a0593..0000000
--- a/dependency_manager/private/src/dm_service_dependency.c
+++ /dev/null
@@ -1,811 +0,0 @@
-/**
- *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.
- */
-/*
- * dm_service_dependency.c
- *
- *  \date       17 Oct 2014
- *  \author     <a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
- *  \copyright  Apache License, Version 2.0
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <limits.h>
-#include <assert.h>
-
-#include "constants.h"
-
-#include "dm_service_dependency_impl.h"
-#include "dm_component_impl.h"
-
-#define DEFAULT_RANKING     0
-#define DM_SERVICE_DEPENDENCY_DEFAULT_STRATEGY DM_SERVICE_DEPENDENCY_STRATEGY_SUSPEND
-
-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);
-static void* serviceDependency_getCallbackHandle(dm_service_dependency_pt dep);
-
-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)->callbackHandle = NULL;
-		(*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)->addCLanguageFilter = 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;
-}
-
-celix_status_t serviceDependency_destroy(dm_service_dependency_pt *dependency_ptr) {
-	celix_status_t status = CELIX_SUCCESS;
-
-	if (!*dependency_ptr) {
-		status = CELIX_ENOMEM;
-	}
-
-	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;
-}
-
-celix_status_t serviceDependency_lock(dm_service_dependency_pt dependency) {
-	celixThreadMutex_lock(&dependency->lock);
-	return CELIX_SUCCESS;
-}
-
-celix_status_t serviceDependency_unlock(dm_service_dependency_pt dependency) {
-	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;
-
-	if (!dependency) {
-		status = CELIX_ILLEGAL_ARGUMENT;
-	}
-
-	if (status == CELIX_SUCCESS) {
-		dependency->required = required;
-	}
-
-	return status;
-}
-
-celix_status_t serviceDependency_setAddCLanguageFilter(dm_service_dependency_pt dependency, bool addCLangFilter) {
-    dependency->addCLanguageFilter = addCLangFilter;
-    return CELIX_SUCCESS;
-}
-
-celix_status_t serviceDependency_setStrategy(dm_service_dependency_pt dependency, dm_service_dependency_strategy_t strategy) {
-	celix_status_t status = CELIX_SUCCESS;
-
-	if (!dependency) {
-		status = CELIX_ILLEGAL_ARGUMENT;
-	} else {
-		dependency->strategy = strategy;
-	}
-
-	return status;
-}
-
-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;
-	}
-
-	return status;
-
-}
-
-celix_status_t serviceDependency_setService(dm_service_dependency_pt dependency, const char* serviceName, const char* serviceVersionRange, const char* filter) {
-	celix_status_t status = CELIX_SUCCESS;
-	if (!dependency || !serviceName) {
-		status = CELIX_ILLEGAL_ARGUMENT;
-	}
-
-	if (status == CELIX_SUCCESS) {
-		array_list_pt filterElements = NULL;
-		arrayList_create(&filterElements);
-
-		free(dependency->tracked_service);
-		dependency->tracked_service = strdup(serviceName);
-
-		if (serviceVersionRange != NULL) {
-			version_range_pt versionRange = NULL;
-
-			if (versionRange_parse(serviceVersionRange, &versionRange) == CELIX_SUCCESS) {
-				version_pt lowVersion = NULL;
-				version_pt highVersion = NULL;
-
-				if ((versionRange_getHighVersion(versionRange, &highVersion) == CELIX_SUCCESS) && (highVersion != NULL)) {
-					bool isHighInclusive;
-					char* highOperator;
-					char* highVersionStr = NULL;
-
-					versionRange_isHighInclusive(versionRange, &isHighInclusive);
-					version_toString(highVersion, &highVersionStr);
-
-					highOperator = isHighInclusive ? "<=" : "<";
-
-					if(highVersionStr != NULL){
-						size_t len = strlen(CELIX_FRAMEWORK_SERVICE_VERSION) + strlen(highVersionStr) + strlen(highOperator) + 3;
-						char serviceVersionFilter[len];
-						snprintf(serviceVersionFilter, len, "(%s%s%s)", CELIX_FRAMEWORK_SERVICE_VERSION, highOperator, highVersionStr);
-						arrayList_add(filterElements, strdup(serviceVersionFilter));
-						free(highVersionStr);
-					}
-				}
-
-				if ((versionRange_getLowVersion(versionRange, &lowVersion) == CELIX_SUCCESS) && (lowVersion != NULL)) {
-					bool isLowInclusive;
-					char* lowOperator;
-					char* lowVersionStr = NULL;
-
-					versionRange_isLowInclusive(versionRange, &isLowInclusive);
-					version_toString(lowVersion, &lowVersionStr);
-
-					lowOperator = isLowInclusive ? ">=" : ">";
-
-					if(lowVersionStr != NULL){
-						size_t len = strlen(CELIX_FRAMEWORK_SERVICE_VERSION) + strlen(lowVersionStr) + strlen(lowOperator) + 3;
-						char serviceVersionFilter[len];
-						snprintf(serviceVersionFilter, len, "(%s%s%s)", CELIX_FRAMEWORK_SERVICE_VERSION, lowOperator, lowVersionStr);
-						arrayList_add(filterElements, strdup(serviceVersionFilter));
-						free(lowVersionStr);
-					}
-				}
-			}
-
-			if(versionRange!=NULL){
-				versionRange_destroy(versionRange);
-			}
-		}
-
-		if (filter != NULL) {
-			free(dependency->tracked_filter_unmodified);
-			dependency->tracked_filter_unmodified = strdup(filter);
-			arrayList_add(filterElements, strdup(filter));
-		}
-
-
-
-        bool needLangFilter = true;
-		if (filter != NULL) {
-            char needle[128];
-            snprintf(needle, sizeof(needle), "(%s=", CELIX_FRAMEWORK_SERVICE_LANGUAGE);
-            if (strstr(filter, needle) != NULL) {
-                needLangFilter = false;
-            }
-        }
-
-        if (needLangFilter && dependency->addCLanguageFilter) {
-			char langFilter[128];
-			snprintf(langFilter, sizeof(langFilter), "(%s=%s)", CELIX_FRAMEWORK_SERVICE_LANGUAGE, CELIX_FRAMEWORK_SERVICE_C_LANGUAGE);
-            arrayList_add(filterElements, strdup(langFilter));
-		}
-
-		if (arrayList_size(filterElements) > 0) {
-			array_list_iterator_pt filterElementsIter = arrayListIterator_create(filterElements);
-
-			size_t len = strlen(serviceName) + strlen(OSGI_FRAMEWORK_OBJECTCLASS) + 4;
-			free(dependency->tracked_filter);
-			dependency->tracked_filter = calloc(len, sizeof(*dependency->tracked_filter));
-			snprintf(dependency->tracked_filter, len, "(%s=%s)", OSGI_FRAMEWORK_OBJECTCLASS, serviceName);
-
-			while (arrayListIterator_hasNext(filterElementsIter) == true) {
-				char* filterElement = (char*) arrayListIterator_next(filterElementsIter);
-				size_t len = strnlen(dependency->tracked_filter, 1024*1024) + strnlen(filterElement, 1024*1024) + 4;
-				char* newFilter = calloc(len, sizeof(*newFilter));
-
-				if (dependency->tracked_filter[0] == '(' && dependency->tracked_filter[1] == '&') {
-					//already have an & (AND) can combine with additional filter -> easier to read
-					size_t orgLen = strnlen(dependency->tracked_filter, 1024*1024);
-					snprintf(newFilter, len, "%.*s%s)", (int)orgLen -1, dependency->tracked_filter, filterElement);
-				} else {
-					snprintf(newFilter, len, "(&%s%s)", dependency->tracked_filter, filterElement);
-				}
-
-				free(dependency->tracked_filter);
-				free(filterElement);
-
-				dependency->tracked_filter = newFilter;
-			}
-
-			arrayListIterator_destroy(filterElementsIter);
-		}
-		else {
-			free(dependency->tracked_filter);
-			dependency->tracked_filter = NULL;
-		}
-
-		arrayList_destroy(filterElements);
-	}
-
-	return status;
-}
-
-celix_status_t serviceDependency_getFilter(dm_service_dependency_pt dependency, const char** filter) {
-	*filter = (const char*)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;
-
-    //printf("Setting callbacks set %p, add %p, change %p, remove %p and swap %p\n", set, add, change, remove, swap);
-
-	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;
-	}
-
-	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;
-
-	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;
-	}
-
-	return status;
-}
-
-celix_status_t serviceDependency_setAutoConfigure(dm_service_dependency_pt dependency, celix_thread_mutex_t *service_lock, const void **field) {
-	celix_status_t status = CELIX_SUCCESS;
-
-	celix_thread_mutex_t lock;
-
-	if (!dependency) {
-		status = CELIX_ILLEGAL_ARGUMENT;
-	}
-
-	if (status == CELIX_SUCCESS) {
-		dependency->autoConfigure = field;
-		celixThreadMutex_create(&lock, NULL);
-		*service_lock = lock;
-		dependency->lock = lock;
-	}
-
-	return status;
-}
-
-celix_status_t serviceDependency_setComponent(dm_service_dependency_pt dependency, dm_component_pt component) {
-	celix_status_t status = CELIX_SUCCESS;
-
-	if (!dependency) {
-		status = CELIX_ILLEGAL_ARGUMENT;
-	}
-
-	if (status == CELIX_SUCCESS) {
-		dependency->component = component;
-	}
-
-	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 && !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) {
-		dependency->isStarted = true;
-	}
-
-	return status;
-}
-
-celix_status_t serviceDependency_stop(dm_service_dependency_pt dependency) {
-	celix_status_t status = CELIX_SUCCESS;
-
-	if (!dependency) {
-		status = CELIX_ILLEGAL_ARGUMENT;
-	}
-
-	if (status == CELIX_SUCCESS) {
-		dependency->isStarted = false;
-	}
-
-	if (status == CELIX_SUCCESS && dependency->tracker) {
-		status = serviceTracker_close(dependency->tracker);
-		if (status == CELIX_SUCCESS) {
-			serviceTracker_destroy(dependency->tracker);
-			dependency->tracker = NULL;
-		}
-	}
-
-	return status;
-}
-
-celix_status_t serviceDependency_setInstanceBound(dm_service_dependency_pt dependency, bool instanceBound) {
-	celix_status_t status = CELIX_SUCCESS;
-
-	if (!dependency) {
-		status = CELIX_ILLEGAL_ARGUMENT;
-	}
-
-	if (status == CELIX_SUCCESS) {
-		dependency->instanceBound = instanceBound;
-	}
-
-	return status;
-}
-
-celix_status_t serviceDependency_setAvailable(dm_service_dependency_pt dependency, bool available) {
-	celix_status_t status = CELIX_SUCCESS;
-
-	if (!dependency) {
-		status = CELIX_ILLEGAL_ARGUMENT;
-	}
-
-	if (status == CELIX_SUCCESS) {
-		dependency->available = available;
-	}
-
-	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);
-		const 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 {
-			break;
-		}
-
-	}
-
-	arrayList_destroy(serviceReferences);
-
-	if (status == CELIX_SUCCESS) {
-		if (curServRef) {
-			status = bundleContext_getService(event->context, curServRef, &service);
-		} else {
-			service = NULL;
-		}
-
-		if (dependency->set) {
-			dependency->set(serviceDependency_getCallbackHandle(dependency), service);
-		}
-		if (dependency->set_with_ref) {
-			dependency->set_with_ref(serviceDependency_getCallbackHandle(dependency), curServRef, service);
-		}
-
-		if (curServRef) {
-			bundleContext_ungetService(event->context, curServRef, NULL);
-		}
-	}
-
-	return status;
-}
-
-celix_status_t serviceDependency_invokeAdd(dm_service_dependency_pt dependency, dm_event_pt event) {
-	celix_status_t status = CELIX_SUCCESS;
-
-	if (!dependency) {
-		status = CELIX_ILLEGAL_ARGUMENT;
-	}
-
-	if (status == CELIX_SUCCESS) {
-		if (dependency->add) {
-			dependency->add(serviceDependency_getCallbackHandle(dependency), event->service);
-		}
-		if (dependency->add_with_ref) {
-			dependency->add_with_ref(serviceDependency_getCallbackHandle(dependency), event->reference, event->service);
-		}
-	}
-
-	return status;
-}
-
-celix_status_t serviceDependency_invokeChange(dm_service_dependency_pt dependency, dm_event_pt event) {
-	celix_status_t status = CELIX_SUCCESS;
-
-	if (!dependency) {
-		status = CELIX_ILLEGAL_ARGUMENT;
-	}
-
-	if (status == CELIX_SUCCESS) {
-		if (dependency->change) {
-			dependency->change(serviceDependency_getCallbackHandle(dependency), event->service);
-		}
-		if (dependency->change_with_ref) {
-			dependency->change_with_ref(serviceDependency_getCallbackHandle(dependency), event->reference, event->service);
-		}
-	}
-
-	return status;
-}
-
-celix_status_t serviceDependency_invokeRemove(dm_service_dependency_pt dependency, dm_event_pt event) {
-	celix_status_t status = CELIX_SUCCESS;
-
-	if (!dependency) {
-		status = CELIX_ILLEGAL_ARGUMENT;
-	}
-
-	if (status == CELIX_SUCCESS) {
-		if (dependency->remove) {
-			dependency->remove(serviceDependency_getCallbackHandle(dependency), event->service);
-		}
-		if (dependency->remove_with_ref) {
-			dependency->remove_with_ref(serviceDependency_getCallbackHandle(dependency), event->reference, event->service);
-		}
-	}
-
-	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;
-
-	if (!dependency) {
-		status = CELIX_ILLEGAL_ARGUMENT;
-	}
-
-	if (status == CELIX_SUCCESS) {
-		if (dependency->swap) {
-			dependency->swap(serviceDependency_getCallbackHandle(dependency), event->service, newEvent->service);
-		}
-		if (dependency->swap_with_ref) {
-			dependency->swap_with_ref(serviceDependency_getCallbackHandle(dependency), event->reference, event->service, newEvent->reference, newEvent->service);
-		}
-	}
-
-	return status;
-}
-
-celix_status_t serviceDependency_isAvailable(dm_service_dependency_pt dependency, bool *available) {
-	celix_status_t status = CELIX_SUCCESS;
-
-	if (!dependency) {
-		status = CELIX_ILLEGAL_ARGUMENT;
-	}
-
-	if (status == CELIX_SUCCESS) {
-		*available = dependency->available;
-	}
-
-	return status;
-}
-
-celix_status_t serviceDependency_isRequired(dm_service_dependency_pt dependency, bool *required) {
-	celix_status_t status = CELIX_SUCCESS;
-
-	if (!dependency) {
-		status = CELIX_ILLEGAL_ARGUMENT;
-	}
-
-	if (status == CELIX_SUCCESS) {
-		*required = dependency->required;
-	}
-
-	return status;
-}
-
-celix_status_t serviceDependency_isInstanceBound(dm_service_dependency_pt dependency, bool *instanceBound) {
-	celix_status_t status = CELIX_SUCCESS;
-
-	if (!dependency) {
-		status = CELIX_ILLEGAL_ARGUMENT;
-	}
-
-	if (status == CELIX_SUCCESS) {
-		*instanceBound = dependency->instanceBound;
-	}
-
-	return status;
-}
-
-celix_status_t serviceDependency_isAutoConfig(dm_service_dependency_pt dependency, bool *autoConfig) {
-	celix_status_t status = CELIX_SUCCESS;
-
-	if (!dependency) {
-		status = CELIX_ILLEGAL_ARGUMENT;
-	}
-
-	if (status == CELIX_SUCCESS) {
-		*autoConfig = dependency->autoConfigure != NULL;
-	}
-
-	return status;
-}
-
-celix_status_t serviceDependency_getAutoConfig(dm_service_dependency_pt dependency, const void*** autoConfigure) {
-	celix_status_t status = CELIX_SUCCESS;
-
-	if (!dependency) {
-		status = CELIX_ILLEGAL_ARGUMENT;
-	}
-
-	if (status == CELIX_SUCCESS) {
-		*autoConfigure = dependency->autoConfigure;
-	}
-
-	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;
-	}
-
-	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 = event_create(DM_EVENT_ADDED, bundle, context, reference, service, &event);
-	}
-
-	if (status == CELIX_SUCCESS) {
-		component_handleEvent(dependency->component, dependency, event);
-	}
-
-	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;
-	}
-
-	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 = event_create(DM_EVENT_CHANGED, bundle, context, reference, service, &event);
-	}
-
-	if (status == CELIX_SUCCESS) {
-		component_handleEvent(dependency->component, dependency, event);
-	}
-
-	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;
-	}
-
-	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 = event_create(DM_EVENT_REMOVED, bundle, context, reference, service, &event);
-	}
-
-	if (status == CELIX_SUCCESS) {
-		component_handleEvent(dependency->component, dependency, event);
-	}
-
-	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;
-		if (info->filter == 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);
-
-		celixThreadMutex_unlock(&dep->lock);
-	} else {
-		status = CELIX_ENOMEM;
-	}
-
-	if (status == CELIX_SUCCESS) {
-		*out = info;
-	}
-
-	return status;
-}
-
-void dependency_destroyDependencyInfo(dm_service_dependency_info_pt info) {
-	if (info != NULL) {
-		free(info->filter);
-	}
-	free(info);
-}
-
-celix_status_t serviceDependency_setCallbackHandle(dm_service_dependency_pt dependency, void* handle) {
-	dependency->callbackHandle = handle;
-    return CELIX_SUCCESS;
-}
-
-static void* serviceDependency_getCallbackHandle(dm_service_dependency_pt dependency) {
-    return dependency->callbackHandle == NULL ? component_getImplementation(dependency->component) : dependency->callbackHandle;
-}

http://git-wip-us.apache.org/repos/asf/celix/blob/a1c30887/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
deleted file mode 100644
index 4d6f507..0000000
--- a/dependency_manager/private/src/dm_shell_activator.c
+++ /dev/null
@@ -1,94 +0,0 @@
-/**
- *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.
- */
-/*
- * dm_shell_activator.c
- *
- *  \date       16 Oct 2015
- *  \author     <a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
- *  \copyright  Apache License, Version 2.0
- */
-
-#include <constants.h>
-#include "bundle_context.h"
-#include "command.h"
-
-#include "dm_shell_list_command.h"
-#include "shell_constants.h"
-
-struct bundle_instance {
-    service_registration_pt reg;
-    command_service_t  dmCommand;
-    dm_command_handle_t dmHandle;
-};
-
-typedef struct bundle_instance * bundle_instance_pt;
-
-celix_status_t bundleActivator_create(bundle_context_pt context, void **userData) {
-
-	if(userData==NULL){
-		return CELIX_ILLEGAL_ARGUMENT;
-	}
-
-    struct bundle_instance *bi = calloc(sizeof (struct bundle_instance), 1);
-
-    if (bi==NULL) {
-        return CELIX_ENOMEM;
-    }
-
-    bi->dmHandle.context = context;
-    const char* config = NULL;
-    bundleContext_getPropertyWithDefault(context, SHELL_USE_ANSI_COLORS, SHELL_USE_ANSI_COLORS_DEFAULT_VALUE, &config);
-    bi->dmHandle.useColors = config != NULL && strncmp("true", config, 5) == 0;
-
-    (*userData) = bi;
-
-    return CELIX_SUCCESS;
-}
-
-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;
-
-    bi->dmCommand.handle = &bi->dmHandle;
-    bi->dmCommand.executeCommand = (void *)dmListCommand_execute;
-
-    properties_pt props = properties_create();
-    properties_set(props, CELIX_FRAMEWORK_SERVICE_LANGUAGE, CELIX_FRAMEWORK_SERVICE_C_LANGUAGE);
-    properties_set(props, OSGI_SHELL_COMMAND_NAME, "dm");
-    properties_set(props, OSGI_SHELL_COMMAND_USAGE, "dm");
-    properties_set(props, OSGI_SHELL_COMMAND_DESCRIPTION,
-                   "Gives an overview of the component managemend by a dependency manager.");
-
-    status = bundleContext_registerService(context, OSGI_SHELL_COMMAND_SERVICE_NAME, &bi->dmCommand, props, &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) {
-    bundle_instance_pt bi = (bundle_instance_pt) userData;
-    free(bi);
-    return CELIX_SUCCESS;
-}
-

http://git-wip-us.apache.org/repos/asf/celix/blob/a1c30887/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
deleted file mode 100644
index 1600710..0000000
--- a/dependency_manager/private/src/dm_shell_list_command.c
+++ /dev/null
@@ -1,126 +0,0 @@
-/**
- *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.
- */
-/*
- * dm_shell_list_command.c
- *
- *  \date       Oct 16, 2015
- *  \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_dependency_manager.h>
-#include <dm_shell_list_command.h>
-#include "dm_info.h"
-#include "service_reference.h"
-#include "array_list.h"
-#include "bundle_context.h"
-#include "bundle.h"
-#include "shell.h"
-
-
-static const char * const OK_COLOR = "\033[92m";
-static const char * const WARNING_COLOR = "\033[93m";
-static const char * const NOK_COLOR = "\033[91m";
-static const char * const END_COLOR = "\033[m";
-
-void dmListCommand_execute(dm_command_handle_t* handle, char * line, FILE *out, FILE *err) {
-
-    array_list_pt servRefs = NULL;
-    int i;
-    bundleContext_getServiceReferences(handle->context, DM_INFO_SERVICE_NAME ,NULL, &servRefs);
-
-    if(servRefs==NULL){
-	fprintf(out, "Invalid dm_info ServiceReferences List\n");
-	return;
-    }
-
-    bool colors = handle->useColors;
-
-    for(i = 0; i < arrayList_size(servRefs); i++) {
-        dm_dependency_manager_info_pt info = NULL;
-        dm_info_service_pt infoServ = NULL;
-        service_reference_pt servRef = NULL;
-        servRef = arrayList_get(servRefs, i);
-        bundleContext_getService(handle->context,  servRef, (void**)&infoServ);
-        infoServ->getInfo(infoServ->handle, &info);
-
-        int cmpCnt;
-        for (cmpCnt = 0; cmpCnt < arrayList_size(info->components); cmpCnt++) {
-            dm_component_info_pt compInfo = arrayList_get(info->components, cmpCnt);
-            const char *startColors = "";
-            const char *endColors = "";
-            if (colors) {
-                startColors = compInfo->active ? OK_COLOR : NOK_COLOR;
-                endColors = END_COLOR;
-            }
-            fprintf(out, "Component: Name=%s\n|- ID=%s, %sActive=%s%s, State=%s\n", compInfo->name, compInfo->id, startColors, compInfo->active ?  "true " : "false", endColors, compInfo->state);
-
-            int interfCnt;
-            fprintf(out, "|- Interfaces (%d):\n", arrayList_size(compInfo->interfaces));
-            for(interfCnt = 0 ;interfCnt < arrayList_size(compInfo->interfaces); interfCnt++) {
-                dm_interface_info_pt intfInfo= arrayList_get(compInfo->interfaces, interfCnt);
-                fprintf(out, "   |- Interface: %s\n", intfInfo->name);
-
-                hash_map_iterator_t iter = hashMapIterator_construct((hash_map_pt) intfInfo->properties);
-                char* key = NULL;
-                while((key = hashMapIterator_nextKey(&iter)) != NULL) {
-                    fprintf(out, "      | %15s = %s\n", key, properties_get(intfInfo->properties, key));
-                }
-            }
-
-            int depCnt;
-            fprintf(out, "|- Dependencies (%d):\n", arrayList_size(compInfo->dependency_list));
-            for(depCnt = 0 ;depCnt < arrayList_size(compInfo->dependency_list); depCnt++) {
-                dm_service_dependency_info_pt dependency;
-                dependency = arrayList_get(compInfo->dependency_list, depCnt);
-                const char *startColors = "";
-                const char *endColors = "";
-                if (colors) {
-                    if (dependency->required) {
-                        startColors = dependency->available ? OK_COLOR : NOK_COLOR;
-                    } else {
-                        startColors = dependency->available ? OK_COLOR : WARNING_COLOR;
-                    }
-
-                    endColors = END_COLOR;
-                }
-                fprintf(out, "   |- Dependency: %sAvailable = %s%s, Required = %s, Filter = %s\n",
-                        startColors,
-                        dependency->available ? "true " : "false" ,
-                        endColors,
-                        dependency->required ? "true " : "false",
-                        dependency->filter
-                );
-            }
-            fprintf(out, "\n");
-
-		}
-
-            infoServ->destroyInfo(infoServ->handle, info);
-
-		bundleContext_ungetService(handle->context, servRef, NULL);
-		bundleContext_ungetServiceReference(handle->context, servRef);
-
-    }
-
-	if(servRefs!=NULL){
-		arrayList_destroy(servRefs);
-    }
-}

http://git-wip-us.apache.org/repos/asf/celix/blob/a1c30887/dependency_manager/public/include/dm_activator.h
----------------------------------------------------------------------
diff --git a/dependency_manager/public/include/dm_activator.h b/dependency_manager/public/include/dm_activator.h
deleted file mode 100644
index bba62e6..0000000
--- a/dependency_manager/public/include/dm_activator.h
+++ /dev/null
@@ -1,65 +0,0 @@
-/**
- * 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.
- */
-
-/*
- * dm_activator_base.h
- *
- *  \date       26 Jul 2014
- *  \author     <a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
- *  \copyright  Apache License, Version 2.0
- */
-
-
-#ifndef DM_ACTIVATOR_BASE_H_
-#define DM_ACTIVATOR_BASE_H_
-
-
-#include "bundle_context.h"
-#include "celix_errno.h"
-#include "dm_dependency_manager.h"
-#include "bundle_activator.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * Should be implemented by a bundle specific DM activator.
- * Should allocate and initialize a bundle specific activator struct.
- */
-celix_status_t dm_create(bundle_context_pt context, void ** userData);
-
-/**
- * Should be implemented by a bundle specific DM activator.
- * Will be called after the dm_create function.
- * Can be used to specify with use of the provided dependency manager the bundle specific components.
- */
-celix_status_t dm_init(void * userData, bundle_context_pt context, dm_dependency_manager_pt manager);
-
-/**
- * Should be implemented by a bundle specific DM activator.
- * Should deinitialize and deallocate the undle specific activator struct.
- */
-celix_status_t dm_destroy(void * userData, bundle_context_pt context, dm_dependency_manager_pt manager);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* DM_ACTIVATOR_BASE_H_ */

http://git-wip-us.apache.org/repos/asf/celix/blob/a1c30887/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
deleted file mode 100644
index 2cdad6d..0000000
--- a/dependency_manager/public/include/dm_component.h
+++ /dev/null
@@ -1,158 +0,0 @@
-/**
- *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.
- */
-/*
- * dm_component.h
- *
- *  \date       8 Oct 2014
- *  \author     <a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
- *  \copyright  Apache License, Version 2.0
- */
-
-#ifndef COMPONENT_H_
-#define COMPONENT_H_
-
-
-#include <bundle_context.h>
-#include <celix_errno.h>
-
-#include "dm_service_dependency.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef struct dm_component_struct *dm_component_pt;
-
-typedef enum dm_component_state_enum {
-    DM_CMP_STATE_INACTIVE = 1,
-    DM_CMP_STATE_WAITING_FOR_REQUIRED = 2,
-    DM_CMP_STATE_INSTANTIATED_AND_WAITING_FOR_REQUIRED = 3,
-    DM_CMP_STATE_TRACKING_OPTIONAL = 4,
-} dm_component_state_t;
-
-#define DM_COMPONENT_MAX_ID_LENGTH 64
-#define DM_COMPONENT_MAX_NAME_LENGTH 128
-
-typedef int (*init_fpt)(void *userData);
-typedef int (*start_fpt)(void *userData);
-typedef int (*stop_fpt)(void *userData);
-typedef int (*deinit_fpt)(void *userData);
-
-/**
- * Creates a DM Component
- * Caller has ownership.
- */
-celix_status_t component_create(bundle_context_pt context, const char* name, dm_component_pt *component);
-
-/**
- * Destroys a DM Component
- */
-void component_destroy(dm_component_pt component);
-
-
-/**
- * Specify if a default 'service.lang=C' should be added to the properties of interfaces if no 'service.lang' has been
- * provided. Default is false. Note that this should be set before using component_addInterface.
- */
-celix_status_t component_setCLanguageProperty(dm_component_pt component, bool setCLangProp);
-
-
-/**
- * Adds a C interface to provide as service to the Celix framework.
- *
- * @param serviceName the service name.
- * @param version The version of the interface (e.g. "1.0.0"), Can be a NULL pointer.
- * @param properties To (meta) properties to provide with the service. Can be a NULL pointer.
- */
-celix_status_t component_addInterface(dm_component_pt component, const char* serviceName, const char* serviceVersion, const void* service, properties_pt properties);
-
-/**
- * Sets the implementation of the component. e.g. the component handle/self/this pointer.
- */
-celix_status_t component_setImplementation(dm_component_pt component, void* implementation);
-
-/**
- * Returns an arraylist of service names. The caller owns the arraylist and strings (char *)
- */
-celix_status_t component_getInterfaces(dm_component_pt component, array_list_pt *servicesNames);
-
-/**
- * Adds a C service dependency to the component
- */
-celix_status_t component_addServiceDependency(dm_component_pt component, dm_service_dependency_pt dep);
-
-/**
- * Removes a C service dependency to the component
- */
-celix_status_t component_removeServiceDependency(dm_component_pt component, dm_service_dependency_pt dependency);
-
-/**
- * Returns the current state of the component.
- */
-dm_component_state_t component_currentState(dm_component_pt cmp);
-
-/**
- * Returns the implementation of the component. e.g. the component handle/self/this pointer.
- */
-void * component_getImplementation(dm_component_pt cmp);
-
-/**
- * Returns the DM component name. This is used when printing information about the component.
- */
-const char * component_getName(dm_component_pt cmp);
-
-/**
- * Returns bundle context for the bundle where this DM component is part of.
- */
-celix_status_t component_getBundleContext(dm_component_pt component, bundle_context_pt *out);
-
-/**
- * Set the component life cycle callbacks.
- * The first argument will be the component implementation (@see component_getImplementation)
- */
-celix_status_t component_setCallbacks(dm_component_pt component, init_fpt init, start_fpt start, stop_fpt stop, deinit_fpt deinit);
-
-/**
- * Set the component life cycle callbacks using a MACRO for improving the type safety.
- */
-#define component_setCallbacksSafe(dmCmp, type, init, start, stop, deinit) \
-    do {  \
-        int (*tmp_init)(type)   = (init); \
-        int (*tmp_start)(type)  = (start); \
-        int (*tmp_stop)(type)   = (stop); \
-        int (*tmp_deinit)(type) = (deinit); \
-        component_setCallbacks((dmCmp), (init_fpt)tmp_init, (start_fpt)tmp_start, (stop_fpt)tmp_stop, (deinit_fpt)tmp_deinit); \
-    } while(0)
-
-/**
- * Create a DM Component info struct. Containing information about the component.
- * Caller has ownership.
- */
-celix_status_t component_getComponentInfo(dm_component_pt component, dm_component_info_pt *info);
-
-/**
- * Destroys a DM Component info struct.
- */
-void component_destroyComponentInfo(dm_component_info_pt info);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* COMPONENT_H_ */

http://git-wip-us.apache.org/repos/asf/celix/blob/a1c30887/dependency_manager/public/include/dm_dependency_manager.h
----------------------------------------------------------------------
diff --git a/dependency_manager/public/include/dm_dependency_manager.h b/dependency_manager/public/include/dm_dependency_manager.h
deleted file mode 100644
index 89fe51d..0000000
--- a/dependency_manager/public/include/dm_dependency_manager.h
+++ /dev/null
@@ -1,79 +0,0 @@
-/**
- *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.
- */
-/*
- * dm_dependency_manager.h
- *
- *  \date       22 Feb 2014
- *  \author     <a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
- *  \copyright  Apache License, Version 2.0
- */
-
-#ifndef DM_DEPENDENCY_MANAGER_H_
-#define DM_DEPENDENCY_MANAGER_H_
-
-
-#include "bundle_context.h"
-#include "celix_errno.h"
-#include "array_list.h"
-#include "dm_info.h"
-#include "dm_component.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef struct dm_dependency_manager *dm_dependency_manager_pt;
-
-/**
- * Creates a dependency manager.
- * Caller has ownership.
- */
-celix_status_t dependencyManager_create(bundle_context_pt context, dm_dependency_manager_pt *manager);
-
-/**
- * Destroys the provided dependency manager
- */
-void dependencyManager_destroy(dm_dependency_manager_pt manager);
-
-/**
- * Adds a DM component to the dependency manager
- */
-celix_status_t dependencyManager_add(dm_dependency_manager_pt manager, dm_component_pt component);
-
-/**
- * Removes all DM components from the dependency manager
- */
-celix_status_t dependencyManager_removeAllComponents(dm_dependency_manager_pt manager);
-
-/**
- * Create and returns a DM Info struct. Which contains information about the state of the DM components
- * Caller has ownership.
- */
-celix_status_t dependencyManager_getInfo(dm_dependency_manager_pt manager, dm_dependency_manager_info_pt *info);
-
-/**
- * Destroys a DM info struct.
- */
-void dependencyManager_destroyInfo(dm_dependency_manager_pt manager, dm_dependency_manager_info_pt info);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* DM_DEPENDENCY_MANAGER_H_ */

http://git-wip-us.apache.org/repos/asf/celix/blob/a1c30887/dependency_manager/public/include/dm_info.h
----------------------------------------------------------------------
diff --git a/dependency_manager/public/include/dm_info.h b/dependency_manager/public/include/dm_info.h
deleted file mode 100644
index f5e6b47..0000000
--- a/dependency_manager/public/include/dm_info.h
+++ /dev/null
@@ -1,81 +0,0 @@
-/**
- *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.
- */
-/*
- * dm_server.h
- *
- *  \date       15 Oct 2015
- *  \author     <a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
- *  \copyright  Apache License, Version 2.0
- */
-#ifndef CELIX_DM_INFO_SERVICE_H
-#define CELIX_DM_INFO_SERVICE_H
-
-
-
-#include <stdbool.h>
-#include "array_list.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#define DM_INFO_SERVICE_NAME "dm_info"
-
-
-typedef struct dm_interface_info_struct {
-    char* name;
-    properties_pt properties;
-} * dm_interface_info_pt;
-
-typedef struct dm_service_dependency_info_struct {
-    char *filter;
-    bool available;
-    bool required;
-    size_t count;
-} * dm_service_dependency_info_pt;
-
-typedef struct dm_component_info_struct {
-    char id[64];
-    char name[128];
-    bool active;
-    char * state;
-    array_list_pt interfaces;   // type dm_interface_info_pt
-    array_list_pt dependency_list;  // type dm_service_dependency_info_pt
-} * dm_component_info_pt;
-
-typedef struct dm_dependency_manager_info_struct {
-    array_list_pt  components;      // type dm_component_info
-} * dm_dependency_manager_info_pt;
-
-struct dm_info_service_struct {
-    void *handle;
-
-    /*Note: dm_caller has the ownership of the result.*/
-    celix_status_t (*getInfo)(void *handle, dm_dependency_manager_info_pt *info);
-    void (*destroyInfo)(void *handle, dm_dependency_manager_info_pt info);
-};
-
-typedef struct dm_info_service_struct dm_info_service_t;
-typedef dm_info_service_t* dm_info_service_pt;
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif //CELIX_DM_INFO_SERVICE_H

http://git-wip-us.apache.org/repos/asf/celix/blob/a1c30887/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
deleted file mode 100644
index fb34230..0000000
--- a/dependency_manager/public/include/dm_service_dependency.h
+++ /dev/null
@@ -1,171 +0,0 @@
-/**
- *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.
- */
-/*
- * dm_service_dependency.h
- *
- *  \date       8 Oct 2014
- *  \author     <a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
- *  \copyright  Apache License, Version 2.0
- */
-
-#ifndef DM_SERVICE_DEPENDENCY_H_
-#define DM_SERVICE_DEPENDENCY_H_
-
-#include "service_reference.h"
-#include "celix_errno.h"
-#include "dm_info.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-typedef struct dm_service_dependency *dm_service_dependency_pt;
-
-typedef enum dm_service_dependency_strategy_enum {
-	DM_SERVICE_DEPENDENCY_STRATEGY_LOCKING,
-	DM_SERVICE_DEPENDENCY_STRATEGY_SUSPEND
-} dm_service_dependency_strategy_t;
-
-typedef int (*service_set_fpt)(void *handle, const void* service);
-typedef int (*service_add_fpt)(void *handle, const void* service);
-typedef int (*service_change_fpt)(void *handle, const void* service);
-typedef int (*service_remove_fpt)(void *handle, const void* service);
-typedef int (*service_swap_fpt)(void *handle, const void* oldService, const void* newService);
-
-typedef celix_status_t (*service_set_with_ref_fpt)(void *handle, service_reference_pt reference, const void* service);
-typedef celix_status_t (*service_add_with_ref_fpt)(void *handle, service_reference_pt reference, const void* service);
-typedef celix_status_t (*service_change_with_ref_fpt)(void *handle, service_reference_pt reference, const void* service);
-typedef celix_status_t (*service_remove_with_ref_fpt)(void *handle, service_reference_pt reference, const void* service);
-typedef celix_status_t (*service_swap_with_ref_fpt)(void *handle, service_reference_pt oldReference, const void* oldService, service_reference_pt newReference, const void* newService);
-
-/**
- * Create a service dependency.
- * Caller has ownership.
- */
-celix_status_t serviceDependency_create(dm_service_dependency_pt *dependency_ptr);
-
-/**
- * Destroys a service dependency.
- * Caller has ownership.
- */
-celix_status_t serviceDependency_destroy(dm_service_dependency_pt *dependency_ptr);
-
-/**
- * Specify if the service dependency is required. default is false
- */
-celix_status_t serviceDependency_setRequired(dm_service_dependency_pt dependency, bool required);
-
-/**
- * Specify if the servide dependency should add a C language filter for this dependency if no "service.lang" part if found the in the provided filter.
- * Default is false
- */
-celix_status_t serviceDependency_setAddCLanguageFilter(dm_service_dependency_pt dependency, bool addCLangFilter);
-
-
-/**
- * Specify if the service dependency update strategy.
- *
- * The DM_SERVICE_DEPENDENCY_STRATEGY_LOCKING strategy notifies the component in case the dependencies set
- * changes (e.g. a dependency is added/removed): the component is responsible for protecting via locks
- * the dependencies list and check (always under lock) if the service he's depending on is still available.
- *
- * The DM_SERVICE_DEPENDENCY_STRATEGY_SUSPEND (default when no strategy is explicitly set) reliefs the programmer
- * from dealing with service dependencies' consistency issues: in case this strategy is adopted, the component
- * is stopped and restarted (i.e. temporarily suspended) upon service dependencies' changes.
- *
- * Default strategy is DM_SERVICE_DEPENDENCY_STRATEGY_SUSPEND
- */
-celix_status_t serviceDependency_setStrategy(dm_service_dependency_pt dependency,dm_service_dependency_strategy_t strategy);
-
-/**
- * Return the service dependency update strategy.
- */
-celix_status_t serviceDependency_getStrategy(dm_service_dependency_pt dependency,dm_service_dependency_strategy_t* strategy);
-
-/**
- * Set the service name, version range and filter.
- *
- * @param serviceName The service name. Must have a value.
- * @param serviceVersionRange The service version range, can be a NULL pointer.
- * @param filter The (additional) filter to use (e.g. "(location=front)"). Can be a NULL pointer.
- */
-celix_status_t serviceDependency_setService(dm_service_dependency_pt dependency, const char* serviceName, const char* serviceVersionRange, const char* filter);
-
-/**
- * Returns the service depenendy filter.
- */
-celix_status_t serviceDependency_getFilter(dm_service_dependency_pt dependency, const char** filter);
-
-/**
- * Set the set, add, change, remove and swap function callbacks when services specified by the service dependency
- * are (respectively) set, added, changed, removed or swapped.
- * The first argument of the callbacks will be the component implement (@see component_getImplementation)
- * The second the argument a pointer to an instance of a service struct of the specified service dependency.
- */
-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);
-
-/**
- * Set the set, add, change, remove and swap function callbacks when services specified by the service dependency
- * are (respectively) set, added, changed, removed or swapped.
- * The first argument of the callbacks will be the component implement (@see component_getImplementation)
- * The second argument of th callbacks will be a pointer to an instance of a service struct of the specified service dependency.
- * The third argument of th callbacks will be a pointer to a service reference of the a service instance of the specified service dependency.
- */
-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);
-
-/**
- * Specifies which field member (pointer to) to update when a service dependencies is set.
- * If provided the provided service_lock will be used for locking when updating the service instance.
- */
-celix_status_t serviceDependency_setAutoConfigure(dm_service_dependency_pt dependency, celix_thread_mutex_t *service_lock, const void** field);
-
-#define serviceDependency_setCallbacksSafe(dep, cmpType, servType, set, add, change, remove, swap) \
-	do { \
-		int (*tmpSet)(cmpType, servType) = set; \
-		int (*tmpAdd)(cmpType, servType) = add; \
-		int (*tmpChange)(cmpType, servType) = change; \
-		int (*tmpRemove)(cmpType, servType) = remove; \
-		int (*tmpSwap)(cmpType, servType, servType) = swap; \
-		serviceDependency_setCallbacks((dep), (service_set_fpt)tmpSet, (service_add_fpt)tmpAdd, (service_change_fpt)tmpChange, (service_remove_fpt)tmpRemove, (service_swap_fpt)tmpSwap); \
-	} while(0)
-
-/**
- * Set the callback handle to be used in the callbacks. Note that this normally should not be set, because the
- * result of component_getImplementation() is used
- * This can be used in rare cases when the callbacks are actually interceptors. e.g. in the case of C++ support.
- */
-celix_status_t serviceDependency_setCallbackHandle(dm_service_dependency_pt dependency, void* handle);
-
-/**
- * Creates a service dependency info. The service dependency info struct contains information about the service dependency.
- * The caller is the owner
- */
-celix_status_t serviceDependency_getServiceDependencyInfo(dm_service_dependency_pt, dm_service_dependency_info_pt *info);
-
-/**
- * Destroy a provided service dependency info struct.
- */
-void dependency_destroyDependencyInfo(dm_service_dependency_info_pt info);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* DM_SERVICE_DEPENDENCY_H_ */

http://git-wip-us.apache.org/repos/asf/celix/blob/a1c30887/dependency_manager/readme.md
----------------------------------------------------------------------
diff --git a/dependency_manager/readme.md b/dependency_manager/readme.md
index 8b9ce71..f60fdea 100644
--- a/dependency_manager/readme.md
+++ b/dependency_manager/readme.md
@@ -114,17 +114,23 @@ celix_status_t dm_destroy(void * userData, bundle_context_pt context, dm_depende
 }  
 ```
 
+### References
+
+For more information examples please see
+
+- [The Dependency Manager API](public/include): The dependency manager header files
+- [Getting Started: Using Service with C](../documents/getting_started/using_services_with_c.md): A introduction how to work with services using the dependency manager
+- [Dm example](../examples/dm_example): A DM example.
 
-### Dependency Manager Shell support
+## Dependency Manager Shell support
 
 There is support for retrieving information of the dm components with
 use of the `dm` command. This command will print all known dm component,
 their state, provided interfaces and required interfaces.
 
-### References
 
-For more information examples please see
+## Using info
 
-- [The Dependency Manager API](public/include): The dependency manager header files
-- [Getting Started: Using Service with C](../documents/getting_started/using_services_with_c.md): A introduction how to work with services using the dependency manager
-- [Dm example](../examples/dm_example): A DM example.  
+If the Celix Dependency Manager is installed The `FindCelix.cmake` will set:
+ - The `Celix::dm_shell` bundle target
+ - The `Celix::dependency_manger_static` library target

http://git-wip-us.apache.org/repos/asf/celix/blob/a1c30887/dependency_manager/src/dm_activator.c
----------------------------------------------------------------------
diff --git a/dependency_manager/src/dm_activator.c b/dependency_manager/src/dm_activator.c
new file mode 100644
index 0000000..8de3bf1
--- /dev/null
+++ b/dependency_manager/src/dm_activator.c
@@ -0,0 +1,119 @@
+/**
+ * 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.
+ */
+
+#include "dm_activator.h"
+
+#include <stdlib.h>
+
+struct dm_dependency_activator_base {
+    dm_dependency_manager_pt manager;
+    bundle_context_pt context;
+    service_registration_pt reg;
+    dm_info_service_pt info;
+    void* userData;
+};
+
+typedef struct dm_dependency_activator_base * dependency_activator_base_pt;
+
+celix_status_t bundleActivator_create(bundle_context_pt context, void **userData) {
+    celix_status_t status = CELIX_ENOMEM;
+
+    dependency_activator_base_pt dependency_activator = calloc(1, sizeof(struct dm_dependency_activator_base));
+    dm_info_service_pt serv = calloc(1, sizeof(*serv));
+
+    if (dependency_activator != NULL && serv != NULL) {
+        dependency_activator->context = context;
+        dm_create(context, &dependency_activator->userData);
+        dependency_activator->info = serv;
+
+        status = dependencyManager_create(dependency_activator->context, &dependency_activator->manager);
+    } else {
+        status = CELIX_ENOMEM;
+
+    }
+
+    if (status == CELIX_SUCCESS) {
+        *userData = dependency_activator;
+    } else {
+        if (dependency_activator != NULL) {
+            dependencyManager_destroy(dependency_activator->manager);
+        }
+        free(dependency_activator);
+        free(serv);
+    }
+
+    return status;
+}
+
+celix_status_t bundleActivator_start(void * userData, bundle_context_pt context) {
+    celix_status_t status;
+    dependency_activator_base_pt dependency_activator = (dependency_activator_base_pt) userData;
+
+
+    status = dm_init(dependency_activator->userData, context, dependency_activator->manager);
+
+    if (status == CELIX_SUCCESS) {
+        //Create the service
+        dependency_activator->info->handle = dependency_activator->manager;
+        dependency_activator->info->getInfo = (void *) dependencyManager_getInfo;
+        dependency_activator->info->destroyInfo = (void *) dependencyManager_destroyInfo;
+
+        status = bundleContext_registerService(context, DM_INFO_SERVICE_NAME, dependency_activator->info, NULL,
+                                               &(dependency_activator->reg));
+    }
+
+    return status;
+}
+
+celix_status_t bundleActivator_stop(void * userData, bundle_context_pt context __attribute__((unused))) {
+    celix_status_t status = CELIX_SUCCESS;
+    dependency_activator_base_pt dependency_activator = (dependency_activator_base_pt) userData;
+
+    // Remove the service
+    status = serviceRegistration_unregister(dependency_activator->reg);
+    dependencyManager_removeAllComponents(dependency_activator->manager);
+
+    return status;
+}
+
+celix_status_t bundleActivator_destroy(void * userData, bundle_context_pt context __attribute__((unused))) {
+    celix_status_t status = CELIX_SUCCESS;
+    dependency_activator_base_pt dependency_activator = (dependency_activator_base_pt) userData;
+
+    if(dependency_activator==NULL){
+        return CELIX_ILLEGAL_ARGUMENT;
+    }
+
+    status = dm_destroy(dependency_activator->userData, dependency_activator->context,
+                        dependency_activator->manager);
+
+    if (status == CELIX_SUCCESS) {
+        dependencyManager_destroy(dependency_activator->manager);
+    }
+
+    dependency_activator->userData = NULL;
+    dependency_activator->manager = NULL;
+
+    if (dependency_activator != NULL) {
+        free(dependency_activator->info);
+    }
+    free(dependency_activator);
+
+    return status;
+}
\ No newline at end of file