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 2018/05/27 18:37:07 UTC

[24/51] [partial] celix git commit: CELIX-424: Cleans up the directory structure. Moves all libraries to the libs subdir and all bundles to the bundles subdir

http://git-wip-us.apache.org/repos/asf/celix/blob/3bce889b/bundles/shell/shell_tui/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/bundles/shell/shell_tui/CMakeLists.txt b/bundles/shell/shell_tui/CMakeLists.txt
new file mode 100644
index 0000000..a31645f
--- /dev/null
+++ b/bundles/shell/shell_tui/CMakeLists.txt
@@ -0,0 +1,40 @@
+# 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.
+celix_subproject(SHELL_TUI "Option to enable building the Shell Textual User Interface bundles" ON DEPS LAUNCHER SHELL)
+if (SHELL_TUI)
+
+    add_celix_bundle(shell_tui
+    	SYMBOLIC_NAME "apache_celix_shell_tui"
+    	VERSION "1.1.0"
+    	NAME "Apache Celix Shell TUI"
+    	SOURCES 
+    		private/src/activator 
+    		private/src/shell_tui
+    		private/src/history
+	)
+	
+	target_include_directories(shell_tui PRIVATE
+			"${PROJECT_SOURCE_DIR}/utils/public/include"
+			private/include
+	)
+    target_link_libraries(shell_tui PRIVATE Celix::shell_api)
+
+	install_celix_bundle(shell_tui EXPORT celix)
+
+	#Alias setup to match external usage
+	add_library(Celix::shell_tui ALIAS shell_tui)
+endif (SHELL_TUI)

http://git-wip-us.apache.org/repos/asf/celix/blob/3bce889b/bundles/shell/shell_tui/README.md
----------------------------------------------------------------------
diff --git a/bundles/shell/shell_tui/README.md b/bundles/shell/shell_tui/README.md
new file mode 100644
index 0000000..2b8984f
--- /dev/null
+++ b/bundles/shell/shell_tui/README.md
@@ -0,0 +1,34 @@
+<!--
+Licensed to the Apache Software Foundation (ASF) under one or more
+contributor license agreements.  See the NOTICE file distributed with
+this work for additional information regarding copyright ownership.
+The ASF licenses this file to You under the Apache License, Version 2.0
+(the "License"); you may not use this file except in compliance with
+the License.  You may obtain a copy of the License at
+   
+    http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+-->
+
+# Shell TUI
+
+The Celix Shell TUI implements a textual user interface for the Celix Shell.
+
+## CMake option
+    BUILD_SHELL_TUI=ON
+
+## Config options
+
+- SHELL_USE_ANSI_CONTROL_SEQUENCES - Wether to use ANSI control
+sequences to support backspace, left, up, etc key commands in the
+shell tui. Default is true if a TERM environment is set else false.
+
+## Using info
+
+If the Celix Shell TUI is installed, 'find_package(Celix)' will set:
+ - The `Celix::shell_tui` bundle target if the shell_tui is installed

http://git-wip-us.apache.org/repos/asf/celix/blob/3bce889b/bundles/shell/shell_tui/private/include/history.h
----------------------------------------------------------------------
diff --git a/bundles/shell/shell_tui/private/include/history.h b/bundles/shell/shell_tui/private/include/history.h
new file mode 100644
index 0000000..b5e6320
--- /dev/null
+++ b/bundles/shell/shell_tui/private/include/history.h
@@ -0,0 +1,39 @@
+/**
+ *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.
+ */
+/*
+ * history.h
+ *
+ *  \date       Jan 16, 2016
+ *  \author    	<a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
+ *  \copyright	Apache License, Version 2.0
+ */
+#ifndef SHELL_TUI_HISTORY
+#define SHELL_TUI_HISTORY
+
+typedef struct history history_t;
+
+history_t *historyCreate();
+void historyDestroy(history_t *hist);
+void history_addLine(history_t *hist, const char *line);
+char *historyGetPrevLine(history_t *hist);
+char *historyGetNextLine(history_t *hist);
+void historyLineReset(history_t *hist);
+unsigned int historySize(history_t *hist);
+
+#endif // SHELL_TUI_HISTORY

http://git-wip-us.apache.org/repos/asf/celix/blob/3bce889b/bundles/shell/shell_tui/private/include/shell_tui.h
----------------------------------------------------------------------
diff --git a/bundles/shell/shell_tui/private/include/shell_tui.h b/bundles/shell/shell_tui/private/include/shell_tui.h
new file mode 100644
index 0000000..b561ff6
--- /dev/null
+++ b/bundles/shell/shell_tui/private/include/shell_tui.h
@@ -0,0 +1,44 @@
+/**
+ *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.
+ */
+/*
+ * shell_tui.h
+ *
+ *  \date       Jan 16, 2016
+ *  \author    	<a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
+ *  \copyright	Apache License, Version 2.0
+ */
+
+#ifndef SHELL_TUI_H_
+#define SHELL_TUI_H_
+
+#include <stdlib.h>
+
+#include "celix_threads.h"
+#include "shell.h"
+
+typedef struct shell_tui shell_tui_t ;
+
+shell_tui_t* shellTui_create(bool useAnsiControlSequences);
+celix_status_t shellTui_start(shell_tui_t* shellTui);
+celix_status_t shellTui_stop(shell_tui_t* shellTui);
+void shellTui_destroy(shell_tui_t* shellTui);
+
+celix_status_t shellTui_setShell(shell_tui_t* shellTui, shell_service_t* svc);
+
+#endif /* SHELL_TUI_H_ */

