celix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pnol...@apache.org
Subject svn commit: r1633678 [2/2] - in /celix/branches/celix_config_admin: ./ config_admin/ config_admin/examples/ config_admin/examples/example_test/ config_admin/examples/example_test/META-INF/ config_admin/examples/example_test/private/ config_admin/exampl...
Date Wed, 22 Oct 2014 18:53:40 GMT
Added: celix/branches/celix_config_admin/config_admin/service/private/src/configuration_impl.c
URL: http://svn.apache.org/viewvc/celix/branches/celix_config_admin/config_admin/service/private/src/configuration_impl.c?rev=1633678&view=auto
==============================================================================
--- celix/branches/celix_config_admin/config_admin/service/private/src/configuration_impl.c (added)
+++ celix/branches/celix_config_admin/config_admin/service/private/src/configuration_impl.c Wed Oct 22 18:53:39 2014
@@ -0,0 +1,611 @@
+/**
+ *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.
+ */
+/*
+ * configuration_impl.c
+ *
+ *  \date       Aug 12, 2013
+ *  \author    	<a href="mailto:celix-dev@incubator.apache.org">Apache Celix Project Team</a>
+ *  \copyright	Apache License, Version 2.0
+ */
+
+#include <stdbool.h>
+#include <stdlib.h>
+#include <stdio.h>
+
+/*celix.config_admin.Configuration */
+//#include "configuration.h"
+#include "configuration_impl.h"
+
+/* APR */
+#include <apr_general.h>
+#include <apr_thread_mutex.h>
+/* celix.framework */
+#include "bundle.h"
+#include "constants.h"
+#include "utils.h"
+/* celix.framework_patch*/
+#include "framework_patch.h"
+/* celix.config_admin.public*/
+#include "configuration_event.h"
+#include "configuration_admin.h"
+/* celix.config_admin.private*/
+#include "configuration_admin_factory.h"
+#include "configuration_store.h"
+
+struct configuration{
+
+	apr_pool_t 		*pool;
+
+	configuration_admin_factory_pt configurationAdminFactory;
+	configuration_store_pt configurationStore;
+
+	char *bundleLocation;
+	char *factoryPid;
+	char *pid;
+	properties_pt dictionary;
+
+	bool deleted; // Not sure if it's needed
+	bundle_pt boundBundle;
+
+	apr_thread_mutex_t *mutex;
+
+};
+
+
+// org.eclipse.equinox.internal.cm
+celix_status_t configuration_lock(configuration_pt configuration);
+celix_status_t configuration_unlock(configuration_pt configuration);
+celix_status_t configuration_getBundleLocation2(configuration_pt configuration, bool checkPermission, char **location);
+celix_status_t configuration_getFactoryPid2(configuration_pt configuration, bool checkDeleted, char **factoryPid);
+celix_status_t configuration_getPid2(configuration_pt configuration, bool checkDeleted, char **pid);
+static celix_status_t configuration_updateDictionary(configuration_pt configuration, properties_pt properties);
+
+// org.apache.felix.cm.impl
+static celix_status_t configuration_setBundleLocationProperty(configuration_pt configuration, properties_pt *properties);
+static celix_status_t configuration_setAutoProperties(configuration_pt configuration, properties_pt *properties, bool withBundleLocation);
+
+
+/* ========== CONSTRUCTOR ========== */
+
+/* ---------- public ---------- */
+
+celix_status_t configuration_create( configuration_admin_factory_pt factory, configuration_store_pt store,
+									 char *factoryPid, char *pid, char *bundleLocation,
+									 configuration_pt *configuration){
+
+	apr_pool_t *pool;
+	configuration_pt config;
+
+	if ( apr_pool_create(&pool,NULL) != APR_SUCCESS ){
+		printf("[ ERROR ]: Configuration{PID=%s} - Not created (None Pool) \n",pid);
+		return CELIX_ILLEGAL_ARGUMENT;
+	}
+
+	config = apr_palloc(pool,sizeof(struct configuration));
+	if(!config){
+		printf("[ ERROR ]: Configuration{PID=%s} - Not created (ENOMEM) \n",pid);
+		return CELIX_ENOMEM;
+	}
+
+	config->pool = pool;
+
+	config->configurationAdminFactory  = factory;
+	config->configurationStore = store;
+
+	config->factoryPid = factoryPid;
+	config->pid = pid;
+	config->bundleLocation = bundleLocation;
+	config->dictionary = NULL;
+
+	config->deleted = false;
+	config->boundBundle = NULL;
+
+	config->mutex = NULL;
+
+	if( apr_thread_mutex_create(&config->mutex, APR_THREAD_MUTEX_NESTED, pool) != APR_SUCCESS || config->mutex == NULL ){
+		printf("[ ERROR ]: Configuration{PID=%s} - Not created (MUTEX) \n",pid);
+		return CELIX_ILLEGAL_ARGUMENT;
+	}
+
+	printf("[ SUCCESS]: Configuration{PID=%s}  - Created \n", pid);
+	*configuration = config;
+	return CELIX_SUCCESS;
+}
+
+celix_status_t configuration_create2(configuration_admin_factory_pt factory, configuration_store_pt store,
+									 properties_pt dictionary,
+									 configuration_pt *configuration){
+
+	apr_pool_t *pool;
+	configuration_pt config;
+
+	if ( apr_pool_create(&pool,NULL) != APR_SUCCESS ){
+		printf("[ ERROR ]: Configuration - Not created (None Pool) \n");
+		return CELIX_ILLEGAL_ARGUMENT;
+	}
+
+	config = apr_palloc(pool,sizeof(struct configuration));
+	if(!config){
+		printf("[ ERROR ]: Configuration - Not created (ENOMEM) \n");
+		return CELIX_ENOMEM;
+	}
+
+	config->pool = pool;
+
+	config->configurationAdminFactory  = factory;
+	config->configurationStore = store;
+
+	config->factoryPid = properties_get(dictionary,(char *)SERVICE_FACTORYPID);
+	config->pid = properties_get(dictionary, (char *)OSGI_FRAMEWORK_SERVICE_PID);
+	config->bundleLocation = properties_get(dictionary, (char *)SERVICE_BUNDLELOCATION);
+	config->dictionary = NULL;
+
+	config->deleted = false;
+	config->boundBundle = NULL;
+
+	config->mutex = NULL;
+
+	if( apr_thread_mutex_create(&config->mutex, APR_THREAD_MUTEX_NESTED, pool) != APR_SUCCESS || config->mutex == NULL ){
+		printf("[ ERROR ]: Configuration{PID=%s} - Not created (MUTEX) \n", config->pid);
+		return CELIX_ILLEGAL_ARGUMENT;
+	}
+
+	configuration_updateDictionary(config, dictionary);
+
+	printf("[ SUCCESS]: Configuration{PID=%s}  - Created \n", config->pid);
+	*configuration = config;
+	return CELIX_SUCCESS;
+
+}
+
+
+/* ========== IMPLEMENTS CONFIGURATION ========== */
+
+/* ---------- public ---------- */
+// specifications
+
+celix_status_t configuration_delete(configuration_pt configuration){
+	return CELIX_SUCCESS;
+}
+
+celix_status_t configuration_equals(configuration_pt thisConfiguration, configuration_pt otherConfiguration, bool *equals){
+	return CELIX_SUCCESS;
+}
+
+celix_status_t configuration_getBundleLocation(configuration_pt configuration, char **bundleLocation){
+	return configuration_getBundleLocation2( configuration, true, bundleLocation);
+}
+
+celix_status_t configuration_getFactoryPid(configuration_pt configuration, char **factoryPid){
+	return configuration_getFactoryPid2(configuration, true, factoryPid);
+}
+
+celix_status_t configuration_getPid(configuration_pt configuration, char **pid){
+	return configuration_getPid2(configuration, true, pid);
+}
+
+celix_status_t configuration_getProperties(configuration_pt configuration, properties_pt *properties){
+
+	printf("[ DEBUG ]: Configuration{PID=%s} - getProperties \n",configuration->pid);
+
+	properties_pt copy = configuration->dictionary;
+
+	// (1) configuration.lock
+	configuration_lock(configuration);
+
+	// (2) configuration.checkDeleted
+	if ( configuration_checkDeleted(configuration) != CELIX_SUCCESS ){
+		configuration_unlock(configuration);
+		return CELIX_ILLEGAL_STATE;
+	}
+	// (3) Have the Configuration properties ?
+	if ( configuration->dictionary == NULL ){
+		printf("[ DEBUG ]: configuration_getProperties results NULL \n");
+		*properties = NULL;
+		configuration_unlock(configuration);
+		return CELIX_SUCCESS;
+	}
+
+	// (4) configuration.setAutoProperties
+	if ( configuration_setAutoProperties(configuration, &copy, false) != CELIX_SUCCESS ){
+		configuration_unlock(configuration);
+		return CELIX_ILLEGAL_ARGUMENT;
+	}
+
+	// (5) return
+	*properties = copy;
+	configuration_unlock(configuration);
+	return CELIX_SUCCESS;
+}
+
+celix_status_t configuration_hashCode(configuration_pt configuration, int *hashCode){
+	return CELIX_SUCCESS;
+}
+
+celix_status_t configuration_setBundleLocation(configuration_pt configuration, char *bundleLocation){
+
+	configuration_lock(configuration);
+
+	if ( configuration_checkDeleted(configuration) != CELIX_SUCCESS ){
+		configuration_unlock(configuration);
+		return CELIX_ILLEGAL_STATE;
+	}
+
+	//	TODO configurationAdminFactory.checkConfigurationPermission
+
+	configuration->bundleLocation = bundleLocation;
+	configuration->boundBundle = NULL; // always reset the boundBundle when setBundleLocation is called
+
+	configuration_unlock(configuration);
+
+	return CELIX_SUCCESS;
+}
+
+celix_status_t configuration_update(configuration_pt configuration, properties_pt properties){
+
+	printf("[ DEBUG ]: Configuration{PID=%s} - update \n", configuration->pid);
+
+	celix_status_t status;
+
+	// (1)
+	configuration_lock(configuration);
+
+	// (2)
+	if ( configuration_checkDeleted(configuration) != CELIX_SUCCESS ){
+		configuration_unlock(configuration);
+		return CELIX_ILLEGAL_STATE;
+	}
+	// (3)
+	configuration_updateDictionary(configuration,properties);
+
+	// (4)
+	status = configurationStore_saveConfiguration(configuration->configurationStore,configuration->pid,configuration);
+	if (status != CELIX_SUCCESS){
+		configuration_unlock(configuration);
+		return status;
+	}
+
+	// (5)
+	bool isFactory;
+	if (configuration->factoryPid == NULL){
+		isFactory = false;
+	} else{
+		isFactory = true;
+	}
+
+	status = configurationAdminFactory_notifyConfigurationUpdated(configuration->configurationAdminFactory, configuration, isFactory);
+	if (status != CELIX_SUCCESS){
+		configuration_unlock(configuration);
+		return status;
+	}
+
+	// (6)
+	status = configurationAdminFactory_dispatchEvent(configuration->configurationAdminFactory, CONFIGURATION_EVENT_CM_UPDATED, configuration->factoryPid, configuration->pid);
+	if (status != CELIX_SUCCESS){
+		configuration_unlock(configuration);
+		return status;
+	}
+
+	// (7)
+	configuration_unlock(configuration);
+	printf("[ SUCCESS ]: Configuration{PID=%s} - update \n",configuration->pid);
+	return CELIX_SUCCESS;
+}
+
+/* ---------- protected ---------- */
+// org.eclipse.equinox.cm.impl
+
+celix_status_t configuration_lock(configuration_pt configuration){
+//	printf("[ DEBUG ]: Configuration{PID=%s} - LOCK \n",configuration->pid);
+	apr_thread_mutex_lock(configuration->mutex);
+	return CELIX_SUCCESS;
+}
+
+celix_status_t configuration_unlock(configuration_pt configuration){
+//	printf("[ DEBUG ]: Configuration{PID=%s} - UNLOCK \n",configuration->pid);
+	apr_thread_mutex_unlock(configuration->mutex);
+	return CELIX_SUCCESS;
+}
+
+celix_status_t configuration_checkLocked(configuration_pt configuration){
+	// Not used
+	return CELIX_SUCCESS;
+}
+
+celix_status_t configuration_bind(configuration_pt configuration, bundle_pt bundle, bool *isBind){
+
+	printf("[ DEBUG ]: Configuration{PID=%s} - bind(START) \n",configuration->pid);
+
+	char *bundleLocation;
+
+	configuration_lock(configuration);
+
+	/* ----------- BINDING -------------- */
+
+	// (1): it's the configuration already bound?
+	if ( configuration->boundBundle == NULL ){// (1): No
+
+		// (2): it's the configuration located?
+		if ( configuration->bundleLocation != NULL ){//(2): Yes
+
+			if ( bundle_getBundleLocation(bundle, &bundleLocation) != CELIX_SUCCESS){
+				configuration_unlock(configuration);
+				return CELIX_ILLEGAL_ARGUMENT;
+			}
+
+			// (3): bundle and configuration have the same location?
+			if ( string_equals(configuration->bundleLocation, bundleLocation) ){ // (3): Yes
+				// bind up configuration with bundle
+				configuration->boundBundle = bundle;
+				printf("[ DEBUG ]: Configuration{PID=%s} - bind (bound with Bundle{%s}) \n",configuration->pid,bundleLocation);
+			}
+			// (3): No
+
+		}else{// (2): No
+			// bind up configuration with bundle
+			configuration->boundBundle = bundle;
+			printf("[ DEBUG ]: Configuration{PID=%s}) - bind (not located and now bound with Bundle) \n",configuration->pid);
+		}
+
+	}// (1): Yes
+
+	/* ------------ RETURN -------------- */
+
+	bool bind;
+	if(configuration->boundBundle == bundle){
+		bind = true;
+	}else{
+		bind = false;
+	}
+
+	/* ------------- END ----------------- */
+	configuration_unlock(configuration);
+
+	*isBind = bind;
+	printf("[ DEBUG ]: Configuration{PID=%s} - bind(END) \n",configuration->pid);
+	return CELIX_SUCCESS;
+
+}
+
+celix_status_t configuration_unbind(configuration_pt configuration, bundle_pt bundle){
+	return CELIX_SUCCESS;
+}
+
+celix_status_t configuration_getBundleLocation2(configuration_pt configuration, bool checkPermission, char **location){
+
+	celix_status_t status;
+
+	// (1)
+	configuration_lock(configuration);
+
+	// (2)
+	if( configuration_checkDeleted(configuration) != CELIX_SUCCESS ){
+		configuration_unlock(configuration);
+		return CELIX_ILLEGAL_STATE;
+	}
+	// (3)
+	if ( checkPermission ){
+
+		if ( configurationAdminFactory_checkConfigurationPermission(configuration->configurationAdminFactory) != CELIX_SUCCESS ){
+			return CELIX_ILLEGAL_STATE; // TODO configurationAdmin, not yet implemented
+		}
+	}
+
+	// (4)
+	if ( configuration->bundleLocation ){
+		*location = configuration->bundleLocation;
+		configuration_unlock(configuration);
+		return CELIX_SUCCESS;
+	}
+
+	// (5)
+	if ( configuration->boundBundle != NULL ){
+		status = bundle_getBundleLocation(configuration->boundBundle,location);
+		configuration_unlock(configuration);
+		return status;
+	}
+
+	// (6)
+	*location = NULL;
+	configuration_unlock(configuration);
+	return CELIX_SUCCESS;
+}
+
+celix_status_t configuration_getFactoryPid2(configuration_pt configuration, bool checkDeleted, char **factoryPid){
+	return CELIX_SUCCESS;
+}
+
+celix_status_t configuration_getPid2(configuration_pt configuration, bool checkDeleted, char **pid){
+
+	printf("[ DEBUG ]: Configuration{PID=%s} - getPid \n", configuration->pid);
+
+	configuration_lock(configuration);
+
+	if ( checkDeleted ){
+		if ( configuration_checkDeleted(configuration) != CELIX_SUCCESS ){
+			configuration_unlock(configuration);
+			return CELIX_ILLEGAL_STATE;
+		}
+	}
+
+	*pid = configuration->pid;
+
+	configuration_unlock(configuration);
+
+	return CELIX_SUCCESS;
+}
+
+// org.eclipse.equinox.internal.cm modified to fit with org.apache.felix.cm.impl
+// change due to ConfigurationStore implementation
+celix_status_t configuration_getAllProperties(configuration_pt configuration, properties_pt *properties){
+
+	celix_status_t status;
+
+	properties_pt copy = NULL;
+
+	// (1) configuration.lock
+	configuration_lock(configuration);
+
+	// (2) configuration.deleted ?
+	if( configuration->deleted ){
+		*properties = NULL;
+		configuration_unlock(configuration);
+		return CELIX_SUCCESS;
+	}
+
+	// (3) configuration.getProps
+	if( configuration_getProperties(configuration, &copy) != CELIX_SUCCESS){
+		configuration_unlock(configuration);
+		return CELIX_ILLEGAL_ARGUMENT;
+	}
+
+	// (4) configuration.setProperties
+	if ( copy == NULL ){ //set all the automatic properties
+
+		copy = properties_create();
+		status = configuration_setAutoProperties(configuration, &copy, true);
+
+	}else{ // copy != NULL - only set service.bundleLocation
+
+		status = configuration_setBundleLocationProperty(configuration, &copy);
+
+	}
+
+	// (5) return
+	if (status == CELIX_SUCCESS){
+		*properties = copy;
+	}else{
+		*properties = NULL;
+	}
+
+	configuration_unlock(configuration);
+	return status;
+
+}
+
+celix_status_t configuration_isDeleted(configuration_pt configuration, bool *isDeleted){
+	return CELIX_SUCCESS;
+}
+
+/* ---------- private ---------- */
+
+celix_status_t configuration_checkDeleted(configuration_pt configuration){
+
+	if ( configuration->deleted ){
+		printf("[CELIX_ILLEGAL_STATE ]: configuration(pid=%s) deleted \n", configuration->pid);
+		return CELIX_ILLEGAL_STATE;
+	}
+
+	return CELIX_SUCCESS;
+}
+
+// configuration->dictionary must not contain keys reserved to ConfigAdmin (i.e. "service.pid")
+celix_status_t configuration_updateDictionary(configuration_pt configuration, properties_pt properties){
+
+	properties_pt newDictionary = NULL;
+
+	if ( configuration->dictionary != NULL && configuration->dictionary != properties ){
+		properties_destroy(configuration->dictionary); //free
+	}
+
+	newDictionary = properties; // properties == NULL | properties != NULL
+
+	if ( newDictionary != NULL ){
+
+		hashMap_remove(newDictionary, (void *) OSGI_FRAMEWORK_SERVICE_PID);
+		hashMap_remove(newDictionary, (void *) SERVICE_FACTORYPID);
+		hashMap_remove(newDictionary, (void *) SERVICE_BUNDLELOCATION);
+	}
+
+	configuration->dictionary = newDictionary;
+	return CELIX_SUCCESS;
+
+}
+
+/* ========== IMPLEMENTATION ========== */
+
+/* ---------- protected ---------- */
+
+celix_status_t configuration_getPool(configuration_pt configuration, apr_pool_t **pool){
+
+	printf("[ DEBUG ]: Configuration{PID=%s} - get Pool \n",configuration->pid);
+
+	configuration_lock(configuration);
+
+	*pool = configuration->pool;
+
+	configuration_unlock(configuration);
+
+	return CELIX_SUCCESS;
+}
+
+/* ---------- private ---------- */
+// org.apache.felix.cm.impl
+
+
+// properties_pt as input and output
+celix_status_t configuration_setAutoProperties(configuration_pt configuration, properties_pt *properties, bool withBundleLocation){
+
+	//(1) configuration.lock
+	configuration_lock(configuration);
+
+	// (2) set service.pid
+	properties_set(*properties, (char*)OSGI_FRAMEWORK_SERVICE_PID, configuration->pid);
+
+	// (3) set factory.pid
+	if ( configuration->factoryPid != NULL ){
+		properties_set(*properties, (char*)SERVICE_FACTORYPID, configuration->factoryPid);
+	}
+
+	// (4) set service.bundleLocation
+	if ( withBundleLocation ){
+
+		if ( configuration_setBundleLocationProperty(configuration, properties) != CELIX_SUCCESS ){
+			configuration_unlock(configuration);
+			return CELIX_ILLEGAL_ARGUMENT;
+		}
+
+	}
+
+	// (5) return
+	configuration_unlock(configuration);
+	return CELIX_SUCCESS;
+
+}
+
+celix_status_t configuration_setBundleLocationProperty(configuration_pt configuration, properties_pt *properties){
+
+	char *boundLocation;
+
+	configuration_lock(configuration);
+
+	if( configuration_getBundleLocation(configuration, &boundLocation) != CELIX_SUCCESS ){
+		configuration_unlock(configuration);
+		return CELIX_ILLEGAL_ARGUMENT;
+	}
+
+	if ( boundLocation != NULL ){
+		properties_set(*properties, (char*)SERVICE_BUNDLELOCATION, boundLocation);
+	}
+
+	configuration_unlock(configuration);
+
+	return CELIX_SUCCESS;
+
+}

