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

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

http://git-wip-us.apache.org/repos/asf/celix/blob/a1c30887/shell/src/activator.c
----------------------------------------------------------------------
diff --git a/shell/src/activator.c b/shell/src/activator.c
new file mode 100644
index 0000000..ac298d8
--- /dev/null
+++ b/shell/src/activator.c
@@ -0,0 +1,269 @@
+/**
+ *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 13, 2010
+ *  \author    	<a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
+ *  \copyright	Apache License, Version 2.0
+ */
+#include <stdlib.h>
+#include <string.h>
+
+#include "shell_private.h"
+#include "bundle_activator.h"
+#include "std_commands.h"
+#include "service_tracker.h"
+#include "constants.h"
+
+#define NUMBER_OF_COMMANDS 10
+
+struct command {
+    celix_status_t (*exec)(void *handle, char *commandLine, FILE *out, FILE *err);
+    char *name;
+    char *description;
+    char *usage;
+    command_service_pt service;
+    service_registration_pt reg;
+    properties_pt props;
+};
+
+struct bundle_instance {
+	shell_service_pt shellService;
+	service_registration_pt registration;
+    service_tracker_pt tracker;
+
+    struct command std_commands[NUMBER_OF_COMMANDS];
+};
+
+typedef struct bundle_instance *bundle_instance_pt;
+
+celix_status_t bundleActivator_create(bundle_context_pt context_ptr, void **_pptr) {
+	celix_status_t status = CELIX_SUCCESS;
+
+    bundle_instance_pt instance_ptr = NULL;
+
+    if (!_pptr || !context_ptr) {
+        status = CELIX_ENOMEM;
+    }
+
+    if (status == CELIX_SUCCESS) {
+        instance_ptr = (bundle_instance_pt) calloc(1, sizeof(struct bundle_instance));
+        if (!instance_ptr) {
+            status = CELIX_ENOMEM;
+        }
+    }
+
+    if (status == CELIX_SUCCESS) {
+        status = shell_create(context_ptr, &instance_ptr->shellService);
+    }
+
+    if (status == CELIX_SUCCESS) {
+        instance_ptr->std_commands[0] =
+                (struct command) {
+                        .exec = psCommand_execute,
+                        .name = "lb",
+                        .description = "list bundles.",
+                        .usage = "lb [-l | -s | -u]"
+                };
+        instance_ptr->std_commands[1] =
+                (struct command) {
+                        .exec = startCommand_execute,
+                        .name = "start",
+                        .description = "start bundle(s).",
+                        .usage = "start <id> [<id> ...]"
+                };
+        instance_ptr->std_commands[2] =
+                (struct command) {
+                        .exec = stopCommand_execute,
+                        .name = "stop",
+                        .description = "stop bundle(s).",
+                        .usage = "stop <id> [<id> ...]"
+                };
+        instance_ptr->std_commands[3] =
+                (struct command) {
+                        .exec = installCommand_execute,
+                        .name = "install",
+                        .description = "install bundle(s).",
+                        .usage = "install <file> [<file> ...]"
+                };
+        instance_ptr->std_commands[4] =
+                (struct command) {
+                        .exec = uninstallCommand_execute,
+                        .name = "uninstall",
+                        .description = "uninstall bundle(s).",
+                        .usage = "uninstall <file> [<file> ...]"
+                };
+        instance_ptr->std_commands[5] =
+                (struct command) {
+                        .exec = updateCommand_execute,
+                        .name = "update",
+                        .description = "update bundle(s).",
+                        .usage = "update <id> [<URL>]"
+                };
+        instance_ptr->std_commands[6] =
+                (struct command) {
+                        .exec = helpCommand_execute,
+                        .name = "help",
+                        .description = "display available commands and description.",
+                        .usage = "help <command>]"
+                };
+        instance_ptr->std_commands[7] =
+                (struct command) {
+                        .exec = logCommand_execute,
+                        .name = "log",
+                        .description = "print log.",
+                        .usage = "log"
+                };
+        instance_ptr->std_commands[8] =
+                (struct command) {
+                        .exec = inspectCommand_execute,
+                        .name = "inspect",
+                        .description = "inspect services and components.",
+                        .usage = "inspect (service) (capability|requirement) [<id> ...]"
+                };
+        instance_ptr->std_commands[9] =
+                (struct command) { NULL, NULL, NULL, NULL, NULL, NULL, NULL }; /*marker for last element*/
+
+        unsigned int i = 0;
+        while (instance_ptr->std_commands[i].exec != NULL) {
+            instance_ptr->std_commands[i].props = properties_create();
+            if (!instance_ptr->std_commands[i].props) {
+                status = CELIX_BUNDLE_EXCEPTION;
+                break;
+            }
+
+            properties_set(instance_ptr->std_commands[i].props, OSGI_SHELL_COMMAND_NAME, instance_ptr->std_commands[i].name);
+            properties_set(instance_ptr->std_commands[i].props, OSGI_SHELL_COMMAND_USAGE, instance_ptr->std_commands[i].usage);
+            properties_set(instance_ptr->std_commands[i].props, OSGI_SHELL_COMMAND_DESCRIPTION, instance_ptr->std_commands[i].description);
+            properties_set(instance_ptr->std_commands[i].props, CELIX_FRAMEWORK_SERVICE_LANGUAGE, CELIX_FRAMEWORK_SERVICE_C_LANGUAGE);
+
+            instance_ptr->std_commands[i].service = calloc(1, sizeof(*instance_ptr->std_commands[i].service));
+            if (!instance_ptr->std_commands[i].service) {
+                status = CELIX_ENOMEM;
+                break;
+            }
+
+            instance_ptr->std_commands[i].service->handle = context_ptr;
+            instance_ptr->std_commands[i].service->executeCommand = instance_ptr->std_commands[i].exec;
+
+            i += 1;
+        }
+    }
+
+    if (status == CELIX_SUCCESS) {
+        *_pptr = instance_ptr;
+    }
+
+
+    if (status != CELIX_SUCCESS) {
+        bundleActivator_destroy(instance_ptr, context_ptr);
+    }
+
+	return status;
+}
+
+celix_status_t bundleActivator_start(void *_ptr, bundle_context_pt context_ptr) {
+	celix_status_t status = CELIX_SUCCESS;
+
+	bundle_instance_pt instance_ptr  = (bundle_instance_pt) _ptr;
+
+    if (!instance_ptr || !context_ptr) {
+        status = CELIX_ILLEGAL_ARGUMENT;
+    }
+
+    if (status == CELIX_SUCCESS) {
+        properties_pt props = properties_create();
+        properties_set(props, CELIX_FRAMEWORK_SERVICE_LANGUAGE, CELIX_FRAMEWORK_SERVICE_C_LANGUAGE);
+        status = bundleContext_registerService(context_ptr, (char *) OSGI_SHELL_SERVICE_NAME, instance_ptr->shellService, props, &instance_ptr->registration);
+    }
+
+	if (status == CELIX_SUCCESS) {
+        service_tracker_customizer_pt cust = NULL;
+        serviceTrackerCustomizer_create(instance_ptr->shellService->shell, NULL, (void *)shell_addCommand, NULL, (void *)shell_removeCommand, &cust);
+        serviceTracker_create(context_ptr, (char *)OSGI_SHELL_COMMAND_SERVICE_NAME, cust, &instance_ptr->tracker);
+        serviceTracker_open(instance_ptr->tracker);
+    }
+
+
+    if (status == CELIX_SUCCESS) {
+        for (unsigned int i = 0; instance_ptr->std_commands[i].exec != NULL; i++) {
+            status = bundleContext_registerService(context_ptr, (char *) OSGI_SHELL_COMMAND_SERVICE_NAME,
+                                                   instance_ptr->std_commands[i].service,
+                                                   instance_ptr->std_commands[i].props,
+                                                   &instance_ptr->std_commands[i].reg);
+            if (status != CELIX_SUCCESS) {
+                break;
+            }
+
+        }
+	}
+
+	return status;
+}
+
+celix_status_t bundleActivator_stop(void *_ptr, bundle_context_pt context_ptr) {
+    celix_status_t status = CELIX_SUCCESS;
+
+    bundle_instance_pt instance_ptr = (bundle_instance_pt) _ptr;
+
+    if (instance_ptr) {
+        for (unsigned int i = 0; instance_ptr->std_commands[i].exec != NULL; i++) {
+            if (instance_ptr->std_commands[i].reg != NULL) {
+                status = serviceRegistration_unregister(instance_ptr->std_commands[i].reg);
+                instance_ptr->std_commands[i].reg = NULL;
+                instance_ptr->std_commands[i].props = NULL;
+            }
+        }
+
+        if (instance_ptr->tracker != NULL) {
+            serviceTracker_close(instance_ptr->tracker);
+        }
+    } else {
+        status = CELIX_ILLEGAL_ARGUMENT;
+    }
+
+    return status;
+}
+
+celix_status_t bundleActivator_destroy(void *_ptr, bundle_context_pt __attribute__((__unused__)) context_ptr) {
+    celix_status_t status = CELIX_SUCCESS;
+
+    bundle_instance_pt instance_ptr = (bundle_instance_pt) _ptr;
+
+    if (instance_ptr) {
+        serviceRegistration_unregister(instance_ptr->registration);
+
+        for (unsigned int i = 0; instance_ptr->std_commands[i].exec != NULL; i++) {
+            free(instance_ptr->std_commands[i].service);
+        }
+
+        shell_destroy(&instance_ptr->shellService);
+
+        if (instance_ptr->tracker != NULL) {
+            serviceTracker_destroy(instance_ptr->tracker);
+        }
+
+        free(instance_ptr);
+    } else {
+        status = CELIX_ILLEGAL_ARGUMENT;
+    }
+
+    return status;
+}

