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 2016/10/16 12:47:06 UTC

[6/8] celix git commit: CELIX-282: Removes superfluous examples.

http://git-wip-us.apache.org/repos/asf/celix/blob/505f6a84/examples/locking/mutex_benchmark/private/src/mutex_benchmark.c
----------------------------------------------------------------------
diff --git a/examples/locking/mutex_benchmark/private/src/mutex_benchmark.c b/examples/locking/mutex_benchmark/private/src/mutex_benchmark.c
deleted file mode 100644
index 02470b3..0000000
--- a/examples/locking/mutex_benchmark/private/src/mutex_benchmark.c
+++ /dev/null
@@ -1,135 +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.
- */
-#include <stdlib.h>
-#include <string.h>
-#include <pthread.h>
-#include <sys/time.h>
-#include <stdio.h>
-#include <math.h>
-
-#include "benchmark.h"
-
-static const char * const BENCHMARK_NAME = "MUTEX";
-static const double SAMPLE_FACTOR = 1;
-
-struct benchmark {
-	pthread_mutex_t mutex;
-	math_service_pt math;
-};
-
-typedef struct thread_info {
-	benchmark_pt benchmark;
-	int nrOfSamples;
-	unsigned int result;
-	struct timeval begin;
-	struct timeval end;
-	unsigned int skips;
-} thread_info_t;
-
-static void benchmark_thread(thread_info_t *info);
-
-celix_status_t benchmark_create(benchmark_pt *benchmark) {
-	(*benchmark) = malloc(sizeof(struct benchmark));
-	(*benchmark)->math = NULL;
-	pthread_mutex_init(&(*benchmark)->mutex, NULL);
-	return CELIX_SUCCESS;
-}
-
-celix_status_t benchmark_destroy(benchmark_pt benchmark) {
-	free(benchmark);
-	return CELIX_SUCCESS;
-}
-
-benchmark_result_t benchmark_run(benchmark_pt benchmark, int nrOfThreads, int nrOfSamples) {
-	int i;
-	pthread_t threads[nrOfThreads];
-	thread_info_t infos[nrOfThreads];
-	benchmark_result_t result;
-	memset(&result,0,sizeof(benchmark_result_t));
-	unsigned long elapsedTime = 0;
-
-	result.skips =0;
-
-	for (i = 0 ; i < nrOfThreads ; i += 1) {
-		infos[i].benchmark = benchmark;
-		infos[i].nrOfSamples = nrOfSamples;
-		infos[i].skips = 0;
-		infos[i].result = rand();
-		pthread_create(&threads[i], NULL, (void *)benchmark_thread,  &infos[i]);
-	}
-
-	for (i = 0; i < nrOfThreads ; i += 1) {
-		pthread_join(threads[i], NULL);
-		elapsedTime += ((infos[i].end.tv_sec - infos[i].begin.tv_sec) * 1000000) + (infos[i].end.tv_usec - infos[i].begin.tv_usec);
-		result.skips += infos[i].skips;
-	}
-
-    unsigned int actualSamples = (nrOfSamples * nrOfThreads) - result.skips;
-    if(elapsedTime != 0){
-	result.averageCallTimeInNanoseconds = actualSamples == 0 ? NAN : ((double)elapsedTime * 1000) / (nrOfSamples * nrOfThreads);
-	result.callFrequencyInMhz = ((double)(actualSamples * nrOfThreads) / elapsedTime);
-    }
-	result.nrOfThreads = nrOfThreads;
-	result.nrOfsamples = actualSamples;
-    result.requestedNrOfSamples = (nrOfSamples * nrOfThreads);
-
-	return result;
-}
-
-static void benchmark_thread(thread_info_t *info) {
-	int i;
-
-	gettimeofday(&info->begin, NULL);
-	for (i = 0; i < info->nrOfSamples; i += 1) {
-		pthread_mutex_lock(&info->benchmark->mutex);
-		if (info->benchmark->math != NULL) {
-			info->result = info->benchmark->math->calc(info->benchmark->math->handle, info->result, i);
-		} else {
-			info->skips += 1; //should not happen
-		}
-		pthread_mutex_unlock(&info->benchmark->mutex);
-	}
-	gettimeofday(&info->end, NULL);
-
-}
-
-char * benchmark_getName(benchmark_pt benchmark) {
-	return (char *)BENCHMARK_NAME;
-}
-
-celix_status_t benchmark_addMathService(benchmark_pt benchmark, math_service_pt mathService) {
-	pthread_mutex_lock(&benchmark->mutex);
-	benchmark->math = mathService;
-	pthread_mutex_unlock(&benchmark->mutex);
-	return CELIX_SUCCESS;
-}
-
-celix_status_t benchmark_removeMathService(benchmark_pt benchmark, math_service_pt mathService) {
-	pthread_mutex_lock(&benchmark->mutex);
-	if (benchmark->math == mathService) {
-		benchmark->math = NULL;
-	}
-	pthread_mutex_unlock(&benchmark->mutex);
-	return CELIX_SUCCESS;
-
-}
-
-double benchmark_getSampleFactor(benchmark_pt benchmark) {
-	return SAMPLE_FACTOR;
-}

http://git-wip-us.apache.org/repos/asf/celix/blob/505f6a84/examples/locking/reference_benchmark/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/examples/locking/reference_benchmark/CMakeLists.txt b/examples/locking/reference_benchmark/CMakeLists.txt
deleted file mode 100644
index 017d195..0000000
--- a/examples/locking/reference_benchmark/CMakeLists.txt
+++ /dev/null
@@ -1,29 +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.
-
-add_bundle(reference_benchmark SOURCES
-	../benchmark/public/src/benchmark_activator
-	private/src/reference_benchmark 
-)
-
-include_directories(public/include)
-include_directories(../benchmark/public/include)
-include_directories("${PROJECT_SOURCE_DIR}/framework/public/include")
-include_directories("${PROJECT_SOURCE_DIR}/utils/public/include")
-include_directories("${PROJECT_SOURCE_DIR}/shell/public/include")
-target_link_libraries(reference_benchmark celix_framework)
-

http://git-wip-us.apache.org/repos/asf/celix/blob/505f6a84/examples/locking/reference_benchmark/private/src/reference_benchmark.c
----------------------------------------------------------------------
diff --git a/examples/locking/reference_benchmark/private/src/reference_benchmark.c b/examples/locking/reference_benchmark/private/src/reference_benchmark.c
deleted file mode 100644
index 0cc0c33..0000000
--- a/examples/locking/reference_benchmark/private/src/reference_benchmark.c
+++ /dev/null
@@ -1,128 +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.
- */
-
-#include <stdlib.h>
-#include <pthread.h>
-#include <unistd.h>
-#include <sys/time.h>
-
-#include "benchmark.h"
-
-static const char * const BENCHMARK_NAME = "REFERENCE";
-static const double SAMPLE_FACTOR = 100;
-
-typedef struct thread_info {
-	benchmark_pt benchmark;
-	int nrOfSamples;
-	unsigned int result;
-	struct timeval begin;
-	struct timeval end;
-	int skips;
-} thread_info_t;
-
-static void benchmark_thread(thread_info_t *info);
-static int benchmark_calc(int arg1, int arg2);
-
-celix_status_t benchmark_create(benchmark_pt *benchmark) {
-	//do nothing
-	return CELIX_SUCCESS;
-}
-
-celix_status_t benchmark_destroy(benchmark_pt benchmark) {
-	//do nothing
-	return CELIX_SUCCESS;
-}
-
-benchmark_result_t benchmark_run(benchmark_pt benchmark, int nrOfThreads, int nrOfSamples) {
-	int i;
-	pthread_t threads[nrOfThreads];
-	thread_info_t infos[nrOfThreads];
-	benchmark_result_t result;
-	unsigned long elapsedTime = 0;
-
-	result.skips =0;
-
-	for (i = 0 ; i < nrOfThreads ; i += 1) {
-		infos[i].benchmark = benchmark;
-		infos[i].nrOfSamples = nrOfSamples;
-		infos[i].skips = 0;
-		infos[i].result = rand();
-		pthread_create(&threads[i], NULL, (void *)benchmark_thread,  &infos[i]);
-	}
-
-	for (i = 0; i < nrOfThreads ; i += 1) {
-		pthread_join(threads[i], NULL);
-		elapsedTime += ((infos[i].end.tv_sec - infos[i].begin.tv_sec) * 1000000) + (infos[i].end.tv_usec - infos[i].begin.tv_usec);
-		result.skips += infos[i].skips;
-	}
-
-	result.averageCallTimeInNanoseconds = elapsedTime;
-	result.averageCallTimeInNanoseconds *= 1000;
-	result.averageCallTimeInNanoseconds /= nrOfSamples;
-	result.averageCallTimeInNanoseconds /= nrOfThreads;
-	result.callFrequencyInMhz = ((double)(nrOfSamples * nrOfThreads) / elapsedTime);
-	result.nrOfThreads = nrOfThreads;
-	result.nrOfsamples = nrOfSamples;
-
-	return result;
-}
-
-static void benchmark_thread(thread_info_t *info) {
-	int i;
-
-	int result = info->result;
-	struct timeval *begin = &info->begin;
-	struct timeval *end = &info->end;
-	int nrOFSamples = info->nrOfSamples;
-
-
-	gettimeofday(begin, NULL);
-	for (i = 0; i < nrOFSamples; i += 1) {
-		result = benchmark_calc(result, i);
-	}
-	gettimeofday(end, NULL);
-
-	info->result = result;
-}
-
-char * benchmark_getName(benchmark_pt benchmark) {
-	return (char *)BENCHMARK_NAME;
-}
-
-celix_status_t benchmark_addMathService(benchmark_pt benchmark, math_service_pt mathService) {
-	//ignore service is not used
-	return CELIX_SUCCESS;
-}
-
-celix_status_t benchmark_removeMathService(benchmark_pt benchmark, math_service_pt mathService) {
-	//ignore service is not used
-	return CELIX_SUCCESS;
-
-}
-
-/*
- * Same implementation as the math_service. This function is used a reference.
- */
-static int benchmark_calc(int arg1, int arg2) {
-	return  arg1 * arg2 + arg2;
-}
-
-double benchmark_getSampleFactor(benchmark_pt benchmark) {
-	return SAMPLE_FACTOR;
-}