Added: celix/branches/celix_config_admin/config_admin/service/private/src/configuration_store.c
URL: http://svn.apache.org/viewvc/celix/branches/celix_config_admin/config_admin/service/private/src/configuration_store.c?rev=1633678&view=auto
==============================================================================
--- celix/branches/celix_config_admin/config_admin/service/private/src/configuration_store.c (added)
+++ celix/branches/celix_config_admin/config_admin/service/private/src/configuration_store.c Wed Oct 22 18:53:39 2014
@@ -0,0 +1,431 @@
+/**
+ *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.
+ */
+/*
+ * configuration_store.c
+ *
+ *  \date       Aug 12, 2013
+ *  \author    	<a href="mailto:celix-dev@incubator.apache.org">Apache Celix Project Team</a>
+ *  \copyright	Apache License, Version 2.0
+ */
+
+
+#include <stdbool.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+/* celix.config_admin.ConfigurationStore */
+#include "configuration_store.h"
+
+/* APR */
+#include <apr.h>
+#include <apr_errno.h>
+#include <apr_file_io.h>
+#include <apr_file_info.h>
+#include <apr_thread_mutex.h>
+/* celix.utils */
+#include "hash_map.h"
+/* celix.framework */
+#include "properties.h"
+#include "utils.h"
+/* celix.config_admin.private*/
+#include "configuration_impl.h"
+
+
+#define STORE_DIR "store"
+#define PID_EXT ".pid"
+
+
+struct configuration_store{
+
+	apr_pool_t *pool;
+	bundle_context_pt context;
+
+	apr_thread_mutex_t *mutex;
+
+	configuration_admin_factory_pt configurationAdminFactory;
+
+	hash_map_pt configurations;
+	// int createdPidCount;
+
+};
+
+static celix_status_t configurationStore_createCache(configuration_store_pt store);
+static celix_status_t configurationStore_getConfigurationFile(char *pid, char* storePath, configuration_pt configuration, apr_file_t **file);
+static celix_status_t configurationStore_writeConfigurationFile(apr_file_t *file, properties_pt properties);
+static celix_status_t configurationStore_readCache(configuration_store_pt store);
+static celix_status_t configurationStore_readConfigurationFile(const char *name, apr_size_t size, properties_pt *dictionary);
+static celix_status_t configurationStore_parseDataConfigurationFile(char *data, properties_pt *dictionary);
+
+/* ========== CONSTRUCTOR ========== */
+
+celix_status_t configurationStore_create(apr_pool_t *pool, bundle_context_pt context, configuration_admin_factory_pt factory, configuration_store_pt *store){
+
+	celix_status_t status;
+
+	*store = apr_palloc(pool, sizeof(**store));
+
+	if (!*store){
+		printf("[ ERROR ]: ConfigStore - Not initialized (ENOMEM) \n");
+		return CELIX_ENOMEM;
+	}
+
+	(*store)->pool = pool;
+	(*store)->context = context;
+
+	(*store)->mutex = NULL;
+
+	(*store)->configurationAdminFactory = factory;
+
+	(*store)->configurations = hashMap_create(utils_stringHash, NULL, utils_stringEquals, NULL);
+//	(*store)->createdPidCount = 0;
+
+
+	if ( configurationStore_createCache( (*store) ) != CELIX_SUCCESS ){
+		printf("[ ERROR ]: ConfigStore - Not initialized (CACHE) \n");
+		return CELIX_ILLEGAL_ARGUMENT;
+	}
+
+	apr_status_t mutexStatus = apr_thread_mutex_create(&(*store)->mutex, APR_THREAD_MUTEX_UNNESTED, pool);
+	if( mutexStatus != APR_SUCCESS || (*store)->mutex == NULL ){
+		printf("[ ERROR ]: ConfigStore - Not initialized (MUTEX) \n");
+		return CELIX_ILLEGAL_ARGUMENT;
+	}
+
+	configurationStore_readCache( (*store) );
+
+	printf("[ SUCCESS ]: ConfigStore - Initialized \n");
+	return CELIX_SUCCESS;
+}
+
+
+
+/* ========== IMPLEMENTATION ==========  */
+
+/* ---------- public ---------- */
+// org.eclipse.equinox.internal.cm
+
+celix_status_t configurationStore_lock(configuration_store_pt store){
+	apr_thread_mutex_lock(store->mutex);
+	printf("[ SUCCESS ]: ConfigStore - LOCK \n");
+	return CELIX_SUCCESS;
+}
+
+celix_status_t configurationStore_unlock(configuration_store_pt store){
+	apr_thread_mutex_unlock(store->mutex);
+	printf("[ SUCCESS ]: ConfigStore - UNLOCK \n");
+	return CELIX_SUCCESS;
+}
+
+celix_status_t configurationStore_saveConfiguration(configuration_store_pt store, char *pid, configuration_pt configuration){
+
+	printf("[ DEBUG ]: ConfigStore - saveConfig{PID=%s} \n",pid);
+
+	celix_status_t status;
+
+	//(1) config.checkLocked
+
+	//(2) configurationStore.getFile
+	apr_file_t *configFile;
+	status = configurationStore_getConfigurationFile(pid, (char *)STORE_DIR, configuration, &configFile);
+	if (status != CELIX_SUCCESS){
+		return status;
+	}
+
+	//(4) configProperties = config.getAllProperties
+
+	properties_pt configProperties = NULL;
+	status = configuration_getAllProperties(configuration, &configProperties);
+	if (status != CELIX_SUCCESS){
+		printf("[ ERROR ]: ConfigStore - config{PID=%s}.getAllProperties \n",pid);
+		return status;
+	}
+
+	printf("properties_pt SIZE = %i \n", hashMap_size(configProperties));
+
+	//(5) configStore.writeFile(file,properties)
+	status = configurationStore_writeConfigurationFile(configFile, configProperties);
+	if (status != CELIX_SUCCESS){
+		return status;
+	}
+
+	return CELIX_SUCCESS;
+}
+
+celix_status_t configurationStore_removeConfiguration(configuration_store_pt store, char *pid){
+	return CELIX_SUCCESS;
+}
+
+celix_status_t configurationStore_getConfiguration(configuration_store_pt store, char *pid, char *location, configuration_pt *configuration){
+
+	celix_status_t status;
+
+	configuration_pt config;
+	config = hashMap_get(store->configurations,pid);
+
+	if (config == NULL){
+
+		status = configuration_create(store->configurationAdminFactory,store,NULL,pid,location,&config);
+		if ( status != CELIX_SUCCESS ){
+			printf("[ ERROR ]: ConfigStore - getConfig(PID=%s) (unable to create) \n",pid);
+			return status;
+		}
+
+		hashMap_put(store->configurations, pid, config);
+		printf("[ DEBUG ]: ConfigStore - getConfig(PID=%s) (new one stored) \n",pid);
+	}
+
+	*configuration = config;
+	return CELIX_SUCCESS;
+}
+
+celix_status_t configurationStore_createFactoryConfiguration(configuration_store_pt store, char *factoryPid, char *location, configuration_pt *configuration){
+	return CELIX_SUCCESS;
+}
+
+celix_status_t configurationStore_findConfiguration(configuration_store_pt store, char *pid, configuration_pt *configuration){
+
+	*configuration = hashMap_get(store->configurations,pid);
+	printf("[ DEBUG ]: ConfigStore - findConfig(PID=%s) \n",pid);
+	return CELIX_SUCCESS;
+
+}
+
+celix_status_t configurationStore_getFactoryConfigurations(configuration_store_pt store, char *factoryPid, configuration_pt *configuration){
+	return CELIX_SUCCESS;
+}
+
+celix_status_t configurationStore_listConfigurations(configuration_store_pt store, filter_pt filter, array_list_pt *configurations){
+	return CELIX_SUCCESS;
+}
+
+celix_status_t configurationStore_unbindConfigurations(configuration_store_pt store, bundle_pt bundle){
+	return CELIX_SUCCESS;
+}
+
+/* ---------- private ---------- */
+
+celix_status_t configurationStore_createCache(configuration_store_pt store){
+
+	apr_status_t cacheStat = apr_dir_make((const char*)STORE_DIR, APR_FPROT_OS_DEFAULT, store->pool);
+
+	if ( cacheStat == APR_SUCCESS || cacheStat == APR_EEXIST ){
+		printf("[ SUCCESS ]: ConfigStore - Cache OK \n");
+		return CELIX_SUCCESS;
+	}
+
+	printf("[ ERROR ]: ConfigStore - Create Cache \n");
+	return CELIX_FILE_IO_EXCEPTION;
+
+}
+
+celix_status_t configurationStore_getConfigurationFile(char *pid, char* storePath, configuration_pt configuration, apr_file_t **file){
+
+	// (1) The full path to the file
+	char *fname = strdup((const char *)storePath);
+	strcat(fname, strdup("/"));
+	strcat(fname, strdup((const char *)pid));
+	strcat(fname, strdup((const char *)PID_EXT));
+
+	printf("[ DEBUG ]: ConfigStore - getFile(%s) \n",fname);
+	// (2) configuration.getPool
+	apr_pool_t *fpool;
+	configuration_getPool(configuration, &fpool);
+
+	// (3) file.open
+	if ( apr_file_open(file, (const char*)fname, APR_FOPEN_CREATE|APR_FOPEN_WRITE, APR_FPROT_OS_DEFAULT, fpool) != APR_SUCCESS ){
+		printf("[ ERROR ]: ConfigStore - getFile(IO_EXCEPTION) \n");
+		return CELIX_FILE_IO_EXCEPTION;
+	}
+	return CELIX_SUCCESS;
+}
+
+
+celix_status_t configurationStore_writeConfigurationFile(apr_file_t *file, properties_pt properties){
+
+	printf("[ DEBUG ]: ConfigStore - write \n");
+
+	if (  properties == NULL || hashMap_size(properties) <= 0 ){
+		return CELIX_SUCCESS;
+	}
+	// size >0
+
+	char *buffer;
+	bool iterator0 = true;
+
+	hash_map_iterator_pt iterator = hashMapIterator_create(properties);
+	while (hashMapIterator_hasNext(iterator)) {
+
+		hash_map_entry_pt entry = hashMapIterator_nextEntry(iterator);
+
+		char * line = strdup(hashMapEntry_getKey(entry));
+		strcat(line, strdup("="));
+		strcat(line, strdup(hashMapEntry_getValue(entry)));
+		strcat(line, "\n");
+
+		if (iterator0){
+			buffer = line;
+			iterator0 = false;
+		}else{
+			strcat(buffer,strdup(line));
+		}
+	}
+
+	apr_size_t buffLength = strlen((const char *)buffer);
+	apr_size_t writtenBytes = buffLength;
+
+	if ( apr_file_write(file, (const void *)buffer, &writtenBytes) != APR_SUCCESS || writtenBytes != buffLength ){
+		printf("[ ERROR ]: ConfigStore - writing in Cache incomplete \n");
+		return CELIX_FILE_IO_EXCEPTION;
+	}
+
+	return CELIX_SUCCESS;
+
+}
+
+celix_status_t configurationStore_readCache(configuration_store_pt store){
+
+	celix_status_t status;
+
+	apr_dir_t *cache;	// directory handle
+	apr_finfo_t finfo;	// read file info
+
+	properties_pt properties = NULL;
+	configuration_pt configuration = NULL;
+	char *pid;
+
+
+	// (1) cache.open
+	if ( apr_dir_open(&cache, (const char *)STORE_DIR, store->pool) != APR_SUCCESS ){
+		printf("[ ERROR ]: ConfigStore - Read Cache \n");
+		return CELIX_FILE_IO_EXCEPTION;
+	}
+
+	// (2) directory.read
+	while ( apr_dir_read(&finfo, APR_FINFO_NAME | APR_FINFO_SIZE, cache) == APR_SUCCESS ){
+
+		if ( (strcmp((finfo.name), ".") != 0) && (strcmp((finfo.name), "..") != 0) && (strpbrk((finfo.name), "~") == NULL) ){
+
+			// (2.1) file.readData
+			status = configurationStore_readConfigurationFile(finfo.name , (apr_size_t)(finfo.size), &properties);
+			if ( status != CELIX_SUCCESS ){
+				return status;
+			}
+
+			// (2.2) new configuration
+			status = configuration_create2(store->configurationAdminFactory, store, properties, &configuration);
+			if ( status != CELIX_SUCCESS ){
+				return status;
+			}
+
+			// (2.3) configurations.put
+			configuration_getPid(configuration, &pid);
+			hashMap_put(store->configurations, pid, configuration);
+		}
+	}
+
+	return CELIX_SUCCESS;
+}
+
+celix_status_t configurationStore_readConfigurationFile(const char *name, apr_size_t size, properties_pt *dictionary){
+
+	apr_pool_t *fpool;	// file pool
+	apr_file_t *file;	// file handle
+	char *fname;		// file name
+	char *buffer;		// file buffer
+	apr_size_t readBytes = size;
+
+	properties_pt properties = NULL;
+
+	// (1) The full path to the file
+	fname = strdup((const char *)STORE_DIR);
+	strcat(fname, strdup("/"));
+	strcat(fname, strdup(name));
+
+	// (2) pool.new
+	if ( apr_pool_create(&fpool,NULL) != APR_SUCCESS ){
+		printf("[ ERROR ]: ConfigStore - Read File{%s} (ENOMEM) \n", name);
+		return CELIX_ENOMEM;
+	}
+
+	// (3) file.open
+	if ( apr_file_open(&file, (const char*)fname, APR_FOPEN_READ, APR_FPROT_OS_DEFAULT, fpool) != APR_SUCCESS ){
+		printf("[ ERROR ]: ConfigStore - open File{%s} for reading (IO_EXCEPTION) \n", name);
+		return CELIX_FILE_IO_EXCEPTION;
+	}
+
+	// (4) buffer.new
+	buffer = apr_palloc(fpool, size);
+	if (!buffer) {
+		return CELIX_ENOMEM;
+	}
+
+	// (5) file.read
+	if ( apr_file_read(file, (void *)buffer, &readBytes) != APR_SUCCESS || readBytes != size ){
+		printf("[ ERROR ]: ConfigStore - reading File{%s} \n", name);
+		return CELIX_FILE_IO_EXCEPTION;
+	}
+
+	if ( configurationStore_parseDataConfigurationFile(buffer, &properties) != CELIX_SUCCESS ){
+		printf("[ ERROR ]: ConfigStore - parsing data File{%s} \n", name);
+		return CELIX_ILLEGAL_ARGUMENT;
+	}
+
+	// (6) file.close & buffer.destroy
+	apr_pool_destroy (fpool);
+
+	// (7) return
+	*dictionary = properties;
+	return CELIX_SUCCESS;
+
+}
+
+celix_status_t configurationStore_parseDataConfigurationFile(char *data, properties_pt *dictionary){
+
+	properties_pt properties = properties_create();
+
+	char *token;
+	char *key;
+	char *value;
+
+	bool isKey = true;
+	token = strtok (data,"=");
+
+	while ( token != NULL ){
+
+		if ( isKey ){
+			key = strdup(token);
+			isKey = false;
+		}else{ // isValue
+			value = strdup(token);
+			properties_set(properties, key, value);
+			isKey = true;
+		}
+
+		token = strtok (NULL, "=\n");
+
+	}
+
+	if ( hashMap_isEmpty(properties) ){
+		return CELIX_ILLEGAL_ARGUMENT;
+	}
+
+	*dictionary = properties;
+	return CELIX_SUCCESS;
+}

