celix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pnol...@apache.org
Subject [41/50] [abbrv] celix git commit: CELIX-282: Removes superfluous examples.
Date Tue, 18 Oct 2016 19:26:43 GMT
http://git-wip-us.apache.org/repos/asf/celix/blob/505f6a84/examples/osgi-in-action/chapter04-paint-example/paint/private/src/activator.c
----------------------------------------------------------------------
diff --git a/examples/osgi-in-action/chapter04-paint-example/paint/private/src/activator.c b/examples/osgi-in-action/chapter04-paint-example/paint/private/src/activator.c
deleted file mode 100644
index f82b572..0000000
--- a/examples/osgi-in-action/chapter04-paint-example/paint/private/src/activator.c
+++ /dev/null
@@ -1,139 +0,0 @@
-/**
- *Licensed to the Apache Software Foundation (ASF) under one
- *or more contributor license agreements.  See the NOTICE file
- *distributed with this work for additional information
- *regarding copyright ownership.  The ASF licenses this file
- *to you under the Apache License, Version 2.0 (the
- *"License"); you may not use this file except in compliance
- *with the License.  You may obtain a copy of the License at
- *
- *  http://www.apache.org/licenses/LICENSE-2.0
- *
- *Unless required by applicable law or agreed to in writing,
- *software distributed under the License is distributed on an
- *"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- *specific language governing permissions and limitations
- *under the License.
- */
-/*
- * activator.c
- *
- *  \date       Aug 22, 2011
- *  \author    	<a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
- *  \copyright	Apache License, Version 2.0
- */
-#include <stdlib.h>
-#include <stdio.h>
-#include <apr_general.h>
-#include <glib.h>
-#include <gtk/gtk.h>
-#include <gdk/gdk.h>
-
-#include "bundle_activator.h"
-#include "bundle_context.h"
-#include "simple_shape.h"
-#include "paint_frame.h"
-#include "service_tracker.h"
-#include "service_reference.h"
-#include "service_registration.h"
-
-struct paintFrameActivatorData {
-	service_registration_pt reg;
-	apr_pool_t *pool;
-	service_tracker_pt tracker;
-	bundle_context_pt context;
-	paint_frame_pt paint_frame;
-};
-celix_status_t addingServ(void * handle, service_reference_pt ref, void **service);
-celix_status_t addedServ(void * handle, service_reference_pt reference, void * service);
-celix_status_t modifiedServ(void * handle, service_reference_pt reference, void * service);
-celix_status_t removedServ(void * handle, service_reference_pt reference, void * service);
-
-typedef struct paintFrameActivatorData *greeting_activator_pt;
-
-celix_status_t bundleActivator_create(bundle_context_pt context, void **userData) {
-	celix_status_t status = CELIX_SUCCESS;
-	apr_pool_t *pool;
-	greeting_activator_pt activator;
-	service_tracker_customizer_pt cust = NULL;
-	printf("Paint_frame create\n");
-	status = bundleContext_getMemoryPool(context, &pool);
-	if (status == CELIX_SUCCESS) {
-		*userData = apr_palloc(pool, sizeof(struct paintFrameActivatorData));
-		activator = *userData;
-		activator->reg = NULL;
-		activator->pool = pool;
-		activator->context = context;
-		activator->paint_frame = NULL;
-		activator->tracker = NULL;
-		status = paintFrame_create(context, pool, &activator->paint_frame);
-
-		serviceTrackerCustomizer_create(pool, activator, addingServ,
-				addedServ, modifiedServ, removedServ, &cust);
-
-        serviceTracker_create(pool, context, SIMPLE_SHAPE_SERVICE_NAME, cust, &activator->tracker);
-		serviceTracker_open(activator->tracker);
-
-	}
-	return status;
-}
-
-celix_status_t bundleActivator_start(void * userData, bundle_context_pt ctx) {
-	struct paintFrameActivatorData * act = (struct paintFrameActivatorData *) userData;
-	celix_status_t status = CELIX_SUCCESS;
-	return status;
-}
-
-celix_status_t bundleActivator_stop(void * userData, bundle_context_pt context) {
-	struct paintFrameActivatorData * act = (struct paintFrameActivatorData *) userData;
-	serviceTracker_close(act->tracker);
-	paintFrame_exit(act->paint_frame);
-	return CELIX_SUCCESS;
-}
-
-celix_status_t bundleActivator_destroy(void * userData, bundle_context_pt context) {
-	struct paintFrameActivatorData * act = (struct paintFrameActivatorData *) userData;
-	return CELIX_SUCCESS;
-}
-
-celix_status_t addingServ(void * handle, service_reference_pt ref, void **service) {
-	struct paintFrameActivatorData * data = (struct paintFrameActivatorData *) handle;
-    bundleContext_getService(data->context, ref, service);
-    return CELIX_SUCCESS;
-}
-
-celix_status_t addedServ(void * handle, service_reference_pt ref, void * service) {
-	struct paintFrameActivatorData * data = (struct paintFrameActivatorData *) handle;
-	service_registration_pt reg = NULL;
-	properties_pt props = NULL;
-	char * serviceName = NULL;
-	serviceReference_getServiceRegistration(ref, &reg);
-	serviceRegistration_getProperties(reg, &props);
-	serviceName = properties_get(props, "name");
-	paintFrame_addShape(data->paint_frame, data->context, service);
-	return CELIX_SUCCESS;
- }
-
-celix_status_t modifiedServ(void * handle, service_reference_pt ref, void * service) {
-	struct paintFrameActivatorData * data = (struct paintFrameActivatorData *) handle;
-	service_registration_pt reg = NULL;
-	properties_pt props = NULL;
-	char * serviceName = NULL;
-	serviceReference_getServiceRegistration(ref, &reg);
-	serviceRegistration_getProperties(reg, &props);
-	serviceName = properties_get(props, "name");
-	return CELIX_SUCCESS;
-}
-
-celix_status_t removedServ(void * handle, service_reference_pt ref, void * service) {
-	struct paintFrameActivatorData * data = (struct paintFrameActivatorData *) handle;
-	service_registration_pt reg = NULL;
-	properties_pt props = NULL;
-	char * serviceName = NULL;
-	serviceReference_getServiceRegistration(ref, &reg);
-	serviceRegistration_getProperties(reg, &props);
-	serviceName = properties_get(props, "name");
-	paintFrame_removeShape(data->paint_frame, service);
-	return CELIX_SUCCESS;
-}

