celix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pnol...@apache.org
Subject svn commit: r1633678 [1/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
Author: pnoltes
Date: Wed Oct 22 18:53:39 2014
New Revision: 1633678

URL: http://svn.apache.org/r1633678
Log:
CELIX-77: commit of the current state of config_admin. Still some compilation errors, due the api changes.

Added:
    celix/branches/celix_config_admin/config_admin/
    celix/branches/celix_config_admin/config_admin/CMakeLists.txt
    celix/branches/celix_config_admin/config_admin/deploy.cmake
    celix/branches/celix_config_admin/config_admin/examples/
    celix/branches/celix_config_admin/config_admin/examples/CMakeLists.txt
    celix/branches/celix_config_admin/config_admin/examples/example_test/
    celix/branches/celix_config_admin/config_admin/examples/example_test/CMakeLists.txt
    celix/branches/celix_config_admin/config_admin/examples/example_test/META-INF/
    celix/branches/celix_config_admin/config_admin/examples/example_test/META-INF/MANIFEST.MF
    celix/branches/celix_config_admin/config_admin/examples/example_test/private/
    celix/branches/celix_config_admin/config_admin/examples/example_test/private/include/
    celix/branches/celix_config_admin/config_admin/examples/example_test/private/include/example_managed_service_impl.h
    celix/branches/celix_config_admin/config_admin/examples/example_test/private/src/
    celix/branches/celix_config_admin/config_admin/examples/example_test/private/src/activator.c
    celix/branches/celix_config_admin/config_admin/examples/example_test/private/src/example_managed_service_impl.c
    celix/branches/celix_config_admin/config_admin/examples/example_test2/
    celix/branches/celix_config_admin/config_admin/examples/example_test2/CMakeLists.txt
    celix/branches/celix_config_admin/config_admin/examples/example_test2/bundle_configuring/
    celix/branches/celix_config_admin/config_admin/examples/example_test2/bundle_configuring/CMakeLists.txt
    celix/branches/celix_config_admin/config_admin/examples/example_test2/bundle_configuring/META-INF/
    celix/branches/celix_config_admin/config_admin/examples/example_test2/bundle_configuring/META-INF/MANIFEST.MF
    celix/branches/celix_config_admin/config_admin/examples/example_test2/bundle_configuring/private/
    celix/branches/celix_config_admin/config_admin/examples/example_test2/bundle_configuring/private/src/
    celix/branches/celix_config_admin/config_admin/examples/example_test2/bundle_configuring/private/src/activator.c
    celix/branches/celix_config_admin/config_admin/examples/example_test2/bundle_managed_service/
    celix/branches/celix_config_admin/config_admin/examples/example_test2/bundle_managed_service/CMakeLists.txt
    celix/branches/celix_config_admin/config_admin/examples/example_test2/bundle_managed_service/META-INF/
    celix/branches/celix_config_admin/config_admin/examples/example_test2/bundle_managed_service/META-INF/MANIFEST.MF
    celix/branches/celix_config_admin/config_admin/examples/example_test2/bundle_managed_service/private/
    celix/branches/celix_config_admin/config_admin/examples/example_test2/bundle_managed_service/private/include/
    celix/branches/celix_config_admin/config_admin/examples/example_test2/bundle_managed_service/private/include/example_managed_service_impl.h
    celix/branches/celix_config_admin/config_admin/examples/example_test2/bundle_managed_service/private/src/
    celix/branches/celix_config_admin/config_admin/examples/example_test2/bundle_managed_service/private/src/activator.c
    celix/branches/celix_config_admin/config_admin/examples/example_test2/bundle_managed_service/private/src/example_managed_service_impl.c
    celix/branches/celix_config_admin/config_admin/service/
    celix/branches/celix_config_admin/config_admin/service/CMakeLists.txt
    celix/branches/celix_config_admin/config_admin/service/META-INF/
    celix/branches/celix_config_admin/config_admin/service/META-INF/MANIFEST.MF
    celix/branches/celix_config_admin/config_admin/service/private/
    celix/branches/celix_config_admin/config_admin/service/private/include/
    celix/branches/celix_config_admin/config_admin/service/private/include/configuration_admin_factory.h
    celix/branches/celix_config_admin/config_admin/service/private/include/configuration_admin_impl.h
    celix/branches/celix_config_admin/config_admin/service/private/include/configuration_impl.h
    celix/branches/celix_config_admin/config_admin/service/private/include/configuration_store.h
    celix/branches/celix_config_admin/config_admin/service/private/include/framework_patch.h
    celix/branches/celix_config_admin/config_admin/service/private/include/managed_service_tracker.h
    celix/branches/celix_config_admin/config_admin/service/private/include/updated_thread_pool.h
    celix/branches/celix_config_admin/config_admin/service/private/src/
    celix/branches/celix_config_admin/config_admin/service/private/src/activator.c
    celix/branches/celix_config_admin/config_admin/service/private/src/configuration_admin_factory.c
    celix/branches/celix_config_admin/config_admin/service/private/src/configuration_admin_impl.c
    celix/branches/celix_config_admin/config_admin/service/private/src/configuration_impl.c
    celix/branches/celix_config_admin/config_admin/service/private/src/configuration_store.c
    celix/branches/celix_config_admin/config_admin/service/private/src/framework_patch.c
    celix/branches/celix_config_admin/config_admin/service/private/src/managed_service_impl.c
    celix/branches/celix_config_admin/config_admin/service/private/src/managed_service_tracker.c
    celix/branches/celix_config_admin/config_admin/service/private/src/updated_thread_pool.c
    celix/branches/celix_config_admin/config_admin/service/public/
    celix/branches/celix_config_admin/config_admin/service/public/include/
    celix/branches/celix_config_admin/config_admin/service/public/include/configuration.h
    celix/branches/celix_config_admin/config_admin/service/public/include/configuration_admin.h
    celix/branches/celix_config_admin/config_admin/service/public/include/configuration_event.h
    celix/branches/celix_config_admin/config_admin/service/public/include/configuration_listener.h
    celix/branches/celix_config_admin/config_admin/service/public/include/configuration_plugin.h
    celix/branches/celix_config_admin/config_admin/service/public/include/managed_service.h
Modified:
    celix/branches/celix_config_admin/CMakeLists.txt
    celix/branches/celix_config_admin/shell_bonjour/CMakeLists.txt

Modified: celix/branches/celix_config_admin/CMakeLists.txt
URL: http://svn.apache.org/viewvc/celix/branches/celix_config_admin/CMakeLists.txt?rev=1633678&r1=1633677&r2=1633678&view=diff
==============================================================================
--- celix/branches/celix_config_admin/CMakeLists.txt (original)
+++ celix/branches/celix_config_admin/CMakeLists.txt Wed Oct 22 18:53:39 2014
@@ -56,6 +56,7 @@ set(DEFAULT_VERSION 1.0.0)
 add_subdirectory(examples)
 add_subdirectory(device_access)
 add_subdirectory(deployment_admin)
+add_subdirectory(config_admin)
 add_subdirectory(remote_services)
 add_subdirectory(remote_shell)
 add_subdirectory(shell_bonjour)

Added: celix/branches/celix_config_admin/config_admin/CMakeLists.txt
URL: http://svn.apache.org/viewvc/celix/branches/celix_config_admin/config_admin/CMakeLists.txt?rev=1633678&view=auto
==============================================================================
--- celix/branches/celix_config_admin/config_admin/CMakeLists.txt (added)
+++ celix/branches/celix_config_admin/config_admin/CMakeLists.txt Wed Oct 22 18:53:39 2014
@@ -0,0 +1,25 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+# 
+#   http://www.apache.org/licenses/LICENSE-2.0
+# 
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+
+celix_subproject(CONFIG_ADMIN "Option to enable building the Config Admin Service bundle and its examples" OFF DEPS framework launcher shell_tui log_writer)
+if (CONFIG_ADMIN)
+
+	add_subdirectory(service)
+	add_subdirectory(examples)
+
+endif (CONFIG_ADMIN)

Added: celix/branches/celix_config_admin/config_admin/deploy.cmake
URL: http://svn.apache.org/viewvc/celix/branches/celix_config_admin/config_admin/deploy.cmake?rev=1633678&view=auto
==============================================================================
--- celix/branches/celix_config_admin/config_admin/deploy.cmake (added)
+++ celix/branches/celix_config_admin/config_admin/deploy.cmake Wed Oct 22 18:53:39 2014
@@ -0,0 +1,24 @@
+
+# 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.
+
+if (CONFIG_ADMIN)
+ 	
+	deploy("config_admin1" BUNDLES config_admin shell shell_tui log_service log_writer example_test)
+	deploy("config_admin2" BUNDLES config_admin shell shell_tui log_service log_writer bundle_managed_service bundle_configuring)
+
+endif (CONFIG_ADMIN)

Added: celix/branches/celix_config_admin/config_admin/examples/CMakeLists.txt
URL: http://svn.apache.org/viewvc/celix/branches/celix_config_admin/config_admin/examples/CMakeLists.txt?rev=1633678&view=auto
==============================================================================
--- celix/branches/celix_config_admin/config_admin/examples/CMakeLists.txt (added)
+++ celix/branches/celix_config_admin/config_admin/examples/CMakeLists.txt Wed Oct 22 18:53:39 2014
@@ -0,0 +1,21 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+# 
+#   http://www.apache.org/licenses/LICENSE-2.0
+# 
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+
+add_subdirectory(example_test)	
+add_subdirectory(example_test2)
+	
\ No newline at end of file

Added: celix/branches/celix_config_admin/config_admin/examples/example_test/CMakeLists.txt
URL: http://svn.apache.org/viewvc/celix/branches/celix_config_admin/config_admin/examples/example_test/CMakeLists.txt?rev=1633678&view=auto
==============================================================================
--- celix/branches/celix_config_admin/config_admin/examples/example_test/CMakeLists.txt (added)
+++ celix/branches/celix_config_admin/config_admin/examples/example_test/CMakeLists.txt Wed Oct 22 18:53:39 2014
@@ -0,0 +1,32 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+# 
+#   http://www.apache.org/licenses/LICENSE-2.0
+# 
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+
+include_directories("${PROJECT_SOURCE_DIR}/utils/public/include")
+include_directories("${PROJECT_SOURCE_DIR}/framework/public/include")
+include_directories("${PROJECT_SOURCE_DIR}/config_admin/service/public/include")
+include_directories("private/include")
+
+SET(BUNDLE_SYMBOLICNAME "example_test")
+SET(BUNDLE_VERSION "0.1.0")
+
+bundle(example_test SOURCES 
+	private/src/activator
+	private/src/example_managed_service_impl
+)
+
+target_link_libraries(example_test celix_framework celix_utils config_admin ${APR_LIBRARY})

Added: celix/branches/celix_config_admin/config_admin/examples/example_test/META-INF/MANIFEST.MF
URL: http://svn.apache.org/viewvc/celix/branches/celix_config_admin/config_admin/examples/example_test/META-INF/MANIFEST.MF?rev=1633678&view=auto
==============================================================================
--- celix/branches/celix_config_admin/config_admin/examples/example_test/META-INF/MANIFEST.MF (added)
+++ celix/branches/celix_config_admin/config_admin/examples/example_test/META-INF/MANIFEST.MF Wed Oct 22 18:53:39 2014
@@ -0,0 +1,5 @@
+Manifest-Version: 1.0
+Bundle-SymbolicName: example_test
+Bundle-Version: 1.0.0
+library: example_test
+Import-Service: configuration_admin

Added: celix/branches/celix_config_admin/config_admin/examples/example_test/private/include/example_managed_service_impl.h
URL: http://svn.apache.org/viewvc/celix/branches/celix_config_admin/config_admin/examples/example_test/private/include/example_managed_service_impl.h?rev=1633678&view=auto
==============================================================================
--- celix/branches/celix_config_admin/config_admin/examples/example_test/private/include/example_managed_service_impl.h (added)
+++ celix/branches/celix_config_admin/config_admin/examples/example_test/private/include/example_managed_service_impl.h Wed Oct 22 18:53:39 2014
@@ -0,0 +1,56 @@
+/**
+ *Licensed to the Apache Software Foundation (ASF) under one
+ *or more contributor license agreements.  See the NOTICE file
+ *distributed with this work for additional information
+ *regarding copyright ownership.  The ASF licenses this file
+ *to you under the Apache License, Version 2.0 (the
+ *"License"); you may not use this file except in compliance
+ *with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *Unless required by applicable law or agreed to in writing,
+ *software distributed under the License is distributed on an
+ *"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ *specific language governing permissions and limitations
+ *under the License.
+ */
+/*
+ * example_managed_service_impl.h
+ *
+ *  \date       Aug 12, 2013
+ *  \author    	<a href="mailto:celix-dev@incubator.apache.org">Apache Celix Project Team</a>
+ *  \copyright	Apache License, Version 2.0
+ */
+
+
+#ifndef MANAGED_SERVICE_IMPL_H_
+#define MANAGED_SERVICE_IMPL_H_
+
+
+/* APR */
+#include <apr_general.h>
+/* celix.utils*/
+#include "properties.h"
+/* celix.framework */
+#include "celix_errno.h"
+#include "service_registration.h"
+#include "bundle_context.h"
+/* celix.config_admin.ManagedService */
+#include "managed_service.h"
+
+struct managed_service{
+
+	apr_pool_t 				*pool;
+	BUNDLE_CONTEXT 			context;
+
+	SERVICE_REGISTRATION 	registration;
+	PROPERTIES 				properties;
+
+};
+
+celix_status_t managedServiceImpl_create(BUNDLE_CONTEXT context, managed_service_t *instance);
+celix_status_t managedServiceImpl_updated(managed_service_t instance, PROPERTIES properties);
+
+#endif /* MANAGED_SERVICE_IMPL_H_ */

Added: celix/branches/celix_config_admin/config_admin/examples/example_test/private/src/activator.c
URL: http://svn.apache.org/viewvc/celix/branches/celix_config_admin/config_admin/examples/example_test/private/src/activator.c?rev=1633678&view=auto
==============================================================================
--- celix/branches/celix_config_admin/config_admin/examples/example_test/private/src/activator.c (added)
+++ celix/branches/celix_config_admin/config_admin/examples/example_test/private/src/activator.c Wed Oct 22 18:53:39 2014
@@ -0,0 +1,188 @@
+/**
+ *Licensed to the Apache Software Foundation (ASF) under one
+ *or more contributor license agreements.  See the NOTICE file
+ *distributed with this work for additional information
+ *regarding copyright ownership.  The ASF licenses this file
+ *to you under the Apache License, Version 2.0 (the
+ *"License"); you may not use this file except in compliance
+ *with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *Unless required by applicable law or agreed to in writing,
+ *software distributed under the License is distributed on an
+ *"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ *specific language governing permissions and limitations
+ *under the License.
+ */
+/*
+ * activator.c
+ *
+ *  \date       Aug 12, 2013
+ *  \author    	<a href="mailto: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.framework */
+#include "bundle_activator.h"
+#include "bundle_context.h"
+#include "constants.h"
+#include "properties.h"
+#include "utils.h"
+/* celix.utils */
+#include "hash_map.h"
+/* celix.configadmin */
+#include "configuration_admin.h"
+#include "configuration.h"
+#include "managed_service.h"
+/* celix.config_admin.examples.private */
+#include "example_managed_service_impl.h"
+
+
+static void test_debugConfiguration(configuration_t configuration, char* pid);
+
+
+celix_status_t bundleActivator_create(BUNDLE_CONTEXT context, void **userData) {
+	*userData = NULL;
+	return CELIX_SUCCESS;
+}
+
+celix_status_t bundleActivator_start(void * userData, BUNDLE_CONTEXT ctx) {
+
+	SERVICE_REFERENCE ref = NULL;
+	celix_status_t status = bundleContext_getServiceReference(ctx, (char *) CONFIGURATION_ADMIN_SERVICE_NAME, &ref);
+
+	if (status == CELIX_SUCCESS) {
+
+		if (ref == NULL) {
+
+			printf("[configAdminClient]: ConfigAdminService reference not available\n");
+
+		} else {
+
+			printf("------------------- DEMO ---------------------- \n");
+
+			configuration_admin_service_t confAdminServ = NULL;
+			bundleContext_getService(ctx, ref, (void *) &confAdminServ);
+
+			if (confAdminServ == NULL){
+
+				printf("[ TEST ]: ConfigAdminService not available\n");
+
+			} else {
+
+				printf("/////////////////// TESTS ///////////////////// \n");
+
+				char *pid = "base.device1";
+
+				/* ------------------ get Configuration -------------------*/
+
+				printf("------------------- TEST01 -------------------- \n");
+				printf("[ TEST ]: getConfiguration(pid=%s) - It's new \n",pid);
+				configuration_t configuration;
+				(*confAdminServ->getConfiguration)(confAdminServ->configAdmin,pid, &configuration);
+
+				test_debugConfiguration(configuration, pid);
+
+				/* ------------------ get Configuration -------------------*/
+
+				char *pid2 = "base.device1";
+
+				printf("------------------- TEST02--------------------- \n");
+				printf("[ TEST ]: getConfiguration(pid=%s) - Looking for it in Cache \n",pid2);
+				configuration_t configuration2;
+				(*confAdminServ->getConfiguration)(confAdminServ->configAdmin,pid2, &configuration2);
+
+				test_debugConfiguration(configuration2, pid2);
+
+				/* ------------------ register ManagedService -------------*/
+
+				printf("------------------- TEST03 -------------------- \n");
+				printf("[ TEST ]: register ManagedService(pid=%s) \n",pid);
+
+
+				managed_service_t instance;
+				status = managedServiceImpl_create(ctx, &instance);
+				if (status != CELIX_SUCCESS){
+					return status;
+				}
+
+				managed_service_service_t managedService;
+				status = managedService_create(ctx, &managedService);
+				if (status != CELIX_SUCCESS){
+					return status;
+				}
+
+				managedService->managedService = instance;
+				managedService->updated = managedServiceImpl_updated;
+
+				PROPERTIES dictionary;
+				dictionary = properties_create();
+				properties_set(dictionary, (char *) SERVICE_PID, pid);
+
+				status = bundleContext_registerService(ctx, (char *) MANAGED_SERVICE_SERVICE_NAME,
+						managedService, dictionary, &instance->registration);
+				if (status != CELIX_SUCCESS){
+					printf("[ ERROR ]: Managed Service not registered \n");
+					return status;
+				}
+
+				printf("[ TEST ]: ManagedService(pid=%s) registered  \n",pid);
+
+				/* ------------------ update Configuration ----------------*/
+
+				printf("------------------- TEST04 -------------------- \n");
+				printf("[ TEST ]: configuration update NULL \n");
+				configuration_update(configuration , NULL);
+
+				/* ------------------ update Configuration ----------------*/
+
+				printf("------------------- TEST05 -------------------- \n");
+				printf("[ TEST ]: configuration update New Properties \n");
+				char *prop1 = "type";
+				char *value1 = "printer";
+				PROPERTIES properties = properties_create();
+				properties_set(properties, prop1, value1);
+				configuration_update(configuration , properties);
+
+				/* ------------------ Configuration get Props ----------------*/
+
+				printf("------------------- TEST06 -------------------- \n");
+				printf("[ TEST ]: configuration get properties \n");
+
+				PROPERTIES propsRx = properties_create();
+				configuration_getProperties(configuration, &propsRx);
+
+				printf("[ TEST ]: PROP=%s - VALUE=%s \n", (char*)SERVICE_PID, properties_get(propsRx,(char*)SERVICE_PID));
+				printf("[ TEST ]: PROP=%s - VALUE=%s \n", prop1, properties_get(propsRx,prop1));
+
+				printf("/////////////////// END TESTS ///////////////// \n");
+
+			}
+		}
+	}
+	return status;
+}
+
+celix_status_t bundleActivator_stop(void * userData, BUNDLE_CONTEXT context) {
+	return CELIX_SUCCESS;
+}
+
+celix_status_t bundleActivator_destroy(void * userData, BUNDLE_CONTEXT context) {
+	return CELIX_SUCCESS;
+}
+
+void test_debugConfiguration(configuration_t configuration, char* pid){
+
+	if (configuration == NULL){
+		printf("[ TEST ]: Configuration(pid=%s) is NULL \n", pid);
+	} else{
+		printf("[ TEST ]: Configuration(pid=%s) OK \n", pid);
+	}
+
+}

Added: celix/branches/celix_config_admin/config_admin/examples/example_test/private/src/example_managed_service_impl.c
URL: http://svn.apache.org/viewvc/celix/branches/celix_config_admin/config_admin/examples/example_test/private/src/example_managed_service_impl.c?rev=1633678&view=auto
==============================================================================
--- celix/branches/celix_config_admin/config_admin/examples/example_test/private/src/example_managed_service_impl.c (added)
+++ celix/branches/celix_config_admin/config_admin/examples/example_test/private/src/example_managed_service_impl.c Wed Oct 22 18:53:39 2014
@@ -0,0 +1,102 @@
+/**
+ *Licensed to the Apache Software Foundation (ASF) under one
+ *or more contributor license agreements.  See the NOTICE file
+ *distributed with this work for additional information
+ *regarding copyright ownership.  The ASF licenses this file
+ *to you under the Apache License, Version 2.0 (the
+ *"License"); you may not use this file except in compliance
+ *with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *Unless required by applicable law or agreed to in writing,
+ *software distributed under the License is distributed on an
+ *"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ *specific language governing permissions and limitations
+ *under the License.
+ */
+/*
+ * example_managed_service_impl.c
+ *
+ *  \date       Aug 12, 2013
+ *  \author    	<a href="mailto:celix-dev@incubator.apache.org">Apache Celix Project Team</a>
+ *  \copyright	Apache License, Version 2.0
+ */
+
+
+#include <stdlib.h>
+#include <stdio.h>
+
+#include "example_managed_service_impl.h"
+
+/* ------------------------ Constructor -------------------------------------*/
+
+celix_status_t managedServiceImpl_create(BUNDLE_CONTEXT context, managed_service_t *instance){
+
+	celix_status_t status;
+
+	apr_pool_t *pool;
+	status = bundleContext_getMemoryPool(context,&pool);
+	if (status != CELIX_SUCCESS){
+		printf("[ ERROR ]: ManagedServiceImpl - Instance not initialized \n");
+		return status;
+	}
+
+	managed_service_t managedService = apr_palloc(pool,sizeof(*managedService));
+	if(!managedService){
+		printf("[ ERROR ]: ManagedServiceImpl - Not initialized (ENOMEM) \n");
+		return CELIX_ENOMEM;
+	}
+
+	managedService->pool = pool;
+	managedService->context = context;
+	managedService->registration = NULL;
+	managedService->properties = NULL;
+
+	printf("[ ManagedServiceImpl ]: ManagedServiceImpl - Initialized \n");
+	*instance = managedService;
+	return CELIX_SUCCESS;
+}
+
+
+/* -------------------- Implementation --------------------------------------*/
+
+celix_status_t managedServiceImpl_updated(managed_service_t managedService, PROPERTIES properties){
+
+	if (properties == NULL){
+		printf("[ managedServiceImpl ]: updated - Received NULL properties \n");
+		managedService->properties = NULL;
+	}else{
+		printf("[ managedServiceImpl ]: updated - Received New Properties \n");
+		managedService->properties = properties_create();
+		managedService->properties = properties;
+	}
+
+	return CELIX_SUCCESS;
+}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

Added: celix/branches/celix_config_admin/config_admin/examples/example_test2/CMakeLists.txt
URL: http://svn.apache.org/viewvc/celix/branches/celix_config_admin/config_admin/examples/example_test2/CMakeLists.txt?rev=1633678&view=auto
==============================================================================
--- celix/branches/celix_config_admin/config_admin/examples/example_test2/CMakeLists.txt (added)
+++ celix/branches/celix_config_admin/config_admin/examples/example_test2/CMakeLists.txt Wed Oct 22 18:53:39 2014
@@ -0,0 +1,21 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+# 
+#   http://www.apache.org/licenses/LICENSE-2.0
+# 
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+
+add_subdirectory(bundle_configuring)	
+add_subdirectory(bundle_managed_service)
+	
\ No newline at end of file

Added: celix/branches/celix_config_admin/config_admin/examples/example_test2/bundle_configuring/CMakeLists.txt
URL: http://svn.apache.org/viewvc/celix/branches/celix_config_admin/config_admin/examples/example_test2/bundle_configuring/CMakeLists.txt?rev=1633678&view=auto
==============================================================================
--- celix/branches/celix_config_admin/config_admin/examples/example_test2/bundle_configuring/CMakeLists.txt (added)
+++ celix/branches/celix_config_admin/config_admin/examples/example_test2/bundle_configuring/CMakeLists.txt Wed Oct 22 18:53:39 2014
@@ -0,0 +1,30 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+# 
+#   http://www.apache.org/licenses/LICENSE-2.0
+# 
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+
+include_directories("${PROJECT_SOURCE_DIR}/utils/public/include")
+include_directories("${PROJECT_SOURCE_DIR}/framework/public/include")
+include_directories("${PROJECT_SOURCE_DIR}/config_admin/service/public/include")
+
+SET(BUNDLE_SYMBOLICNAME  "bundle_configuraring")
+SET(BUNDLE_VERSION "0.1.0")
+
+bundle(bundle_configuring SOURCES 
+	private/src/activator
+)
+
+target_link_libraries(bundle_configuring celix_framework celix_utils config_admin ${APR_LIBRARY})

Added: celix/branches/celix_config_admin/config_admin/examples/example_test2/bundle_configuring/META-INF/MANIFEST.MF
URL: http://svn.apache.org/viewvc/celix/branches/celix_config_admin/config_admin/examples/example_test2/bundle_configuring/META-INF/MANIFEST.MF?rev=1633678&view=auto
==============================================================================
--- celix/branches/celix_config_admin/config_admin/examples/example_test2/bundle_configuring/META-INF/MANIFEST.MF (added)
+++ celix/branches/celix_config_admin/config_admin/examples/example_test2/bundle_configuring/META-INF/MANIFEST.MF Wed Oct 22 18:53:39 2014
@@ -0,0 +1,5 @@
+Manifest-Version: 1.0
+Bundle-SymbolicName: bundle_configuring
+Bundle-Version: 1.0.0
+library: bundle_configuring
+Import-Service: configuration_admin

Added: celix/branches/celix_config_admin/config_admin/examples/example_test2/bundle_configuring/private/src/activator.c
URL: http://svn.apache.org/viewvc/celix/branches/celix_config_admin/config_admin/examples/example_test2/bundle_configuring/private/src/activator.c?rev=1633678&view=auto
==============================================================================
--- celix/branches/celix_config_admin/config_admin/examples/example_test2/bundle_configuring/private/src/activator.c (added)
+++ celix/branches/celix_config_admin/config_admin/examples/example_test2/bundle_configuring/private/src/activator.c Wed Oct 22 18:53:39 2014
@@ -0,0 +1,94 @@
+/*
+ ============================================================================
+ Name        	: activator.c
+ Developed at	: Thales
+ Supervisor	 	: Pepijn NOLTES
+ Author      	: Jorge SANCHEZ
+ Version     	: 0.1 - Jul 12, 2013
+ Package	 	: celix.config_admin.examples.example_test2
+ Description	: Example
+ Reviews	 	:
+ ============================================================================
+ */
+
+#include <stdbool.h>
+#include <stdlib.h>
+#include <stdio.h>
+
+/* celix.framework */
+#include "bundle_activator.h"
+#include "bundle_context.h"
+#include "constants.h"
+#include "properties.h"
+#include "utils.h"
+/* celix.utils */
+#include "hash_map.h"
+/* celix.configadmin */
+#include "configuration_admin.h"
+#include "configuration.h"
+
+
+celix_status_t bundleActivator_create(BUNDLE_CONTEXT context, void **userData) {
+	*userData = NULL;
+	return CELIX_SUCCESS;
+}
+
+celix_status_t bundleActivator_start(void * userData, BUNDLE_CONTEXT ctx) {
+
+	SERVICE_REFERENCE ref = NULL;
+	celix_status_t status = bundleContext_getServiceReference(ctx, (char *) CONFIGURATION_ADMIN_SERVICE_NAME, &ref);
+
+	if (status == CELIX_SUCCESS) {
+
+		if (ref == NULL) {
+
+			printf("[configAdminClient]: ConfigAdminService reference not available\n");
+
+		} else {
+
+			configuration_admin_service_t confAdminServ = NULL;
+			bundleContext_getService(ctx, ref, (void *) &confAdminServ);
+
+			if (confAdminServ == NULL){
+
+				printf("[ BUNDLE configuring ]: ConfigAdminService not available\n");
+
+			} else {
+
+				char *pid = "base.device1";
+
+				configuration_t configuration;
+				char *configurationLocation;
+
+				/* ------------------ get Configuration -------------------*/
+				printf("[ BUNDLE configuring ]: getConfiguration(pid=%s) \n",pid);
+
+				(*confAdminServ->getConfiguration)(confAdminServ->configAdmin,pid, &configuration);
+
+				/* ------------------ Configuration get Props ----------------*/
+				printf("[ BUNDLE configuring ]: configuration getBundleLocation \n");
+
+				configuration_getBundleLocation(configuration, &configurationLocation);
+
+				/* -------------------- Validation ---------------------------*/
+
+				printf("[ BUNDLE configuring ]: I have a Configuration that belongs to: \n ");
+				printf(" %s \n ", configurationLocation);
+
+				printf("[ BUNDLE configuring ]: END \n");
+
+			}
+		}
+	}
+	return status;
+}
+
+celix_status_t bundleActivator_stop(void * userData, BUNDLE_CONTEXT context) {
+	return CELIX_SUCCESS;
+}
+
+celix_status_t bundleActivator_destroy(void * userData, BUNDLE_CONTEXT context) {
+	return CELIX_SUCCESS;
+}
+
+

Added: celix/branches/celix_config_admin/config_admin/examples/example_test2/bundle_managed_service/CMakeLists.txt
URL: http://svn.apache.org/viewvc/celix/branches/celix_config_admin/config_admin/examples/example_test2/bundle_managed_service/CMakeLists.txt?rev=1633678&view=auto
==============================================================================
--- celix/branches/celix_config_admin/config_admin/examples/example_test2/bundle_managed_service/CMakeLists.txt (added)
+++ celix/branches/celix_config_admin/config_admin/examples/example_test2/bundle_managed_service/CMakeLists.txt Wed Oct 22 18:53:39 2014
@@ -0,0 +1,32 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+# 
+#   http://www.apache.org/licenses/LICENSE-2.0
+# 
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+
+include_directories("${PROJECT_SOURCE_DIR}/utils/public/include")
+include_directories("${PROJECT_SOURCE_DIR}/framework/public/include")
+include_directories("${PROJECT_SOURCE_DIR}/config_admin/service/public/include")
+include_directories("private/include")
+
+SET(BUNDLE_SYMBOLICNAME "bundle_managed_service")
+SET(BUNDLE_VERSION "0.1.0")
+
+bundle(bundle_managed_service SOURCES 
+	private/src/activator
+	private/src/example_managed_service_impl
+)
+
+target_link_libraries(bundle_managed_service celix_framework celix_utils config_admin ${APR_LIBRARY})

Added: celix/branches/celix_config_admin/config_admin/examples/example_test2/bundle_managed_service/META-INF/MANIFEST.MF
URL: http://svn.apache.org/viewvc/celix/branches/celix_config_admin/config_admin/examples/example_test2/bundle_managed_service/META-INF/MANIFEST.MF?rev=1633678&view=auto
==============================================================================
--- celix/branches/celix_config_admin/config_admin/examples/example_test2/bundle_managed_service/META-INF/MANIFEST.MF (added)
+++ celix/branches/celix_config_admin/config_admin/examples/example_test2/bundle_managed_service/META-INF/MANIFEST.MF Wed Oct 22 18:53:39 2014
@@ -0,0 +1,5 @@
+Manifest-Version: 1.0
+Bundle-SymbolicName: bundle_managed_service
+Bundle-Version: 1.0.0
+library: bundle_managed_service
+Import-Service: configuration_admin

Added: celix/branches/celix_config_admin/config_admin/examples/example_test2/bundle_managed_service/private/include/example_managed_service_impl.h
URL: http://svn.apache.org/viewvc/celix/branches/celix_config_admin/config_admin/examples/example_test2/bundle_managed_service/private/include/example_managed_service_impl.h?rev=1633678&view=auto
==============================================================================
--- celix/branches/celix_config_admin/config_admin/examples/example_test2/bundle_managed_service/private/include/example_managed_service_impl.h (added)
+++ celix/branches/celix_config_admin/config_admin/examples/example_test2/bundle_managed_service/private/include/example_managed_service_impl.h Wed Oct 22 18:53:39 2014
@@ -0,0 +1,58 @@
+/**
+ *Licensed to the Apache Software Foundation (ASF) under one
+ *or more contributor license agreements.  See the NOTICE file
+ *distributed with this work for additional information
+ *regarding copyright ownership.  The ASF licenses this file
+ *to you under the Apache License, Version 2.0 (the
+ *"License"); you may not use this file except in compliance
+ *with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *Unless required by applicable law or agreed to in writing,
+ *software distributed under the License is distributed on an
+ *"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ *specific language governing permissions and limitations
+ *under the License.
+ */
+/*
+ * example_managed_service_impl.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_IMPL_H_
+#define MANAGED_SERVICE_IMPL_H_
+
+
+/* APR */
+#include <apr_general.h>
+/* celix.utils*/
+#include "properties.h"
+/* celix.framework */
+#include "celix_errno.h"
+#include "service_registration.h"
+#include "bundle_context.h"
+/* celix.config_admin.ManagedService */
+#include "managed_service.h"
+
+
+struct managed_service{
+
+	apr_pool_t 				*pool;
+	BUNDLE_CONTEXT 			context;
+
+	SERVICE_REGISTRATION 	registration;
+	PROPERTIES 				properties;
+
+};
+
+
+celix_status_t managedServiceImpl_create(BUNDLE_CONTEXT context, managed_service_t *instance);
+celix_status_t managedServiceImpl_updated(managed_service_t instance, PROPERTIES properties);
+
+#endif /* MANAGED_SERVICE_IMPL_H_ */

Added: celix/branches/celix_config_admin/config_admin/examples/example_test2/bundle_managed_service/private/src/activator.c
URL: http://svn.apache.org/viewvc/celix/branches/celix_config_admin/config_admin/examples/example_test2/bundle_managed_service/private/src/activator.c?rev=1633678&view=auto
==============================================================================
--- celix/branches/celix_config_admin/config_admin/examples/example_test2/bundle_managed_service/private/src/activator.c (added)
+++ celix/branches/celix_config_admin/config_admin/examples/example_test2/bundle_managed_service/private/src/activator.c Wed Oct 22 18:53:39 2014
@@ -0,0 +1,120 @@
+/**
+ *Licensed to the Apache Software Foundation (ASF) under one
+ *or more contributor license agreements.  See the NOTICE file
+ *distributed with this work for additional information
+ *regarding copyright ownership.  The ASF licenses this file
+ *to you under the Apache License, Version 2.0 (the
+ *"License"); you may not use this file except in compliance
+ *with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *Unless required by applicable law or agreed to in writing,
+ *software distributed under the License is distributed on an
+ *"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ *specific language governing permissions and limitations
+ *under the License.
+ */
+/*
+ * activator.c
+ *
+ *  \date       Aug 12, 2013
+ *  \author    	<a href="mailto: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.framework */
+#include "bundle_activator.h"
+#include "bundle_context.h"
+#include "constants.h"
+#include "properties.h"
+#include "utils.h"
+/* celix.utils */
+#include "hash_map.h"
+/* celix.configadmin */
+#include "configuration_admin.h"
+#include "configuration.h"
+#include "managed_service.h"
+/* celix.config_admin.examples.private */
+#include "example_managed_service_impl.h"
+
+
+celix_status_t bundleActivator_start(void * userData, BUNDLE_CONTEXT ctx) {
+
+	SERVICE_REFERENCE ref = NULL;
+	celix_status_t status = bundleContext_getServiceReference(ctx, (char *) CONFIGURATION_ADMIN_SERVICE_NAME, &ref);
+
+	if (status == CELIX_SUCCESS) {
+
+		if (ref == NULL) {
+
+			printf("[configAdminClient]: ConfigAdminService reference not available\n");
+
+		} else {
+
+			printf("------------------- DEMO ---------------------- \n");
+
+			configuration_admin_service_t confAdminServ = NULL;
+			bundleContext_getService(ctx, ref, (void *) &confAdminServ);
+
+			if (confAdminServ == NULL){
+
+				printf("[ TEST ]: ConfigAdminService not available\n");
+
+			} else {
+
+				char *pid = "base.device1";
+				/* ------------------ register ManagedService -------------*/
+
+				printf("[ BUNDLE example_managed_service ]: register ManagedService(pid=%s) \n",pid);
+
+
+				managed_service_t instance;
+				status = managedServiceImpl_create(ctx, &instance);
+				if (status != CELIX_SUCCESS){
+					return status;
+				}
+
+				managed_service_service_t managedService;
+				status = managedService_create(ctx, &managedService);
+				if (status != CELIX_SUCCESS){
+					return status;
+				}
+
+				managedService->managedService = instance;
+				managedService->updated = managedServiceImpl_updated;
+
+				PROPERTIES dictionary;
+				dictionary = properties_create();
+				properties_set(dictionary, (char *) SERVICE_PID, pid);
+
+				status = bundleContext_registerService(ctx, (char *) MANAGED_SERVICE_SERVICE_NAME,
+						managedService, dictionary, &instance->registration);
+				if (status != CELIX_SUCCESS){
+					printf("[ ERROR ]: Managed Service not registered \n");
+					return status;
+				}
+
+				printf("[ BUNDLE example_managed_service ]: ManagedService(pid=%s) registered  \n",pid);
+
+			}
+		}
+	}
+	return status;
+}
+
+celix_status_t bundleActivator_stop(void * userData, BUNDLE_CONTEXT context) {
+	return CELIX_SUCCESS;
+}
+
+celix_status_t bundleActivator_destroy(void * userData, BUNDLE_CONTEXT context) {
+	return CELIX_SUCCESS;
+}
+
+

Added: celix/branches/celix_config_admin/config_admin/examples/example_test2/bundle_managed_service/private/src/example_managed_service_impl.c
URL: http://svn.apache.org/viewvc/celix/branches/celix_config_admin/config_admin/examples/example_test2/bundle_managed_service/private/src/example_managed_service_impl.c?rev=1633678&view=auto
==============================================================================
--- celix/branches/celix_config_admin/config_admin/examples/example_test2/bundle_managed_service/private/src/example_managed_service_impl.c (added)
+++ celix/branches/celix_config_admin/config_admin/examples/example_test2/bundle_managed_service/private/src/example_managed_service_impl.c Wed Oct 22 18:53:39 2014
@@ -0,0 +1,102 @@
+/**
+ *Licensed to the Apache Software Foundation (ASF) under one
+ *or more contributor license agreements.  See the NOTICE file
+ *distributed with this work for additional information
+ *regarding copyright ownership.  The ASF licenses this file
+ *to you under the Apache License, Version 2.0 (the
+ *"License"); you may not use this file except in compliance
+ *with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *Unless required by applicable law or agreed to in writing,
+ *software distributed under the License is distributed on an
+ *"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ *specific language governing permissions and limitations
+ *under the License.
+ */
+/*
+ * example_managed_service_impl.c
+ *
+ *  \date       Aug 12, 2013
+ *  \author    	<a href="mailto:celix-dev@incubator.apache.org">Apache Celix Project Team</a>
+ *  \copyright	Apache License, Version 2.0
+ */
+
+
+#include <stdlib.h>
+#include <stdio.h>
+
+#include "example_managed_service_impl.h"
+
+/* ------------------------ Constructor -------------------------------------*/
+
+celix_status_t managedServiceImpl_create(BUNDLE_CONTEXT context, managed_service_t *instance){
+
+	celix_status_t status;
+
+	apr_pool_t *pool;
+	status = bundleContext_getMemoryPool(context,&pool);
+	if (status != CELIX_SUCCESS){
+		printf("[ ERROR ]: ManagedServiceImpl - Instance not initialized \n");
+		return status;
+	}
+
+	managed_service_t managedService = apr_palloc(pool,sizeof(*managedService));
+	if(!managedService){
+		printf("[ ERROR ]: ManagedServiceImpl - Not initialized (ENOMEM) \n");
+		return CELIX_ENOMEM;
+	}
+
+	managedService->pool = pool;
+	managedService->context = context;
+	managedService->registration = NULL;
+	managedService->properties = NULL;
+
+	printf("[ ManagedServiceImpl ]: ManagedServiceImpl - Initialized \n");
+	*instance = managedService;
+	return CELIX_SUCCESS;
+}
+
+
+/* -------------------- Implementation --------------------------------------*/
+
+celix_status_t managedServiceImpl_updated(managed_service_t managedService, PROPERTIES properties){
+
+	if (properties == NULL){
+		printf("[ managedServiceImpl ]: updated - Received NULL properties \n");
+		managedService->properties = NULL;
+	}else{
+		printf("[ managedServiceImpl ]: updated - Received New Properties \n");
+		managedService->properties = properties_create();
+		managedService->properties = properties;
+	}
+
+	return CELIX_SUCCESS;
+}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

Added: celix/branches/celix_config_admin/config_admin/service/CMakeLists.txt
URL: http://svn.apache.org/viewvc/celix/branches/celix_config_admin/config_admin/service/CMakeLists.txt?rev=1633678&view=auto
==============================================================================
--- celix/branches/celix_config_admin/config_admin/service/CMakeLists.txt (added)
+++ celix/branches/celix_config_admin/config_admin/service/CMakeLists.txt Wed Oct 22 18:53:39 2014
@@ -0,0 +1,41 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+# 
+#   http://www.apache.org/licenses/LICENSE-2.0
+# 
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+
+include_directories("${PROJECT_SOURCE_DIR}/utils/public/include")
+include_directories("${PROJECT_SOURCE_DIR}/framework/public/include")
+include_directories("public/include")
+include_directories("private/include")
+
+SET(BUNDLE_SYMBOLICNAME "config_admin")
+SET(BUNDLE_VERSION "0.0.1")
+ 		
+bundle(config_admin SOURCES 
+	private/src/activator 
+	private/src/configuration_admin_factory
+	private/src/configuration_admin_impl
+	private/src/configuration_impl
+	private/src/configuration_store
+	private/src/framework_patch
+	private/src/managed_service_impl.c
+	private/src/managed_service_tracker.c
+	private/src/updated_thread_pool.c
+)
+
+target_link_libraries(config_admin celix_framework celix_utils ${APR_LIBRARY} ${APRUTIL_LIBRARY})
+	
+

Added: celix/branches/celix_config_admin/config_admin/service/META-INF/MANIFEST.MF
URL: http://svn.apache.org/viewvc/celix/branches/celix_config_admin/config_admin/service/META-INF/MANIFEST.MF?rev=1633678&view=auto
==============================================================================
--- celix/branches/celix_config_admin/config_admin/service/META-INF/MANIFEST.MF (added)
+++ celix/branches/celix_config_admin/config_admin/service/META-INF/MANIFEST.MF Wed Oct 22 18:53:39 2014
@@ -0,0 +1,6 @@
+Manifest-Version: 1.0
+Bundle-SymbolicName: config_admin
+Bundle-Version: 1.0.0
+library: config_admin
+Export-Service: configuration_admin
+Import-Service: configuration_admin

Added: celix/branches/celix_config_admin/config_admin/service/private/include/configuration_admin_factory.h
URL: http://svn.apache.org/viewvc/celix/branches/celix_config_admin/config_admin/service/private/include/configuration_admin_factory.h?rev=1633678&view=auto
==============================================================================
--- celix/branches/celix_config_admin/config_admin/service/private/include/configuration_admin_factory.h (added)
+++ celix/branches/celix_config_admin/config_admin/service/private/include/configuration_admin_factory.h Wed Oct 22 18:53:39 2014
@@ -0,0 +1,67 @@
+/**
+ *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_factory.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_FACTORY_H_
+#define CONFIGURATION_ADMIN_FACTORY_H_
+
+#include <stdbool.h>
+
+/* APR */
+#include <apr_general.h>
+/* celix.framework */
+#include "bundle.h"
+#include "bundle_context.h"
+#include "celix_errno.h"
+#include "service_reference.h"
+#include "service_factory.h"
+#include "properties.h"
+/* celix.config_admin.public*/
+#include "configuration_admin.h"
+
+
+typedef struct configuration_admin_factory *configuration_admin_factory_pt;
+
+
+/* METHODS */
+
+celix_status_t configurationAdminFactory_create(apr_pool_t *pool, bundle_context_pt context, service_factory_pt *factory, configuration_admin_factory_pt *instance);
+
+celix_status_t configurationAdminFactory_start(configuration_admin_factory_pt factory);
+celix_status_t configurationAdminFactory_stop(configuration_admin_factory_pt factory);
+
+// public void bundleChanged(BundleEvent event)
+
+celix_status_t configurationAdminFactory_checkConfigurationPermission(configuration_admin_factory_pt factory);
+
+celix_status_t configurationAdminFactory_dispatchEvent(configuration_admin_factory_pt factory, int type, char *factoryPid, char *pid);
+
+celix_status_t configurationAdminFactory_notifyConfigurationUpdated(configuration_admin_factory_pt factory, configuration_pt configuration, bool isFactory);
+celix_status_t configurationAdminFactory_notifyConfigurationDeleted(configuration_admin_factory_pt factory, configuration_pt configuration, bool isFactory);
+
+celix_status_t configurationAdminFactory_modifyConfiguration(configuration_admin_factory_pt factory, service_reference_pt reference, properties_pt properties);
+
+#endif /* CONFIGURATION_ADMIN_FACTORY_H_ */

Added: celix/branches/celix_config_admin/config_admin/service/private/include/configuration_admin_impl.h
URL: http://svn.apache.org/viewvc/celix/branches/celix_config_admin/config_admin/service/private/include/configuration_admin_impl.h?rev=1633678&view=auto
==============================================================================
--- celix/branches/celix_config_admin/config_admin/service/private/include/configuration_admin_impl.h (added)
+++ celix/branches/celix_config_admin/config_admin/service/private/include/configuration_admin_impl.h Wed Oct 22 18:53:39 2014
@@ -0,0 +1,71 @@
+/**
+ *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_impl.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_IMP_H_
+#define CONFIGURATION_ADMIN_IMP_H_
+
+
+/* config_admin.ConfigAdmin*/
+#include "configuration_admin.h"
+
+/* APR */
+#include <apr_general.h>
+/* celix.framework */
+#include "bundle.h"
+/* celix.config_admin.public */
+#include "configuration.h"
+/* celix.config_admin.private */
+#include "configuration_admin_factory.h"
+#include "configuration_store.h"
+
+
+struct configuration_admin{
+
+	apr_pool_t 		*pool;
+	bundle_pt bundle;
+
+	configuration_admin_factory_pt configurationAdminFactory;
+	configuration_store_pt configurationStore;
+};
+
+
+/* METHODS: celix.config_admin.private */
+celix_status_t configurationAdmin_create(apr_pool_t *pool,
+										 configuration_admin_factory_pt factory, configuration_store_pt store, bundle_pt bundle,
+										 configuration_admin_service_pt *service);
+
+/* METHODS: celix.config_admin.public */
+celix_status_t configurationAdmin_createFactoryConfiguration(configuration_admin_pt configAdmin, char *factoryPid, configuration_pt *configuration);
+celix_status_t configurationAdmin_createFactoryConfiguration2(configuration_admin_pt configAdmin, char *factoryPid, char *location, configuration_pt *configuration);
+
+celix_status_t configurationAdmin_getConfiguration(configuration_admin_pt configAdmin, char *pid, configuration_pt *configuration);
+celix_status_t configurationAdmin_getConfiguration2(configuration_admin_pt configAdmin, char *pid, char *location, configuration_pt *configuration);
+
+celix_status_t configurationAdmin_listConfigurations(configuration_admin_pt configAdmin, char *filter, array_list_pt *configurations);
+
+
+#endif /* CONFIGURATION_ADMIN_IMP_H_ */
+

Added: celix/branches/celix_config_admin/config_admin/service/private/include/configuration_impl.h
URL: http://svn.apache.org/viewvc/celix/branches/celix_config_admin/config_admin/service/private/include/configuration_impl.h?rev=1633678&view=auto
==============================================================================
--- celix/branches/celix_config_admin/config_admin/service/private/include/configuration_impl.h (added)
+++ celix/branches/celix_config_admin/config_admin/service/private/include/configuration_impl.h Wed Oct 22 18:53:39 2014
@@ -0,0 +1,68 @@
+/**
+ *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.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_IMPL_H_
+#define CONFIGURATION_IMPL_H_
+
+/*celix.config_admin.Configuration */
+#include "configuration.h"
+
+/* celix.framework */
+#include "bundle_context.h"
+/* celix.config_admin.private*/
+#include "configuration_admin_factory.h"
+#include "configuration_store.h"
+
+
+celix_status_t configuration_create( configuration_admin_factory_pt factory, configuration_store_pt store,
+									 char *factoryPid, char *pid, char *bundleLocation,
+									 configuration_pt *configuration);
+
+celix_status_t configuration_create2(configuration_admin_factory_pt factory, configuration_store_pt store,
+									 properties_pt dictionary,
+									 configuration_pt *configuration);
+
+celix_status_t configuration_getPool(configuration_pt configuration, apr_pool_t **pool);
+
+celix_status_t configuration_lock(configuration_pt configuration);
+celix_status_t configuration_unlock(configuration_pt configuration);
+celix_status_t configuration_checkLocked(configuration_pt configuration);
+
+celix_status_t configuration_bind(configuration_pt configuration, bundle_pt bundle, bool *isBind);
+celix_status_t configuration_unbind(configuration_pt configuration, bundle_pt bundle);
+
+celix_status_t configuration_checkDeleted(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);
+celix_status_t configuration_getAllProperties(configuration_pt configuration, properties_pt *properties);
+
+celix_status_t configuration_isDeleted(configuration_pt configuration, bool *isDeleted);
+
+
+#endif /* CONFIGURATION_IMPL_H_ */

Added: celix/branches/celix_config_admin/config_admin/service/private/include/configuration_store.h
URL: http://svn.apache.org/viewvc/celix/branches/celix_config_admin/config_admin/service/private/include/configuration_store.h?rev=1633678&view=auto
==============================================================================
--- celix/branches/celix_config_admin/config_admin/service/private/include/configuration_store.h (added)
+++ celix/branches/celix_config_admin/config_admin/service/private/include/configuration_store.h Wed Oct 22 18:53:39 2014
@@ -0,0 +1,66 @@
+/**
+ *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.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_STORE_H_
+#define CONFIGURATION_STORE_H_
+
+/* APR */
+#include <apr_general.h>
+/* celix.utils.public*/
+#include "array_list.h"
+/* celix.framework */
+#include "bundle.h"
+#include "bundle_context.h"
+#include "filter.h"
+/* celix.config_admin.public */
+#include "configuration.h"
+/* celix.config_admin.private */
+#include "configuration_admin_factory.h"
+
+typedef struct configuration_store *configuration_store_pt;
+
+/* METHODS */
+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 configurationStore_lock(configuration_store_pt store);
+celix_status_t configurationStore_unlock(configuration_store_pt store);
+
+celix_status_t configurationStore_saveConfiguration(configuration_store_pt store, char *pid, configuration_pt configuration);
+celix_status_t configurationStore_removeConfiguration(configuration_store_pt store, char *pid);
+
+celix_status_t configurationStore_getConfiguration(configuration_store_pt store, char *pid, char *location, configuration_pt *configuration);
+celix_status_t configurationStore_createFactoryConfiguration(configuration_store_pt store, char *factoryPid, char *location, configuration_pt *configuration);
+
+celix_status_t configurationStore_findConfiguration(configuration_store_pt store, char *pid, configuration_pt *configuration);
+
+celix_status_t configurationStore_getFactoryConfigurations(configuration_store_pt store, char *factoryPid, configuration_pt *configuration);
+
+celix_status_t configurationStore_listConfigurations(configuration_store_pt store, filter_pt filter, array_list_pt *configurations);
+
+celix_status_t configurationStore_unbindConfigurations(configuration_store_pt store, bundle_pt bundle);
+
+#endif /* CONFIGURATION_STORE_H_ */

Added: celix/branches/celix_config_admin/config_admin/service/private/include/framework_patch.h
URL: http://svn.apache.org/viewvc/celix/branches/celix_config_admin/config_admin/service/private/include/framework_patch.h?rev=1633678&view=auto
==============================================================================
--- celix/branches/celix_config_admin/config_admin/service/private/include/framework_patch.h (added)
+++ celix/branches/celix_config_admin/config_admin/service/private/include/framework_patch.h Wed Oct 22 18:53:39 2014
@@ -0,0 +1,39 @@
+/**
+ *Licensed to the Apache Software Foundation (ASF) under one
+ *or more contributor license agreements.  See the NOTICE file
+ *distributed with this work for additional information
+ *regarding copyright ownership.  The ASF licenses this file
+ *to you under the Apache License, Version 2.0 (the
+ *"License"); you may not use this file except in compliance
+ *with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *Unless required by applicable law or agreed to in writing,
+ *software distributed under the License is distributed on an
+ *"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ *specific language governing permissions and limitations
+ *under the License.
+ */
+/*
+ * framework_patch.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 BUNDLE_PATCH_H_
+#define BUNDLE_PATCH_H_
+
+
+/* celix.framework.public */
+#include "celix_errno.h"
+#include "bundle.h"
+#include "service_reference.h"
+
+celix_status_t bundle_getBundleLocation(bundle_pt bundle, char **location);
+
+#endif /* BUNDLE_PATCH_H_ */

Added: celix/branches/celix_config_admin/config_admin/service/private/include/managed_service_tracker.h
URL: http://svn.apache.org/viewvc/celix/branches/celix_config_admin/config_admin/service/private/include/managed_service_tracker.h?rev=1633678&view=auto
==============================================================================
--- celix/branches/celix_config_admin/config_admin/service/private/include/managed_service_tracker.h (added)
+++ celix/branches/celix_config_admin/config_admin/service/private/include/managed_service_tracker.h 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_tracker.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_tracker_pt_H_
+#define MANAGED_service_tracker_pt_H_
+
+/* APR */
+#include <apr_general.h>
+/* celix.framework */
+#include "bundle_context.h"
+#include "celix_errno.h"
+#include "service_reference.h"
+#include "service_tracker.h"
+/* celix.config_admin.public */
+#include "configuration.h"
+/* celix.config_admin.private */
+#include "configuration_admin_factory.h"
+#include "configuration_store.h"
+
+
+typedef struct managed_service_tracker *managed_service_tracker_t;
+
+
+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 managedServiceTracker_notifyDeleted(managed_service_tracker_t tracker, configuration_pt configuration);
+celix_status_t managedServiceTracker_notifyUpdated(managed_service_tracker_t tracker, configuration_pt configuration);
+
+celix_status_t managedServiceTracker_addingService(void * handle, service_reference_pt reference, void **service);
+celix_status_t managedServiceTracker_addedService(void * handle, service_reference_pt reference, void * service);
+celix_status_t managedServiceTracker_modifiedService(void * handle, service_reference_pt reference, void * service);
+celix_status_t managedServiceTracker_removedService(void * handle, service_reference_pt reference, void * service);
+
+
+#endif /* MANAGED_service_tracker_pt_H_ */

Added: celix/branches/celix_config_admin/config_admin/service/private/include/updated_thread_pool.h
URL: http://svn.apache.org/viewvc/celix/branches/celix_config_admin/config_admin/service/private/include/updated_thread_pool.h?rev=1633678&view=auto
==============================================================================
--- celix/branches/celix_config_admin/config_admin/service/private/include/updated_thread_pool.h (added)
+++ celix/branches/celix_config_admin/config_admin/service/private/include/updated_thread_pool.h Wed Oct 22 18:53:39 2014
@@ -0,0 +1,55 @@
+/**
+ *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.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 UPDATED_THREAD_POOL_H_
+#define UPDATED_THREAD_POOL_H_
+
+
+#define INIT_THREADS 0
+#define MAX_THREADS 10
+
+
+typedef struct updated_thread_pool *updated_thread_pool_t;
+
+/* APR */
+#include <apr.h>
+#include <apr_pools.h>
+/* celix.framework.public */
+#include "bundle_context.h"
+#include "celix_errno.h"
+#include "properties.h"
+/* celix.config_admin.public*/
+#include "managed_service.h"
+
+
+
+celix_status_t updatedThreadPool_create(apr_pool_t *pool, bundle_context_pt context, apr_int64_t maxTreads, updated_thread_pool_t *updatedThreadPool);
+
+celix_status_t updatedThreadPool_push(updated_thread_pool_t updatedThreadPool, managed_service_service_pt service, properties_pt properties);
+
+
+#endif /* UPDATED_THREAD_POOL_H_ */

Added: celix/branches/celix_config_admin/config_admin/service/private/src/activator.c
URL: http://svn.apache.org/viewvc/celix/branches/celix_config_admin/config_admin/service/private/src/activator.c?rev=1633678&view=auto
==============================================================================
--- celix/branches/celix_config_admin/config_admin/service/private/src/activator.c (added)
+++ celix/branches/celix_config_admin/config_admin/service/private/src/activator.c Wed Oct 22 18:53:39 2014
@@ -0,0 +1,137 @@
+/**
+ *Licensed to the Apache Software Foundation (ASF) under one
+ *or more contributor license agreements.  See the NOTICE file
+ *distributed with this work for additional information
+ *regarding copyright ownership.  The ASF licenses this file
+ *to you under the Apache License, Version 2.0 (the
+ *"License"); you may not use this file except in compliance
+ *with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *Unless required by applicable law or agreed to in writing,
+ *software distributed under the License is distributed on an
+ *"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ *specific language governing permissions and limitations
+ *under the License.
+ */
+/*
+ * activator.c
+ *
+ *  \date       Aug 12, 2013
+ *  \author    	<a href="mailto:celix-dev@incubator.apache.org">Apache Celix Project Team</a>
+ *  \copyright	Apache License, Version 2.0
+ */
+
+
+#include <stddef.h>
+#include <stdlib.h>
+#include <stdio.h>
+
+/* APR */
+#include <apr_general.h>
+/* celix.framework.public */
+#include "bundle_activator.h"
+#include "bundle_context.h"
+#include "celix_errno.h"
+#include "service_factory.h"
+#include "service_registration.h"
+/* celix.config_admin.public */
+#include "configuration_admin.h"
+/* celix.config_admin.private */
+#include "configuration_admin_factory.h"
+
+
+struct config_admin_bundle {
+	apr_pool_t *pool;
+	bundle_context_pt context;
+	service_registration_pt configAdminFactoryReg;
+};
+
+typedef struct config_admin_bundle *config_admin_bundle_t;
+
+
+/* -------------------- Implements BundleActivator ---------------------------- */
+
+celix_status_t bundleActivator_create(bundle_context_pt context, void **userData) {
+
+	celix_status_t status = CELIX_SUCCESS;
+
+	apr_pool_t *pool;
+	status = bundleContext_getMemoryPool(context, &pool);
+
+	if (status == CELIX_SUCCESS) {
+
+		config_admin_bundle_t bi = apr_palloc(pool, sizeof(struct config_admin_bundle));
+
+		if (bi == NULL) {
+
+			status = CELIX_ENOMEM;
+
+		} else {
+
+			(*userData) = bi;
+			bi->context = context;
+			bi->pool = pool;
+			bi->configAdminFactoryReg = NULL;
+
+			status = CELIX_SUCCESS;
+
+		}
+	}
+	return status;
+}
+
+celix_status_t bundleActivator_start(void * userData, bundle_context_pt context) {
+
+	celix_status_t status;
+
+	config_admin_bundle_t bi = (config_admin_bundle_t) userData;
+
+	service_factory_pt configAdminFactory;
+	configuration_admin_factory_pt configAdminFactoryInstance;
+
+	status = configurationAdminFactory_create(bi->pool, bi->context, &configAdminFactory, &configAdminFactoryInstance);
+	if (status != CELIX_SUCCESS){
+		return status;
+	}
+
+	status = bundleContext_registerServiceFactory(bi->context, (char *) CONFIGURATION_ADMIN_SERVICE_NAME, configAdminFactory, NULL, &bi->configAdminFactoryReg);
+	if (status != CELIX_SUCCESS){
+		return status;
+	}
+	printf("[ SUCCESS ]: Activator - ConfigAdminFactory Registered \n");
+
+	status = configurationAdminFactory_start(configAdminFactoryInstance);
+	if (status != CELIX_SUCCESS){
+		return status;
+	}
+
+	return CELIX_SUCCESS;
+
+}
+
+celix_status_t bundleActivator_stop(void * userData, bundle_context_pt context) {
+
+	celix_status_t status = CELIX_SUCCESS;
+
+	config_admin_bundle_t bi = (config_admin_bundle_t) userData;
+
+	serviceRegistration_unregister(bi->configAdminFactoryReg);
+
+	bi->configAdminFactoryReg = NULL;
+
+	return CELIX_SUCCESS;
+}
+
+celix_status_t bundleActivator_destroy(void * userData, bundle_context_pt context) {
+	return CELIX_SUCCESS;
+}
+
+
+
+
+
+
+

Added: celix/branches/celix_config_admin/config_admin/service/private/src/configuration_admin_factory.c
URL: http://svn.apache.org/viewvc/celix/branches/celix_config_admin/config_admin/service/private/src/configuration_admin_factory.c?rev=1633678&view=auto
==============================================================================
--- celix/branches/celix_config_admin/config_admin/service/private/src/configuration_admin_factory.c (added)
+++ celix/branches/celix_config_admin/config_admin/service/private/src/configuration_admin_factory.c Wed Oct 22 18:53:39 2014
@@ -0,0 +1,206 @@
+/**
+ *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_factory.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 <stddef.h>
+#include <stdlib.h>
+#include <stdio.h>
+
+/* celix.config_admin.ConfigAdminFactory */
+#include "configuration_admin_factory.h"
+
+/* celix.framework.Patch*/
+#include "framework_patch.h"
+/* celix.config_admin.public*/
+#include "configuration_admin.h"
+/* celix.config_admin.private*/
+#include "configuration_admin_impl.h"
+#include "managed_service_tracker.h"
+#include "configuration_store.h"
+
+
+struct configuration_admin_factory{
+
+	apr_pool_t 		*pool;
+	bundle_context_pt 	context;
+
+//	configuration_permission_t configurationPermission;
+//	event_dispatcher_t eventDispatcher;
+//	plugin_manager_t pluginManager;
+	managed_service_tracker_t managedServiceTrackerHandle;
+	service_tracker_pt managedServiceTracker;
+//	managed_service_factory_ptracker_t managedServiceFactoryTracker;
+	configuration_store_pt configurationStore;
+
+};
+
+
+celix_status_t configurationAdminFactory_getService(void *factory, bundle_pt bundle, service_registration_pt registration, void **service);
+celix_status_t configurationAdminFactory_ungetService(void *factory, bundle_pt bundle, service_registration_pt registration);
+
+
+/* ========== CONSTRUCTOR =========== */
+
+/* ---------- public ---------- */
+
+celix_status_t configurationAdminFactory_create(apr_pool_t *pool, bundle_context_pt context, service_factory_pt *factory, configuration_admin_factory_pt *instance){
+
+	celix_status_t status;
+
+	configuration_admin_factory_pt this = apr_palloc(pool, sizeof(*this));
+	configuration_store_pt configurationStore;
+	managed_service_tracker_t managedServiceTrackerHandle;
+	service_tracker_pt managedServiceTracker;
+
+	// (1) SERVICE FACTORY
+	*factory = apr_palloc(pool, sizeof(**factory));
+    if (!*factory) {
+        return CELIX_ENOMEM;
+    }
+    // (2) FACTORY DATA
+	if (!this){
+		printf("[ ERROR ]: ConfigAdminFactory - Not initialized \n");
+		return CELIX_ENOMEM;
+	}
+	// (2.1) CONFIGURATION STORE
+	status = configurationStore_create(pool, context, this, &configurationStore);
+	if (status != CELIX_SUCCESS){
+		return status;
+	}
+	// (2.2) SERVICE TRACKER
+	status = managedServiceTracker_create(pool, context, this, configurationStore, &managedServiceTrackerHandle, &managedServiceTracker);
+	if (status != CELIX_SUCCESS){
+		return status;
+	}
+	// (3) INITIALIZATION
+	this->pool = pool;
+	this->context = context;
+
+	this->managedServiceTrackerHandle = managedServiceTrackerHandle;
+	this->managedServiceTracker = managedServiceTracker;
+	this->configurationStore = configurationStore;
+
+	(*factory)->factory = this;
+	(*factory)->getService = configurationAdminFactory_getService;
+	(*factory)->ungetService = configurationAdminFactory_ungetService;
+
+	printf("[ SUCCESS ]: ConfigAdminFactory - Initialized \n");
+	*instance = this;
+	return CELIX_SUCCESS;
+
+}
+
+/* ========== IMPLEMENTS SERVICE FACTORY ========== */
+
+/* ---------- public ---------- */
+
+celix_status_t configurationAdminFactory_getService(void *factory, bundle_pt bundle, service_registration_pt registration, void **service){
+
+	celix_status_t status;
+
+	configuration_admin_factory_pt configAdminFactory = ((service_factory_pt) factory)->factory;
+	configuration_admin_service_pt confAdminService;
+
+	// TODO
+	// (1) reference = registration.getServiceReference
+	// (2) eventDispatcher.setServiceReference(reference);
+
+	// (3) return new ConfigurationAdminImpl(this, configurationStore, bundle);
+	status = configurationAdmin_create(configAdminFactory->pool, configAdminFactory, configAdminFactory->configurationStore, bundle, &confAdminService);
+	if (status != CELIX_SUCCESS){
+		return status;
+	}
+
+	/* DEBUG CODE */
+		char* location;
+		bundle_getBundleLocation(bundle, &location);
+		printf("[ SUCCESS ]: ConfigAdminFactory - get configAdminService (bundle=%s) \n ",location);
+	/* END DEBUG CODE */
+
+	(*service) = confAdminService;
+	return CELIX_SUCCESS;
+
+}
+
+celix_status_t configurationAdminFactory_ungetService(void *factory, bundle_pt bundle, service_registration_pt registration){
+	// do nothing
+	return CELIX_SUCCESS;
+}
+
+
+/* ========== IMPLEMENTATION ========== */
+
+/* ---------- public ---------- */
+
+celix_status_t configurationAdminFactory_start(configuration_admin_factory_pt factory){
+
+	celix_status_t status;
+
+	status = serviceTracker_open(factory->managedServiceTracker);
+	if( status!=CELIX_SUCCESS ){
+		printf("[ ERROR ]: ConfigAdminFactory - ManagedServiceTracker not opened \n");
+		return status;
+	}
+
+	printf("[ SUCCESS ]: ConfigAdminFactory - ManagedServiceTracker opened \n");
+	return CELIX_SUCCESS;
+}
+
+celix_status_t configurationAdminFactory_stop(configuration_admin_factory_pt factory){
+	return CELIX_SUCCESS;
+}
+
+celix_status_t configurationAdminFactory_checkConfigurationPermission(configuration_admin_factory_pt factory){
+	return CELIX_SUCCESS;
+}
+
+celix_status_t configurationAdminFactory_dispatchEvent(configuration_admin_factory_pt factory, int type, char *factoryPid, char *pid){
+	return CELIX_SUCCESS;
+}
+
+celix_status_t configurationAdminFactory_notifyConfigurationUpdated(configuration_admin_factory_pt factory, configuration_pt configuration, bool isFactory){
+
+	if (isFactory == TRUE){
+
+		printf("[ DEBUG ]: ConfigAdminFactory - notifyConfigUpdated Factory \n");
+		return CELIX_SUCCESS;
+
+	}else{
+
+		printf("[ DEBUG ]: ConfigAdminFactory - notifyConfigUpdated \n");
+		return managedServiceTracker_notifyUpdated(factory->managedServiceTrackerHandle,configuration);
+
+	}
+
+}
+
+celix_status_t configurationAdminFactory_notifyConfigurationDeleted(configuration_admin_factory_pt factory, configuration_pt configuration, bool isFactory){
+	return CELIX_SUCCESS;
+}
+
+celix_status_t configurationAdminFactory_modifyConfiguration(configuration_admin_factory_pt factory, service_reference_pt reference, properties_pt properties){
+	return CELIX_SUCCESS;
+}

Added: celix/branches/celix_config_admin/config_admin/service/private/src/configuration_admin_impl.c
URL: http://svn.apache.org/viewvc/celix/branches/celix_config_admin/config_admin/service/private/src/configuration_admin_impl.c?rev=1633678&view=auto
==============================================================================
--- celix/branches/celix_config_admin/config_admin/service/private/src/configuration_admin_impl.c (added)
+++ celix/branches/celix_config_admin/config_admin/service/private/src/configuration_admin_impl.c Wed Oct 22 18:53:39 2014
@@ -0,0 +1,208 @@
+/**
+ *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_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>
+#include <string.h>
+
+/* celix.config_admin.ConfigAdmin */
+#include "configuration_admin_impl.h"
+
+/* celix.framework.public */
+#include "utils.h"
+/* celix.framework_patch*/
+#include "framework_patch.h"
+/* celix.config_admin.private*/
+#include "configuration_impl.h"
+
+
+static celix_status_t configurationAdmin_checkPid(char *pid);
+
+
+/* ========== CONSTRUCTOR ========== */
+
+celix_status_t configurationAdmin_create(apr_pool_t *pool,
+										 configuration_admin_factory_pt factory, configuration_store_pt store, bundle_pt bundle,
+										 configuration_admin_service_pt *service){
+
+	*service = apr_palloc(pool, sizeof(**service));
+	if(!*service){
+		printf("[ ERROR ]: ConfigAdmin - Not initialized(ENOMEM) \n");
+		return CELIX_ENOMEM;
+	}
+
+	configuration_admin_pt this = apr_palloc(pool, sizeof(*this));
+	if (!this){
+		printf("[ ERROR ]: ConfigAdmin - Not initialized \n");
+		return CELIX_ENOMEM;
+	}
+
+	this->pool = pool;
+	this->bundle = bundle;
+
+	this->configurationAdminFactory = factory;
+	this->configurationStore = store;
+
+	(*service)->configAdmin = this;
+	(*service)->createFactoryConfiguration = configurationAdmin_createFactoryConfiguration;
+	(*service)->createFactoryConfiguration2 = configurationAdmin_createFactoryConfiguration2;
+	(*service)->getConfiguration = configurationAdmin_getConfiguration;
+	(*service)->getConfiguration2 = configurationAdmin_getConfiguration2;
+	(*service)->listConfigurations = configurationAdmin_listConfigurations;
+
+	printf("[ SUCCESS ]: ConfigAdmin - Initialized \n");
+	return CELIX_SUCCESS;
+
+}
+
+/* ========== IMPLEMENTATION ========== */
+
+/* ---------- public ---------- */
+
+celix_status_t configurationAdmin_createFactoryConfiguration(configuration_admin_pt configAdmin, char *factoryPid, configuration_pt *configuration){
+	return CELIX_SUCCESS;
+}
+
+celix_status_t configurationAdmin_createFactoryConfiguration2(configuration_admin_pt configAdmin, char *factoryPid, char *location, configuration_pt *configuration){
+	return CELIX_SUCCESS;
+}
+
+celix_status_t configurationAdmin_getConfiguration(configuration_admin_pt configAdmin, char *pid, configuration_pt *configuration){
+
+	celix_status_t status;
+
+	configuration_pt config;
+
+	char *configAdminBundleLocation;
+	char *configBundleLocation;
+
+
+	// (1) configurationAdmin.checkPid
+	if ( configurationAdmin_checkPid(pid) != CELIX_SUCCESS ){
+		*configuration = NULL;
+		return CELIX_ILLEGAL_ARGUMENT;
+	}
+
+	// (2) bundle.getLocation
+	if ( bundle_getBundleLocation(configAdmin->bundle,&configAdminBundleLocation) != CELIX_SUCCESS ){
+		*configuration = NULL;
+		return CELIX_ILLEGAL_ARGUMENT;
+	}
+
+	// (3) delegates to configurationStore.getConfiguration
+	if ( configurationStore_getConfiguration(configAdmin->configurationStore, pid, configAdminBundleLocation, &config) != CELIX_SUCCESS ){
+		*configuration = NULL;
+		return CELIX_ILLEGAL_ARGUMENT;
+	}
+
+	printf("[ DEBUG ]: ConfigAdmin - getBundleLocation \n");
+
+
+	/* ---------- pseudo code ---------- */
+	/*
+
+	(4) is the configuration already bound? / configBundleLocation != NULL ?
+		YES - are the Configuration and the ConfigAdmin bound to the same bundle?
+			NO - check permission
+
+	(5) config.bind(bundle)
+		if the Configuration is not bound, then we bind it up with the ConfigAdmin bundle
+		in case of be bound, the function does not bind it up with ConfigAdmin bundle
+
+	*/
+
+
+	// (4) config.getBundleLocation != NULL ?
+	if ( configuration_getBundleLocation2(config,false,&configBundleLocation) == CELIX_SUCCESS ){
+
+		if ( string_equals(configAdminBundleLocation,configBundleLocation) != 1 ){
+
+			if ( configurationAdminFactory_checkConfigurationPermission(configAdmin->configurationAdminFactory) != CELIX_SUCCESS ){
+				printf("[ ERROR ]: ConfigAdmin - Config. Permission \n");
+				*configuration = NULL;
+				return CELIX_ILLEGAL_STATE; //TODO checkConfigurationPermission not yet implemented, everything is allowed
+			}
+		}
+	}
+
+	// (5) config.bind(bundle)
+	bool dummy;
+	if ( configuration_bind(config, configAdmin->bundle, &dummy) != CELIX_SUCCESS){
+		*configuration = NULL;
+		printf("[ ERROR]: ConfigAdmin - bind Config.");
+		return CELIX_ILLEGAL_STATE;
+	}
+
+	printf("[ SUCCESS ]: ConfigAdmin - get Configuration \n");
+	*configuration = config;
+	return CELIX_SUCCESS;
+
+}
+
+celix_status_t configurationAdmin_getConfiguration2(configuration_admin_pt configAdmin, char *pid, char *location, configuration_pt *configuration){
+
+//	celix_status_t status;
+//
+//	status = configurationAdmin_checkPid(pid);
+//	if (status != CELIX_SUCCESS){
+//		*configuration = NULL;
+//		return status;
+//	}
+//
+//	status = configurationAdminFactory_checkConfigurationPermission(configAdmin->configurationAdminFactory);
+//	if (status != CELIX_SUCCESS){
+//		*configuration = NULL;
+//		return status;
+//	}
+//
+//	configuration_pt config;
+//	status = configurationStore_getConfiguration(configAdmin->configurationStore, pid, location, &config);
+//	if (status != CELIX_SUCCESS){
+//		*configuration = NULL;
+//		return status;
+//	}
+//
+//	printf("SUCCESS get Configuration");
+//	*configuration = config;
+	return CELIX_SUCCESS;
+}
+
+celix_status_t configurationAdmin_listConfigurations(configuration_admin_pt configAdmin, char *filter, array_list_pt *configurations){
+	return CELIX_SUCCESS;
+}
+
+/* ---------- private ---------- */
+
+celix_status_t configurationAdmin_checkPid(char *pid){
+
+	if (pid == NULL){
+		printf("[ ERROR ]: PID cannot be null");
+		return CELIX_ILLEGAL_ARGUMENT;
+	} else {
+		return CELIX_SUCCESS;
+	}
+}



Mime
View raw message