Added: celix/branches/celix_config_admin/config_admin/service/private/src/framework_patch.c
URL: http://svn.apache.org/viewvc/celix/branches/celix_config_admin/config_admin/service/private/src/framework_patch.c?rev=1633678&view=auto
==============================================================================
--- celix/branches/celix_config_admin/config_admin/service/private/src/framework_patch.c (added)
+++ celix/branches/celix_config_admin/config_admin/service/private/src/framework_patch.c Wed Oct 22 18:53:39 2014
@@ -0,0 +1,60 @@
+/**
+ *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.
+ */
+/*
+ * framework_patch.c
+ *
+ *  \date       Aug 12, 2013
+ *  \author    	<a href="mailto:celix-dev@incubator.apache.org">Apache Celix Project Team</a>
+ *  \copyright	Apache License, Version 2.0
+ */
+
+
+#include "framework_patch.h"
+
+#include <stdlib.h>
+#include <stdio.h>
+/* celix.framework.public */
+#include "celix_errno.h"
+#include "bundle.h"
+#include "bundle_archive.h"
+#include "properties.h"
+#include "hash_map.h"
+
+
+celix_status_t bundle_getBundleLocation(bundle_pt bundle, char **location){
+
+	celix_status_t status;
+
+	bundle_archive_pt archive = NULL;
+
+	status = bundle_getArchive(bundle, &archive);
+	if (status != CELIX_SUCCESS){
+		printf("[ ERROR ]: Bundle - getBundleLocation (BundleArchive) \n");
+		return status;
+	}
+
+	status =  bundleArchive_getLocation(archive, location);
+	if (status != CELIX_SUCCESS){
+		printf("[ ERROR ]:  Bundle - getBundleLocation (BundleArchiveLocation) \n");
+		return status;
+	}
+
+	return CELIX_SUCCESS;
+}
+