http://git-wip-us.apache.org/repos/asf/celix/blob/505f6a84/examples/osgi-in-action/chapter04-paint-example/paint/private/src/default_shape.c
----------------------------------------------------------------------
diff --git a/examples/osgi-in-action/chapter04-paint-example/paint/private/src/default_shape.c b/examples/osgi-in-action/chapter04-paint-example/paint/private/src/default_shape.c
deleted file mode 100644
index e3d45b5..0000000
--- a/examples/osgi-in-action/chapter04-paint-example/paint/private/src/default_shape.c
+++ /dev/null
@@ -1,96 +0,0 @@
-/**
- *Licensed to the Apache Software Foundation (ASF) under one
- *or more contributor license agreements.  See the NOTICE file
- *distributed with this work for additional information
- *regarding copyright ownership.  The ASF licenses this file
- *to you under the Apache License, Version 2.0 (the
- *"License"); you may not use this file except in compliance
- *with the License.  You may obtain a copy of the License at
- *
- *  http://www.apache.org/licenses/LICENSE-2.0
- *
- *Unless required by applicable law or agreed to in writing,
- *software distributed under the License is distributed on an
- *"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- *specific language governing permissions and limitations
- *under the License.
- */
-/*
- * default_shape.c
- *
- *  \date       Aug 22, 2011
- *  \author    	<a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
- *  \copyright	Apache License, Version 2.0
- */
-
-
-#include <stdio.h>
-#include <string.h>
-#include <celixbool.h>
-#include <stdlib.h>
-#include <glib.h>
-#include <gtk/gtk.h>
-#include <gdk/gdk.h>
-#include "bundle_context.h"
-#include "bundle.h"
-#include "hash_map.h"
-#include "simple_shape.h"
-#include "default_shape.h"
-#define DEFAULT_FILE "underc.png"
-
-void defaultShape_draw(simple_shape_pt shape, GdkPixmap *pixMap, GtkWidget *widget, gdouble x, gdouble y);
-
-simple_shape_pt defaultShape_create(bundle_context_pt context) {
-	celix_status_t status = CELIX_SUCCESS;
-	bundle_pt bundle;
-	apr_pool_t *pool;
-	simple_shape_pt shape = (simple_shape_pt) malloc(sizeof(*shape));
-	bundleContext_getBundle(context, &bundle);
-	bundleContext_getMemoryPool(context, &pool);
-	shape->icon_path = NULL;
-	status = bundle_getEntry(bundle, DEFAULT_FILE, pool, &shape->icon_path);
-	shape->simpleShape_draw = defaultShape_draw;
-	if (status == CELIX_SUCCESS){
-		// no error
-	} else {
-		printf("Could not find resource %s\n", DEFAULT_FILE);
-	}
-	return shape;
-}
-
-void defaultShape_draw(simple_shape_pt shape, GdkPixmap *pixMap, GtkWidget *widget, gdouble x, gdouble y){
-	GdkRectangle update_rect;
-	GdkPixbuf *curr_pix_buf;
-	GError *gerror = NULL;
-	gsize rd = 0, wr = 0;
-	if (shape->icon_path == NULL) {
-		printf("error message: icon path unknown\n");
-	} else {
-		gchar *gfn = g_locale_to_utf8(shape->icon_path, strlen(shape->icon_path), &rd, &wr, &gerror);
-		curr_pix_buf = gdk_pixbuf_new_from_file(gfn, &gerror);
-		if(!curr_pix_buf) {
-			g_printerr("error message: %s\n", (gchar *) gerror->message);
-		}
-		update_rect.x = x - 5;
-		update_rect.y = y - 5;
-		update_rect.width = gdk_pixbuf_get_width(curr_pix_buf);
-		update_rect.height = gdk_pixbuf_get_height(curr_pix_buf);
-		gdk_pixbuf_render_to_drawable(
-				curr_pix_buf,
-				pixMap,
-				gtk_widget_get_style(widget)->fg_gc[gtk_widget_get_state(widget)],
-				0, 0,
-				update_rect.x, update_rect.y,
-				update_rect.width,
-				update_rect.height,
-				GDK_RGB_DITHER_NONE,
-				0, 0);
-		gtk_widget_queue_draw_area (widget,
-				update_rect.x, update_rect.y,
-				update_rect.width, update_rect.height);
-	}
-}
-
-
-