http://git-wip-us.apache.org/repos/asf/celix/blob/3bce889b/bundles/shell/shell_tui/private/src/activator.c
----------------------------------------------------------------------
diff --git a/bundles/shell/shell_tui/private/src/activator.c b/bundles/shell/shell_tui/private/src/activator.c
new file mode 100644
index 0000000..f25dd5b
--- /dev/null
+++ b/bundles/shell/shell_tui/private/src/activator.c
@@ -0,0 +1,133 @@
+/**
+ *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       Jan 15, 2016
+ *  \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 "bundle_context.h"
+#include "bundle_activator.h"
+
+
+#include "shell_tui.h"
+#include "service_tracker.h"
+
+#define SHELL_USE_ANSI_CONTROL_SEQUENCES "SHELL_USE_ANSI_CONTROL_SEQUENCES"
+
+typedef struct shell_tui_activator {
+    shell_tui_t* shellTui;
+    service_tracker_pt tracker;
+    shell_service_t* currentSvc;
+    bool useAnsiControlSequences;
+} shell_tui_activator_t;
+
+
+static celix_status_t activator_addShellService(void *handle, service_reference_pt ref, void *svc) {
+    shell_tui_activator_t* act = (shell_tui_activator_t*) handle;
+    act->currentSvc = svc;
+    shellTui_setShell(act->shellTui, svc);
+    return CELIX_SUCCESS;
+}
+
+static celix_status_t activator_removeShellService(void *handle, service_reference_pt ref, void *svc) {
+    shell_tui_activator_t* act = (shell_tui_activator_t*) handle;
+    if (act->currentSvc == svc) {
+        act->currentSvc = NULL;
+        shellTui_setShell(act->shellTui, NULL);
+    }
+    return CELIX_SUCCESS;
+}
+
+celix_status_t bundleActivator_create(bundle_context_pt context, void **userData) {
+	celix_status_t status = CELIX_SUCCESS;
+
+    shell_tui_activator_t* activator = calloc(1, sizeof(*activator));
+
+	if (activator != NULL) {
+        bool useCommands;
+        const char* config = NULL;
+        bundleContext_getProperty(context, SHELL_USE_ANSI_CONTROL_SEQUENCES, &config);
+        if (config != NULL) {
+            useCommands = strncmp("true", config, 5) == 0;
+        } else {
+            char *term = getenv("TERM");
+            useCommands = term != NULL;
+        }
+
+        activator->shellTui = shellTui_create(useCommands);
+
+        service_tracker_customizer_t* cust = NULL;
+        serviceTrackerCustomizer_create(activator, NULL, activator_addShellService, NULL, activator_removeShellService, &cust);
+        serviceTracker_create(context, OSGI_SHELL_SERVICE_NAME, cust, &activator->tracker);
+	}
+
+    if (activator != NULL && activator->shellTui != NULL) {
+        (*userData) = activator;
+    } else {
+        if (activator != NULL) {
+            shellTui_destroy(activator->shellTui);
+            if (activator->tracker != NULL) {
+                serviceTracker_destroy(activator->tracker);
+            }
+        }
+        free(activator);
+		status = CELIX_ENOMEM;
+	}
+
+	return status;
+}
+
+celix_status_t bundleActivator_start(void * userData, bundle_context_pt context) {
+	celix_status_t status = CELIX_SUCCESS;
+
+    shell_tui_activator_t* act = (shell_tui_activator_t*) userData;
+
+    act->currentSvc = NULL;
+    serviceTracker_open(act->tracker);
+    shellTui_start(act->shellTui);
+
+	return status;
+}
+
+celix_status_t bundleActivator_stop(void * userData, bundle_context_pt context) {
+	celix_status_t status = CELIX_SUCCESS;
+    shell_tui_activator_t* act = (shell_tui_activator_t*) userData;
+
+    if (act != NULL) {
+        serviceTracker_close(act->tracker);
+        shellTui_stop(act->shellTui);
+    }
+
+	return status;
+}
+
+celix_status_t bundleActivator_destroy(void * userData, bundle_context_pt context) {
+    shell_tui_activator_t* act = (shell_tui_activator_t*) userData;
+
+    shellTui_destroy(act->shellTui);
+    serviceTracker_destroy(act->tracker);
+	free(act);
+
+	return CELIX_SUCCESS;
+}

http://git-wip-us.apache.org/repos/asf/celix/blob/3bce889b/bundles/shell/shell_tui/private/src/history.c
----------------------------------------------------------------------
diff --git a/bundles/shell/shell_tui/private/src/history.c b/bundles/shell/shell_tui/private/src/history.c
new file mode 100644
index 0000000..e58c502
--- /dev/null
+++ b/bundles/shell/shell_tui/private/src/history.c
@@ -0,0 +1,80 @@
+/**
+ *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 "history.h"
+#include <stdlib.h>
+#include <string.h>
+#include "linked_list.h"
+
+#define HIST_SIZE 32
+
+struct history {
+	linked_list_pt history_lines;
+	int currentLine;
+};
+
+history_t *historyCreate() {
+	history_t* hist = calloc(1, sizeof(*hist));
+    linkedList_create(&hist->history_lines);
+    hist->currentLine = -1;
+    return hist;
+}
+
+void historyDestroy(history_t *hist) {
+	unsigned int size = linkedList_size(hist->history_lines);
+	for(unsigned int i = 0; i < size; i++) {
+		char *line = linkedList_get(hist->history_lines, i);
+		free(line);
+	}
+	linkedList_destroy(hist->history_lines);
+	free(hist);
+}
+
+void history_addLine(history_t *hist, const char *line) {
+	linkedList_addFirst(hist->history_lines, strdup(line));
+	if(linkedList_size(hist->history_lines) == HIST_SIZE) {
+		char *lastLine = (char*)linkedList_get(hist->history_lines, HIST_SIZE-1);
+		free(lastLine);
+		linkedList_removeIndex(hist->history_lines, HIST_SIZE-1);
+	}
+}
+
+char *historyGetPrevLine(history_t *hist) {
+	hist->currentLine = (hist->currentLine + 1) % linkedList_size(hist->history_lines);
+	return (char*)linkedList_get(hist->history_lines, hist->currentLine);
+}
+
+char *historyGetNextLine(history_t *hist) {
+    if(linkedList_size(hist->history_lines) > 0) {
+         if (hist->currentLine <= 0) {
+        	 hist->currentLine = linkedList_size(hist->history_lines) - 1;
+         } else {
+        	 hist->currentLine--;
+         }
+    }
+	return (char*)linkedList_get(hist->history_lines, hist->currentLine);
+}
+
+void historyLineReset(history_t *hist) {
+	hist->currentLine = -1;
+}
+
+unsigned int historySize(history_t *hist) {
+	return linkedList_size(hist->history_lines);
+}

http://git-wip-us.apache.org/repos/asf/celix/blob/3bce889b/bundles/shell/shell_tui/private/src/shell_tui.c
----------------------------------------------------------------------
diff --git a/bundles/shell/shell_tui/private/src/shell_tui.c b/bundles/shell/shell_tui/private/src/shell_tui.c
new file mode 100644
index 0000000..2ceb21a
--- /dev/null
+++ b/bundles/shell/shell_tui/private/src/shell_tui.c
@@ -0,0 +1,464 @@
+/**
+ *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.
+ */
+/*
+ * shell_tui.c
+ *
+ *  \date       Aug 13, 2010
+ *  \author    	<a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
+ *  \copyright	Apache License, Version 2.0
+ */
+#include <sys/time.h>
+#include <sys/select.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <termios.h>
+#include <unistd.h>
+
+#include "bundle_context.h"
+#include "shell.h"
+#include "shell_tui.h"
+#include "utils.h"
+#include <signal.h>
+#include <fcntl.h>
+#include "history.h"
+
+#define LINE_SIZE 256
+#define PROMPT "-> "
+
+#define KEY_ESC1		'\033'
+#define KEY_ESC2		'['
+#define KEY_BACKSPACE 	127
+#define KEY_TAB			9
+#define KEY_ENTER		'\n'
+#define KEY_UP 			'A'
+#define KEY_DOWN 		'B'
+#define KEY_RIGHT		'C'
+#define KEY_LEFT		'D'
+#define KEY_DEL1		'3'
+#define KEY_DEL2		'~'
+
+struct shell_tui {
+    celix_thread_mutex_t mutex; //protects shell
+    shell_service_t* shell;
+    celix_thread_t thread;
+
+    int readPipeFd;
+    int writePipeFd;
+
+    bool useAnsiControlSequences;
+};
+
+typedef struct shell_context {
+    char in[LINE_SIZE+1];
+    char buffer[LINE_SIZE+1];
+    char dline[LINE_SIZE+1];
+    int pos;
+    history_t* hist;
+} shell_context_t;
+
+struct OriginalSettings {
+    struct termios term_org;
+    struct sigaction oldSigIntAction;
+    struct sigaction oldSigSegvAction;
+    struct sigaction oldSigAbrtAction;
+    struct sigaction oldSigQuitAction;
+
+};
+
+// static function declarations
+static void remove_newlines(char* line);
+static void clearLine();
+static void cursorLeft(int n);
+static void writeLine(const char*line, int pos);
+static int autoComplete(shell_service_pt shellSvc, char *in, int cursorPos, size_t maxLen);
+static void shellSigHandler(int sig, siginfo_t *info, void* ptr);
+static void* shellTui_runnable(void *data);
+static void shellTui_parseInputForControl(shell_tui_t* shellTui, shell_context_t* ctx);
+static void shellTui_parseInput(shell_tui_t* shellTui, shell_context_t* ctx);
+static void writePrompt(void);
+
+// Unfortunately has to be static, it is not possible to pass user defined data to the handler
+static struct OriginalSettings originalSettings;
+
+shell_tui_t* shellTui_create(bool useAnsiControlSequences) {
+    shell_tui_t* result = calloc(1, sizeof(*result));
+    if (result != NULL) {
+        result->useAnsiControlSequences = useAnsiControlSequences;
+        celixThreadMutex_create(&result->mutex, NULL);
+    }
+    return result;
+}
+
+celix_status_t shellTui_start(shell_tui_t* shellTui) {
+    celix_status_t status = CELIX_SUCCESS;
+
+    int fds[2];
+    int rc  = pipe(fds);
+    if (rc == 0) {
+        shellTui->readPipeFd = fds[0];
+        shellTui->writePipeFd = fds[1];
+        if(fcntl(shellTui->writePipeFd, F_SETFL, O_NONBLOCK) == 0){
+        	celixThread_create(&shellTui->thread, NULL, shellTui_runnable, shellTui);
+        }
+        else{
+        	fprintf(stderr,"fcntl on pipe failed");
+        	status = CELIX_FILE_IO_EXCEPTION;
+        }
+    } else {
+        fprintf(stderr, "Cannot create pipe");
+        status = CELIX_BUNDLE_EXCEPTION;
+    }
+
+    return status;
+}
+
+celix_status_t shellTui_stop(shell_tui_t* shellTui) {
+    celix_status_t status = CELIX_SUCCESS;
+    write(shellTui->writePipeFd, "\0", 1); //trigger select to stop
+    celixThread_join(shellTui->thread, NULL);
+    close(shellTui->writePipeFd);
+    close(shellTui->readPipeFd);
+    return status;
+}
+
+void shellTui_destroy(shell_tui_t* shellTui) {
+    if (shellTui == NULL) return;
+
+    celixThreadMutex_destroy(&shellTui->mutex);
+    free(shellTui);
+}
+
+celix_status_t shellTui_setShell(shell_tui_t* shellTui, shell_service_t* svc) {
+    celixThreadMutex_lock(&shellTui->mutex);
+    shellTui->shell = svc;
+    celixThreadMutex_unlock(&shellTui->mutex);
+    return CELIX_SUCCESS;
+}
+
+static void shellSigHandler(int sig, siginfo_t *info, void* ptr) {
+    tcsetattr(STDIN_FILENO, TCSANOW, &originalSettings.term_org);
+    if (sig == SIGINT) {
+        originalSettings.oldSigIntAction.sa_sigaction(sig, info, ptr);
+    } else if (sig == SIGSEGV){
+        originalSettings.oldSigSegvAction.sa_sigaction(sig, info, ptr);
+    } else if (sig == SIGABRT){
+        originalSettings.oldSigAbrtAction.sa_sigaction(sig, info, ptr);
+    } else if (sig == SIGQUIT){
+        originalSettings.oldSigQuitAction.sa_sigaction(sig, info, ptr);
+    }
+}
+
+static void* shellTui_runnable(void *data) {
+    shell_tui_t* shellTui = (shell_tui_t*) data;
+
+    //setup shell context
+    shell_context_t ctx;
+    memset(&ctx, 0, sizeof(ctx));
+    ctx.hist = historyCreate();
+
+    struct termios term_new;
+    if (shellTui->useAnsiControlSequences) {
+        sigaction(SIGINT, NULL, &originalSettings.oldSigIntAction);
+        sigaction(SIGSEGV, NULL, &originalSettings.oldSigSegvAction);
+        sigaction(SIGABRT, NULL, &originalSettings.oldSigAbrtAction);
+        sigaction(SIGQUIT, NULL, &originalSettings.oldSigQuitAction);
+        struct sigaction newAction;
+        memset(&newAction, 0, sizeof(newAction));
+        newAction.sa_flags = SA_SIGINFO;
+        newAction.sa_sigaction = shellSigHandler;
+        sigaction(SIGINT, &newAction, NULL);
+        sigaction(SIGSEGV, &newAction, NULL);
+        sigaction(SIGABRT, &newAction, NULL);
+        sigaction(SIGQUIT, &newAction, NULL);
+        tcgetattr(STDIN_FILENO, &originalSettings.term_org);
+
+
+        term_new = originalSettings.term_org;
+        term_new.c_lflag &= ~(ICANON | ECHO);
+        tcsetattr(STDIN_FILENO, TCSANOW, &term_new);
+    }
+
+    //setup file descriptors
+    fd_set rfds;
+    int nfds = shellTui->writePipeFd > STDIN_FILENO ? (shellTui->writePipeFd +1) : (STDIN_FILENO + 1);
+
+    for (;;) {
+        if (shellTui->useAnsiControlSequences) {
+            writeLine(ctx.in, ctx.pos);
+        } else {
+            writePrompt();
+        }
+        FD_ZERO(&rfds);
+        FD_SET(STDIN_FILENO, &rfds);
+        FD_SET(shellTui->readPipeFd, &rfds);
+
+        if (select(nfds, &rfds, NULL, NULL, NULL) > 0) {
+            if (FD_ISSET(shellTui->readPipeFd, &rfds)) {
+                break; //something is written to the pipe -> exit thread
+            } else if (FD_ISSET(STDIN_FILENO, &rfds)) {
+                if (shellTui->useAnsiControlSequences) {
+                    shellTui_parseInputForControl(shellTui, &ctx);
+                } else {
+                    shellTui_parseInput(shellTui, &ctx);
+                }
+            }
+        }
+    }
+
+    historyDestroy(ctx.hist);
+    if (shellTui->useAnsiControlSequences) {
+        tcsetattr(STDIN_FILENO, TCSANOW, &originalSettings.term_org);
+        sigaction(SIGINT, &originalSettings.oldSigIntAction, NULL);
+        sigaction(SIGSEGV, &originalSettings.oldSigSegvAction, NULL);
+        sigaction(SIGABRT, &originalSettings.oldSigAbrtAction, NULL);
+        sigaction(SIGQUIT, &originalSettings.oldSigQuitAction, NULL);
+    }
+
+
+    return NULL;
+}
+
+static void shellTui_parseInput(shell_tui_t* shellTui, shell_context_t* ctx) {
+    char* buffer = ctx->buffer;
+    char* in = ctx->in;
+    int pos = ctx->pos;
+
+    char* line = NULL;
+
+
+    int nr_chars = read(STDIN_FILENO, buffer, LINE_SIZE-pos-1);
+    for(int bufpos = 0; bufpos < nr_chars; bufpos++) {
+        if (buffer[bufpos] == KEY_ENTER) { //end of line -> forward command
+            line = utils_stringTrim(in);
+            celixThreadMutex_lock(&shellTui->mutex);
+            if (shellTui->shell != NULL) {
+                printf("Providing command '%s' from in '%s'\n", line, in);
+                shellTui->shell->executeCommand(shellTui->shell->shell, line, stdout, stderr);
+            } else {
+                fprintf(stderr, "Shell service not available\n");
+            }
+            celixThreadMutex_unlock(&shellTui->mutex);
+            pos = 0;
+            in[pos] = '\0';
+        } else { //text
+            in[pos] = buffer[bufpos];
+            in[pos+1] = '\0';
+            pos++;
+            continue;
+        }
+    } // for
+    ctx->pos = pos;
+}
+
+static void shellTui_parseInputForControl(shell_tui_t* shellTui, shell_context_t* ctx) {
+    char* buffer = ctx->buffer;
+    char* in = ctx->in;
+    char* dline = ctx->dline;
+    history_t* hist = ctx->hist;
+    int pos = ctx->pos;
+
+    char* line = NULL;
+
+    if (shellTui == NULL) {
+    	return;
+    }
+
+    int nr_chars = read(STDIN_FILENO, buffer, LINE_SIZE-pos-1);
+    for(int bufpos = 0; bufpos < nr_chars; bufpos++) {
+        if (buffer[bufpos] == KEY_ESC1 && buffer[bufpos+1] == KEY_ESC2) {
+            switch (buffer[bufpos+2]) {
+                case KEY_UP:
+                    if(historySize(hist) > 0) {
+                        strncpy(in, historyGetPrevLine(hist), LINE_SIZE);
+                        pos = strlen(in);
+                        writeLine(in, pos);
+                    }
+                    break;
+                case KEY_DOWN:
+                    if(historySize(hist) > 0) {
+                        strncpy(in, historyGetNextLine(hist), LINE_SIZE);
+                        pos = strlen(in);
+                        writeLine(in, pos);
+                    }
+                    break;
+                case KEY_RIGHT:
+                    if (pos < strlen(in)) {
+                        pos++;
+                    }
+                    writeLine(in, pos);
+                    break;
+                case KEY_LEFT:
+                    if (pos > 0) {
+                        pos--;
+                    }
+                    writeLine(in, pos);
+                    break;
+                case KEY_DEL1:
+                    if(buffer[bufpos+3] == KEY_DEL2) {
+                        bufpos++; // delete cmd takes 4 chars
+                        int len = strlen(in);
+                        if (pos < len) {
+                            for (int i = pos; i <= len; i++) {
+                                in[i] = in[i + 1];
+                            }
+                        }
+                        writeLine(in, pos);
+                    }
+                    break;
+                default:
+                    // Unsupported char, do nothing
+                    break;
+            }
+            bufpos+=2;
+            continue;
+        } else if (buffer[bufpos] == KEY_BACKSPACE) { // backspace
+            if(pos > 0) {
+                int len = strlen(in);
+                for(int i = pos-1; i <= len; i++) {
+                    in[i] = in[i+1];
+                }
+                pos--;
+            }
+            writeLine(in, pos);
+            continue;
+        } else if(buffer[bufpos] == KEY_TAB) {
+            celixThreadMutex_lock(&shellTui->mutex);
+            pos = autoComplete(shellTui->shell, in, pos, LINE_SIZE);
+            celixThreadMutex_unlock(&shellTui->mutex);
+            continue;
+        } else if (buffer[bufpos] != KEY_ENTER) { //not end of line -> text
+            if (in[pos] == '\0') {
+                in[pos+1] = '\0';
+            }
+            in[pos] = buffer[bufpos];
+            pos++;
+            writeLine(in, pos);
+            fflush(stdout);
+            continue;
+        }
+
+        //parse enter
+        writeLine(in, pos);
+        write(STDOUT_FILENO, "\n", 1);
+        remove_newlines(in);
+        history_addLine(hist, in);
+
+        memset(dline, 0, LINE_SIZE);
+        strncpy(dline, in, LINE_SIZE);
+
+        pos = 0;
+        in[pos] = '\0';
+
+        line = utils_stringTrim(dline);
+        if ((strlen(line) == 0)) {
+            continue;
+        }
+        historyLineReset(hist);
+        celixThreadMutex_lock(&shellTui->mutex);
+        if (shellTui->shell != NULL) {
+            shellTui->shell->executeCommand(shellTui->shell->shell, line, stdout, stderr);
+            pos = 0;
+            nr_chars = 0;
+        } else {
+            fprintf(stderr, "Shell service not available\n");
+        }
+        celixThreadMutex_unlock(&shellTui->mutex);
+    } // for
+    ctx->pos = pos;
+}
+
+static void remove_newlines(char* line) {
+    for(int i = 0; i < strlen(line); i++) {
+        if(line[i] == '\n') {
+            for(int j = 0; j < strlen(&line[i]); j++) {
+                line[i+j] = line[i+j+1];
+            }
+        }
+    }
+}
+
+static void clearLine() {
+	printf("\033[2K\r");
+	fflush(stdout);
+}
+
+static void cursorLeft(int n) {
+	if(n>0) {
+		printf("\033[%dD", n);
+		fflush(stdout);
+	}
+}
+
+static void writePrompt(void) {
+    write(STDIN_FILENO, PROMPT, strlen(PROMPT));
+}
+
+static void writeLine(const char* line, int pos) {
+    clearLine();
+    write(STDOUT_FILENO, PROMPT, strlen(PROMPT));
+    write(STDOUT_FILENO, line, strlen(line));
+	cursorLeft(strlen(line)-pos);
+}
+
+static int autoComplete(shell_service_t* shellSvc, char *in, int cursorPos, size_t maxLen) {
+	array_list_pt commandList = NULL;
+	array_list_pt possibleCmdList = NULL;
+	shellSvc->getCommands(shellSvc->shell, &commandList);
+	int nrCmds = arrayList_size(commandList);
+	arrayList_create(&possibleCmdList);
+
+	for (int i = 0; i < nrCmds; i++) {
+		char *cmd = arrayList_get(commandList, i);
+		if (strncmp(in, cmd, cursorPos) == 0) {
+			arrayList_add(possibleCmdList, cmd);
+		}
+	}
+
+	int nrPossibleCmds = arrayList_size(possibleCmdList);
+	if (nrPossibleCmds == 0) {
+		// Check if complete command with space is entered: show usage if this is the case
+		if(in[strlen(in) - 1] == ' ') {
+			for (int i = 0; i < nrCmds; i++) {
+				char *cmd = arrayList_get(commandList, i);
+				if (strncmp(in, cmd, strlen(cmd)) == 0) {
+					clearLine();
+					char* usage = NULL;
+					shellSvc->getCommandUsage(shellSvc->shell, cmd, &usage);
+					printf("Usage:\n %s\n", usage);
+				}
+			}
+		}
+	} else if (nrPossibleCmds == 1) {
+		//Replace input string with the only possibility
+		snprintf(in, maxLen, "%s ", (char*)arrayList_get(possibleCmdList, 0));
+		cursorPos = strlen(in);
+	} else {
+		// Show possibilities
+		clearLine();
+		for(int i = 0; i < nrPossibleCmds; i++) {
+			printf("%s ", (char*)arrayList_get(possibleCmdList, i));
+		}
+		printf("\n");
+	}
+	arrayList_destroy(commandList);
+	arrayList_destroy(possibleCmdList);
+	return cursorPos;
+}
+