Added: celix/branches/celix_config_admin/config_admin/service/private/src/managed_service_impl.c
URL: http://svn.apache.org/viewvc/celix/branches/celix_config_admin/config_admin/service/private/src/managed_service_impl.c?rev=1633678&view=auto
==============================================================================
--- celix/branches/celix_config_admin/config_admin/service/private/src/managed_service_impl.c (added)
+++ celix/branches/celix_config_admin/config_admin/service/private/src/managed_service_impl.c Wed Oct 22 18:53:39 2014
@@ -0,0 +1,61 @@
+/**
+ *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.
+ */
+/*
+ * managed_service_impl.c
+ *
+ *  \date       Aug 12, 2013
+ *  \author    	<a href="mailto:celix-dev@incubator.apache.org">Apache Celix Project Team</a>
+ *  \copyright	Apache License, Version 2.0
+ */
+
+
+#include <stdlib.h>
+#include <stdio.h>
+
+/* celix.config_admin.ManagedService */
+#include "managed_service.h"
+
+/* APR */
+#include <apr_general.h>
+
+
+/* ------------------------ Constructor -------------------------------------*/
+
+celix_status_t managedService_create(bundle_context_pt context, managed_service_service_pt *service){
+
+	celix_status_t status;
+
+	apr_pool_t *pool;
+	status = bundleContext_getMemoryPool(context,&pool);
+
+	if (status != CELIX_SUCCESS){
+		printf("[ ERROR ]: ManagedService not initialized \n");
+		return status;
+	}
+
+	managed_service_service_pt managedServiceService = apr_palloc(pool,sizeof(*managedServiceService));
+	if(!managedServiceService){
+		printf("[ ERROR ]: ManagedService Service not initialized \n");
+		return CELIX_ENOMEM;
+	}
+
+	*service = managedServiceService;
+	return CELIX_SUCCESS;
+
+}

