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

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

http://git-wip-us.apache.org/repos/asf/celix/blob/a1c30887/pubsub/deploy/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/pubsub/deploy/CMakeLists.txt b/pubsub/deploy/CMakeLists.txt
index 5039aea..6f9234d 100644
--- a/pubsub/deploy/CMakeLists.txt
+++ b/pubsub/deploy/CMakeLists.txt
@@ -22,53 +22,53 @@ find_program(XTERM_CMD NAMES xterm)
 add_deploy(pubsub_publisher_udp_mc
 	GROUP pubsub
 	BUNDLES
-	   shell
-	   shell_tui
-	   org.apache.celix.pubsub_serializer.PubSubSerializerJson
-	   org.apache.celix.pubsub_discovery.etcd.PubsubDiscovery
-	   org.apache.celix.pubsub_topology_manager.PubSubTopologyManager
-	   org.apache.celix.pubsub_admin.PubSubAdminUdpMc
-	   org.apache.celix.pubsub_publisher.PoiPublisher
-	   org.apache.celix.pubsub_publisher.PoiPublisher2
+		Celix::shell
+	   	Celix::shell_tui
+	   	org.apache.celix.pubsub_serializer.PubSubSerializerJson
+	   	org.apache.celix.pubsub_discovery.etcd.PubsubDiscovery
+	   	org.apache.celix.pubsub_topology_manager.PubSubTopologyManager
+	   	org.apache.celix.pubsub_admin.PubSubAdminUdpMc
+	   	org.apache.celix.pubsub_publisher.PoiPublisher
+	   	org.apache.celix.pubsub_publisher.PoiPublisher2
 )
 
 add_deploy("pubsub_subscriber_udp_mc"
 	GROUP "pubsub"
 	BUNDLES
-	   shell
-	   shell_tui
-	   org.apache.celix.pubsub_serializer.PubSubSerializerJson
-	   org.apache.celix.pubsub_discovery.etcd.PubsubDiscovery
-	   org.apache.celix.pubsub_topology_manager.PubSubTopologyManager
-	   org.apache.celix.pubsub_admin.PubSubAdminUdpMc
-	   org.apache.celix.pubsub_subscriber.PoiSubscriber
+		Celix::shell
+		Celix::shell_tui
+	   	org.apache.celix.pubsub_serializer.PubSubSerializerJson
+	  	org.apache.celix.pubsub_discovery.etcd.PubsubDiscovery
+	   	org.apache.celix.pubsub_topology_manager.PubSubTopologyManager
+	   	org.apache.celix.pubsub_admin.PubSubAdminUdpMc
+	   	org.apache.celix.pubsub_subscriber.PoiSubscriber
 )
 
 add_deploy("pubsub_subscriber2_udp_mc"
 	GROUP "pubsub"
 	BUNDLES
-	   shell
-	   shell_tui
-	   org.apache.celix.pubsub_serializer.PubSubSerializerJson
-	   org.apache.celix.pubsub_discovery.etcd.PubsubDiscovery
-	   org.apache.celix.pubsub_topology_manager.PubSubTopologyManager
-	   org.apache.celix.pubsub_admin.PubSubAdminUdpMc
-	   org.apache.celix.pubsub_subscriber.PoiSubscriber
+		Celix::shell
+		Celix::shell_tui
+	   	org.apache.celix.pubsub_serializer.PubSubSerializerJson
+	   	org.apache.celix.pubsub_discovery.etcd.PubsubDiscovery
+	   	org.apache.celix.pubsub_topology_manager.PubSubTopologyManager
+	   	org.apache.celix.pubsub_admin.PubSubAdminUdpMc
+	   	org.apache.celix.pubsub_subscriber.PoiSubscriber
 )
 
 if (ETCD_CMD AND XTERM_CMD)
 	#Runtime starting a publish and subscriber for udp mc
 	add_runtime(pubsub_rt_upd_mc
-			NAME udp_mc
-			GROUP pubsub
-			DEPLOYMENTS
+		NAME udp_mc
+		GROUP pubsub
+		DEPLOYMENTS
 			pubsub_publisher_udp_mc
 			pubsub_subscriber_udp_mc
 			pubsub_subscriber2_udp_mc
-			COMMANDS
+		COMMANDS
 			etcd
-			USE_TERM
-			)
+		USE_TERM
+	)
 endif ()
 
 if (BUILD_PUBSUB_PSA_ZMQ)
@@ -77,61 +77,61 @@ if (BUILD_PUBSUB_PSA_ZMQ)
 	add_deploy("pubsub_publisher"
 	    GROUP "pubsub"
 	    BUNDLES
-	       shell
-	       shell_tui
-	       org.apache.celix.pubsub_serializer.PubSubSerializerJson
-	       org.apache.celix.pubsub_discovery.etcd.PubsubDiscovery
-	       org.apache.celix.pubsub_topology_manager.PubSubTopologyManager
-	       org.apache.celix.pubsub_admin.PubSubAdminZmq
-	       org.apache.celix.pubsub_admin.PubSubAdminUdpMc
-	       org.apache.celix.pubsub_publisher.PoiPublisher
-	       org.apache.celix.pubsub_publisher.PoiPublisher2
+			Celix::shell
+			Celix::shell_tui
+	      	org.apache.celix.pubsub_serializer.PubSubSerializerJson
+	       	org.apache.celix.pubsub_discovery.etcd.PubsubDiscovery
+	       	org.apache.celix.pubsub_topology_manager.PubSubTopologyManager
+	       	org.apache.celix.pubsub_admin.PubSubAdminZmq
+	       	org.apache.celix.pubsub_admin.PubSubAdminUdpMc
+	       	org.apache.celix.pubsub_publisher.PoiPublisher
+	       	org.apache.celix.pubsub_publisher.PoiPublisher2
 	    PROPERTIES
-	       poi1.psa=zmq
-	       poi2.psa=udp
+	       	poi1.psa=zmq
+	       	poi2.psa=udp
 	)
 
 	add_deploy("pubsub_subscriber"
 	    GROUP "pubsub"
 	    BUNDLES
-	       shell
-	       shell_tui
-	       org.apache.celix.pubsub_serializer.PubSubSerializerJson
-	       org.apache.celix.pubsub_discovery.etcd.PubsubDiscovery
-	       org.apache.celix.pubsub_topology_manager.PubSubTopologyManager
-	       org.apache.celix.pubsub_admin.PubSubAdminZmq
-	       org.apache.celix.pubsub_admin.PubSubAdminUdpMc
-	       org.apache.celix.pubsub_subscriber.PoiSubscriber
+			Celix::shell
+			Celix::shell_tui
+	       	org.apache.celix.pubsub_serializer.PubSubSerializerJson
+	       	org.apache.celix.pubsub_discovery.etcd.PubsubDiscovery
+	       	org.apache.celix.pubsub_topology_manager.PubSubTopologyManager
+	       	org.apache.celix.pubsub_admin.PubSubAdminZmq
+	       	org.apache.celix.pubsub_admin.PubSubAdminUdpMc
+	       	org.apache.celix.pubsub_subscriber.PoiSubscriber
 	    PROPERTIES
-	       poi1.psa=zmq
-	       poi2.psa=udp
+	       	poi1.psa=zmq
+	       	poi2.psa=udp
 	)
 
 	# ZMQ
 	add_deploy("pubsub_zmq"
 	    GROUP "pubsub"
 	    BUNDLES
-	       shell
-	       shell_tui
-	       org.apache.celix.pubsub_serializer.PubSubSerializerJson
-	       org.apache.celix.pubsub_discovery.etcd.PubsubDiscovery
-	       org.apache.celix.pubsub_topology_manager.PubSubTopologyManager
-	       org.apache.celix.pubsub_admin.PubSubAdminZmq
-	       org.apache.celix.pubsub_publisher.PoiPublisher
-	       org.apache.celix.pubsub_subscriber.PoiSubscriber
+			Celix::shell
+			Celix::shell_tui
+	       	org.apache.celix.pubsub_serializer.PubSubSerializerJson
+	       	org.apache.celix.pubsub_discovery.etcd.PubsubDiscovery
+	       	org.apache.celix.pubsub_topology_manager.PubSubTopologyManager
+	       	org.apache.celix.pubsub_admin.PubSubAdminZmq
+	       	org.apache.celix.pubsub_publisher.PoiPublisher
+	       	org.apache.celix.pubsub_subscriber.PoiSubscriber
 	)
 
 	add_deploy("pubsub_publisher_zmq"
 	    GROUP "pubsub"
 	    BUNDLES
-	       shell
-	       shell_tui
-	       org.apache.celix.pubsub_serializer.PubSubSerializerJson
-	       org.apache.celix.pubsub_discovery.etcd.PubsubDiscovery
-	       org.apache.celix.pubsub_topology_manager.PubSubTopologyManager
-	       org.apache.celix.pubsub_admin.PubSubAdminZmq
-	       org.apache.celix.pubsub_publisher.PoiPublisher
-	       org.apache.celix.pubsub_publisher.PoiPublisher2
+			Celix::shell
+			Celix::shell_tui
+	       	org.apache.celix.pubsub_serializer.PubSubSerializerJson
+	       	org.apache.celix.pubsub_discovery.etcd.PubsubDiscovery
+	       	org.apache.celix.pubsub_topology_manager.PubSubTopologyManager
+	       	org.apache.celix.pubsub_admin.PubSubAdminZmq
+	       	org.apache.celix.pubsub_publisher.PoiPublisher
+	       	org.apache.celix.pubsub_publisher.PoiPublisher2
 	   	PROPERTIES
 		    pubsub.scope=my_small_scope
 	)
@@ -139,25 +139,25 @@ if (BUILD_PUBSUB_PSA_ZMQ)
 	add_deploy("pubsub_subscriber_zmq"
 	    GROUP "pubsub"
 	    BUNDLES
-	       shell
-	       shell_tui
-	       org.apache.celix.pubsub_serializer.PubSubSerializerJson
-	       org.apache.celix.pubsub_discovery.etcd.PubsubDiscovery
-	       org.apache.celix.pubsub_topology_manager.PubSubTopologyManager
-	       org.apache.celix.pubsub_admin.PubSubAdminZmq
-	       org.apache.celix.pubsub_subscriber.PoiSubscriber
+			Celix::shell
+			Celix::shell_tui
+	       	org.apache.celix.pubsub_serializer.PubSubSerializerJson
+	       	org.apache.celix.pubsub_discovery.etcd.PubsubDiscovery
+	       	org.apache.celix.pubsub_topology_manager.PubSubTopologyManager
+	       	org.apache.celix.pubsub_admin.PubSubAdminZmq
+	       	org.apache.celix.pubsub_subscriber.PoiSubscriber
 	)
 
 	add_deploy("pubsub_subscriber2_zmq"
 	    GROUP "pubsub"
 	    BUNDLES
-	       shell
-	       shell_tui
-	       org.apache.celix.pubsub_serializer.PubSubSerializerJson
-	       org.apache.celix.pubsub_discovery.etcd.PubsubDiscovery
-	       org.apache.celix.pubsub_topology_manager.PubSubTopologyManager
-	       org.apache.celix.pubsub_admin.PubSubAdminZmq
-	       org.apache.celix.pubsub_subscriber.PoiSubscriber
+			Celix::shell
+			Celix::shell_tui
+	       	org.apache.celix.pubsub_serializer.PubSubSerializerJson
+	       	org.apache.celix.pubsub_discovery.etcd.PubsubDiscovery
+	       	org.apache.celix.pubsub_topology_manager.PubSubTopologyManager
+	       	org.apache.celix.pubsub_admin.PubSubAdminZmq
+	       	org.apache.celix.pubsub_subscriber.PoiSubscriber
 
 	)
 