http://git-wip-us.apache.org/repos/asf/celix/blob/3bce889b/config_admin/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/config_admin/CMakeLists.txt b/config_admin/CMakeLists.txt
deleted file mode 100644
index fc42f7e..0000000
--- a/config_admin/CMakeLists.txt
+++ /dev/null
@@ -1,61 +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.
-
-
-#TODO refactor and improve impl
-#celix_subproject(CONFIG_ADMIN "Option to enable building the Config Admin Service bundle and its examples" OFF DEPS framework launcher shell_tui log_writer)
-set(CONFIG_AMDIN FALSE)
-if (CONFIG_ADMIN)
-
-	add_subdirectory(service)
-    add_subdirectory(example)
-	
-	if (ENABLE_TESTING)
-		find_package(CppUTest REQUIRED)
-
-	    include_directories(${CPPUTEST_INCLUDE_DIR})
-	    add_subdirectory(config_admin_tst)
-#		find_package(CppUTest REQUIRED)
-#
-#	    include_directories(${CUNIT_INCLUDE_DIRS})
-#	    include_directories(${CPPUTEST_INCLUDE_DIR})
-#	    include_directories("${PROJECT_SOURCE_DIR}/config_admin/service/public/include")
-#	    include_directories("${PROJECT_SOURCE_DIR}/config_admin/service/private/include")
-#	    include_directories("${PROJECT_SOURCE_DIR}/utils/public/include")
-#	    
-#	    add_executable(config_admin_test config_admin_tst/config_admin_test.cpp)
-#	    target_link_libraries(config_admin_test celix_utils ${CPPUTEST_LIBRARY} pthread)
-#	    
-#	    
-#		add_test(NAME run_config_admin_test COMMAND config_admin_test)
-#      	SETUP_TARGET_FOR_COVERAGE(config_admin_test config_admin_test ${CMAKE_BINARY_DIR}/coverage/config_admin_test/config_admin_test)
-
-   endif(ENABLE_TESTING)
-	
-
-   add_celix_container(config_admin_deploy
-       NAME "config_admin"
-       BUNDLES 
-        config_admin 
-        Celix::shell
-	    Celix::shell_tui
-        log_service 
-        log_writer 
-        config_admin_example
-   )
-
-endif (CONFIG_ADMIN)