Added: celix/branches/celix_config_admin/config_admin/service/private/src/managed_service_tracker.c
URL: http://svn.apache.org/viewvc/celix/branches/celix_config_admin/config_admin/service/private/src/managed_service_tracker.c?rev=1633678&view=auto
==============================================================================
--- celix/branches/celix_config_admin/config_admin/service/private/src/managed_service_tracker.c (added)
+++ celix/branches/celix_config_admin/config_admin/service/private/src/managed_service_tracker.c Wed Oct 22 18:53:39 2014
@@ -0,0 +1,588 @@
+/**
+ *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.
+ */
+/*
+ * managed_service_tracker.c
+ *
+ *  \date       Aug 12, 2013
+ *  \author    	<a href="mailto:celix-dev@incubator.apache.org">Apache Celix Project Team</a>
+ *  \copyright	Apache License, Version 2.0
+ */
+
+
+#include <stdbool.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+
+/* celix.config_admin.ManagedServiceTracker */
+#include "managed_service_tracker.h"
+#include "service_tracker_customizer.h"
+
+/* APR */
+#include <apr_thread_mutex.h>
+/* celix.utils */
+#include "hash_map.h"
+/* celix.framework */
+#include "constants.h"
+#include "properties.h"
+#include "utils.h"
+/* celix.framework.Patch*/
+#include "framework_patch.h"
+/* celix.config_admin.public */
+#include "managed_service.h"
+/* celix.config_admin.private */
+#include "configuration_impl.h"
+#include "updated_thread_pool.h"
+
+
+struct managed_service_tracker{
+
+	apr_pool_t 		*pool;
+	bundle_context_pt 	context;
+
+	configuration_admin_factory_pt configurationAdminfactory;
+	configuration_store_pt configurationStore;
+	updated_thread_pool_t updatedThreadPool;// according to org.equinox is our "SerializableTaskQueue"
+
+	apr_thread_mutex_t *managedServicesReferencesMutex;
+	hash_map_pt managedServices;
+	hash_map_pt managedServicesReferences;
+
+};
+
+static celix_status_t managedServiceTracker_createHandle(apr_pool_t *pool, bundle_context_pt context, configuration_admin_factory_pt factory,
+														 configuration_store_pt store,managed_service_tracker_t *tracker);
+static celix_status_t managedServiceTracker_createCustomized(apr_pool_t *pool, bundle_context_pt context,
+													  	  	 managed_service_tracker_t trackerHandle, service_tracker_pt *tracker);
+
+static celix_status_t managedServiceTracker_add(managed_service_tracker_t tracker, service_reference_pt reference, char * pid, managed_service_service_pt service);
+static celix_status_t managedServiceTracker_remove(managed_service_tracker_t tracker, service_reference_pt reference, char * pid);
+static celix_status_t managedServiceTracker_trackManagedService(managed_service_tracker_t tracker, char *pid, service_reference_pt reference, managed_service_service_pt service);
+static celix_status_t managedServiceTracker_untrackManagedService(managed_service_tracker_t tracker, char *pid, service_reference_pt reference);
+static celix_status_t managedServiceTracker_getManagedService(managed_service_tracker_t tracker, char *pid, managed_service_service_pt *service);
+static celix_status_t managedServiceTracker_getManagedServiceReference(managed_service_tracker_t tracker, char *pid, service_reference_pt *reference);
+static celix_status_t managedServiceTracker_getPidForManagedService(managed_service_service_pt *service, char **pid);
+static celix_status_t managedServiceTracker_asynchUpdated(managed_service_tracker_t trackerHandle, managed_service_service_pt service, properties_pt properties);
+
+static celix_status_t managedServiceTracker_getBundleContext(managed_service_tracker_t trackerHandle, bundle_context_pt *context);
+
+static celix_status_t managedServiceTracker_lockManagedServicesReferences(managed_service_tracker_t handle);
+static celix_status_t managedServiceTracker_unlockManagedServicesReferences(managed_service_tracker_t handle);
+
+/* ========== CONSTRUCTOR ========== */
+
+/* ---------- public ---------- */
+
+celix_status_t managedServiceTracker_create(apr_pool_t *pool, bundle_context_pt context,
+											configuration_admin_factory_pt factory, configuration_store_pt store,
+											managed_service_tracker_t *trackerHandle, service_tracker_pt *tracker){
+
+	celix_status_t status;
+
+	managed_service_tracker_t managedServiceTrackerHandle;
+	service_tracker_pt managedServiceTrackerCustomized;
+
+	status = managedServiceTracker_createHandle(pool, context, factory, store, &managedServiceTrackerHandle);
+	if (status != CELIX_SUCCESS){
+		*trackerHandle = NULL;
+		*tracker = NULL;
+		return status;
+	}
+
+	status = managedServiceTracker_createCustomized(pool, context, managedServiceTrackerHandle, &managedServiceTrackerCustomized);
+	if (status != CELIX_SUCCESS){
+		*trackerHandle = NULL;
+		*tracker = NULL;
+		return status;
+	}
+	*trackerHandle = managedServiceTrackerHandle;
+	*tracker = managedServiceTrackerCustomized;
+
+	printf("[ SUCCESS ]: Tracker - Initialized \n");
+	return CELIX_SUCCESS;
+
+}
+
+/* ---------- private ---------- */
+
+celix_status_t managedServiceTracker_createHandle(apr_pool_t *pool, bundle_context_pt context,
+											configuration_admin_factory_pt factory, configuration_store_pt store,
+											managed_service_tracker_t *tracker){
+
+	celix_status_t status;
+
+	updated_thread_pool_t updatedThreadPool = NULL;
+	managed_service_tracker_t this = apr_palloc(pool, sizeof(*this));
+
+	if (!this){
+		printf("[ ERROR ]: TrackerInstance - Not initialized (ENOMEM) \n");
+		*tracker = NULL;
+		return CELIX_ENOMEM;
+	}
+
+	status = updatedThreadPool_create(pool, context, (apr_int64_t)MAX_THREADS, &updatedThreadPool);
+	if ( status != CELIX_SUCCESS ){
+		return status;
+	}
+
+	this->pool = pool;
+	this->context = context;
+
+	this->configurationAdminfactory = factory;
+	this->configurationStore = store;
+	this->updatedThreadPool = updatedThreadPool;
+
+	this->managedServicesReferencesMutex = NULL;
+	this->managedServices = hashMap_create(utils_stringHash, NULL, utils_stringEquals, NULL);
+	this->managedServicesReferences = hashMap_create(utils_stringHash, NULL, utils_stringEquals, NULL);
+
+
+	apr_status_t mutexStatus = apr_thread_mutex_create(&this->managedServicesReferencesMutex, APR_THREAD_MUTEX_UNNESTED, pool);
+	if( mutexStatus != APR_SUCCESS || this->managedServicesReferencesMutex == NULL ){
+		printf("[ ERROR ]: TrackerInstance - Not initialized (MUTEX) \n");
+		return CELIX_ILLEGAL_ARGUMENT;
+	}
+
+	*tracker = this;
+	return CELIX_SUCCESS;
+
+}
+
+celix_status_t managedServiceTracker_createCustomized(apr_pool_t *pool, bundle_context_pt context,
+													  	  	 managed_service_tracker_t trackerHandle, service_tracker_pt *tracker){
+
+	celix_status_t status = CELIX_SUCCESS;
+
+	//TODO use create
+	//serviceTrackerCustomizer_create
+
+	service_tracker_customizer_pt customizer = apr_palloc(pool, sizeof(struct serviceTrackerCustomizer));
+	service_tracker_pt managedServiceTracker = NULL;
+
+
+	if(!customizer){
+		printf("[ ERROR ]: TrackerCustomized - Not initialized(ENOMEM) \n");
+		*tracker = NULL;
+		return CELIX_ENOMEM;
+	}
+
+	customizer->handle= trackerHandle;
+	customizer->addingService=managedServiceTracker_addingService;
+	customizer->addedService=managedServiceTracker_addedService;
+	customizer->modifiedService=managedServiceTracker_modifiedService;
+	customizer->removedService=managedServiceTracker_removedService;
+
+	status = serviceTracker_create(pool, context, (char *) MANAGED_SERVICE_SERVICE_NAME, customizer, &managedServiceTracker);
+	if (status != CELIX_SUCCESS) {
+		printf("[ ERROR ]: TrackerCustomized - Not created \n");
+		*tracker = NULL;
+		return status;
+	}
+
+	*tracker = managedServiceTracker;
+	return CELIX_SUCCESS;
+}
+
+
+/* ========== IMPLEMENTS CUSTOMIZED TRACKER ========== */
+
+/* ---------- public ---------- */
+
+celix_status_t managedServiceTracker_addingService(void * handle, service_reference_pt reference, void **service){
+
+	printf("[ DEBUG ]: Tracker - Adding Service \n");
+
+	celix_status_t status;
+
+	void *pid = NULL;
+
+	bundle_context_pt context = NULL;
+
+	managed_service_tracker_t managedServiceTracker_i = handle;	//instance
+	managed_service_service_pt managedService_s = NULL;			//service
+
+	// (1) reference.getPid
+
+	if ( serviceReference_getProperty(reference, (char *)SERVICE_PID, &pid) != CELIX_SUCCESS || pid == NULL){
+		*service = NULL;
+		printf(" [ ERROR ]: Tracker - PID is NULL \n");
+		return CELIX_ILLEGAL_ARGUMENT;
+	}
+
+
+	// (2) context.getManagedServiceService
+
+	// (2.1) trackerInstance.getBundleContext
+
+	if ( managedServiceTracker_getBundleContext(managedServiceTracker_i, &context) != CELIX_SUCCESS ){
+		*service = NULL;
+		printf(" [ ERROR ]: Tracker - NULL bundleContext \n");
+		return CELIX_ILLEGAL_ARGUMENT;
+	}
+
+
+	// (2.2) context.getManagedServiceService
+
+	if( bundleContext_getService(context, reference, (void*) &managedService_s) != CELIX_SUCCESS ){
+		printf("[ ERROR ]: Tracker - AddingService ( BundleContext - getService{PID=%s} ) \n", pid);
+		*service = NULL;
+		return CELIX_ILLEGAL_ARGUMENT;
+	}
+	if ( managedService_s == NULL ){
+		printf("[ WARNING ]: Tracker - AddingService (none Service{PID=%s}) \n",pid);
+		*service = NULL;
+		return CELIX_ILLEGAL_ARGUMENT;
+	}
+
+	/* DEBUG CODE */
+
+		service_registration_pt registration = NULL;
+		serviceReference_getServiceRegistration(reference, &registration);
+		char *serviceName = NULL;
+		serviceRegistration_getServiceName(registration, &serviceName);
+
+		printf("[ DEBUG ]: Tracker - AddingService ( SUCCESS BundleCtxt - getService{Name=%s,PID=%s}  ) \n",serviceName, pid);
+
+	/* ENF OF DEBUG CODE */
+
+	// (3) trackerInstance.AddManagedServiceToLocalList
+
+	configurationStore_lock( managedServiceTracker_i->configurationStore );
+
+	status = managedServiceTracker_add(managedServiceTracker_i, reference, pid, managedService_s);
+
+	configurationStore_unlock( managedServiceTracker_i->configurationStore );
+
+	if ( status != CELIX_SUCCESS ){
+		*service = NULL;
+	}else{
+		*service = &managedService_s;
+	}
+
+	return status;
+
+}
+
+celix_status_t managedServiceTracker_addedService(void * handle, service_reference_pt reference, void * service){
+	return CELIX_SUCCESS;
+}
+
+celix_status_t managedServiceTracker_modifiedService(void * handle, service_reference_pt reference, void * service){
+	return CELIX_SUCCESS;
+}
+
+celix_status_t managedServiceTracker_removedService(void * handle, service_reference_pt reference, void * service){
+	return CELIX_SUCCESS;
+}
+
+
+/* ---------- private ---------- */
+// org.eclipse.equinox.internal.cm.ManagedServiceTracker
+
+celix_status_t managedServiceTracker_add(managed_service_tracker_t tracker, service_reference_pt reference, char *pid, managed_service_service_pt service){
+
+	printf("[ DEBUG ]: Tracker - Add (Service{PID=%s}) \n", pid);
+
+	celix_status_t status;
+
+	bundle_pt bundle = NULL;
+	char *bundleLocation;
+
+	configuration_pt configuration = NULL;
+	properties_pt properties = NULL;
+
+
+	configurationStore_findConfiguration(tracker->configurationStore, pid, &configuration);
+
+	if (configuration == NULL){
+
+		if ( managedServiceTracker_trackManagedService(tracker, pid, reference, service) == CELIX_SUCCESS ){
+
+			// TODO : this is new code, it hasn't been tested yet
+
+			if ( serviceReference_getBundle(reference, &bundle) != CELIX_SUCCESS ){
+				return CELIX_ILLEGAL_ARGUMENT;
+			}
+
+			if ( bundle_getBundleLocation(bundle, &bundleLocation) != CELIX_SUCCESS ){
+				return CELIX_ILLEGAL_ARGUMENT;
+			}
+
+			// (1) creates a new Configuration for the ManagedService
+			if ( configurationStore_getConfiguration(tracker->configurationStore, pid, bundleLocation, &configuration) != CELIX_SUCCESS || configuration == NULL ){
+				return CELIX_ILLEGAL_ARGUMENT;
+			}
+
+			// (2) bind the Configuration with the ManagedService
+			bool dummy;
+			if ( (configuration_bind(configuration, bundle, &dummy) != CELIX_SUCCESS) ){
+				return CELIX_ILLEGAL_ARGUMENT;
+			}
+
+			// (3) the new Configuration is persisted and visible for other ConfigAdmin instances
+			if ( configurationStore_saveConfiguration(tracker->configurationStore, pid, configuration) != CELIX_SUCCESS ){
+				return CELIX_ILLEGAL_STATE;
+			}
+
+			// End of new code
+
+			printf("[ SUCCESS ]: Tracker - Add (Service{PID=%s} tracked) \n", pid);
+
+			// TODO: It must be considered in case of fail if untrack the ManagedService
+
+			printf("[ DEBUG ]: Tracker - Add (Service{PID=%s} AsynchUpdated - NULL props) \n",pid);
+			return managedServiceTracker_asynchUpdated(tracker, service, NULL);
+
+
+
+		}else {
+			return CELIX_ILLEGAL_ARGUMENT; // the service was already tracked
+		}
+
+	} else{
+
+		printf("[ DEBUG ]: Tracker - Add (Service{PID=%s} - LOCK Config) \n",pid);
+		configuration_lock(configuration);
+
+		if ( managedServiceTracker_trackManagedService(tracker, pid, reference, service) == CELIX_SUCCESS ){
+
+			if ( serviceReference_getBundle(reference, &bundle) != CELIX_SUCCESS){
+				configuration_unlock(configuration);
+				printf("[ERROR ]: Tracker - Add (Service{PID=%s} Reference - getBundle NULL)",pid);
+				return CELIX_ILLEGAL_ARGUMENT;
+			}
+
+			// TODO configuration.isDeleted ? - with only using one calling bundle OK
+
+			bool isBind;
+			if ( (configuration_bind(configuration, bundle, &isBind) == CELIX_SUCCESS) && (isBind == true) ){ // config.bind(bundle)
+
+				if ( configuration_getProperties(configuration, &properties) != CELIX_SUCCESS ){
+					configuration_unlock(configuration);
+					return CELIX_ILLEGAL_ARGUMENT;
+				}
+
+				if ( configurationAdminFactory_modifyConfiguration(tracker->configurationAdminfactory, reference, properties) != CELIX_SUCCESS ){
+					configuration_unlock(configuration);
+					return CELIX_ILLEGAL_ARGUMENT;
+				}
+				printf("[ DEBUG ]: Tracker - Add Service{PID=%s} (AsynchUpdated - existing Configuration) \n",pid);
+
+				status = managedServiceTracker_asynchUpdated(tracker, service, properties);
+				printf("[ DEBUG ]: Tracker - Add Service{PID=%s} (UNLOCK Config) \n",pid);
+
+				configuration_unlock(configuration);
+
+				return status;
+
+			}else{
+				printf("[ WARNING ]: Tracker - Add Service{PID=%s} ( Configuration for Service(PID=%s) could not be bound ) $s \n", pid);
+				configuration_unlock(configuration);
+				return CELIX_ILLEGAL_STATE;
+			}
+
+		}else{
+			configuration_unlock(configuration);
+			return CELIX_ILLEGAL_ARGUMENT; // the service was already tracked
+		}
+	}
+}
+
+celix_status_t managedServiceTracker_remove(managed_service_tracker_t tracker, service_reference_pt reference, char * pid){
+	return CELIX_SUCCESS;
+}
+
+celix_status_t managedServiceTracker_trackManagedService(managed_service_tracker_t tracker, char *pid, service_reference_pt reference, managed_service_service_pt service){
+
+	managedServiceTracker_lockManagedServicesReferences(tracker);
+
+	if ( hashMap_containsKey(tracker->managedServicesReferences, pid) ){
+		printf("[ WARNING ]: Tracker - Track ( Service{PID=%s} already registered ) ", pid);
+		managedServiceTracker_unlockManagedServicesReferences(tracker);
+		return CELIX_ILLEGAL_ARGUMENT;
+	}
+
+	hashMap_put(tracker->managedServicesReferences, pid, reference);
+	hashMap_put(tracker->managedServices, pid, service);
+
+	managedServiceTracker_unlockManagedServicesReferences(tracker);
+
+	return CELIX_SUCCESS;
+}
+
+celix_status_t managedServiceTracker_untrackManagedService(managed_service_tracker_t tracker, char *pid, service_reference_pt reference){
+	return CELIX_SUCCESS;
+}
+
+celix_status_t managedServiceTracker_getManagedService(managed_service_tracker_t tracker, char *pid, managed_service_service_pt *service){
+
+	celix_status_t status;
+	managed_service_service_pt serv = NULL;
+
+	managedServiceTracker_lockManagedServicesReferences(tracker);
+
+	serv = hashMap_get(tracker->managedServices,pid);
+	if (serv == NULL){
+		status = CELIX_ILLEGAL_ARGUMENT;
+	} else{
+		status = CELIX_SUCCESS;
+	}
+
+	managedServiceTracker_unlockManagedServicesReferences(tracker);
+
+	*service = serv;
+	return status;
+}
+
+celix_status_t managedServiceTracker_getManagedServiceReference(managed_service_tracker_t tracker, char *pid, service_reference_pt *reference){
+
+	celix_status_t status;
+	service_reference_pt ref = NULL;
+
+	managedServiceTracker_lockManagedServicesReferences(tracker);
+
+	ref = hashMap_get(tracker->managedServicesReferences,pid);
+	if (ref == NULL){
+		status = CELIX_ILLEGAL_ARGUMENT;
+	} else{
+		status = CELIX_SUCCESS;
+	}
+
+	managedServiceTracker_unlockManagedServicesReferences(tracker);
+
+	*reference = ref;
+	return status;
+}
+
+celix_status_t managedServiceTracker_getPidForManagedService(managed_service_service_pt *service, char **pid){
+	return CELIX_SUCCESS;
+}
+
+celix_status_t managedServiceTracker_asynchUpdated(managed_service_tracker_t trackerHandle, managed_service_service_pt service, properties_pt properties){
+
+	return updatedThreadPool_push(trackerHandle->updatedThreadPool, service, properties);
+
+}
+
+
+/* ========== IMPLEMENTENTATION  ========== */
+
+/* ---------- public ---------- */
+
+celix_status_t managedServiceTracker_notifyDeleted(managed_service_tracker_t tracker, configuration_pt configuration){
+	return CELIX_SUCCESS;
+}
+
+celix_status_t managedServiceTracker_notifyUpdated(managed_service_tracker_t tracker, configuration_pt configuration){
+
+	printf("[ DEBUG ]: Tracker - NotifyUpdated \n");
+
+	char *pid;
+
+	service_reference_pt reference = NULL;
+	bundle_pt bundle = NULL;
+	properties_pt properties = NULL;
+
+	managed_service_service_pt service = NULL;
+
+	// (1) config.checkLocked
+	if ( configuration_checkLocked(configuration) != CELIX_SUCCESS){ //TODO not yet implemented
+		return CELIX_ILLEGAL_ARGUMENT;
+	}
+
+	// (2) config.getPid
+	if (configuration_getPid(configuration, &pid) != CELIX_SUCCESS ){
+		return CELIX_ILLEGAL_ARGUMENT;
+	}
+
+	// (3) reference = getManagedServiceReference(pid)
+	if ( managedServiceTracker_getManagedServiceReference(tracker, pid, &reference) != CELIX_SUCCESS || reference == NULL ){
+		printf("[ ERROR ]: Tracker - Notify (NULL Reference Service{PID=%s}) \n", pid);
+		return CELIX_ILLEGAL_ARGUMENT; // Eclipse ignores, but according to Specs, callback is delayed
+	}
+
+	//  (4.1) reference.getBundle
+	if ( serviceReference_getBundle(reference, &bundle) != CELIX_SUCCESS || bundle == NULL ){
+		printf("[ ERROR ]: Tracker - Notify (NULL Bundle Service{PID=%s}) \n", pid);
+		return CELIX_ILLEGAL_ARGUMENT;
+	}
+
+	//	(4.2) config.bind(reference.getBundle)
+	bool isBind;
+	if ( configuration_bind(configuration, bundle, &isBind) != CELIX_SUCCESS || isBind == false){
+		printf("[ ERROR ]: Tracker - Notify (Service{PID=%s} Permission Error) \n", pid);
+		return CELIX_ILLEGAL_STATE;
+	}
+
+	// (5) if (reference != null && config.bind(reference.getBundle()))
+
+	// (5.1) properties = config.getProperties
+	if ( configuration_getProperties(configuration, &properties) != CELIX_SUCCESS ){
+		printf("[ ERROR ]: Tracker - Notify (Service{PID=%s} Wrong Properties) \n", pid);
+		return CELIX_ILLEGAL_ARGUMENT;
+	}
+
+	// (5.2) modifyConfiguration
+	if ( configurationAdminFactory_modifyConfiguration(tracker->configurationAdminfactory, reference, properties) != CELIX_SUCCESS ){
+		return CELIX_ILLEGAL_ARGUMENT; //TODO no yet implemented modifyConfiguration
+	}
+
+	// (5.3) service = getManagedService(pid)
+	if ( managedServiceTracker_getManagedService(tracker, pid, &service) !=  CELIX_SUCCESS ){
+		printf("[ ERROR ]: Tracker - Notify (NULL Service{PID=%s}) \n", pid);
+		return CELIX_ILLEGAL_ARGUMENT;
+	}
+
+	// (5.4) asynchUpdate(service,properties)
+	if ( (properties == NULL) || (properties != NULL && hashMap_size(properties) == 0) ){
+		printf("[ DEBUG ]: Tracker - Notify (AsynchUpdated Service{PID=%s} - NULL props) \n",pid);
+		return managedServiceTracker_asynchUpdated(tracker, service, NULL);
+	}else{
+		printf("[ DEBUG ]: Tracker - Notify (AsynchUpdated Service{PID=%s} - existing props) \n",pid);
+		return managedServiceTracker_asynchUpdated(tracker, service, properties);
+	}
+}
+
+/* ---------- private ---------- */
+
+celix_status_t managedServiceTracker_getBundleContext(managed_service_tracker_t trackerHandle, bundle_context_pt *context){
+
+	if(trackerHandle->context != NULL){
+		*context = trackerHandle->context;
+		return CELIX_SUCCESS;
+	}else{
+		printf("[ ERROR ]: Tracker - getBundleContext (NULL context) \n");
+		*context = NULL;
+		return CELIX_ILLEGAL_ARGUMENT;
+	}
+}
+
+celix_status_t managedServiceTracker_lockManagedServicesReferences(managed_service_tracker_t handle){
+
+	apr_thread_mutex_lock(handle->managedServicesReferencesMutex);
+	return CELIX_SUCCESS;
+
+}
+
+celix_status_t managedServiceTracker_unlockManagedServicesReferences(managed_service_tracker_t handle){
+
+	apr_thread_mutex_unlock(handle->managedServicesReferencesMutex);
+	return CELIX_SUCCESS;
+
+}