http://git-wip-us.apache.org/repos/asf/celix/blob/a1c30887/shell/src/help_command.c
----------------------------------------------------------------------
diff --git a/shell/src/help_command.c b/shell/src/help_command.c
new file mode 100644
index 0000000..48615ae
--- /dev/null
+++ b/shell/src/help_command.c
@@ -0,0 +1,112 @@
+/**
+ *Licensed to the Apache Software Foundation (ASF) under one
+ *or more contributor license agreements.  See the NOTICE file
+ *distributed with this work for additional information
+ *regarding copyright ownership.  The ASF licenses this file
+ *to you under the Apache License, Version 2.0 (the
+ *"License"); you may not use this file except in compliance
+ *with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *Unless required by applicable law or agreed to in writing,
+ *software distributed under the License is distributed on an
+ *"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ *specific language governing permissions and limitations
+ *under the License.
+ */
+/*
+ * help_command.c
+ *
+ *  \date       Aug 20, 2010
+ *  \author    	<a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
+ *  \copyright	Apache License, Version 2.0
+ */
+#include <stdlib.h>
+#include <string.h>
+#include <stdint.h>
+
+#include "array_list.h"
+#include "bundle_context.h"
+#include "shell.h"
+#include "std_commands.h"
+
+celix_status_t helpCommand_execute(void *_ptr, char *line_str, FILE *out_ptr, FILE *err_ptr) {
+	celix_status_t status = CELIX_SUCCESS;
+
+	bundle_context_pt context_ptr = _ptr;
+	service_reference_pt shell_service_reference_ptr = NULL;
+	shell_service_pt shell_ptr = NULL;
+
+	if (!context_ptr || !line_str || !out_ptr || !err_ptr) {
+		status = CELIX_ILLEGAL_ARGUMENT;
+	}
+
+	if (status == CELIX_SUCCESS) {
+		status = bundleContext_getServiceReference(context_ptr, (char *) OSGI_SHELL_SERVICE_NAME, &shell_service_reference_ptr);
+	}
+
+	if (status == CELIX_SUCCESS) {
+		status = bundleContext_getService(context_ptr, shell_service_reference_ptr, (void **) &shell_ptr);
+	}
+
+	if (status == CELIX_SUCCESS) {
+        uint32_t out_len = 256;
+        char *sub = NULL;
+        char *save_ptr = NULL;
+        char out_str[out_len];
+
+        memset(out_str, 0, sizeof(out_str));
+
+        strtok_r(line_str, OSGI_SHELL_COMMAND_SEPARATOR, &save_ptr);
+        sub = strtok_r(NULL, OSGI_SHELL_COMMAND_SEPARATOR, &save_ptr);
+
+        if (sub == NULL) {
+            unsigned int i;
+            array_list_pt commands = NULL;
+
+            status = shell_ptr->getCommands(shell_ptr->shell, &commands);
+            for (i = 0; i < arrayList_size(commands); i++) {
+                char *name = arrayList_get(commands, i);
+                fprintf(out_ptr, "%s\n", name);
+            }
+            fprintf(out_ptr, "\nUse 'help <command-name>' for more information.\n");
+            arrayList_destroy(commands);
+        } else {
+            celix_status_t sub_status_desc;
+            celix_status_t sub_status_usage;
+            int i;
+            array_list_pt commands = NULL;
+            shell_ptr->getCommands(shell_ptr->shell, &commands);
+            for (i = 0; i < arrayList_size(commands); i++) {
+                char *name = arrayList_get(commands, i);
+                if (strcmp(sub, name) == 0) {
+                    char *usage_str = NULL;
+                    char *desc_str = NULL;
+
+                    sub_status_desc = shell_ptr->getCommandDescription(shell_ptr->shell, name, &desc_str);
+                    sub_status_usage = shell_ptr->getCommandUsage(shell_ptr->shell, name, &usage_str);
+
+                    if (sub_status_usage == CELIX_SUCCESS && sub_status_desc == CELIX_SUCCESS) {
+                        fprintf(out_ptr, "Command     : %s\n", name);
+                        fprintf(out_ptr, "Usage       : %s\n", usage_str == NULL ? "" : usage_str);
+                        fprintf(out_ptr, "Description : %s\n", desc_str == NULL ? "" : desc_str);
+                    } else {
+                        fprintf(err_ptr, "Error retreiving help info for command '%s'\n", sub);
+                    }
+
+                    if (sub_status_desc != CELIX_SUCCESS && status == CELIX_SUCCESS) {
+                        status = sub_status_desc;
+                    }
+                    if (sub_status_usage != CELIX_SUCCESS && status == CELIX_SUCCESS) {
+                        status = sub_status_usage;
+                    }
+                }
+            }
+            arrayList_destroy(commands);
+        }
+    }
+
+    return status;
+}