http://git-wip-us.apache.org/repos/asf/celix/blob/3bce889b/config_admin/config_admin_tst/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/config_admin/config_admin_tst/CMakeLists.txt b/config_admin/config_admin_tst/CMakeLists.txt
deleted file mode 100644
index f0abb8c..0000000
--- a/config_admin/config_admin_tst/CMakeLists.txt
+++ /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.
-
-include_directories(
-    ${PROJECT_SOURCE_DIR}/framework/public/include
-    ${PROJECT_SOURCE_DIR}/utils/public/include
-    ${PROJECT_SOURCE_DIR}/utils/public/include
-    ${PROJECT_SOURCE_DIR}/config_admin/service/public/include
-    example_test/private/include
-    example_test2/private/include
-)
-
-add_subdirectory(example_test)
-add_subdirectory(example_test2)
-
-SET(CMAKE_SKIP_BUILD_RPATH  FALSE) #TODO needed?
-SET(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE) #TODO needed?
-SET(CMAKE_INSTALL_RPATH "${PROJECT_BINARY_DIR}/framework" "${PROJECT_BINARY_DIR}/utils" )
-
-add_executable(config_admin_test config_admin_test.cpp)
-target_link_libraries(config_admin_test Celix::framework ${CELIX_LIBRARIES} ${CPPUTEST_LIBRARY} pthread)
-
-
-get_property(config_admin_bundle_file TARGET config_admin PROPERTY BUNDLE_FILE)
-get_property(example_test_bundle_file TARGET example_test PROPERTY BUNDLE_FILE)
-get_property(example_test2_bundle_file TARGET example_test2 PROPERTY BUNDLE_FILE)
-
-configure_file(config.properties.in config.properties @ONLY)
-
-
-#ADD_TARGET_FOR_TEST(config_admin_test)
-add_test(NAME run_config_admin_test COMMAND config_admin_test)
-SETUP_TARGET_FOR_COVERAGE(config_admin_test config_admin_test ${CMAKE_BINARY_DIR}/coverage/config_admin_test/config_admin_test)