@@ -165,20 +165,20 @@ if (BUILD_PUBSUB_PSA_ZMQ)
 	add_deploy("pubsub_mp_subscriber_zmq"
 	    GROUP "pubsub"
 	    BUNDLES
-	       shell
-	       shell_tui
-	       org.apache.celix.pubsub_serializer.PubSubSerializerJson
-	       org.apache.celix.pubsub_discovery.etcd.PubsubDiscovery
-	       org.apache.celix.pubsub_topology_manager.PubSubTopologyManager
-	       org.apache.celix.pubsub_admin.PubSubAdminZmq
-	       org.apache.celix.pubsub_subscriber.MpSubscriber
+			Celix::hell
+			Celix::shell_tui
+	       	org.apache.celix.pubsub_serializer.PubSubSerializerJson
+	       	org.apache.celix.pubsub_discovery.etcd.PubsubDiscovery
+	       	org.apache.celix.pubsub_topology_manager.PubSubTopologyManager
+	       	org.apache.celix.pubsub_admin.PubSubAdminZmq
+	       	org.apache.celix.pubsub_subscriber.MpSubscriber
 	)
 
 	add_deploy("pubsub_mp_publisher_zmq"
 	    GROUP "pubsub"
 	    BUNDLES
-	   		shell
-	   		shell_tui
+			Celix::shell
+			Celix::shell_tui
 	   		org.apache.celix.pubsub_serializer.PubSubSerializerJson
 	   		org.apache.celix.pubsub_discovery.etcd.PubsubDiscovery
 	   		org.apache.celix.pubsub_topology_manager.PubSubTopologyManager

http://git-wip-us.apache.org/repos/asf/celix/blob/a1c30887/remote_services/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/remote_services/CMakeLists.txt b/remote_services/CMakeLists.txt
index d5d07a3..767ece7 100644
--- a/remote_services/CMakeLists.txt
+++ b/remote_services/CMakeLists.txt
@@ -17,17 +17,6 @@
 
 celix_subproject(REMOTE_SERVICE_ADMIN "Option to enable building the Remote Service Admin Service bundles" OFF)
 if (REMOTE_SERVICE_ADMIN)
-    # Add -fPIC for x86_64 Unix platforms; this lib will be linked to a shared lib
-    if(UNIX AND NOT WIN32)
-      find_program(CMAKE_UNAME uname /bin /usr/bin /usr/local/bin )
-      if(CMAKE_UNAME)
-        exec_program(uname ARGS -m OUTPUT_VARIABLE CMAKE_SYSTEM_PROCESSOR)
-        set(CMAKE_SYSTEM_PROCESSOR ${CMAKE_SYSTEM_PROCESSOR} CACHE INTERNAL "processor type (i386 and x86_64)")
-         if(CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64")
-          add_definitions(-fPIC)
-        endif(CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64")
-      endif(CMAKE_UNAME)
-    endif(UNIX AND NOT WIN32)
 
     add_subdirectory(examples)
 
@@ -37,8 +26,8 @@ if (REMOTE_SERVICE_ADMIN)
     add_subdirectory(discovery_etcd)
     add_subdirectory(discovery_shm)
 
-    add_subdirectory(remote_service_admin_http)
-    add_subdirectory(remote_service_admin_shm)
+    #TODO refactor shm rsa to use dfi
+    #add_subdirectory(remote_service_admin_shm)
     add_subdirectory(remote_service_admin)
     add_subdirectory(remote_service_admin_dfi)
 

http://git-wip-us.apache.org/repos/asf/celix/blob/a1c30887/remote_services/discovery_configured/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/remote_services/discovery_configured/CMakeLists.txt b/remote_services/discovery_configured/CMakeLists.txt
index edbbc13..b9f849d 100644
--- a/remote_services/discovery_configured/CMakeLists.txt
+++ b/remote_services/discovery_configured/CMakeLists.txt
@@ -46,13 +46,12 @@ if (RSA_DISCOVERY_CONFIGURED)
 	${PROJECT_SOURCE_DIR}/remote_services/discovery/private/src/endpoint_discovery_server.c
 	${PROJECT_SOURCE_DIR}/remote_services/remote_service_admin/private/src/endpoint_description.c
 	${PROJECT_SOURCE_DIR}/remote_services/utils/private/src/civetweb.c
-
-	${PROJECT_SOURCE_DIR}/log_service/public/src/log_helper.c
     )
+    target_link_libraries(discovery_configured PRIVATE Celix::log_helper)
 
     install_bundle(discovery_configured)
 
-    target_link_libraries(discovery_configured celix_framework ${CURL_LIBRARIES} ${LIBXML2_LIBRARIES})
+    target_link_libraries(discovery_configured PRIVATE ${CURL_LIBRARIES} ${LIBXML2_LIBRARIES})
 
     if (RSA_ENDPOINT_TEST_READER)
         add_executable(descparser

http://git-wip-us.apache.org/repos/asf/celix/blob/a1c30887/remote_services/discovery_etcd/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/remote_services/discovery_etcd/CMakeLists.txt b/remote_services/discovery_etcd/CMakeLists.txt
index 442d486..b8955de 100644
--- a/remote_services/discovery_etcd/CMakeLists.txt
+++ b/remote_services/discovery_etcd/CMakeLists.txt
@@ -40,8 +40,8 @@ if (RSA_DISCOVERY_ETCD)
         SYMBOLIC_NAME "apache_celix_rsa_discovery_etcd"
         NAME "Apache Celix RSA Discovery ETCD"
         SOURCES
-		private/src/discovery_impl.c
-	    private/src/etcd_watcher.c
+		src/discovery_impl.c
+	    src/etcd_watcher.c
 		${PROJECT_SOURCE_DIR}/remote_services/discovery/private/src/discovery_activator.c
 		${PROJECT_SOURCE_DIR}/remote_services/discovery/private/src/discovery.c
 		${PROJECT_SOURCE_DIR}/remote_services/discovery/private/src/endpoint_descriptor_reader.c
@@ -50,12 +50,12 @@ if (RSA_DISCOVERY_ETCD)
 		${PROJECT_SOURCE_DIR}/remote_services/discovery/private/src/endpoint_discovery_server.c
 	    ${PROJECT_SOURCE_DIR}/remote_services/remote_service_admin/private/src/endpoint_description.c
 	    ${PROJECT_SOURCE_DIR}/remote_services/utils/private/src/civetweb.c
-	    
-	    ${PROJECT_SOURCE_DIR}/log_service/public/src/log_helper.c
 	)
+	target_link_libraries(discovery_etcd PRIVATE Celix::log_helper)
+	target_include_directories(discovery_etcd PRIVATE src ../discovery/private/include)
 
 	install_bundle(discovery_etcd)
 		
-	target_link_libraries(discovery_etcd celix_framework etcdlib ${CURL_LIBRARIES} ${LIBXML2_LIBRARIES} ${JANSSON_LIBRARIES})
+	target_link_libraries(discovery_etcd PRIVATE Celix::etcdlib ${CURL_LIBRARIES} ${LIBXML2_LIBRARIES} ${JANSSON_LIBRARIES})
 
 endif (RSA_DISCOVERY_ETCD)

http://git-wip-us.apache.org/repos/asf/celix/blob/a1c30887/remote_services/discovery_etcd/private/include/discovery_impl.h
----------------------------------------------------------------------
diff --git a/remote_services/discovery_etcd/private/include/discovery_impl.h b/remote_services/discovery_etcd/private/include/discovery_impl.h
deleted file mode 100644
index a19b145..0000000
--- a/remote_services/discovery_etcd/private/include/discovery_impl.h
+++ /dev/null
@@ -1,66 +0,0 @@
-/**
- *Licensed to the Apache Software Foundation (ASF) under one
- *or more contributor license agreements.  See the NOTICE file
- *distributed with this work for additional information
- *regarding copyright ownership.  The ASF licenses this file
- *to you under the Apache License, Version 2.0 (the
- *"License"); you may not use this file except in compliance
- *with the License.  You may obtain a copy of the License at
- *
- *  http://www.apache.org/licenses/LICENSE-2.0
- *
- *Unless required by applicable law or agreed to in writing,
- *software distributed under the License is distributed on an
- *"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- *specific language governing permissions and limitations
- *under the License.
- */
-/*
- * discovery_impl.h
- *
- *  \date       Sep 29, 2011
- *  \author    	<a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
- *  \copyright	Apache License, Version 2.0
- */
-
-#ifndef DISCOVERY_IMPL_H_
-#define DISCOVERY_IMPL_H_
-
-#include "bundle_context.h"
-#include "service_reference.h"
-
-#include "endpoint_description.h"
-#include "endpoint_listener.h"
-
-#include "endpoint_discovery_poller.h"
-#include "endpoint_discovery_server.h"
-#include "etcd_watcher.h"
-
-#include "log_helper.h"
-
-#define DEFAULT_SERVER_IP 	"127.0.0.1"
-#define DEFAULT_SERVER_PORT "9999"
-#define DEFAULT_SERVER_PATH "/org.apache.celix.discovery.etcd"
-
-#define DEFAULT_POLL_ENDPOINTS ""
-
-#define FREE_MEM(ptr) if(ptr) {free(ptr); ptr = NULL;}
-
-struct discovery {
-	bundle_context_pt context;
-
-	celix_thread_mutex_t listenerReferencesMutex;
-	celix_thread_mutex_t discoveredServicesMutex;
-
-	hash_map_pt listenerReferences; //key=serviceReference, value=nop
-	hash_map_pt discoveredServices; //key=endpointId (string), value=endpoint_description_pt
-
-	etcd_watcher_pt watcher;
-	endpoint_discovery_poller_pt poller;
-	endpoint_discovery_server_pt server;
-
-	log_helper_pt loghelper;
-};
-
-#endif /* DISCOVERY_H_ */

http://git-wip-us.apache.org/repos/asf/celix/blob/a1c30887/remote_services/discovery_etcd/private/include/etcd_watcher.h
----------------------------------------------------------------------
diff --git a/remote_services/discovery_etcd/private/include/etcd_watcher.h b/remote_services/discovery_etcd/private/include/etcd_watcher.h
deleted file mode 100644
index b4dbf40..0000000
--- a/remote_services/discovery_etcd/private/include/etcd_watcher.h
+++ /dev/null
@@ -1,40 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- *  KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-/*
- * etcd_watcher.h
- *
- * \date       17 Sep 2014
- * \author     <a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
- * \copyright  Apache License, Version 2.0
- */
-
-#ifndef ETCD_WATCHER_H_
-#define ETCD_WATCHER_H_
-
-#include "celix_errno.h"
-#include "discovery.h"
-#include "endpoint_discovery_poller.h"
-
-typedef struct etcd_watcher *etcd_watcher_pt;
-
-celix_status_t etcdWatcher_create(discovery_pt discovery,  bundle_context_pt context, etcd_watcher_pt *watcher);
-celix_status_t etcdWatcher_destroy(etcd_watcher_pt watcher);
-
-
-#endif /* ETCD_WATCHER_H_ */

http://git-wip-us.apache.org/repos/asf/celix/blob/a1c30887/remote_services/discovery_etcd/private/src/discovery_impl.c
----------------------------------------------------------------------
diff --git a/remote_services/discovery_etcd/private/src/discovery_impl.c b/remote_services/discovery_etcd/private/src/discovery_impl.c
deleted file mode 100644
index 8087d95..0000000
--- a/remote_services/discovery_etcd/private/src/discovery_impl.c
+++ /dev/null
@@ -1,183 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- *  KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-/*
- * discovery_impl.c
- *
- * \date        Aug 8, 2014
- * \author    	<a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
- * \copyright	Apache License, Version 2.0
- */
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <stdbool.h>
-#include <netdb.h>
-#include <netinet/in.h>
-
-#include "constants.h"
-#include "celix_threads.h"
-#include "bundle_context.h"
-#include "array_list.h"
-#include "utils.h"
-#include "celix_errno.h"
-#include "filter.h"
-#include "service_reference.h"
-#include "service_registration.h"
-#include "remote_constants.h"
-
-
-#include "discovery.h"
-#include "discovery_impl.h"
-#include "etcd_watcher.h"
-#include "endpoint_discovery_poller.h"
-#include "endpoint_discovery_server.h"
-
-
-
-celix_status_t discovery_create(bundle_context_pt context, discovery_pt *discovery) {
-	celix_status_t status = CELIX_SUCCESS;
-
-	*discovery = malloc(sizeof(struct discovery));
-	if (!*discovery) {
-		return CELIX_ENOMEM;
-	}
-
-	(*discovery)->context = context;
-	(*discovery)->poller = NULL;
-	(*discovery)->server = NULL;
-
-	(*discovery)->listenerReferences = hashMap_create(serviceReference_hashCode, NULL, serviceReference_equals2, NULL);
-	(*discovery)->discoveredServices = hashMap_create(utils_stringHash, NULL, utils_stringEquals, NULL);
-
-	status = celixThreadMutex_create(&(*discovery)->listenerReferencesMutex, NULL);
-	status = celixThreadMutex_create(&(*discovery)->discoveredServicesMutex, NULL);
-
-	logHelper_create(context, &(*discovery)->loghelper);
-
-	return status;
-}
-
-
-
-celix_status_t discovery_destroy(discovery_pt discovery) {
-	celix_status_t status = CELIX_SUCCESS;
-
-	discovery->context = NULL;
-	discovery->poller = NULL;
-	discovery->server = NULL;
-
-	celixThreadMutex_lock(&discovery->discoveredServicesMutex);
-
-	hashMap_destroy(discovery->discoveredServices, false, false);
-	discovery->discoveredServices = NULL;
-
-	celixThreadMutex_unlock(&discovery->discoveredServicesMutex);
-
-	celixThreadMutex_destroy(&discovery->discoveredServicesMutex);
-
-	celixThreadMutex_lock(&discovery->listenerReferencesMutex);
-
-	hashMap_destroy(discovery->listenerReferences, false, false);
-	discovery->listenerReferences = NULL;
-
-	celixThreadMutex_unlock(&discovery->listenerReferencesMutex);
-
-	celixThreadMutex_destroy(&discovery->listenerReferencesMutex);
-
-	logHelper_destroy(&discovery->loghelper);
-
-	free(discovery);
-
-	return status;
-}
-
-celix_status_t discovery_start(discovery_pt discovery) {
-    celix_status_t status = CELIX_SUCCESS;
-	const char *port = NULL;
-	const char *path = NULL;
-
-	logHelper_start(discovery->loghelper);
-
-	bundleContext_getProperty(discovery->context, DISCOVERY_SERVER_PORT, &port);
-	if (port == NULL) {
-		port = DEFAULT_SERVER_PORT;
-	}
-
-	bundleContext_getProperty(discovery->context, DISCOVERY_SERVER_PATH, &path);
-	if (path == NULL) {
-		path = DEFAULT_SERVER_PATH;
-	}
-
-    status = endpointDiscoveryPoller_create(discovery, discovery->context, &discovery->poller);
-    if (status != CELIX_SUCCESS) {
-    	return CELIX_BUNDLE_EXCEPTION;
-    }
-
-    status = endpointDiscoveryServer_create(discovery, discovery->context, &discovery->server);
-    if (status != CELIX_SUCCESS) {
-		return CELIX_BUNDLE_EXCEPTION;
-    }
-
-    status = etcdWatcher_create(discovery, discovery->context, &discovery->watcher);
-    if (status != CELIX_SUCCESS) {
-    	return CELIX_BUNDLE_EXCEPTION;
-    }
-    return status;
-}
-
-celix_status_t discovery_stop(discovery_pt discovery) {
-	celix_status_t status;
-
-	status = etcdWatcher_destroy(discovery->watcher);
-	if (status != CELIX_SUCCESS) {
-		return CELIX_BUNDLE_EXCEPTION;
-	}
-
-	status = endpointDiscoveryServer_destroy(discovery->server);
-	if (status != CELIX_SUCCESS) {
-		return CELIX_BUNDLE_EXCEPTION;
-	}
-
-	status = endpointDiscoveryPoller_destroy(discovery->poller);
-	if (status != CELIX_SUCCESS) {
-		return CELIX_BUNDLE_EXCEPTION;
-	}
-	hash_map_iterator_pt iter;
-
-	celixThreadMutex_lock(&discovery->discoveredServicesMutex);
-
-	iter = hashMapIterator_create(discovery->discoveredServices);
-	while (hashMapIterator_hasNext(iter)) {
-		hash_map_entry_pt entry = hashMapIterator_nextEntry(iter);
-		endpoint_description_pt endpoint = hashMapEntry_getValue(entry);
-
-		discovery_informEndpointListeners(discovery, endpoint, false);
-	}
-	hashMapIterator_destroy(iter);
-
-	celixThreadMutex_unlock(&discovery->discoveredServicesMutex);
-
-
-	logHelper_stop(discovery->loghelper);
-
-	return status;
-}
-
-
-

http://git-wip-us.apache.org/repos/asf/celix/blob/a1c30887/remote_services/discovery_etcd/private/src/etcd_watcher.c
----------------------------------------------------------------------
diff --git a/remote_services/discovery_etcd/private/src/etcd_watcher.c b/remote_services/discovery_etcd/private/src/etcd_watcher.c
deleted file mode 100644
index ebeac4f..0000000
--- a/remote_services/discovery_etcd/private/src/etcd_watcher.c
+++ /dev/null
@@ -1,397 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- *  KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-/*
- * etcd_watcher.c
- *
- * \date       16 Sep 2014
- * \author     <a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
- * \copyright  Apache License, Version 2.0
- */
-
-#include <stdbool.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <string.h>
-
-#include "log_helper.h"
-#include "log_service.h"
-#include "constants.h"
-#include "utils.h"
-#include "discovery.h"
-#include "discovery_impl.h"
-
-#include <curl/curl.h>
-#include "etcd.h"
-#include "etcd_watcher.h"
-
-#include "endpoint_discovery_poller.h"
-
-struct etcd_watcher {
-    discovery_pt discovery;
-    log_helper_pt* loghelper;
-    hash_map_pt entries;
-
-	celix_thread_mutex_t watcherLock;
-	celix_thread_t watcherThread;
-
-	volatile bool running;
-};
-
-
-#define MAX_ROOTNODE_LENGTH			128
-#define MAX_LOCALNODE_LENGTH		4096
-#define MAX_VALUE_LENGTH			256
-
-#define CFG_ETCD_ROOT_PATH			"DISCOVERY_ETCD_ROOT_PATH"
-#define DEFAULT_ETCD_ROOTPATH		"discovery"
-
-#define CFG_ETCD_SERVER_IP			"DISCOVERY_ETCD_SERVER_IP"
-#define DEFAULT_ETCD_SERVER_IP		"127.0.0.1"
-
-#define CFG_ETCD_SERVER_PORT		"DISCOVERY_ETCD_SERVER_PORT"
-#define DEFAULT_ETCD_SERVER_PORT 	2379
-
-// be careful - this should be higher than the curl timeout
-#define CFG_ETCD_TTL   				"DISCOVERY_ETCD_TTL"
-#define DEFAULT_ETCD_TTL 			30
-
-
-// note that the rootNode shouldn't have a leading slash
-static celix_status_t etcdWatcher_getRootPath(bundle_context_pt context, char* rootNode) {
-	celix_status_t status = CELIX_SUCCESS;
-	const char* rootPath = NULL;
-
-	if (((bundleContext_getProperty(context, CFG_ETCD_ROOT_PATH, &rootPath)) != CELIX_SUCCESS) || (!rootPath)) {
-		strncpy(rootNode, DEFAULT_ETCD_ROOTPATH, MAX_ROOTNODE_LENGTH);
-	}
-	else {
-		strncpy(rootNode, rootPath, MAX_ROOTNODE_LENGTH);
-	}
-
-	return status;
-}
-
-static celix_status_t etcdWatcher_getLocalNodePath(bundle_context_pt context, char* localNodePath) {
-	celix_status_t status = CELIX_SUCCESS;
-	char rootPath[MAX_ROOTNODE_LENGTH];
-    const char* uuid = NULL;
-
-    if ((etcdWatcher_getRootPath(context, rootPath) != CELIX_SUCCESS)) {
-		status = CELIX_ILLEGAL_STATE;
-    }
-	else if (((bundleContext_getProperty(context, OSGI_FRAMEWORK_FRAMEWORK_UUID, &uuid)) != CELIX_SUCCESS) || (!uuid)) {
-		status = CELIX_ILLEGAL_STATE;
-	}
-	else if (rootPath[strlen(rootPath) - 1] == '/') {
-    	snprintf(localNodePath, MAX_LOCALNODE_LENGTH, "%s%s", rootPath, uuid);
-    }
-    else {
-    	snprintf(localNodePath, MAX_LOCALNODE_LENGTH, "%s/%s", rootPath, uuid);
-    }
-
-    return status;
-}
-
-static void add_node(const char *key, const char *value, void* arg) {
-	discovery_pt discovery = (discovery_pt) arg;
-	endpointDiscoveryPoller_addDiscoveryEndpoint(discovery->poller, (char *) value);
-}
-
-/*
- * retrieves all already existing discovery endpoints
- * from etcd and adds them to the poller.
- *
- * returns the modifiedIndex of the last modified
- * discovery endpoint (see etcd documentation).
- */
-static celix_status_t etcdWatcher_addAlreadyExistingWatchpoints(discovery_pt discovery, long long* highestModified) {
-	celix_status_t status = CELIX_SUCCESS;
-
-	char rootPath[MAX_ROOTNODE_LENGTH];
-	status = etcdWatcher_getRootPath(discovery->context, rootPath);
-
-	if (status == CELIX_SUCCESS) {
-		if(etcd_get_directory(rootPath, add_node, discovery, highestModified)) {
-			    status = CELIX_ILLEGAL_ARGUMENT;
-		}
-	}
-
-	return status;
-}
-
-
-static celix_status_t etcdWatcher_addOwnFramework(etcd_watcher_pt watcher)
-{
-    celix_status_t status = CELIX_BUNDLE_EXCEPTION;
-    char localNodePath[MAX_LOCALNODE_LENGTH];
-    char *value;
- 	char url[MAX_VALUE_LENGTH];
-    int modIndex;
-    char* endpoints = NULL;
-    const char* ttlStr = NULL;
-    int ttl;
-
-	bundle_context_pt context = watcher->discovery->context;
-	endpoint_discovery_server_pt server = watcher->discovery->server;
-
-    // register own framework
-    if ((status = etcdWatcher_getLocalNodePath(context, localNodePath)) != CELIX_SUCCESS) {
-        return status;
-    }
-
-	if (endpointDiscoveryServer_getUrl(server, url) != CELIX_SUCCESS) {
-		snprintf(url, MAX_VALUE_LENGTH, "http://%s:%s/%s", DEFAULT_SERVER_IP, DEFAULT_SERVER_PORT, DEFAULT_SERVER_PATH);
-	}
-
-	endpoints = url;
-
-    if ((bundleContext_getProperty(context, CFG_ETCD_TTL, &ttlStr) != CELIX_SUCCESS) || !ttlStr) {
-        ttl = DEFAULT_ETCD_TTL;
-    }
-    else
-    {
-        char* endptr = (char *) ttlStr;
-        errno = 0;
-        ttl = strtol(ttlStr, &endptr, 10);
-        if (*endptr || errno != 0) {
-            ttl = DEFAULT_ETCD_TTL;
-        }
-    }
-
-	if (etcd_get(localNodePath, &value, &modIndex) != true) {
-		etcd_set(localNodePath, endpoints, ttl, false);
-	}
-	else if (etcd_set(localNodePath, endpoints, ttl, true) == false)  {
-		logHelper_log(*watcher->loghelper, OSGI_LOGSERVICE_WARNING, "Cannot register local discovery");
-    }
-    else {
-        status = CELIX_SUCCESS;
-    }
-
-	FREE_MEM(value);
-
-    return status;
-}
-
-
-
-
-static celix_status_t etcdWatcher_addEntry(etcd_watcher_pt watcher, char* key, char* value) {
-	celix_status_t status = CELIX_BUNDLE_EXCEPTION;
-	endpoint_discovery_poller_pt poller = watcher->discovery->poller;
-
-	if (!hashMap_containsKey(watcher->entries, key)) {
-		status = endpointDiscoveryPoller_addDiscoveryEndpoint(poller, value);
-
-		if (status == CELIX_SUCCESS) {
-			hashMap_put(watcher->entries, strdup(key), strdup(value));
-		}
-	}
-
-	return status;
-}
-
-static celix_status_t etcdWatcher_removeEntry(etcd_watcher_pt watcher, char* key, char* value) {
-	celix_status_t status = CELIX_BUNDLE_EXCEPTION;
-	endpoint_discovery_poller_pt poller = watcher->discovery->poller;
-
-	hash_map_entry_pt entry = hashMap_getEntry(watcher->entries, key);
-
-	if (entry != NULL) {
-		void* origKey = hashMapEntry_getKey(entry);
-		void* value = hashMap_remove(watcher->entries, key);
-
-		free(origKey);
-
-		// check if there is another entry with the same value
-		hash_map_iterator_pt iter = hashMapIterator_create(watcher->entries);
-		unsigned int valueFound = 0;
-
-		while (hashMapIterator_hasNext(iter) && valueFound <= 1) {
-			if (strcmp(value, hashMapIterator_nextValue(iter)) == 0)
-				valueFound++;
-		}
-
-		hashMapIterator_destroy(iter);
-
-		if (valueFound == 0)
-			status = endpointDiscoveryPoller_removeDiscoveryEndpoint(poller, value);
-
-		free(value);
-
-	}
-
-	return status;
-
-}
-
-
-/*
- * performs (blocking) etcd_watch calls to check for
- * changing discovery endpoint information within etcd.
- */
-static void* etcdWatcher_run(void* data) {
-	etcd_watcher_pt watcher = (etcd_watcher_pt) data;
-	time_t timeBeforeWatch = time(NULL);
-	char rootPath[MAX_ROOTNODE_LENGTH];
-	long long highestModified = 0;
-
-	bundle_context_pt context = watcher->discovery->context;
-
-	etcdWatcher_addAlreadyExistingWatchpoints(watcher->discovery, &highestModified);
-	etcdWatcher_getRootPath(context, rootPath);
-
-	while (watcher->running) {
-
-		char *rkey = NULL;
-		char *value = NULL;
-		char *preValue = NULL;
-		char *action = NULL;
-		long long modIndex;
-
-        if (etcd_watch(rootPath, highestModified + 1, &action, &preValue, &value, &rkey, &modIndex) == 0 && action != NULL) {
-			if (strcmp(action, "set") == 0) {
-				etcdWatcher_addEntry(watcher, rkey, value);
-			} else if (strcmp(action, "delete") == 0) {
-				etcdWatcher_removeEntry(watcher, rkey, value);
-			} else if (strcmp(action, "expire") == 0) {
-				etcdWatcher_removeEntry(watcher, rkey, value);
-			} else if (strcmp(action, "update") == 0) {
-				etcdWatcher_addEntry(watcher, rkey, value);
-			} else {
-				logHelper_log(*watcher->loghelper, OSGI_LOGSERVICE_INFO, "Unexpected action: %s", action);
-			}
-
-			highestModified = modIndex;
-        } else if (time(NULL) - timeBeforeWatch <= (DEFAULT_ETCD_TTL / 4)) {
-			sleep(DEFAULT_ETCD_TTL / 4);
-        }
-
-        FREE_MEM(action);
-        FREE_MEM(value);
-        FREE_MEM(preValue);
-        FREE_MEM(rkey);
-
-		// update own framework uuid
-		if (time(NULL) - timeBeforeWatch > (DEFAULT_ETCD_TTL / 4)) {
-			etcdWatcher_addOwnFramework(watcher);
-			timeBeforeWatch = time(NULL);
-		}
-	}
-
-	return NULL;
-}
-
-/*
- * the ectdWatcher needs to have access to the endpoint_discovery_poller and therefore is only
- * allowed to be created after the endpoint_discovery_poller
- */
-celix_status_t etcdWatcher_create(discovery_pt discovery, bundle_context_pt context,
-		etcd_watcher_pt *watcher)
-{
-	celix_status_t status = CELIX_SUCCESS;
-
-	const char* etcd_server = NULL;
-	const char* etcd_port_string = NULL;
-	int etcd_port = 0;
-
-	if (discovery == NULL) {
-		return CELIX_BUNDLE_EXCEPTION;
-	}
-
-	(*watcher) = calloc(1, sizeof(struct etcd_watcher));
-	if (!*watcher) {
-		return CELIX_ENOMEM;
-	}
-	else
-	{
-		(*watcher)->discovery = discovery;
-		(*watcher)->loghelper = &discovery->loghelper;
-		(*watcher)->entries = hashMap_create(utils_stringHash, NULL, utils_stringEquals, NULL);
-	}
-
-	if ((bundleContext_getProperty(context, CFG_ETCD_SERVER_IP, &etcd_server) != CELIX_SUCCESS) || !etcd_server) {
-		etcd_server = DEFAULT_ETCD_SERVER_IP;
-	}
-
-	if ((bundleContext_getProperty(context, CFG_ETCD_SERVER_PORT, &etcd_port_string) != CELIX_SUCCESS) || !etcd_port_string) {
-		etcd_port = DEFAULT_ETCD_SERVER_PORT;
-	}
-	else
-	{
-		char* endptr = (char*)etcd_port_string;
-		errno = 0;
-		etcd_port =  strtol(etcd_port_string, &endptr, 10);
-		if (*endptr || errno != 0) {
-			etcd_port = DEFAULT_ETCD_SERVER_PORT;
-		}
-	}
-
-	if (etcd_init((char*) etcd_server, etcd_port, CURL_GLOBAL_DEFAULT) != 0) {
-		status = CELIX_BUNDLE_EXCEPTION;
-	} else {
-		status = CELIX_SUCCESS;
-	}
-
-    if (status == CELIX_SUCCESS) {
-        etcdWatcher_addOwnFramework(*watcher);
-        status = celixThreadMutex_create(&(*watcher)->watcherLock, NULL);
-    }
-
-    if (status == CELIX_SUCCESS) {
-        if (celixThreadMutex_lock(&(*watcher)->watcherLock) == CELIX_SUCCESS) {
-            status = celixThread_create(&(*watcher)->watcherThread, NULL, etcdWatcher_run, *watcher);
-            if (status == CELIX_SUCCESS) {
-                (*watcher)->running = true;
-            }
-            celixThreadMutex_unlock(&(*watcher)->watcherLock);
-        }
-    }
-
-    return status;
-}
-
-
-celix_status_t etcdWatcher_destroy(etcd_watcher_pt watcher) {
-	celix_status_t status = CELIX_SUCCESS;
-	char localNodePath[MAX_LOCALNODE_LENGTH];
-
-	celixThreadMutex_lock(&watcher->watcherLock);
-	watcher->running = false;
-	celixThreadMutex_unlock(&watcher->watcherLock);
-
-	celixThread_join(watcher->watcherThread, NULL);
-
-	// register own framework
-	status = etcdWatcher_getLocalNodePath(watcher->discovery->context, localNodePath);
-
-	if (status != CELIX_SUCCESS || etcd_del(localNodePath) == false)
-	{
-		logHelper_log(*watcher->loghelper, OSGI_LOGSERVICE_WARNING, "Cannot remove local discovery registration.");
-	}
-
-	watcher->loghelper = NULL;
-
-	hashMap_destroy(watcher->entries, true, true);
-
-	free(watcher);
-
-	return status;
-}
-

http://git-wip-us.apache.org/repos/asf/celix/blob/a1c30887/remote_services/discovery_etcd/src/discovery_impl.c
----------------------------------------------------------------------
diff --git a/remote_services/discovery_etcd/src/discovery_impl.c b/remote_services/discovery_etcd/src/discovery_impl.c
new file mode 100644
index 0000000..8087d95
--- /dev/null
+++ b/remote_services/discovery_etcd/src/discovery_impl.c
@@ -0,0 +1,183 @@
+/**
+ * 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.
+ */
+/*
+ * discovery_impl.c
+ *
+ * \date        Aug 8, 2014
+ * \author    	<a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
+ * \copyright	Apache License, Version 2.0
+ */
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <stdbool.h>
+#include <netdb.h>
+#include <netinet/in.h>
+
+#include "constants.h"
+#include "celix_threads.h"
+#include "bundle_context.h"
+#include "array_list.h"
+#include "utils.h"
+#include "celix_errno.h"
+#include "filter.h"
+#include "service_reference.h"
+#include "service_registration.h"
+#include "remote_constants.h"
+
+
+#include "discovery.h"
+#include "discovery_impl.h"
+#include "etcd_watcher.h"
+#include "endpoint_discovery_poller.h"
+#include "endpoint_discovery_server.h"
+
+
+
+celix_status_t discovery_create(bundle_context_pt context, discovery_pt *discovery) {
+	celix_status_t status = CELIX_SUCCESS;
+
+	*discovery = malloc(sizeof(struct discovery));
+	if (!*discovery) {
+		return CELIX_ENOMEM;
+	}
+
+	(*discovery)->context = context;
+	(*discovery)->poller = NULL;
+	(*discovery)->server = NULL;
+
+	(*discovery)->listenerReferences = hashMap_create(serviceReference_hashCode, NULL, serviceReference_equals2, NULL);
+	(*discovery)->discoveredServices = hashMap_create(utils_stringHash, NULL, utils_stringEquals, NULL);
+
+	status = celixThreadMutex_create(&(*discovery)->listenerReferencesMutex, NULL);
+	status = celixThreadMutex_create(&(*discovery)->discoveredServicesMutex, NULL);
+
+	logHelper_create(context, &(*discovery)->loghelper);
+
+	return status;
+}
+
+
+
+celix_status_t discovery_destroy(discovery_pt discovery) {
+	celix_status_t status = CELIX_SUCCESS;
+
+	discovery->context = NULL;
+	discovery->poller = NULL;
+	discovery->server = NULL;
+
+	celixThreadMutex_lock(&discovery->discoveredServicesMutex);
+
+	hashMap_destroy(discovery->discoveredServices, false, false);
+	discovery->discoveredServices = NULL;
+
+	celixThreadMutex_unlock(&discovery->discoveredServicesMutex);
+
+	celixThreadMutex_destroy(&discovery->discoveredServicesMutex);
+
+	celixThreadMutex_lock(&discovery->listenerReferencesMutex);
+
+	hashMap_destroy(discovery->listenerReferences, false, false);
+	discovery->listenerReferences = NULL;
+
+	celixThreadMutex_unlock(&discovery->listenerReferencesMutex);
+
+	celixThreadMutex_destroy(&discovery->listenerReferencesMutex);
+
+	logHelper_destroy(&discovery->loghelper);
+
+	free(discovery);
+
+	return status;
+}
+
+celix_status_t discovery_start(discovery_pt discovery) {
+    celix_status_t status = CELIX_SUCCESS;
+	const char *port = NULL;
+	const char *path = NULL;
+
+	logHelper_start(discovery->loghelper);
+
+	bundleContext_getProperty(discovery->context, DISCOVERY_SERVER_PORT, &port);
+	if (port == NULL) {
+		port = DEFAULT_SERVER_PORT;
+	}
+
+	bundleContext_getProperty(discovery->context, DISCOVERY_SERVER_PATH, &path);
+	if (path == NULL) {
+		path = DEFAULT_SERVER_PATH;
+	}
+
+    status = endpointDiscoveryPoller_create(discovery, discovery->context, &discovery->poller);
+    if (status != CELIX_SUCCESS) {
+    	return CELIX_BUNDLE_EXCEPTION;
+    }
+
+    status = endpointDiscoveryServer_create(discovery, discovery->context, &discovery->server);
+    if (status != CELIX_SUCCESS) {
+		return CELIX_BUNDLE_EXCEPTION;
+    }
+
+    status = etcdWatcher_create(discovery, discovery->context, &discovery->watcher);
+    if (status != CELIX_SUCCESS) {
+    	return CELIX_BUNDLE_EXCEPTION;
+    }
+    return status;
+}
+
+celix_status_t discovery_stop(discovery_pt discovery) {
+	celix_status_t status;
+
+	status = etcdWatcher_destroy(discovery->watcher);
+	if (status != CELIX_SUCCESS) {
+		return CELIX_BUNDLE_EXCEPTION;
+	}
+
+	status = endpointDiscoveryServer_destroy(discovery->server);
+	if (status != CELIX_SUCCESS) {
+		return CELIX_BUNDLE_EXCEPTION;
+	}
+
+	status = endpointDiscoveryPoller_destroy(discovery->poller);
+	if (status != CELIX_SUCCESS) {
+		return CELIX_BUNDLE_EXCEPTION;
+	}
+	hash_map_iterator_pt iter;
+
+	celixThreadMutex_lock(&discovery->discoveredServicesMutex);
+
+	iter = hashMapIterator_create(discovery->discoveredServices);
+	while (hashMapIterator_hasNext(iter)) {
+		hash_map_entry_pt entry = hashMapIterator_nextEntry(iter);
+		endpoint_description_pt endpoint = hashMapEntry_getValue(entry);
+
+		discovery_informEndpointListeners(discovery, endpoint, false);
+	}
+	hashMapIterator_destroy(iter);
+
+	celixThreadMutex_unlock(&discovery->discoveredServicesMutex);
+
+
+	logHelper_stop(discovery->loghelper);
+
+	return status;
+}
+
+
+

http://git-wip-us.apache.org/repos/asf/celix/blob/a1c30887/remote_services/discovery_etcd/src/discovery_impl.h
----------------------------------------------------------------------
diff --git a/remote_services/discovery_etcd/src/discovery_impl.h b/remote_services/discovery_etcd/src/discovery_impl.h
new file mode 100644
index 0000000..a19b145
--- /dev/null
+++ b/remote_services/discovery_etcd/src/discovery_impl.h
@@ -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.
+ */
+/*
+ * discovery_impl.h
+ *
+ *  \date       Sep 29, 2011
+ *  \author    	<a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
+ *  \copyright	Apache License, Version 2.0
+ */
+
+#ifndef DISCOVERY_IMPL_H_
+#define DISCOVERY_IMPL_H_
+
+#include "bundle_context.h"
+#include "service_reference.h"
+
+#include "endpoint_description.h"
+#include "endpoint_listener.h"
+
+#include "endpoint_discovery_poller.h"
+#include "endpoint_discovery_server.h"
+#include "etcd_watcher.h"
+
+#include "log_helper.h"
+
+#define DEFAULT_SERVER_IP 	"127.0.0.1"
+#define DEFAULT_SERVER_PORT "9999"
+#define DEFAULT_SERVER_PATH "/org.apache.celix.discovery.etcd"
+
+#define DEFAULT_POLL_ENDPOINTS ""
+
+#define FREE_MEM(ptr) if(ptr) {free(ptr); ptr = NULL;}
+
+struct discovery {
+	bundle_context_pt context;
+
+	celix_thread_mutex_t listenerReferencesMutex;
+	celix_thread_mutex_t discoveredServicesMutex;
+
+	hash_map_pt listenerReferences; //key=serviceReference, value=nop
+	hash_map_pt discoveredServices; //key=endpointId (string), value=endpoint_description_pt
+
+	etcd_watcher_pt watcher;
+	endpoint_discovery_poller_pt poller;
+	endpoint_discovery_server_pt server;
+
+	log_helper_pt loghelper;
+};
+
+#endif /* DISCOVERY_H_ */

http://git-wip-us.apache.org/repos/asf/celix/blob/a1c30887/remote_services/discovery_etcd/src/etcd_watcher.c
----------------------------------------------------------------------
diff --git a/remote_services/discovery_etcd/src/etcd_watcher.c b/remote_services/discovery_etcd/src/etcd_watcher.c
new file mode 100644
index 0000000..ebeac4f
--- /dev/null
+++ b/remote_services/discovery_etcd/src/etcd_watcher.c
@@ -0,0 +1,397 @@
+/**
+ * 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.
+ */
+/*
+ * etcd_watcher.c
+ *
+ * \date       16 Sep 2014
+ * \author     <a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
+ * \copyright  Apache License, Version 2.0
+ */
+
+#include <stdbool.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <string.h>
+
+#include "log_helper.h"
+#include "log_service.h"
+#include "constants.h"
+#include "utils.h"
+#include "discovery.h"
+#include "discovery_impl.h"
+
+#include <curl/curl.h>
+#include "etcd.h"
+#include "etcd_watcher.h"
+
+#include "endpoint_discovery_poller.h"
+
+struct etcd_watcher {
+    discovery_pt discovery;
+    log_helper_pt* loghelper;
+    hash_map_pt entries;
+
+	celix_thread_mutex_t watcherLock;
+	celix_thread_t watcherThread;
+
+	volatile bool running;
+};
+
+
+#define MAX_ROOTNODE_LENGTH			128
+#define MAX_LOCALNODE_LENGTH		4096
+#define MAX_VALUE_LENGTH			256
+
+#define CFG_ETCD_ROOT_PATH			"DISCOVERY_ETCD_ROOT_PATH"
+#define DEFAULT_ETCD_ROOTPATH		"discovery"
+
+#define CFG_ETCD_SERVER_IP			"DISCOVERY_ETCD_SERVER_IP"
+#define DEFAULT_ETCD_SERVER_IP		"127.0.0.1"
+
+#define CFG_ETCD_SERVER_PORT		"DISCOVERY_ETCD_SERVER_PORT"
+#define DEFAULT_ETCD_SERVER_PORT 	2379
+
+// be careful - this should be higher than the curl timeout
+#define CFG_ETCD_TTL   				"DISCOVERY_ETCD_TTL"
+#define DEFAULT_ETCD_TTL 			30
+
+
+// note that the rootNode shouldn't have a leading slash
+static celix_status_t etcdWatcher_getRootPath(bundle_context_pt context, char* rootNode) {
+	celix_status_t status = CELIX_SUCCESS;
+	const char* rootPath = NULL;
+
+	if (((bundleContext_getProperty(context, CFG_ETCD_ROOT_PATH, &rootPath)) != CELIX_SUCCESS) || (!rootPath)) {
+		strncpy(rootNode, DEFAULT_ETCD_ROOTPATH, MAX_ROOTNODE_LENGTH);
+	}
+	else {
+		strncpy(rootNode, rootPath, MAX_ROOTNODE_LENGTH);
+	}
+
+	return status;
+}
+
+static celix_status_t etcdWatcher_getLocalNodePath(bundle_context_pt context, char* localNodePath) {
+	celix_status_t status = CELIX_SUCCESS;
+	char rootPath[MAX_ROOTNODE_LENGTH];
+    const char* uuid = NULL;
+
+    if ((etcdWatcher_getRootPath(context, rootPath) != CELIX_SUCCESS)) {
+		status = CELIX_ILLEGAL_STATE;
+    }
+	else if (((bundleContext_getProperty(context, OSGI_FRAMEWORK_FRAMEWORK_UUID, &uuid)) != CELIX_SUCCESS) || (!uuid)) {
+		status = CELIX_ILLEGAL_STATE;
+	}
+	else if (rootPath[strlen(rootPath) - 1] == '/') {
+    	snprintf(localNodePath, MAX_LOCALNODE_LENGTH, "%s%s", rootPath, uuid);
+    }
+    else {
+    	snprintf(localNodePath, MAX_LOCALNODE_LENGTH, "%s/%s", rootPath, uuid);
+    }
+
+    return status;
+}
+
+static void add_node(const char *key, const char *value, void* arg) {
+	discovery_pt discovery = (discovery_pt) arg;
+	endpointDiscoveryPoller_addDiscoveryEndpoint(discovery->poller, (char *) value);
+}
+
+/*
+ * retrieves all already existing discovery endpoints
+ * from etcd and adds them to the poller.
+ *
+ * returns the modifiedIndex of the last modified
+ * discovery endpoint (see etcd documentation).
+ */
+static celix_status_t etcdWatcher_addAlreadyExistingWatchpoints(discovery_pt discovery, long long* highestModified) {
+	celix_status_t status = CELIX_SUCCESS;
+
+	char rootPath[MAX_ROOTNODE_LENGTH];
+	status = etcdWatcher_getRootPath(discovery->context, rootPath);
+
+	if (status == CELIX_SUCCESS) {
+		if(etcd_get_directory(rootPath, add_node, discovery, highestModified)) {
+			    status = CELIX_ILLEGAL_ARGUMENT;
+		}
+	}
+
+	return status;
+}
+
+
+static celix_status_t etcdWatcher_addOwnFramework(etcd_watcher_pt watcher)
+{
+    celix_status_t status = CELIX_BUNDLE_EXCEPTION;
+    char localNodePath[MAX_LOCALNODE_LENGTH];
+    char *value;
+ 	char url[MAX_VALUE_LENGTH];
+    int modIndex;
+    char* endpoints = NULL;
+    const char* ttlStr = NULL;
+    int ttl;
+
+	bundle_context_pt context = watcher->discovery->context;
+	endpoint_discovery_server_pt server = watcher->discovery->server;
+
+    // register own framework
+    if ((status = etcdWatcher_getLocalNodePath(context, localNodePath)) != CELIX_SUCCESS) {
+        return status;
+    }
+
+	if (endpointDiscoveryServer_getUrl(server, url) != CELIX_SUCCESS) {
+		snprintf(url, MAX_VALUE_LENGTH, "http://%s:%s/%s", DEFAULT_SERVER_IP, DEFAULT_SERVER_PORT, DEFAULT_SERVER_PATH);
+	}
+
+	endpoints = url;
+
+    if ((bundleContext_getProperty(context, CFG_ETCD_TTL, &ttlStr) != CELIX_SUCCESS) || !ttlStr) {
+        ttl = DEFAULT_ETCD_TTL;
+    }
+    else
+    {
+        char* endptr = (char *) ttlStr;
+        errno = 0;
+        ttl = strtol(ttlStr, &endptr, 10);
+        if (*endptr || errno != 0) {
+            ttl = DEFAULT_ETCD_TTL;
+        }
+    }
+
+	if (etcd_get(localNodePath, &value, &modIndex) != true) {
+		etcd_set(localNodePath, endpoints, ttl, false);
+	}
+	else if (etcd_set(localNodePath, endpoints, ttl, true) == false)  {
+		logHelper_log(*watcher->loghelper, OSGI_LOGSERVICE_WARNING, "Cannot register local discovery");
+    }
+    else {
+        status = CELIX_SUCCESS;
+    }
+
+	FREE_MEM(value);
+
+    return status;
+}
+
+
+
+
+static celix_status_t etcdWatcher_addEntry(etcd_watcher_pt watcher, char* key, char* value) {
+	celix_status_t status = CELIX_BUNDLE_EXCEPTION;
+	endpoint_discovery_poller_pt poller = watcher->discovery->poller;
+
+	if (!hashMap_containsKey(watcher->entries, key)) {
+		status = endpointDiscoveryPoller_addDiscoveryEndpoint(poller, value);
+
+		if (status == CELIX_SUCCESS) {
+			hashMap_put(watcher->entries, strdup(key), strdup(value));
+		}
+	}
+
+	return status;
+}
+
+static celix_status_t etcdWatcher_removeEntry(etcd_watcher_pt watcher, char* key, char* value) {
+	celix_status_t status = CELIX_BUNDLE_EXCEPTION;
+	endpoint_discovery_poller_pt poller = watcher->discovery->poller;
+
+	hash_map_entry_pt entry = hashMap_getEntry(watcher->entries, key);
+
+	if (entry != NULL) {
+		void* origKey = hashMapEntry_getKey(entry);
+		void* value = hashMap_remove(watcher->entries, key);
+
+		free(origKey);
+
+		// check if there is another entry with the same value
+		hash_map_iterator_pt iter = hashMapIterator_create(watcher->entries);
+		unsigned int valueFound = 0;
+
+		while (hashMapIterator_hasNext(iter) && valueFound <= 1) {
+			if (strcmp(value, hashMapIterator_nextValue(iter)) == 0)
+				valueFound++;
+		}
+
+		hashMapIterator_destroy(iter);
+
+		if (valueFound == 0)
+			status = endpointDiscoveryPoller_removeDiscoveryEndpoint(poller, value);
+
+		free(value);
+
+	}
+
+	return status;
+
+}
+
+
+/*
+ * performs (blocking) etcd_watch calls to check for
+ * changing discovery endpoint information within etcd.
+ */
+static void* etcdWatcher_run(void* data) {
+	etcd_watcher_pt watcher = (etcd_watcher_pt) data;
+	time_t timeBeforeWatch = time(NULL);
+	char rootPath[MAX_ROOTNODE_LENGTH];
+	long long highestModified = 0;
+
+	bundle_context_pt context = watcher->discovery->context;
+
+	etcdWatcher_addAlreadyExistingWatchpoints(watcher->discovery, &highestModified);
+	etcdWatcher_getRootPath(context, rootPath);
+
+	while (watcher->running) {
+
+		char *rkey = NULL;
+		char *value = NULL;
+		char *preValue = NULL;
+		char *action = NULL;
+		long long modIndex;
+
+        if (etcd_watch(rootPath, highestModified + 1, &action, &preValue, &value, &rkey, &modIndex) == 0 && action != NULL) {
+			if (strcmp(action, "set") == 0) {
+				etcdWatcher_addEntry(watcher, rkey, value);
+			} else if (strcmp(action, "delete") == 0) {
+				etcdWatcher_removeEntry(watcher, rkey, value);
+			} else if (strcmp(action, "expire") == 0) {
+				etcdWatcher_removeEntry(watcher, rkey, value);
+			} else if (strcmp(action, "update") == 0) {
+				etcdWatcher_addEntry(watcher, rkey, value);
+			} else {
+				logHelper_log(*watcher->loghelper, OSGI_LOGSERVICE_INFO, "Unexpected action: %s", action);
+			}
+
+			highestModified = modIndex;
+        } else if (time(NULL) - timeBeforeWatch <= (DEFAULT_ETCD_TTL / 4)) {
+			sleep(DEFAULT_ETCD_TTL / 4);
+        }
+
+        FREE_MEM(action);
+        FREE_MEM(value);
+        FREE_MEM(preValue);
+        FREE_MEM(rkey);
+
+		// update own framework uuid
+		if (time(NULL) - timeBeforeWatch > (DEFAULT_ETCD_TTL / 4)) {
+			etcdWatcher_addOwnFramework(watcher);
+			timeBeforeWatch = time(NULL);
+		}
+	}
+
+	return NULL;
+}
+
+/*
+ * the ectdWatcher needs to have access to the endpoint_discovery_poller and therefore is only
+ * allowed to be created after the endpoint_discovery_poller
+ */
+celix_status_t etcdWatcher_create(discovery_pt discovery, bundle_context_pt context,
+		etcd_watcher_pt *watcher)
+{
+	celix_status_t status = CELIX_SUCCESS;
+
+	const char* etcd_server = NULL;
+	const char* etcd_port_string = NULL;
+	int etcd_port = 0;
+
+	if (discovery == NULL) {
+		return CELIX_BUNDLE_EXCEPTION;
+	}
+
+	(*watcher) = calloc(1, sizeof(struct etcd_watcher));
+	if (!*watcher) {
+		return CELIX_ENOMEM;
+	}
+	else
+	{
+		(*watcher)->discovery = discovery;
+		(*watcher)->loghelper = &discovery->loghelper;
+		(*watcher)->entries = hashMap_create(utils_stringHash, NULL, utils_stringEquals, NULL);
+	}
+
+	if ((bundleContext_getProperty(context, CFG_ETCD_SERVER_IP, &etcd_server) != CELIX_SUCCESS) || !etcd_server) {
+		etcd_server = DEFAULT_ETCD_SERVER_IP;
+	}
+
+	if ((bundleContext_getProperty(context, CFG_ETCD_SERVER_PORT, &etcd_port_string) != CELIX_SUCCESS) || !etcd_port_string) {
+		etcd_port = DEFAULT_ETCD_SERVER_PORT;
+	}
+	else
+	{
+		char* endptr = (char*)etcd_port_string;
+		errno = 0;
+		etcd_port =  strtol(etcd_port_string, &endptr, 10);
+		if (*endptr || errno != 0) {
+			etcd_port = DEFAULT_ETCD_SERVER_PORT;
+		}
+	}
+
+	if (etcd_init((char*) etcd_server, etcd_port, CURL_GLOBAL_DEFAULT) != 0) {
+		status = CELIX_BUNDLE_EXCEPTION;
+	} else {
+		status = CELIX_SUCCESS;
+	}
+
+    if (status == CELIX_SUCCESS) {
+        etcdWatcher_addOwnFramework(*watcher);
+        status = celixThreadMutex_create(&(*watcher)->watcherLock, NULL);
+    }
+
+    if (status == CELIX_SUCCESS) {
+        if (celixThreadMutex_lock(&(*watcher)->watcherLock) == CELIX_SUCCESS) {
+            status = celixThread_create(&(*watcher)->watcherThread, NULL, etcdWatcher_run, *watcher);
+            if (status == CELIX_SUCCESS) {
+                (*watcher)->running = true;
+            }
+            celixThreadMutex_unlock(&(*watcher)->watcherLock);
+        }
+    }
+
+    return status;
+}
+
+
+celix_status_t etcdWatcher_destroy(etcd_watcher_pt watcher) {
+	celix_status_t status = CELIX_SUCCESS;
+	char localNodePath[MAX_LOCALNODE_LENGTH];
+
+	celixThreadMutex_lock(&watcher->watcherLock);
+	watcher->running = false;
+	celixThreadMutex_unlock(&watcher->watcherLock);
+
+	celixThread_join(watcher->watcherThread, NULL);
+
+	// register own framework
+	status = etcdWatcher_getLocalNodePath(watcher->discovery->context, localNodePath);
+
+	if (status != CELIX_SUCCESS || etcd_del(localNodePath) == false)
+	{
+		logHelper_log(*watcher->loghelper, OSGI_LOGSERVICE_WARNING, "Cannot remove local discovery registration.");
+	}
+
+	watcher->loghelper = NULL;
+
+	hashMap_destroy(watcher->entries, true, true);
+
+	free(watcher);
+
+	return status;
+}
+

http://git-wip-us.apache.org/repos/asf/celix/blob/a1c30887/remote_services/discovery_etcd/src/etcd_watcher.h
----------------------------------------------------------------------
diff --git a/remote_services/discovery_etcd/src/etcd_watcher.h b/remote_services/discovery_etcd/src/etcd_watcher.h
new file mode 100644
index 0000000..b4dbf40
--- /dev/null
+++ b/remote_services/discovery_etcd/src/etcd_watcher.h
@@ -0,0 +1,40 @@
+/**
+ * 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.
+ */
+/*
+ * etcd_watcher.h
+ *
+ * \date       17 Sep 2014
+ * \author     <a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
+ * \copyright  Apache License, Version 2.0
+ */
+
+#ifndef ETCD_WATCHER_H_
+#define ETCD_WATCHER_H_
+
+#include "celix_errno.h"
+#include "discovery.h"
+#include "endpoint_discovery_poller.h"
+
+typedef struct etcd_watcher *etcd_watcher_pt;
+
+celix_status_t etcdWatcher_create(discovery_pt discovery,  bundle_context_pt context, etcd_watcher_pt *watcher);
+celix_status_t etcdWatcher_destroy(etcd_watcher_pt watcher);
+
+
+#endif /* ETCD_WATCHER_H_ */

http://git-wip-us.apache.org/repos/asf/celix/blob/a1c30887/remote_services/examples/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/remote_services/examples/CMakeLists.txt b/remote_services/examples/CMakeLists.txt
index 44b7733..c7c5444 100644
--- a/remote_services/examples/CMakeLists.txt
+++ b/remote_services/examples/CMakeLists.txt
@@ -18,97 +18,42 @@
 celix_subproject(RSA_EXAMPLES "Option to enable building the RSA examples" ON DEPS LAUNCHER shell_tui log_writer RSA_TOPOLOGY_MANAGER)
 if (RSA_EXAMPLES)
     add_subdirectory(calculator_service)
-
-    add_subdirectory(calculator_endpoint)
-    add_subdirectory(calculator_endpoint2)
-
-    add_subdirectory(calculator_proxy)
-    add_subdirectory(calculator_proxy2)
-
     add_subdirectory(calculator_shell)
 
-    if(BUILD_RSA_REMOTE_SERVICE_ADMIN_HTTP AND BUILD_RSA_DISCOVERY_CONFIGURED)
-        add_deploy(remote-services-cfg-server 
-            NAME "server"
-            GROUP "remote-services/remote-services-cfg"
-            BUNDLES discovery_configured topology_manager remote_service_admin_http calculator shell shell_tui log_service log_writer
-            PROPERTIES
-                RSA_PORT=8001
-                DISCOVERY_CFG_POLL_ENDPOINTS=http://localhost:8082/org.apache.celix.discovery.configured
-                DISCOVERY_CFG_SERVER_PORT=8081
-        )
-        deploy_bundles_dir(remote-services-cfg-server DIR_NAME "endpoints" BUNDLES
-            org.apache.celix.calc.api.Calculator_endpoint
-            org.apache.celix.calc.api.Calculator2_endpoint
-        )
-
-        add_deploy(remote-services-cfg-client
-            NAME "client"
-            GROUP "remote-services/remote-services-cfg"
-            BUNDLES topology_manager remote_service_admin_http shell shell_tui log_service log_writer calculator_shell discovery_configured
-            PROPERTIES
-                RSA_PORT=8002
-                DISCOVERY_CFG_POLL_ENDPOINTS=http://localhost:8081/org.apache.celix.discovery.configured
-                DISCOVERY_CFG_SERVER_PORT=8082
-        )
-        deploy_bundles_dir(remote-services-cfg-client DIR_NAME "endpoints"
-            BUNDLES org.apache.celix.calc.api.Calculator_proxy org.apache.celix.calc.api.Calculator2_proxy
-        )
-    endif()
-
-    if (BUILD_RSA_REMOTE_SERVICE_ADMIN_SHM AND BUILD_RSA_DISCOVERY_SHM)
-        add_deploy(remote-services-shm 
-            NAME "server"
-            GROUP "remote-services/remote-services-shm"
-            BUNDLES discovery_shm topology_manager remote_service_admin_shm calculator shell shell_tui log_service log_writer
-        )
-        deploy_bundles_dir(remote-services-shm DIR_NAME "endpoints"
-            BUNDLES org.apache.celix.calc.api.Calculator_endpoint
-        )
-
-        add_deploy(remote-services-shm-client 
-            NAME "client"
-            GROUP "remote-services/remote-services-shm"
-            BUNDLES topology_manager remote_service_admin_shm shell shell_tui log_service log_writer calculator_shell discovery_shm
-        )
-        deploy_bundles_dir(remote-services-shm-client DIR_NAME "endpoints"
-            BUNDLES org.apache.celix.calc.api.Calculator_proxy
-        )
-    endif ()
 
-    if (BUILD_RSA_DISCOVERY_ETCD AND BUILD_RSA_REMOTE_SERVICE_ADMIN_HTTP)
-        add_deploy(remote-services-etcd 
-            NAME "server"
-            GROUP "remote-services/remote-services-etcd"
-            BUNDLES discovery_etcd topology_manager remote_service_admin_http calculator shell shell_tui log_service log_writer
-        )
-        deploy_bundles_dir(remote-services-etcd DIR_NAME "endpoints"
-            BUNDLES
-            	org.apache.celix.calc.api.Calculator_endpoint
-            	org.apache.celix.calc.api.Calculator2_endpoint
-        )
+#    TODO refactor shm remote service admin to use dfi
+#    if (BUILD_RSA_REMOTE_SERVICE_ADMIN_SHM AND BUILD_RSA_DISCOVERY_SHM)
+#        add_deploy(remote-services-shm
+#            NAME "server"
+#            GROUP "remote-services/remote-services-shm"
+#            BUNDLES discovery_shm topology_manager remote_service_admin_shm calculator shell shell_tui log_service log_writer
+#        )
+#        deploy_bundles_dir(remote-services-shm DIR_NAME "endpoints"
+#            BUNDLES org.apache.celix.calc.api.Calculator_endpoint
+#        )
+#
+#        add_deploy(remote-services-shm-client
+#            NAME "client"
+#            GROUP "remote-services/remote-services-shm"
+#            BUNDLES topology_manager remote_service_admin_shm shell shell_tui log_service log_writer calculator_shell discovery_shm
+#        )
+#        deploy_bundles_dir(remote-services-shm-client DIR_NAME "endpoints"
+#            BUNDLES org.apache.celix.calc.api.Calculator_proxy
+#        )
+#    endif ()
 
-        add_deploy("remote-services-etcd-client" 
-            NAME "client"
-            GROUP "remote-services/remote-services-etcd"
-            BUNDLES topology_manager remote_service_admin_http shell shell_tui log_service log_writer calculator_shell discovery_etcd
-        )
-        deploy_bundles_dir(remote-services-etcd-client DIR_NAME "endpoints"
-            BUNDLES org.apache.celix.calc.api.Calculator_proxy
-        )
-    endif ()
 
     if (BUILD_RSA_DISCOVERY_ETCD AND BUILD_RSA_REMOTE_SERVICE_ADMIN_DFI)
         add_deploy(remote-services-dfi 
             NAME "server"
             GROUP "remote-services/remote-services-dfi"
-            BUNDLES discovery_etcd topology_manager remote_service_admin_dfi calculator shell shell_tui log_service log_writer
+            BUNDLES discovery_etcd topology_manager remote_service_admin_dfi calculator Celix::shell Celix::shell_tui log_service log_writer
         )
 
         add_deploy("remote-services-dfi-client" 
             NAME "client"
             GROUP "remote-services/remote-services-dfi"
-            BUNDLES topology_manager remote_service_admin_dfi shell shell_tui log_service log_writer calculator_shell discovery_etcd
+            BUNDLES topology_manager remote_service_admin_dfi Celix::shell Celix::shell_tui log_service log_writer calculator_shell discovery_etcd
         )
     endif ()
 endif (RSA_EXAMPLES)

http://git-wip-us.apache.org/repos/asf/celix/blob/a1c30887/remote_services/examples/calculator_endpoint/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/remote_services/examples/calculator_endpoint/CMakeLists.txt b/remote_services/examples/calculator_endpoint/CMakeLists.txt
deleted file mode 100644
index 6e9c928..0000000
--- a/remote_services/examples/calculator_endpoint/CMakeLists.txt
+++ /dev/null
@@ -1,35 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License.  You may obtain a copy of the License at
-# 
-#   http://www.apache.org/licenses/LICENSE-2.0
-# 
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied.  See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-find_package(Jansson REQUIRED)
-
-include_directories("${JANSSON_INCLUDE_DIRS}")
-include_directories("../../../utils/public/include")
-include_directories("../../remote_service_admin/public/include")
-include_directories("../calculator_service/public/include")
-include_directories("private/include")
-
-add_bundle(org.apache.celix.calc.api.Calculator_endpoint SOURCES
-	private/src/calculator_endpoint_activator
-	private/src/calculator_endpoint_impl.c
-    
-    private/include/calculator_endpoint_impl.h
-    VERSION 0.0.1
-    SYMBOLIC_NAME "apache_celix_remoting_calculator_endpoint"
-)
-
-target_link_libraries(org.apache.celix.calc.api.Calculator_endpoint celix_framework ${JANSSON_LIBRARIES})

http://git-wip-us.apache.org/repos/asf/celix/blob/a1c30887/remote_services/examples/calculator_endpoint/private/include/calculator_endpoint_impl.h
----------------------------------------------------------------------
diff --git a/remote_services/examples/calculator_endpoint/private/include/calculator_endpoint_impl.h b/remote_services/examples/calculator_endpoint/private/include/calculator_endpoint_impl.h
deleted file mode 100644
index dbeda2d..0000000
--- a/remote_services/examples/calculator_endpoint/private/include/calculator_endpoint_impl.h
+++ /dev/null
@@ -1,46 +0,0 @@
-/**
- *Licensed to the Apache Software Foundation (ASF) under one
- *or more contributor license agreements.  See the NOTICE file
- *distributed with this work for additional information
- *regarding copyright ownership.  The ASF licenses this file
- *to you under the Apache License, Version 2.0 (the
- *"License"); you may not use this file except in compliance
- *with the License.  You may obtain a copy of the License at
- *
- *  http://www.apache.org/licenses/LICENSE-2.0
- *
- *Unless required by applicable law or agreed to in writing,
- *software distributed under the License is distributed on an
- *"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- *specific language governing permissions and limitations
- *under the License.
- */
-/*
- * calculator_endpoint_impl.h
- *
- *  \date       Oct 7, 2011
- *  \author    	<a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
- *  \copyright	Apache License, Version 2.0
- */
-
-#ifndef CALCULATOR_ENDPOINT_IMPL_H_
-#define CALCULATOR_ENDPOINT_IMPL_H_
-
-#include "celix_errno.h"
-#include "remote_endpoint_impl.h"
-
-#include "calculator_service.h"
-
-celix_status_t calculatorEndpoint_create(remote_endpoint_pt *endpoint);
-celix_status_t calculatorEndpoint_destroy(remote_endpoint_pt *endpoint);
-
-celix_status_t calculatorEndpoint_setService(remote_endpoint_pt endpoint, void *service);
-
-celix_status_t calculatorEndpoint_handleRequest(remote_endpoint_pt endpoint, char *data, char **reply);
-
-celix_status_t calculatorEndpoint_add(remote_endpoint_pt endpoint, char *data, char **reply);
-celix_status_t calculatorEndpoint_sub(remote_endpoint_pt endpoint, char *data, char **reply);
-celix_status_t calculatorEndpoint_sqrt(remote_endpoint_pt endpoint, char *data, char **reply);
-
-#endif /* CALCULATOR_ENDPOINT_IMPL_H_ */

http://git-wip-us.apache.org/repos/asf/celix/blob/a1c30887/remote_services/examples/calculator_endpoint/private/src/calculator_endpoint_activator.c
----------------------------------------------------------------------
diff --git a/remote_services/examples/calculator_endpoint/private/src/calculator_endpoint_activator.c b/remote_services/examples/calculator_endpoint/private/src/calculator_endpoint_activator.c
deleted file mode 100644
index 319ecb0..0000000
--- a/remote_services/examples/calculator_endpoint/private/src/calculator_endpoint_activator.c
+++ /dev/null
@@ -1,96 +0,0 @@
-/**
- *Licensed to the Apache Software Foundation (ASF) under one
- *or more contributor license agreements.  See the NOTICE file
- *distributed with this work for additional information
- *regarding copyright ownership.  The ASF licenses this file
- *to you under the Apache License, Version 2.0 (the
- *"License"); you may not use this file except in compliance
- *with the License.  You may obtain a copy of the License at
- *
- *  http://www.apache.org/licenses/LICENSE-2.0
- *
- *Unless required by applicable law or agreed to in writing,
- *software distributed under the License is distributed on an
- *"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- *specific language governing permissions and limitations
- *under the License.
- */
-/*
- * calculator_endpoint_activator.c
- *
- *  \date       Oct 10, 2011
- *  \author    	<a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
- *  \copyright	Apache License, Version 2.0
- */
-#include <stdlib.h>
-
-#include "bundle_activator.h"
-
-#include "calculator_endpoint_impl.h"
-#include "service_registration.h"
-
-struct activator {
-	remote_endpoint_service_pt endpointService;
-	service_registration_pt endpointServiceRegistration;
-};
-
-celix_status_t bundleActivator_create(bundle_context_pt context, void **userData) {
-	celix_status_t status = CELIX_SUCCESS;
-
-	struct activator *activator;
-
-	activator = calloc(1, sizeof(*activator));
-	if (!activator) {
-		status = CELIX_ENOMEM;
-	} else {
-		activator->endpointService = NULL;
-		activator->endpointServiceRegistration = NULL;
-
-		*userData = activator;
-	}
-
-	return status;
-}
-
-celix_status_t bundleActivator_start(void * userData, bundle_context_pt context) {
-	celix_status_t status = CELIX_SUCCESS;
-	struct activator *activator = userData;
-	remote_endpoint_pt endpoint = NULL;
-	remote_endpoint_service_pt endpointService = NULL;
-
-	calculatorEndpoint_create(&endpoint);
-	endpointService = calloc(1, sizeof(*endpointService));
-	endpointService->endpoint = endpoint;
-	endpointService->handleRequest = calculatorEndpoint_handleRequest;
-	endpointService->setService = calculatorEndpoint_setService;
-
-	properties_pt props = properties_create();
-	properties_set(props, (char *) "remote.interface", (char *) CALCULATOR_SERVICE);
-
-	bundleContext_registerService(context, OSGI_RSA_REMOTE_ENDPOINT, endpointService, props, &activator->endpointServiceRegistration);
-
-	activator->endpointService = endpointService;
-
-	return status;
-}
-
-celix_status_t bundleActivator_stop(void * userData, bundle_context_pt context) {
-	celix_status_t status = CELIX_SUCCESS;
-	struct activator *activator = userData;
-
-	serviceRegistration_unregister(activator->endpointServiceRegistration);
-
-	calculatorEndpoint_destroy(&activator->endpointService->endpoint);
-	free(activator->endpointService);
-
-	return status;
-}
-
-celix_status_t bundleActivator_destroy(void * userData, bundle_context_pt context) {
-	celix_status_t status = CELIX_SUCCESS;
-	struct activator *activator = userData;
-
-	free(activator);
-	return status;
-}

http://git-wip-us.apache.org/repos/asf/celix/blob/a1c30887/remote_services/examples/calculator_endpoint/private/src/calculator_endpoint_impl.c
----------------------------------------------------------------------
diff --git a/remote_services/examples/calculator_endpoint/private/src/calculator_endpoint_impl.c b/remote_services/examples/calculator_endpoint/private/src/calculator_endpoint_impl.c
deleted file mode 100644
index b9a973f..0000000
--- a/remote_services/examples/calculator_endpoint/private/src/calculator_endpoint_impl.c
+++ /dev/null
@@ -1,184 +0,0 @@
-/**
- *Licensed to the Apache Software Foundation (ASF) under one
- *or more contributor license agreements.  See the NOTICE file
- *distributed with this work for additional information
- *regarding copyright ownership.  The ASF licenses this file
- *to you under the Apache License, Version 2.0 (the
- *"License"); you may not use this file except in compliance
- *with the License.  You may obtain a copy of the License at
- *
- *  http://www.apache.org/licenses/LICENSE-2.0
- *
- *Unless required by applicable law or agreed to in writing,
- *software distributed under the License is distributed on an
- *"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- *specific language governing permissions and limitations
- *under the License.
- */
-/*
- * calculator_endpoint_impl.c
- *
- *  \date       Oct 7, 2011
- *  \author    	<a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
- *  \copyright	Apache License, Version 2.0
- */
-#include <jansson.h>
-#include <string.h>
-
-#include "celix_errno.h"
-
-#include "calculator_endpoint_impl.h"
-
-celix_status_t calculatorEndpoint_create(remote_endpoint_pt *endpoint) {
-	celix_status_t status = CELIX_SUCCESS;
-	*endpoint = calloc(1, sizeof(**endpoint));
-	if (!*endpoint) {
-		status = CELIX_ENOMEM;
-	} else {
-		(*endpoint)->service = NULL;
-	}
-
-	return status;
-}
-
-celix_status_t calculatorEndpoint_destroy(remote_endpoint_pt *endpoint) {
-	celix_status_t status = CELIX_SUCCESS;
-	free(*endpoint);
-	*endpoint = NULL;
-
-	return status;
-}
-
-celix_status_t calculatorEndpoint_setService(remote_endpoint_pt endpoint, void *service) {
-	celix_status_t status = CELIX_SUCCESS;
-	endpoint->service = service;
-	return status;
-}
-
-/**
- * Request: http://host:port/services/{service}
- */
-celix_status_t calculatorEndpoint_handleRequest(remote_endpoint_pt endpoint, char *data, char **reply) {
-	celix_status_t status = CELIX_SUCCESS;
-	json_error_t jsonError;
-    json_t *root = json_loads(data, 0, &jsonError);
-    const char *sig;
-    json_unpack(root, "{s:s}", "m", &sig);
-
-	printf("CALCULATOR_ENDPOINT: Handle request \"%s\" with data \"%s\"\n", sig, data);
-	if (strcmp(sig, "add(DD)D") == 0) {
-		calculatorEndpoint_add(endpoint, data, reply);
-	} else if (strcmp(sig, "sub(DD)D") == 0) {
-		calculatorEndpoint_sub(endpoint, data, reply);
-	} else if (strcmp(sig, "sqrt(D)D") == 0) {
-		calculatorEndpoint_sqrt(endpoint, data, reply);
-	} else {
-		status = CELIX_ILLEGAL_ARGUMENT;
-	}
-
-	json_decref(root);
-
-	return status;
-}
-
-celix_status_t calculatorEndpoint_add(remote_endpoint_pt endpoint, char *data, char **reply) {
-	celix_status_t status = CELIX_SUCCESS;
-	json_error_t jsonError;
-	json_t *root;
-
-	root = json_loads(data, 0, &jsonError);
-	if (!root) {
-		status = CELIX_ILLEGAL_ARGUMENT;
-	} else {
-		double a;
-		double b;
-		json_unpack(root, "{s:[ff]}", "a", &a, &b);
-
-		if (endpoint->service != NULL) {
-			double result;
-			json_t *resultRoot;
-			calculator_service_pt service = endpoint->service;
-			service->add(service->calculator, a, b, &result);
-			resultRoot = json_pack("{s:f}", "r", result);
-
-			char *c = json_dumps(resultRoot, 0);
-			*reply = c;
-
-			json_decref(resultRoot);
-		} else {
-			printf("CALCULATOR_ENDPOINT: No service available");
-			status = CELIX_BUNDLE_EXCEPTION;
-		}
-		json_decref(root);
-	}
-
-	return status;
-}
-
-celix_status_t calculatorEndpoint_sub(remote_endpoint_pt endpoint, char *data, char **reply) {
-	celix_status_t status = CELIX_SUCCESS;
-	json_error_t jsonError;
-	json_t *root;
-
-	root = json_loads(data, 0, &jsonError);
-	if (!root) {
-		status = CELIX_ILLEGAL_ARGUMENT;
-	} else {
-		double a;
-		double b;
-		json_unpack(root, "{s:[ff]}", "a", &a, &b);
-
-		if (endpoint->service != NULL) {
-			double result;
-			json_t *resultRoot;
-			calculator_service_pt service = endpoint->service;
-			service->sub(service->calculator, a, b, &result);
-			resultRoot = json_pack("{s:f}", "r", result);
-
-			char *c = json_dumps(resultRoot, JSON_ENCODE_ANY);
-			*reply = c;
-
-			json_decref(resultRoot);
-		} else {
-			printf("CALCULATOR_ENDPOINT: No service available");
-			status = CELIX_BUNDLE_EXCEPTION;
-		}
-		json_decref(root);
-	}
-
-	return status;
-}
-
-celix_status_t calculatorEndpoint_sqrt(remote_endpoint_pt endpoint, char *data, char **reply) {
-	celix_status_t status = CELIX_SUCCESS;
-	json_error_t jsonError;
-	json_t *root;
-
-	root = json_loads(data, 0, &jsonError);
-	if (!root) {
-		status = CELIX_ILLEGAL_ARGUMENT;
-	} else {
-		double a;
-		json_unpack(root, "{s:[f]}", "a", &a);
-
-		if (endpoint->service != NULL) {
-			double result;
-			json_t *resultRoot;
-			calculator_service_pt service = endpoint->service;
-			service->sqrt(service->calculator, a, &result);
-			resultRoot = json_pack("{s:f}", "r", result);
-
-			char *c = json_dumps(resultRoot, JSON_ENCODE_ANY);
-			*reply = c;
-
-			json_decref(resultRoot);
-		} else {
-			printf("CALCULATOR_ENDPOINT: No service available");
-			status = CELIX_BUNDLE_EXCEPTION;
-		}
-		json_decref(root);
-	}
-
-	return status;
-}

http://git-wip-us.apache.org/repos/asf/celix/blob/a1c30887/remote_services/examples/calculator_endpoint2/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/remote_services/examples/calculator_endpoint2/CMakeLists.txt b/remote_services/examples/calculator_endpoint2/CMakeLists.txt
deleted file mode 100644
index b75e6df..0000000
--- a/remote_services/examples/calculator_endpoint2/CMakeLists.txt
+++ /dev/null
@@ -1,35 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License.  You may obtain a copy of the License at
-# 
-#   http://www.apache.org/licenses/LICENSE-2.0
-# 
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied.  See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-find_package(Jansson REQUIRED)
-
-include_directories("${JANSSON_INCLUDE_DIRS}")
-include_directories("../../../utils/public/include")
-include_directories("../../remote_service_admin/public/include")
-include_directories("../calculator_service/public/include")
-include_directories("private/include")
-
-add_bundle(org.apache.celix.calc.api.Calculator2_endpoint SOURCES
-	private/src/calculator_endpoint_activator
-	private/src/calculator_endpoint_impl.c
-    
-    private/include/calculator_endpoint_impl.h
-    SYMBOLIC_NAME "apache_celix_remoting_calculator2_endpoint"
-    VERSION "0.0.1"
-)
-
-target_link_libraries(org.apache.celix.calc.api.Calculator2_endpoint celix_framework ${JANSSON_LIBRARIES})

http://git-wip-us.apache.org/repos/asf/celix/blob/a1c30887/remote_services/examples/calculator_endpoint2/private/include/calculator_endpoint_impl.h
----------------------------------------------------------------------
diff --git a/remote_services/examples/calculator_endpoint2/private/include/calculator_endpoint_impl.h b/remote_services/examples/calculator_endpoint2/private/include/calculator_endpoint_impl.h
deleted file mode 100644
index dbeda2d..0000000
--- a/remote_services/examples/calculator_endpoint2/private/include/calculator_endpoint_impl.h
+++ /dev/null
@@ -1,46 +0,0 @@
-/**
- *Licensed to the Apache Software Foundation (ASF) under one
- *or more contributor license agreements.  See the NOTICE file
- *distributed with this work for additional information
- *regarding copyright ownership.  The ASF licenses this file
- *to you under the Apache License, Version 2.0 (the
- *"License"); you may not use this file except in compliance
- *with the License.  You may obtain a copy of the License at
- *
- *  http://www.apache.org/licenses/LICENSE-2.0
- *
- *Unless required by applicable law or agreed to in writing,
- *software distributed under the License is distributed on an
- *"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- *specific language governing permissions and limitations
- *under the License.
- */
-/*
- * calculator_endpoint_impl.h
- *
- *  \date       Oct 7, 2011
- *  \author    	<a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
- *  \copyright	Apache License, Version 2.0
- */
-
-#ifndef CALCULATOR_ENDPOINT_IMPL_H_
-#define CALCULATOR_ENDPOINT_IMPL_H_
-
-#include "celix_errno.h"
-#include "remote_endpoint_impl.h"
-
-#include "calculator_service.h"
-
-celix_status_t calculatorEndpoint_create(remote_endpoint_pt *endpoint);
-celix_status_t calculatorEndpoint_destroy(remote_endpoint_pt *endpoint);
-
-celix_status_t calculatorEndpoint_setService(remote_endpoint_pt endpoint, void *service);
-
-celix_status_t calculatorEndpoint_handleRequest(remote_endpoint_pt endpoint, char *data, char **reply);
-
-celix_status_t calculatorEndpoint_add(remote_endpoint_pt endpoint, char *data, char **reply);
-celix_status_t calculatorEndpoint_sub(remote_endpoint_pt endpoint, char *data, char **reply);
-celix_status_t calculatorEndpoint_sqrt(remote_endpoint_pt endpoint, char *data, char **reply);
-
-#endif /* CALCULATOR_ENDPOINT_IMPL_H_ */

http://git-wip-us.apache.org/repos/asf/celix/blob/a1c30887/remote_services/examples/calculator_endpoint2/private/src/calculator_endpoint_activator.c
----------------------------------------------------------------------
diff --git a/remote_services/examples/calculator_endpoint2/private/src/calculator_endpoint_activator.c b/remote_services/examples/calculator_endpoint2/private/src/calculator_endpoint_activator.c
deleted file mode 100644
index 9f89d91..0000000
--- a/remote_services/examples/calculator_endpoint2/private/src/calculator_endpoint_activator.c
+++ /dev/null
@@ -1,96 +0,0 @@
-/**
- *Licensed to the Apache Software Foundation (ASF) under one
- *or more contributor license agreements.  See the NOTICE file
- *distributed with this work for additional information
- *regarding copyright ownership.  The ASF licenses this file
- *to you under the Apache License, Version 2.0 (the
- *"License"); you may not use this file except in compliance
- *with the License.  You may obtain a copy of the License at
- *
- *  http://www.apache.org/licenses/LICENSE-2.0
- *
- *Unless required by applicable law or agreed to in writing,
- *software distributed under the License is distributed on an
- *"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- *specific language governing permissions and limitations
- *under the License.
- */
-/*
- * calculator_endpoint_activator.c
- *
- *  \date       Oct 10, 2011
- *  \author    	<a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
- *  \copyright	Apache License, Version 2.0
- */
-#include <stdlib.h>
-
-#include "bundle_activator.h"
-
-#include "calculator_endpoint_impl.h"
-#include "service_registration.h"
-
-struct activator {
-	remote_endpoint_service_pt endpointService;
-	service_registration_pt endpointServiceRegistration;
-};
-
-celix_status_t bundleActivator_create(bundle_context_pt context, void **userData) {
-	celix_status_t status = CELIX_SUCCESS;
-
-	struct activator *activator;
-
-	activator = calloc(1, sizeof(*activator));
-	if (!activator) {
-		status = CELIX_ENOMEM;
-	} else {
-		activator->endpointService = NULL;
-		activator->endpointServiceRegistration = NULL;
-
-		*userData = activator;
-	}
-
-	return status;
-}
-
-celix_status_t bundleActivator_start(void * userData, bundle_context_pt context) {
-	celix_status_t status = CELIX_SUCCESS;
-	struct activator *activator = userData;
-	remote_endpoint_pt endpoint = NULL;
-	remote_endpoint_service_pt endpointService = NULL;
-
-	calculatorEndpoint_create(&endpoint);
-	endpointService = calloc(1, sizeof(*endpointService));
-	endpointService->endpoint = endpoint;
-	endpointService->handleRequest = calculatorEndpoint_handleRequest;
-        endpointService->setService = calculatorEndpoint_setService;
-
-        properties_pt props = properties_create();
-        properties_set(props, (char *) "remote.interface", (char *) CALCULATOR2_SERVICE);
-
-        bundleContext_registerService(context, OSGI_RSA_REMOTE_ENDPOINT, endpointService, props, &activator->endpointServiceRegistration);
-
-	activator->endpointService = endpointService;
-
-	return status;
-}
-
-celix_status_t bundleActivator_stop(void * userData, bundle_context_pt context) {
-	celix_status_t status = CELIX_SUCCESS;
-	struct activator *activator = userData;
-
-	serviceRegistration_unregister(activator->endpointServiceRegistration);
-
-	calculatorEndpoint_destroy(&activator->endpointService->endpoint);
-	free(activator->endpointService);
-
-	return status;
-}
-
-celix_status_t bundleActivator_destroy(void * userData, bundle_context_pt context) {
-	celix_status_t status = CELIX_SUCCESS;
-	struct activator *activator = userData;
-
-	free(activator);
-	return status;
-}