celix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pnol...@apache.org
Subject celix git commit: CELIX-370: Reverts some changes for the C/C++ dependency manager and some refactoring.
Date Fri, 23 Jun 2017 13:20:18 GMT
Repository: celix
Updated Branches:
  refs/heads/develop a2f06474a -> 0aa1f0bec


CELIX-370: Reverts some changes for the C/C++ dependency manager and some refactoring.

Cannot find a way to make a working header based C++ depedency manager. The previous setup had some bugs (multiple defitions) when using more than one level of inheritance with the DmActivator


Project: http://git-wip-us.apache.org/repos/asf/celix/repo
Commit: http://git-wip-us.apache.org/repos/asf/celix/commit/0aa1f0be
Tree: http://git-wip-us.apache.org/repos/asf/celix/tree/0aa1f0be
Diff: http://git-wip-us.apache.org/repos/asf/celix/diff/0aa1f0be

Branch: refs/heads/develop
Commit: 0aa1f0becfbcfedabf8048fca25df59b2af29be9
Parents: a2f0647
Author: Pepijn Noltes <pepijnnoltes@gmail.com>
Authored: Fri Jun 23 15:17:14 2017 +0200
Committer: Pepijn Noltes <pepijnnoltes@gmail.com>
Committed: Fri Jun 23 15:17:14 2017 +0200

----------------------------------------------------------------------
 cmake/FindCELIX.cmake                           |  26 +++-
 dependency_manager/CMakeLists.txt               |   3 +
 dependency_manager/private/src/dm_activator.c   | 119 +++++++++++++++++
 .../public/include/dm_activator.h               |   7 +-
 .../public/include/dm_activator_impl.h          | 119 -----------------
 dependency_manager_cxx/CMakeLists.txt           |  36 ++++-
 .../include/celix/dm/DependencyManager.h        |  26 +++-
 .../include/celix/dm/DependencyManager_Impl.h   |  29 -----
 .../include/celix/dm/DmActivator.h              |  63 ++++++---
 .../include/celix/dm/DmActivator_Impl.h         | 130 -------------------
 .../include/celix/dm/ServiceDependency.h        |  22 +++-
 .../include/celix/dm/ServiceDependency_Impl.h   |  21 ---
 dependency_manager_cxx/src/dm_activator.cc      |  88 +++++++++++++
 examples/dm_example_cxx/phase1/CMakeLists.txt   |   6 +-
 examples/dm_example_cxx/phase2a/CMakeLists.txt  |   6 +-
 examples/dm_example_cxx/phase2b/CMakeLists.txt  |   6 +-
 examples/dm_example_cxx/phase3/CMakeLists.txt   |   7 +-
 .../phase3/include/Phase3Activator.h            |   6 +-
 .../phase3/include/Phase3BaseActivator.h        |  35 +++++
 .../phase3/src/Phase3Activator.cc               |   8 +-
 .../phase3/src/Phase3BaseActivator.cc           |  31 +++++
 .../phase3_locking/CMakeLists.txt               |   6 +-
 .../services_example_cxx/bar/CMakeLists.txt     |   6 +-
 .../services_example_cxx/baz/CMakeLists.txt     |   6 +-
 .../services_example_cxx/foo/CMakeLists.txt     |   6 +-
 25 files changed, 445 insertions(+), 373 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/celix/blob/0aa1f0be/cmake/FindCELIX.cmake
----------------------------------------------------------------------
diff --git a/cmake/FindCELIX.cmake b/cmake/FindCELIX.cmake
index fc7a96e..c3d3840 100644
--- a/cmake/FindCELIX.cmake
+++ b/cmake/FindCELIX.cmake
@@ -26,8 +26,9 @@
 #  CELIX_LAUNCHER - The path to the celix launcher
 #
 #  CELIX_BUNDLES_DIR - The path where the Celix provided bundles are installed
+#  CELIX_DM_LIB - The Celix Dependency Manager library
 #  CELIX_DM_STATIC_LIB - The Celix Dependency Manager static library
-#  CELIX_DM_CXX_STATIC_LIB - The Celix C++ Dependency Manager static library
+#  CELIX_DM_STATIC_CXX_LIB - The Celix C++ Dependency Manager static library
 
 set(CELIX_DIR_FROM_FINDCELIX "${CMAKE_CURRENT_LIST_DIR}/../../../..")
 
@@ -68,23 +69,36 @@ find_path(CELIX_BUNDLES_DIR shell.zip
           	PATH_SUFFIXES share/celix/bundles
 )
 
+find_library(CELIX_DM_LIB NAMES dependency_manager_so
+		PATHS ${CELIX_DIR_FROM_FINDCELIX} $ENV{CELIX_DIR} ${CELIX_DIR} /usr /usr/local
+		PATH_SUFFIXES lib lib64
+)
+
 find_library(CELIX_DM_STATIC_LIB NAMES dependency_manager_static
 		PATHS ${CELIX_DIR_FROM_FINDCELIX} $ENV{CELIX_DIR} ${CELIX_DIR} /usr /usr/local
 		PATH_SUFFIXES lib lib64
 )
+
+find_library(CELIX_DM_STATIC_CXX_LIB NAMES dependency_manager_cxx_static
+		PATHS ${CELIX_DIR_FROM_FINDCELIX} $ENV{CELIX_DIR} ${CELIX_DIR} /usr /usr/local
+		PATH_SUFFIXES lib lib64
+)
+
 if (CELIX_DM_STATIC_LIB)
     set(CELIX_DM_INCLUDE_DIR ${CELIX_INCLUDE_DIR}/dependency_manager)
-    set(CELIX_DM_CXX_INCLUDE_DIR ${CELIX_INCLUDE_DIR}/dependency_manager_cxx)
-else()
-    set(CELIX_DM_INCLUDE_DIR )
-    set(CELIX_DM_CXX_INCLUDE_DIR )
 endif()
+if (CELIX_DM_LIB)
+    set(CELIX_DM_INCLUDE_DIR ${CELIX_INCLUDE_DIR}/dependency_manager)
+endif ()
+if (CELIX_DM_STATIC_CXX_LIB)
+    set(CELIX_DM_CXX_INCLUDE_DIR ${CELIX_INCLUDE_DIR}/dependency_manager_cxx)
+endif ()
 
 include(FindPackageHandleStandardArgs)
 # handle the QUIETLY and REQUIRED arguments and set CELIX_FOUND to TRUE
 # if all listed variables are TRUE
 find_package_handle_standard_args(CELIX  DEFAULT_MSG
-                                  CELIX_FRAMEWORK_LIBRARY CELIX_UTILS_LIBRARY CELIX_DFI_LIBRARY CELIX_DM_STATIC_LIB CELIX_DM_CXX_STATIC_LIB CELIX_INCLUDE_DIR CELIX_LAUNCHER CELIX_CMAKECELIX_FILE)
+	CELIX_FRAMEWORK_LIBRARY CELIX_UTILS_LIBRARY CELIX_DFI_LIBRARY CELIX_DM_SHARED_LIB CELIX_DM_STATIC_LIB CELIX_DM_STATIC_CXX_LIB CELIX_INCLUDE_DIR CELIX_LAUNCHER CELIX_CMAKECELIX_FILE)
 mark_as_advanced(CELIX_INCLUDE_DIR CELIX_FRAMEWORK_LIBRARY CELIX_UTILS_LIBRARY CELIX_LAUNCHER CELIX_CMAKECELIX_FILE)
 
 if(CELIX_FOUND)

