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-426: Updates C++ DepMan examples to use the udpated C++ api (i.e. no linking to static dep man lib is needed anymore).
Date Tue, 08 May 2018 10:36:19 GMT
Repository: celix
Updated Branches:
  refs/heads/feature/CELIX-426-cxx-api ed32d9f05 -> 88a8baf1a


CELIX-426: Updates C++ DepMan examples to use the udpated C++ api (i.e. no linking to static
dep man lib is needed anymore).


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

Branch: refs/heads/feature/CELIX-426-cxx-api
Commit: 88a8baf1a60418b3442f217cefe053b912cc3ff8
Parents: ed32d9f
Author: Pepijn Noltes <pepijnnoltes@gmail.com>
Authored: Tue May 8 12:35:09 2018 +0200
Committer: Pepijn Noltes <pepijnnoltes@gmail.com>
Committed: Tue May 8 12:35:09 2018 +0200

----------------------------------------------------------------------
 .../dm_example_cxx/phase1/CMakeLists.txt        | 13 +----
 .../phase1/src/Phase1Activator.cc               | 42 +++++++--------
 .../dm_example_cxx/phase1/src/Phase1Activator.h | 11 ++--
 .../dm_example_cxx/phase2/CMakeLists.txt        | 15 ------
 .../dm_example_cxx/phase2/src/Phase2Activator.h |  9 ++--
 .../phase2/src/Phase2aActivator.cc              | 14 ++---
 .../phase2/src/Phase2bActivator.cc              | 14 ++---
 .../dm_example_cxx/phase3/CMakeLists.txt        | 11 ----
 .../phase3/src/Phase3Activator.cc               | 11 ++--
 .../dm_example_cxx/phase3/src/Phase3Activator.h |  6 +--
 .../phase3/src/Phase3BaseActivator.cc           |  6 +--
 .../phase3/src/Phase3BaseActivator.h            | 11 ++--
 .../phase3_locking/CMakeLists.txt               | 10 ----
 .../src/Phase3LockingActivator.cc               | 14 +++--
 .../phase3_locking/src/Phase3LockingActivator.h | 10 ++--
 framework/include/celix/Bundle.h                |  8 +--
 framework/include/celix/BundleActivator.h       | 55 ++++++++++++++++----
 framework/include/celix/BundleContext.h         | 14 +++--
 framework/include/celix/Celix.h                 |  1 +
 framework/include/celix/Framework.h             |  7 +--
 framework/include/celix/IBundleActivator.h      | 34 ++++++++++++
 framework/include/celix/dm/Component.h          |  6 +--
 framework/include/celix/dm/DependencyManager.h  |  6 +--
 framework/include/celix/dm/DmActivator.h        |  6 +--
 framework/include/celix/dm/Properties.h         |  6 +--
 framework/include/celix/dm/ServiceDependency.h  |  6 +--
 framework/include/celix/dm/types.h              |  6 +--
 .../include/celix/impl/BundleActivatorImpl.h    | 55 --------------------
 .../include/celix/impl/BundleContextImpl.h      | 32 +++++++-----
 framework/include/celix/impl/BundleImpl.h       | 14 ++---
 framework/include/celix/impl/FrameworkImpl.h    | 12 ++++-
 utils/CMakeLists.txt                            |  4 +-
 32 files changed, 223 insertions(+), 246 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/celix/blob/88a8baf1/examples/celix-examples/dm_example_cxx/phase1/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/examples/celix-examples/dm_example_cxx/phase1/CMakeLists.txt b/examples/celix-examples/dm_example_cxx/phase1/CMakeLists.txt
index 5007e77..7cf362f 100644
--- a/examples/celix-examples/dm_example_cxx/phase1/CMakeLists.txt
+++ b/examples/celix-examples/dm_example_cxx/phase1/CMakeLists.txt
@@ -23,15 +23,4 @@ add_celix_bundle(dm_example_cxx_phase1
         src/Phase1Cmp.cc
 )
 target_include_directories(dm_example_cxx_phase1 PRIVATE src)
-target_link_libraries(dm_example_cxx_phase1 PRIVATE dm_example_cxx_api Celix::shell_api)
-
-IF(APPLE)
-    target_link_libraries(dm_example_cxx_phase1 PRIVATE  -Wl,-all_load Celix::dependency_manager_cxx_static)
-else()
-    if(ENABLE_ADDRESS_SANITIZER)
-        #With asan there can be undefined symbols
-        target_link_libraries(dm_example_cxx_phase1 PRIVATE -Wl,--whole-archive Celix::dependency_manager_cxx_static
-Wl,--no-whole-archive)
-    else()
-        target_link_libraries(dm_example_cxx_phase1 PRIVATE -Wl,--no-undefined -Wl,--whole-archive
Celix::dependency_manager_cxx_static -Wl,--no-whole-archive)
-    endif()
-endif()
+target_link_libraries(dm_example_cxx_phase1 PRIVATE dm_example_cxx_api Celix::shell_api)
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/celix/blob/88a8baf1/examples/celix-examples/dm_example_cxx/phase1/src/Phase1Activator.cc
----------------------------------------------------------------------
diff --git a/examples/celix-examples/dm_example_cxx/phase1/src/Phase1Activator.cc b/examples/celix-examples/dm_example_cxx/phase1/src/Phase1Activator.cc
index 4bee1df..1f11349 100644
--- a/examples/celix-examples/dm_example_cxx/phase1/src/Phase1Activator.cc
+++ b/examples/celix-examples/dm_example_cxx/phase1/src/Phase1Activator.cc
@@ -21,17 +21,13 @@
 #include "Phase1Activator.h"
 #include "IPhase2.h"
 
-using namespace celix::dm;
+#include "celix/BundleActivator.h"
 
 /* This example create a C++ component providing a C++ and C service
  * For the C service a service struct in initialized and registered
  * For the C++ service the object itself is used
  */
 