Added: celix/branches/celix_config_admin/config_admin/service/private/src/updated_thread_pool.c
URL: http://svn.apache.org/viewvc/celix/branches/celix_config_admin/config_admin/service/private/src/updated_thread_pool.c?rev=1633678&view=auto
==============================================================================
--- celix/branches/celix_config_admin/config_admin/service/private/src/updated_thread_pool.c (added)
+++ celix/branches/celix_config_admin/config_admin/service/private/src/updated_thread_pool.c Wed Oct 22 18:53:39 2014
@@ -0,0 +1,173 @@
+/**
+ *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.
+ */
+/*
+ * updated_thread_pool.c
+ *
+ *  \date       Aug 12, 2013
+ *  \author    	<a href="mailto:celix-dev@incubator.apache.org">Apache Celix Project Team</a>
+ *  \copyright	Apache License, Version 2.0
+ */
+
+
+#include <stdbool.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+
+/* celix.config_admin.UpdatedThreadPool */
+#include "updated_thread_pool.h"
+
+/* APR */
+#include <apr_thread_mutex.h>
+#include <apr_thread_pool.h>
+
+
+struct updated_thread_pool{
+
+	apr_pool_t 		*pool;
+	bundle_context_pt 	context;
+
+	apr_int64_t maxTreads;
+
+	//	apr_thread_mutex_t *mutex;
+	apr_thread_pool_t *threadPool;	//protected by mutex
+
+};
+
+typedef struct data_callback *data_callback_t;
+
+struct data_callback{
+
+	apr_pool_t 		*pool;	//independent pool
+
+	managed_service_service_pt managedServiceService;
+	properties_pt properties;
+
+};
+
+
+static void *APR_THREAD_FUNC updateThreadPool_updatedCallback(apr_thread_t *thread, void *data);
+static celix_status_t updatedThreadPool_wrapDataCallback(managed_service_service_pt service, properties_pt properties, data_callback_t *data);
+
+
+/* ========== CONSTRUCTOR ========== */
+
+/* ---------- public ---------- */
+
+celix_status_t updatedThreadPool_create(apr_pool_t *pool, bundle_context_pt context, apr_int64_t maxTreads, updated_thread_pool_t *updatedThreadPool){
+
+	*updatedThreadPool = apr_palloc(pool, sizeof(**updatedThreadPool));
+	if (!*updatedThreadPool){
+		printf("[ ERROR ]: UpdatedThreadPool - Not initialized (ENOMEM) \n");
+		return CELIX_ENOMEM;
+	}
+
+	if ( apr_thread_pool_create(&(*updatedThreadPool)->threadPool, INIT_THREADS, maxTreads, pool) != APR_SUCCESS ){
+		printf("[ ERROR ]: UpdatedThreadPool - Instance not created \n");
+		return CELIX_ENOMEM;
+	}
+
+	(*updatedThreadPool)->pool = pool;
+	(*updatedThreadPool)->context = context;
+
+	(*updatedThreadPool)->maxTreads = maxTreads;
+
+	printf("[ SUCCESS ]: UpdatedThreadPool - initialized \n");
+	return CELIX_SUCCESS;
+
+}
+
+/* ========== IMPLEMENTATION ========== */
+
+/* ---------- public ---------- */
+
+celix_status_t updatedThreadPool_push(updated_thread_pool_t updatedThreadPool, managed_service_service_pt service, properties_pt properties){
+
+	data_callback_t data = NULL;
+
+	// TODO apr_thread_mutex_lock(instance->mutex)?
+
+	if ( apr_thread_pool_busy_count(updatedThreadPool->threadPool) < updatedThreadPool->maxTreads ) {
+
+		if ( updatedThreadPool_wrapDataCallback(service, properties, &data) != CELIX_SUCCESS ){
+			return CELIX_ILLEGAL_ARGUMENT;
+		}
+
+
+		if ( apr_thread_pool_push(updatedThreadPool->threadPool, updateThreadPool_updatedCallback, data,
+				APR_THREAD_TASK_PRIORITY_NORMAL, NULL) != APR_SUCCESS ){
+
+			printf("[ ERROR ]: UpdatedThreadPool - Push (apr_thread_pool_push) \n ");
+			return CELIX_ILLEGAL_STATE;
+
+		}
+
+	} else {
+
+		printf("[ ERROR ]: UpdatedThreadPool - Push (Full!) \n ");
+		return CELIX_ILLEGAL_STATE;
+
+	}
+
+	printf("[ SUCCESS ]:  UpdatedThreadPool - Push \n");
+	return CELIX_SUCCESS;
+}
+
+/* ---------- private ---------- */
+
+void *APR_THREAD_FUNC updateThreadPool_updatedCallback(apr_thread_t *thread, void *data) {
+
+
+	printf("[ DEBUG ]: UpdatedThreadPool - Callback \n");
+
+	data_callback_t params = data;
+
+	managed_service_service_pt managedServiceService = params->managedServiceService;
+	properties_pt properties = params->properties;
+
+	apr_pool_destroy(params->pool);
+
+	(*managedServiceService->updated)(managedServiceService->managedService, properties);
+
+	return NULL;
+
+}
+
+celix_status_t updatedThreadPool_wrapDataCallback(managed_service_service_pt service, properties_pt properties, data_callback_t *data){
+
+	apr_pool_t *pool;
+
+	if ( apr_pool_create(&pool,NULL) != APR_SUCCESS ){
+		printf("[ ERROR ]: UpdatedThreadPool - WrapDataCallback (Data not created) \n");
+		return CELIX_ILLEGAL_ARGUMENT;
+	}
+
+	*data = apr_palloc(pool, sizeof(**data));
+	if (!*data){
+		printf("[ ERROR ]: UpdatedThreadPool - WrapDataCallback (Data not initialized) \n");
+		return CELIX_ENOMEM;
+	}
+
+	(*data)->pool = pool;
+	(*data)->managedServiceService = service;
+	(*data)->properties = properties;
+
+	return CELIX_SUCCESS;
+}
+