http://git-wip-us.apache.org/repos/asf/celix/blob/0aa1f0be/dependency_manager/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/dependency_manager/CMakeLists.txt b/dependency_manager/CMakeLists.txt
index f2e8342..842f608 100644
--- a/dependency_manager/CMakeLists.txt
+++ b/dependency_manager/CMakeLists.txt
@@ -46,6 +46,7 @@ if (DEPENDENCY_MANAGER)
     	private/src/dm_service_dependency
     	private/src/dm_event
     	private/src/dm_dependency_manager_impl
+        private/src/dm_activator
     )
     set_target_properties(dependency_manager_static PROPERTIES SOVERSION 1)
 
@@ -54,6 +55,7 @@ if (DEPENDENCY_MANAGER)
     	private/src/dm_service_dependency
      	private/src/dm_event
         private/src/dm_dependency_manager_impl
+        private/src/dm_activator
     )
     set_target_properties(dependency_manager_so PROPERTIES SOVERSION 1)
 
@@ -72,6 +74,7 @@ if (DEPENDENCY_MANAGER)
     install(
     	FILES
     	    public/include/dm_activator.h
+            private/src/dm_activator.c
             public/include/dm_component.h
             public/include/dm_dependency_manager.h
             public/include/dm_service_dependency.h

http://git-wip-us.apache.org/repos/asf/celix/blob/0aa1f0be/dependency_manager/private/src/dm_activator.c
----------------------------------------------------------------------
diff --git a/dependency_manager/private/src/dm_activator.c b/dependency_manager/private/src/dm_activator.c
new file mode 100644
index 0000000..8de3bf1
--- /dev/null
+++ b/dependency_manager/private/src/dm_activator.c
@@ -0,0 +1,119 @@
+/**
+ * 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 "dm_activator.h"
+
+#include <stdlib.h>
+
+struct dm_dependency_activator_base {
+    dm_dependency_manager_pt manager;
+    bundle_context_pt context;
+    service_registration_pt reg;
+    dm_info_service_pt info;
+    void* userData;
+};
+
+typedef struct dm_dependency_activator_base * dependency_activator_base_pt;
+
+celix_status_t bundleActivator_create(bundle_context_pt context, void **userData) {
+    celix_status_t status = CELIX_ENOMEM;
+
+    dependency_activator_base_pt dependency_activator = calloc(1, sizeof(struct dm_dependency_activator_base));
+    dm_info_service_pt serv = calloc(1, sizeof(*serv));
+
+    if (dependency_activator != NULL && serv != NULL) {
+        dependency_activator->context = context;
+        dm_create(context, &dependency_activator->userData);
+        dependency_activator->info = serv;
+
+        status = dependencyManager_create(dependency_activator->context, &dependency_activator->manager);
+    } else {
+        status = CELIX_ENOMEM;
+
+    }
+
+    if (status == CELIX_SUCCESS) {
+        *userData = dependency_activator;
+    } else {
+        if (dependency_activator != NULL) {
+            dependencyManager_destroy(dependency_activator->manager);
+        }
+        free(dependency_activator);
+        free(serv);
+    }
+
+    return status;
+}
+
+celix_status_t bundleActivator_start(void * userData, bundle_context_pt context) {
+    celix_status_t status;
+    dependency_activator_base_pt dependency_activator = (dependency_activator_base_pt) userData;
+
+
+    status = dm_init(dependency_activator->userData, context, dependency_activator->manager);
+
+    if (status == CELIX_SUCCESS) {
+        //Create the service
+        dependency_activator->info->handle = dependency_activator->manager;
+        dependency_activator->info->getInfo = (void *) dependencyManager_getInfo;
+        dependency_activator->info->destroyInfo = (void *) dependencyManager_destroyInfo;
+
+        status = bundleContext_registerService(context, DM_INFO_SERVICE_NAME, dependency_activator->info, NULL,
+                                               &(dependency_activator->reg));
+    }
+
+    return status;
+}
+
+celix_status_t bundleActivator_stop(void * userData, bundle_context_pt context __attribute__((unused))) {
+    celix_status_t status = CELIX_SUCCESS;
+    dependency_activator_base_pt dependency_activator = (dependency_activator_base_pt) userData;
+
+    // Remove the service
+    status = serviceRegistration_unregister(dependency_activator->reg);
+    dependencyManager_removeAllComponents(dependency_activator->manager);
+
+    return status;
+}
+
+celix_status_t bundleActivator_destroy(void * userData, bundle_context_pt context __attribute__((unused))) {
+    celix_status_t status = CELIX_SUCCESS;
+    dependency_activator_base_pt dependency_activator = (dependency_activator_base_pt) userData;
+
+    if(dependency_activator==NULL){
+        return CELIX_ILLEGAL_ARGUMENT;
+    }
+
+    status = dm_destroy(dependency_activator->userData, dependency_activator->context,
+                        dependency_activator->manager);
+
+    if (status == CELIX_SUCCESS) {
+        dependencyManager_destroy(dependency_activator->manager);
+    }
+
+    dependency_activator->userData = NULL;
+    dependency_activator->manager = NULL;
+
+    if (dependency_activator != NULL) {
+        free(dependency_activator->info);
+    }
+    free(dependency_activator);
+
+    return status;
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/celix/blob/0aa1f0be/dependency_manager/public/include/dm_activator.h
----------------------------------------------------------------------
diff --git a/dependency_manager/public/include/dm_activator.h b/dependency_manager/public/include/dm_activator.h
index 1b2b018..bba62e6 100644
--- a/dependency_manager/public/include/dm_activator.h
+++ b/dependency_manager/public/include/dm_activator.h
@@ -33,6 +33,7 @@
 #include "bundle_context.h"
 #include "celix_errno.h"
 #include "dm_dependency_manager.h"
+#include "bundle_activator.h"
 
 #ifdef __cplusplus
 extern "C" {
@@ -57,12 +58,6 @@ celix_status_t dm_init(void * userData, bundle_context_pt context, dm_dependency
  */
 celix_status_t dm_destroy(void * userData, bundle_context_pt context, dm_dependency_manager_pt manager);
 
-/**
- * Includes the header implementation of the bundle activator functions. The header impl is used to prevent
- * source dependency to bundle activator symbols.
- */
-#include "dm_activator_impl.h"
-
 #ifdef __cplusplus
 }
 #endif