http://git-wip-us.apache.org/repos/asf/celix/blob/505f6a84/examples/locking/services/benchmark_service.h
----------------------------------------------------------------------
diff --git a/examples/locking/services/benchmark_service.h b/examples/locking/services/benchmark_service.h
deleted file mode 100644
index d0a1a9c..0000000
--- a/examples/locking/services/benchmark_service.h
+++ /dev/null
@@ -1,39 +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.
- */
-
-#ifndef BENCHMARK_SERVICE_H_
-#define BENCHMARK_SERVICE_H_
-
-#include "benchmark_result.h"
-
-typedef struct benchmark_service *benchmark_service_pt;
-
-typedef struct benchmark_handler *benchmark_handler_pt; //ADT
-
-#define BENCHMARK_SERVICE_NAME "benchmark_service"
-
-struct benchmark_service {
-	benchmark_handler_pt handler;
-
-	benchmark_result_t (*run)(benchmark_handler_pt handler, int nrOfThreads, int nrOfSamples);
-	char * (*name)(benchmark_handler_pt handler);
-	double (*getSampleFactor)(benchmark_handler_pt benchmark);
-};
-
-#endif /* BENCHMARK_SERVICE_H_ */

http://git-wip-us.apache.org/repos/asf/celix/blob/505f6a84/examples/locking/services/frequency_service.h
----------------------------------------------------------------------
diff --git a/examples/locking/services/frequency_service.h b/examples/locking/services/frequency_service.h
deleted file mode 100644
index 8f4ad12..0000000
--- a/examples/locking/services/frequency_service.h
+++ /dev/null
@@ -1,47 +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.
- */
-/*
- * frequence_service.h
- *
- *  \date       Feb 4, 2014
- *  \author    	<a href="mailto:celix-dev@incubator.apache.org">Apache Celix Project Team</a>
- *  \copyright	Apache License, Version 2.0
- */
-
-//TODO change to math provider service ???
-
-#ifndef FREQUENCY_SERVICE_H
-#define FREQUENCY_SERVICE_H
-
-#define FREQUENCY_SERVICE_NAME "frequency_service"
-
-typedef struct frequency_hander frequence_handler_t;
-
-struct frequency_service {
-	frequence_handler_t *handle;
-	void (*setFrequency)(frequence_handler_t *handle, double freq);
-	void (*resetCounter)(frequence_handler_t *handle);
-	unsigned int (*getCounter)(frequence_handler_t *handle);
-	void (*setBenchmarkName)(frequence_handler_t *handle, char *name);
-	void (*setNrOfThreads)(frequence_handler_t *handle, unsigned int nrOfThreads);
-};
-
-typedef struct frequency_service * frequency_service_pt;
-
-#endif /* FREQUENCY_SERVICE_H */

http://git-wip-us.apache.org/repos/asf/celix/blob/505f6a84/examples/locking/services/math_service.h
----------------------------------------------------------------------
diff --git a/examples/locking/services/math_service.h b/examples/locking/services/math_service.h
deleted file mode 100644
index 23de461..0000000
--- a/examples/locking/services/math_service.h
+++ /dev/null
@@ -1,40 +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.
- */
-/*
- * echo_server.h
- *
- *  \date       Sep 21, 2010
- *  \author    	<a href="mailto:celix-dev@incubator.apache.org">Apache Celix Project Team</a>
- *  \copyright	Apache License, Version 2.0
- */
-
-#ifndef MATH_SERVICE_H 
-#define MATH_SERVICE_H 
-
-#define MATH_SERVICE_NAME "math_service"
-
-
-struct math_service {
-	void *handle;
-	int (*calc)(void *handle, int arg1, int arg2);
-};
-
-typedef struct math_service *math_service_pt;
-
-#endif /* MATH_SERVICE_H */

http://git-wip-us.apache.org/repos/asf/celix/blob/505f6a84/examples/locking/start_stop_benchmark/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/examples/locking/start_stop_benchmark/CMakeLists.txt b/examples/locking/start_stop_benchmark/CMakeLists.txt
deleted file mode 100644
index ec88166..0000000
--- a/examples/locking/start_stop_benchmark/CMakeLists.txt
+++ /dev/null
@@ -1,29 +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.
-
-add_bundle(start_stop_benchmark SOURCES
-	../benchmark/public/src/benchmark_activator
-	private/src/start_stop_benchmark 
-)
-
-include_directories(public/include)
-include_directories(../benchmark/public/include)
-include_directories("${PROJECT_SOURCE_DIR}/framework/public/include")
-include_directories("${PROJECT_SOURCE_DIR}/utils/public/include")
-include_directories("${PROJECT_SOURCE_DIR}/shell/public/include")
-target_link_libraries(start_stop_benchmark celix_framework)
-