Added: celix/branches/celix_config_admin/config_admin/service/public/include/configuration.h
URL: http://svn.apache.org/viewvc/celix/branches/celix_config_admin/config_admin/service/public/include/configuration.h?rev=1633678&view=auto
==============================================================================
--- celix/branches/celix_config_admin/config_admin/service/public/include/configuration.h (added)
+++ celix/branches/celix_config_admin/config_admin/service/public/include/configuration.h Wed Oct 22 18:53:39 2014
@@ -0,0 +1,57 @@
+/**
+ *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.
+ */
+/*
+ * configuration.h
+ *
+ *  \date       Aug 12, 2013
+ *  \author    	<a href="mailto:celix-dev@incubator.apache.org">Apache Celix Project Team</a>
+ *  \copyright	Apache License, Version 2.0
+ */
+
+
+#ifndef CONFIGURATION_H_
+#define CONFIGURATION_H_
+
+
+#include <stdbool.h>
+/* celix.framework */
+#include "celix_errno.h"
+#include "properties.h"
+
+
+typedef struct configuration *configuration_pt;
+
+/* METHODS */
+celix_status_t configuration_delete(configuration_pt configuration);
+
+celix_status_t configuration_equals(configuration_pt thisConfiguration, configuration_pt otherConfiguration, bool *equals);
+
+celix_status_t configuration_getBundleLocation(configuration_pt configuration, char **bundleLocation);
+celix_status_t configuration_getFactoryPid(configuration_pt configuration, char **factoryPid);
+celix_status_t configuration_getPid(configuration_pt configuration, char **pid);
+celix_status_t configuration_getProperties(configuration_pt configuration, properties_pt *properties);
+
+celix_status_t configuration_hashCode(configuration_pt configuration, int *hashCode);
+
+celix_status_t configuration_setBundleLocation(configuration_pt configuration, char *bundleLocation);
+
+celix_status_t configuration_update(configuration_pt configuration, properties_pt properties);
+
+
+#endif /* CONFIGURATION_H_ */