http://git-wip-us.apache.org/repos/asf/celix/blob/3bce889b/config_admin/config_admin_tst/config.properties.in
----------------------------------------------------------------------
diff --git a/config_admin/config_admin_tst/config.properties.in b/config_admin/config_admin_tst/config.properties.in
deleted file mode 100644
index 7e8c14d..0000000
--- a/config_admin/config_admin_tst/config.properties.in
+++ /dev/null
@@ -1,20 +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.
-
-cosgi.auto.start.1=@config_admin_bundle_file@ @example_test_bundle_file@ @example_test2_bundle_file@
-LOGHELPER_ENABLE_STDOUT_FALLBACK=true
-org.osgi.framework.storage.clean=onFirstInit
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/celix/blob/3bce889b/config_admin/config_admin_tst/config_admin_test.cpp
----------------------------------------------------------------------
diff --git a/config_admin/config_admin_tst/config_admin_test.cpp b/config_admin/config_admin_tst/config_admin_test.cpp
deleted file mode 100644
index 04cd6d7..0000000
--- a/config_admin/config_admin_tst/config_admin_test.cpp
+++ /dev/null
@@ -1,404 +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.
- */
-/*
- * config_admin_test.cpp
- *
- * 	\date       Sep 15, 2015
- *  \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 <unistd.h>
-#include <string.h>
-
-#include "CppUTest/TestHarness.h"
-#include "CppUTest/TestHarness_c.h"
-#include "CppUTest/CommandLineTestRunner.h"
-
-extern "C" {
-#include "celix_threads.h"
-#include "array_list.h"
-
-#include "celix_launcher.h"
-#include "constants.h"
-#include "framework.h"
-#include "configuration_admin.h"
-#include "example_managed_service_impl.h"
-#include "example2_managed_service_impl.h"
-
-
-static framework_pt framework = NULL;
-static bundle_context_pt context = NULL;
-
-service_reference_pt confAdminRef = NULL;
-configuration_admin_service_pt confAdminServ = NULL;
-
-service_reference_pt testRef = NULL;
-tst_service_pt testServ = NULL;
-
-service_reference_pt test2Ref = NULL;
-tst2_service_pt test2Serv = NULL;
-
-	void setupFw(void) {
-    	int rc = 0;
-
-        rc = celixLauncher_launch("config.properties", &framework);
-        CHECK_EQUAL(CELIX_SUCCESS, rc);
-
-        bundle_pt bundle = NULL;
-        rc = framework_getFrameworkBundle(framework, &bundle);
-        CHECK_EQUAL(CELIX_SUCCESS, rc);
-
-        rc = bundle_getContext(bundle, &context);
-        CHECK_EQUAL(CELIX_SUCCESS, rc);
-
-        rc = bundleContext_getServiceReference(context, (char *) CONFIGURATION_ADMIN_SERVICE_NAME, &confAdminRef);
-        CHECK_EQUAL(CELIX_SUCCESS, rc);
-
-		rc = bundleContext_getService(context, confAdminRef, (void **) &confAdminServ);
-		CHECK_EQUAL(CELIX_SUCCESS, rc);
-
-        rc = bundleContext_getServiceReference(context, (char *) TST_SERVICE_NAME, &testRef);
-        CHECK_EQUAL(CELIX_SUCCESS, rc);
-
-		rc = bundleContext_getService(context, testRef, (void **)&testServ);
-		CHECK_EQUAL(CELIX_SUCCESS, rc);
-
-        rc = bundleContext_getServiceReference(context, (char *) TST2_SERVICE_NAME, &test2Ref);
-        CHECK_EQUAL(CELIX_SUCCESS, rc);
-
-		rc = bundleContext_getService(context, test2Ref, (void **)&test2Serv);
-		CHECK_EQUAL(CELIX_SUCCESS, rc);
-
-	}
-
-	void teardownFw(void) {
-        int rc = 0;
-
-		rc = bundleContext_ungetService(context, testRef, NULL);
-        CHECK_EQUAL(CELIX_SUCCESS, rc);
-
-        rc = bundleContext_ungetServiceReference(context, testRef);
-        CHECK_EQUAL(CELIX_SUCCESS, rc);
-
-        rc = bundleContext_ungetService(context, test2Ref, NULL);
-        CHECK_EQUAL(CELIX_SUCCESS, rc);
-
-        rc = bundleContext_ungetServiceReference(context, test2Ref);
-        CHECK_EQUAL(CELIX_SUCCESS, rc);
-
- 		rc = bundleContext_ungetService(context, confAdminRef, NULL);
-        CHECK_EQUAL(CELIX_SUCCESS, rc);
-
-        rc = bundleContext_ungetServiceReference(context, confAdminRef);
-        CHECK_EQUAL(CELIX_SUCCESS, rc);
-
-        celixLauncher_stop(framework);
-        celixLauncher_waitForShutdown(framework);
-        celixLauncher_destroy(framework);
-
-        test2Ref = NULL;
-        test2Serv = NULL;
-        testRef = NULL;
-        testServ = NULL;
-        confAdminRef = NULL;
-        confAdminServ = NULL;
-        context = NULL;
-        framework = NULL;
-	}
-
-	static void cleanUp(void) {
-		system("rm -rf .cache");
-		system("rm -rf store");
-	}
-	 static void testBundles(void) {
-		 printf("begin: %s\n", __func__);
-        array_list_pt bundles = NULL;
-
-        int rc = bundleContext_getBundles(context, &bundles);
-        CHECK_EQUAL(0, rc);
-        CHECK_EQUAL(4, arrayList_size(bundles)); //framework, config_admin, example_test, example_test2
-        arrayList_destroy(bundles);
-		 printf("end: %s\n", __func__);
-	 }
-
-
-	static void testManagedService(void) {
-		printf("begin: %s\n", __func__);
-		const char *pid = "base.device1";
-		char value[80];
-		properties_pt properties;
-		/* ------------------ get Configuration -------------------*/
-
-		configuration_pt configuration;
-		(*confAdminServ->getConfiguration)(confAdminServ->configAdmin,(char *)pid, &configuration);
-		configuration->configuration_getProperties(configuration->handle, &properties);
-		CHECK((properties ==  NULL));
-		testServ->get_type(testServ->handle, value);
-		CHECK_TEXT("default_value", value);
-
-		/* ------------------ clear configuration ----------------*/
-		configuration->configuration_update(configuration->handle , NULL);
-		sleep(1);
-		/* check if it is also cleared in the service */
-		testServ->get_type(testServ->handle, value);
-		CHECK_TEXT("", value);
-
-		/* ------------------ update Configuration ----------------*/
-		const char *prop1 = "type";
-		const char *value1 = "printer";
-		properties = properties_create();
-		properties_set(properties, (char *)prop1, (char *)value1);
-		// configuration_update transfers ownership of properties structure to the configuration object
-		configuration->configuration_update(configuration->handle , properties);
-
-		sleep(1);
-		testServ->get_type(testServ->handle, value);
-		CHECK_TEXT("printer", value);
-		properties = NULL;
-		configuration->configuration_getProperties(configuration->handle, &properties);
-		if (properties != NULL) {
-			const char *test_value = properties_get(properties, (char*)OSGI_FRAMEWORK_SERVICE_PID);
-			CHECK_TEXT("base.device1", test_value);
-			test_value = properties_get(properties, (char *)prop1);
-			CHECK_TEXT("printer", test_value);
-		}
-		printf("end: %s\n", __func__);
-	 }
-
-	static void testManagedServicePersistent(void) {
-			printf("begin: %s\n", __func__);
-			const char *pid = "base.device1";
-			properties_pt properties = NULL;
-			const char *key = "type";
-			/* ------------------ get Configuration -------------------*/
-
-			configuration_pt configuration;
-			(*confAdminServ->getConfiguration)(confAdminServ->configAdmin, (char *)pid, &configuration);
-			configuration->configuration_getProperties(configuration->handle, &properties);
-			CHECK((properties != NULL));
-			if (properties != NULL) {
-				const char *test_value = properties_get(properties, (char*)OSGI_FRAMEWORK_SERVICE_PID);
-				CHECK_TEXT("base.device1", test_value);
-				test_value = properties_get(properties, (char *)key);
-				CHECK_TEXT("printer", test_value);
-			}
-
-			printf("end: %s\n", __func__);
-		 }
-
-	static void testTwoManagedService(void) {
-			printf("begin: %s\n", __func__);
-			const char *pid = "base.device1";
-			const char *tst2Pid = "test2_pid";
-			char value[80];
-			properties_pt properties;
-			properties_pt properties2;
-			/* ------------------ get Configuration -------------------*/
-
-			configuration_pt configuration;
-			configuration_pt configuration2;
-			(*confAdminServ->getConfiguration)(confAdminServ->configAdmin, (char *)pid, &configuration);
-			(*confAdminServ->getConfiguration)(confAdminServ->configAdmin, (char *)tst2Pid, &configuration2);
-
-			/* ------------------ update Configuration ----------------*/
-			const char *prop1 = "type";
-			const char *value1 = "printer";
-			properties = properties_create();
-			properties_set(properties, (char *)prop1, (char *)value1);
-			// configuration_update transfers ownership of properties structure to the configuration object
-			configuration->configuration_update(configuration->handle , properties);
-			properties2 = properties_create();
-			properties_set(properties2, (char *)prop1, (char *)"test2_printer");
-			// configuration_update transfers ownership of properties structure to the configuration object
-			configuration2->configuration_update(configuration2->handle , properties2);
-
-			sleep(1);
-			testServ->get_type(testServ->handle, value);
-			CHECK_TEXT("printer", value);
-			test2Serv->get_type(test2Serv->handle, value);
-			CHECK_TEXT("test2_printer", value);
-			properties = NULL;
-			configuration->configuration_getProperties(configuration->handle, &properties);
-			if (properties != NULL) {
-				const char *test_value = properties_get(properties, (char*)OSGI_FRAMEWORK_SERVICE_PID);
-				CHECK_TEXT("base.device1", test_value);
-				test_value = properties_get(properties, (char *)prop1);
-				CHECK_TEXT("printer", test_value);
-			}
-			configuration2->configuration_getProperties(configuration2->handle, &properties);
-			if (properties != NULL) {
-				const char *test_value = properties_get(properties, (char*)OSGI_FRAMEWORK_SERVICE_PID);
-				CHECK_TEXT("test2_pid", test_value);
-				test_value = properties_get(properties, (char *)prop1);
-				CHECK_TEXT("test2_printer", test_value);
-			}
-			printf("end: %s\n", __func__);
-		 }
-
-	    static void testAddManagedServiceProperty(void) {
-			printf("begin: %s\n", __func__);
-			const char *pid = "base.device1";
-			char value[80];
-			properties_pt properties;
-			/* ------------------ get Configuration -------------------*/
-
-			configuration_pt configuration;
-			(*confAdminServ->getConfiguration)(confAdminServ->configAdmin, (char *)pid, &configuration);
-
-			/* ------------------ update Configuration ----------------*/
-			const char *prop1 = "type";
-			const char *value1 = "printer";
-			const char *prop2 = "second_type";
-			const char *value2 = "my_second_value";
-			properties = properties_create();
-			properties_set(properties, (char *)prop1, (char *)value1);
-			// configuration_update transfers ownership of properties structure to the configuration object
-			configuration->configuration_update(configuration->handle , properties);
-			sleep(1);
-			testServ->get_type(testServ->handle, value);
-			CHECK_TEXT("printer", value);
-			configuration->configuration_getProperties(configuration->handle, &properties);
-			CHECK((properties != NULL));
-			properties_set(properties, (char *)prop2, (char *)value2);
-			// extend an existing configuration with a new property
-			configuration->configuration_update(configuration->handle, properties);
-			value2 = NULL;
-			testServ->get_second_type(testServ->handle, value);
-			CHECK_TEXT("my_second_value", value);
-			printf("end: %s\n", __func__);
-		 }
-
-	    static void testManagedServiceRemoved(void) {
-			printf("begin: %s\n", __func__);
-			const char *pid = "base.device1";
-			char value[80];
-			properties_pt properties = NULL;
-			bundle_pt	bundle = NULL;
-			bundle_pt   fwBundle = NULL;
-			bundle_archive_pt	archive = NULL;
-			bundle_context_pt   context = NULL;
-			const char                *location = NULL;
-			/* ------------------ get Configuration -------------------*/
-
-			configuration_pt configuration;
-			(*confAdminServ->getConfiguration)(confAdminServ->configAdmin, (char *)pid, &configuration);
-
-			/* ------------------ update Configuration ----------------*/
-			const char *prop1 = "type";
-			const char *value1 = "printer";
-			const char *prop2 = "second_type";
-			const char *value2 = "my_second_value";
-			char org_location[128];
-			properties = properties_create();
-			properties_set(properties, (char *)prop1, (char *)value1);
-			properties_set(properties, (char *)prop2, (char *)value2);
-			// configuration_update transfers ownership of properties structure to the configuration object
-			configuration->configuration_update(configuration->handle , properties);
-			sleep(1);
-			serviceReference_getBundle(testRef, &bundle);
-			bundle_getArchive(bundle, &archive);
-			bundle_getBundleLocation(bundle, &location);
-			bundle_stop(bundle);
-			strcpy(org_location, location);
-			configuration->configuration_getProperties(configuration->handle, &properties);
-			bundle_uninstall(bundle);
-			configuration->configuration_getProperties(configuration->handle, &properties);
-			CHECK((properties != NULL));
-			bundle = NULL;
-			framework_getFrameworkBundle(framework, &fwBundle);
-		    bundle_getContext(fwBundle, &context);
-		    bundleContext_installBundle(context, org_location, &bundle);
-			bundle_startWithOptions(bundle, 0);
-			// extend an existing configuration with a new property
-			configuration->configuration_getProperties(configuration->handle, &properties);
-			CHECK((properties != NULL));
-			testRef = NULL;
-	        bundleContext_getServiceReference(context, (char *) TST_SERVICE_NAME, &testRef);
-			testServ = NULL;
-			bundleContext_getService(context, testRef, (void **)&testServ);
-			testServ->get_second_type(testServ->handle, value);
-			CHECK_TEXT("my_second_value", value);
-			printf("end: %s\n", __func__);
-	}
-}
-
-
-
-int main(int argc, char** argv) {
-	return RUN_ALL_TESTS(argc, argv);
-}
-
-
-//----------------------TEST THREAD FUNCTION DECLARATIONS----------------------
-
-//----------------------TESTGROUP DEFINES----------------------
-
-TEST_GROUP(managed_service) {
-
-    void setup(void) {
-        cleanUp();
-    	setupFw();
-    }
-
-	void teardown(void) {
-		teardownFw();
-	}
-
-};
-
-TEST_GROUP(managed_service_persistent) {
-
-    void setup(void) {
-    	setupFw();
-    }
-
-	void teardown(void) {
-		teardownFw();
-	}
-
-};
-
-// TODO: test service factory PID
-
-//----------------------THREAD_POOL TESTS----------------------
-TEST(managed_service, test_managed_service_removed) {
-	testManagedServiceRemoved();
-}
-
-TEST(managed_service, add_managed_service_property) {
-    testAddManagedServiceProperty();
-}
-
-TEST(managed_service, test_two_managed_service) {
-    testTwoManagedService();
-}
-
-TEST(managed_service_persistent, test_persistent) {
-    testManagedServicePersistent();
-}
-
-TEST(managed_service, test_managed_service) {
-    testManagedService();
-}
-
-TEST(managed_service, test_bundles) {
-    testBundles();
-}

http://git-wip-us.apache.org/repos/asf/celix/blob/3bce889b/config_admin/config_admin_tst/example_test/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/config_admin/config_admin_tst/example_test/CMakeLists.txt b/config_admin/config_admin_tst/example_test/CMakeLists.txt
deleted file mode 100644
index 80419b5..0000000
--- a/config_admin/config_admin_tst/example_test/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.
-
-
-include_directories("${PROJECT_SOURCE_DIR}/utils/public/include")
-include_directories("${PROJECT_SOURCE_DIR}/framework/public/include")
-include_directories("${PROJECT_SOURCE_DIR}/config_admin/service/public/include")
-include_directories("private/include")
-
-add_celix_bundle(example_test
-    VERSION 0.1.0
-    SOURCES
-	private/src/activator
-	private/src/example_managed_service_impl
-)
-
-target_link_libraries(example_test PRIVATE Celix::framework celix_utils config_admin)

http://git-wip-us.apache.org/repos/asf/celix/blob/3bce889b/config_admin/config_admin_tst/example_test/META-INF/MANIFEST.MF
----------------------------------------------------------------------
diff --git a/config_admin/config_admin_tst/example_test/META-INF/MANIFEST.MF b/config_admin/config_admin_tst/example_test/META-INF/MANIFEST.MF
deleted file mode 100644
index 15593d6..0000000
--- a/config_admin/config_admin_tst/example_test/META-INF/MANIFEST.MF
+++ /dev/null
@@ -1,5 +0,0 @@
-Manifest-Version: 1.0
-Bundle-SymbolicName: example_test
-Bundle-Version: 1.0.0
-library: example_test
-Import-Service: configuration_admin