http://git-wip-us.apache.org/repos/asf/celix/blob/a1c30887/shell/src/inspect_command.c
----------------------------------------------------------------------
diff --git a/shell/src/inspect_command.c b/shell/src/inspect_command.c
new file mode 100644
index 0000000..cb93e9c
--- /dev/null
+++ b/shell/src/inspect_command.c
@@ -0,0 +1,277 @@
+/**
+ *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.
+ */
+/*
+ * inspect_command.c
+ *
+ *  \date       Oct 13, 2011
+ *  \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 "array_list.h"
+#include "bundle_context.h"
+
+#include "std_commands.h"
+
+#define SERVICE_TYPE "service"
+#define CAPABILITY "capability"
+#define REQUIREMENT "requirement"
+
+celix_status_t inspectCommand_printExportedServices(bundle_context_pt context, array_list_pt ids, FILE *outStream, FILE *errStream);
+celix_status_t inspectCommand_printImportedServices(bundle_context_pt context, array_list_pt ids, FILE *outStream, FILE *errStream);
+
+celix_status_t inspectCommand_execute(void *handle, char * commandline, FILE *outStream, FILE *errStream) {
+	celix_status_t status = CELIX_SUCCESS;
+
+	bundle_context_pt context = handle;
+
+	char *token;
+	strtok_r(commandline, " ", &token);
+	char *type = strtok_r(NULL, " ", &token);
+	if (type != NULL) {
+		char *direction = strtok_r(NULL, " ", &token);
+		if (direction != NULL) {
+			array_list_pt ids = NULL;
+			char *id = strtok_r(NULL, " ", &token);
+
+			arrayList_create(&ids);
+			while (id != NULL) {
+				arrayList_add(ids, id);
+				id = strtok_r(NULL, " ", &token);
+			}
+
+			if (strcmp(type, SERVICE_TYPE) == 0) {
+				if (strcmp(direction, CAPABILITY) == 0) {
+					status = inspectCommand_printExportedServices(context, ids, outStream, errStream);
+					if (status != CELIX_SUCCESS) {
+						fprintf(errStream, "INSPECT: Error\n");
+					}
+				} else if (strcmp(direction, REQUIREMENT) == 0) {
+                    status = inspectCommand_printImportedServices(context, ids, outStream, errStream);
+                    if (status != CELIX_SUCCESS) {
+						fprintf(errStream, "INSPECT: Error\n");
+                    }
+				} else {
+					fprintf(errStream, "INSPECT: Invalid argument\n");
+				}
+			} else {
+				fprintf(errStream, "INSPECT: Invalid argument\n");
+			}
+			arrayList_destroy(ids);
+		} else {
+			fprintf(errStream, "INSPECT: Too few arguments\n");
+		}
+	} else {
+		fprintf(errStream, "INSPECT: Too few arguments\n");
+	}
+	return status;
+}
+
+celix_status_t inspectCommand_printExportedServices(bundle_context_pt context, array_list_pt ids, FILE *outStream, FILE *errStream) {
+	celix_status_t status = CELIX_SUCCESS;
+	array_list_pt bundles = NULL;
+
+	if (arrayList_isEmpty(ids)) {
+		status = bundleContext_getBundles(context, &bundles);
+	} else {
+		unsigned int i;
+
+		arrayList_create(&bundles);
+		for (i = 0; i < arrayList_size(ids); i++) {
+			char *idStr = (char *) arrayList_get(ids, i);
+			long id = atol(idStr);
+			bundle_pt b = NULL;
+			celix_status_t st = bundleContext_getBundleById(context, id, &b);
+			if (st == CELIX_SUCCESS) {
+				arrayList_add(bundles, b);
+			} else {
+				fprintf(outStream, "INSPECT: Invalid bundle ID: %ld\n", id);
+			}
+		}
+	}
+
+	if (status == CELIX_SUCCESS) {
+		unsigned int i = 0;
+		for (i = 0; i < arrayList_size(bundles); i++) {
+			bundle_pt bundle = (bundle_pt) arrayList_get(bundles, i);
+
+			if (i > 0) {
+				fprintf(outStream, "\n");
+			}
+
+			if (bundle != NULL) {
+				array_list_pt refs = NULL;
+
+				if (bundle_getRegisteredServices(bundle, &refs) == CELIX_SUCCESS) {
+					module_pt module = NULL;
+					const char * name = NULL;
+					status = bundle_getCurrentModule(bundle, &module);
+					if (status == CELIX_SUCCESS) {
+						status = module_getSymbolicName(module, &name);
+						if (status == CELIX_SUCCESS) {
+							fprintf(outStream, "%s provides services:\n", name);
+							fprintf(outStream, "==============\n");
+
+							if (refs == NULL || arrayList_size(refs) == 0) {
+								fprintf(outStream, "Nothing\n");
+							} else {
+								unsigned int j = 0;
+								for (j = 0; j < arrayList_size(refs); j++) {
+									service_reference_pt ref = (service_reference_pt) arrayList_get(refs, j);
+									unsigned int size = 0;
+									char **keys;
+
+									serviceReference_getPropertyKeys(ref, &keys, &size);
+									for (int k = 0; k < size; k++) {
+									    char *key = keys[k];
+									    const char *value = NULL;
+									    serviceReference_getProperty(ref, key, &value);
+
+										fprintf(outStream, "%s = %s\n", key, value);
+									}
+
+									free(keys);
+
+//									objectClass = properties_get(props, (char *) OSGI_FRAMEWORK_OBJECTCLASS);
+//									sprintf(line, "ObjectClass = %s\n", objectClass);
+									if ((j + 1) < arrayList_size(refs)) {
+										fprintf(outStream, "----\n");
+									}
+								}
+							}
+						}
+					}
+				}
+
+				if(refs!=NULL){
+					arrayList_destroy(refs);
+				}
+			}
+		}
+	}
+
+	if (bundles != NULL) {
+	    arrayList_destroy(bundles);
+	}
+
+	return status;
+}
+
+celix_status_t inspectCommand_printImportedServices(bundle_context_pt context, array_list_pt ids, FILE *outStream, FILE *errStream) {
+    celix_status_t status = CELIX_SUCCESS;
+    array_list_pt bundles = NULL;
+
+    if (arrayList_isEmpty(ids)) {
+        status = bundleContext_getBundles(context, &bundles);
+    } else {
+        unsigned int i;
+
+        arrayList_create(&bundles);
+        for (i = 0; i < arrayList_size(ids); i++) {
+            char *idStr = (char *) arrayList_get(ids, i);
+            long id = atol(idStr);
+            bundle_pt b = NULL;
+            celix_status_t st = bundleContext_getBundleById(context, id, &b);
+            if (st == CELIX_SUCCESS) {
+                arrayList_add(bundles, b);
+            } else {
+				fprintf(outStream, "INSPECT: Invalid bundle ID: %ld\n", id);
+            }
+        }
+    }
+
+    if (status == CELIX_SUCCESS) {
+        unsigned int i = 0;
+        for (i = 0; i < arrayList_size(bundles); i++) {
+            bundle_pt bundle = (bundle_pt) arrayList_get(bundles, i);
+
+            if (i > 0) {
+				fprintf(outStream, "\n");
+            }
+
+            if (bundle != NULL) {
+                array_list_pt refs = NULL;
+
+                if (bundle_getServicesInUse(bundle, &refs) == CELIX_SUCCESS) {
+                    module_pt module = NULL;
+                    const char * name = NULL;
+                    status = bundle_getCurrentModule(bundle, &module);
+                    if (status == CELIX_SUCCESS) {
+                        status = module_getSymbolicName(module, &name);
+                        if (status == CELIX_SUCCESS) {
+							fprintf(outStream, "%s requires services:\n", name);
+							fprintf(outStream, "==============\n");
+
+                            if (refs == NULL || arrayList_size(refs) == 0) {
+								fprintf(outStream, "Nothing\n");
+                            } else {
+                                unsigned int j = 0;
+                                for (j = 0; j < arrayList_size(refs); j++) {
+                                    service_reference_pt ref = (service_reference_pt) arrayList_get(refs, j);
+                                    bundle_pt usedBundle = NULL;
+                                    module_pt usedModule = NULL;
+                                    const char *usedSymbolicName = NULL;
+                                    long usedBundleId;
+
+                                    serviceReference_getBundle(ref, &usedBundle);
+                                    bundle_getBundleId(usedBundle, &usedBundleId);
+                                    bundle_getCurrentModule(usedBundle, &usedModule);
+                                    module_getSymbolicName(usedModule, &usedSymbolicName);
+
+									fprintf(outStream, "%s [%ld]\n", usedSymbolicName, usedBundleId);
+
+                                    unsigned int size = 0;
+                                    char **keys;
+
+                                    serviceReference_getPropertyKeys(ref, &keys, &size);
+                                    for (int k = 0; k < size; k++) {
+                                        char *key = keys[k];
+                                        const char *value = NULL;
+                                        serviceReference_getProperty(ref, key, &value);
+
+										fprintf(outStream, "%s = %s\n", key, value);
+                                    }
+                                    free(keys);
+
+//                                  objectClass = properties_get(props, (char *) OSGI_FRAMEWORK_OBJECTCLASS);
+//                                  sprintf(line, "ObjectClass = %s\n", objectClass);
+                                    if ((j + 1) < arrayList_size(refs)) {
+										fprintf(outStream, "----\n");
+                                    }
+                                }
+                            }
+                        }
+                    }
+                }
+
+                if(refs!=NULL){
+                	arrayList_destroy(refs);
+                }
+            }
+        }
+    }
+
+    arrayList_destroy(bundles);
+
+
+    return status;
+}

http://git-wip-us.apache.org/repos/asf/celix/blob/a1c30887/shell/src/install_command.c
----------------------------------------------------------------------
diff --git a/shell/src/install_command.c b/shell/src/install_command.c
new file mode 100644
index 0000000..067ba2b
--- /dev/null
+++ b/shell/src/install_command.c
@@ -0,0 +1,76 @@
+/**
+ *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.
+ */
+/*
+ * install_command.c
+ *
+ *  \date       Apr 4, 2011
+ *  \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 "array_list.h"
+#include "bundle_context.h"
+
+void installCommand_execute(void *handle, char * line, FILE *outStream, FILE *errStream) {
+	bundle_context_pt context = handle;
+
+	char delims[] = " ";
+	char * sub = NULL;
+	char *save_ptr = NULL;
+	char info[256];
+
+	// ignore the command
+	sub = strtok_r(line, delims, &save_ptr);
+	sub = strtok_r(NULL, delims, &save_ptr);
+	
+	if (sub == NULL) {
+		fprintf(errStream, "Incorrect number of arguments.\n");
+	} else {
+		info[0] = '\0';
+		while (sub != NULL) {
+			bundle_pt bundle = NULL;
+			bundleContext_installBundle(context, sub, &bundle);
+			if (bundle != NULL) {
+				long id;
+				bundle_archive_pt archive = NULL;
+				char bundleId[sizeof(id) + 1];
+
+				if (strlen(info) > 0) {
+					strcat(info, ", ");
+				}
+				bundle_getArchive(bundle, &archive);
+				bundleArchive_getId(archive, &id);
+				sprintf(bundleId, "%ld", id);
+				strcat(info, bundleId);
+			}
+			sub = strtok_r(NULL, delims, &save_ptr);
+		}
+		if (strchr(info, ',') != NULL) {
+			fprintf(outStream, "Bundle IDs: ");
+			fprintf(outStream, "%s", info);
+			fprintf(outStream, "\n");
+		} else if (strlen(info) > 0) {
+			fprintf(outStream, "Bundle ID: ");
+			fprintf(outStream, "%s", info);
+			fprintf(outStream, "\n");
+		}
+	}
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/celix/blob/a1c30887/shell/src/lb_command.c
----------------------------------------------------------------------
diff --git a/shell/src/lb_command.c b/shell/src/lb_command.c
new file mode 100644
index 0000000..d0504f6
--- /dev/null
+++ b/shell/src/lb_command.c
@@ -0,0 +1,205 @@
+/**
+ *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.
+ */
+/*
+ * std_shell_commands.c
+ *
+ *  \date       March 27, 2014
+ *  \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 "array_list.h"
+#include "bundle_context.h"
+#include "std_commands.h"
+#include "shell_constants.h"
+
+static const char * const HEAD_COLOR = "\033[4m"; //underline
+static const char * const EVEN_COLOR = "\033[1m"; //bold
+static const char * const ODD_COLOR = "\033[3m";  //italic
+static const char * const END_COLOR = "\033[0m";
+
+static char * psCommand_stateString(bundle_state_e state); 
+
+celix_status_t psCommand_execute(void *_ptr, char *command_line_str, FILE *out_ptr, FILE *err_ptr) {
+    celix_status_t status = CELIX_SUCCESS;
+    bundle_context_t* ctx = _ptr;
+
+    const char* config = NULL;
+    bundleContext_getPropertyWithDefault(ctx, SHELL_USE_ANSI_COLORS, SHELL_USE_ANSI_COLORS_DEFAULT_VALUE, &config);
+    bool useColors = config != NULL && strncmp("true", config, 5) == 0;
+
+    bundle_context_pt context_ptr = _ptr;
+    array_list_pt bundles_ptr     = NULL;
+
+    bool show_location        = false;
+    bool show_symbolic_name   = false;
+    bool show_update_location = false;
+    char *message_str         = "Name";
+
+    if (!context_ptr || !command_line_str || !out_ptr || !err_ptr) {
+        status = CELIX_ILLEGAL_ARGUMENT;
+    }
+
+    if (status == CELIX_SUCCESS) {
+        status = bundleContext_getBundles(context_ptr, &bundles_ptr);
+    }
+
+    if (status == CELIX_SUCCESS) {
+        char *sub_str = NULL;
+        char *save_ptr = NULL;
+
+        strtok_r(command_line_str, OSGI_SHELL_COMMAND_SEPARATOR, &save_ptr);
+        sub_str = strtok_r(NULL, OSGI_SHELL_COMMAND_SEPARATOR, &save_ptr);
+        while (sub_str != NULL) {
+            if (strcmp(sub_str, "-l") == 0) {
+                show_location = true;
+                message_str = "Location";
+            } else if (strcmp(sub_str, "-s") == 0) {
+                show_symbolic_name = true;
+                message_str = "Symbolic name";
+            } else if (strcmp(sub_str, "-u") == 0) {
+                show_update_location = true;
+                message_str = "Update location";
+            }
+            sub_str = strtok_r(NULL, OSGI_SHELL_COMMAND_SEPARATOR, &save_ptr);
+        }
+
+	const char* startColor = "";
+	const char* endColor = "";
+	if (useColors) {
+		startColor = HEAD_COLOR;
+		endColor = END_COLOR;
+	} 
+        fprintf(out_ptr, "%s  %-5s %-12s %s%s\n", startColor, "ID", "State", message_str, endColor);
+
+        unsigned int size = arrayList_size(bundles_ptr);
+
+        bundle_pt bundles_array_ptr[size];
+
+        for (unsigned int i = 0; i < size; i++) {
+            bundles_array_ptr[i] = arrayList_get(bundles_ptr, i);
+        }
+
+        for (unsigned int i = 0; i < size - 1; i++) {
+            for (unsigned int j = i + 1; j < size; j++) {
+                bundle_pt first_ptr = bundles_array_ptr[i];
+                bundle_pt second_ptr = bundles_array_ptr[j];
+
+                bundle_archive_pt first_archive_ptr = NULL;
+                bundle_archive_pt second_archive_ptr = NULL;
+
+                long first_id;
+                long second_id;
+
+                bundle_getArchive(first_ptr, &first_archive_ptr);
+                bundle_getArchive(second_ptr, &second_archive_ptr);
+
+                bundleArchive_getId(first_archive_ptr, &first_id);
+                bundleArchive_getId(second_archive_ptr, &second_id);
+
+                if (first_id > second_id) {
+                    bundle_pt temp_ptr = bundles_array_ptr[i];
+                    bundles_array_ptr[i] = bundles_array_ptr[j];
+                    bundles_array_ptr[j] = temp_ptr;
+                }
+            }
+        }
+
+        for (unsigned int i = 0; i < size; i++) {
+            celix_status_t sub_status;
+
+            bundle_pt bundle_ptr = bundles_array_ptr[i];
+
+            bundle_archive_pt archive_ptr = NULL;
+            long id = 0;
+            bundle_state_e state = OSGI_FRAMEWORK_BUNDLE_UNKNOWN;
+            const char *state_str = NULL;
+            module_pt module_ptr = NULL;
+            const char *name_str = NULL;
+
+            sub_status = bundle_getArchive(bundle_ptr, &archive_ptr);
+            if (sub_status == CELIX_SUCCESS) {
+                sub_status = bundleArchive_getId(archive_ptr, &id);
+            }
+
+            if (sub_status == CELIX_SUCCESS) {
+                sub_status = bundle_getState(bundle_ptr, &state);
+            }
+
+            if (sub_status == CELIX_SUCCESS) {
+                state_str = psCommand_stateString(state);
+
+                sub_status = bundle_getCurrentModule(bundle_ptr, &module_ptr);
+            }
+
+            if (sub_status == CELIX_SUCCESS) {
+                sub_status = module_getSymbolicName(module_ptr, &name_str);
+            }
+
+            if (sub_status == CELIX_SUCCESS) {
+                if (show_location) {
+                    sub_status = bundleArchive_getLocation(archive_ptr, &name_str);
+                } else if (show_symbolic_name) {
+                    // do nothing
+                } else if (show_update_location) {
+                    sub_status = bundleArchive_getLocation(archive_ptr, &name_str);
+                }
+            }
+
+            if (sub_status == CELIX_SUCCESS) {
+		startColor = "";
+		endColor = "";
+                if (useColors) {
+                    startColor = i % 2 == 0 ? EVEN_COLOR : ODD_COLOR;
+                    endColor = END_COLOR;
+                } 
+		fprintf(out_ptr, "%s  %-5ld %-12s %s%s\n", startColor, id, state_str, name_str, endColor);
+
+            }
+
+            if (sub_status != CELIX_SUCCESS) {
+                status = sub_status;
+                break;
+            }
+        }
+
+        arrayList_destroy(bundles_ptr);
+    }
+
+    return status;
+}
+
+static char * psCommand_stateString(bundle_state_e state) {
+    switch (state) {
+        case OSGI_FRAMEWORK_BUNDLE_ACTIVE:
+            return "Active      ";
+        case OSGI_FRAMEWORK_BUNDLE_INSTALLED:
+            return "Installed   ";
+        case OSGI_FRAMEWORK_BUNDLE_RESOLVED:
+            return "Resolved    ";
+        case OSGI_FRAMEWORK_BUNDLE_STARTING:
+            return "Starting    ";
+        case OSGI_FRAMEWORK_BUNDLE_STOPPING:
+            return "Stopping    ";
+        default:
+            return "Unknown     ";
+    }
+}

http://git-wip-us.apache.org/repos/asf/celix/blob/a1c30887/shell/src/log_command.c
----------------------------------------------------------------------
diff --git a/shell/src/log_command.c b/shell/src/log_command.c
new file mode 100644
index 0000000..8b0244a
--- /dev/null
+++ b/shell/src/log_command.c
@@ -0,0 +1,94 @@
+/**
+ *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.
+ */
+/*
+ * log_command.c
+ *
+ *  \date       Jun 26, 2011
+ *  \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 "log_reader_service.h"
+#include "linked_list_iterator.h"
+
+celix_status_t logCommand_levelAsString(bundle_context_pt context, log_level_t level, char **string);
+
+void logCommand_execute(bundle_context_pt context, char *line, FILE *outStream, FILE *errStream) {
+    celix_status_t status;
+    service_reference_pt readerService = NULL;
+
+    status = bundleContext_getServiceReference(context, (char *) OSGI_LOGSERVICE_READER_SERVICE_NAME, &readerService);
+    if (status != CELIX_SUCCESS || readerService != NULL) {
+        linked_list_pt list = NULL;
+        linked_list_iterator_pt iter = NULL;
+        log_reader_service_pt reader = NULL;
+
+
+		bundleContext_getService(context, readerService, (void **) &reader);
+		reader->getLog(reader->reader, &list);
+		iter = linkedListIterator_create(list, 0);
+		while (linkedListIterator_hasNext(iter)) {
+			log_entry_pt entry = linkedListIterator_next(iter);
+			char time[20];
+			char *level = NULL;
+			char errorString[256];
+
+            strftime(time, 20, "%Y-%m-%d %H:%M:%S", localtime(&entry->time));
+            logCommand_levelAsString(context, entry->level, &level);
+
+			if (entry->errorCode > 0) {
+				celix_strerror(entry->errorCode, errorString, 256);
+				fprintf(outStream, "%s - Bundle: %s - %s - %d %s\n", time, entry->bundleSymbolicName, entry->message, entry->errorCode, errorString);
+			} else {
+				fprintf(outStream, "%s - Bundle: %s - %s\n", time, entry->bundleSymbolicName, entry->message);
+			}
+		}
+		linkedListIterator_destroy(iter);
+		linkedList_destroy(list);
+		bool result = true;
+		bundleContext_ungetService(context, readerService, &result);
+        bundleContext_ungetServiceReference(context, readerService);
+    } else {
+		fprintf(outStream, "No log reader available\n");
+    }
+}
+
+celix_status_t logCommand_levelAsString(bundle_context_pt context, log_level_t level, char **string) {
+	switch (level) {
+	case OSGI_LOGSERVICE_ERROR:
+		*string = "ERROR";
+		break;
+	case OSGI_LOGSERVICE_WARNING:
+		*string = "WARNING";
+		break;
+	case OSGI_LOGSERVICE_INFO:
+		*string = "INFO";
+		break;
+	case OSGI_LOGSERVICE_DEBUG:
+	default:
+		*string = "DEBUG";
+		break;
+	}
+
+	return CELIX_SUCCESS;
+}

http://git-wip-us.apache.org/repos/asf/celix/blob/a1c30887/shell/src/shell.c
----------------------------------------------------------------------
diff --git a/shell/src/shell.c b/shell/src/shell.c
new file mode 100644
index 0000000..ac8603e
--- /dev/null
+++ b/shell/src/shell.c
@@ -0,0 +1,305 @@
+/**
+ *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.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 <stdlib.h>
+#include <string.h>
+#include <log_helper.h>
+
+#include "celix_errno.h"
+
+#include "shell_private.h"
+
+
+#include "utils.h"
+
+celix_status_t shell_getCommands(shell_pt shell_ptr, array_list_pt *commands_ptr);
+celix_status_t shell_getCommandUsage(shell_pt shell_ptr, char *command_name_str, char **usage_pstr);
+celix_status_t shell_getCommandDescription(shell_pt shell_ptr, char *command_name_str, char **command_description_pstr);
+
+celix_status_t shell_create(bundle_context_pt context_ptr, shell_service_pt *shell_service_ptr) {
+	celix_status_t status = CELIX_SUCCESS;
+
+	if (!context_ptr || !shell_service_ptr) {
+		status = CELIX_ILLEGAL_ARGUMENT;
+	}
+
+	if (status == CELIX_SUCCESS) {
+		*shell_service_ptr =  calloc(1, sizeof(**shell_service_ptr));
+		if (!*shell_service_ptr) {
+			status = CELIX_ENOMEM;
+		}
+	}
+
+	if (status == CELIX_SUCCESS) {
+		(*shell_service_ptr)->shell = calloc(1, sizeof(*(*shell_service_ptr)->shell));
+		if (!(*shell_service_ptr)->shell) {
+			status = CELIX_ENOMEM;
+		}
+	}
+
+	if (status == CELIX_SUCCESS) {
+		(*shell_service_ptr)->shell->bundle_context_ptr = context_ptr;
+		(*shell_service_ptr)->shell->command_name_map_ptr = hashMap_create(utils_stringHash, NULL, utils_stringEquals, NULL);
+		(*shell_service_ptr)->shell->command_reference_map_ptr = hashMap_create(NULL, NULL, NULL, NULL);
+
+		(*shell_service_ptr)->getCommands = shell_getCommands;
+		(*shell_service_ptr)->getCommandDescription = shell_getCommandDescription;
+		(*shell_service_ptr)->getCommandUsage = shell_getCommandUsage;
+		(*shell_service_ptr)->getCommandReference = shell_getCommandReference;
+		(*shell_service_ptr)->executeCommand = shell_executeCommand;
+
+        status = logHelper_create(context_ptr, &(*shell_service_ptr)->shell->logHelper);
+	}
+
+	if (status != CELIX_SUCCESS) {
+		shell_destroy(shell_service_ptr);
+	}
+
+	return status;
+}
+
+celix_status_t shell_destroy(shell_service_pt *shell_service_ptr) {
+	celix_status_t status = CELIX_SUCCESS;
+
+	if (!shell_service_ptr || !*shell_service_ptr) {
+		status = CELIX_ILLEGAL_ARGUMENT;
+	}
+
+	if (status == CELIX_SUCCESS) {
+		if ((*shell_service_ptr)->shell) {
+			if ((*shell_service_ptr)->shell->command_name_map_ptr) {
+				hashMap_destroy((*shell_service_ptr)->shell->command_name_map_ptr, false, false);
+			}
+			if ((*shell_service_ptr)->shell->command_reference_map_ptr) {
+				hashMap_destroy((*shell_service_ptr)->shell->command_reference_map_ptr, false, false);
+			}
+			if ((*shell_service_ptr)->shell->logHelper) {
+				logHelper_destroy(&((*shell_service_ptr)->shell->logHelper));
+			}
+			free((*shell_service_ptr)->shell);
+			(*shell_service_ptr)->shell = NULL;
+		}
+		free(*shell_service_ptr);
+		*shell_service_ptr = NULL;
+	}
+
+	return status;
+}
+
+celix_status_t shell_addCommand(shell_pt shell_ptr, service_reference_pt reference_ptr, void *svc) {
+    celix_status_t status = CELIX_SUCCESS;
+    command_service_pt command_ptr = NULL;
+    const char *name_str = NULL;
+
+    if (!shell_ptr || !reference_ptr) {
+        return CELIX_ILLEGAL_ARGUMENT;
+    }
+
+    if (status == CELIX_SUCCESS) {
+        command_ptr = svc;
+    }
+
+    if (status == CELIX_SUCCESS) {
+        status = serviceReference_getProperty(reference_ptr, "command.name", &name_str);
+        if (!name_str) {
+            logHelper_log(shell_ptr->logHelper, OSGI_LOGSERVICE_ERROR, "Command service must contain a 'command.name' property!");
+            status = CELIX_BUNDLE_EXCEPTION;
+        }
+    }
+
+    if (status == CELIX_SUCCESS) {
+        hashMap_put(shell_ptr->command_name_map_ptr, (char *)name_str, command_ptr);
+        hashMap_put(shell_ptr->command_reference_map_ptr, reference_ptr, command_ptr);
+    }
+
+    if (status != CELIX_SUCCESS) {
+        shell_removeCommand(shell_ptr, reference_ptr, svc);
+        char err[32];
+        celix_strerror(status, err, 32);
+        logHelper_log(shell_ptr->logHelper, OSGI_LOGSERVICE_ERROR, "Could not add command, got error %s\n", err);
+    }
+
+    return status;
+}
+
+celix_status_t shell_removeCommand(shell_pt shell_ptr, service_reference_pt reference_ptr, void *svc) {
+    celix_status_t status = CELIX_SUCCESS;
+
+    command_service_pt command_ptr = NULL;
+    const char *name_str = NULL;
+
+    if (!shell_ptr || !reference_ptr) {
+        status = CELIX_ILLEGAL_ARGUMENT;
+    }
+
+    if (status == CELIX_SUCCESS) {
+        command_ptr = hashMap_remove(shell_ptr->command_reference_map_ptr, reference_ptr);
+        if (!command_ptr) {
+            status = CELIX_ILLEGAL_ARGUMENT;
+        }
+    }
+
+    if (status == CELIX_SUCCESS) {
+        status = serviceReference_getProperty(reference_ptr, "command.name", &name_str);
+        if (!name_str) {
+            status = CELIX_BUNDLE_EXCEPTION;
+        }
+    }
+
+    if (status == CELIX_SUCCESS) {
+        hashMap_remove(shell_ptr->command_name_map_ptr, (char *)name_str);
+    }
+
+    return status;
+}
+
+celix_status_t shell_getCommands(shell_pt shell_ptr, array_list_pt *commands_ptr) {
+	celix_status_t status = CELIX_SUCCESS;
+
+	hash_map_iterator_pt iter = NULL;
+
+	if (!shell_ptr || !commands_ptr) {
+		status = CELIX_ILLEGAL_ARGUMENT;
+	}
+
+	if (status == CELIX_SUCCESS) {
+		iter = hashMapIterator_create(shell_ptr->command_name_map_ptr);
+		if (!iter) {
+			status = CELIX_BUNDLE_EXCEPTION;
+		}
+	}
+
+	if (status == CELIX_SUCCESS) {
+		arrayList_create(commands_ptr);
+		while (hashMapIterator_hasNext(iter)) {
+			char *name_str = hashMapIterator_nextKey(iter);
+			arrayList_add(*commands_ptr, name_str);
+		}
+		hashMapIterator_destroy(iter);
+	}
+
+	return status;
+}
+
+
+celix_status_t shell_getCommandUsage(shell_pt shell_ptr, char *command_name_str, char **usage_pstr) {
+	celix_status_t status = CELIX_SUCCESS;
+
+	service_reference_pt reference = NULL;
+
+	if (!shell_ptr || !command_name_str || !usage_pstr) {
+		status = CELIX_ILLEGAL_ARGUMENT;
+	}
+
+	if (status == CELIX_SUCCESS) {
+		status = shell_getCommandReference(shell_ptr, command_name_str, &reference);
+		if (!reference) {
+			status = CELIX_BUNDLE_EXCEPTION;
+		}
+	}
+
+	if (status == CELIX_SUCCESS) {
+		status = serviceReference_getProperty(reference, "command.usage", (const char**)usage_pstr);
+	}
+
+	return status;
+}
+
+celix_status_t shell_getCommandDescription(shell_pt shell_ptr, char *command_name_str, char **command_description_pstr) {
+	celix_status_t status = CELIX_SUCCESS;
+
+	service_reference_pt reference = NULL;
+
+	if (!shell_ptr || !command_name_str || !command_description_pstr) {
+		status = CELIX_ILLEGAL_ARGUMENT;
+	}
+
+	if (status == CELIX_SUCCESS) {
+		status = shell_getCommandReference(shell_ptr, command_name_str, &reference);
+		if (!reference) {
+			status = CELIX_BUNDLE_EXCEPTION;
+		}
+	}
+
+	if (status == CELIX_SUCCESS) {
+		serviceReference_getProperty(reference, "command.description", (const char**)command_description_pstr);
+	}
+
+	return status;
+}
+
+celix_status_t shell_getCommandReference(shell_pt shell_ptr, char *command_name_str, service_reference_pt *command_reference_ptr) {
+	celix_status_t status = CELIX_SUCCESS;
+
+	if (!shell_ptr || !command_name_str || !command_reference_ptr) {
+		status = CELIX_ILLEGAL_ARGUMENT;
+	}
+
+	if (status == CELIX_SUCCESS) {
+		*command_reference_ptr = NULL;
+		hash_map_iterator_pt iter = hashMapIterator_create(shell_ptr->command_reference_map_ptr);
+		while (hashMapIterator_hasNext(iter)) {
+			hash_map_entry_pt entry = hashMapIterator_nextEntry(iter);
+			service_reference_pt reference = hashMapEntry_getKey(entry);
+			const char *name_str = NULL;
+			serviceReference_getProperty(reference, "command.name", &name_str);
+			if (strcmp(name_str, command_name_str) == 0) {
+				*command_reference_ptr = (service_reference_pt) hashMapEntry_getKey(entry);
+				break;
+			}
+		}
+		hashMapIterator_destroy(iter);
+	}
+
+	return status;
+}
+
+celix_status_t shell_executeCommand(shell_pt shell_ptr, char *command_line_str, FILE *out, FILE *err) {
+	celix_status_t status = CELIX_SUCCESS;
+
+	command_service_pt command_ptr = NULL;
+
+	if (!shell_ptr || !command_line_str || !out || !err) {
+		status = CELIX_ILLEGAL_ARGUMENT;
+	}
+
+	if (status == CELIX_SUCCESS) {
+		size_t pos = strcspn(command_line_str, " ");
+
+		char *command_name_str = (pos != strlen(command_line_str)) ? strndup(command_line_str, pos) : strdup(command_line_str);
+		command_ptr = hashMap_get(shell_ptr->command_name_map_ptr, command_name_str);
+		free(command_name_str);
+		if (!command_ptr) {
+			fprintf(err, "No such command\n");
+			status = CELIX_BUNDLE_EXCEPTION;
+		}
+	}
+
+	if (status == CELIX_SUCCESS) {
+		status = command_ptr->executeCommand(command_ptr->handle, command_line_str, out, err);
+	}
+
+	return status;
+}

http://git-wip-us.apache.org/repos/asf/celix/blob/a1c30887/shell/src/shell_private.h
----------------------------------------------------------------------
diff --git a/shell/src/shell_private.h b/shell/src/shell_private.h
new file mode 100644
index 0000000..7270fa2
--- /dev/null
+++ b/shell/src/shell_private.h
@@ -0,0 +1,51 @@
+/**
+ *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_private.h
+ *
+ *  \date       Aug 13, 2010
+ *  \author    	<a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
+ *  \copyright	Apache License, Version 2.0
+ */
+
+#ifndef SHELL_PRIVATE_H_
+#define SHELL_PRIVATE_H_
+
+#include "bundle_context.h"
+#include "shell.h"
+#include "hash_map.h"
+#include "command.h"
+#include "log_helper.h"
+
+struct shell {
+	bundle_context_pt bundle_context_ptr;
+	hash_map_pt command_reference_map_ptr;
+	hash_map_pt command_name_map_ptr;
+	log_helper_pt logHelper;
+};
+
+celix_status_t shell_create(bundle_context_pt context_ptr, shell_service_pt *shell_service_ptr);
+celix_status_t shell_destroy(shell_service_pt *shell_service_ptr);
+celix_status_t shell_addCommand(shell_pt shell_ptr, service_reference_pt reference_ptr, void *svc);
+celix_status_t shell_removeCommand(shell_pt shell_ptr, service_reference_pt reference_ptr, void *svc);
+
+celix_status_t shell_getCommandReference(shell_pt shell_ptr, char *command_name_str, service_reference_pt *command_reference_ptr);
+celix_status_t shell_executeCommand(shell_pt shell_ptr, char *command_line_str, FILE *out, FILE *err);
+
+#endif /* SHELL_PRIVATE_H_ */