Added: celix/branches/celix_config_admin/config_admin/service/public/include/configuration_admin.h
URL: http://svn.apache.org/viewvc/celix/branches/celix_config_admin/config_admin/service/public/include/configuration_admin.h?rev=1633678&view=auto
==============================================================================
--- celix/branches/celix_config_admin/config_admin/service/public/include/configuration_admin.h (added)
+++ celix/branches/celix_config_admin/config_admin/service/public/include/configuration_admin.h Wed Oct 22 18:53:39 2014
@@ -0,0 +1,64 @@
+/**
+ *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.
+ */
+/*
+ * configuration_admin.h
+ *
+ *  \date       Aug 12, 2013
+ *  \author    	<a href="mailto:celix-dev@incubator.apache.org">Apache Celix Project Team</a>
+ *  \copyright	Apache License, Version 2.0
+ */
+
+
+#ifndef CONFIGURATION_ADMIN_H_
+#define CONFIGURATION_ADMIN_H_
+
+
+/* celix.utils.public.include*/
+#include "array_list.h"
+/* celix.framework.public.include */
+#include "celix_errno.h"
+/* celix.config_admin.public.include */
+#include "configuration.h"
+
+
+/* Name of the class */
+#define CONFIGURATION_ADMIN_SERVICE_NAME "org.osgi.service.cm.ConfigurationAdmin"
+/* Configuration properties*/
+#define SERVICE_BUNDLELOCATION "service.bundleLocation"
+#define SERVICE_FACTORYPID "service.factoryPid"
+
+
+typedef struct configuration_admin *configuration_admin_pt;
+typedef struct configuration_admin_service *configuration_admin_service_pt;
+
+
+struct configuration_admin_service {
+
+	/* INSTANCE */
+	configuration_admin_pt configAdmin;
+
+	/* METHODS */
+	celix_status_t (*createFactoryConfiguration)(configuration_admin_pt configAdmin, char *factoryPid, configuration_pt *configuration);
+	celix_status_t (*createFactoryConfiguration2)(configuration_admin_pt configAdmin, char *factoryPid, char *location, configuration_pt *configuration);
+	celix_status_t (*getConfiguration)(configuration_admin_pt configAdmin, char *pid, configuration_pt *configuration);
+	celix_status_t (*getConfiguration2)(configuration_admin_pt configAdmin, char *pid, char *location, configuration_pt *configuration);
+	celix_status_t (*listConfigurations)(configuration_admin_pt configAdmin, char *filter, array_list_pt *configurations);
+};
+
+#endif /* CONFIGURATION_ADMIN_H_ */

Added: celix/branches/celix_config_admin/config_admin/service/public/include/configuration_event.h
URL: http://svn.apache.org/viewvc/celix/branches/celix_config_admin/config_admin/service/public/include/configuration_event.h?rev=1633678&view=auto
==============================================================================
--- celix/branches/celix_config_admin/config_admin/service/public/include/configuration_event.h (added)
+++ celix/branches/celix_config_admin/config_admin/service/public/include/configuration_event.h Wed Oct 22 18:53:39 2014
@@ -0,0 +1,57 @@
+/**
+ *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.
+ */
+/*
+ * configuration_event.h
+ *
+ *  \date       Aug 12, 2013
+ *  \author    	<a href="mailto:celix-dev@incubator.apache.org">Apache Celix Project Team</a>
+ *  \copyright	Apache License, Version 2.0
+ */
+
+
+#ifndef CONFIGURATION_EVENT_H_
+#define CONFIGURATION_EVENT_H_
+
+
+/* celix.framework.public.include */
+#include "celix_errno.h"
+#include "service_reference.h"
+
+
+#define CONFIGURATION_EVENT_CM_DELETED 2
+#define CONFIGURATION_EVENT_CM_LOCATION_CHANGED 3
+#define CONFIGURATION_EVENT_CM_UPDATED 1
+
+
+typedef struct configuration_event *configuration_event_t;
+
+
+/* METHODS */
+celix_status_t configurationEvent_create(
+		service_reference_pt referenceConfigAdmin,
+		int type, char* factoryPid, char *pid,
+		configuration_event_t *event);
+
+celix_status_t configurationEvent_getFactoryPid(configuration_event_t event, char **factoryPid);
+celix_status_t configurationEvent_getPid(configuration_event_t event, char **pid);
+celix_status_t configurationEvent_getReference(configuration_event_t event, service_reference_pt *referenceConfigAdmin);
+celix_status_t configurationEvent_getType(configuration_event_t event, int *type);
+
+
+#endif /* CONFIGURATION_EVENT_H_ */

Added: celix/branches/celix_config_admin/config_admin/service/public/include/configuration_listener.h
URL: http://svn.apache.org/viewvc/celix/branches/celix_config_admin/config_admin/service/public/include/configuration_listener.h?rev=1633678&view=auto
==============================================================================
--- celix/branches/celix_config_admin/config_admin/service/public/include/configuration_listener.h (added)
+++ celix/branches/celix_config_admin/config_admin/service/public/include/configuration_listener.h Wed Oct 22 18:53:39 2014
@@ -0,0 +1,57 @@
+/**
+ *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.
+ */
+/*
+ * configuration_listener.h
+ *
+ *  \date       Aug 12, 2013
+ *  \author    	<a href="mailto:celix-dev@incubator.apache.org">Apache Celix Project Team</a>
+ *  \copyright	Apache License, Version 2.0
+ */
+
+
+#ifndef CONFIGURATION_LISTENER_H_
+#define CONFIGURATION_LISTENER_H_
+
+/* celix.utils.public.include*/
+#include "array_list.h"
+/* celix.framework.public.include */
+#include "celix_errno.h"
+/* celix.config_admin.public.include */
+#include "configuration_event.h"
+
+/* Name of the class */
+#define CONFIGURATION_LISTENER_SERVICE_NAME "org.osgi.service.cm.ConfigurationListener"
+
+
+typedef struct configuration_listener *configuration_listener_t;
+typedef struct configuration_listener_service *configuration_listener_service_t;
+
+
+struct configuration_listener_service {
+
+	/* INSTANCE */
+	configuration_listener_t configListener;
+
+	/* METHOD */
+	celix_status_t (*configurationEvent)(configuration_listener_t configListener, configuration_event_t event);
+
+};
+
+
+#endif /* CONFIGURATION_LISTENER_H_ */

Added: celix/branches/celix_config_admin/config_admin/service/public/include/configuration_plugin.h
URL: http://svn.apache.org/viewvc/celix/branches/celix_config_admin/config_admin/service/public/include/configuration_plugin.h?rev=1633678&view=auto
==============================================================================
--- celix/branches/celix_config_admin/config_admin/service/public/include/configuration_plugin.h (added)
+++ celix/branches/celix_config_admin/config_admin/service/public/include/configuration_plugin.h Wed Oct 22 18:53:39 2014
@@ -0,0 +1,62 @@
+/**
+ *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.
+ */
+/*
+ * configuration_plugin.h
+ *
+ *  \date       Aug 12, 2013
+ *  \author    	<a href="mailto:celix-dev@incubator.apache.org">Apache Celix Project Team</a>
+ *  \copyright	Apache License, Version 2.0
+ */
+
+
+#ifndef CONFIGURATION_PLUGIN_H_
+#define CONFIGURATION_PLUGIN_H_
+
+
+/* celix.utils.public.include*/
+#include "hash_map.h"
+/* celix.framework.public.include */
+#include "celix_errno.h"
+#include "service_reference.h"
+
+
+/* Name of the class */
+#define CONFIGURATION_PLUGIN_SERVICE_NAME "org.osgi.service.cm.ConfigurationPlugin"
+/* Service properties*/
+#define CONFIGURATION_PLUGIN_CM_RANKING "service.cmRanking"
+#define CONFIGURATION_PLUGIN_CM_TARGET "cm.target"
+
+typedef struct configuration_plugin *configuration_plugin_t;
+typedef struct configuration_plugin_service *configuration_plugin_service_t;
+
+
+struct configuration_plugin_service {
+
+	/* INSTANCE */
+	configuration_plugin_t configPlugin;
+
+	/* METHOD */
+	// reference to Managed Service or Managed Service Factory
+	celix_status_t (*modifyConfiguration)(configuration_plugin_t configPlugin, service_reference_pt reference, hash_map_pt properties);
+
+};
+
+
+
+#endif /* CONFIGURATION_PLUGIN_H_ */

Added: celix/branches/celix_config_admin/config_admin/service/public/include/managed_service.h
URL: http://svn.apache.org/viewvc/celix/branches/celix_config_admin/config_admin/service/public/include/managed_service.h?rev=1633678&view=auto
==============================================================================
--- celix/branches/celix_config_admin/config_admin/service/public/include/managed_service.h (added)
+++ celix/branches/celix_config_admin/config_admin/service/public/include/managed_service.h Wed Oct 22 18:53:39 2014
@@ -0,0 +1,54 @@
+/**
+ *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.
+ */
+/*
+ * managed_service.h
+ *
+ *  \date       Aug 12, 2013
+ *  \author    	<a href="mailto:celix-dev@incubator.apache.org">Apache Celix Project Team</a>
+ *  \copyright	Apache License, Version 2.0
+ */
+
+#ifndef MANAGED_SERVICE_H_
+#define MANAGED_SERVICE_H_
+
+
+/* celix.framework */
+#include "bundle_context.h"
+#include "celix_errno.h"
+#include "properties.h"
+
+/* Name of the class */
+#define MANAGED_SERVICE_SERVICE_NAME "org.osgi.service.cm.ManagedService"
+
+
+typedef struct managed_service *managed_service_pt;
+typedef struct managed_service_service *managed_service_service_pt;
+
+struct managed_service_service{
+
+	managed_service_pt managedService;
+	/* METHODS */
+	celix_status_t (*updated)(managed_service_pt managedService, properties_pt properties);
+
+};
+
+celix_status_t managedService_create(bundle_context_pt context, managed_service_service_pt *service);
+
+
+#endif /* MANAGED_SERVICE_H_ */

Modified: celix/branches/celix_config_admin/shell_bonjour/CMakeLists.txt
URL: http://svn.apache.org/viewvc/celix/branches/celix_config_admin/shell_bonjour/CMakeLists.txt?rev=1633678&r1=1633677&r2=1633678&view=diff
==============================================================================
--- celix/branches/celix_config_admin/shell_bonjour/CMakeLists.txt (original)
+++ celix/branches/celix_config_admin/shell_bonjour/CMakeLists.txt Wed Oct 22 18:53:39 2014
@@ -21,7 +21,7 @@ if (SHELL_BONJOUR)
 	find_package(LibXml2 REQUIRED)
 	
 	#TODO create/add FindDNS_SD.cmake and use it (with required)
-	find_library(DNS_SD_LIB NAMES dns_sd)
+	find_library(DNS_SD_LIB NAMES dns_sd dns_services)
 	
 	set(BUNDLE_SYMBOLICNAME "bonjour_shell")
 	set(BUNDLE_VERSION "0.1.0")



Mime
View raw message