http://git-wip-us.apache.org/repos/asf/celix/blob/505f6a84/examples/osgi-in-action/chapter04-paint-example/paint/private/src/paint_frame.c
----------------------------------------------------------------------
diff --git a/examples/osgi-in-action/chapter04-paint-example/paint/private/src/paint_frame.c b/examples/osgi-in-action/chapter04-paint-example/paint/private/src/paint_frame.c
deleted file mode 100644
index 1c56311..0000000
--- a/examples/osgi-in-action/chapter04-paint-example/paint/private/src/paint_frame.c
+++ /dev/null
@@ -1,363 +0,0 @@
-/**
- *Licensed to the Apache Software Foundation (ASF) under one
- *or more contributor license agreements.  See the NOTICE file
- *distributed with this work for additional information
- *regarding copyright ownership.  The ASF licenses this file
- *to you under the Apache License, Version 2.0 (the
- *"License"); you may not use this file except in compliance
- *with the License.  You may obtain a copy of the License at
- *
- *  http://www.apache.org/licenses/LICENSE-2.0
- *
- *Unless required by applicable law or agreed to in writing,
- *software distributed under the License is distributed on an
- *"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- *specific language governing permissions and limitations
- *under the License.
- */
-/*
- * paint_frame.c
- *
- *  \date       Aug 22, 2011
- *  \author    	<a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
- *  \copyright	Apache License, Version 2.0
- */
-
-
-/*
- * This class represents the main application class, which is a JFrame subclass
- * that manages a toolbar of shapes and a drawing canvas. This class does not
- * directly interact with the underlying OSGi framework; instead, it is injected
- * with the available <tt>SimpleShape</tt> instances to eliminate any
- * dependencies on the OSGi application programming interfaces.
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <gtk/gtk.h>
-#include <string.h>
-#include <celixbool.h>
-#include <glib.h>
-#include <gdk/gdk.h>
-#include "bundle_context.h"
-#include "bundle.h"
-#include "utils.h"
-#include "hash_map.h"
-#include "simple_shape.h"
-#include "linked_list_iterator.h"
-#include "linked_list.h"
-#include "paint_frame.h"
-#include "shape_component.h"
-#include "default_shape.h"
-#include "celix_errno.h"
-
-static paint_frame_pt this = NULL;
-
-struct shape_info {
-	char *name;
-	simple_shape_pt shape;
-	GtkWidget *button;
-};
-
-typedef struct shape_info *shape_info_pt;
-static celix_status_t paintFrame_redraw(paint_frame_pt frame, GdkModifierType state);
-static celix_status_t paintFrame_show(paint_frame_pt frame);
-static void paintFrame_destroy(GtkWidget *widget, gpointer data);
-static void paintFrame_expose(GtkWidget *widget, GdkEventExpose *event, gpointer data);
-static void paintFrame_configure(GtkWidget *widget, GdkEventConfigure *event, gpointer data);
-static void paintFrame_buttonClicked(GtkWidget *button, gpointer data);
-static gboolean paintFrame_mousePressed( GtkWidget *widget, GdkEventButton *event, gpointer data);
-static gpointer paintFrame_gtkmain(gpointer a_data);
-static void paintFrame_destroyWidgets(paint_frame_pt frame);
-
-/**
- * Default constructor that populates the main window.
- **/
-celix_status_t paintFrame_create(bundle_context_pt context, apr_pool_t *pool, paint_frame_pt *frame) {
-	celix_status_t status = CELIX_SUCCESS;
-	apr_pool_t *mypool = NULL;
-	apr_pool_create(&mypool, pool);
-	this = malloc(sizeof(*this));
-	if (!this) {
-		this = NULL;
-		status = CELIX_ENOMEM;
-	} else {
-		char *builderFile;
-		bundle_pt bundle;
-		GError *error = NULL;
-		*frame = this;
-		
-
-		(*frame)->showing = false;
-		(*frame)->pool = mypool;
-		(*frame)->pixMap = NULL;
-		(*frame)->m_selected = NULL;
-		(*frame)->context = context;
-		(*frame)->m_shapes = hashMap_create(utils_stringHash, NULL, utils_stringEquals, NULL);
-		(*frame)->m_defaultShape = defaultShape_create((*frame)->context);
-		linkedList_create((*frame)->pool, &(*frame)->m_shapeComponents);
-
-
-		status = bundleContext_getBundle(context, &bundle);
-		if (status == CELIX_SUCCESS) {
-			status = bundle_getEntry(bundle, "gtktest.glade", mypool, &builderFile);
-			if (status == CELIX_SUCCESS) {
-				(*frame)->file = builderFile;
-
-				gdk_threads_init();
-				gtk_init(NULL, NULL);
-
-				if( g_thread_supported()) {
-					// (*frame)->main = g_thread_new("main", paintFrame_gtkmain, (*frame));
-					(*frame)->main = g_thread_create(paintFrame_gtkmain, (*frame), TRUE, &error);
-					if ((*frame)->main == NULL){
-						g_printerr ("Failed to create thread: %s\n", error->message);
-						status = CELIX_BUNDLE_EXCEPTION;
-					}
-				} else {
-					g_printerr("g_thread NOT supported\n");
-				}
-			}
-		}
-	}
-
-	return status;
-}
-
-celix_status_t paintFrame_exit(paint_frame_pt frame) {
-	frame->showing = false;
-
-	paintFrame_destroyWidgets(frame);
-
-	gdk_threads_enter();
-
-	gtk_main_quit();
-
-	gdk_threads_leave();
-
-	g_thread_join(frame->main);
-
-	return CELIX_SUCCESS;
-}
-
-static celix_status_t shapeInfo_create(paint_frame_pt frame, char* name, GtkWidget *button, simple_shape_pt shape, shape_info_pt *info){
-	*info = malloc(sizeof(**info));
-	(*info)->shape = shape;
-	(*info)->name = name;
-	(*info)->button = button;
-	return CELIX_SUCCESS;
-}
-static celix_status_t paintFrame_show(paint_frame_pt frame) {
-	gtk_widget_show(frame->drawingArea);
-	gtk_widget_show(frame->toolbar);
-	gtk_widget_show(frame->window);
-
-	return CELIX_SUCCESS;
-}
-
-/**
- * Injects an available <tt>SimpleShape</tt> into the drawing frame.
- *
- * @param name The name of the injected <tt>SimpleShape</tt>.
- * @param icon The icon associated with the injected <tt>SimpleShape</tt>.
- * @param shape The injected <tt>SimpleShape</tt> instance.
- **/
-celix_status_t paintFrame_addShape(paint_frame_pt frame, bundle_context_pt context, simple_shape_pt shape) {
-	celix_status_t status = CELIX_SUCCESS;
-	GError *gerror = NULL;
-	GtkWidget *button = NULL;
-	GtkWidget *im = NULL;
-
-	gdk_threads_enter();
-	
-	button = gtk_button_new();
-	gtk_widget_set_name((GtkWidget *) button, shape->name);
-	im = gtk_image_new_from_file(shape->icon_path);
-	gtk_button_set_image((GtkButton *) button, im);
-	gtk_toolbar_append_widget((GtkToolbar *) frame->toolbar, (GtkWidget *) button, "", "");
-	g_signal_connect (G_OBJECT (button), "clicked", G_CALLBACK (paintFrame_buttonClicked), frame);
-	gtk_widget_show(button);
-	if (hashMap_get(frame->m_shapes, shape->name) == NULL) {
-		shape_info_pt info = NULL;
-		shapeInfo_create(frame, shape->name, button, shape, &info);
-		hashMap_put(frame->m_shapes, shape->name, info);
-	}
-	paintFrame_redraw(frame, 0);
-	paintFrame_show(frame);
-	gdk_threads_leave();
-
-	return status;
-}
-
-/**
- * Removes a no longer available <tt>SimpleShape</tt> from the drawing frame.
- *
- * @param name The name of the <tt>SimpleShape</tt> to remove.
- **/
-celix_status_t paintFrame_removeShape(paint_frame_pt frame, simple_shape_pt sshape) {
-	celix_status_t status = CELIX_SUCCESS;
-	shape_info_pt shape = NULL;
-	gdk_threads_enter();
-	shape = (shape_info_pt) hashMap_remove(this->m_shapes, sshape->name);
-	if (shape != NULL) {
-		this->m_selected = NULL;
-		gtk_widget_destroy(GTK_WIDGET(shape->button));
-		gtk_widget_show_all(this->toolbar);
-		paintFrame_redraw(this, 0);
-		paintFrame_show(this);
-	}
-	gdk_threads_leave();
-
-	return status;
-}
-
-/**
- * Retrieves the available <tt>SimpleShape</tt> associated with the given
- * name.
- *
- * @param name The name of the <tt>SimpleShape</tt> to retrieve.
- * @return The corresponding <tt>SimpleShape</tt> instance if available or
- *         <tt>null</tt>.
- **/
-simple_shape_pt paintFrame_getShape(paint_frame_pt frame, char *name) {
-	shape_info_pt info = (shape_info_pt) hashMap_get(frame->m_shapes, name);
-	if (info == NULL) {
-		return frame->m_defaultShape;
-	} else {
-		return info->shape;
-	}
-}
-
-static void paintFrame_destroy(GtkWidget *widget, gpointer data) {
-	paint_frame_pt frame = data;
-	bundle_pt bundle = NULL;
-
-	frame->showing = false;
-
-//	bundleContext_getBundleById(frame->context, 0, &bundle);
-//	bundle_stop(bundle, 0);
-}
-
-static void paintFrame_destroyWidgets(paint_frame_pt frame) {
-	gdk_threads_enter();
-
-	if (frame->pixMap != NULL) {
-		gdk_pixmap_unref(frame->pixMap);
-	}
-	if (frame->toolbar != NULL) {
-		gtk_widget_destroy(frame->toolbar);
-	}
-	if (frame->drawingArea != NULL) {
-		gtk_widget_destroy(frame->drawingArea);
-	}
-	if (frame->window != NULL) {
-		gtk_widget_destroy(frame->window);
-	}
-
-	frame->pixMap = NULL;
-	frame->toolbar = NULL;
-	frame->window = NULL;
-	frame->drawingArea = NULL;
-
-	gdk_threads_leave();
-}
-
-static void paintFrame_configure(GtkWidget *widget, GdkEventConfigure *event, gpointer data) {
-	paint_frame_pt frame = data;
-	GtkAllocation allocation;
-
-	if (frame->pixMap != NULL) {
-		gdk_pixmap_unref(frame->pixMap);
-	}
-
-	gtk_widget_get_allocation(widget, &allocation);
-	frame->pixMap = gdk_pixmap_new(gtk_widget_get_window(widget), allocation.width, allocation.height, -1);
-	paintFrame_redraw(frame, 0);
-}
-
-static void paintFrame_expose(GtkWidget *widget, GdkEventExpose *event, gpointer data) {
-	paint_frame_pt frame = data;
-	gdk_draw_pixmap(gtk_widget_get_window(widget),
-			gtk_widget_get_style(widget)->fg_gc[gtk_widget_get_state(widget)],
-			frame->pixMap, event->area.x, event->area.y, event->area.x,
-			event->area.y, event->area.width, event->area.height);
-}
-
-static void paintFrame_buttonClicked(GtkWidget *button, gpointer data) {
-	paint_frame_pt frame = data;
-	frame->m_selected = (char *) gtk_widget_get_name(button);
-}
-
-static gboolean paintFrame_mousePressed( GtkWidget *widget, GdkEventButton *event, gpointer data) {
-	paint_frame_pt frame = data;
-	if (event->button == 1 && frame->pixMap != NULL) {
-		if (frame->m_selected == NULL){
-			printf("no button selected yet\n");
-		} else {
-			shape_component_pt sc = shapeComponent_create(frame, paintFrame_getShape(frame, frame->m_selected), event->x, event->y);
-			linkedList_addFirst(frame->m_shapeComponents, sc);
-			(*sc->shapeComponent_paintComponent)(sc, frame, frame->pixMap, widget);
-		}
-	}
-	return TRUE;
-}
-
-static celix_status_t paintFrame_redraw(paint_frame_pt frame, GdkModifierType state) {
-	if (frame->pixMap != NULL && frame->showing) {
-		GdkRectangle update_rect;
-		GtkAllocation allocation;
-		linked_list_iterator_pt it = NULL;
-
-		update_rect.x = 0;
-		update_rect.y = 0;
-		gtk_widget_get_allocation(frame->drawingArea, &allocation);
-		update_rect.width = allocation.width;
-		update_rect.height = allocation.height;
-		gdk_draw_rectangle (this->pixMap,
-				gtk_widget_get_style(frame->drawingArea)->white_gc,
-				TRUE,
-				update_rect.x, update_rect.y,
-				update_rect.width, update_rect.height);
-		gtk_widget_draw(frame->drawingArea, &update_rect);
-		it = linkedListIterator_create(this->m_shapeComponents, 0);
-		while (linkedListIterator_hasNext(it)) {
-			shape_component_pt sc = linkedListIterator_next(it);
-			(*sc->shapeComponent_paintComponent)(sc, this, this->pixMap, frame->drawingArea);
-		}
-	}
-
-	return CELIX_SUCCESS;
-}
-
-static gpointer paintFrame_gtkmain(gpointer a_data) {
-	GtkBuilder *builder;
-	paint_frame_pt frame = (paint_frame_pt) a_data;
-
-	gdk_threads_enter();
-	builder = gtk_builder_new();
-	gtk_builder_add_from_file(builder, frame->file, NULL);
-
-	frame->window = GTK_WIDGET(gtk_builder_get_object (builder, "window1"));
-	frame->toolbar = GTK_WIDGET(gtk_builder_get_object (builder, "toolbar1"));
-	frame->drawingArea = GTK_WIDGET(gtk_builder_get_object (builder, "drawingarea1"));
-	g_object_unref(G_OBJECT(builder));
-
-	gtk_window_set_title(GTK_WINDOW(frame->window), "OSGi in Action, Paint-Example");
-
-	gtk_widget_set_events (frame->drawingArea, GDK_EXPOSURE_MASK | GDK_BUTTON_PRESS_MASK);
-
-	g_signal_connect(G_OBJECT(frame->window), "destroy", G_CALLBACK(paintFrame_destroy), frame);
-	g_signal_connect(G_OBJECT(frame->drawingArea), "expose_event", G_CALLBACK(paintFrame_expose), frame);
-	g_signal_connect(G_OBJECT(frame->drawingArea), "configure_event", G_CALLBACK(paintFrame_configure), frame);
-	g_signal_connect(G_OBJECT(frame->drawingArea), "button_press_event", G_CALLBACK(paintFrame_mousePressed), frame);
-
-
-	paintFrame_show(frame);
-	frame->showing = true;
-
-	gtk_main();
-	gdk_threads_leave();
-
-	return NULL;
-}