http://git-wip-us.apache.org/repos/asf/celix/blob/a1c30887/shell/src/start_command.c
----------------------------------------------------------------------
diff --git a/shell/src/start_command.c b/shell/src/start_command.c
new file mode 100644
index 0000000..f43699a
--- /dev/null
+++ b/shell/src/start_command.c
@@ -0,0 +1,84 @@
+/**
+ *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.
+ */
+/*
+ * start_command.c
+ *
+ *  \date       Aug 20, 2010
+ *  \author    	<a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
+ *  \copyright	Apache License, Version 2.0
+ */
+#include <stdlib.h>
+#include <string.h>
+#include <stdio.h>
+
+#include "std_commands.h"
+#include "bundle_context.h"
+
+celix_status_t startCommand_execute(void *_ptr, char *command_line_str, FILE *out_ptr, FILE *err_ptr) {
+    celix_status_t status = CELIX_SUCCESS;
+
+    bundle_context_pt context_ptr = _ptr;
+
+    if (!context_ptr || !command_line_str || !out_ptr || !err_ptr) {
+        status = CELIX_ILLEGAL_ARGUMENT;
+    }
+
+    if (status == CELIX_SUCCESS) {
+        char *sub_str = NULL;
+        char *save_ptr = NULL;
+
+        strtok_r(command_line_str, OSGI_SHELL_COMMAND_SEPARATOR, &save_ptr);
+        sub_str = strtok_r(NULL, OSGI_SHELL_COMMAND_SEPARATOR, &save_ptr);
+
+        if (sub_str == NULL) {
+            fprintf(out_ptr, "Incorrect number of arguments.\n");
+        } else {
+            while (sub_str != NULL) {
+                celix_status_t sub_status = CELIX_SUCCESS;
+
+                bundle_pt bundle_ptr = NULL;
+
+                char *end_str = NULL;
+                long id = strtol(sub_str, &end_str, 10);
+                if (*end_str) {
+                    sub_status = CELIX_ILLEGAL_ARGUMENT;
+                    fprintf(err_ptr, "Bundle id '%s' is invalid, problem at %s\n", sub_str, end_str);
+                }
+
+                if (sub_status == CELIX_SUCCESS) {
+                    sub_status = bundleContext_getBundleById(context_ptr, id, &bundle_ptr);
+                }
+
+                if (sub_status == CELIX_SUCCESS) {
+                    bundle_startWithOptions(bundle_ptr, 0);
+                }
+
+                if (sub_status != CELIX_SUCCESS) {
+                    status = sub_status;
+                    break;
+                }
+
+                sub_str = strtok_r(NULL, OSGI_SHELL_COMMAND_SEPARATOR, &save_ptr);
+            }
+        }
+
+    }
+
+    return status;
+}