http://git-wip-us.apache.org/repos/asf/celix/blob/505f6a84/examples/locking/start_stop_benchmark/private/src/start_stop_benchmark.c
----------------------------------------------------------------------
diff --git a/examples/locking/start_stop_benchmark/private/src/start_stop_benchmark.c b/examples/locking/start_stop_benchmark/private/src/start_stop_benchmark.c
deleted file mode 100644
index b86af52..0000000
--- a/examples/locking/start_stop_benchmark/private/src/start_stop_benchmark.c
+++ /dev/null
@@ -1,201 +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.
- */
-
-#include <stdlib.h>
-#include <pthread.h>
-#include <unistd.h>
-#include <sys/time.h>
-#include <stdio.h>
-
-#include "benchmark.h"
-
-static const char * const BENCHMARK_NAME = "INTR_CONT";
-static const double SAMPLE_FACTOR = 100;
-static const __useconds_t WAIT_TIME = 1; //100 * 1000;
-
-typedef enum benchmark_state {
-	BENCHMARK_STATE_INTERRUPTED,
-	BENCHMARK_STATE_RUNNING
-} benchmark_state_t;
-
-struct benchmark {
-	int nrOfThreads;
-	pthread_mutex_t mutex; //write protect for state
-	math_service_pt math;
-	benchmark_state_t state;
-	int threadsRunning;
-};
-
-typedef struct thread_info {
-	benchmark_pt benchmark;
-	int nrOfSamples;
-	unsigned int result;
-	struct timeval begin;
-	struct timeval end;
-	int skips;
-} thread_info_t;
-
-static void benchmark_thread(thread_info_t *info);
-static void benchmark_runSamples(thread_info_t *info, int *i, volatile benchmark_state_t *state);
-static void benchmark_interrupt(benchmark_pt benchmark);
-static void benchmark_continue(benchmark_pt benchmark);
-
-celix_status_t benchmark_create(benchmark_pt *benchmark) {
-	(*benchmark) = malloc(sizeof(struct benchmark));
-	(*benchmark)->math = NULL;
-	(*benchmark)->state = BENCHMARK_STATE_INTERRUPTED;
-	(*benchmark)->nrOfThreads = 0;
-	(*benchmark)->threadsRunning = 0;
-
-	pthread_mutex_init(&(*benchmark)->mutex, NULL);
-
-	return CELIX_SUCCESS;
-}
-
-celix_status_t benchmark_destroy(benchmark_pt benchmark) {
-	free(benchmark);
-
-	return CELIX_SUCCESS;
-}
-
-benchmark_result_t benchmark_run(benchmark_pt benchmark, int nrOfThreads, int nrOfSamples) {
-	int i;
-	pthread_t threads[nrOfThreads];
-	thread_info_t infos[nrOfThreads];
-	int isThreadRunning[nrOfThreads];
-	benchmark_result_t result;
-	unsigned long elapsedTime = 0;
-	result.skips =0;
-
-	for (i = 0 ; i < nrOfThreads ; i += 1) {
-		infos[i].benchmark = benchmark;
-		infos[i].nrOfSamples = nrOfSamples;
-		infos[i].skips = 0;
-		infos[i].result = rand();
-		pthread_create(&threads[i], NULL, (void *)benchmark_thread,  &infos[i]);
-	}
-
-	benchmark->nrOfThreads = nrOfThreads;
-
-	for (i = 0; i < nrOfThreads ; i += 1) {
-		pthread_join(threads[i], NULL);
-		elapsedTime += ((infos[i].end.tv_sec - infos[i].begin.tv_sec) * 1000000) + (infos[i].end.tv_usec - infos[i].begin.tv_usec);
-		result.skips += infos[i].skips;
-	}
-
-	benchmark->nrOfThreads = 0;
-
-	result.averageCallTimeInNanoseconds = elapsedTime;
-	result.averageCallTimeInNanoseconds *= 1000;
-	result.averageCallTimeInNanoseconds /= nrOfSamples;
-	result.averageCallTimeInNanoseconds /= nrOfThreads;
-	result.callFrequencyInMhz = ((double)(nrOfSamples * nrOfThreads) / elapsedTime);
-	result.nrOfThreads = nrOfThreads;
-	result.nrOfsamples = nrOfSamples;
-
-	return result;
-}
-
-static void benchmark_thread(thread_info_t *info) {
-	int i = 0;
-
-	gettimeofday(&info->begin, NULL);
-	while (i < info->nrOfSamples) {
-		if (info->benchmark->state == BENCHMARK_STATE_RUNNING ) {
-			//TODO race condition?? or not because of the mutex on changing the state
-			__sync_add_and_fetch(&info->benchmark->threadsRunning, 1);
-			benchmark_runSamples(info, &i, &info->benchmark->state);
-			__sync_sub_and_fetch(&info->benchmark->threadsRunning, 1);
-		} else {
-			usleep(WAIT_TIME);
-		}
-	}
-	gettimeofday(&info->end, NULL);
-
-}
-
-static void benchmark_runSamples(thread_info_t *info, int *i, volatile benchmark_state_t *state) {
-	int nrOfSamples = info->nrOfSamples;
-	unsigned int result = info->result;
-	math_service_pt math = info->benchmark->math;
-
-	for (; *i < nrOfSamples && *state == BENCHMARK_STATE_RUNNING; *i += 1) {
-		result = math->calc(math->handle, result, *i);
-	}
-
-	info->result = result;
-}
-
-char * benchmark_getName(benchmark_pt benchmark) {
-	return (char *)BENCHMARK_NAME;
-}
-
-static void benchmark_continue(benchmark_pt benchmark) {
-	benchmark->state = BENCHMARK_STATE_RUNNING;
-	unsigned long waitTime = 0;
-	while (benchmark->threadsRunning < benchmark->nrOfThreads) {
-		usleep(WAIT_TIME);
-		waitTime += WAIT_TIME;
-		if (waitTime > 1000 * 1000 * 2) {
-			printf("still waiting to stop, running threads are %i\n",
-					benchmark->threadsRunning);
-		}
-	}
-}
-
-static void benchmark_interrupt(benchmark_pt benchmark) {
-	int i = 0;
-	unsigned long waitTime = 0;
-	if (benchmark->state == BENCHMARK_STATE_RUNNING) {
-		benchmark->state = BENCHMARK_STATE_INTERRUPTED;
-		while (benchmark->threadsRunning > 0) {
-			usleep(WAIT_TIME);
-			waitTime += WAIT_TIME;
-			if (waitTime > 1000 * 1000 * 2) {
-				printf("still waiting to stop, running threads are %i\n",
-						benchmark->threadsRunning);
-			}
-		}
-	}
-}
-
-celix_status_t benchmark_addMathService(benchmark_pt benchmark, math_service_pt mathService) {
-	pthread_mutex_lock(&benchmark->mutex);
-	benchmark_interrupt(benchmark);
-	benchmark->math = mathService;
-	benchmark_continue(benchmark);
-	pthread_mutex_unlock(&benchmark->mutex);
-	return CELIX_SUCCESS;
-}
-
-celix_status_t benchmark_removeMathService(benchmark_pt benchmark, math_service_pt mathService) {
-	pthread_mutex_lock(&benchmark->mutex);
-	if (benchmark->math == mathService) {
-		benchmark_interrupt(benchmark);
-		benchmark->math = NULL;
-		benchmark_continue(benchmark);
-	}
-	pthread_mutex_unlock(&benchmark->mutex);
-	return CELIX_SUCCESS;
-
-}
-
-double benchmark_getSampleFactor(benchmark_pt benchmark) {
-	return SAMPLE_FACTOR;
-}