http://git-wip-us.apache.org/repos/asf/celix/blob/505f6a84/examples/osgi-in-action/chapter04-paint-example/paint/private/src/shape_component.c
----------------------------------------------------------------------
diff --git a/examples/osgi-in-action/chapter04-paint-example/paint/private/src/shape_component.c b/examples/osgi-in-action/chapter04-paint-example/paint/private/src/shape_component.c
deleted file mode 100644
index db8d274..0000000
--- a/examples/osgi-in-action/chapter04-paint-example/paint/private/src/shape_component.c
+++ /dev/null
@@ -1,69 +0,0 @@
-/**
- *Licensed to the Apache Software Foundation (ASF) under one
- *or more contributor license agreements.  See the NOTICE file
- *distributed with this work for additional information
- *regarding copyright ownership.  The ASF licenses this file
- *to you under the Apache License, Version 2.0 (the
- *"License"); you may not use this file except in compliance
- *with the License.  You may obtain a copy of the License at
- *
- *  http://www.apache.org/licenses/LICENSE-2.0
- *
- *Unless required by applicable law or agreed to in writing,
- *software distributed under the License is distributed on an
- *"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- *specific language governing permissions and limitations
- *under the License.
- */
-/*
- * shape_component.c
- *
- *  \date       Aug 22, 2011
- *  \author    	<a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
- *  \copyright	Apache License, Version 2.0
- */
-#include <stdio.h>
-#include <stdio.h>
-#include <string.h>
-#include <celixbool.h>
-#include <stdlib.h>
-#include <glib.h>
-#include <gtk/gtk.h>
-#include <gdk/gdk.h>
-#include "bundle_context.h"
-#include "utils.h"
-#include "linked_list.h"
-#include "hash_map.h"
-#include "simple_shape.h"
-#include "shape_component.h"
-
-static const int BOX = 54;
-
-extern void shapeComponent_paintComponent(shape_component_pt shapeComponent, paint_frame_pt frame,
-		GdkPixmap *pixMap, GtkWidget *widget);
-
-shape_component_pt shapeComponent_create(paint_frame_pt frame, simple_shape_pt sshape,
-		gdouble x, gdouble y) {
-	shape_component_pt shape = malloc(sizeof(*shape));
-	shape->m_frame = frame;
-	shape->shapeName = strdup(sshape->name);
-	shape->x = x - BOX /2;
-	shape->y = y - BOX /2;
-	shape->w = BOX;
-	shape->h = BOX;
-	/* methods */
-	shape->shapeComponent_paintComponent = shapeComponent_paintComponent;
-	return shape;
-}
-
-void shapeComponent_paintComponent(shape_component_pt shapeComponent, paint_frame_pt frame,
-		GdkPixmap *pixMap, GtkWidget *widget) {
-	simple_shape_pt shape = paintFrame_getShape(frame, shapeComponent->shapeName);
-	if (shape == NULL) {
-		g_printerr("cannot find shape %s\n", shapeComponent->shapeName);
-	} else {
-		(*shape->simpleShape_draw)(shape, pixMap, widget,
-				shapeComponent->x, shapeComponent->y);
-	}
-}

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

http://git-wip-us.apache.org/repos/asf/celix/blob/505f6a84/examples/osgi-in-action/chapter04-paint-example/simple/public/include/simple_shape.h
----------------------------------------------------------------------
diff --git a/examples/osgi-in-action/chapter04-paint-example/simple/public/include/simple_shape.h b/examples/osgi-in-action/chapter04-paint-example/simple/public/include/simple_shape.h
deleted file mode 100644
index 6385b54..0000000
--- a/examples/osgi-in-action/chapter04-paint-example/simple/public/include/simple_shape.h
+++ /dev/null
@@ -1,42 +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.
- */
-/*
- * simple_shape.h
- *
- *  \date       Aug 22, 2011
- *  \author    	<a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
- *  \copyright	Apache License, Version 2.0
- */
-#ifndef SIMPLE_SHAPE_H_
-#define SIMPLE_SHAPE_H_
-
-#include <gdk/gdk.h>
-
-struct simple_shape {
-	char *icon_path;
-	char *name;
-	void (*simpleShape_draw) (struct simple_shape *shape, GdkPixmap *pixMap, GtkWidget *widget, gdouble x, gdouble y);
-};
-
-typedef struct simple_shape *simple_shape_pt;
-
-#define SIMPLE_SHAPE_SERVICE_NAME "simple_shape"
-
-
-#endif /* SIMPLE_SHAPE_H_ */

http://git-wip-us.apache.org/repos/asf/celix/blob/505f6a84/examples/osgi-in-action/chapter04-paint-example/square/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/examples/osgi-in-action/chapter04-paint-example/square/CMakeLists.txt b/examples/osgi-in-action/chapter04-paint-example/square/CMakeLists.txt
deleted file mode 100644
index df87ee4..0000000
--- a/examples/osgi-in-action/chapter04-paint-example/square/CMakeLists.txt
+++ /dev/null
@@ -1,45 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License.  You may obtain a copy of the License at
-# 
-#   http://www.apache.org/licenses/LICENSE-2.0
-# 
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied.  See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-INCLUDE(FindPkgConfig)
-pkg_search_module (GLIB  REQUIRED glib-2.0)
-pkg_search_module (GTHR  REQUIRED gthread-2.0)
-pkg_search_module (GTK   REQUIRED gtk+-2.0)
-include_directories(
-	private/include
-	../simple/public/include
-)
-include_directories(${GTK_INCLUDE_DIRS})
-include_directories(${GLIB_INCLUDE_DIRS})
-include_directories(${GTHR_INCLUDE_DIRS})
-
-link_directories(${GTK_LIBRARY_DIRS})
-link_directories(${GLIB_LIBRARY_DIRS})
-link_directories(${GTHR_LIBRARY_DIRS})
-
-add_bundle(square  VERSION 0.0.1  SOURCES
- 	private/src/activator
- 	private/src/square_shape
-    
-    private/include/square_shape.h
- FILES 
- 	private/src/square.png
-)
-
-include_directories("${PROJECT_SOURCE_DIR}/utils/public/include")
-include_directories("${PROJECT_SOURCE_DIR}/log_service/public/include")
-target_link_libraries(square celix_framework ${GLIB_LIBRARIES} ${GTK_LIBRARIES} ${GTHR_LIBRARIES})

http://git-wip-us.apache.org/repos/asf/celix/blob/505f6a84/examples/osgi-in-action/chapter04-paint-example/square/private/include/square_shape.h
----------------------------------------------------------------------
diff --git a/examples/osgi-in-action/chapter04-paint-example/square/private/include/square_shape.h b/examples/osgi-in-action/chapter04-paint-example/square/private/include/square_shape.h
deleted file mode 100644
index 35c4be1..0000000
--- a/examples/osgi-in-action/chapter04-paint-example/square/private/include/square_shape.h
+++ /dev/null
@@ -1,31 +0,0 @@
-/**
- *Licensed to the Apache Software Foundation (ASF) under one
- *or more contributor license agreements.  See the NOTICE file
- *distributed with this work for additional information
- *regarding copyright ownership.  The ASF licenses this file
- *to you under the Apache License, Version 2.0 (the
- *"License"); you may not use this file except in compliance
- *with the License.  You may obtain a copy of the License at
- *
- *  http://www.apache.org/licenses/LICENSE-2.0
- *
- *Unless required by applicable law or agreed to in writing,
- *software distributed under the License is distributed on an
- *"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- *specific language governing permissions and limitations
- *under the License.
- */
-/*
- * square_shape.h
- *
- *  \date       Aug 22, 2011
- *  \author    	<a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
- *  \copyright	Apache License, Version 2.0
- */
-#ifndef SQUARE_SHAPE_H_
-#define SQUARE_SHAPE_H_
-
-extern simple_shape_pt squareShape_create(bundle_context_pt context);
-
-#endif /* SQUARE_SHAPE_H_ */