http://git-wip-us.apache.org/repos/asf/celix/blob/a1c30887/shell/src/std_commands.h
----------------------------------------------------------------------
diff --git a/shell/src/std_commands.h b/shell/src/std_commands.h
new file mode 100644
index 0000000..ef7f37e
--- /dev/null
+++ b/shell/src/std_commands.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.
+ */
+/*
+ * std_commands.h
+ *
+ *  \date       March 27, 2014
+ *  \author    	<a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
+ *  \copyright	Apache License, Version 2.0
+ */
+
+#ifndef __STD_COMMANDS_H_
+#define __STD_COMMANDS_H_
+
+#include "celix_errno.h"
+
+#define OSGI_SHELL_COMMAND_SEPARATOR " "
+
+celix_status_t psCommand_execute(void *_ptr, char *command_line_str, FILE *out_ptr, FILE *err_ptr);
+celix_status_t startCommand_execute(void *_ptr, char *command_line_str, FILE *out_ptr, FILE *err_ptr);
+celix_status_t stopCommand_execute(void *handle, char * commandline, FILE *outStream, FILE *errStream);
+celix_status_t installCommand_execute(void *handle, char * commandline, FILE *outStream, FILE *errStream);
+celix_status_t uninstallCommand_execute(void *handle, char * commandline, FILE *outStream, FILE *errStream);
+celix_status_t updateCommand_execute(void *handle, char * commandline, FILE *outStream, FILE *errStream);
+celix_status_t logCommand_execute(void *handle, char * commandline, FILE *outStream, FILE *errStream);
+celix_status_t inspectCommand_execute(void *handle, char * commandline, FILE *outStream, FILE *errStream);
+celix_status_t helpCommand_execute(void *handle, char * commandline, FILE *outStream, FILE *errStream);
+
+#endif