http://git-wip-us.apache.org/repos/asf/celix/blob/3bce889b/config_admin/config_admin_tst/example_test/private/include/example_managed_service_impl.h
----------------------------------------------------------------------
diff --git a/config_admin/config_admin_tst/example_test/private/include/example_managed_service_impl.h b/config_admin/config_admin_tst/example_test/private/include/example_managed_service_impl.h
deleted file mode 100644
index c34647f..0000000
--- a/config_admin/config_admin_tst/example_test/private/include/example_managed_service_impl.h
+++ /dev/null
@@ -1,68 +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.
- */
-/*
- * example_managed_service_impl.h
- *
- *  \date       Aug 12, 2013
- *  \author    	<a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
- *  \copyright	Apache License, Version 2.0
- */
-
-
-#ifndef MANAGED_SERVICE_IMPL_H_
-#define MANAGED_SERVICE_IMPL_H_
-
-
-/* celix.utils*/
-#include "properties.h"
-/* celix.framework */
-#include "celix_errno.h"
-#include "service_registration.h"
-#include "bundle_context.h"
-/* celix.config_admin.ManagedService */
-#include "managed_service.h"
-
-struct test_managed_service{
-
-	bundle_context_pt 			context;
-
-	service_registration_pt 	registration;
-	properties_pt 				properties;
-	void 						*handle;
-	void (*store_props)(void *handle, char* type, char* second_type);
-
-};
-
-#define TST_SERVICE_NAME "tst_service"
-
-struct tst_service {
-    void *handle;
-    int (*get_type)(void *handle, char *value);
-    int (*get_second_type)(void *handle, char *value);
-};
-
-typedef struct tst_service *tst_service_pt;
-
-celix_status_t managedServiceImpl_create(bundle_context_pt context, managed_service_pt *instance);
-celix_status_t managedServiceImpl_updated(managed_service_pt instance, properties_pt properties);
-celix_status_t managedServiceImpl_destroy(managed_service_pt *instance);
-
-
-
-#endif /* MANAGED_SERVICE_IMPL_H_ */

http://git-wip-us.apache.org/repos/asf/celix/blob/3bce889b/config_admin/config_admin_tst/example_test/private/src/activator.c
----------------------------------------------------------------------
diff --git a/config_admin/config_admin_tst/example_test/private/src/activator.c b/config_admin/config_admin_tst/example_test/private/src/activator.c
deleted file mode 100644
index bae4daf..0000000
--- a/config_admin/config_admin_tst/example_test/private/src/activator.c
+++ /dev/null
@@ -1,207 +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 12, 2013
- *  \author    	<a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
- *  \copyright	Apache License, Version 2.0
- */
-
-#include <stdbool.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-
-/* celix.framework */
-#include "bundle_activator.h"
-#include "bundle_context.h"
-#include "constants.h"
-#include "properties.h"
-#include "utils.h"
-/* celix.utils */
-#include "hash_map.h"
-/* celix.configadmin */
-#include "configuration_admin.h"
-#include "configuration.h"
-#include "managed_service.h"
-#include "service_registration.h"
-/* celix.config_admin.examples.private */
-#include "example_managed_service_impl.h"
-
-
-//static void test_debugConfiguration(configuration_pt configuration, char* pid);
-struct activator {
-	bundle_context_pt context;
-	tst_service_pt           tstServ;
-	service_registration_pt  tstReg;
-
-    service_registration_pt   mgmReg;
-	managed_service_service_pt  mgmServ;
-
-	service_reference_pt	  configAdminServRef;
-	configuration_admin_service_pt   configAdminServ;
-
-	char	type_value[125];
-	char	second_type_value[125];
-};
-
-
-void store_properties(void *handle, char* type, char* second) {
-	struct activator *act = (struct activator *)handle;
-	if (type == NULL)
-		act->type_value[0] = 0x00;
-	else
-		strcpy(act->type_value, type);
-	if (second == NULL)
-		act->second_type_value[0] = 0x00;
-	else
-		strcpy(act->second_type_value, second);
-}
-int my_get_type(void *handle, char* value) {
-	struct activator *act = (struct activator *)handle;
-	strcpy(value, act->type_value);
-
-	return 0;
-}
-
-int my_get_second_type(void *handle, char* value) {
-	struct activator *act = (struct activator *)handle;
-	strcpy(value, act->second_type_value);
-
-	return 0;
-}
-
-celix_status_t bundleActivator_create(bundle_context_pt context, void **userData) {
-	struct activator *act = calloc(1, sizeof(struct activator));
-	act->mgmReg = NULL;
-	act->mgmServ = NULL;
-	act->tstServ = calloc(1, sizeof(*act->tstServ));
-	act->tstServ->handle = act;
-	act->tstServ->get_type = my_get_type;
-	act->tstServ->get_second_type = my_get_second_type;
-	act->tstReg = NULL;
-	act->configAdminServ = NULL;
-	act->configAdminServRef = NULL;
-	act->type_value[0] = 0x00;
-	act->second_type_value[0] = 0x00;
-	*userData = act;
-	return CELIX_SUCCESS;
-}
-
-celix_status_t bundleActivator_start(void * userData, bundle_context_pt ctx) {
-
-	struct activator *act = (struct activator *)userData;
-	service_reference_pt ref;
-	celix_status_t status = bundleContext_getServiceReference(ctx, (char *) CONFIGURATION_ADMIN_SERVICE_NAME, &ref);
-
-	if (status == CELIX_SUCCESS) {
-
-		if (ref == NULL) {
-			printf("[configAdminClient]: ConfigAdminService reference not available\n");
-		} else {
-			configuration_admin_service_pt confAdminServ = NULL;
-			bundleContext_getService(ctx, ref, (void *) &confAdminServ);
-
-			if (confAdminServ == NULL){
-				printf("[ TEST ]: ConfigAdminService not available\n");
-			} else {
-				char *pid = "base.device1";
-				configuration_pt configuration;
-				/* ------------------ get Configuration -------------------*/
-				(*confAdminServ->getConfiguration)(confAdminServ->configAdmin,pid, &configuration);
-				act->configAdminServ = confAdminServ;
-				act->configAdminServRef = ref;
-				managed_service_pt managedService;
-				status = managedServiceImpl_create(ctx, &managedService);
-				if (status != CELIX_SUCCESS){
-					return status;
-				}
-				struct test_managed_service *test_msp = (struct test_managed_service*) managedService;
-				test_msp->handle = act;
-				test_msp->store_props = store_properties;
-
-				status = managedService_create(ctx, &act->mgmServ);
-
-				if (status != CELIX_SUCCESS){
-					return status;
-				}
-
-				act->mgmServ->managedService = managedService;
-				act->mgmServ->updated = managedServiceImpl_updated;
-				properties_pt dictionary;
-				configuration->configuration_getProperties(configuration->handle, &dictionary);
-				if (dictionary == NULL) {
-					dictionary = properties_create();
-					properties_set(dictionary, (char *) OSGI_FRAMEWORK_SERVICE_PID, pid);
-					properties_set(dictionary, (char *) "type", (char*)"default_value");
-				}
-				// the service has to be registered with a properties/dictionary structure that at least contains a pid to assure it
-				// is picked up by the managedServiceTracker of the configuration Admin
-				status = bundleContext_registerService(ctx, (char *) MANAGED_SERVICE_SERVICE_NAME, act->mgmServ, dictionary, &act->mgmReg);
-				if (status != CELIX_SUCCESS){
-					printf("[ ERROR ]: Managed Service not registered \n");
-					return status;
-				}
-				status = bundleContext_registerService(ctx, (char *)TST_SERVICE_NAME, act->tstServ, NULL, &act->tstReg);
-
-			}
-		}
-	}
-	return status;
-
-	return CELIX_SUCCESS;
-}
-
-celix_status_t bundleActivator_stop(void * userData, bundle_context_pt context) {
-	celix_status_t status;
-	struct activator *act = (struct activator *)userData;
-	if (act->mgmReg != NULL)
-		status = serviceRegistration_unregister(act->mgmReg);
-	if (act->tstReg != NULL)
-		status = serviceRegistration_unregister(act->tstReg);
-	if (act->configAdminServRef != NULL) {
-		status = bundleContext_ungetService(context, act->configAdminServRef, NULL);
-		status = bundleContext_ungetServiceReference(context, act->configAdminServRef);
-	}
-	return status;
-}
-
-celix_status_t bundleActivator_destroy(void * userData, bundle_context_pt context) {
-	struct activator *act = (struct activator *)userData;
-
-	managedServiceImpl_destroy(&act->mgmServ->managedService);
-	managedService_destroy(act->mgmServ);
-
-	free(act->tstServ);
-	free(act);
-	return CELIX_SUCCESS;
-}
-
-#if 0
-void test_debugConfiguration(configuration_pt configuration, char* pid){
-
-	if (configuration == NULL){
-		printf("[ TEST ]: Configuration(pid=%s) is NULL \n", pid);
-	} else{
-		printf("[ TEST ]: Configuration(pid=%s) OK \n", pid);
-	}
-
-}
-#endif