http://git-wip-us.apache.org/repos/asf/celix/blob/505f6a84/examples/osgi-in-action/chapter04-paint-example/square/private/src/activator.c
----------------------------------------------------------------------
diff --git a/examples/osgi-in-action/chapter04-paint-example/square/private/src/activator.c b/examples/osgi-in-action/chapter04-paint-example/square/private/src/activator.c
deleted file mode 100644
index 96ca227..0000000
--- a/examples/osgi-in-action/chapter04-paint-example/square/private/src/activator.c
+++ /dev/null
@@ -1,77 +0,0 @@
-/**
- *Licensed to the Apache Software Foundation (ASF) under one
- *or more contributor license agreements.  See the NOTICE file
- *distributed with this work for additional information
- *regarding copyright ownership.  The ASF licenses this file
- *to you under the Apache License, Version 2.0 (the
- *"License"); you may not use this file except in compliance
- *with the License.  You may obtain a copy of the License at
- *
- *  http://www.apache.org/licenses/LICENSE-2.0
- *
- *Unless required by applicable law or agreed to in writing,
- *software distributed under the License is distributed on an
- *"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- *specific language governing permissions and limitations
- *under the License.
- */
-/*
- * activator.c
- *
- *  \date       Aug 22, 2011
- *  \author    	<a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
- *  \copyright	Apache License, Version 2.0
- */
-#include <stdlib.h>
-#include <stdio.h>
-#include <apr_general.h>
-#include <glib.h>
-#include <gtk/gtk.h>
-#include <gdk/gdk.h>
-
-#include "bundle_activator.h"
-#include "bundle_context.h"
-#include "simple_shape.h"
-#include "square_shape.h"
-#include "simple_shape.h"
-
-struct squareActivator {
-	service_registration_pt reg;
-	apr_pool_t *pool;
-};
-
-typedef struct squareActivator *greeting_activator_pt;
-
-celix_status_t bundleActivator_create(bundle_context_pt context, void **userData) {
-	apr_pool_t *pool;
-	greeting_activator_pt activator;
-	celix_status_t status = bundleContext_getMemoryPool(context, &pool);
-	if (status == CELIX_SUCCESS) {
-		*userData = apr_palloc(pool, sizeof(struct squareActivator));
-		activator = *userData;
-		activator->reg = NULL;
-		activator->pool = pool;
-		printf("Square created\n");
-	}
-	return status;
-}
-
-celix_status_t bundleActivator_start(void * userData, bundle_context_pt ctx) {
-	struct squareActivator * act = (struct squareActivator *) userData;
-	celix_status_t status = CELIX_SUCCESS;
-	simple_shape_pt es = squareShape_create(ctx);
-	properties_pt props = properties_create();
-	properties_set(props, "name", "square");
-    status = bundleContext_registerService(ctx, SIMPLE_SHAPE_SERVICE_NAME, es, props, &act->reg);
-	printf("Square start\n");
-	return status;
-}
-
-celix_status_t bundleActivator_stop(void * userData, bundle_context_pt context) {
-	return CELIX_SUCCESS;
-}
-
-celix_status_t bundleActivator_destroy(void * userData, bundle_context_pt context) {
-	return CELIX_SUCCESS;
-}

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

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

http://git-wip-us.apache.org/repos/asf/celix/blob/505f6a84/examples/osgi-in-action/chapter04-paint-example/triangle/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/examples/osgi-in-action/chapter04-paint-example/triangle/CMakeLists.txt b/examples/osgi-in-action/chapter04-paint-example/triangle/CMakeLists.txt
deleted file mode 100644
index ff069b3..0000000
--- a/examples/osgi-in-action/chapter04-paint-example/triangle/CMakeLists.txt
+++ /dev/null
@@ -1,45 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License.  You may obtain a copy of the License at
-# 
-#   http://www.apache.org/licenses/LICENSE-2.0
-# 
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied.  See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-INCLUDE(FindPkgConfig)
-pkg_search_module (GLIB  REQUIRED glib-2.0)
-pkg_search_module (GTHR  REQUIRED gthread-2.0)
-pkg_search_module (GTK   REQUIRED gtk+-2.0)
-include_directories(
-	private/include
-	../simple/public/include
-)
-include_directories(${GTK_INCLUDE_DIRS})
-include_directories(${GLIB_INCLUDE_DIRS})
-include_directories(${GTHR_INCLUDE_DIRS})
-
-link_directories(${GTK_LIBRARY_DIRS})
-link_directories(${GLIB_LIBRARY_DIRS})
-link_directories(${GTHR_LIBRARY_DIRS})
-
-add_bundle(triangle  VERSION 0.0.1 SOURCES
- 	private/src/activator
- 	private/src/triangle_shape
-    
-    private/include/triangle_shape.h
- FILES 
- 	private/src/triangle.png
-)
-
-include_directories("${PROJECT_SOURCE_DIR}/utils/public/include")
-include_directories("${PROJECT_SOURCE_DIR}/log_service/public/include")
-target_link_libraries(triangle celix_framework ${GLIB_LIBRARIES} ${GTK_LIBRARIES} ${GTHR_LIBRARIES})

http://git-wip-us.apache.org/repos/asf/celix/blob/505f6a84/examples/osgi-in-action/chapter04-paint-example/triangle/private/include/triangle_shape.h
----------------------------------------------------------------------
diff --git a/examples/osgi-in-action/chapter04-paint-example/triangle/private/include/triangle_shape.h b/examples/osgi-in-action/chapter04-paint-example/triangle/private/include/triangle_shape.h
deleted file mode 100644
index 02b924c..0000000
--- a/examples/osgi-in-action/chapter04-paint-example/triangle/private/include/triangle_shape.h
+++ /dev/null
@@ -1,32 +0,0 @@
-/**
- *Licensed to the Apache Software Foundation (ASF) under one
- *or more contributor license agreements.  See the NOTICE file
- *distributed with this work for additional information
- *regarding copyright ownership.  The ASF licenses this file
- *to you under the Apache License, Version 2.0 (the
- *"License"); you may not use this file except in compliance
- *with the License.  You may obtain a copy of the License at
- *
- *  http://www.apache.org/licenses/LICENSE-2.0
- *
- *Unless required by applicable law or agreed to in writing,
- *software distributed under the License is distributed on an
- *"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- *specific language governing permissions and limitations
- *under the License.
- */
-/*
- * triangle_shape.h
- *
- *  \date       Aug 22, 2011
- *  \author    	<a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
- *  \copyright	Apache License, Version 2.0
- */
-
-#ifndef TRIANGLE_SHAPE_H_
-#define TRIANGLE_SHAPE_H_
-
-extern simple_shape_pt triangleShape_create(bundle_context_pt ctx);
-
-#endif /* TRIANGLE_SHAPE_H_ */