http://git-wip-us.apache.org/repos/asf/celix/blob/a1c30887/shell/src/stop_command.c
----------------------------------------------------------------------
diff --git a/shell/src/stop_command.c b/shell/src/stop_command.c
new file mode 100644
index 0000000..0093c99
--- /dev/null
+++ b/shell/src/stop_command.c
@@ -0,0 +1,82 @@
+/**
+ *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.
+ */
+/*
+ * stop_command.c
+ *
+ *  \date       Aug 20, 2010
+ *  \author    	<a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
+ *  \copyright	Apache License, Version 2.0
+ */
+#include <stdlib.h>
+#include <string.h>
+
+#include "bundle_context.h"
+#include "std_commands.h"
+
+celix_status_t stopCommand_execute(void *_ptr, char *command_line_str, FILE *out_ptr, FILE *err_ptr) {
+    celix_status_t status = CELIX_SUCCESS;
+
+    bundle_context_pt context_ptr = _ptr;
+
+    if (!context_ptr || !command_line_str || !out_ptr || !err_ptr) {
+        status = CELIX_ILLEGAL_ARGUMENT;
+    }
+
+    if (status == CELIX_SUCCESS) {
+        char *sub_str = NULL;
+        char *save_ptr = NULL;
+
+        strtok_r(command_line_str, OSGI_SHELL_COMMAND_SEPARATOR, &save_ptr);
+        sub_str = strtok_r(NULL, OSGI_SHELL_COMMAND_SEPARATOR, &save_ptr);
+
+        if (sub_str == NULL) {
+            fprintf(out_ptr, "Incorrect number of arguments.\n");
+        } else {
+            while (sub_str != NULL) {
+                celix_status_t sub_status = CELIX_SUCCESS;
+
+                bundle_pt bundle_ptr = NULL;
+
+                char *end_str = NULL;
+                long id = strtol(sub_str, &end_str, 10);
+                if (*end_str) {
+                    sub_status = CELIX_ILLEGAL_ARGUMENT;
+                    fprintf(err_ptr, "Bundle id '%s' is invalid, problem at %s\n", sub_str, end_str);
+                }
+
+                if (sub_status == CELIX_SUCCESS) {
+                    sub_status = bundleContext_getBundleById(context_ptr, id, &bundle_ptr);
+                }
+
+                if (sub_status == CELIX_SUCCESS) {
+                    bundle_stopWithOptions(bundle_ptr, 0);
+                }
+
+                if (sub_status != CELIX_SUCCESS) {
+                    status = sub_status;
+                    break;
+                }
+
+                sub_str = strtok_r(NULL, OSGI_SHELL_COMMAND_SEPARATOR, &save_ptr);
+            }
+        }
+    }
+
+    return status;
+}

http://git-wip-us.apache.org/repos/asf/celix/blob/a1c30887/shell/src/uninstall_command.c
----------------------------------------------------------------------
diff --git a/shell/src/uninstall_command.c b/shell/src/uninstall_command.c
new file mode 100644
index 0000000..fb30831
--- /dev/null
+++ b/shell/src/uninstall_command.c
@@ -0,0 +1,58 @@
+/**
+ *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.
+ */
+/*
+ * uninstall_command.c
+ *
+ *  \date       Aug 20, 2010
+ *  \author    	<a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
+ *  \copyright	Apache License, Version 2.0
+ */
+#include <stdlib.h>
+#include <string.h>
+
+#include "array_list.h"
+#include "bundle_context.h"
+
+celix_status_t uninstallCommand_execute(void *handle, char * line, FILE *outStream, FILE *errStream) {
+	bundle_context_pt context = handle;
+	char delims[] = " ";
+	char * sub = NULL;
+	char *save_ptr = NULL;
+	celix_status_t status = CELIX_SUCCESS;
+
+	sub = strtok_r(line, delims, &save_ptr);
+	sub = strtok_r(NULL, delims, &save_ptr);
+
+	if (sub == NULL) {
+		fprintf(errStream, "Incorrect number of arguments.\n");
+	} else {
+		while (sub != NULL) {
+			long id = atol(sub);
+			bundle_pt bundle = NULL;
+			status = bundleContext_getBundleById(context, id, &bundle);
+			if (status==CELIX_SUCCESS && bundle!=NULL) {
+				bundle_uninstall(bundle);
+			} else {
+				fprintf(errStream, "Bundle id is invalid.");
+			}
+			sub = strtok_r(NULL, delims, &save_ptr);
+		}
+	}
+	return status;
+}

http://git-wip-us.apache.org/repos/asf/celix/blob/a1c30887/shell/src/update_command.c
----------------------------------------------------------------------
diff --git a/shell/src/update_command.c b/shell/src/update_command.c
new file mode 100644
index 0000000..64999ac
--- /dev/null
+++ b/shell/src/update_command.c
@@ -0,0 +1,117 @@
+/**
+ *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.
+ */
+/*
+ * update_command.c
+ *
+ *  \date       Aug 20, 2010
+ *  \author    	<a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
+ *  \copyright	Apache License, Version 2.0
+ *
+ */
+#include <stdlib.h>
+#include <string.h>
+#include <curl/curl.h>
+#include <sys/stat.h>
+
+#include "array_list.h"
+#include "bundle_context.h"
+
+celix_status_t updateCommand_download(bundle_context_pt context, char * url, char **inputFile);
+size_t updateCommand_writeData(void *ptr, size_t size, size_t nmemb, FILE *stream);
+
+void updateCommand_execute(void *handle, char * line, FILE *outStream, FILE *errStream) {
+	bundle_context_pt context = handle;
+    bundle_pt bundle = NULL;
+	char delims[] = " ";
+	char * sub = NULL;
+	char *save_ptr = NULL;
+
+	sub = strtok_r(line, delims, &save_ptr);
+	sub = strtok_r(NULL, delims, &save_ptr);
+
+	if (sub == NULL) {
+		fprintf(errStream, "Incorrect number of arguments.\n");
+	} else {
+		long id = atol(sub);
+		celix_status_t ret = bundleContext_getBundleById(context, id, &bundle);
+		if (ret==CELIX_SUCCESS && bundle!=NULL) {
+			char inputFile[256];
+			sub = strtok_r(NULL, delims, &save_ptr);
+			inputFile[0] = '\0';
+			if (sub != NULL) {
+				char *test = inputFile;
+				printf("URL: %s\n", sub);
+
+				if (updateCommand_download(context, sub, &test) == CELIX_SUCCESS) {
+					printf("Update bundle with stream\n");
+					bundle_update(bundle, inputFile);
+				} else {
+					fprintf(errStream, "Unable to download from %s\n", sub);
+				}
+			} else {
+				bundle_update(bundle, NULL);
+			}
+		} else {
+			fprintf(errStream, "Bundle id is invalid.\n");
+		}
+	}
+}
+
+celix_status_t updateCommand_download(bundle_context_pt context, char * url, char **inputFile) {
+	CURL *curl = NULL;
+	CURLcode res = CURLE_FILE_COULDNT_READ_FILE;
+	curl = curl_easy_init();
+	if (curl) {
+		FILE *fp = NULL;
+		snprintf(*inputFile, 13,"updateXXXXXX");
+		umask(0011);
+		int fd = mkstemp(*inputFile);
+		if (fd) {
+		    fp = fopen(*inputFile, "wb+");
+		    if(fp!=NULL){
+		    	printf("Temp file: %s\n", *inputFile);
+		    	curl_easy_setopt(curl, CURLOPT_NOSIGNAL, 1);
+		    	curl_easy_setopt(curl, CURLOPT_URL, url);
+		    	curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, updateCommand_writeData);
+		    	curl_easy_setopt(curl, CURLOPT_WRITEDATA, fp);
+		    	//curl_easy_setopt(curl, CURLOPT_NOPROGRESS, 0);
+		    	//curl_easy_setopt(curl, CURLOPT_PROGRESSFUNCTION, updateCommand_downloadProgress);
+		    	res = curl_easy_perform(curl);
+		    	fclose(fp);
+		    }
+		    /* always cleanup */
+		    curl_easy_cleanup(curl);
+		    if(fp==NULL){
+		    	return CELIX_FILE_IO_EXCEPTION;
+		    }
+		}
+	}
+	if (res != CURLE_OK) {
+		printf("Error: %d\n", res);
+		*inputFile[0] = '\0';
+		return CELIX_ILLEGAL_STATE;
+	} else {
+		return CELIX_SUCCESS;
+	}
+}
+
+size_t updateCommand_writeData(void *ptr, size_t size, size_t nmemb, FILE *stream) {
+    size_t written = fwrite(ptr, size, nmemb, stream);
+    return written;
+}

http://git-wip-us.apache.org/repos/asf/celix/blob/a1c30887/shell_bonjour/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/shell_bonjour/CMakeLists.txt b/shell_bonjour/CMakeLists.txt
index 300fef0..2276f09 100644
--- a/shell_bonjour/CMakeLists.txt
+++ b/shell_bonjour/CMakeLists.txt
@@ -26,28 +26,24 @@ if (SHELL_BONJOUR)
 	set(BUNDLE_VERSION "0.1.0")
 	set(BUNDLE_NAME "bonjour_shell")
 