http://git-wip-us.apache.org/repos/asf/celix/blob/3bce889b/config_admin/config_admin_tst/example_test/private/src/example_managed_service_impl.c
----------------------------------------------------------------------
diff --git a/config_admin/config_admin_tst/example_test/private/src/example_managed_service_impl.c b/config_admin/config_admin_tst/example_test/private/src/example_managed_service_impl.c
deleted file mode 100644
index 7bcbf36..0000000
--- a/config_admin/config_admin_tst/example_test/private/src/example_managed_service_impl.c
+++ /dev/null
@@ -1,103 +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.
- */
-/*
- * example_managed_service_impl.c
- *
- *  \date       Aug 12, 2013
- *  \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 "example_managed_service_impl.h"
-
-/* ------------------------ Constructor -------------------------------------*/
-
-celix_status_t managedServiceImpl_create(bundle_context_pt context, managed_service_pt *instance) {
-
-	celix_status_t status = CELIX_SUCCESS;
-
-	struct test_managed_service *managedService = calloc(1, sizeof(*managedService));
-	if(!managedService){
-		printf("[ ERROR ]: ManagedServiceImpl - Not initialized (ENOMEM) \n");
-		return CELIX_ENOMEM;
-	}
-
-	managedService->context = context;
-	managedService->registration = NULL;
-	managedService->properties = NULL;
-
-	printf("[ ManagedServiceImpl ]: ManagedServiceImpl - Initialized \n");
-	*instance = (managed_service_pt)managedService;
-	return status;
-}
-
-
-celix_status_t managedServiceImpl_destroy(managed_service_pt *instance) {
-    free(*instance);
-
-    return CELIX_SUCCESS;
-}
-
-/* -------------------- Implementation --------------------------------------*/
-
-celix_status_t managedServiceImpl_updated(managed_service_pt managedService, properties_pt properties){
-	struct test_managed_service *msp = (struct test_managed_service *) managedService;
-
-	if (properties == NULL){
-		printf("[ managedServiceImpl ]: updated - Received NULL properties \n");
-		msp->store_props(msp->handle, "", "");
-	}else{
-		printf("[ managedServiceImpl ]: updated - Received New Properties \n");
-		char *value = (char*)properties_get(properties, "type");
-		char *value2 = (char*)properties_get(properties, "second_type");
-		msp->store_props(msp->handle, value, value2);
-		// it would be nicer if we get the property values here and store them in the activator structure.
-	}
-
-	return CELIX_SUCCESS;
-}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-

http://git-wip-us.apache.org/repos/asf/celix/blob/3bce889b/config_admin/config_admin_tst/example_test2/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/config_admin/config_admin_tst/example_test2/CMakeLists.txt b/config_admin/config_admin_tst/example_test2/CMakeLists.txt
deleted file mode 100644
index 1579eaf..0000000
--- a/config_admin/config_admin_tst/example_test2/CMakeLists.txt
+++ /dev/null
@@ -1,30 +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_directories("${PROJECT_SOURCE_DIR}/utils/public/include")
-include_directories("${PROJECT_SOURCE_DIR}/framework/public/include")
-include_directories("${PROJECT_SOURCE_DIR}/config_admin/service/public/include")
-include_directories("private/include")
-
-add_celix_bundle(example_test2 SOURCES
-	private/src/activator
-	private/src/example_managed_service_impl
-    VERSION 0.1.0
-)
-
-target_link_libraries(example_test2 Celix::framework celix_utils config_admin)

http://git-wip-us.apache.org/repos/asf/celix/blob/3bce889b/config_admin/config_admin_tst/example_test2/META-INF/MANIFEST.MF
----------------------------------------------------------------------
diff --git a/config_admin/config_admin_tst/example_test2/META-INF/MANIFEST.MF b/config_admin/config_admin_tst/example_test2/META-INF/MANIFEST.MF
deleted file mode 100644
index 15593d6..0000000
--- a/config_admin/config_admin_tst/example_test2/META-INF/MANIFEST.MF
+++ /dev/null
@@ -1,5 +0,0 @@
-Manifest-Version: 1.0
-Bundle-SymbolicName: example_test
-Bundle-Version: 1.0.0
-library: example_test
-Import-Service: configuration_admin

http://git-wip-us.apache.org/repos/asf/celix/blob/3bce889b/config_admin/config_admin_tst/example_test2/private/include/example2_managed_service_impl.h
----------------------------------------------------------------------
diff --git a/config_admin/config_admin_tst/example_test2/private/include/example2_managed_service_impl.h b/config_admin/config_admin_tst/example_test2/private/include/example2_managed_service_impl.h
deleted file mode 100644
index ab63215..0000000
--- a/config_admin/config_admin_tst/example_test2/private/include/example2_managed_service_impl.h
+++ /dev/null
@@ -1,66 +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.
- */
-/*
- * example_managed_service_impl.h
- *
- *  \date       Aug 12, 2013
- *  \author    	<a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
- *  \copyright	Apache License, Version 2.0
- */
-
-
-#ifndef TEST2_SERVICE_IMPL_H_
-#define TEST2_SERVICE_IMPL_H_
-
-
-/* celix.utils*/
-#include "properties.h"
-/* celix.framework */
-#include "celix_errno.h"
-#include "service_registration.h"
-#include "bundle_context.h"
-/* celix.config_admin.ManagedService */
-#include "managed_service.h"
-
-/*
-struct managed_service2{
-
-	bundle_context_pt 			context;
-
-	service_registration_pt 	registration;
-	properties_pt 				properties;
-
-};
-*/
-#define TST2_SERVICE_NAME "tst2_service"
-
-struct tst2_service {
-    void *handle;
-    int (*get_type)(void *handle, char *value);
-};
-
-typedef struct tst2_service *tst2_service_pt;
-
-celix_status_t managedServiceImpl_create(bundle_context_pt context, managed_service_pt *instance);
-celix_status_t managedServiceImpl_updated(managed_service_pt instance, properties_pt properties);
-celix_status_t managedServiceImpl_destroy(managed_service_pt *instance);
-
-
-
-#endif /* TEST2_SERVICE_IMPL_H_ */

http://git-wip-us.apache.org/repos/asf/celix/blob/3bce889b/config_admin/config_admin_tst/example_test2/private/src/activator.c
----------------------------------------------------------------------
diff --git a/config_admin/config_admin_tst/example_test2/private/src/activator.c b/config_admin/config_admin_tst/example_test2/private/src/activator.c
deleted file mode 100644
index a5ff343..0000000
--- a/config_admin/config_admin_tst/example_test2/private/src/activator.c
+++ /dev/null
@@ -1,227 +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 12, 2013
- *  \author    	<a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
- *  \copyright	Apache License, Version 2.0
- */
-
-#include <stdbool.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-
-#include "example2_managed_service_impl.h"
-/* celix.framework */
-#include "bundle_activator.h"
-#include "bundle_context.h"
-#include "constants.h"
-#include "properties.h"
-#include "utils.h"
-/* celix.utils */
-#include "hash_map.h"
-/* celix.configadmin */
-#include "configuration_admin.h"
-#include "configuration.h"
-#include "managed_service.h"
-#include "service_registration.h"
-/* celix.config_admin.examples.private */
-
-
-//static void test_debugConfiguration(configuration_pt configuration, char* pid);
-struct activator {
-	bundle_context_pt context;
-	tst2_service_pt          tstServ;
-	service_registration_pt  tstReg;
-
-    service_registration_pt   mgmReg;
-    managed_service_service_pt  mgmServ;
-
-
-	service_reference_pt	  configAdminServRef;
-	configuration_admin_service_pt   configAdminServ;
-
-	configuration_pt configuration;
-
-};
-
-
-int my_get_type(void *handle, char* value) {
-	struct activator *act = (struct activator *)handle;
-	if (act->configuration != NULL) {
-		properties_pt propsRx;
-		act->configuration->configuration_getProperties(act->configuration->handle, &propsRx);
-		if (propsRx != NULL) {
-			printf("[ TEST ]: PROP=%s - VALUE=%s \n", (char*)OSGI_FRAMEWORK_SERVICE_PID, properties_get(propsRx,(char*)OSGI_FRAMEWORK_SERVICE_PID));
-			strcpy(value, properties_get(propsRx,"type"));
-		}
-		else {
-			printf("[ TEST ]: No properties found \n");
-			strcpy(value, "");
-		}
-	}
-	else
-		value[0] = 0x00;
-	return 0;
-}
-celix_status_t bundleActivator_create(bundle_context_pt context, void **userData) {
-	struct activator *act = calloc(1, sizeof(struct activator));
-	act->mgmReg = NULL;
-	act->mgmServ = NULL;
-	act->tstServ = calloc(1, sizeof(*act->tstServ));
-	act->tstServ->handle = act;
-	act->tstServ->get_type = my_get_type;
-	act->tstReg = NULL;
-	act->configAdminServ = NULL;
-	act->configAdminServRef = NULL;
-	act->configuration = NULL;
-	*userData = act;
-	return CELIX_SUCCESS;
-}
-
-celix_status_t bundleActivator_start(void * userData, bundle_context_pt ctx) {
-
-	struct activator *act = (struct activator *)userData;
-	service_reference_pt ref;
-	celix_status_t status = bundleContext_getServiceReference(ctx, (char *) CONFIGURATION_ADMIN_SERVICE_NAME, &ref);
-
-	if (status == CELIX_SUCCESS) {
-
-		if (ref == NULL) {
-			printf("[configAdminClient]: ConfigAdminService reference not available\n");
-		} else {
-			configuration_admin_service_pt confAdminServ = NULL;
-			bundleContext_getService(ctx, ref, (void *) &confAdminServ);
-
-			if (confAdminServ == NULL){
-				printf("[ TEST ]: ConfigAdminService not available\n");
-			} else {
-				char *pid = "test2_pid";
-                /* In example_test a managed service is registered for which there already exists a
-                 * configuration object. In this case, a managed service is register for which there
-                 * is no configuration object in the configAdmin
-                 */
-				/* ------------------ get Configuration -------------------*
-				(*confAdminServ->getConfiguration)(confAdminServ->configAdmin,pid, &act->configuration);
-				*/
-				act->configAdminServ = confAdminServ;
-				act->configAdminServRef = ref;
-
-			    managed_service_pt managedService;
-				status = managedServiceImpl_create(ctx, &managedService);
-				if (status != CELIX_SUCCESS){
-					return status;
-				}
-
-				status = managedService_create(ctx, &act->mgmServ);
-				if (status != CELIX_SUCCESS){
-					return status;
-				}
-
-				act->mgmServ->managedService = managedService;
-				act->mgmServ->updated = managedServiceImpl_updated;
-
-				properties_pt dictionary;
-				dictionary = properties_create();
-				properties_set(dictionary, (char *) OSGI_FRAMEWORK_SERVICE_PID, pid);
-				properties_set(dictionary, (char *) "type", (char*)"test2_default_value");
-
-				status = bundleContext_registerService(ctx, (char *) MANAGED_SERVICE_SERVICE_NAME,
-				        act->mgmServ, dictionary, &act->mgmReg);
-				if (status != CELIX_SUCCESS){
-					printf("[ ERROR ]: Managed Service not registered \n");
-					return status;
-				}
-
-				status = bundleContext_registerService(ctx, (char *)TST2_SERVICE_NAME, act->tstServ, NULL, &act->tstReg);
-
-#if 0
-				/* ------------------ update Configuration ----------------*/
-
-				printf("------------------- TEST04 -------------------- \n");
-				printf("[ TEST ]: configuration update NULL \n");
-				configuration_update(configuration , NULL);
-
-				/* ------------------ update Configuration ----------------*/
-
-				printf("------------------- TEST05 -------------------- \n");
-				printf("[ TEST ]: configuration update New Properties \n");
-				char *prop1 = "type";
-				char *value1 = "printer";
-				properties_pt properties = properties_create();
-				properties_set(properties, prop1, value1);
-				configuration_update(configuration , properties);
-
-				/* ------------------ Configuration get Props ----------------*/
-
-				printf("------------------- TEST06 -------------------- \n");
-				printf("[ TEST ]: configuration get properties \n");
-
-				properties_pt propsRx = properties_create();
-				configuration_getProperties(configuration, &propsRx);
-
-				printf("[ TEST ]: PROP=%s - VALUE=%s \n", (char*)OSGI_FRAMEWORK_SERVICE_PID, properties_get(propsRx,(char*)OSGI_FRAMEWORK_SERVICE_PID));
-				printf("[ TEST ]: PROP=%s - VALUE=%s \n", prop1, properties_get(propsRx,prop1));
-
-				printf("/////////////////// END TESTS ///////////////// \n");
-#endif
-			}
-		}
-	}
-	return status;
-
-	return CELIX_SUCCESS;
-}
-
-celix_status_t bundleActivator_stop(void * userData, bundle_context_pt context) {
-	celix_status_t status;
-	struct activator *act = (struct activator *)userData;
-	if (act->mgmReg != NULL)
-		status = serviceRegistration_unregister(act->mgmReg);
-	if (act->tstReg != NULL)
-		status = serviceRegistration_unregister(act->tstReg);
-	if (act->configAdminServRef != NULL) {
-		status = bundleContext_ungetService(context, act->configAdminServRef, NULL);
-		status = bundleContext_ungetServiceReference(context, act->configAdminServRef);
-	}
-	return status;
-}
-
-celix_status_t bundleActivator_destroy(void * userData, bundle_context_pt context) {
-	struct activator *act = (struct activator *)userData;
-    managedServiceImpl_destroy(&act->mgmServ->managedService);
-    managedService_destroy(act->mgmServ);
-	free(act->tstServ);
-	free(act);
-	return CELIX_SUCCESS;
-}
-
-#if 0
-void test_debugConfiguration(configuration_pt configuration, char* pid){
-
-	if (configuration == NULL){
-		printf("[ TEST ]: Configuration(pid=%s) is NULL \n", pid);
-	} else{
-		printf("[ TEST ]: Configuration(pid=%s) OK \n", pid);
-	}
-
-}
-#endif