http://git-wip-us.apache.org/repos/asf/celix/blob/505f6a84/examples/osgi-in-action/chapter04-paint-example/triangle/private/src/activator.c
----------------------------------------------------------------------
diff --git a/examples/osgi-in-action/chapter04-paint-example/triangle/private/src/activator.c b/examples/osgi-in-action/chapter04-paint-example/triangle/private/src/activator.c
deleted file mode 100644
index 49875ac..0000000
--- a/examples/osgi-in-action/chapter04-paint-example/triangle/private/src/activator.c
+++ /dev/null
@@ -1,77 +0,0 @@
-/**
- *Licensed to the Apache Software Foundation (ASF) under one
- *or more contributor license agreements.  See the NOTICE file
- *distributed with this work for additional information
- *regarding copyright ownership.  The ASF licenses this file
- *to you under the Apache License, Version 2.0 (the
- *"License"); you may not use this file except in compliance
- *with the License.  You may obtain a copy of the License at
- *
- *  http://www.apache.org/licenses/LICENSE-2.0
- *
- *Unless required by applicable law or agreed to in writing,
- *software distributed under the License is distributed on an
- *"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- *specific language governing permissions and limitations
- *under the License.
- */
-/*
- * activator.c
- *
- *  \date       Aug 22, 2011
- *  \author    	<a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
- *  \copyright	Apache License, Version 2.0
- */
-#include <stdlib.h>
-#include <stdio.h>
-#include <apr_general.h>
-#include <glib.h>
-#include <gtk/gtk.h>
-#include <gdk/gdk.h>
-
-#include "bundle_activator.h"
-#include "bundle_context.h"
-#include "simple_shape.h"
-#include "triangle_shape.h"
-#include "simple_shape.h"
-
-struct greetingActivator {
-	service_registration_pt reg;
-	apr_pool_t *pool;
-};
-
-typedef struct greetingActivator *greeting_activator_pt;
-
-celix_status_t bundleActivator_create(bundle_context_pt context, void **userData) {
-	apr_pool_t *pool;
-	greeting_activator_pt activator;
-	celix_status_t status = bundleContext_getMemoryPool(context, &pool);
-	if (status == CELIX_SUCCESS) {
-		*userData = apr_palloc(pool, sizeof(struct greetingActivator));
-		activator = *userData;
-		activator->reg = NULL;
-		activator->pool = pool;
-	}
-	printf("Triangle created %d\n", status);
-	return status;
-}
-
-celix_status_t bundleActivator_start(void * userData, bundle_context_pt ctx) {
-	struct greetingActivator * act = (struct greetingActivator *) userData;
-	celix_status_t status = CELIX_SUCCESS;
-	simple_shape_pt es = triangleShape_create(ctx);
-	properties_pt props = properties_create();
-	properties_set(props, "name", "triangle");
-    status = bundleContext_registerService(ctx, SIMPLE_SHAPE_SERVICE_NAME, es, props, &act->reg);
-	printf("Triangle activated %d\n", status);
-	return status;
-}
-
-celix_status_t bundleActivator_stop(void * userData, bundle_context_pt context) {
-	return CELIX_SUCCESS;
-}
-
-celix_status_t bundleActivator_destroy(void * userData, bundle_context_pt context) {
-	return CELIX_SUCCESS;
-}

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

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

http://git-wip-us.apache.org/repos/asf/celix/blob/505f6a84/examples/producer_consumer/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/examples/producer_consumer/CMakeLists.txt b/examples/producer_consumer/CMakeLists.txt
deleted file mode 100644
index 5e07a12..0000000
--- a/examples/producer_consumer/CMakeLists.txt
+++ /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.
-
-add_subdirectory(database)
-add_subdirectory(producer)
-add_subdirectory(consumer)

http://git-wip-us.apache.org/repos/asf/celix/blob/505f6a84/examples/producer_consumer/consumer/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/examples/producer_consumer/consumer/CMakeLists.txt b/examples/producer_consumer/consumer/CMakeLists.txt
deleted file mode 100644
index 2803af7..0000000
--- a/examples/producer_consumer/consumer/CMakeLists.txt
+++ /dev/null
@@ -1,27 +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}/examples/producer_consumer/database/public/include")
-
-add_bundle(consumer
-	VERSION 1.0.0
-	SOURCES
-	 	private/src/activator.c
-)
-
-target_link_libraries(consumer celix_framework)

http://git-wip-us.apache.org/repos/asf/celix/blob/505f6a84/examples/producer_consumer/consumer/private/src/activator.c
----------------------------------------------------------------------
diff --git a/examples/producer_consumer/consumer/private/src/activator.c b/examples/producer_consumer/consumer/private/src/activator.c
deleted file mode 100644
index 0e58856..0000000
--- a/examples/producer_consumer/consumer/private/src/activator.c
+++ /dev/null
@@ -1,195 +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       16 Feb 2015
- *  \author     <a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
- *  \copyright  Apache License, Version 2.0
- */
-
-#include <stdlib.h>
-
-#include <unistd.h>
-
-#include <sys/time.h>
-
-#include <bundle_activator.h>
-#include <service_tracker.h>
-#include <constants.h>
-
-#include <array_list.h>
-
-#include "reader_service.h"
-#include "writer_service.h"
-#include "data.h"
-
-struct activator {
-    service_tracker_pt readerTracker;
-    service_tracker_pt writerTracker;
-    array_list_pt readerServices;
-    array_list_pt writerServices;
-    bool running;
-    celix_thread_t worker;
-};
-
-celix_status_t readerServiceAdded(void *handle, service_reference_pt reference, void *service);
-celix_status_t readerServiceRemoved(void *handle, service_reference_pt reference, void *service);
-
-celix_status_t writerServiceAdded(void *handle, service_reference_pt reference, void *service);
-celix_status_t writerServiceRemoved(void *handle, service_reference_pt reference, void *service);
-
-void *retrieveData(void *handle);
-
-celix_status_t bundleActivator_create(bundle_context_pt context, void **userData) {
-    celix_status_t status = CELIX_SUCCESS;
-    *userData = calloc(1, sizeof(struct activator));
-    if (*userData) {
-        ((struct activator *) *userData)->readerTracker = NULL;
-        ((struct activator *) *userData)->writerTracker = NULL;
-        ((struct activator *) *userData)->readerServices = NULL;
-        ((struct activator *) *userData)->writerServices = NULL;
-        ((struct activator *) *userData)->running = false;
-        ((struct activator *) *userData)->worker = celix_thread_default;
-    } 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;
-
-    // create list for services
-    arrayList_create(&activator->readerServices);
-    arrayList_create(&activator->writerServices);
-
-    // start the thread
-    activator->running = true;
-    status = celixThread_create(&activator->worker, NULL, retrieveData, activator);
-
-    if (status == CELIX_SUCCESS) {
-        service_tracker_customizer_pt readerCustomizer = NULL;
-        service_tracker_customizer_pt writerCustomizer = NULL;
-        serviceTrackerCustomizer_create(userData, NULL, readerServiceAdded, NULL, readerServiceRemoved, &readerCustomizer);
-        serviceTrackerCustomizer_create(userData, NULL, writerServiceAdded, NULL, writerServiceRemoved, &writerCustomizer);
-
-        serviceTracker_create(context, WRITER_SERVICE_NAME, writerCustomizer, &activator->writerTracker);
-        serviceTracker_open(activator->writerTracker);
-
-        serviceTracker_create(context, READER_SERVICE_NAME, readerCustomizer, &activator->readerTracker);
-        serviceTracker_open(activator->readerTracker);
-    }
-
-    return status;
-}
-
-celix_status_t bundleActivator_stop(void * userData, bundle_context_pt context) {
-    celix_status_t status = CELIX_SUCCESS;
-    struct activator *activator = userData;
-
-    // stop the thread
-    activator->running = false;
-
-    celixThread_join(activator->worker, NULL);
-
-    serviceTracker_close(activator->readerTracker);
-    serviceTracker_close(activator->writerTracker);
-
-    serviceTracker_destroy(activator->readerTracker);
-    serviceTracker_destroy(activator->writerTracker);
-
-    // destroy the list of services
-    arrayList_destroy(activator->readerServices);
-    arrayList_destroy(activator->writerServices);
-
-    return status;
-}
-
-celix_status_t bundleActivator_destroy(void * userData, bundle_context_pt context) {
-    celix_status_t status = CELIX_SUCCESS;
-    struct activator *activator = userData;
-
-    free(activator);
-
-    return status;
-}
-
-celix_status_t readerServiceAdded(void *handle, service_reference_pt reference, void *service) {
-    struct activator *activator = handle;
-    arrayList_add(activator->readerServices, service);
-    printf("Consumer: Reader Service Added.\n");
-
-    return CELIX_SUCCESS;
-}
-
-celix_status_t readerServiceRemoved(void *handle, service_reference_pt reference, void *service) {
-    struct activator *activator = handle;
-    arrayList_removeElement(activator->readerServices, service);
-    printf("Consumer: Reader Service Removed.\n");
-
-    return CELIX_SUCCESS;
-}
-
-celix_status_t writerServiceAdded(void *handle, service_reference_pt reference, void *service) {
-    struct activator *activator = handle;
-    arrayList_add(activator->writerServices, service);
-    printf("Consumer: Writer Service Added.\n");
-
-    return CELIX_SUCCESS;
-}
-
-celix_status_t writerServiceRemoved(void *handle, service_reference_pt reference, void *service) {
-    struct activator *activator = handle;
-    arrayList_removeElement(activator->writerServices, service);
-    printf("Consumer: Writer Service Removed.\n");
-
-    return CELIX_SUCCESS;
-}
-
-void *retrieveData(void *handle) {
-    struct activator *activator = handle;
-
-    while (activator->running) {
-        int i;
-        for (i = 0; i < arrayList_size(activator->readerServices); i++) {
-            reader_service_pt service = arrayList_get(activator->readerServices, i);
-            data_pt retrievedData = NULL;
-
-            if (service->readerService_getNextData(service->handler, &retrievedData) == CELIX_SUCCESS) {
-                printf(" Data #%d received.", retrievedData->id);
-
-                writer_service_pt writerService = arrayList_get(activator->writerServices, 0);
-                if (writerService && writerService->writerService_removeData(writerService->handler, &retrievedData) == CELIX_SUCCESS) {
-                    printf(" and removed\n");
-                }
-
-            } else {
-                printf(" No data available\n");
-                sleep(5);
-            }
-
-        }
-
-    }
-
-    return NULL;
-}