-	include_directories("${PROJECT_SOURCE_DIR}/utils/public/include")
-	include_directories("${PROJECT_SOURCE_DIR}/shell/public/include")
-	include_directories("${LIBXML2_INCLUDE_DIR}")
-	include_directories("private/include")
-
-	set(MEMSTREAM_SOURCES )
-	if (APPLE OR ANDROID)
-		set(MEMSTREAM_SOURCES ${PROJECT_SOURCE_DIR}/utils/private/src/memstream/open_memstream.c  ${PROJECT_SOURCE_DIR}/utils/private/src/memstream/fmemopen.c)
-		include_directories(${PROJECT_SOURCE_DIR}/utils/public/include/memstream)
-	endif()
 	add_bundle(bonjour_shell
-                VERSION "1.0.0"
+		VERSION "1.0.0"
 		SOURCES
 		 	private/src/activator.c
 		 	private/src/bonjour_shell.c
-			${MEMSTREAM_SOURCES}
 	)
-	
-	target_link_libraries(bonjour_shell celix_framework celix_utils ${LIBXML2_LIBRARIES} ${DNS_SD_LIB})
+	add_library(Celix::bonjour_shell ALIAS bonjour_shell)
+
+
+	target_include_directories(bonjour_shell PRIVATE
+			"${PROJECT_SOURCE_DIR}/utils/public/include"
+			"${LIBXML2_INCLUDE_DIR}"
+			private/include
+	)
+	target_link_libraries(bonjour_shell PRIVATE ${LIBXML2_LIBRARIES} ${DNS_SD_LIB} Celix::shell_api)
 
 	add_deploy("bonjour_shell_deploy" BUNDLES 
-		shell
+		Celix::shell
 		bonjour_shell
 		PROPERTIES "bonjour.shell.id=Apache Celix"
 	)

http://git-wip-us.apache.org/repos/asf/celix/blob/a1c30887/shell_tui/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/shell_tui/CMakeLists.txt b/shell_tui/CMakeLists.txt
index 0216261..bd6b316 100644
--- a/shell_tui/CMakeLists.txt
+++ b/shell_tui/CMakeLists.txt
@@ -27,10 +27,14 @@ if (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_bundle(shell_tui)
-	
-	include_directories("private/include")
-    include_directories("${PROJECT_SOURCE_DIR}/utils/public/include")
-    include_directories("${PROJECT_SOURCE_DIR}/shell/public/include")
-    target_link_libraries(shell_tui celix_framework)
+
+	#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/a1c30887/shell_tui/README.md
----------------------------------------------------------------------
diff --git a/shell_tui/README.md b/shell_tui/README.md
index a637214..8a58fcb 100644
--- a/shell_tui/README.md
+++ b/shell_tui/README.md
@@ -10,3 +10,8 @@ The Celix Shell TUI implements a textual user interface for the Celix Shell.
 - 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 The `FindCelix.cmake` will set:
+ - The `Celix::shell_tui` bundle target if the shell_tui is installed

http://git-wip-us.apache.org/repos/asf/celix/blob/a1c30887/utils/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/utils/CMakeLists.txt b/utils/CMakeLists.txt
index 9132f45..e0c187f 100644
--- a/utils/CMakeLists.txt
+++ b/utils/CMakeLists.txt
@@ -15,93 +15,98 @@
 # specific language governing permissions and limitations
 # under the License.
 
-celix_subproject(UTILS "Option to build the utilities library" ON)
-if (UTILS) 
-    cmake_minimum_required(VERSION 2.6)
-    
+set(MEMSTREAM_SOURCES )
+set(MEMSTREAM_INCLUDES )
+if (APPLE OR ANDROID)
+    set(MEMSTREAM_SOURCES src/memstream/open_memstream.c  src/memstream/fmemopen.c)
+    set(MEMSTREAM_INCLUDE_DIR include/memstream)
+endif()
+
+add_library(utils SHARED
+    src/array_list.c
+    src/hash_map.c
+    src/linked_list.c
+    src/linked_list_iterator.c
+    src/celix_threads.c
+    src/version.c
+    src/version_range.c
+    src/thpool.c
+    src/properties.c
+    src/utils.c
+    ${MEMSTREAM_SOURCES}
+)
+set_target_properties(utils PROPERTIES OUTPUT_NAME "celix_utils")
+
 if (ANDROID)
-    add_definitions(-DUSE_FILE32API)
+    target_compile_definitions(utils PRIVATE -DUSE_FILE32API)
 endif ()
 
-    include_directories("private/include")
-    include_directories("public/include")
-    add_library(celix_utils SHARED 
-                private/src/array_list.c
-                private/src/hash_map.c
-                private/src/linked_list.c
-                private/src/linked_list_iterator.c
-                private/src/celix_threads.c
-                private/src/version.c
-                private/src/version_range.c
-                private/src/thpool.c
-                private/src/properties.c
-                private/src/utils.c
-    )
-
-    set_target_properties(celix_utils PROPERTIES "SOVERSION" 2)
-    
-    IF(UNIX AND NOT ANDROID)
-        target_link_libraries(celix_utils m pthread)
-    ELSEIF(ANDROID)
-        target_link_libraries(celix_utils m)
-    ENDIF()
-    
-    install(TARGETS celix_utils DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT framework)
-    FILE(GLOB files "public/include/*.h")
-    INSTALL(FILES ${files} DESTINATION include/celix COMPONENT framework)
-    
-    celix_subproject(UTILS-TESTS "Option to build the utilities library tests" "OFF")
-
-        if (ENABLE_TESTING AND UTILS-TESTS)
-            find_package(CppUTest REQUIRED)
-
-            SET(CMAKE_SKIP_BUILD_RPATH  FALSE) 
-            SET(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE) 
-            SET(CMAKE_INSTALL_RPATH "${PROJECT_BINARY_DIR}/utils")
-
-
-            include_directories(${CUNIT_INCLUDE_DIRS})
-            include_directories(${CPPUTEST_INCLUDE_DIR})
-            include_directories(public/include)
-            include_directories(utils/private/include)
-            
-            add_executable(hash_map_test private/test/hash_map_test.cpp)
-            target_link_libraries(hash_map_test celix_utils ${CPPUTEST_LIBRARY} pthread)
-            
-            add_executable(array_list_test private/test/array_list_test.cpp)
-            target_link_libraries(array_list_test celix_utils ${CPPUTEST_LIBRARY} pthread)
-            
-            add_executable(celix_threads_test private/test/celix_threads_test.cpp)
-            target_link_libraries(celix_threads_test celix_utils ${CPPUTEST_LIBRARY} ${CPPUTEST_EXT_LIBRARY} pthread)
-            add_executable(linked_list_test private/test/linked_list_test.cpp)
-            target_link_libraries(linked_list_test celix_utils ${CPPUTEST_LIBRARY} pthread)
-            
-            add_executable(thread_pool_test private/test/thread_pool_test.cpp)
-            target_link_libraries(thread_pool_test celix_utils ${CPPUTEST_LIBRARY} pthread) 
-
-            add_executable(properties_test private/test/properties_test.cpp)
-            target_link_libraries(properties_test ${CPPUTEST_LIBRARY} ${CPPUTEST_EXT_LIBRARY} celix_utils pthread)
-
-            add_executable(utils_test private/test/utils_test.cpp)
-            target_link_libraries(utils_test ${CPPUTEST_LIBRARY} celix_utils pthread)
-		
-            configure_file(private/resources-test/properties.txt ${CMAKE_BINARY_DIR}/utils/resources-test/properties.txt COPYONLY)
-
-            add_test(NAME run_array_list_test COMMAND array_list_test)
-            add_test(NAME run_hash_map_test COMMAND hash_map_test)
-            add_test(NAME run_celix_threads_test COMMAND celix_threads_test)
-            add_test(NAME run_thread_pool_test COMMAND thread_pool_test)
-            add_test(NAME run_linked_list_test COMMAND linked_list_test)
-            add_test(NAME run_properties_test COMMAND properties_test)
-            add_test(NAME run_utils_test COMMAND utils_test)
-        
-            SETUP_TARGET_FOR_COVERAGE(array_list_test array_list_test ${CMAKE_BINARY_DIR}/coverage/array_list_test/array_list_test)
-            SETUP_TARGET_FOR_COVERAGE(hash_map hash_map_test ${CMAKE_BINARY_DIR}/coverage/hash_map_test/hash_map_test)
-            SETUP_TARGET_FOR_COVERAGE(celix_threads_test celix_threads_test ${CMAKE_BINARY_DIR}/coverage/celix_threads_test/celix_threads_test)
-            SETUP_TARGET_FOR_COVERAGE(thread_pool_test thread_pool_test ${CMAKE_BINARY_DIR}/coverage/thread_pool_test/thread_pool_test)
-            SETUP_TARGET_FOR_COVERAGE(linked_list_test linked_list_test ${CMAKE_BINARY_DIR}/coverage/linked_list_test/linked_list_test)
-            SETUP_TARGET_FOR_COVERAGE(properties_test properties_test ${CMAKE_BINARY_DIR}/coverage/properties_test/properties_test)
-            SETUP_TARGET_FOR_COVERAGE(utils_test utils_test ${CMAKE_BINARY_DIR}/coverage/utils_test/utils_test)
-
-   endif(ENABLE_TESTING AND UTILS-TESTS)
-endif (UTILS)
+target_include_directories(utils PUBLIC include ${MEMSTREAM_INCLUDE_DIR})
+target_include_directories(utils PRIVATE src)
+set_target_properties(utils PROPERTIES "SOVERSION" 2)
+
+IF(UNIX AND NOT ANDROID)
+    target_link_libraries(utils PRIVATE m pthread)
+ELSEIF(ANDROID)
+    target_link_libraries(utils PRIVATE m)
+ENDIF()
+
+install(TARGETS utils DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT framework)
+
+#Alias setup to match external usage
+add_library(Celix::utils ALIAS utils)
+
+
+celix_subproject(UTILS-TESTS "Option to build the utilities library tests" "OFF")
+if (ENABLE_TESTING AND UTILS-TESTS)
+    find_package(CppUTest REQUIRED)
+
+    SET(CMAKE_SKIP_BUILD_RPATH  FALSE)
+    SET(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE)
+    SET(CMAKE_INSTALL_RPATH "${PROJECT_BINARY_DIR}/utils")
+
+
+    include_directories(${CUNIT_INCLUDE_DIRS})
+    include_directories(${CPPUTEST_INCLUDE_DIR})
+    include_directories(include)
+    include_directories(src)
+
+    add_executable(hash_map_test private/test/hash_map_test.cpp)
+    target_link_libraries(hash_map_test Celix::utils ${CPPUTEST_LIBRARY} pthread)
+
+    add_executable(array_list_test private/test/array_list_test.cpp)
+    target_link_libraries(array_list_test  Celix::utils ${CPPUTEST_LIBRARY} pthread)
+
+    add_executable(celix_threads_test private/test/celix_threads_test.cpp)
+    target_link_libraries(celix_threads_test Celix::utils ${CPPUTEST_LIBRARY} ${CPPUTEST_EXT_LIBRARY} pthread)
+    add_executable(linked_list_test private/test/linked_list_test.cpp)
+    target_link_libraries(linked_list_test  Celix::utils ${CPPUTEST_LIBRARY} pthread)
+
+    add_executable(thread_pool_test private/test/thread_pool_test.cpp)
+    target_link_libraries(thread_pool_test  Celix::utils ${CPPUTEST_LIBRARY} pthread)
+
+    add_executable(properties_test private/test/properties_test.cpp)
+    target_link_libraries(properties_test ${CPPUTEST_LIBRARY} ${CPPUTEST_EXT_LIBRARY}  Celix::utils pthread)
+
+    add_executable(utils_test private/test/utils_test.cpp)
+    target_link_libraries(utils_test ${CPPUTEST_LIBRARY}  Celix::utils pthread)
+
+    configure_file(private/resources-test/properties.txt ${CMAKE_BINARY_DIR}/utils/resources-test/properties.txt COPYONLY)
+
+    add_test(NAME run_array_list_test COMMAND array_list_test)
+    add_test(NAME run_hash_map_test COMMAND hash_map_test)
+    add_test(NAME run_celix_threads_test COMMAND celix_threads_test)
+    add_test(NAME run_thread_pool_test COMMAND thread_pool_test)
+    add_test(NAME run_linked_list_test COMMAND linked_list_test)
+    add_test(NAME run_properties_test COMMAND properties_test)
+    add_test(NAME run_utils_test COMMAND utils_test)
+
+    SETUP_TARGET_FOR_COVERAGE(array_list_test array_list_test ${CMAKE_BINARY_DIR}/coverage/array_list_test/array_list_test)
+    SETUP_TARGET_FOR_COVERAGE(hash_map hash_map_test ${CMAKE_BINARY_DIR}/coverage/hash_map_test/hash_map_test)
+    SETUP_TARGET_FOR_COVERAGE(celix_threads_test celix_threads_test ${CMAKE_BINARY_DIR}/coverage/celix_threads_test/celix_threads_test)
+    SETUP_TARGET_FOR_COVERAGE(thread_pool_test thread_pool_test ${CMAKE_BINARY_DIR}/coverage/thread_pool_test/thread_pool_test)
+    SETUP_TARGET_FOR_COVERAGE(linked_list_test linked_list_test ${CMAKE_BINARY_DIR}/coverage/linked_list_test/linked_list_test)
+    SETUP_TARGET_FOR_COVERAGE(properties_test properties_test ${CMAKE_BINARY_DIR}/coverage/properties_test/properties_test)
+    SETUP_TARGET_FOR_COVERAGE(utils_test utils_test ${CMAKE_BINARY_DIR}/coverage/utils_test/utils_test)
+
+endif(ENABLE_TESTING AND UTILS-TESTS)

http://git-wip-us.apache.org/repos/asf/celix/blob/a1c30887/utils/include/array_list.h
----------------------------------------------------------------------
diff --git a/utils/include/array_list.h b/utils/include/array_list.h
new file mode 100644
index 0000000..4f83a45
--- /dev/null
+++ b/utils/include/array_list.h
@@ -0,0 +1,99 @@
+/**
+ *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.
+ */
+/*
+ * array_list.h
+ *
+ *  \date       Aug 4, 2010
+ *  \author    	<a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
+ *  \copyright	Apache License, Version 2.0
+ */
+
+#ifndef ARRAY_LIST_H_
+#define ARRAY_LIST_H_
+
+#include "celixbool.h"
+#include "exports.h"
+#include "celix_errno.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef struct arrayList *array_list_pt;
+
+typedef struct arrayListIterator *array_list_iterator_pt;
+
+typedef celix_status_t (*array_list_element_equals_pt)(const void *, const void *, bool *equals);
+
+UTILS_EXPORT celix_status_t arrayList_create(array_list_pt *list);
+
+UTILS_EXPORT celix_status_t arrayList_createWithEquals(array_list_element_equals_pt equals, array_list_pt *list);
+
+UTILS_EXPORT void arrayList_destroy(array_list_pt list);
+
+UTILS_EXPORT void arrayList_trimToSize(array_list_pt list);
+
+UTILS_EXPORT void arrayList_ensureCapacity(array_list_pt list, int capacity);
+
+UTILS_EXPORT unsigned int arrayList_size(array_list_pt list);
+
+UTILS_EXPORT bool arrayList_isEmpty(array_list_pt list);
+
+UTILS_EXPORT bool arrayList_contains(array_list_pt list, void *element);
+
+UTILS_EXPORT int arrayList_indexOf(array_list_pt list, void *element);
+
+UTILS_EXPORT int arrayList_lastIndexOf(array_list_pt list, void *element);
+
+UTILS_EXPORT void *arrayList_get(array_list_pt list, unsigned int index);
+
+UTILS_EXPORT void *arrayList_set(array_list_pt list, unsigned int index, void *element);
+
+UTILS_EXPORT bool arrayList_add(array_list_pt list, void *element);
+
+UTILS_EXPORT int arrayList_addIndex(array_list_pt list, unsigned int index, void *element);
+
+UTILS_EXPORT bool arrayList_addAll(array_list_pt list, array_list_pt toAdd);
+
+UTILS_EXPORT void *arrayList_remove(array_list_pt list, unsigned int index);
+
+UTILS_EXPORT bool arrayList_removeElement(array_list_pt list, void *element);
+
+UTILS_EXPORT void arrayList_clear(array_list_pt list);
+
+UTILS_EXPORT array_list_pt arrayList_clone(array_list_pt list);
+
+UTILS_EXPORT array_list_iterator_pt arrayListIterator_create(array_list_pt list);
+
+UTILS_EXPORT void arrayListIterator_destroy(array_list_iterator_pt iterator);
+
+UTILS_EXPORT bool arrayListIterator_hasNext(array_list_iterator_pt iterator);
+
+UTILS_EXPORT void *arrayListIterator_next(array_list_iterator_pt iterator);
+
+UTILS_EXPORT bool arrayListIterator_hasPrevious(array_list_iterator_pt iterator);
+
+UTILS_EXPORT void *arrayListIterator_previous(array_list_iterator_pt iterator);
+
+UTILS_EXPORT void arrayListIterator_remove(array_list_iterator_pt iterator);
+
+#ifdef __cplusplus
+}
+#endif
+#endif /* ARRAY_LIST_H_ */