http://git-wip-us.apache.org/repos/asf/celix/blob/3bce889b/config_admin/config_admin_tst/example_test2/private/src/example_managed_service_impl.c
----------------------------------------------------------------------
diff --git a/config_admin/config_admin_tst/example_test2/private/src/example_managed_service_impl.c b/config_admin/config_admin_tst/example_test2/private/src/example_managed_service_impl.c
deleted file mode 100644
index 249bc66..0000000
--- a/config_admin/config_admin_tst/example_test2/private/src/example_managed_service_impl.c
+++ /dev/null
@@ -1,108 +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.
- */
-/*
- * example_managed_service_impl.c
- *
- *  \date       Aug 12, 2013
- *  \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 "example2_managed_service_impl.h"
-
-
-struct managed_service{
-
-	bundle_context_pt 			context;
-
-	service_registration_pt 	registration;
-	properties_pt 				properties;
-
-};
-
-/* ------------------------ Constructor -------------------------------------*/
-
-celix_status_t managedServiceImpl_create(bundle_context_pt context, managed_service_pt *instance){
-
-	celix_status_t status = CELIX_SUCCESS;
-
-	managed_service_pt managedService = calloc(1, sizeof(*managedService));
-	if(!managedService){
-		printf("[ ERROR ]: ManagedServiceImpl - Not initialized (ENOMEM) \n");
-		return CELIX_ENOMEM;
-	}
-
-	managedService->context = context;
-	managedService->registration = NULL;
-	managedService->properties = NULL;
-
-	*instance = managedService;
-	return status;
-}
-
-celix_status_t managedServiceImpl_destroy(managed_service_pt *instance) {
-    free(*instance);
-
-    return CELIX_SUCCESS;
-}
-
-/* -------------------- Implementation --------------------------------------*/
-
-celix_status_t managedServiceImpl_updated(managed_service_pt managedService, properties_pt properties){
-
-	if (properties == NULL){
-		printf("[ managedServiceImpl ]: updated - Received NULL properties \n");
-		managedService->properties = NULL;
-	}else{
-		printf("[ managedServiceImpl ]: updated - Received New Properties \n");
-		managedService->properties = properties_create();
-		managedService->properties = properties;
-	}
-
-	return CELIX_SUCCESS;
-}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-

http://git-wip-us.apache.org/repos/asf/celix/blob/3bce889b/config_admin/example/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/config_admin/example/CMakeLists.txt b/config_admin/example/CMakeLists.txt
deleted file mode 100644
index b0b4810..0000000
--- a/config_admin/example/CMakeLists.txt
+++ /dev/null
@@ -1,25 +0,0 @@
-
-
-SET(
-	BUNDLE_NAME 
-    "config_admin_example"
-)
-
-SET(
-	BUNDLE_SYMBOLICNAME 
-    "org.apache.celix.config_admin.example"
-)
-
-include_directories(
-	"private/include"
-	"public/include"
-    ${PROJECT_SOURCE_DIR}/utils/public/include
-    ../service/public/include
-)
-
-add_celix_bundle(config_admin_example
-	VERSION 0.0.1
-	SOURCES
-		private/src/bundle_activator
-		private/src/example
-)

http://git-wip-us.apache.org/repos/asf/celix/blob/3bce889b/config_admin/example/private/include/example.h
----------------------------------------------------------------------
diff --git a/config_admin/example/private/include/example.h b/config_admin/example/private/include/example.h
deleted file mode 100644
index 7239ea5..0000000
--- a/config_admin/example/private/include/example.h
+++ /dev/null
@@ -1,18 +0,0 @@
-#ifndef __EXAMPLE_H_
-#define __EXAMPLE_H_
-
-
-
-#include <celix_errno.h>
-#include <array_list.h>
-#include <properties.h>
-
-typedef struct example *example_pt;
-
-celix_status_t example_create(example_pt *component);
-celix_status_t example_start(example_pt component);
-celix_status_t example_stop(example_pt component);
-celix_status_t example_destroy(example_pt component);
-celix_status_t example_updated(example_pt component, properties_pt updatedProperties);
-
-#endif //__EXAMPLE_H_

http://git-wip-us.apache.org/repos/asf/celix/blob/3bce889b/config_admin/example/private/src/bundle_activator.c
----------------------------------------------------------------------
diff --git a/config_admin/example/private/src/bundle_activator.c b/config_admin/example/private/src/bundle_activator.c
deleted file mode 100644
index 3e4622f..0000000
--- a/config_admin/example/private/src/bundle_activator.c
+++ /dev/null
@@ -1,75 +0,0 @@
-#include <stdlib.h>
-#include <pthread.h>
-
-#include <constants.h>
-#include <bundle_context.h>
-#include <service_tracker.h>
-
-#include "example.h"
-#include "managed_service.h"
-
-struct activator {
-	bundle_context_pt context;
-	example_pt example;
-	managed_service_service_pt managed;
-	service_registration_pt managedServiceRegistry;
-};
-
-celix_status_t bundleActivator_create(bundle_context_pt context, void **userData) {
-	celix_status_t status = CELIX_SUCCESS;
-	struct activator *activator = calloc(1, sizeof(struct activator));
-	if (activator != NULL) {
-		(*userData) = activator;
-		activator->example = NULL;
-		example_create(&activator->example);
-		activator->managed = NULL;
-		activator->managedServiceRegistry = NULL;
-
-	} else {
-		status = CELIX_ENOMEM;
-	}
-	return status;
-}
-
-celix_status_t bundleActivator_start(void *userData, bundle_context_pt context) {
-	celix_status_t status = CELIX_SUCCESS;
-	struct activator *activator = userData;
-
-	example_start(activator->example);
-    
-    activator->managed = calloc(1, sizeof(*activator->managed));
-    properties_pt props = properties_create();
-
-	if (activator->managed != NULL && props != NULL) {
-        properties_set(props, "service.pid", "org.example.config.admin"); 
-        activator->managed->managedService = (void *)activator->example;
-        activator->managed->updated = (void *)example_updated;
-		bundleContext_registerService(context, (char *)  MANAGED_SERVICE_SERVICE_NAME, activator->managed, props, &activator->managedServiceRegistry);
-	}
-
-	return status;
-}
-
-celix_status_t bundleActivator_stop(void *userData, bundle_context_pt context) {
-	celix_status_t status = CELIX_SUCCESS;
-	struct activator *activator = userData;
-
-	if (activator->managed != NULL) {
-		serviceRegistration_unregister(activator->managedServiceRegistry);
-	}
-	example_stop(activator->example);
-
-	return status;
-}
-
-celix_status_t bundleActivator_destroy(void *userData, bundle_context_pt context) {
-	celix_status_t status = CELIX_SUCCESS;
-	struct activator *activator = userData;
-
-	example_destroy(activator->example);
-	if (activator->managed != NULL) {
-		free(activator->managed);
-	}
-
-	return status;
-}