-DmActivator* DmActivator::create(DependencyManager& mng) {
-    return new Phase1Activator(mng);
-}
-
 struct InvalidCServ {
     virtual ~InvalidCServ() = default;
     void* handle {nullptr}; //valid pod
@@ -40,35 +36,39 @@ struct InvalidCServ {
     virtual void baz(double __attribute__((unused)) arg) {} //not a valid pod
 };
 
-void Phase1Activator::init() {
+celix::IBundleActivator* celix::createBundleActivator(celix::BundleContext &ctx) {
+    return new Phase1Activator{ctx};
+}
+
+Phase1Activator::Phase1Activator(celix::BundleContext& ctx) {
+    auto &mng = ctx.getDependencyManager();
     auto cmp = std::unique_ptr<Phase1Cmp>(new Phase1Cmp());
 
-    Properties cmdProps;
+    celix::Properties cmdProps;
     cmdProps[OSGI_SHELL_COMMAND_NAME] = "phase1_info";
     cmdProps[OSGI_SHELL_COMMAND_USAGE] = "phase1_info";
     cmdProps[OSGI_SHELL_COMMAND_DESCRIPTION] = "Print information about the Phase1Cmp";
 
 
-    cmd.handle = cmp.get();
-    cmd.executeCommand = [](void *handle, char* line, FILE* out, FILE *err) {
-        Phase1Cmp* cmp = (Phase1Cmp*)handle;
-        return cmp->infoCmd(line, out, err);
+    this->cmd.handle = cmp.get();
+    this->cmd.executeCommand = [](void *handle, char* line, FILE* out, FILE *err) {
+        Phase1Cmp* c = (Phase1Cmp*)handle;
+        return c->infoCmd(line, out, err);
     };
 
-    auto tst = std::unique_ptr<InvalidCServ>(new InvalidCServ{});
-    tst->handle = cmp.get();
+    //auto tst = std::unique_ptr<InvalidCServ>(new InvalidCServ{});
+    //tst->handle = cmp.get();
 
 
     mng.createComponent(std::move(cmp))  //using a pointer a instance. Also supported is
lazy initialization (default constructor needed) or a rvalue reference (move)
-        .addInterface<IPhase1>(IPHASE1_VERSION)
-        //.addInterface<IPhase2>() -> Compile error (static assert), because Phase1Cmp
does not implement IPhase2
-        .addCInterface(&cmd, OSGI_SHELL_COMMAND_SERVICE_NAME, "", cmdProps)
-        //.addCInterface(tst.get(), "TEST_SRV") -> Compile error (static assert), because
InvalidCServ is not a pod
-        .addInterface<srv::info::IName>(INAME_VERSION)
-        .setCallbacks(&Phase1Cmp::init, &Phase1Cmp::start, &Phase1Cmp::stop,
&Phase1Cmp::deinit);
-
+                    .addInterface<IPhase1>(IPHASE1_VERSION)
+                     //.addInterface<IPhase2>() -> Compile error (static assert),
because Phase1Cmp does not implement IPhase2
+                    .addCInterface(&cmd, OSGI_SHELL_COMMAND_SERVICE_NAME, "", cmdProps)
+                    //.addCInterface(tst.get(), "TEST_SRV") -> Compile error (static assert),
because InvalidCServ is not a pod
+                    .addInterface<srv::info::IName>(INAME_VERSION)
+                    .setCallbacks(&Phase1Cmp::init, &Phase1Cmp::start, &Phase1Cmp::stop,
&Phase1Cmp::deinit);
 }
 
-void Phase1Activator::deinit() {
+Phase1Activator::~Phase1Activator() {
     //nothing to do
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/celix/blob/88a8baf1/examples/celix-examples/dm_example_cxx/phase1/src/Phase1Activator.h
----------------------------------------------------------------------
diff --git a/examples/celix-examples/dm_example_cxx/phase1/src/Phase1Activator.h b/examples/celix-examples/dm_example_cxx/phase1/src/Phase1Activator.h
index 37b25e3..240c3ec 100644
--- a/examples/celix-examples/dm_example_cxx/phase1/src/Phase1Activator.h
+++ b/examples/celix-examples/dm_example_cxx/phase1/src/Phase1Activator.h
@@ -20,17 +20,18 @@
 #ifndef CELIX_PHASE1ACTIVATOR_H
 #define CELIX_PHASE1ACTIVATOR_H
 
+#include <celix/IBundleActivator.h>
 #include "celix/dm/DmActivator.h"
 #include "command.h"
 
 using namespace celix::dm;
 
-class Phase1Activator : public DmActivator {
-    command_service_t cmd {nullptr, nullptr};
+class Phase1Activator : public celix::IBundleActivator {
 public:
-    Phase1Activator(DependencyManager& mng) : DmActivator(mng) {}
-    virtual void init();
-    virtual void deinit();
+    Phase1Activator(celix::BundleContext& _ctx);
+    virtual ~Phase1Activator();
+private:
+    command_service_t cmd {nullptr, nullptr};
 };
 
 #endif //CELIX_PHASE1ACTIVATOR_H

http://git-wip-us.apache.org/repos/asf/celix/blob/88a8baf1/examples/celix-examples/dm_example_cxx/phase2/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/examples/celix-examples/dm_example_cxx/phase2/CMakeLists.txt b/examples/celix-examples/dm_example_cxx/phase2/CMakeLists.txt
index f2b3813..345bd51 100644
--- a/examples/celix-examples/dm_example_cxx/phase2/CMakeLists.txt
+++ b/examples/celix-examples/dm_example_cxx/phase2/CMakeLists.txt
@@ -34,18 +34,3 @@ add_celix_bundle(dm_example_cxx_phase2b
         )
 target_include_directories(dm_example_cxx_phase2b PRIVATE src)
 target_link_libraries(dm_example_cxx_phase2b PRIVATE Celix::log_service_api dm_example_cxx_api)
-
-IF(APPLE)
-    target_link_libraries(dm_example_cxx_phase2a PRIVATE -Wl,-all_load Celix::dependency_manager_cxx_static)
-    target_link_libraries(dm_example_cxx_phase2b PRIVATE -Wl,-all_load Celix::dependency_manager_cxx_static)
-else()
-    if(ENABLE_ADDRESS_SANITIZER)
-        #With asan there can be undefined symbols
-        target_link_libraries(dm_example_cxx_phase2a PRIVATE -Wl,--whole-archive Celix::dependency_manager_cxx_static
-Wl,--no-whole-archive)
-        target_link_libraries(dm_example_cxx_phase2b PRIVATE -Wl,--whole-archive Celix::dependency_manager_cxx_static
-Wl,--no-whole-archive)
-    else()
-        target_link_libraries(dm_example_cxx_phase2a PRIVATE -Wl,--whole-archive Celix::dependency_manager_cxx_static
-Wl,--no-whole-archive)
-        target_link_libraries(dm_example_cxx_phase2b PRIVATE -Wl,--whole-archive Celix::dependency_manager_cxx_static
-Wl,--no-whole-archive)
-
-    endif()
-endif()

http://git-wip-us.apache.org/repos/asf/celix/blob/88a8baf1/examples/celix-examples/dm_example_cxx/phase2/src/Phase2Activator.h
----------------------------------------------------------------------
diff --git a/examples/celix-examples/dm_example_cxx/phase2/src/Phase2Activator.h b/examples/celix-examples/dm_example_cxx/phase2/src/Phase2Activator.h
index 069b2ae..38a5cd7 100644
--- a/examples/celix-examples/dm_example_cxx/phase2/src/Phase2Activator.h
+++ b/examples/celix-examples/dm_example_cxx/phase2/src/Phase2Activator.h
@@ -20,15 +20,14 @@
 #ifndef CELIX_PHASE2AACTIVATOR_H
 #define CELIX_PHASE2AACTIVATOR_H
 
-#include "celix/dm/DmActivator.h"
+#include "celix/IBundleActivator.h"
 
 using namespace celix::dm;
 
-class Phase2Activator : public DmActivator {
+class Phase2Activator : public celix::IBundleActivator {
 public:
-    Phase2Activator(DependencyManager& mng) : DmActivator(mng) {}
-    virtual void init();
-    virtual void deinit();
+    Phase2Activator(celix::BundleContext& ctx);
+    virtual ~Phase2Activator();
 };
 
 #endif //CELIX_PHASE2AACTIVATOR_H

http://git-wip-us.apache.org/repos/asf/celix/blob/88a8baf1/examples/celix-examples/dm_example_cxx/phase2/src/Phase2aActivator.cc
----------------------------------------------------------------------
diff --git a/examples/celix-examples/dm_example_cxx/phase2/src/Phase2aActivator.cc b/examples/celix-examples/dm_example_cxx/phase2/src/Phase2aActivator.cc
index e33ae0e..80d9bb4 100644
--- a/examples/celix-examples/dm_example_cxx/phase2/src/Phase2aActivator.cc
+++ b/examples/celix-examples/dm_example_cxx/phase2/src/Phase2aActivator.cc
@@ -22,15 +22,15 @@
 #include "Phase2Activator.h"
 #include "log_service.h"
 
-using namespace celix::dm;
+#include "celix/BundleActivator.h"
 
 
-DmActivator* DmActivator::create(DependencyManager& mng) {
-    return new Phase2Activator(mng);
+celix::IBundleActivator* celix::createBundleActivator(celix::BundleContext &ctx) {
+    return new Phase2Activator{ctx};
 }
 
-
-void Phase2Activator::init() {
+Phase2Activator::Phase2Activator(celix::BundleContext& ctx) {
+    auto &mng = ctx.getDependencyManager();
 
     Properties props {};
     props["name"] = "phase2a";
@@ -52,6 +52,6 @@ void Phase2Activator::init() {
             .setCallbacks(&Phase2Cmp::setLogService);
 }
 
-void Phase2Activator::deinit() {
-
+Phase2Activator::~Phase2Activator() {
+    //nothing
 }

http://git-wip-us.apache.org/repos/asf/celix/blob/88a8baf1/examples/celix-examples/dm_example_cxx/phase2/src/Phase2bActivator.cc
----------------------------------------------------------------------
diff --git a/examples/celix-examples/dm_example_cxx/phase2/src/Phase2bActivator.cc b/examples/celix-examples/dm_example_cxx/phase2/src/Phase2bActivator.cc
index 4fba8c0..49298c3 100644
--- a/examples/celix-examples/dm_example_cxx/phase2/src/Phase2bActivator.cc
+++ b/examples/celix-examples/dm_example_cxx/phase2/src/Phase2bActivator.cc
@@ -21,14 +21,14 @@
 #include "Phase2Activator.h"
 #include "log_service.h"
 
-using namespace celix::dm;
+#include "celix/BundleActivator.h"
 
-
-DmActivator* DmActivator::create(DependencyManager& mng) {
-    return new Phase2Activator(mng);
+celix::IBundleActivator* celix::createBundleActivator(celix::BundleContext &ctx) {
+    return new Phase2Activator{ctx};
 }
 
-void Phase2Activator::init() {
+Phase2Activator::Phase2Activator(celix::BundleContext& ctx) {
+    auto &mng = ctx.getDependencyManager();
 
     Properties props {};
     props["name"] = "phase2b";
@@ -45,6 +45,6 @@ void Phase2Activator::init() {
             .setCallbacks(&Phase2Cmp::setLogService);
 }
 
-void Phase2Activator::deinit() {
-
+Phase2Activator::~Phase2Activator() {
+    //nothing
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/celix/blob/88a8baf1/examples/celix-examples/dm_example_cxx/phase3/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/examples/celix-examples/dm_example_cxx/phase3/CMakeLists.txt b/examples/celix-examples/dm_example_cxx/phase3/CMakeLists.txt
index c583f25..60dd73b 100644
--- a/examples/celix-examples/dm_example_cxx/phase3/CMakeLists.txt
+++ b/examples/celix-examples/dm_example_cxx/phase3/CMakeLists.txt
@@ -25,14 +25,3 @@ add_celix_bundle(dm_example_cxx_phase3
 )
 target_include_directories(dm_example_cxx_phase3 PRIVATE src)
 target_link_libraries(dm_example_cxx_phase3 PRIVATE dm_example_cxx_api pthread)
-
-IF(APPLE)
-    target_link_libraries(dm_example_cxx_phase3 PRIVATE -Wl,-all_load Celix::dependency_manager_cxx_static)
-else()
-    if(ENABLE_ADDRESS_SANITIZER)
-        #With asan there can be undefined symbols
-        target_link_libraries(dm_example_cxx_phase3 PRIVATE  -Wl,--whole-archive Celix::dependency_manager_cxx_static
-Wl,--no-whole-archive)
-    else()
-        target_link_libraries(dm_example_cxx_phase3 PRIVATE  -Wl,--no-undefined -Wl,--whole-archive
Celix::dependency_manager_cxx_static -Wl,--no-whole-archive)
-    endif()
-endif()

http://git-wip-us.apache.org/repos/asf/celix/blob/88a8baf1/examples/celix-examples/dm_example_cxx/phase3/src/Phase3Activator.cc
----------------------------------------------------------------------
diff --git a/examples/celix-examples/dm_example_cxx/phase3/src/Phase3Activator.cc b/examples/celix-examples/dm_example_cxx/phase3/src/Phase3Activator.cc
index f5aa178..4cf88cc 100644
--- a/examples/celix-examples/dm_example_cxx/phase3/src/Phase3Activator.cc
+++ b/examples/celix-examples/dm_example_cxx/phase3/src/Phase3Activator.cc
@@ -21,17 +21,18 @@
 #include "Phase3Cmp.h"
 #include "Phase3Activator.h"
 
-using namespace celix::dm;
+#include "celix/BundleActivator.h"
 
 
-DmActivator* DmActivator::create(DependencyManager& mng) {
-    return new Phase3Activator(mng);
+celix::IBundleActivator* celix::createBundleActivator(celix::BundleContext &ctx) {
+    return new Phase3Activator{ctx};
 }
 
-void Phase3Activator::init() {
-    Phase3BaseActivator::init();
+Phase3Activator::Phase3Activator(celix::BundleContext& ctx) : Phase3BaseActivator{ctx.getDependencyManager()}
{
     cmp.createServiceDependency<IPhase2>()
              .setRequired(false)
              .setFilter("(&(name=phase2a)(non-existing=*))")
              .setCallbacks(&Phase3Cmp::setPhase2a);
 }
+
+Phase3Activator::~Phase3Activator(){}

http://git-wip-us.apache.org/repos/asf/celix/blob/88a8baf1/examples/celix-examples/dm_example_cxx/phase3/src/Phase3Activator.h
----------------------------------------------------------------------
diff --git a/examples/celix-examples/dm_example_cxx/phase3/src/Phase3Activator.h b/examples/celix-examples/dm_example_cxx/phase3/src/Phase3Activator.h
index e02cd61..e4f91c8 100644
--- a/examples/celix-examples/dm_example_cxx/phase3/src/Phase3Activator.h
+++ b/examples/celix-examples/dm_example_cxx/phase3/src/Phase3Activator.h
@@ -22,12 +22,10 @@
 
 #include "Phase3BaseActivator.h"
 
-using namespace celix::dm;
-
 class Phase3Activator : public Phase3BaseActivator {
 public:
-    Phase3Activator(DependencyManager& mng) : Phase3BaseActivator(mng) {}
-    virtual void init();
+    Phase3Activator(celix::BundleContext& ctx);
+    ~Phase3Activator();
 };
 
 #endif //CELIX_PHASE2AACTIVATOR_H

http://git-wip-us.apache.org/repos/asf/celix/blob/88a8baf1/examples/celix-examples/dm_example_cxx/phase3/src/Phase3BaseActivator.cc
----------------------------------------------------------------------
diff --git a/examples/celix-examples/dm_example_cxx/phase3/src/Phase3BaseActivator.cc b/examples/celix-examples/dm_example_cxx/phase3/src/Phase3BaseActivator.cc
index 37746dc..d7d16c5 100644
--- a/examples/celix-examples/dm_example_cxx/phase3/src/Phase3BaseActivator.cc
+++ b/examples/celix-examples/dm_example_cxx/phase3/src/Phase3BaseActivator.cc
@@ -20,12 +20,12 @@
 #include "Phase3Cmp.h"
 #include "Phase3BaseActivator.h"
 
-using namespace celix::dm;
-
-void Phase3BaseActivator::init() {
+Phase3BaseActivator::Phase3BaseActivator(celix::dm::DependencyManager& mng) : cmp(mng.createComponent<Phase3Cmp>())
{
     cmp.setCallbacks(nullptr, &Phase3Cmp::start, &Phase3Cmp::stop, nullptr);
 
     cmp.createServiceDependency<IPhase2>()
             .setRequired(true)
             .setCallbacks(&Phase3Cmp::addPhase2, &Phase3Cmp::removePhase2);
 }
+
+Phase3BaseActivator::~Phase3BaseActivator(){};

http://git-wip-us.apache.org/repos/asf/celix/blob/88a8baf1/examples/celix-examples/dm_example_cxx/phase3/src/Phase3BaseActivator.h
----------------------------------------------------------------------
diff --git a/examples/celix-examples/dm_example_cxx/phase3/src/Phase3BaseActivator.h b/examples/celix-examples/dm_example_cxx/phase3/src/Phase3BaseActivator.h
index 0f3d813..27deee2 100644
--- a/examples/celix-examples/dm_example_cxx/phase3/src/Phase3BaseActivator.h
+++ b/examples/celix-examples/dm_example_cxx/phase3/src/Phase3BaseActivator.h
@@ -20,14 +20,13 @@
 #ifndef CELIX_PHASE3BASEACTIVATOR_H
 #define CELIX_PHASE3BASEACTIVATOR_H
 
-#include "celix/dm/DmActivator.h"
+#include "celix/IBundleActivator.h"
+#include "celix/dm/DependencyManager.h"
 
-using namespace celix::dm;
-
-class Phase3BaseActivator : public DmActivator {
+class Phase3BaseActivator : public celix::IBundleActivator {
 public:
-    Phase3BaseActivator(DependencyManager& mng) : DmActivator(mng), cmp(mng.createComponent<Phase3Cmp>())
{}
-    void init();
+    Phase3BaseActivator(celix::dm::DependencyManager& mng);
+    virtual ~Phase3BaseActivator();
 protected:
     celix::dm::Component<Phase3Cmp>& cmp;
 };

http://git-wip-us.apache.org/repos/asf/celix/blob/88a8baf1/examples/celix-examples/dm_example_cxx/phase3_locking/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/examples/celix-examples/dm_example_cxx/phase3_locking/CMakeLists.txt b/examples/celix-examples/dm_example_cxx/phase3_locking/CMakeLists.txt
index 7a6823a..aa62b70 100644
--- a/examples/celix-examples/dm_example_cxx/phase3_locking/CMakeLists.txt
+++ b/examples/celix-examples/dm_example_cxx/phase3_locking/CMakeLists.txt
@@ -26,13 +26,3 @@ add_celix_bundle(dm_example_cxx_phase3_locking
 target_include_directories(dm_example_cxx_phase3_locking PRIVATE src)
 target_link_libraries(dm_example_cxx_phase3_locking PRIVATE dm_example_cxx_api pthread)
 
-IF(APPLE)
-    target_link_libraries(dm_example_cxx_phase3_locking PRIVATE -Wl,-all_load Celix::dependency_manager_cxx_static)
-else()
-    if(ENABLE_ADDRESS_SANITIZER)
-        #With asan there can be undefined symbols
-        target_link_libraries(dm_example_cxx_phase3_locking PRIVATE -Wl,--whole-archive Celix::dependency_manager_cxx_static
-Wl,--no-whole-archive)
-    else()
-        target_link_libraries(dm_example_cxx_phase3_locking PRIVATE -Wl,--no-undefined -Wl,--whole-archive
Celix::dependency_manager_cxx_static -Wl,--no-whole-archive)
-    endif()
-endif()

http://git-wip-us.apache.org/repos/asf/celix/blob/88a8baf1/examples/celix-examples/dm_example_cxx/phase3_locking/src/Phase3LockingActivator.cc
----------------------------------------------------------------------
diff --git a/examples/celix-examples/dm_example_cxx/phase3_locking/src/Phase3LockingActivator.cc
b/examples/celix-examples/dm_example_cxx/phase3_locking/src/Phase3LockingActivator.cc
index 29d178e..eb538b5 100644
--- a/examples/celix-examples/dm_example_cxx/phase3_locking/src/Phase3LockingActivator.cc
+++ b/examples/celix-examples/dm_example_cxx/phase3_locking/src/Phase3LockingActivator.cc
@@ -23,14 +23,16 @@
 
 #include <memory>
 
-using namespace celix::dm;
+#include "celix/BundleActivator.h"
 
 
-DmActivator* DmActivator::create(DependencyManager& mng) {
-    return new Phase3LockingActivator(mng);
+
+celix::IBundleActivator* celix::createBundleActivator(celix::BundleContext &ctx) {
+    return new Phase3LockingActivator{ctx};
 }
 
-void Phase3LockingActivator::init() {
+Phase3LockingActivator::Phase3LockingActivator(celix::BundleContext& ctx) {
+    auto &mng = ctx.getDependencyManager();
     auto inst = std::shared_ptr<Phase3LockingCmp> {new Phase3LockingCmp {}};
 
     Component<Phase3LockingCmp>& cmp = mng.createComponent<Phase3LockingCmp>(inst)
 //set inst using a shared ptr
@@ -39,4 +41,6 @@ void Phase3LockingActivator::init() {
     cmp.createServiceDependency<IPhase2>()
             .setStrategy(DependencyUpdateStrategy::locking)
             .setCallbacks(&Phase3LockingCmp::addPhase2, &Phase3LockingCmp::removePhase2);
-}
\ No newline at end of file
+}
+
+Phase3LockingActivator::~Phase3LockingActivator() {}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/celix/blob/88a8baf1/examples/celix-examples/dm_example_cxx/phase3_locking/src/Phase3LockingActivator.h
----------------------------------------------------------------------
diff --git a/examples/celix-examples/dm_example_cxx/phase3_locking/src/Phase3LockingActivator.h
b/examples/celix-examples/dm_example_cxx/phase3_locking/src/Phase3LockingActivator.h
index 78d1748..1ff75ba 100644
--- a/examples/celix-examples/dm_example_cxx/phase3_locking/src/Phase3LockingActivator.h
+++ b/examples/celix-examples/dm_example_cxx/phase3_locking/src/Phase3LockingActivator.h
@@ -20,14 +20,12 @@
 #ifndef CELIX_PHASE3LOCKINGACTIVATOR_H
 #define CELIX_PHASE3LOCKINGACTIVATOR_H
 
-#include "celix/dm/DmActivator.h"
+#include "celix/IBundleActivator.h"
 
-using namespace celix::dm;
-
-class Phase3LockingActivator : public DmActivator {
+class Phase3LockingActivator : public celix::IBundleActivator {
 public:
-    Phase3LockingActivator(DependencyManager& mng) : DmActivator(mng) {}
-    virtual void init();
+    Phase3LockingActivator(celix::BundleContext& ctx);
+    virtual ~Phase3LockingActivator();
 };
 
 #endif //CELIX_PHASE3LOCKINGAACTIVATOR_H

http://git-wip-us.apache.org/repos/asf/celix/blob/88a8baf1/framework/include/celix/Bundle.h
----------------------------------------------------------------------
diff --git a/framework/include/celix/Bundle.h b/framework/include/celix/Bundle.h
index de65e4d..511f6d7 100644
--- a/framework/include/celix/Bundle.h
+++ b/framework/include/celix/Bundle.h
@@ -23,7 +23,6 @@
 #include "celix/Properties.h"
 
 namespace celix {
-    class Framework; //forward declaration
 
     enum class BundleState {
         UNKNOWN,
@@ -59,9 +58,6 @@ namespace celix {
 
         virtual celix::Properties getManifestAsProperties() const noexcept  = 0;
 
-        //TODO make ref?
-        virtual celix::Framework* getFramework() const noexcept = 0;
-
         virtual void start() noexcept = 0;
 
         virtual void stop() noexcept = 0;
@@ -72,6 +68,6 @@ namespace celix {
 
 }
 
-#include "celix/impl/BundleImpl.h"
-
 #endif //CXX_CELIX_BUNDLE_H
+
+#include "celix/impl/BundleImpl.h"

http://git-wip-us.apache.org/repos/asf/celix/blob/88a8baf1/framework/include/celix/BundleActivator.h
----------------------------------------------------------------------
diff --git a/framework/include/celix/BundleActivator.h b/framework/include/celix/BundleActivator.h
index 6809008..ccf15fc 100644
--- a/framework/include/celix/BundleActivator.h
+++ b/framework/include/celix/BundleActivator.h
@@ -20,9 +20,12 @@
 #ifndef CXX_CELIX_BUNDLEACTIVATOR_H
 #define CXX_CELIX_BUNDLEACTIVATOR_H
 
-#include "celix/BundleContext.h"
-#include "bundle_activator.h"
+#include <memory>
+
+#include "celix/IBundleActivator.h"
+#include "celix/Framework.h"
 
+#include "bundle_activator.h"
 
 /**
  * Note & Warning this is a header implementation of the C bundle activator.
@@ -31,19 +34,49 @@
  */
 
 namespace celix {
-
-    class IBundleActivator {
-    public:
-        IBundleActivator(){};
-        virtual ~IBundleActivator(){};
-    };
-
     /**
      * The celix::createBundleActivator which needs to be implemented by a bundle.
-     */
+    */
     static celix::IBundleActivator* createBundleActivator(celix::BundleContext &ctx);
+
+    namespace impl {
+        struct ActivatorData {
+            std::unique_ptr<celix::Framework> fw{};
+            std::unique_ptr<celix::BundleContext> ctx{};
+            std::unique_ptr<celix::IBundleActivator> act{};
+        };
+    }
+}
+
+
+extern "C" celix_status_t bundleActivator_create(bundle_context_t *c_ctx, void **userData)
{
+    auto *data = new celix::impl::ActivatorData;
+    data->fw = std::unique_ptr<celix::Framework>{new celix::impl::FrameworkImpl{c_ctx}};
+    data->ctx = std::unique_ptr<celix::BundleContext>{new celix::impl::BundleContextImpl{c_ctx,
*data->fw}};
+    *userData = data;
+    return CELIX_SUCCESS;
+}
+
+extern "C" celix_status_t bundleActivator_start(void *userData, bundle_context_t *) {
+    auto *data = static_cast<celix::impl::ActivatorData*>(userData);
+    data->act = std::unique_ptr<celix::IBundleActivator>{celix::createBundleActivator(*data->ctx)};
+    data->ctx->getDependencyManager().start();
+    return CELIX_SUCCESS;
 }
 
-#include "celix/impl/BundleActivatorImpl.h"
+extern "C" celix_status_t bundleActivator_stop(void *userData, bundle_context_t *) {
+    auto *data = static_cast<celix::impl::ActivatorData*>(userData);
+    data->ctx->getDependencyManager().stop();
+    data->act = nullptr;
+    return CELIX_SUCCESS;
+}
+
+extern "C" celix_status_t bundleActivator_destroy(void *userData, bundle_context_t*) {
+    auto *data = static_cast<celix::impl::ActivatorData*>(userData);
+    data->ctx = nullptr;
+    data->fw = nullptr;
+    delete data;
+    return CELIX_SUCCESS;
+}
 
 #endif //CXX_CELIX_BUNDLEACTIVATOR_H

http://git-wip-us.apache.org/repos/asf/celix/blob/88a8baf1/framework/include/celix/BundleContext.h
----------------------------------------------------------------------
diff --git a/framework/include/celix/BundleContext.h b/framework/include/celix/BundleContext.h
index 8fb540d..b26cdd0 100644
--- a/framework/include/celix/BundleContext.h
+++ b/framework/include/celix/BundleContext.h
@@ -31,8 +31,11 @@
 namespace celix {
 
     //forward declarations
-    class Bundle;
     class BundleContext;
+    class Framework;
+    namespace dm {
+        class DependencyManager;
+    }
 
     struct BundleRegistrationOptions {
         std::string id{};
@@ -193,8 +196,11 @@ namespace celix {
          */
         virtual void stopTracker(long trackerId) noexcept  = 0;
 
-        virtual Bundle& getBundle() noexcept = 0;
+        virtual celix::Framework& getFramework() noexcept = 0;
 
+        virtual celix::Bundle& getBundle() noexcept = 0;
+
+        virtual celix::dm::DependencyManager& getDependencyManager() noexcept  = 0;
 
         //TODO
         //class celix::DependencyManager; //forward declaration TODO create
@@ -237,6 +243,6 @@ namespace celix {
 
 }
 
-#include "celix/impl/BundleContextImpl.h"
-
 #endif //CXX_CELIX_BUNDLECONTEXT_H
+
+#include "celix/impl/BundleContextImpl.h"

http://git-wip-us.apache.org/repos/asf/celix/blob/88a8baf1/framework/include/celix/Celix.h
----------------------------------------------------------------------
diff --git a/framework/include/celix/Celix.h b/framework/include/celix/Celix.h
index c27969f..8a6a0c9 100644
--- a/framework/include/celix/Celix.h
+++ b/framework/include/celix/Celix.h
@@ -32,5 +32,6 @@
 #include "celix/BundleContext.h"
 #include "celix/Framework.h"
 #include "celix/FrameworkFactory.h"
+#include "celix/dm/DependencyManager.h"
 
 #endif //CXX_CELIX_CELIX_H

http://git-wip-us.apache.org/repos/asf/celix/blob/88a8baf1/framework/include/celix/Framework.h
----------------------------------------------------------------------
diff --git a/framework/include/celix/Framework.h b/framework/include/celix/Framework.h
index ee7074b..e8daa6a 100644
--- a/framework/include/celix/Framework.h
+++ b/framework/include/celix/Framework.h
@@ -28,9 +28,7 @@
 #include "celix/BundleContext.h"
 
 namespace celix {
-    /*TODO make framework a bundle ??
-     * personally I was never a fan of the context that the framework is also a bundle
-     */
+
     class Framework  {
     public:
         virtual ~Framework() = default;
@@ -46,6 +44,9 @@ namespace celix {
         virtual celix::BundleContext& getFrameworkContext() noexcept = 0;
         virtual celix::Bundle& getFrameworkBundle() noexcept = 0;
     };
+
 }
 
 #endif //CXX_CELIX_FRAMEWORK_H
+
+#include "celix/impl/FrameworkImpl.h"

http://git-wip-us.apache.org/repos/asf/celix/blob/88a8baf1/framework/include/celix/IBundleActivator.h
----------------------------------------------------------------------
diff --git a/framework/include/celix/IBundleActivator.h b/framework/include/celix/IBundleActivator.h
new file mode 100644
index 0000000..35487b0
--- /dev/null
+++ b/framework/include/celix/IBundleActivator.h
@@ -0,0 +1,34 @@
+/**
+ *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 CXX_CELIX_IBUNDLEACTIVATOR_H
+#define CXX_CELIX_IBUNDLEACTIVATOR_H
+
+#include "celix/BundleContext.h"
+
+namespace celix {
+
+    class IBundleActivator {
+    public:
+        IBundleActivator(){};
+        virtual ~IBundleActivator(){};
+    };
+}
+
+#endif //CXX_CELIX_IBUNDLEACTIVATOR_H

http://git-wip-us.apache.org/repos/asf/celix/blob/88a8baf1/framework/include/celix/dm/Component.h
----------------------------------------------------------------------
diff --git a/framework/include/celix/dm/Component.h b/framework/include/celix/dm/Component.h
index 06aaf20..0edc8e9 100644
--- a/framework/include/celix/dm/Component.h
+++ b/framework/include/celix/dm/Component.h
@@ -17,8 +17,8 @@
  * under the License.
  */
 
-#ifndef CELIX_DM_COMPONENT_H
-#define CELIX_DM_COMPONENT_H
+#ifndef CXX_CELIX_DM_COMPONENT_H
+#define CXX_CELIX_DM_COMPONENT_H
 
 #include "celix/dm/types.h"
 #include "dm_component.h"
@@ -231,4 +231,4 @@ namespace celix { namespace dm {
 
 #include "celix/dm/Component_Impl.h"
 
-#endif //CELIX_DM_COMPONENT_H
+#endif //CXX_CELIX_DM_COMPONENT_H

http://git-wip-us.apache.org/repos/asf/celix/blob/88a8baf1/framework/include/celix/dm/DependencyManager.h
----------------------------------------------------------------------
diff --git a/framework/include/celix/dm/DependencyManager.h b/framework/include/celix/dm/DependencyManager.h
index 258a311..e9a74a4 100644
--- a/framework/include/celix/dm/DependencyManager.h
+++ b/framework/include/celix/dm/DependencyManager.h
@@ -17,8 +17,8 @@
  * under the License.
  */
 
-#ifndef CELIX_DM_DEPENDENCYMANAGER_H
-#define CELIX_DM_DEPENDENCYMANAGER_H
+#ifndef CXX_CELIX_DM_DEPENDENCYMANAGER_H
+#define CXX_CELIX_DM_DEPENDENCYMANAGER_H
 
 
 #include "celix/dm/types.h"
@@ -146,4 +146,4 @@ namespace celix { namespace dm {
 
 #include "celix/dm/DependencyManager_Impl.h"
 
-#endif //CELIX_DM_DEPENDENCYMANAGER_H
+#endif //CXX_CELIX_DM_DEPENDENCYMANAGER_H

http://git-wip-us.apache.org/repos/asf/celix/blob/88a8baf1/framework/include/celix/dm/DmActivator.h
----------------------------------------------------------------------
diff --git a/framework/include/celix/dm/DmActivator.h b/framework/include/celix/dm/DmActivator.h
index d7aac3c..ee8cde7 100644
--- a/framework/include/celix/dm/DmActivator.h
+++ b/framework/include/celix/dm/DmActivator.h
@@ -17,8 +17,8 @@
  * under the License.
  */
 
-#ifndef CELIX_DM_ACTIVATOR_H
-#define CELIX_DM_ACTIVATOR_H
+#ifndef CXX_CELIX_DM_ACTIVATOR_H
+#define CXX_CELIX_DM_ACTIVATOR_H
 
 
 #include <utility>
@@ -94,4 +94,4 @@ namespace celix { namespace dm {
     };
 }}
 
-#endif //CELIX_DM_ACTIVATOR_H
+#endif //CXX_CELIX_DM_ACTIVATOR_H

http://git-wip-us.apache.org/repos/asf/celix/blob/88a8baf1/framework/include/celix/dm/Properties.h
----------------------------------------------------------------------
diff --git a/framework/include/celix/dm/Properties.h b/framework/include/celix/dm/Properties.h
index 77d2872..fc485ca 100644
--- a/framework/include/celix/dm/Properties.h
+++ b/framework/include/celix/dm/Properties.h
@@ -17,8 +17,8 @@
  * under the License.
  */
 
-#ifndef CELIX_DM_PROPERTIES_H
-#define CELIX_DM_PROPERTIES_H
+#ifndef CXX_CELIX_DM_PROPERTIES_H
+#define CXX_CELIX_DM_PROPERTIES_H
 
 #include "celix/Properties.h"
 
@@ -26,4 +26,4 @@ namespace celix { namespace dm {
     using Properties = celix::Properties;
 }}
 
-#endif //CELIX_DM_PROPERTIES_H
+#endif //CXX_CELIX_DM_PROPERTIES_H

http://git-wip-us.apache.org/repos/asf/celix/blob/88a8baf1/framework/include/celix/dm/ServiceDependency.h
----------------------------------------------------------------------
diff --git a/framework/include/celix/dm/ServiceDependency.h b/framework/include/celix/dm/ServiceDependency.h
index f439b82..b2b6afb 100644
--- a/framework/include/celix/dm/ServiceDependency.h
+++ b/framework/include/celix/dm/ServiceDependency.h
@@ -17,8 +17,8 @@
  * under the License.
  */
 
-#ifndef CELIX_DM_SERVICEDEPENDENCY_H
-#define CELIX_DM_SERVICEDEPENDENCY_H
+#ifndef CXX_CELIX_DM_SERVICEDEPENDENCY_H
+#define CXX_CELIX_DM_SERVICEDEPENDENCY_H
 
 #include "dm_service_dependency.h"
 #include "celix/dm/types.h"
@@ -323,4 +323,4 @@ namespace celix { namespace dm {
 #include "celix/dm/ServiceDependency_Impl.h"
 
 
-#endif //CELIX_DM_SERVICEDEPENDENCY_H
+#endif //CXX_CELIX_DM_SERVICEDEPENDENCY_H

http://git-wip-us.apache.org/repos/asf/celix/blob/88a8baf1/framework/include/celix/dm/types.h
----------------------------------------------------------------------
diff --git a/framework/include/celix/dm/types.h b/framework/include/celix/dm/types.h
index 43f0f04..8b7b120 100644
--- a/framework/include/celix/dm/types.h
+++ b/framework/include/celix/dm/types.h
@@ -17,8 +17,8 @@
  * under the License.
  */
 
-#ifndef CELIX_DM_TYPES_H
-#define CELIX_DM_TYPES_H
+#ifndef CXX_CELIX_DM_TYPES_H
+#define CXX_CELIX_DM_TYPES_H
 
 #include <map>
 #include <string>
@@ -87,4 +87,4 @@ namespace celix { namespace dm {
 
 }}
 
-#endif //CELIX_DM_TYPES_H
+#endif //CXX_CELIX_DM_TYPES_H

http://git-wip-us.apache.org/repos/asf/celix/blob/88a8baf1/framework/include/celix/impl/BundleActivatorImpl.h
----------------------------------------------------------------------
diff --git a/framework/include/celix/impl/BundleActivatorImpl.h b/framework/include/celix/impl/BundleActivatorImpl.h
deleted file mode 100644
index 2a0db53..0000000
--- a/framework/include/celix/impl/BundleActivatorImpl.h
+++ /dev/null
@@ -1,55 +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.
- */
-
-
-namespace celix {
-    namespace impl {
-        struct ActivatorData {
-            celix::BundleContext *ctx;
-            celix::IBundleActivator *act;
-        };
-    }
-}
-
-
-extern "C" celix_status_t bundleActivator_create(bundle_context_t *c_ctx, void **userData)
{
-    auto *data = new celix::impl::ActivatorData;
-    data->ctx = new celix::impl::BundleContextImpl(c_ctx);
-    *userData = data;
-    return CELIX_SUCCESS;
-}
-
-extern "C" celix_status_t bundleActivator_start(void *userData, bundle_context_t *) {
-    auto *data = static_cast<celix::impl::ActivatorData*>(userData);
-    data->act = celix::createBundleActivator(*data->ctx);
-    return CELIX_SUCCESS;
-}
-
-extern "C" celix_status_t bundleActivator_stop(void *userData, bundle_context_t *) {
-    auto *data = static_cast<celix::impl::ActivatorData*>(userData);
-    delete data->act;
-    return CELIX_SUCCESS;
-}
-
-extern "C" celix_status_t bundleActivator_destroy(void *userData, bundle_context_t*) {
-    auto *data = static_cast<celix::impl::ActivatorData*>(userData);
-    delete data->ctx;
-    delete data;
-    return CELIX_SUCCESS;
-}

http://git-wip-us.apache.org/repos/asf/celix/blob/88a8baf1/framework/include/celix/impl/BundleContextImpl.h
----------------------------------------------------------------------
diff --git a/framework/include/celix/impl/BundleContextImpl.h b/framework/include/celix/impl/BundleContextImpl.h
index 8bdd5c1..80ee662 100644
--- a/framework/include/celix/impl/BundleContextImpl.h
+++ b/framework/include/celix/impl/BundleContextImpl.h
@@ -17,8 +17,8 @@
  *under the License.
  */
 
-#ifndef CELIX_IMPL_BUNDLECONTEXT_H
-#define CELIX_IMPL_BUNDLECONTEXT_H
+#ifndef CELIX_IMPL_BUNDLECONTEXTIMPL_H
+#define CELIX_IMPL_BUNDLECONTEXTIMPL_H
 
 #include <mutex>
 #include <cstring>
@@ -28,6 +28,7 @@
 #include "service_tracker.h"
 
 #include "celix/impl/BundleImpl.h"
+#include "celix/dm/DependencyManager.h"
 
 namespace celix {
 
@@ -44,7 +45,7 @@ namespace celix {
 
         class BundleContextImpl : public celix::BundleContext {
         public:
-            BundleContextImpl(bundle_context_t *ctx) : c_ctx{ctx} {}
+            BundleContextImpl(bundle_context_t *ctx, celix::Framework& _fw) : c_ctx{ctx},
fw{_fw}, bnd{c_ctx}, dm{c_ctx} {}
 
             virtual ~BundleContextImpl() {
                 //NOTE no need to destroy the c bundle context -> done by c framework
@@ -151,16 +152,18 @@ namespace celix {
                 return celix_bundleContext_useBundle(this->c_ctx, bundleId, (void*)(&use),
c_use);
             }
 
-            Bundle& getBundle() noexcept override {
-                std::lock_guard<std::mutex> lock{this->mutex};
-                if (this->cachedBundle.size() == 0) {
-                    celix_bundle_t *c_bnd = nullptr;
-                    bundleContext_getBundle(this->c_ctx, &c_bnd);
-                    this->cachedBundle.emplace_back(c_bnd);
-                }
-                return this->cachedBundle[0];
+            celix::Framework& getFramework() noexcept override {
+                return this->fw;
+            }
+
+            celix::Bundle& getBundle() noexcept override {
+                return this->bnd;
             };
 
+            celix::dm::DependencyManager& getDependencyManager() noexcept override {
+                return this->dm;
+            }
+
         protected:
 
             long registerServiceInternal(const std::string &serviceName, void *svc, const
std::string &version, const std::string &lang, Properties props = {}) noexcept override
{
@@ -295,7 +298,11 @@ namespace celix {
             }
 
         private:
+            //initialized in ctor
             bundle_context_t *c_ctx;
+            celix::Framework& fw;
+            celix::impl::BundleImpl bnd;
+            celix::dm::DependencyManager dm;
 
             struct TrackEntry {
                 std::function<void(void *, const celix::Properties &, const celix::Bundle
&)> set{};
@@ -305,9 +312,8 @@ namespace celix {
 
             std::mutex mutex{};
             std::map<long,std::unique_ptr<TrackEntry>> trackEntries{};
-            std::vector<celix::impl::BundleImpl> cachedBundle{};
         };
     }
 }
 
-#endif //CELIX_IMPL_BUNDLECONTEXT_H
+#endif //CELIX_IMPL_BUNDLECONTEXTIMPL_H

http://git-wip-us.apache.org/repos/asf/celix/blob/88a8baf1/framework/include/celix/impl/BundleImpl.h
----------------------------------------------------------------------
diff --git a/framework/include/celix/impl/BundleImpl.h b/framework/include/celix/impl/BundleImpl.h
index 465922a..1f5c9c8 100644
--- a/framework/include/celix/impl/BundleImpl.h
+++ b/framework/include/celix/impl/BundleImpl.h
@@ -29,10 +29,11 @@ namespace celix {
     namespace impl {
         class BundleImpl : public celix::Bundle {
         public:
+            BundleImpl(celix_bundle_context_t *c_ctx) : c_bnd{nullptr} {
+                bundleContext_getBundle(c_ctx, &this->c_bnd);
+            }
+
             BundleImpl(celix_bundle_t *b) : c_bnd{b} {
-                framework_t *c_fw{nullptr};
-                bundle_getFramework(this->c_bnd, &c_fw);
-                //this->fw = std::unique_ptr<celix::impl::Framework>{new celix::impl::Framework(c_fw,
false)};
             }
 
             virtual ~BundleImpl() {
@@ -135,11 +136,6 @@ namespace celix {
                 return celix::Properties{}; //TODO
             }
 
-            celix::Framework* getFramework() const noexcept override {
-//                return this->fw;
-                return nullptr; //TODO
-            }
-
             void start() noexcept override {
                 bundle_start(this->c_bnd);
             }
@@ -176,8 +172,6 @@ namespace celix {
             };
 
             celix_bundle_t *c_bnd;
-//            framework_t *c_fw{nullptr};
-//            std::unique_ptr<celix::impl::Framework> fw{nullptr};
         };
     }
 }

http://git-wip-us.apache.org/repos/asf/celix/blob/88a8baf1/framework/include/celix/impl/FrameworkImpl.h
----------------------------------------------------------------------
diff --git a/framework/include/celix/impl/FrameworkImpl.h b/framework/include/celix/impl/FrameworkImpl.h
index 6a9cceb..0b7475e 100644
--- a/framework/include/celix/impl/FrameworkImpl.h
+++ b/framework/include/celix/impl/FrameworkImpl.h
@@ -23,14 +23,20 @@
 #include "celix_framework_factory.h"
 #include "framework.h"
 
+#include "celix/impl/BundleContextImpl.h"
 #include "celix/impl/BundleImpl.h"
 
 namespace celix {
 
     namespace impl {
 
-        class FrameworkImpl :public celix::Framework {
+        class FrameworkImpl : public celix::Framework {
         public:
+            FrameworkImpl(celix_bundle_context_t *c_ctx) : owner{false} {
+                bundleContext_getFramework(c_ctx, &this->c_fwm);
+                this->setFrameworkContext();
+            }
+
             FrameworkImpl(framework_t *c_fw) : owner{false} {
                 //wrapper framework
                 this->c_fwm = c_fw;
@@ -102,7 +108,9 @@ namespace celix {
                 bundle_context_t *fwmCtx = nullptr;
                 framework_getFrameworkBundle(this->c_fwm, &fwmBundle);
                 bundle_getContext(fwmBundle, &fwmCtx);
-                this->bundleContextsCache.emplace(0, fwmCtx);
+                this->bundleContextsCache.emplace(std::piecewise_construct,
+                                                    std::forward_as_tuple(0L),
+                                                    std::forward_as_tuple(fwmCtx, *this));
             }
 
 

http://git-wip-us.apache.org/repos/asf/celix/blob/88a8baf1/utils/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/utils/CMakeLists.txt b/utils/CMakeLists.txt
index 1826902..2407c03 100644
--- a/utils/CMakeLists.txt
+++ b/utils/CMakeLists.txt
@@ -73,8 +73,8 @@ if (ENABLE_TESTING AND UTILS-TESTS)
     SET(CMAKE_INSTALL_RPATH "${PROJECT_BINARY_DIR}/utils")
 
 
-    include_directories(${CUNIT_INCLUDE_DIRS})
-    include_directories(${CPPUTEST_INCLUDE_DIR})
+    include_directories(SYSTEM ${CUNIT_INCLUDE_DIRS})
+    include_directories(SYSTEM ${CPPUTEST_INCLUDE_DIR})
     include_directories(include)
     include_directories(src)
 


Mime
View raw message