http://git-wip-us.apache.org/repos/asf/celix/blob/0aa1f0be/dependency_manager/public/include/dm_activator_impl.h
----------------------------------------------------------------------
diff --git a/dependency_manager/public/include/dm_activator_impl.h b/dependency_manager/public/include/dm_activator_impl.h
deleted file mode 100644
index 878af0b..0000000
--- a/dependency_manager/public/include/dm_activator_impl.h
+++ /dev/null
@@ -1,119 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- * 
- *   http://www.apache.org/licenses/LICENSE-2.0 
- * 
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- *  KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-#include <stdlib.h>
-#include "bundle_context.h"
-#include "dm_dependency_manager.h"
-
-struct dm_dependency_activator_base {
-    dm_dependency_manager_pt manager;
-    bundle_context_pt context;
-    service_registration_pt reg;
-    dm_info_service_pt info;
-    void* userData;
-};
-
-typedef struct dm_dependency_activator_base * dependency_activator_base_pt;
-
-celix_status_t bundleActivator_create(bundle_context_pt context, void **userData) {
-    celix_status_t status = CELIX_ENOMEM;
-
-    dependency_activator_base_pt dependency_activator = calloc(1, sizeof(struct dm_dependency_activator_base));
-    dm_info_service_pt serv = calloc(1, sizeof(*serv));
-
-    if (dependency_activator != NULL && serv != NULL) {
-        dependency_activator->context = context;
-        dm_create(context, &dependency_activator->userData);
-        dependency_activator->info = serv;
-
-        status = dependencyManager_create(dependency_activator->context, &dependency_activator->manager);
-    } else {
-        status = CELIX_ENOMEM;
-
-    }
-
-    if (status == CELIX_SUCCESS) {
-        *userData = dependency_activator;
-    } else {
-        if (dependency_activator != NULL) {
-            dependencyManager_destroy(dependency_activator->manager);
-        }
-        free(dependency_activator);
-        free(serv);
-    }
-
-    return status;
-}
-
-celix_status_t bundleActivator_start(void * userData, bundle_context_pt context) {
-    celix_status_t status;
-    dependency_activator_base_pt dependency_activator = (dependency_activator_base_pt) userData;
-
-
-    status = dm_init(dependency_activator->userData, context, dependency_activator->manager);
-
-    if (status == CELIX_SUCCESS) {
-        //Create the service
-        dependency_activator->info->handle = dependency_activator->manager;
-        dependency_activator->info->getInfo = (void *) dependencyManager_getInfo;
-        dependency_activator->info->destroyInfo = (void *) dependencyManager_destroyInfo;
-
-        status = bundleContext_registerService(context, DM_INFO_SERVICE_NAME, dependency_activator->info, NULL,
-                                               &(dependency_activator->reg));
-    }
-
-    return status;
-}
-
-celix_status_t bundleActivator_stop(void * userData, bundle_context_pt context __attribute__((unused))) {
-    celix_status_t status = CELIX_SUCCESS;
-    dependency_activator_base_pt dependency_activator = (dependency_activator_base_pt) userData;
-
-    // Remove the service
-    status = serviceRegistration_unregister(dependency_activator->reg);
-    dependencyManager_removeAllComponents(dependency_activator->manager);
-
-    return status;
-}
-
-celix_status_t bundleActivator_destroy(void * userData, bundle_context_pt context __attribute__((unused))) {
-    celix_status_t status = CELIX_SUCCESS;
-    dependency_activator_base_pt dependency_activator = (dependency_activator_base_pt) userData;
-
-    if(dependency_activator==NULL){
-        return CELIX_ILLEGAL_ARGUMENT;
-    }
-
-    status = dm_destroy(dependency_activator->userData, dependency_activator->context,
-                        dependency_activator->manager);
-
-    if (status == CELIX_SUCCESS) {
-        dependencyManager_destroy(dependency_activator->manager);
-    }
-
-    dependency_activator->userData = NULL;
-    dependency_activator->manager = NULL;
-
-    if (dependency_activator != NULL) {
-        free(dependency_activator->info);
-    }
-    free(dependency_activator);
-
-    return status;
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/celix/blob/0aa1f0be/dependency_manager_cxx/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/dependency_manager_cxx/CMakeLists.txt b/dependency_manager_cxx/CMakeLists.txt
index 34feec9..c113fa3 100644
--- a/dependency_manager_cxx/CMakeLists.txt
+++ b/dependency_manager_cxx/CMakeLists.txt
@@ -18,6 +18,39 @@
 celix_subproject(DEPENDENCY_MANAGER_CXX "Option to build the C++ dependency manager static library" ON DEPS framework DEPENDENCY_MANAGER)
 if (DEPENDENCY_MANAGER_CXX)
 
+    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)
+
+    include_directories(
+            include
+            ${PROJECT_SOURCE_DIR}/dependency_manager/public/include
+            ${PROJECT_SOURCE_DIR}/dependency_manager/private/include
+            ${PROJECT_SOURCE_DIR}/utils/public/include
+    )
+
+    add_library( dependency_manager_cxx_static STATIC
+            ${CMAKE_SOURCE_DIR}/dependency_manager/private/src/dm_component_impl
+            ${CMAKE_SOURCE_DIR}/dependency_manager/private/src/dm_service_dependency
+            ${CMAKE_SOURCE_DIR}/dependency_manager/private/src/dm_event
+            ${CMAKE_SOURCE_DIR}/dependency_manager/private/src/dm_dependency_manager_impl
+            src/dm_activator.cc
+    )
+    #set_target_properties(dependency_manager_cxx_static PROPERTIES SOVERSION 1)
+
+    if (APPLE)
+        target_link_libraries(dependency_manager_cxx_static celix_framework "-undefined dynamic_lookup")
+    else()
+        target_link_libraries(dependency_manager_cxx_static celix_framework)
+    endif()
+
     install(
         DIRECTORY
             include/celix
@@ -26,5 +59,6 @@ if (DEPENDENCY_MANAGER_CXX)
         COMPONENT
             dependency_manager_cxx
     )
-    
+    install(TARGETS dependency_manager_cxx_static DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT dependency_manager_cxx)
+
 endif (DEPENDENCY_MANAGER_CXX)

