Repository: celix
Updated Branches:
  refs/heads/develop 8f5867851 -> db5e6d740


http://git-wip-us.apache.org/repos/asf/celix/blob/db5e6d74/config_admin/service/private/src/configuration_impl.c
----------------------------------------------------------------------
diff --git a/config_admin/service/private/src/configuration_impl.c 
b/config_admin/service/private/src/configuration_impl.c
new file mode 100644
index 0000000..6897e75
--- /dev/null
+++ b/config_admin/service/private/src/configuration_impl.c
@@ -0,0 +1,597 @@
+/**
+ *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:[email protected]";>Apache 
Celix Project Team</a>
+ *  \copyright Apache License, Version 2.0
+ */
+
+#include <stdbool.h>
+#include <stdlib.h>
+#include <string.h>
+#include <stdio.h>
+
+/*celix.config_admin.Configuration */
+//#include "configuration.h"
+#include "configuration_impl.h"
+#include "celix_threads.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{
+
+       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;
+
+       celix_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){
+
+       configuration_pt config;
+    celix_thread_mutexattr_t   mutex_attr;
+
+
+       config = calloc(1,sizeof(struct configuration));
+       if(!config){
+               printf("[ ERROR ]: Configuration{PID=%s} - Not created (ENOMEM) 
\n",pid);
+               return CELIX_ENOMEM;
+       }
+
+       config->configurationAdminFactory  = factory;
+       config->configurationStore = store;
+
+       config->factoryPid = factoryPid;
+       config->pid = pid;
+       config->bundleLocation = bundleLocation;
+       config->dictionary = NULL;
+
+       config->deleted = false;
+       config->boundBundle = NULL;
+
+    celixThreadMutexAttr_create(&mutex_attr);
+    celixThreadMutexAttr_settype(&mutex_attr, CELIX_THREAD_MUTEX_RECURSIVE);  
// why recursive?
+       if( celixThreadMutex_create(&config->mutex, &mutex_attr) != 
CELIX_SUCCESS ){
+               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){
+
+       configuration_pt config;
+    celix_thread_mutexattr_t   mutex_attr;
+
+       config = calloc(1, sizeof(struct configuration));
+       if(!config){
+               printf("[ ERROR ]: Configuration - Not created (ENOMEM) \n");
+               return CELIX_ENOMEM;
+       }
+
+       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;
+
+    celixThreadMutexAttr_create(&mutex_attr);
+    celixThreadMutexAttr_settype(&mutex_attr, CELIX_THREAD_MUTEX_RECURSIVE);  
// why recursive?
+       if( celixThreadMutex_create(&config->mutex, &mutex_attr) != 
CELIX_SUCCESS ){
+               printf("[ ERROR ]: Configuration{PID=%s} - Not created (MUTEX) 
\n", config->pid);
+               return CELIX_ILLEGAL_ARGUMENT;
+       }
+    celixThreadMutexAttr_destroy(&mutex_attr);
+       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){
+       printf("TODO: Implement configuration_delete\n");
+       celixThreadMutex_destroy(&configuration->mutex);
+       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);
+       celixThreadMutex_lock(&configuration->mutex);
+       return CELIX_SUCCESS;
+}
+
+celix_status_t configuration_unlock(configuration_pt configuration){
+//     printf("[ DEBUG ]: Configuration{PID=%s} - UNLOCK 
\n",configuration->pid);
+       celixThreadMutex_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 ( strcmp(configuration->bundleLocation, 
bundleLocation) == 0 ){ // (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 ---------- */
+#if 0
+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;
+}
+#endif
+/* ---------- 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;
+
+}

http://git-wip-us.apache.org/repos/asf/celix/blob/db5e6d74/config_admin/service/private/src/configuration_store.c
----------------------------------------------------------------------
diff --git a/config_admin/service/private/src/configuration_store.c 
b/config_admin/service/private/src/configuration_store.c
new file mode 100644
index 0000000..a0883c6
--- /dev/null
+++ b/config_admin/service/private/src/configuration_store.c
@@ -0,0 +1,428 @@
+/**
+ *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:[email protected]";>Apache 
Celix Project Team</a>
+ *  \copyright Apache License, Version 2.0
+ */
+
+#include <stdbool.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <dirent.h>
+#include <unistd.h>
+
+/* celix.config_admin.ConfigurationStore */
+#include "configuration_store.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 {
+
+    bundle_context_pt context;
+
+    celix_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, int *file);
+static celix_status_t configurationStore_writeConfigurationFile(int fd, 
properties_pt properties);
+static celix_status_t configurationStore_readCache(configuration_store_pt 
store);
+static celix_status_t configurationStore_readConfigurationFile(const char 
*name, int size, properties_pt *dictionary);
+static celix_status_t configurationStore_parseDataConfigurationFile(char 
*data, properties_pt *dictionary);
+
+/* ========== CONSTRUCTOR ========== */
+
+celix_status_t configurationStore_create(bundle_context_pt context, 
configuration_admin_factory_pt factory, configuration_store_pt *store) {
+
+    *store = calloc(1, sizeof(**store));
+
+    if (!*store) {
+        printf("[ ERROR ]: ConfigStore - Not initialized (ENOMEM) \n");
+        return CELIX_ENOMEM;
+    }
+
+    (*store)->context = context;
+
+    (*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;
+    }
+
+    celix_status_t mutexStatus = celixThreadMutex_create(&(*store)->mutex, 
NULL);
+    if (mutexStatus != CELIX_SUCCESS) {
+        printf("[ ERROR ]: ConfigStore - Not initialized (MUTEX) \n");
+        return CELIX_ILLEGAL_ARGUMENT;
+    }
+
+    configurationStore_readCache((*store));
+
+    printf("[ SUCCESS ]: ConfigStore - Initialized \n");
+    return CELIX_SUCCESS;
+}
+
+celix_status_t configurationStore_destroy(configuration_store_pt store) {
+    celixThreadMutex_destroy(&store->mutex);
+    return CELIX_SUCCESS;
+}
+
+/* ========== IMPLEMENTATION ==========  */
+
+/* ---------- public ---------- */
+// org.eclipse.equinox.internal.cm
+celix_status_t configurationStore_lock(configuration_store_pt store) {
+    celixThreadMutex_lock(&store->mutex);
+    printf("[ SUCCESS ]: ConfigStore - LOCK \n");
+    return CELIX_SUCCESS;
+}
+
+celix_status_t configurationStore_unlock(configuration_store_pt store) {
+    celixThreadMutex_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
+    int 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) {
+
+    int result = mkdir((const char*) STORE_DIR, 0777);
+
+    if ((result == 0) || ((result == -1) && (errno == 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, int *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
+#if 0
+    apr_pool_t *fpool;
+    configuration_getPool(configuration, &fpool);
+#endif
+    // (3) file.open
+    if ((*file = open((const char*) fname, O_CREAT | O_RDWR)) < 0) {
+        printf("[ ERROR ]: ConfigStore - getFile(IO_EXCEPTION) \n");
+        return CELIX_FILE_IO_EXCEPTION;
+    }
+    return CELIX_SUCCESS;
+}
+
+celix_status_t configurationStore_writeConfigurationFile(int 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));
+        }
+    }
+
+    int buffLength = strlen((const char *) buffer);
+
+    if (write(file, (const void *) buffer, buffLength) != 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;
+
+    DIR *cache;        // directory handle
+
+    properties_pt properties = NULL;
+    configuration_pt configuration = NULL;
+    char *pid;
+
+    // (1) cache.open
+    cache = opendir((const char*) STORE_DIR);
+    if (cache == NULL) {
+        printf("[ ERROR ]: ConfigStore - Read Cache \n");
+        return CELIX_FILE_IO_EXCEPTION;
+    }
+
+    // (2) directory.read
+    struct dirent *dp;
+    int res;
+    struct stat st;
+    union {
+        struct dirent d;
+        char b[offsetof (struct dirent, d_name) + NAME_MAX + 1];
+    } u;
+    res = readdir_r(cache, (struct dirent*) &u, &dp);
+    while ((res == 0) && (dp != NULL)) {
+
+        if ((strcmp((dp->d_name), ".") != 0) && (strcmp((dp->d_name), "..") != 
0) && (strpbrk(dp->d_name, "~") == NULL)) {
+
+            // (2.1) file.readData
+            if (stat(dp->d_name, &st) == 0) {
+                status = configurationStore_readConfigurationFile(dp->d_name, 
st.st_size, &properties);
+                if (status != CELIX_SUCCESS) {
+                    closedir(cache);
+                    return status;
+                }
+            }
+            // (2.2) new configuration
+            status = configuration_create2(store->configurationAdminFactory, 
store, properties, &configuration);
+            if (status != CELIX_SUCCESS) {
+                closedir(cache);
+                return status;
+            }
+
+            // (2.3) configurations.put
+            configuration_getPid(configuration, &pid);
+            hashMap_put(store->configurations, pid, configuration);
+        }
+        res = readdir_r(cache, (struct dirent*) &u, &dp);
+    }
+
+    closedir(cache);
+
+    return CELIX_SUCCESS;
+}
+
+celix_status_t configurationStore_readConfigurationFile(const char *name, int 
size, properties_pt *dictionary) {
+
+    char *fname;               // file name
+    char *buffer;              // file buffer
+    int fd;
+    celix_status_t status = CELIX_SUCCESS;
+
+    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
+
+    // (3) file.open
+    fd = open((const char*) fname, O_RDONLY);
+    if (fd < 0) {
+        printf("[ ERROR ]: ConfigStore - open File{%s} for reading 
(IO_EXCEPTION) \n", name);
+        return CELIX_FILE_IO_EXCEPTION;
+    }
+
+    // (4) buffer.new
+    buffer = calloc(1, size);
+    if (!buffer) {
+        close(fd);
+        return CELIX_ENOMEM;
+    }
+
+    // (5) file.read
+    if (read(fd, (void *) buffer, size) != size) {
+        printf("[ ERROR ]: ConfigStore - reading File{%s} \n", name);
+        status = CELIX_FILE_IO_EXCEPTION;
+    }
+
+    status = CELIX_DO_IF(status, 
configurationStore_parseDataConfigurationFile(buffer, &properties));
+
+    // (6) file.close & buffer.destroy
+    free(buffer);
+    close(fd);
+    // (7) return
+    *dictionary = properties;
+    return status;
+
+}
+
+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;
+}

http://git-wip-us.apache.org/repos/asf/celix/blob/db5e6d74/config_admin/service/private/src/framework_patch.c
----------------------------------------------------------------------
diff --git a/config_admin/service/private/src/framework_patch.c 
b/config_admin/service/private/src/framework_patch.c
new file mode 100644
index 0000000..9162a29
--- /dev/null
+++ b/config_admin/service/private/src/framework_patch.c
@@ -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:[email protected]";>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;
+}
+

http://git-wip-us.apache.org/repos/asf/celix/blob/db5e6d74/config_admin/service/private/src/managed_service_impl.c
----------------------------------------------------------------------
diff --git a/config_admin/service/private/src/managed_service_impl.c 
b/config_admin/service/private/src/managed_service_impl.c
new file mode 100644
index 0000000..ee5e797
--- /dev/null
+++ b/config_admin/service/private/src/managed_service_impl.c
@@ -0,0 +1,50 @@
+/**
+ *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:[email protected]";>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 */
+
+
+/* ------------------------ Constructor -------------------------------------*/
+
+celix_status_t managedService_create(bundle_context_pt context, 
managed_service_service_pt *service){
+
+       managed_service_service_pt managedServiceService = calloc(1, 
sizeof(*managedServiceService));
+       if(!managedServiceService){
+               printf("[ ERROR ]: ManagedService Service not initialized \n");
+               return CELIX_ENOMEM;
+       }
+
+       *service = managedServiceService;
+       return CELIX_SUCCESS;
+
+}

http://git-wip-us.apache.org/repos/asf/celix/blob/db5e6d74/config_admin/service/private/src/managed_service_tracker.c
----------------------------------------------------------------------
diff --git a/config_admin/service/private/src/managed_service_tracker.c 
b/config_admin/service/private/src/managed_service_tracker.c
new file mode 100644
index 0000000..104b85e
--- /dev/null
+++ b/config_admin/service/private/src/managed_service_tracker.c
@@ -0,0 +1,563 @@
+/**
+ *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:[email protected]";>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"
+
+/* celix.utils */
+#include "hash_map.h"
+/* celix.framework */
+#include "constants.h"
+#include "properties.h"
+#include "utils.h"
+#include "service_reference.h"
+#include "service_registration.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 {
+
+    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"
+
+    hash_map_pt managedServices;
+    hash_map_pt managedServicesReferences;
+    celix_thread_mutex_t managedServicesReferencesMutex;
+};
+
+static celix_status_t managedServiceTracker_createHandle(bundle_context_pt 
context, configuration_admin_factory_pt factory, configuration_store_pt store, 
managed_service_tracker_t *tracker);
+static celix_status_t managedServiceTracker_createCustomized(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(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(context, factory, store, 
&managedServiceTrackerHandle);
+    if (status != CELIX_SUCCESS) {
+        *trackerHandle = NULL;
+        *tracker = NULL;
+        return status;
+    }
+
+    status = managedServiceTracker_createCustomized(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(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 = calloc(1, sizeof(*this));
+
+    if (!this) {
+        printf("[ ERROR ]: TrackerInstance - Not initialized (ENOMEM) \n");
+        *tracker = NULL;
+        return CELIX_ENOMEM;
+    }
+
+    status = updatedThreadPool_create(context, MAX_THREADS, 
&updatedThreadPool);
+    if (status != CELIX_SUCCESS) {
+        return status;
+    }
+
+    this->context = context;
+
+    this->configurationAdminfactory = factory;
+    this->configurationStore = store;
+    this->updatedThreadPool = updatedThreadPool;
+
+    this->managedServices = hashMap_create(utils_stringHash, NULL, 
utils_stringEquals, NULL);
+    this->managedServicesReferences = hashMap_create(utils_stringHash, NULL, 
utils_stringEquals, NULL);
+
+    celix_status_t mutexStatus = 
celixThreadMutex_create(&this->managedServicesReferencesMutex, NULL);
+    if (mutexStatus != CELIX_SUCCESS) {
+        printf("[ ERROR ]: TrackerInstance - Not initialized (MUTEX) \n");
+        // TODO destroy threadpool?
+        return CELIX_ILLEGAL_ARGUMENT;
+    }
+
+    *tracker = this;
+    return CELIX_SUCCESS;
+
+}
+
+celix_status_t managedServiceTracker_createCustomized(bundle_context_pt 
context, managed_service_tracker_t trackerHandle, service_tracker_pt *tracker) {
+    celix_status_t status;
+
+    service_tracker_customizer_pt customizer = NULL;
+    service_tracker_pt managedServiceTracker = NULL;
+
+    status = serviceTrackerCustomizer_create(trackerHandle, 
managedServiceTracker_addingService, managedServiceTracker_addedService, 
managedServiceTracker_modifiedService, managedServiceTracker_removedService, 
&customizer);
+
+    if (status != CELIX_SUCCESS) {
+        printf("[ ERROR ]: TrackerCustomized - Not initialized(ENOMEM) \n");
+        *tracker = NULL;
+        return CELIX_ENOMEM;
+    }
+
+    serviceTracker_create(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;
+
+    char *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
+
+    status = serviceReference_getProperty(reference, (char *) 
OSGI_FRAMEWORK_SERVICE_ID, &pid);
+    if (status != 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 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
+        }
+    }
+}
+
+/* TODO
+ 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;
+}
+
+/* TODO
+ 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;
+}
+
+/* TODO
+ 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) {
+
+    celixThreadMutex_lock(&handle->managedServicesReferencesMutex);
+    return CELIX_SUCCESS;
+
+}
+
+celix_status_t 
managedServiceTracker_unlockManagedServicesReferences(managed_service_tracker_t 
handle) {
+
+    celixThreadMutex_unlock(&handle->managedServicesReferencesMutex);
+    return CELIX_SUCCESS;
+
+}

http://git-wip-us.apache.org/repos/asf/celix/blob/db5e6d74/config_admin/service/private/src/updated_thread_pool.c
----------------------------------------------------------------------
diff --git a/config_admin/service/private/src/updated_thread_pool.c 
b/config_admin/service/private/src/updated_thread_pool.c
new file mode 100644
index 0000000..acf0afe
--- /dev/null
+++ b/config_admin/service/private/src/updated_thread_pool.c
@@ -0,0 +1,157 @@
+/**
+ *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:[email protected]";>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 "thpool.h"
+#include "updated_thread_pool.h"
+
+
+
+struct updated_thread_pool{
+
+       bundle_context_pt       context;
+
+       int maxTreads;
+
+       //      apr_thread_mutex_t *mutex;
+       threadpool threadPool;  //protected by mutex
+
+};
+
+typedef struct data_callback *data_callback_t;
+
+struct data_callback{
+
+       managed_service_service_pt managedServiceService;
+       properties_pt properties;
+
+};
+
+
+static void *updateThreadPool_updatedCallback(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(bundle_context_pt context, int 
maxThreads, updated_thread_pool_t *updatedThreadPool){
+
+       *updatedThreadPool = calloc(1, sizeof(**updatedThreadPool));
+       if (!*updatedThreadPool){
+               printf("[ ERROR ]: UpdatedThreadPool - Not initialized (ENOMEM) 
\n");
+               return CELIX_ENOMEM;
+       }
+
+       (*updatedThreadPool)->threadPool=thpool_init(maxThreads);
+//     if ( apr_thread_pool_create(&(*updatedThreadPool)->threadPool, 
INIT_THREADS, maxTreads, pool) != APR_SUCCESS ){
+       if ((*updatedThreadPool)->threadPool == NULL) {
+               printf("[ ERROR ]: UpdatedThreadPool - Instance not created 
\n");
+               return CELIX_ENOMEM;
+       }
+
+       (*updatedThreadPool)->context = context;
+
+       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 (thpool_add_work(updatedThreadPool->threadPool, 
updateThreadPool_updatedCallback, data) == 0) {
+//             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 *updateThreadPool_updatedCallback(void *data) {
+
+
+       printf("[ DEBUG ]: UpdatedThreadPool - Callback \n");
+
+       data_callback_t params = data;
+
+       managed_service_service_pt managedServiceService = 
params->managedServiceService;
+       properties_pt properties = params->properties;
+
+       
(*managedServiceService->updated)(managedServiceService->managedService, 
properties);
+
+       return NULL;
+
+}
+
+celix_status_t updatedThreadPool_wrapDataCallback(managed_service_service_pt 
service, properties_pt properties, data_callback_t *data){
+
+
+       *data = calloc(1, sizeof(**data));
+       if (!*data){
+               printf("[ ERROR ]: UpdatedThreadPool - WrapDataCallback (Data 
not initialized) \n");
+               return CELIX_ENOMEM;
+       }
+
+       (*data)->managedServiceService = service;
+       (*data)->properties = properties;
+
+       return CELIX_SUCCESS;
+}
+

http://git-wip-us.apache.org/repos/asf/celix/blob/db5e6d74/config_admin/service/public/include/configuration.h
----------------------------------------------------------------------
diff --git a/config_admin/service/public/include/configuration.h 
b/config_admin/service/public/include/configuration.h
new file mode 100644
index 0000000..b872d23
--- /dev/null
+++ b/config_admin/service/public/include/configuration.h
@@ -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:[email protected]";>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_ */

http://git-wip-us.apache.org/repos/asf/celix/blob/db5e6d74/config_admin/service/public/include/configuration_admin.h
----------------------------------------------------------------------
diff --git a/config_admin/service/public/include/configuration_admin.h 
b/config_admin/service/public/include/configuration_admin.h
new file mode 100644
index 0000000..09ad096
--- /dev/null
+++ b/config_admin/service/public/include/configuration_admin.h
@@ -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:[email protected]";>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_ */

http://git-wip-us.apache.org/repos/asf/celix/blob/db5e6d74/config_admin/service/public/include/configuration_event.h
----------------------------------------------------------------------
diff --git a/config_admin/service/public/include/configuration_event.h 
b/config_admin/service/public/include/configuration_event.h
new file mode 100644
index 0000000..38b79d1
--- /dev/null
+++ b/config_admin/service/public/include/configuration_event.h
@@ -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:[email protected]";>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_ */

http://git-wip-us.apache.org/repos/asf/celix/blob/db5e6d74/config_admin/service/public/include/configuration_listener.h
----------------------------------------------------------------------
diff --git a/config_admin/service/public/include/configuration_listener.h 
b/config_admin/service/public/include/configuration_listener.h
new file mode 100644
index 0000000..3a635e6
--- /dev/null
+++ b/config_admin/service/public/include/configuration_listener.h
@@ -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:[email protected]";>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_ */

http://git-wip-us.apache.org/repos/asf/celix/blob/db5e6d74/config_admin/service/public/include/configuration_plugin.h
----------------------------------------------------------------------
diff --git a/config_admin/service/public/include/configuration_plugin.h 
b/config_admin/service/public/include/configuration_plugin.h
new file mode 100644
index 0000000..2175104
--- /dev/null
+++ b/config_admin/service/public/include/configuration_plugin.h
@@ -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:[email protected]";>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_ */

http://git-wip-us.apache.org/repos/asf/celix/blob/db5e6d74/config_admin/service/public/include/managed_service.h
----------------------------------------------------------------------
diff --git a/config_admin/service/public/include/managed_service.h 
b/config_admin/service/public/include/managed_service.h
new file mode 100644
index 0000000..10f8570
--- /dev/null
+++ b/config_admin/service/public/include/managed_service.h
@@ -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:[email protected]";>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_ */

Reply via email to