http://git-wip-us.apache.org/repos/asf/celix/blob/505f6a84/examples/producer_consumer/database/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/examples/producer_consumer/database/CMakeLists.txt b/examples/producer_consumer/database/CMakeLists.txt
deleted file mode 100644
index 40b8b35..0000000
--- a/examples/producer_consumer/database/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}/examples/producer_consumer/database/private/include")
-include_directories("${PROJECT_SOURCE_DIR}/examples/producer_consumer/database/public/include")
-
-add_bundle(database
-	VERSION 1.0.0
-	SOURCES private/src/activator 
-		private/src/writer 
-		private/src/reader
-)
-
-target_link_libraries(database celix_framework)
-

http://git-wip-us.apache.org/repos/asf/celix/blob/505f6a84/examples/producer_consumer/database/private/include/reader_service_impl.h
----------------------------------------------------------------------
diff --git a/examples/producer_consumer/database/private/include/reader_service_impl.h b/examples/producer_consumer/database/private/include/reader_service_impl.h
deleted file mode 100644
index 6db7195..0000000
--- a/examples/producer_consumer/database/private/include/reader_service_impl.h
+++ /dev/null
@@ -1,39 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- *  KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-/*
- * reader_service_impl.h
- *
- *  \date       16 Feb 2015
- *  \author     <a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
- *  \copyright  Apache License, Version 2.0
- */
-
-
-
-#ifndef READER_SERVICE_IMPL_H_
-#define READER_SERVICE_IMPL_H_
-
-#include "data.h"
-#include "database.h"
-
-celix_status_t readerService_getFirstData(database_handler_pt, data_pt firstData);
-celix_status_t readerService_getNextData(database_handler_pt, data_pt* nextData);
-
-#endif

http://git-wip-us.apache.org/repos/asf/celix/blob/505f6a84/examples/producer_consumer/database/private/include/writer_service_impl.h
----------------------------------------------------------------------
diff --git a/examples/producer_consumer/database/private/include/writer_service_impl.h b/examples/producer_consumer/database/private/include/writer_service_impl.h
deleted file mode 100644
index 1933892..0000000
--- a/examples/producer_consumer/database/private/include/writer_service_impl.h
+++ /dev/null
@@ -1,40 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- * 
- *   http://www.apache.org/licenses/LICENSE-2.0 
- * 
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- *  KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-/*
- * writer_service_impl.h
- *
- *  \date       16 Feb 2015
- *  \author     <a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
- *  \copyright  Apache License, Version 2.0
- */
-
-
-
-#ifndef WRITER_SERVICE_IMPL_H_
-#define WRITER_SERVICE_IMPL_H_
-
-#include "data.h"
-#include "database.h"
-
-celix_status_t writerService_storeData(database_handler_pt, data_pt data);
-celix_status_t writerService_removeData(database_handler_pt, data_pt* data);
-
-
-#endif

http://git-wip-us.apache.org/repos/asf/celix/blob/505f6a84/examples/producer_consumer/database/private/src/activator.c
----------------------------------------------------------------------
diff --git a/examples/producer_consumer/database/private/src/activator.c b/examples/producer_consumer/database/private/src/activator.c
deleted file mode 100644
index 3d866e1..0000000
--- a/examples/producer_consumer/database/private/src/activator.c
+++ /dev/null
@@ -1,157 +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       16 Feb 2015
- *  \author     <a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
- *  \copyright  Apache License, Version 2.0
- */
-
-
-#include <stdlib.h>
-#include <unistd.h>
-
-#include <sys/time.h>
-
-#include <bundle_activator.h>
-#include <service_tracker.h>
-#include <constants.h>
-
-#include <array_list.h>
-#include <pthread.h>
-
-#include "reader_service.h"
-#include "reader_service_impl.h"
-#include "writer_service.h"
-#include "writer_service_impl.h"
-
-#include "database.h"
-
-struct activator {
-	database_handler_pt databaseHandler;
-
-	service_registration_pt readerRegistration;
-	service_registration_pt writerRegistration;
-
-	reader_service_pt readerService;
-	writer_service_pt writerService;
-};
-
-
-
-celix_status_t bundleActivator_create(bundle_context_pt context, void **userData) {
-	celix_status_t status = CELIX_SUCCESS;
-
-	*userData = calloc (1, sizeof(struct activator));
-
-	if (*userData) {
-		((struct activator *) *userData)->readerService = NULL;
-		((struct activator *) *userData)->writerService = NULL;
-		((struct activator *) *userData)->databaseHandler = NULL;
-
-	} else {
-		status = CELIX_ENOMEM;
-	}
-	return status;
-}
-
-
-celix_status_t bundleActivator_start(void * userData, bundle_context_pt context) {
-	celix_status_t status = CELIX_ENOMEM;
-	struct activator *activator = userData;
-	reader_service_pt readerService = calloc(1, sizeof(struct reader_service));
-	writer_service_pt writerService = calloc(1, sizeof(struct writer_service));
-	database_handler_pt databaseHandler = calloc(1, sizeof(struct database_handler));
-
-	if (readerService && writerService && databaseHandler)
-	{
-		status = celixThreadMutex_create(&databaseHandler->lock, NULL);
-
-		if (status == CELIX_SUCCESS)
-		{
-			arrayList_create(&databaseHandler->data);
-			databaseHandler->dataIndex = 0;
-
-			readerService->handler = databaseHandler;
-			readerService->readerService_getFirstData = readerService_getFirstData;
-			readerService->readerService_getNextData = readerService_getNextData;
-
-			writerService->handler = databaseHandler;
-			writerService->writerService_storeData = writerService_storeData;
-			writerService->writerService_removeData = writerService_removeData;
-
-			activator->readerService = readerService;
-			activator->writerService = writerService;
-
-			status = bundleContext_registerService(context, READER_SERVICE_NAME, activator->readerService, NULL,  &activator->readerRegistration);
-
-			if (status == CELIX_SUCCESS){
-				status = bundleContext_registerService(context, WRITER_SERVICE_NAME, activator->writerService, NULL,  &activator->writerRegistration);
-			}
-		}
-	}
-
-	if(status != CELIX_SUCCESS){
-		if(readerService!=NULL){
-			free(readerService);
-		}
-		if(writerService!=NULL){
-			free(writerService);
-		}
-		if(databaseHandler!=NULL){
-			free(databaseHandler);
-		}
-	}
-
-	return status;
-}
-
-celix_status_t bundleActivator_stop(void * userData, bundle_context_pt context) {
-	celix_status_t status = CELIX_SUCCESS;
-	struct activator *activator = userData;
-
-	serviceRegistration_unregister(activator->readerRegistration);
-	serviceRegistration_unregister(activator->writerRegistration);
-
-	return status;
-}
-
-celix_status_t bundleActivator_destroy(void * userData, bundle_context_pt context) {
-	celix_status_t status = CELIX_SUCCESS;
-	struct activator *activator = userData;
-
-	database_handler_pt dbh = (database_handler_pt)activator->writerService->handler;
-	if(dbh != NULL){
-		celixThreadMutex_destroy(&dbh->lock);
-		if(dbh->data != NULL){
-			arrayList_destroy(dbh->data);
-		}
-		free(dbh);
-		activator->writerService->handler=NULL;
-	}
-
-	free(activator->readerService);
-	free(activator->writerService);
-	free(activator);
-
-	return status;
-}
-