http://git-wip-us.apache.org/repos/asf/celix/blob/505f6a84/examples/mongoose/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/examples/mongoose/CMakeLists.txt b/examples/mongoose/CMakeLists.txt
index 8a71ac1..f4250ef 100644
--- a/examples/mongoose/CMakeLists.txt
+++ b/examples/mongoose/CMakeLists.txt
@@ -38,3 +38,5 @@ add_bundle(mongoose
 bundle_files(mongoose ${CMAKE_CURRENT_LIST_DIR}/root)
 
 target_link_libraries(mongoose celix_framework mongooselib ${LIBS})
+
+add_deploy("mongoose_deploy" BUNDLES shell shell_tui log_service mongoose)

http://git-wip-us.apache.org/repos/asf/celix/blob/505f6a84/examples/osgi-in-action/chapter01-greeting-example/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/examples/osgi-in-action/chapter01-greeting-example/CMakeLists.txt b/examples/osgi-in-action/chapter01-greeting-example/CMakeLists.txt
deleted file mode 100644
index 5434968..0000000
--- a/examples/osgi-in-action/chapter01-greeting-example/CMakeLists.txt
+++ /dev/null
@@ -1,19 +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.
-
-add_subdirectory(greeting)
-add_subdirectory(client)

http://git-wip-us.apache.org/repos/asf/celix/blob/505f6a84/examples/osgi-in-action/chapter01-greeting-example/README.TXT
----------------------------------------------------------------------
diff --git a/examples/osgi-in-action/chapter01-greeting-example/README.TXT b/examples/osgi-in-action/chapter01-greeting-example/README.TXT
deleted file mode 100644
index 1e4f7ef..0000000
--- a/examples/osgi-in-action/chapter01-greeting-example/README.TXT
+++ /dev/null
@@ -1,24 +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.
- 
-The example activates the bundles `chapter01-greeting-example` and  `chapter01-greeting-example-client`.
-The activator of the client bundle (client.c) tries to find the greeting service, but may fail at start-up,
-because it is activated before the greeting service is installed.
-
-When the text 'Greetings' does not appear, stop and start the `chapter01-greeting-example-client` bundle.
-Now the `chapter01-greeting-example` is already installed and the text `Greetings` does appear after the 
-restart of the client bundle.

http://git-wip-us.apache.org/repos/asf/celix/blob/505f6a84/examples/osgi-in-action/chapter01-greeting-example/client/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/examples/osgi-in-action/chapter01-greeting-example/client/CMakeLists.txt b/examples/osgi-in-action/chapter01-greeting-example/client/CMakeLists.txt
deleted file mode 100644
index 4639292..0000000
--- a/examples/osgi-in-action/chapter01-greeting-example/client/CMakeLists.txt
+++ /dev/null
@@ -1,21 +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.
-
-add_bundle(chapter01-greeting-example-client VERSION 0.0.1 SOURCES private/src/client)
-include_directories("${PROJECT_SOURCE_DIR}/utils/public/include")
-include_directories("../greeting/public/include")
-target_link_libraries(chapter01-greeting-example-client celix_framework)

http://git-wip-us.apache.org/repos/asf/celix/blob/505f6a84/examples/osgi-in-action/chapter01-greeting-example/client/private/src/client.c
----------------------------------------------------------------------
diff --git a/examples/osgi-in-action/chapter01-greeting-example/client/private/src/client.c b/examples/osgi-in-action/chapter01-greeting-example/client/private/src/client.c
deleted file mode 100644
index dfae0ce..0000000
--- a/examples/osgi-in-action/chapter01-greeting-example/client/private/src/client.c
+++ /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.
- */
-/*
- * client.c
- *
- *  \date       Sep 29, 2011
- *  \author    	<a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
- *  \copyright	Apache License, Version 2.0
- */
-#include <stdlib.h>
-#include <stdio.h>
-
-#include "bundle_activator.h"
-#include "greeting_service.h"
-
-
-celix_status_t bundleActivator_create(bundle_context_pt  __attribute__((unused)) context, void **userData) {
-	*userData = NULL;
-	return CELIX_SUCCESS;
-}
-
-celix_status_t bundleActivator_start(void __attribute__((unused)) * userData, bundle_context_pt ctx) {
-	service_reference_pt ref = NULL;
-	celix_status_t status = bundleContext_getServiceReference(ctx, (char *) GREETING_SERVICE_NAME, &ref);
-	if (status == CELIX_SUCCESS) {
-		if (ref == NULL) {
-			printf("Greeting service reference not available\n");
-		} else {
-			greeting_service_pt greeting = NULL;
-			bundleContext_getService(ctx, ref, (void *) &greeting);
-			if (greeting == NULL){
-				printf("Greeting service not available\n");
-			} else {
-				bool result;
-				(*greeting->greeting_sayHello)(greeting->instance);
-				bundleContext_ungetService(ctx, ref, &result);
-			}
-		}
-	}
-	return status;
-}
-
-celix_status_t bundleActivator_stop(void __attribute__((unused)) * userData, bundle_context_pt  __attribute__((unused)) context) {
-	return CELIX_SUCCESS;
-}
-
-celix_status_t bundleActivator_destroy(void __attribute__((unused)) * userData, bundle_context_pt  __attribute__((unused)) context) {
-	return CELIX_SUCCESS;
-}

http://git-wip-us.apache.org/repos/asf/celix/blob/505f6a84/examples/osgi-in-action/chapter01-greeting-example/greeting/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/examples/osgi-in-action/chapter01-greeting-example/greeting/CMakeLists.txt b/examples/osgi-in-action/chapter01-greeting-example/greeting/CMakeLists.txt
deleted file mode 100644
index 625cbda..0000000
--- a/examples/osgi-in-action/chapter01-greeting-example/greeting/CMakeLists.txt
+++ /dev/null
@@ -1,28 +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.
-
-add_bundle(chapter01-greeting-example VERSION 0.0.1 SOURCES
-    private/src/activator
-    private/src/greeting_impl
-    
-    private/include/greeting_impl.h
-)
-
-include_directories("${PROJECT_SOURCE_DIR}/utils/public/include")
-include_directories("public/include")
-include_directories("private/include")
-target_link_libraries(chapter01-greeting-example celix_framework)

http://git-wip-us.apache.org/repos/asf/celix/blob/505f6a84/examples/osgi-in-action/chapter01-greeting-example/greeting/private/include/greeting_impl.h
----------------------------------------------------------------------
diff --git a/examples/osgi-in-action/chapter01-greeting-example/greeting/private/include/greeting_impl.h b/examples/osgi-in-action/chapter01-greeting-example/greeting/private/include/greeting_impl.h
deleted file mode 100644
index 8ea2091..0000000
--- a/examples/osgi-in-action/chapter01-greeting-example/greeting/private/include/greeting_impl.h
+++ /dev/null
@@ -1,38 +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.
- */
-/*
- * greeting_impl.h
- *
- *  \date       Sep 29, 2011
- *  \author    	<a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
- *  \copyright	Apache License, Version 2.0
- */
-#ifndef GREETING_IMPL_H_
-#define GREETING_IMPL_H_
-
-#include "greeting_service.h"
-
-struct greeting {
-	char *name;
-};
-
-extern void greeting_sayHello(greeting_pt instance);
-
-
-#endif /* GREETING_IMPL_H_ */

http://git-wip-us.apache.org/repos/asf/celix/blob/505f6a84/examples/osgi-in-action/chapter01-greeting-example/greeting/private/src/activator.c
----------------------------------------------------------------------
diff --git a/examples/osgi-in-action/chapter01-greeting-example/greeting/private/src/activator.c b/examples/osgi-in-action/chapter01-greeting-example/greeting/private/src/activator.c
deleted file mode 100644
index d5b0b3f..0000000
--- a/examples/osgi-in-action/chapter01-greeting-example/greeting/private/src/activator.c
+++ /dev/null
@@ -1,91 +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.
- */
-/*
- * activator.c
- *
- *  \date       Sep 29, 2011
- *  \author    	<a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
- *  \copyright	Apache License, Version 2.0
- */
-#include <stdlib.h>
-
-#include "bundle_activator.h"
-#include "greeting_impl.h"
-
-struct greetingActivator {
-	service_registration_pt reg;
-	greeting_service_pt greetingService;
-};
-
-typedef struct greetingActivator *greeting_activator_pt;
-
-celix_status_t bundleActivator_create(bundle_context_pt  __attribute__((unused)) context, void **userData) {
-	celix_status_t status = CELIX_SUCCESS;
-	greeting_activator_pt activator;
-	*userData = calloc(1, sizeof(struct greetingActivator));
-	if (*userData) {
-		activator = *userData;
-		activator->reg = NULL;
-	} else {
-		status = CELIX_ENOMEM;
-	}
-	return status;
-}
-
-celix_status_t bundleActivator_start(void * userData, bundle_context_pt context) {
-	celix_status_t status;
-
-	greeting_activator_pt act = (greeting_activator_pt) userData;
-
-	act->greetingService = calloc(1, sizeof(*act->greetingService));
-
-	if (act->greetingService) {
-		act->greetingService->instance = calloc(1, sizeof(*act->greetingService->instance));
-		if (act->greetingService->instance) {
-			act->greetingService->instance->name = GREETING_SERVICE_NAME;
-			act->greetingService->greeting_sayHello = greeting_sayHello;
-
-			status = bundleContext_registerService(context, GREETING_SERVICE_NAME, act->greetingService, NULL, &act->reg);
-		} else {
-			status = CELIX_ENOMEM;
-		}
-	} else {
-		status = CELIX_ENOMEM;
-	}
-	return status;
-}
-
-celix_status_t bundleActivator_stop(void * userData, bundle_context_pt  __attribute__((unused)) context) {
-	celix_status_t status = CELIX_SUCCESS;
-
-	greeting_activator_pt act = (greeting_activator_pt) userData;
-
-	serviceRegistration_unregister(act->reg);
-	act->reg = NULL;
-
-	free(act->greetingService->instance);
-	free(act->greetingService);
-
-	return status;
-}
-
-celix_status_t bundleActivator_destroy(void * userData, bundle_context_pt  __attribute__((unused)) context) {
-	free(userData);
-	return CELIX_SUCCESS;
-}

http://git-wip-us.apache.org/repos/asf/celix/blob/505f6a84/examples/osgi-in-action/chapter01-greeting-example/greeting/private/src/greeting_impl.c
----------------------------------------------------------------------
diff --git a/examples/osgi-in-action/chapter01-greeting-example/greeting/private/src/greeting_impl.c b/examples/osgi-in-action/chapter01-greeting-example/greeting/private/src/greeting_impl.c
deleted file mode 100644
index abe60cc..0000000
--- a/examples/osgi-in-action/chapter01-greeting-example/greeting/private/src/greeting_impl.c
+++ /dev/null
@@ -1,32 +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.
- */
-/*
- * greeting_impl.c
- *
- *  \date       Sep 29, 2011
- *  \author    	<a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
- *  \copyright	Apache License, Version 2.0
- */
-#include <stdio.h>
-#include "greeting_impl.h"
-
-void greeting_sayHello(greeting_pt instance){
-	printf("Greetings from %s\n", instance->name);
-}
-

http://git-wip-us.apache.org/repos/asf/celix/blob/505f6a84/examples/osgi-in-action/chapter01-greeting-example/greeting/public/include/greeting_service.h
----------------------------------------------------------------------
diff --git a/examples/osgi-in-action/chapter01-greeting-example/greeting/public/include/greeting_service.h b/examples/osgi-in-action/chapter01-greeting-example/greeting/public/include/greeting_service.h
deleted file mode 100644
index 9b528ef..0000000
--- a/examples/osgi-in-action/chapter01-greeting-example/greeting/public/include/greeting_service.h
+++ /dev/null
@@ -1,39 +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.
- */
-/*
- * greeting_service.h
- *
- *  \date       Sep 29, 2011
- *  \author    	<a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
- *  \copyright	Apache License, Version 2.0
- */
-#ifndef GREETING_H_
-#define GREETING_H_
-
-#define GREETING_SERVICE_NAME "greeting-service"
-
-typedef struct greeting *greeting_pt;
-typedef struct greeting_service *greeting_service_pt;
-
-struct greeting_service {
-	greeting_pt instance;
-	void (*greeting_sayHello)(greeting_pt instance);
-};
-
-#endif /* GREETING_H_ */

http://git-wip-us.apache.org/repos/asf/celix/blob/505f6a84/examples/osgi-in-action/chapter04-correct-listener/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/examples/osgi-in-action/chapter04-correct-listener/CMakeLists.txt b/examples/osgi-in-action/chapter04-correct-listener/CMakeLists.txt
deleted file mode 100644
index 2e68124..0000000
--- a/examples/osgi-in-action/chapter04-correct-listener/CMakeLists.txt
+++ /dev/null
@@ -1,22 +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.
-
-SET(BUNDLE_SYMBOLICNAME "apache_celix_examples_chapter04_correct_listener")
-add_bundle(chapter04-correct-listener VERSION 0.0.1 SOURCES private/src/listener_example)
-include_directories("${PROJECT_SOURCE_DIR}/utils/public/include")
-include_directories("${PROJECT_SOURCE_DIR}/log_service/public/include")
-target_link_libraries(chapter04-correct-listener celix_framework)

http://git-wip-us.apache.org/repos/asf/celix/blob/505f6a84/examples/osgi-in-action/chapter04-correct-listener/README.TXT
----------------------------------------------------------------------
diff --git a/examples/osgi-in-action/chapter04-correct-listener/README.TXT b/examples/osgi-in-action/chapter04-correct-listener/README.TXT
deleted file mode 100644
index 355d1ad..0000000
--- a/examples/osgi-in-action/chapter04-correct-listener/README.TXT
+++ /dev/null
@@ -1,23 +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.
-
-In the log server a listener registers when the log_service bundle is stopped and 
-started by means of the serviceChanged() routine. This routine maintains the set of log
-services in the variable m_logServiceRefs. The function getLogService() returns the
-current LOG_SERVICE, if it is active or NULL.
-Starting and stopping the log_service bundle shows that the logServiceTest thread 
-correctly recognizes the non-availability of the log_services, when stopped.

http://git-wip-us.apache.org/repos/asf/celix/blob/505f6a84/examples/osgi-in-action/chapter04-correct-listener/private/src/listener_example.c
----------------------------------------------------------------------
diff --git a/examples/osgi-in-action/chapter04-correct-listener/private/src/listener_example.c b/examples/osgi-in-action/chapter04-correct-listener/private/src/listener_example.c
deleted file mode 100644
index 5ee35a3..0000000
--- a/examples/osgi-in-action/chapter04-correct-listener/private/src/listener_example.c
+++ /dev/null
@@ -1,197 +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.
- */
-/*
- * listener_example.c
- *
- *  \date       Sep 22, 2011
- *  \author    	<a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
- *  \copyright	Apache License, Version 2.0
- */
-#include <stdlib.h>
-#include <stdio.h>
-#include <unistd.h>
-
-#include "bundle_activator.h"
-#include "log_service.h"
-
-struct listenerActivator {
-    bundle_context_pt context;
-    service_listener_pt listener;
-
-    celix_thread_t logger;
-    celix_thread_mutex_t logServiceReferencesLock;
-
-    array_list_pt logServiceReferences;
-
-    bool running;
-};
-
-void listenerExample_serviceChanged(service_listener_pt listener, service_event_pt event);
-celix_status_t listenerExample_getLogService(struct listenerActivator *activator, log_service_pt *service);
-
-static void* listenerExample_logger(void* data);
-
-celix_status_t listenerExample_alternativeLog(struct listenerActivator *activator, char *message);
-
-static celix_status_t ref_equals(const void *a, const void *b, bool *equals) {
-    return serviceReference_equals((void*)a, (void*)b, equals);
-}
-
-celix_status_t bundleActivator_create(bundle_context_pt context, void **userData) {
-    celix_status_t status = CELIX_SUCCESS;
-
-    *userData = calloc(1, sizeof(struct listenerActivator));
-    if (!*userData) {
-        status = CELIX_ENOMEM;
-    } else {
-        struct listenerActivator *activator = (*userData);
-        activator->context = context;
-        activator->listener = NULL;
-        activator->logServiceReferences = NULL;
-        arrayList_createWithEquals(ref_equals, &activator->logServiceReferences);
-        activator->running = false;
-
-        status = celixThreadMutex_create(&activator->logServiceReferencesLock, NULL);
-    }
-
-    return status;
-}
-
-celix_status_t bundleActivator_start(void * userData, bundle_context_pt context) {
-    celix_status_t status = CELIX_SUCCESS;
-    struct listenerActivator *activator = userData;
-
-    service_listener_pt listener = calloc(1, sizeof(*listener));
-    if (!listener) {
-        status = CELIX_ENOMEM;
-    } else {
-        char filter[30];
-        array_list_pt logServices = NULL;
-        sprintf(filter, "(objectClass=%s)", OSGI_LOGSERVICE_NAME);
-
-        listener->handle = activator;
-        listener->serviceChanged = (void *) listenerExample_serviceChanged;
-        status = bundleContext_addServiceListener(context, listener, filter);
-        if (status == CELIX_SUCCESS) {
-            activator->listener = listener;
-        }
-
-        status = bundleContext_getServiceReferences(context, NULL, filter, &logServices);
-        if (status == CELIX_SUCCESS) {
-            int i;
-            for (i = 0; i < arrayList_size(logServices); i++) {
-                service_reference_pt logService = (service_reference_pt) arrayList_get(logServices, i);
-                service_event_pt event = calloc(1, sizeof(*event));
-                event->reference = logService;
-                event->type = OSGI_FRAMEWORK_SERVICE_EVENT_REGISTERED;
-
-                listenerExample_serviceChanged(listener, event);
-                free(event);
-            }
-            arrayList_destroy(logServices);
-        }
-
-        activator->running = true;
-
-        status = celixThread_create(&activator->logger, NULL, listenerExample_logger, activator);
-    }
-
-    return status;
-}
-
-celix_status_t bundleActivator_stop(void * userData, bundle_context_pt context) {
-    celix_status_t status = CELIX_SUCCESS;
-    struct listenerActivator *activator = userData;
-
-    activator->running = false;
-    celixThread_join(activator->logger, NULL);
-
-    bundleContext_removeServiceListener(context, activator->listener);
-
-    return status;
-}
-
-celix_status_t bundleActivator_destroy(void * userData, bundle_context_pt context) {
-    celix_status_t status = CELIX_SUCCESS;
-    struct listenerActivator *activator = userData;
-    arrayList_destroy(activator->logServiceReferences);
-    return status;
-}
-
-void listenerExample_serviceChanged(service_listener_pt listener, service_event_pt event) {
-    struct listenerActivator *activator = listener->handle;
-    celixThreadMutex_lock(&activator->logServiceReferencesLock);
-
-    switch (event->type) {
-    case OSGI_FRAMEWORK_SERVICE_EVENT_REGISTERED:
-        arrayList_add(activator->logServiceReferences, event->reference);
-        break;
-//	case MODIFIED:
-//		// only the service metadata has changed, so no need to do anything here
-//		break;
-    case OSGI_FRAMEWORK_SERVICE_EVENT_UNREGISTERING:
-        arrayList_removeElement(activator->logServiceReferences, event->reference);
-        break;
-    default:
-        break;
-    }
-
-    celixThreadMutex_unlock(&activator->logServiceReferencesLock);
-}
-
-celix_status_t listenerExample_getLogService(struct listenerActivator *activator, log_service_pt *service) {
-    celix_status_t status = CELIX_SUCCESS;
-
-    celixThreadMutex_lock(&activator->logServiceReferencesLock);
-
-    if (arrayList_size(activator->logServiceReferences) > 0) {
-        service_reference_pt reference = arrayList_get(activator->logServiceReferences, 0);
-        status = bundleContext_getService(activator->context, reference, (void *) service);
-    }
-    celixThreadMutex_unlock(&activator->logServiceReferencesLock);
-
-    return status;
-}
-
-static void* listenerExample_logger(void* data) {
-    struct listenerActivator *activator = data;
-
-    while (activator->running) {
-        log_service_pt logService = NULL;
-        listenerExample_getLogService(activator, &logService);
-        if (logService != NULL) {
-            (*(logService->log))(logService->logger, OSGI_LOGSERVICE_INFO, "ping");
-        } else {
-            listenerExample_alternativeLog(activator, "No LogService available. Printing to standard out.");
-        }
-
-        sleep(5);
-    }
-
-    return NULL;
-}
-
-celix_status_t listenerExample_alternativeLog(struct listenerActivator *activator, char *message) {
-    celix_status_t status = CELIX_SUCCESS;
-
-    printf("%s\n", message);
-
-    return status;
-}
-

http://git-wip-us.apache.org/repos/asf/celix/blob/505f6a84/examples/osgi-in-action/chapter04-correct-lookup/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/examples/osgi-in-action/chapter04-correct-lookup/CMakeLists.txt b/examples/osgi-in-action/chapter04-correct-lookup/CMakeLists.txt
deleted file mode 100644
index abbb3cf..0000000
--- a/examples/osgi-in-action/chapter04-correct-lookup/CMakeLists.txt
+++ /dev/null
@@ -1,21 +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.
-
-add_bundle(chapter04-correct-lookup VERSION 0.0.1 SOURCES private/src/activator)
-include_directories("${PROJECT_SOURCE_DIR}/utils/public/include")
-include_directories("${PROJECT_SOURCE_DIR}/log_service/public/include")
-target_link_libraries(chapter04-correct-lookup celix_framework)

http://git-wip-us.apache.org/repos/asf/celix/blob/505f6a84/examples/osgi-in-action/chapter04-correct-lookup/private/src/activator.c
----------------------------------------------------------------------
diff --git a/examples/osgi-in-action/chapter04-correct-lookup/private/src/activator.c b/examples/osgi-in-action/chapter04-correct-lookup/private/src/activator.c
deleted file mode 100644
index 19cf093..0000000
--- a/examples/osgi-in-action/chapter04-correct-lookup/private/src/activator.c
+++ /dev/null
@@ -1,179 +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.
- */
-/*
- * activator.c
- *
- *  \date       Sep 29, 2011
- *  \author    	<a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
- *  \copyright	Apache License, Version 2.0
- */
-#include <stdlib.h>
-#include <stdio.h>
-#include <unistd.h>
-
-#include "bundle_activator.h"
-#include "log_service.h"
-
-typedef log_service_pt LOG_SERVICE;
-
-struct threadData {
-    char * service;
-    int threadId;
-    bundle_context_pt m_context;
-    bool running;
-};
-
-typedef struct threadData *thread_data_pt;
-
-static celix_thread_t m_logTestThread;
-
-//*******************************************************************************
-// function prototypes
-//*******************************************************************************
-void startTestThread(thread_data_pt data);
-void stopTestThread();
-void pauseTestThread();
-void alternativeLog(char *message, thread_data_pt data);
-//*******************************************************************************
-// global functions
-//*******************************************************************************
-
-celix_status_t bundleActivator_create(bundle_context_pt context, void **userData) {
-    celix_status_t status = CELIX_SUCCESS;
-
-    *userData = calloc(1, sizeof(struct threadData));
-
-    if ((*userData)==NULL) {
-        status = CELIX_ENOMEM;
-    } else {
-        ((thread_data_pt) (*userData))->service = "chapter04-correct-lookup";
-        ((thread_data_pt) (*userData))->threadId = 0;
-        ((thread_data_pt) (*userData))->m_context = context;
-        ((thread_data_pt) (*userData))->running = false;
-    }
-
-    return status;
-}
-
-celix_status_t bundleActivator_start(void * userData, bundle_context_pt context) {
-
-    thread_data_pt thread_data = (thread_data_pt) userData;
-
-    thread_data->m_context = context;
-    thread_data->running = true;
-
-    startTestThread(thread_data);
-
-    return CELIX_SUCCESS;
-}
-
-celix_status_t bundleActivator_stop(void * userData, bundle_context_pt context) {
-
-    thread_data_pt thread_data = (thread_data_pt) userData;
-
-    thread_data->running = false;
-
-    stopTestThread();
-
-    return CELIX_SUCCESS;
-}
-
-celix_status_t bundleActivator_destroy(void * userData, bundle_context_pt context) {
-
-    free(userData);
-
-    return CELIX_SUCCESS;
-}
-
-//------------------------------------------------------------------------------------------
-//  The rest of this is just support code, not meant to show any particular best practices
-//------------------------------------------------------------------------------------------
-
-// Test LogService by periodically sending a message
-
-static void* LogServiceTest(void* argument) {
-    celix_status_t status = CELIX_SUCCESS;
-    thread_data_pt data = (thread_data_pt) argument;
-    bundle_context_pt m_context = data ->m_context;
-
-    while (data->running == true) {
-        service_reference_pt logServiceRef = NULL;
-        // lookup the current "best" LogService each time, just before we need to use it
-        status = bundleContext_getServiceReference(m_context, (char *) OSGI_LOGSERVICE_NAME, &logServiceRef);
-        // if the service reference is null then we know there's no log service available
-        if (status == CELIX_SUCCESS && logServiceRef != NULL) {
-            void *log = NULL;
-            LOG_SERVICE logService = NULL;
-            bundleContext_getService(m_context, logServiceRef, &log);
-            logService = (LOG_SERVICE) log;
-            // if the dereferenced instance is null then we know the service has been removed
-            if (logService != NULL) {
-                (*(logService->log))(logService->logger, OSGI_LOGSERVICE_INFO, "ping");
-            } else {
-                alternativeLog("LogService has gone", data);
-            }
-        } else {
-            alternativeLog("LogService has gone", data);
-        }
-        pauseTestThread();
-    }
-
-    return NULL;
-}
-
-void startTestThread(thread_data_pt data) {
-    // start separate worker thread to run the actual tests, managed by the bundle lifecycle
-    data->threadId++;
-
-    celixThread_create(&m_logTestThread, NULL, LogServiceTest, data);
-}
-
-void stopTestThread() {
-    celixThread_join(m_logTestThread, NULL);
-}
-
-void pauseTestThread() {
-    // sleep for a bit
-    sleep(5);
-}
-
-void alternativeLog(char *message, thread_data_pt data) {
-    // this provides similar style debug logging output for when the LogService disappears
-    celix_status_t status = CELIX_SUCCESS;
-    bundle_pt bundle = NULL;
-    char tid[20], bid[20];
-    long bundleId;
-    if (data->m_context != NULL) {
-        status = bundleContext_getBundle(data->m_context, &bundle);
-        if (status == CELIX_SUCCESS) {
-            status = bundle_getBundleId(bundle, &bundleId);
-            if (status == CELIX_SUCCESS) {
-                sprintf(tid, "thread=%d", data->threadId);
-                sprintf(bid, "bundle=%ld", bundleId);
-                printf("<--> %s, %s : %s\n", tid, bid, message);
-            } else {
-                printf("%s:%s:%d:getBundleId failed:  %s\n", __FILE__, __FUNCTION__, __LINE__, message);
-            }
-        } else {
-            printf("%s:%s:%d:getBundle failed: %s\n", __FILE__, __FUNCTION__, __LINE__, message);
-        }
-    } else {
-        printf("%s:%s:%d:bundle context NULL:  %s\n", __FILE__, __FUNCTION__, __LINE__, message);
-    }
-}

http://git-wip-us.apache.org/repos/asf/celix/blob/505f6a84/examples/osgi-in-action/chapter04-paint-example/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/examples/osgi-in-action/chapter04-paint-example/CMakeLists.txt b/examples/osgi-in-action/chapter04-paint-example/CMakeLists.txt
deleted file mode 100644
index 23537c3..0000000
--- a/examples/osgi-in-action/chapter04-paint-example/CMakeLists.txt
+++ /dev/null
@@ -1,31 +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.
-
-if(NOT ${WITH_APR})
-	message(FATAL_ERROR "Paint example requires APR, enable WITH_APR option.")
-endif()
-find_package(PkgConfig)
-if(PKG_CONFIG_EXECUTABLE)
-	add_subdirectory(circle)
-	add_subdirectory(paint)
-	add_subdirectory(square)
-	add_subdirectory(triangle)
-
-	add_deploy("chapter04-paint-example" BUNDLES chapter04-paint-example circle square triangle shell shell_tui log_service log_writer)
-else(PKG_CONFIG_EXECUTABLE)
-	MESSAGE("No GTK found, not building the Paint Example")	
-endif(PKG_CONFIG_EXECUTABLE)
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/celix/blob/505f6a84/examples/osgi-in-action/chapter04-paint-example/circle/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/examples/osgi-in-action/chapter04-paint-example/circle/CMakeLists.txt b/examples/osgi-in-action/chapter04-paint-example/circle/CMakeLists.txt
deleted file mode 100644
index 5769ac9..0000000
--- a/examples/osgi-in-action/chapter04-paint-example/circle/CMakeLists.txt
+++ /dev/null
@@ -1,46 +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.
-
-INCLUDE(FindPkgConfig)
-pkg_search_module (GLIB  REQUIRED glib-2.0)
-pkg_search_module (GTHR  REQUIRED gthread-2.0)
-pkg_search_module (GTK   REQUIRED gtk+-2.0)
-include_directories(
-	private/include
-	../simple/public/include
-)
-include_directories(${GTK_INCLUDE_DIRS})
-include_directories(${GLIB_INCLUDE_DIRS})
-include_directories(${GTHR_INCLUDE_DIRS})
-
-link_directories(${GTK_LIBRARY_DIRS})
-link_directories(${GLIB_LIBRARY_DIRS})
-link_directories(${GTHR_LIBRARY_DIRS})
-
-add_bundle(circle VERSION 0.0.1 SOURCES
- 	private/src/activator
- 	private/src/circle_shape
-    
-    private/include/circle_shape.h
- FILES
- 	private/src/circle.png
-)
-
-include_directories("${PROJECT_SOURCE_DIR}/utils/public/include")
-include_directories("${PROJECT_SOURCE_DIR}/log_service/public/include")
-target_link_libraries(circle celix_framework ${GLIB_LIBRARIES} ${GTK_LIBRARIES} ${GTHR_LIBRARIES})
-

http://git-wip-us.apache.org/repos/asf/celix/blob/505f6a84/examples/osgi-in-action/chapter04-paint-example/circle/private/include/circle_shape.h
----------------------------------------------------------------------
diff --git a/examples/osgi-in-action/chapter04-paint-example/circle/private/include/circle_shape.h b/examples/osgi-in-action/chapter04-paint-example/circle/private/include/circle_shape.h
deleted file mode 100644
index e16c57d..0000000
--- a/examples/osgi-in-action/chapter04-paint-example/circle/private/include/circle_shape.h
+++ /dev/null
@@ -1,33 +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.
- */
-/*
- * circle_shape.h
- *
- *  \date       Aug 22, 2011
- *  \author    	<a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
- *  \copyright	Apache License, Version 2.0
- */
-#ifndef CIRCLE_SHAPE_H_
-#define CIRCLE_SHAPE_H_
-
-#include "celix_errno.h"
-
-celix_status_t circleShape_create(bundle_context_pt context, simple_shape_pt *shape);
-
-#endif /* CIRCLE_SHAPE_H_ */

http://git-wip-us.apache.org/repos/asf/celix/blob/505f6a84/examples/osgi-in-action/chapter04-paint-example/circle/private/src/activator.c
----------------------------------------------------------------------
diff --git a/examples/osgi-in-action/chapter04-paint-example/circle/private/src/activator.c b/examples/osgi-in-action/chapter04-paint-example/circle/private/src/activator.c
deleted file mode 100644
index a99396f..0000000
--- a/examples/osgi-in-action/chapter04-paint-example/circle/private/src/activator.c
+++ /dev/null
@@ -1,82 +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.
- */
-/*
- * activator.c
- *
- *  \date       Aug 22, 2011
- *  \author    	<a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
- *  \copyright	Apache License, Version 2.0
- */
-#include <stdlib.h>
-#include <stdio.h>
-#include <apr_general.h>
-#include <glib.h>
-#include <gtk/gtk.h>
-#include <gdk/gdk.h>
-
-#include "service_registration.h"
-#include "bundle_activator.h"
-#include "bundle_context.h"
-#include "simple_shape.h"
-#include "circle_shape.h"
-#include "simple_shape.h"
-
-struct activator {
-	service_registration_pt reg;
-	apr_pool_t *pool;
-};
-
-celix_status_t bundleActivator_create(bundle_context_pt context, void **userData) {
-	apr_pool_t *pool;
-	struct activator *activator;
-	celix_status_t status = bundleContext_getMemoryPool(context, &pool);
-	if (status == CELIX_SUCCESS) {
-		*userData = apr_palloc(pool, sizeof(struct activator));
-		activator = *userData;
-		activator->reg = NULL;
-		activator->pool = pool;
-	}
-	return status;
-}
-
-celix_status_t bundleActivator_start(void * userData, bundle_context_pt ctx) {
-	struct activator * act = (struct activator *) userData;
-	celix_status_t status = CELIX_SUCCESS;
-	simple_shape_pt es = NULL;
-	properties_pt props = NULL;
-
-	circleShape_create(ctx, &es);
-	props = properties_create();
-	properties_set(props, "name", "circle");
-    status = bundleContext_registerService(ctx, SIMPLE_SHAPE_SERVICE_NAME, es, props, &act->reg);
-	return status;
-}
-
-celix_status_t bundleActivator_stop(void * userData, bundle_context_pt context) {
-	celix_status_t status = CELIX_SUCCESS;
-	struct activator * act = (struct activator *) userData;
-
-	status = serviceRegistration_unregister(act->reg);
-
-	return CELIX_SUCCESS;
-}
-
-celix_status_t bundleActivator_destroy(void * userData, bundle_context_pt context) {
-	return CELIX_SUCCESS;
-}

http://git-wip-us.apache.org/repos/asf/celix/blob/505f6a84/examples/osgi-in-action/chapter04-paint-example/circle/private/src/circle.png
----------------------------------------------------------------------
diff --git a/examples/osgi-in-action/chapter04-paint-example/circle/private/src/circle.png b/examples/osgi-in-action/chapter04-paint-example/circle/private/src/circle.png
deleted file mode 100644
index 3d4887e..0000000
Binary files a/examples/osgi-in-action/chapter04-paint-example/circle/private/src/circle.png and /dev/null differ

http://git-wip-us.apache.org/repos/asf/celix/blob/505f6a84/examples/osgi-in-action/chapter04-paint-example/circle/private/src/circle_shape.c
----------------------------------------------------------------------
diff --git a/examples/osgi-in-action/chapter04-paint-example/circle/private/src/circle_shape.c b/examples/osgi-in-action/chapter04-paint-example/circle/private/src/circle_shape.c
deleted file mode 100644
index 5104b5f..0000000
--- a/examples/osgi-in-action/chapter04-paint-example/circle/private/src/circle_shape.c
+++ /dev/null
@@ -1,109 +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.
- */
-/*
- * circle_shape.c
- *
- *  \date       Aug 22, 2011
- *  \author    	<a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
- *  \copyright	Apache License, Version 2.0
- */
-#include <stdio.h>
-#include <string.h>
-#include <celixbool.h>
-#include <stdlib.h>
-#include <glib.h>
-#include <gtk/gtk.h>
-#include <gdk/gdk.h>
-#include "bundle_context.h"
-#include "bundle.h"
-#include "hash_map.h"
-#include "simple_shape.h"
-#include "circle_shape.h"
-
-#define CIRCLE_FILE "circle.png"
-
-void circleShape_draw(simple_shape_pt shape, GdkPixmap *pixMap, GtkWidget *widget, gdouble x, gdouble y);
-
-celix_status_t circleShape_create(bundle_context_pt context, simple_shape_pt *shape) {
-	celix_status_t status = CELIX_SUCCESS;
-
-	bundle_pt bundle;
-	apr_pool_t *pool;
-
-	if (*shape != NULL || context == NULL) {
-		status = CELIX_ILLEGAL_ARGUMENT;
-	} else {
-		status = bundleContext_getBundle(context, &bundle);
-		if (status == CELIX_SUCCESS) {
-			status = bundleContext_getMemoryPool(context, &pool);
-			if (status == CELIX_SUCCESS) {
-				*shape = (simple_shape_pt) apr_palloc(pool, sizeof(**shape));
-				if (!*shape) {
-					status = CELIX_ENOMEM;
-				} else {
-					celix_status_t status = CELIX_SUCCESS;
-					(*shape)->name = "Circle";
-					(*shape)->icon_path = NULL;
-					status = bundle_getEntry(bundle, CIRCLE_FILE, pool, &(*shape)->icon_path);
-					if (status == CELIX_SUCCESS) {
-						(*shape)->simpleShape_draw = circleShape_draw;
-					} else {
-						printf("Could not find resource %s\n", CIRCLE_FILE);
-					}
-				}
-			}
-		}
-	}
-	return status;
-}
-
-void circleShape_draw(simple_shape_pt shape, GdkPixmap *pixMap, GtkWidget *widget, gdouble x, gdouble y){
-	GdkRectangle update_rect;
-	GError *gerror = NULL;
-	gsize rd = 0, wr = 0;
-	if (shape->icon_path == NULL) {
-		printf("error message: icon path unknown\n");
-	} else {
-		gchar *gfn = g_locale_to_utf8(shape->icon_path, strlen(shape->icon_path), &rd, &wr, &gerror);
-		GdkPixbuf*curr_pix_buf = gdk_pixbuf_new_from_file(gfn, &gerror);
-		if(!curr_pix_buf) {
-			g_printerr("error message: %s\n", (gchar *) gerror->message);
-		}
-		update_rect.x = x - 5;
-		update_rect.y = y - 5;
-		update_rect.width = gdk_pixbuf_get_width(curr_pix_buf);
-		update_rect.height = gdk_pixbuf_get_height(curr_pix_buf);
-		gdk_pixbuf_render_to_drawable(
-				curr_pix_buf,
-				pixMap,
-				gtk_widget_get_style(widget)->fg_gc[gtk_widget_get_state(widget)],
-				0, 0,
-				update_rect.x, update_rect.y,
-				update_rect.width,
-				update_rect.height,
-				GDK_RGB_DITHER_NONE,
-				0, 0);
-		gtk_widget_queue_draw_area (widget,
-				update_rect.x, update_rect.y,
-				update_rect.width, update_rect.height);
-	}
-}
-
-
-

http://git-wip-us.apache.org/repos/asf/celix/blob/505f6a84/examples/osgi-in-action/chapter04-paint-example/paint/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/examples/osgi-in-action/chapter04-paint-example/paint/CMakeLists.txt b/examples/osgi-in-action/chapter04-paint-example/paint/CMakeLists.txt
deleted file mode 100644
index 6caa87f..0000000
--- a/examples/osgi-in-action/chapter04-paint-example/paint/CMakeLists.txt
+++ /dev/null
@@ -1,53 +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.
-
-INCLUDE(FindPkgConfig)
-pkg_search_module (GLIB  REQUIRED glib-2.0)
-pkg_search_module (GTHR  REQUIRED gthread-2.0)
-pkg_search_module (GTK   REQUIRED gtk+-2.0)
-pkg_search_module (GMODULE   REQUIRED gmodule-2.0)
-include_directories(
-	private/include
-	../simple/public/include
-)
-
-include_directories(${GTK_INCLUDE_DIRS})
-include_directories(${GLIB_INCLUDE_DIRS})
-include_directories(${GTHR_INCLUDE_DIRS})
-include_directories(${GMODULE_INCLUDE_DIRS})
-
-link_directories(${GTK_LIBRARY_DIRS})
-link_directories(${GLIB_LIBRARY_DIRS})
-link_directories(${GTHR_LIBRARY_DIRS})
-link_directories(${GMODULE_LIBRARY_DIRS})
-
-add_bundle(chapter04-paint-example  VERSION 0.0.1 SOURCES
-	private/src/activator
-	private/src/default_shape
-	private/src/shape_component
-	private/src/paint_frame
-    
-    private/include/default_shape.h
-    private/include/paint_frame.h
-    private/include/shape_component.h
-  FILES
-  	private/src/underc.png gtktest.glade
-)
-
-include_directories("${PROJECT_SOURCE_DIR}/utils/public/include")
-include_directories("${PROJECT_SOURCE_DIR}/log_service/public/include")
-target_link_libraries(chapter04-paint-example celix_framework ${MODULE_LIBRARIES} ${GLIB_LIBRARIES} ${GTK_LIBRARIES} ${GTHR_LIBRARIES})

http://git-wip-us.apache.org/repos/asf/celix/blob/505f6a84/examples/osgi-in-action/chapter04-paint-example/paint/gtktest.glade
----------------------------------------------------------------------
diff --git a/examples/osgi-in-action/chapter04-paint-example/paint/gtktest.glade b/examples/osgi-in-action/chapter04-paint-example/paint/gtktest.glade
deleted file mode 100644
index 9a5e7d5..0000000
--- a/examples/osgi-in-action/chapter04-paint-example/paint/gtktest.glade
+++ /dev/null
@@ -1,59 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- *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.
--->
-<interface>
-  <requires lib="gtk+" version="2.24"/>
-  <!-- interface-naming-policy project-wide -->
-  <object class="GtkWindow" id="window1">
-    <property name="width_request">600</property>
-    <property name="height_request">400</property>
-    <property name="can_focus">False</property>
-    <signal name="destroy" handler="on_window1_destroy" swapped="no"/>
-    <child>
-      <object class="GtkVBox" id="vbox1">
-        <property name="visible">True</property>
-        <property name="can_focus">False</property>
-        <child>
-          <object class="GtkToolbar" id="toolbar1">
-            <property name="visible">True</property>
-            <property name="can_focus">False</property>
-          </object>
-          <packing>
-            <property name="expand">False</property>
-            <property name="fill">True</property>
-            <property name="position">0</property>
-          </packing>
-        </child>
-        <child>
-          <object class="GtkDrawingArea" id="drawingarea1">
-            <property name="visible">True</property>
-            <property name="can_focus">False</property>
-            <property name="events">GDK_EXPOSURE_MASK | GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_STRUCTURE_MASK</property>
-            <signal name="button-press-event" handler="newFrame_mousePressed" after="yes" swapped="no"/>
-          </object>
-          <packing>
-            <property name="expand">True</property>
-            <property name="fill">True</property>
-            <property name="position">1</property>
-          </packing>
-        </child>
-      </object>
-    </child>
-  </object>
-</interface>

http://git-wip-us.apache.org/repos/asf/celix/blob/505f6a84/examples/osgi-in-action/chapter04-paint-example/paint/private/include/default_shape.h
----------------------------------------------------------------------
diff --git a/examples/osgi-in-action/chapter04-paint-example/paint/private/include/default_shape.h b/examples/osgi-in-action/chapter04-paint-example/paint/private/include/default_shape.h
deleted file mode 100644
index b249074..0000000
--- a/examples/osgi-in-action/chapter04-paint-example/paint/private/include/default_shape.h
+++ /dev/null
@@ -1,31 +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.
- */
-/*
- * default_shape.h
- *
- *  \date       Aug 22, 2011
- *  \author    	<a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
- *  \copyright	Apache License, Version 2.0
- */
-#ifndef DEFAULT_SHAPE_H_
-#define DEFAULT_SHAPE_H_
-
-extern simple_shape_pt defaultShape_create(bundle_context_pt context);
-
-#endif /* DEFAULT_SHAPE_H_ */

http://git-wip-us.apache.org/repos/asf/celix/blob/505f6a84/examples/osgi-in-action/chapter04-paint-example/paint/private/include/paint_frame.h
----------------------------------------------------------------------
diff --git a/examples/osgi-in-action/chapter04-paint-example/paint/private/include/paint_frame.h b/examples/osgi-in-action/chapter04-paint-example/paint/private/include/paint_frame.h
deleted file mode 100644
index df3c73c..0000000
--- a/examples/osgi-in-action/chapter04-paint-example/paint/private/include/paint_frame.h
+++ /dev/null
@@ -1,59 +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.
- */
-/*
- * paint_frame.h
- *
- *  \date       Aug 22, 2011
- *  \author    	<a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
- *  \copyright	Apache License, Version 2.0
- */
-
-#ifndef PAINT_FRAME_H_
-#define PAINT_FRAME_H_
-
-#define PAINT_FRAME_SERVICE_NAME "paint"
-
-struct paint_frame {
-	apr_pool_t *pool;
-	GtkWidget *window;
-	GtkWidget *drawingArea;
-	GtkWidget *toolbar;
-	GdkPixmap *pixMap;
-	bool showing;
-
-	char *m_selected;
-	hash_map_pt m_shapes;
-	simple_shape_pt m_defaultShape;
-	linked_list_pt m_shapeComponents;
-	bundle_context_pt context;
-	GThread *main;
-	char *file;
-};
-
-
-typedef struct paint_frame *paint_frame_pt;
-celix_status_t paintFrame_create(bundle_context_pt context, apr_pool_t *pool, paint_frame_pt *frame);
-celix_status_t paintFrame_exit(paint_frame_pt frame);
-
-simple_shape_pt paintFrame_getShape(paint_frame_pt frame, char *name);
-celix_status_t paintFrame_addShape(paint_frame_pt frame, bundle_context_pt context, simple_shape_pt shape);
-celix_status_t paintFrame_removeShape(paint_frame_pt frame, simple_shape_pt sshape);
-
-
-#endif /* PAINT_FRAME_H_ */

http://git-wip-us.apache.org/repos/asf/celix/blob/505f6a84/examples/osgi-in-action/chapter04-paint-example/paint/private/include/shape_component.h
----------------------------------------------------------------------
diff --git a/examples/osgi-in-action/chapter04-paint-example/paint/private/include/shape_component.h b/examples/osgi-in-action/chapter04-paint-example/paint/private/include/shape_component.h
deleted file mode 100644
index 782467d..0000000
--- a/examples/osgi-in-action/chapter04-paint-example/paint/private/include/shape_component.h
+++ /dev/null
@@ -1,45 +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.
- */
-/*
- * shape_component.h
- *
- *  \date       Aug 22, 2011
- *  \author    	<a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
- *  \copyright	Apache License, Version 2.0
- */
-
-#ifndef SHAPE_COMPONENT_H_
-#define SHAPE_COMPONENT_H_
-
-#include "paint_frame.h"
-
-typedef struct shape_component *shape_component_pt;
-
-struct shape_component {
-	char *shapeName;
-	paint_frame_pt m_frame;
-	gdouble x, y, w, h;
-	void (*shapeComponent_paintComponent)(shape_component_pt shapeComponent, paint_frame_pt frame,
-			GdkPixmap *pixMap, GtkWidget *widget);
-};
-
-extern shape_component_pt shapeComponent_create(paint_frame_pt frame, simple_shape_pt sshape,
-		gdouble x, gdouble y);
-
-#endif /* SHAPE_COMPONENT_H_ */