http://git-wip-us.apache.org/repos/asf/celix/blob/a1c30887/utils/include/celix_errno.h
----------------------------------------------------------------------
diff --git a/utils/include/celix_errno.h b/utils/include/celix_errno.h
new file mode 100644
index 0000000..b51540b
--- /dev/null
+++ b/utils/include/celix_errno.h
@@ -0,0 +1,119 @@
+/*
+ *Licensed to the Apache Software Foundation (ASF) under one
+ *or more contributor license agreements.  See the NOTICE file
+ *distributed with this work for additional information
+ *regarding copyright ownership.  The ASF licenses this file
+ *to you under the Apache License, Version 2.0 (the
+ *"License"); you may not use this file except in compliance
+ *with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *Unless required by applicable law or agreed to in writing,
+ *software distributed under the License is distributed on an
+ *"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ *specific language governing permissions and limitations
+ *under the License.
+ */
+/*
+ * celix_errno.h
+ *
+ *  \date       Feb 15, 2011
+ *  \author    	<a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
+ *  \copyright	Apache License, Version 2.0
+ */
+/*!
+  \file
+  \brief Error codes
+  \defgroup framework Celix Framework
+ */
+#ifndef CELIX_ERRNO_H_
+#define CELIX_ERRNO_H_
+
+#include <stddef.h>
+#include <errno.h>
+
+#include "exports.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*!
+ * Helper macro which check the current status and executes the provided expression if the
+ * status is still CELIX_SUCCESS (0)
+ */
+#define CELIX_DO_IF(status, expr) ((status) == CELIX_SUCCESS) ? (expr) : (status)
+
+/*!
+ * \defgroup celix_errno Error Codes
+ * \ingroup framework
+ * \{
+ */
+
+struct celix_status {
+    int code;
+    char *error;
+};
+
+/*!
+ * Status type returned by all functions in Celix
+ */
+typedef int celix_status_t;
+
+/*!
+ * Return a readable string for the given error code.
+ *
+ */
+UTILS_EXPORT char *celix_strerror(celix_status_t errorcode, char *buffer, size_t bufferSize);
+
+/*!
+ * Error code indicating successful execution of the function.
+ */
+#define CELIX_SUCCESS 0
+
+/*!
+ * Starting point for Celix errors.
+ */
+#define CELIX_START_ERROR 70000
+
+/*!
+ * The range for Celix errors.
+ */
+#define CELIX_ERRSPACE_SIZE 1000
+
+/*!
+ * The start error number user application can use.
+ */
+#define CELIX_START_USERERR (CELIX_START_ERROR + CELIX_ERRSPACE_SIZE)
+
+/*!
+ * Exception indicating a problem with a bundle
+ */
+#define CELIX_BUNDLE_EXCEPTION (CELIX_START_ERROR + 1)
+/*!
+ * Invalid bundle context is used
+ */
+#define CELIX_INVALID_BUNDLE_CONTEXT (CELIX_START_ERROR + 2)
+/*!
+ * Argument is not correct
+ */
+#define CELIX_ILLEGAL_ARGUMENT (CELIX_START_ERROR + 3)
+#define CELIX_INVALID_SYNTAX (CELIX_START_ERROR + 4)
+#define CELIX_FRAMEWORK_SHUTDOWN (CELIX_START_ERROR + 5)
+#define CELIX_ILLEGAL_STATE (CELIX_START_ERROR + 6)
+#define CELIX_FRAMEWORK_EXCEPTION (CELIX_START_ERROR + 7)
+#define CELIX_FILE_IO_EXCEPTION (CELIX_START_ERROR + 8)
+#define CELIX_SERVICE_EXCEPTION (CELIX_START_ERROR + 9)
+
+#define CELIX_ENOMEM ENOMEM
+
+/**
+ * \}
+ */
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* CELIX_ERRNO_H_ */