http://git-wip-us.apache.org/repos/asf/celix/blob/505f6a84/examples/producer_consumer/database/private/src/reader.c
----------------------------------------------------------------------
diff --git a/examples/producer_consumer/database/private/src/reader.c b/examples/producer_consumer/database/private/src/reader.c
deleted file mode 100644
index c28cd7b..0000000
--- a/examples/producer_consumer/database/private/src/reader.c
+++ /dev/null
@@ -1,73 +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.
- */
-
-/*
- * reader.c
- *
- *  \date       16 Feb 2015
- *  \author     <a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
- *  \copyright  Apache License, Version 2.0
- */
-
-
-
-#include <pthread.h>
-
-#include "array_list.h"
-#include "celix_errno.h"
-#include "data.h"
-#include "database.h"
-#include "reader_service.h"
-
-
-celix_status_t readerService_getFirstData(database_handler_pt handler, __attribute__((unused)) data_pt firstData)
-{
-	celix_status_t status = CELIX_BUNDLE_EXCEPTION;
-
-	celixThreadMutex_lock(&handler->lock);
-
-	if (arrayList_remove(handler->data, 0) != NULL)
-	{
-		handler->dataIndex--;
-		status = CELIX_SUCCESS;
-	}
-
-    celixThreadMutex_unlock(&handler->lock);
-
-	return status;
-}
-
-
-celix_status_t readerService_getNextData(database_handler_pt handler, data_pt* nextData)
-{
-	celix_status_t status = CELIX_BUNDLE_EXCEPTION;
-
-    celixThreadMutex_lock(&handler->lock);
-
-	if (((*nextData) = (data_pt) arrayList_get(handler->data, handler->dataIndex)) != NULL)
-	{
-		handler->dataIndex++;
-		status = CELIX_SUCCESS;
-	}
-
-    celixThreadMutex_unlock(&handler->lock);
-
-	return status;
-}
-

http://git-wip-us.apache.org/repos/asf/celix/blob/505f6a84/examples/producer_consumer/database/private/src/writer.c
----------------------------------------------------------------------
diff --git a/examples/producer_consumer/database/private/src/writer.c b/examples/producer_consumer/database/private/src/writer.c
deleted file mode 100644
index cce12fa..0000000
--- a/examples/producer_consumer/database/private/src/writer.c
+++ /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.
- */
-
-/*
- * writer.c
- *
- *  \date       16 Feb 2015
- *  \author     <a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
- *  \copyright  Apache License, Version 2.0
- */
-
-
-
-#include <stdlib.h>
-#include <pthread.h>
-
-#include "array_list.h"
-#include "celix_errno.h"
-#include "data.h"
-#include "database.h"
-
-#include "writer_service.h"
-
-celix_status_t writerService_storeData(database_handler_pt handler, data_pt newData)
-{
-	celix_status_t status = CELIX_BUNDLE_EXCEPTION;
-
-    celixThreadMutex_lock(&handler->lock);
-
-	if ( arrayList_add(handler->data, newData) == true)
-		status = CELIX_SUCCESS;
-
-    celixThreadMutex_unlock(&handler->lock);
-	return status;
-}
-
-
-celix_status_t writerService_removeData(database_handler_pt handler, data_pt* newData)
-{
-	celix_status_t status = CELIX_BUNDLE_EXCEPTION;
-
-    celixThreadMutex_lock(&handler->lock);
-
-	if ( arrayList_removeElement(handler->data, *newData) == true)
-		status = CELIX_SUCCESS;
-
-	free(*newData);
-
-    celixThreadMutex_unlock(&handler->lock);
-	return status;
-}
-

http://git-wip-us.apache.org/repos/asf/celix/blob/505f6a84/examples/producer_consumer/database/public/include/data.h
----------------------------------------------------------------------
diff --git a/examples/producer_consumer/database/public/include/data.h b/examples/producer_consumer/database/public/include/data.h
deleted file mode 100644
index d5bd059..0000000
--- a/examples/producer_consumer/database/public/include/data.h
+++ /dev/null
@@ -1,38 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- * 
- *   http://www.apache.org/licenses/LICENSE-2.0 
- * 
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- *  KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-/*
- * data.h
- *
- *  \date       16 Feb 2015
- *  \author     <a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
- *  \copyright  Apache License, Version 2.0
- */
-
-#ifndef _DATA_H_
-#define _DATA_H_
-
-struct data {
-    int id;
-    char description[100];
-};
-
-typedef struct data* data_pt;
-
-#endif

http://git-wip-us.apache.org/repos/asf/celix/blob/505f6a84/examples/producer_consumer/database/public/include/database.h
----------------------------------------------------------------------
diff --git a/examples/producer_consumer/database/public/include/database.h b/examples/producer_consumer/database/public/include/database.h
deleted file mode 100644
index 054fac0..0000000
--- a/examples/producer_consumer/database/public/include/database.h
+++ /dev/null
@@ -1,44 +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.
- */
-
-/*
- * database.h
- *
- *  \date       16 Feb 2015
- *  \author     <a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
- *  \copyright  Apache License, Version 2.0
- */
-
-
-
-#ifndef _DATABASE_H_
-#define _DATABASE_H_
-
-#include "array_list.h"
-#include  "celix_threads.h"
-
-struct database_handler {
-	celix_thread_mutex_t lock;
-	array_list_pt data;
-	int dataIndex;
-};
-
-typedef struct database_handler* database_handler_pt;
-
-#endif

http://git-wip-us.apache.org/repos/asf/celix/blob/505f6a84/examples/producer_consumer/database/public/include/reader_service.h
----------------------------------------------------------------------
diff --git a/examples/producer_consumer/database/public/include/reader_service.h b/examples/producer_consumer/database/public/include/reader_service.h
deleted file mode 100644
index e27e843..0000000
--- a/examples/producer_consumer/database/public/include/reader_service.h
+++ /dev/null
@@ -1,50 +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.
- */
-
-/*
- * reader_service.h
- *
- *  \date       16 Feb 2015
- *  \author     <a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
- *  \copyright  Apache License, Version 2.0
- */
-
-
-
-#ifndef READER_SERVICE_H_
-#define READER_SERVICE_H_
-
-#include "celix_errno.h"
-#include "data.h"
-#include "database.h"
-
-#define READER_SERVICE_NAME		"service.database.reader"
-
-
-struct reader_service {
-	database_handler_pt handler;
-	celix_status_t (*readerService_getFirstData)(database_handler_pt handle, data_pt firstData);
-	celix_status_t (*readerService_getNextData)(database_handler_pt handle, data_pt* nextData);
-};
-
-typedef struct reader_service* reader_service_pt;
-
-
-
-#endif

http://git-wip-us.apache.org/repos/asf/celix/blob/505f6a84/examples/producer_consumer/database/public/include/writer_service.h
----------------------------------------------------------------------
diff --git a/examples/producer_consumer/database/public/include/writer_service.h b/examples/producer_consumer/database/public/include/writer_service.h
deleted file mode 100644
index 936bbbb..0000000
--- a/examples/producer_consumer/database/public/include/writer_service.h
+++ /dev/null
@@ -1,48 +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.
- */
-
-/*
- * writer_service.h
- *
- *  \date       16 Feb 2015
- *  \author     <a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
- *  \copyright  Apache License, Version 2.0
- */
-
-
-
-
-#ifndef WRITER_SERVICE_H_
-#define WRITER_SERVICE_H_
-
-#include "celix_errno.h"
-#include "data.h"
-#include "database.h"
-
-#define WRITER_SERVICE_NAME		"service.database.writer"
-
-struct writer_service {
-	void *handler;
-	celix_status_t (*writerService_storeData)(database_handler_pt handle, data_pt data);
-	celix_status_t (*writerService_removeData)(database_handler_pt handle, data_pt* data);
-};
-
-typedef struct writer_service* writer_service_pt;
-
-#endif

http://git-wip-us.apache.org/repos/asf/celix/blob/505f6a84/examples/producer_consumer/producer/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/examples/producer_consumer/producer/CMakeLists.txt b/examples/producer_consumer/producer/CMakeLists.txt
deleted file mode 100644
index 83ba7d4..0000000
--- a/examples/producer_consumer/producer/CMakeLists.txt
+++ /dev/null
@@ -1,27 +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}/examples/producer_consumer/database/public/include")
-
-add_bundle(producer
-	VERSION 1.0.0
-	SOURCES
-	 	private/src/activator.c
-)
-
-target_link_libraries(producer celix_framework)
\ No newline at end of file


Mime
View raw message