http://git-wip-us.apache.org/repos/asf/celix/blob/0aa1f0be/dependency_manager_cxx/include/celix/dm/DependencyManager.h
----------------------------------------------------------------------
diff --git a/dependency_manager_cxx/include/celix/dm/DependencyManager.h b/dependency_manager_cxx/include/celix/dm/DependencyManager.h
index 9a3ee96..f079b35 100644
--- a/dependency_manager_cxx/include/celix/dm/DependencyManager.h
+++ b/dependency_manager_cxx/include/celix/dm/DependencyManager.h
@@ -34,8 +34,15 @@ namespace celix { namespace dm {
 
     class DependencyManager {
     public:
-        DependencyManager(bundle_context_pt context);
-        virtual ~DependencyManager();
+        DependencyManager(bundle_context_pt ctx) : context(ctx) {
+                this->cDepMan = nullptr;
+                dependencyManager_create(context, &this->cDepMan);
+        }
+
+        virtual ~DependencyManager() {
+                dependencyManager_destroy(this->cDepMan);
+                this->cDepMan = nullptr;
+        }
 
         DependencyManager(DependencyManager&&) = default;
         DependencyManager& operator=(DependencyManager&&) = default;
@@ -43,8 +50,8 @@ namespace celix { namespace dm {
         DependencyManager(const DependencyManager&) = delete;
         DependencyManager& operator=(const DependencyManager&) = delete;
 
-        bundle_context_pt bundleContext() const;
-        dm_dependency_manager_pt cDependencyManager() const;
+        bundle_context_pt bundleContext() const { return context; }
+        dm_dependency_manager_pt cDependencyManager() const { return cDepMan; }
 
 
         /**
@@ -85,12 +92,19 @@ namespace celix { namespace dm {
         /**
          * Starts the Dependency Manager
          */
-        void start();
+        void start() {
+                for(std::unique_ptr<BaseComponent>& cmp : components)  {
+                        dependencyManager_add(cDepMan, cmp->cComponent());
+                }
+        }
 
         /**
          * Stops the Dependency Manager
          */
-        void stop();
+        void stop() {
+                dependencyManager_removeAllComponents(cDepMan);
+                components.clear();
+        }
     private:
         bundle_context_pt context {nullptr};
         std::vector<std::unique_ptr<BaseComponent>> components {};

http://git-wip-us.apache.org/repos/asf/celix/blob/0aa1f0be/dependency_manager_cxx/include/celix/dm/DependencyManager_Impl.h
----------------------------------------------------------------------
diff --git a/dependency_manager_cxx/include/celix/dm/DependencyManager_Impl.h b/dependency_manager_cxx/include/celix/dm/DependencyManager_Impl.h
index d434371..70cbcca 100644
--- a/dependency_manager_cxx/include/celix/dm/DependencyManager_Impl.h
+++ b/dependency_manager_cxx/include/celix/dm/DependencyManager_Impl.h
@@ -19,35 +19,6 @@
 
 using namespace celix::dm;
 
-DependencyManager::DependencyManager(bundle_context_pt context) : context(context), components() {
-    this->cDepMan = nullptr;
-    dependencyManager_create(context, &this->cDepMan);
-}
-
-DependencyManager::~DependencyManager() {
-    dependencyManager_destroy(this->cDepMan);
-    this->cDepMan = nullptr;
-}
-
-bundle_context_pt DependencyManager::bundleContext() const {
-    return context;
-}
-
-dm_dependency_manager_pt DependencyManager::cDependencyManager() const {
-    return cDepMan;
-}
-
-void DependencyManager::start() {
-    for(std::unique_ptr<BaseComponent>& cmp : components)  {
-        dependencyManager_add(cDepMan, cmp->cComponent());
-    }
-}
-
-void DependencyManager::stop() {
-    dependencyManager_removeAllComponents(cDepMan);
-    components.clear();
-}
-
 template<class T>
 Component<T>& DependencyManager::createComponent(std::string name) {
     Component<T>* cmp = name.empty() ?

http://git-wip-us.apache.org/repos/asf/celix/blob/0aa1f0be/dependency_manager_cxx/include/celix/dm/DmActivator.h
----------------------------------------------------------------------
diff --git a/dependency_manager_cxx/include/celix/dm/DmActivator.h b/dependency_manager_cxx/include/celix/dm/DmActivator.h
index caf376a..ba27b7a 100644
--- a/dependency_manager_cxx/include/celix/dm/DmActivator.h
+++ b/dependency_manager_cxx/include/celix/dm/DmActivator.h
@@ -24,19 +24,21 @@
 #include <utility>
 
 #include "celix/dm/DependencyManager.h"
+#include "bundle_activator.h"
 
 namespace celix { namespace dm {
 
     class DmActivator {
     public:
-        DmActivator(DependencyManager& m);
-        virtual ~DmActivator();
+        DmActivator(DependencyManager& m) : ctx{m.bundleContext()}, mng{m}  {}
+        virtual ~DmActivator() = default;
 
         DmActivator(const DmActivator&) = delete;
         DmActivator& operator=(const DmActivator&) = delete;
 
-        DependencyManager& manager() const;
-        bundle_context_pt context() const;
+        DependencyManager& manager() const { return this->mng; }
+
+        bundle_context_pt context() const { return this->ctx; }
 
         /**
          * The init of the DM Activator. Should be overridden by the bundle specific DM activator.
@@ -65,22 +67,45 @@ namespace celix { namespace dm {
     protected:
         bundle_context_pt ctx;
         DependencyManager& mng;
+    private:
+        dm_info_service_t info{};
+        service_registration_pt reg{nullptr};
+
+        int start() {
+            celix_status_t status = CELIX_SUCCESS;
+            this->init();
+            this->mng.start();
+
+            //Create and register the dm info service
+            this->info.handle = this->mng.cDependencyManager();
+            this->info.getInfo = (celix_status_t (*)(void *, dm_dependency_manager_info_pt *)) dependencyManager_getInfo;
+            this->info.destroyInfo = (void (*)(void *, dm_dependency_manager_info_pt)) dependencyManager_destroyInfo;
+            status = bundleContext_registerService(this->ctx, (char *) DM_INFO_SERVICE_NAME, &this->info, NULL, &(this->reg));
+
+            return status;
+        }
+
+        int stop() {
+            celix_status_t status = CELIX_SUCCESS;
+
+            this->deinit();
+
+            // Remove the service
+            if (this->reg != nullptr) {
+                status = serviceRegistration_unregister(this->reg);
+                this->reg = nullptr;
+            }
+            // Remove all components
+            dependencyManager_removeAllComponents(this->mng.cDependencyManager());
+
+            return status;
+        }
+
+        friend celix_status_t ::bundleActivator_create(bundle_context_pt, void**);
+        friend celix_status_t ::bundleActivator_start(void*, bundle_context_pt);
+        friend celix_status_t ::bundleActivator_stop(void*, bundle_context_pt);
+        friend celix_status_t ::bundleActivator_destroy(void*, bundle_context_pt);
     };
-
 }}
 
-#ifndef CELIX_CREATE_BUNDLE_ACTIVATOR_SYMBOLS
-#define CELIX_CREATE_BUNDLE_ACTIVATOR_SYMBOLS 1
-#endif
-
-#if CELIX_CREATE_BUNDLE_ACTIVATOR_SYMBOLS == 1
-extern "C" celix_status_t bundleActivator_create(bundle_context_pt context, void **userData);
-extern "C" celix_status_t bundleActivator_start(void *userData, bundle_context_pt context);
-extern "C" celix_status_t bundleActivator_stop(void *userData, bundle_context_pt context);
-extern "C" celix_status_t bundleActivator_destroy(void *userData, bundle_context_pt context);
-#endif
-
-
-#include "celix/dm/DmActivator_Impl.h"
-
 #endif //CELIX_DM_ACTIVATOR_H

http://git-wip-us.apache.org/repos/asf/celix/blob/0aa1f0be/dependency_manager_cxx/include/celix/dm/DmActivator_Impl.h
----------------------------------------------------------------------
diff --git a/dependency_manager_cxx/include/celix/dm/DmActivator_Impl.h b/dependency_manager_cxx/include/celix/dm/DmActivator_Impl.h
deleted file mode 100644
index d3176f9..0000000
--- a/dependency_manager_cxx/include/celix/dm/DmActivator_Impl.h
+++ /dev/null
@@ -1,130 +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.
- */
-
-using namespace celix::dm;
-
-DmActivator::DmActivator(DependencyManager& m) : ctx{m.bundleContext()}, mng(m) {}
-
-DmActivator::~DmActivator() = default;
-
-DependencyManager& DmActivator::manager() const {
-    return this->mng;
-}
-
-bundle_context_pt DmActivator::context() const {
-    return this->ctx;
-}
-
-namespace celix { namespace dm { namespace /*anon*/ {
-    class DmActivatorImpl {
-    private:
-        DependencyManager mng;
-        bundle_context_pt ctx;
-        DmActivator *act;
-        service_registration_pt reg{nullptr};
-        dm_info_service_t info{nullptr, nullptr, nullptr};
-
-    public:
-        DmActivatorImpl(bundle_context_pt c) : mng{c}, ctx{c}, act{DmActivator::create(mng)} { }
-        ~DmActivatorImpl() { delete act; }
-
-        DmActivatorImpl(DmActivatorImpl&&) = delete;
-        DmActivatorImpl& operator=(DmActivatorImpl&&) = delete;
-
-        DmActivatorImpl(const DmActivatorImpl&) = delete;
-        DmActivator& operator=(const DmActivatorImpl&) = delete;
-
-        celix_status_t start() {
-            celix_status_t status = CELIX_SUCCESS;
-
-            this->act->init();
-            this->mng.start();
-
-            //Create and register the dm info service
-            this->info.handle = this->mng.cDependencyManager();
-            this->info.getInfo = (celix_status_t (*)(void *,
-                                                     dm_dependency_manager_info_pt *)) dependencyManager_getInfo;
-            this->info.destroyInfo = (void (*)(void *, dm_dependency_manager_info_pt)) dependencyManager_destroyInfo;
-            status = bundleContext_registerService(this->ctx, (char *) DM_INFO_SERVICE_NAME, &this->info, NULL,
-                                                   &(this->reg));
-
-            return status;
-        }
-
-        celix_status_t stop() {
-            celix_status_t status = CELIX_SUCCESS;
-
-            // Remove the service
-            if (this->reg != nullptr) {
-                status = serviceRegistration_unregister(this->reg);
-                this->reg = nullptr;
-            }
-            // Remove all components
-            dependencyManager_removeAllComponents(this->mng.cDependencyManager());
-
-            return status;
-        }
-    };
-}}}
-
-
-celix_status_t bundleActivator_create(bundle_context_pt context, void **userData) {
-    int status = CELIX_SUCCESS;
-    DmActivatorImpl* impl = nullptr;
-#ifdef __EXCEPTIONS
-    impl = new DmActivatorImpl(context);
-#else
-    impl = new(std::nothrow) DmActivatorImpl(context);
-#endif
-
-    if (impl == nullptr) {
-        status = CELIX_ENOMEM;
-    } else {
-        *userData = impl;
-    }
-    return status;
-}
-
-#if CELIX_CREATE_BUNDLE_ACTIVATOR_SYMBOLS == 1
-celix_status_t  bundleActivator_start(void *userData, bundle_context_pt context __attribute__((unused))) {
-    int status = CELIX_SUCCESS;
-    DmActivatorImpl* impl = static_cast<DmActivatorImpl*>(userData);
-    if (impl != nullptr) {
-        status = impl->start();
-    }
-    return status;
-}
-
-celix_status_t bundleActivator_stop(void *userData, bundle_context_pt context __attribute__((unused))) {
-    int status = CELIX_SUCCESS;
-    DmActivatorImpl* impl = static_cast<DmActivatorImpl*>(userData);
-    if (impl != nullptr) {
-        status = impl->stop();
-    }
-    return status;
-}
-
-celix_status_t bundleActivator_destroy(void *userData, bundle_context_pt context __attribute__((unused))) {
-    DmActivatorImpl* impl = static_cast<DmActivatorImpl*>(userData);
-    if (impl != nullptr) {
-        delete impl;
-    }
-    return CELIX_SUCCESS;
-}
-#endif
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/celix/blob/0aa1f0be/dependency_manager_cxx/include/celix/dm/ServiceDependency.h
----------------------------------------------------------------------
diff --git a/dependency_manager_cxx/include/celix/dm/ServiceDependency.h b/dependency_manager_cxx/include/celix/dm/ServiceDependency.h
index eaa2ce7..f439b82 100644
--- a/dependency_manager_cxx/include/celix/dm/ServiceDependency.h
+++ b/dependency_manager_cxx/include/celix/dm/ServiceDependency.h
@@ -45,9 +45,27 @@ namespace celix { namespace dm {
         const bool valid;
         dm_service_dependency_pt cServiceDep {nullptr};
 
-        void setDepStrategy(DependencyUpdateStrategy strategy);
+        void setDepStrategy(DependencyUpdateStrategy strategy) {
+            if (!valid) {
+                return;
+            }
+            if (strategy == DependencyUpdateStrategy::locking) {
+                serviceDependency_setStrategy(this->cServiceDependency(), DM_SERVICE_DEPENDENCY_STRATEGY_LOCKING);
+            } else if (strategy == DependencyUpdateStrategy::suspend) {
+                serviceDependency_setStrategy(this->cServiceDependency(), DM_SERVICE_DEPENDENCY_STRATEGY_SUSPEND);
+            } else {
+                std::cerr << "Unexpected dependency update strategy. Cannot convert for dm_depdendency\n";
+            }
+        }
     public:
-        BaseServiceDependency(bool valid);
+        BaseServiceDependency(bool v)  : valid{v} {
+            if (this->valid) {
+                serviceDependency_create(&this->cServiceDep);
+                //NOTE using suspend as default strategy
+                serviceDependency_setStrategy(this->cServiceDep,  DM_SERVICE_DEPENDENCY_STRATEGY_SUSPEND);
+            }
+        }
+
         virtual ~BaseServiceDependency() = default;
 
         BaseServiceDependency(const BaseServiceDependency&) = delete;

http://git-wip-us.apache.org/repos/asf/celix/blob/0aa1f0be/dependency_manager_cxx/include/celix/dm/ServiceDependency_Impl.h
----------------------------------------------------------------------
diff --git a/dependency_manager_cxx/include/celix/dm/ServiceDependency_Impl.h b/dependency_manager_cxx/include/celix/dm/ServiceDependency_Impl.h
index b7511d3..05cbef2 100644
--- a/dependency_manager_cxx/include/celix/dm/ServiceDependency_Impl.h
+++ b/dependency_manager_cxx/include/celix/dm/ServiceDependency_Impl.h
@@ -23,27 +23,6 @@
 
 using namespace celix::dm;
 
-BaseServiceDependency::BaseServiceDependency(bool v) : valid{v} {
-    if (this->valid) {
-        serviceDependency_create(&this->cServiceDep);
-        //NOTE using suspend as default strategy
-        serviceDependency_setStrategy(this->cServiceDep,  DM_SERVICE_DEPENDENCY_STRATEGY_SUSPEND);
-    }
-}
-
-void BaseServiceDependency::setDepStrategy(DependencyUpdateStrategy strategy) {
-    if (!valid) {
-        return;
-    }
-    if (strategy == DependencyUpdateStrategy::locking) {
-        serviceDependency_setStrategy(this->cServiceDependency(), DM_SERVICE_DEPENDENCY_STRATEGY_LOCKING);
-    } else if (strategy == DependencyUpdateStrategy::suspend) {
-        serviceDependency_setStrategy(this->cServiceDependency(), DM_SERVICE_DEPENDENCY_STRATEGY_SUSPEND);
-    } else {
-        std::cerr << "Unexpected dependency update strategy. Cannot convert for dm_depdendency\n";
-    }
-}
-
 template<class T, typename I>
 CServiceDependency<T,I>::CServiceDependency(const std::string name, bool valid) : TypedServiceDependency<T>(valid) {
     this->name = name;

http://git-wip-us.apache.org/repos/asf/celix/blob/0aa1f0be/dependency_manager_cxx/src/dm_activator.cc
----------------------------------------------------------------------
diff --git a/dependency_manager_cxx/src/dm_activator.cc b/dependency_manager_cxx/src/dm_activator.cc
new file mode 100644
index 0000000..b2a0d8e
--- /dev/null
+++ b/dependency_manager_cxx/src/dm_activator.cc
@@ -0,0 +1,88 @@
+/**
+ * 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 <utility>
+#include "celix/dm/DependencyManager.h"
+#include "celix/dm/DmActivator.h"
+#include "bundle_activator.h"
+
+struct BundleActivatorData {
+    DependencyManager mng;
+    DmActivator* act;
+};
+
+extern "C" celix_status_t bundleActivator_create(bundle_context_pt context, void** userData) {
+    int status = CELIX_SUCCESS;
+
+    BundleActivatorData* data = nullptr;
+#ifdef __EXCEPTIONS
+    data = new BundleActivatorData{
+        .mng = celix::dm::DependencyManager{context},
+        .act = nullptr
+    };
+#else
+    data = new(std::nothrow) BundleActivatorData{
+            .mng = celix::dm::DependencyManager{context},
+            .act = nullptr
+    };
+#endif
+    if (data != nullptr) {
+        data->act = celix::dm::DmActivator::create(data->mng);
+    }
+
+    if (data == nullptr || data->act == nullptr) {
+        status = CELIX_ENOMEM;
+        if (data != nullptr) {
+            delete data->act;
+        }
+        delete data;
+        *userData = nullptr;
+    } else {
+        *userData = data;
+    }
+    return status;
+}
+
+extern "C" celix_status_t bundleActivator_start(void* userData, [[gnu::unused]] bundle_context_pt context) {
+    int status = CELIX_SUCCESS;
+    BundleActivatorData* data = static_cast<BundleActivatorData*>(userData);
+    if (data != nullptr) {
+        status = data->act->start();
+    }
+    return status;
+}
+
+extern "C" celix_status_t bundleActivator_stop(void* userData, [[gnu::unused]] bundle_context_pt context) {
+    int status = CELIX_SUCCESS;
+    BundleActivatorData* data = static_cast<BundleActivatorData*>(userData);
+    if (data != nullptr) {
+        status = data->act->stop();
+    }
+    return status;
+}
+
+extern "C" celix_status_t bundleActivator_destroy([[gnu::unused]] void* userData,[[gnu::unused]]     bundle_context_pt context ) {
+    int status = CELIX_SUCCESS;
+    BundleActivatorData* data = static_cast<BundleActivatorData*>(userData);
+    if (data != nullptr) {
+        delete data->act;
+    }
+    delete data;
+    return status;
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/celix/blob/0aa1f0be/examples/dm_example_cxx/phase1/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/examples/dm_example_cxx/phase1/CMakeLists.txt b/examples/dm_example_cxx/phase1/CMakeLists.txt
index 845f2ed..3c0544a 100644
--- a/examples/dm_example_cxx/phase1/CMakeLists.txt
+++ b/examples/dm_example_cxx/phase1/CMakeLists.txt
@@ -31,12 +31,12 @@ add_bundle(phase1_cxx
 target_compile_options(phase1_cxx PUBLIC -Wall -Wextra -Weffc++ -Werror)
 
 IF(APPLE)
-    target_link_libraries(phase1_cxx celix_framework -Wl,-all_load dependency_manager_static)
+    target_link_libraries(phase1_cxx celix_framework -Wl,-all_load dependency_manager_cxx_static)
 else()
     if(ENABLE_ADDRESS_SANITIZER)
         #With asan there can be undefined symbols
-        target_link_libraries(phase1_cxx -Wl,--whole-archive dependency_manager_static -Wl,--no-whole-archive celix_framework)
+        target_link_libraries(phase1_cxx -Wl,--whole-archive dependency_manager_cxx_static -Wl,--no-whole-archive celix_framework)
     else()
-        target_link_libraries(phase1_cxx -Wl,--no-undefined -Wl,--whole-archive dependency_manager_static -Wl,--no-whole-archive celix_framework)
+        target_link_libraries(phase1_cxx -Wl,--no-undefined -Wl,--whole-archive dependency_manager_cxx_static -Wl,--no-whole-archive celix_framework)
     endif()
 endif()

http://git-wip-us.apache.org/repos/asf/celix/blob/0aa1f0be/examples/dm_example_cxx/phase2a/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/examples/dm_example_cxx/phase2a/CMakeLists.txt b/examples/dm_example_cxx/phase2a/CMakeLists.txt
index 3b6b49c..8528078 100644
--- a/examples/dm_example_cxx/phase2a/CMakeLists.txt
+++ b/examples/dm_example_cxx/phase2a/CMakeLists.txt
@@ -31,12 +31,12 @@ add_bundle(phase2a_cxx
 target_compile_options(phase2a_cxx PUBLIC -Wall -Wextra -Weffc++ -Werror)
 
 IF(APPLE)
-    target_link_libraries(phase2a_cxx celix_framework -Wl,-all_load dependency_manager_static)
+    target_link_libraries(phase2a_cxx celix_framework -Wl,-all_load dependency_manager_cxx_static)
 else()
     if(ENABLE_ADDRESS_SANITIZER)
         #With asan there can be undefined symbols
-        target_link_libraries(phase2a_cxx -Wl,--whole-archive dependency_manager_static -Wl,--no-whole-archive celix_framework)
+        target_link_libraries(phase2a_cxx -Wl,--whole-archive dependency_manager_cxx_static -Wl,--no-whole-archive celix_framework)
     else()
-        target_link_libraries(phase2a_cxx -Wl,--no-undefined -Wl,--whole-archive dependency_manager_static -Wl,--no-whole-archive celix_framework)
+        target_link_libraries(phase2a_cxx -Wl,--no-undefined -Wl,--whole-archive dependency_manager_cxx_static -Wl,--no-whole-archive celix_framework)
     endif()
 endif()

http://git-wip-us.apache.org/repos/asf/celix/blob/0aa1f0be/examples/dm_example_cxx/phase2b/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/examples/dm_example_cxx/phase2b/CMakeLists.txt b/examples/dm_example_cxx/phase2b/CMakeLists.txt
index acaeb65..29ff664 100644
--- a/examples/dm_example_cxx/phase2b/CMakeLists.txt
+++ b/examples/dm_example_cxx/phase2b/CMakeLists.txt
@@ -32,12 +32,12 @@ add_bundle(phase2b_cxx
 target_compile_options(phase2b_cxx PUBLIC -Wall -Wextra -Weffc++ -Werror)
 
 IF(APPLE)
-    target_link_libraries(phase2b_cxx celix_framework -Wl,-all_load dependency_manager_static)
+    target_link_libraries(phase2b_cxx celix_framework -Wl,-all_load dependency_manager_cxx_static)
 else()
     if(ENABLE_ADDRESS_SANITIZER)
         #With asan there can be undefined symbols
-        target_link_libraries(phase2b_cxx -Wl,--whole-archive dependency_manager_static -Wl,--no-whole-archive celix_framework)
+        target_link_libraries(phase2b_cxx -Wl,--whole-archive dependency_manager_cxx_static -Wl,--no-whole-archive celix_framework)
     else()
-        target_link_libraries(phase2b_cxx -Wl,--no-undefined -Wl,--whole-archive dependency_manager_static -Wl,--no-whole-archive celix_framework)
+        target_link_libraries(phase2b_cxx -Wl,--no-undefined -Wl,--whole-archive dependency_manager_cxx_static -Wl,--no-whole-archive celix_framework)
     endif()
 endif()

http://git-wip-us.apache.org/repos/asf/celix/blob/0aa1f0be/examples/dm_example_cxx/phase3/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/examples/dm_example_cxx/phase3/CMakeLists.txt b/examples/dm_example_cxx/phase3/CMakeLists.txt
index a9e0273..99c3a5b 100644
--- a/examples/dm_example_cxx/phase3/CMakeLists.txt
+++ b/examples/dm_example_cxx/phase3/CMakeLists.txt
@@ -25,18 +25,19 @@ add_bundle(phase3_cxx
     VERSION 0.0.1
     SOURCES
         src/Phase3Activator.cc
+        src/Phase3BaseActivator.cc
         src/Phase3Cmp.cc
 )
 
 target_compile_options(phase3_cxx PUBLIC -Wall -Wextra -Weffc++ -Werror)
 
 IF(APPLE)
-    target_link_libraries(phase3_cxx celix_framework -Wl,-all_load dependency_manager_static)
+    target_link_libraries(phase3_cxx celix_framework -Wl,-all_load dependency_manager_cxx_static)
 else()
     if(ENABLE_ADDRESS_SANITIZER)
         #With asan there can be undefined symbols
-        target_link_libraries(phase3_cxx -Wl,--whole-archive dependency_manager_static -Wl,--no-whole-archive celix_framework)
+        target_link_libraries(phase3_cxx -Wl,--whole-archive dependency_manager_cxx_static -Wl,--no-whole-archive celix_framework)
     else()
-        target_link_libraries(phase3_cxx -Wl,--no-undefined -Wl,--whole-archive dependency_manager_static -Wl,--no-whole-archive celix_framework)
+        target_link_libraries(phase3_cxx -Wl,--no-undefined -Wl,--whole-archive dependency_manager_cxx_static -Wl,--no-whole-archive celix_framework)
     endif()
 endif()

http://git-wip-us.apache.org/repos/asf/celix/blob/0aa1f0be/examples/dm_example_cxx/phase3/include/Phase3Activator.h
----------------------------------------------------------------------
diff --git a/examples/dm_example_cxx/phase3/include/Phase3Activator.h b/examples/dm_example_cxx/phase3/include/Phase3Activator.h
index fc66c28..e02cd61 100644
--- a/examples/dm_example_cxx/phase3/include/Phase3Activator.h
+++ b/examples/dm_example_cxx/phase3/include/Phase3Activator.h
@@ -20,13 +20,13 @@
 #ifndef CELIX_PHASE3ACTIVATOR_H
 #define CELIX_PHASE3ACTIVATOR_H
 
-#include "celix/dm/DmActivator.h"
+#include "Phase3BaseActivator.h"
 
 using namespace celix::dm;
 
-class Phase3Activator : public DmActivator {
+class Phase3Activator : public Phase3BaseActivator {
 public:
-    Phase3Activator(DependencyManager& mng) : DmActivator(mng) {}
+    Phase3Activator(DependencyManager& mng) : Phase3BaseActivator(mng) {}
     virtual void init();
 };
 

http://git-wip-us.apache.org/repos/asf/celix/blob/0aa1f0be/examples/dm_example_cxx/phase3/include/Phase3BaseActivator.h
----------------------------------------------------------------------
diff --git a/examples/dm_example_cxx/phase3/include/Phase3BaseActivator.h b/examples/dm_example_cxx/phase3/include/Phase3BaseActivator.h
new file mode 100644
index 0000000..3a3b1b8
--- /dev/null
+++ b/examples/dm_example_cxx/phase3/include/Phase3BaseActivator.h
@@ -0,0 +1,35 @@
+/**
+ * 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.
+ */
+
+#ifndef CELIX_PHASE3BASEACTIVATOR_H
+#define CELIX_PHASE3BASEACTIVATOR_H
+
+#include "celix/dm/DmActivator.h"
+
+using namespace celix::dm;
+
+class Phase3BaseActivator : public DmActivator {
+public:
+    Phase3BaseActivator(DependencyManager& mng) : DmActivator(mng), cmp{mng.createComponent<Phase3Cmp>()} {}
+    void init();
+protected:
+    celix::dm::Component<Phase3Cmp>& cmp;
+};
+
+#endif //CELIX_PHASE3BASEACTIVATOR_H

http://git-wip-us.apache.org/repos/asf/celix/blob/0aa1f0be/examples/dm_example_cxx/phase3/src/Phase3Activator.cc
----------------------------------------------------------------------
diff --git a/examples/dm_example_cxx/phase3/src/Phase3Activator.cc b/examples/dm_example_cxx/phase3/src/Phase3Activator.cc
index 1bccbbc..f5aa178 100644
--- a/examples/dm_example_cxx/phase3/src/Phase3Activator.cc
+++ b/examples/dm_example_cxx/phase3/src/Phase3Activator.cc
@@ -29,13 +29,7 @@ DmActivator* DmActivator::create(DependencyManager& mng) {
 }
 
 void Phase3Activator::init() {
-    Component<Phase3Cmp>& cmp = mng.createComponent<Phase3Cmp>() //NOTE no setInstance -> lazy initialization using the default constructor
-            .setCallbacks(nullptr, &Phase3Cmp::start, &Phase3Cmp::stop, nullptr);
-
-    cmp.createServiceDependency<IPhase2>()
-            .setRequired(true)
-            .setCallbacks(&Phase3Cmp::addPhase2, &Phase3Cmp::removePhase2);
-
+    Phase3BaseActivator::init();
     cmp.createServiceDependency<IPhase2>()
              .setRequired(false)
              .setFilter("(&(name=phase2a)(non-existing=*))")

http://git-wip-us.apache.org/repos/asf/celix/blob/0aa1f0be/examples/dm_example_cxx/phase3/src/Phase3BaseActivator.cc
----------------------------------------------------------------------
diff --git a/examples/dm_example_cxx/phase3/src/Phase3BaseActivator.cc b/examples/dm_example_cxx/phase3/src/Phase3BaseActivator.cc
new file mode 100644
index 0000000..37746dc
--- /dev/null
+++ b/examples/dm_example_cxx/phase3/src/Phase3BaseActivator.cc
@@ -0,0 +1,31 @@
+/**
+ * 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 "Phase3Cmp.h"
+#include "Phase3BaseActivator.h"
+
+using namespace celix::dm;
+
+void Phase3BaseActivator::init() {
+    cmp.setCallbacks(nullptr, &Phase3Cmp::start, &Phase3Cmp::stop, nullptr);
+
+    cmp.createServiceDependency<IPhase2>()
+            .setRequired(true)
+            .setCallbacks(&Phase3Cmp::addPhase2, &Phase3Cmp::removePhase2);
+}

http://git-wip-us.apache.org/repos/asf/celix/blob/0aa1f0be/examples/dm_example_cxx/phase3_locking/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/examples/dm_example_cxx/phase3_locking/CMakeLists.txt b/examples/dm_example_cxx/phase3_locking/CMakeLists.txt
index f5a5445..07c9b54 100644
--- a/examples/dm_example_cxx/phase3_locking/CMakeLists.txt
+++ b/examples/dm_example_cxx/phase3_locking/CMakeLists.txt
@@ -31,12 +31,12 @@ add_bundle(phase3_locking_cxx
 target_compile_options(phase3_locking_cxx PUBLIC -Wall -Wextra -Weffc++ -Werror)
 
 IF(APPLE)
-    target_link_libraries(phase3_locking_cxx celix_framework -Wl,-all_load dependency_manager_static)
+    target_link_libraries(phase3_locking_cxx celix_framework -Wl,-all_load dependency_manager_cxx_static)
 else()
     if(ENABLE_ADDRESS_SANITIZER)
         #With asan there can be undefined symbols
-        target_link_libraries(phase3_locking_cxx -Wl,--whole-archive dependency_manager_static -Wl,--no-whole-archive celix_framework)
+        target_link_libraries(phase3_locking_cxx -Wl,--whole-archive dependency_manager_cxx_static -Wl,--no-whole-archive celix_framework)
     else()
-        target_link_libraries(phase3_locking_cxx -Wl,--no-undefined -Wl,--whole-archive dependency_manager_static -Wl,--no-whole-archive celix_framework)
+        target_link_libraries(phase3_locking_cxx -Wl,--no-undefined -Wl,--whole-archive dependency_manager_cxx_static -Wl,--no-whole-archive celix_framework)
     endif()
 endif()

http://git-wip-us.apache.org/repos/asf/celix/blob/0aa1f0be/examples/services_example_cxx/bar/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/examples/services_example_cxx/bar/CMakeLists.txt b/examples/services_example_cxx/bar/CMakeLists.txt
index 05c4d15..b3cdb07 100644
--- a/examples/services_example_cxx/bar/CMakeLists.txt
+++ b/examples/services_example_cxx/bar/CMakeLists.txt
@@ -30,12 +30,12 @@ add_bundle(bar_cxx
 target_compile_options(bar_cxx PUBLIC -Wall -Wextra -Weffc++ -Werror)
 
 IF(APPLE)
-    target_link_libraries(bar_cxx celix_framework -Wl,-all_load dependency_manager_static)
+    target_link_libraries(bar_cxx celix_framework -Wl,-all_load  dependency_manager_cxx_static)
 else()
     if(ENABLE_ADDRESS_SANITIZER)
         #With asan there can be undefined symbols
-        target_link_libraries(bar_cxx -Wl,--whole-archive dependency_manager_static -Wl,--no-whole-archive celix_framework)
+        target_link_libraries(bar_cxx -Wl,--whole-archive  dependency_manager_cxx_static -Wl,--no-whole-archive celix_framework)
     else()
-        target_link_libraries(bar_cxx -Wl,--no-undefined -Wl,--whole-archive dependency_manager_static -Wl,--no-whole-archive celix_framework)
+        target_link_libraries(bar_cxx -Wl,--no-undefined -Wl,--whole-archive  dependency_manager_cxx_static -Wl,--no-whole-archive celix_framework)
     endif()
 endif()
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/celix/blob/0aa1f0be/examples/services_example_cxx/baz/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/examples/services_example_cxx/baz/CMakeLists.txt b/examples/services_example_cxx/baz/CMakeLists.txt
index eda3830..205c716 100644
--- a/examples/services_example_cxx/baz/CMakeLists.txt
+++ b/examples/services_example_cxx/baz/CMakeLists.txt
@@ -30,12 +30,12 @@ add_bundle(baz_cxx
 target_compile_options(baz_cxx PUBLIC -Wall -Wextra -Weffc++ -Werror)
 
 IF(APPLE)
-    target_link_libraries(baz_cxx celix_framework -Wl,-all_load dependency_manager_static)
+    target_link_libraries(baz_cxx celix_framework -Wl,-all_load  dependency_manager_cxx_static)
 else()
     if(ENABLE_ADDRESS_SANITIZER)
         #With asan there can be undefined symbols
-        target_link_libraries(baz_cxx -Wl,--whole-archive dependency_manager_static -Wl,--no-whole-archive celix_framework)
+        target_link_libraries(baz_cxx -Wl,--whole-archive  dependency_manager_cxx_static -Wl,--no-whole-archive celix_framework)
     else()
-        target_link_libraries(baz_cxx -Wl,--no-undefined -Wl,--whole-archive dependency_manager_static -Wl,--no-whole-archive celix_framework)
+        target_link_libraries(baz_cxx -Wl,--no-undefined -Wl,--whole-archive  dependency_manager_cxx_static -Wl,--no-whole-archive celix_framework)
     endif()
 endif()

http://git-wip-us.apache.org/repos/asf/celix/blob/0aa1f0be/examples/services_example_cxx/foo/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/examples/services_example_cxx/foo/CMakeLists.txt b/examples/services_example_cxx/foo/CMakeLists.txt
index 6c20b3f..e01af00 100644
--- a/examples/services_example_cxx/foo/CMakeLists.txt
+++ b/examples/services_example_cxx/foo/CMakeLists.txt
@@ -30,12 +30,12 @@ add_bundle(foo_cxx
 target_compile_options(foo_cxx PUBLIC -Wall -Wextra -Weffc++ -Werror)
 
 IF(APPLE)
-    target_link_libraries(foo_cxx celix_framework -Wl,-all_load dependency_manager_static)
+    target_link_libraries(foo_cxx celix_framework -Wl,-all_load  dependency_manager_cxx_static)
 else()
     if(ENABLE_ADDRESS_SANITIZER)
         #With asan there can be undefined symbols
-        target_link_libraries(foo_cxx -Wl,--whole-archive dependency_manager_static -Wl,--no-whole-archive celix_framework)
+        target_link_libraries(foo_cxx -Wl,--whole-archive  dependency_manager_cxx_static -Wl,--no-whole-archive celix_framework)
     else()
-        target_link_libraries(foo_cxx -Wl,--no-undefined -Wl,--whole-archive dependency_manager_static -Wl,--no-whole-archive celix_framework)
+        target_link_libraries(foo_cxx -Wl,--no-undefined -Wl,--whole-archive  dependency_manager_cxx_static -Wl,--no-whole-archive celix_framework)
     endif()
 endif()


Mime
View raw message