This is an automated email from the ASF dual-hosted git repository.

pnoltes pushed a commit to branch feature/split_celix_cxx_option
in repository https://gitbox.apache.org/repos/asf/celix.git

commit c3da2711358fe49c6b3807b6af718f9277fb24ee
Author: Pepijn Noltes <[email protected]>
AuthorDate: Sun Dec 4 15:54:51 2022 +0100

    Removing unused C++ topology manager code.
---
 bundles/cxx_remote_services/CMakeLists.txt         |   7 +-
 .../topology_manager/include/topology_manager.h    |  63 -----------
 .../topology_manager/src/topology_manager.cc       | 116 ---------------------
 3 files changed, 1 insertion(+), 185 deletions(-)

diff --git a/bundles/cxx_remote_services/CMakeLists.txt 
b/bundles/cxx_remote_services/CMakeLists.txt
index f60b2083..78e2cf0a 100644
--- a/bundles/cxx_remote_services/CMakeLists.txt
+++ b/bundles/cxx_remote_services/CMakeLists.txt
@@ -15,15 +15,10 @@
 # specific language governing permissions and limitations
 # under the License.
 
-celix_subproject(CXX_REMOTE_SERVICE_ADMIN "Option to enable building the C++17 
Remote Service Admin Service bundles" OFF)
+celix_subproject(CXX_REMOTE_SERVICE_ADMIN "Option to enable building the C++17 
Remote Service Admin Service bundles" ON)
 if (CXX_REMOTE_SERVICE_ADMIN)
-    message(STATUS  "The C++ Remote Service Admin is still experimental; The 
API, SPI and implementation is not stable and will change")
-
     add_subdirectory(rsa_spi)
     add_subdirectory(admin)
     add_subdirectory(discovery_configured)
     add_subdirectory(integration)
-
-    #NOTE the topology manager is not yet used. The discovery and RSA need to 
be refactor for this
-    #add_subdirectory(topology_manager)
 endif()
\ No newline at end of file
diff --git 
a/bundles/cxx_remote_services/topology_manager/include/topology_manager.h 
b/bundles/cxx_remote_services/topology_manager/include/topology_manager.h
deleted file mode 100644
index 710cbdb5..00000000
--- a/bundles/cxx_remote_services/topology_manager/include/topology_manager.h
+++ /dev/null
@@ -1,63 +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 "celix/rsa/IEndpointAnnouncer.h"
-#include <IExportedService.h>
-#include <celix_api.h>
-#include <mutex>
-#include <celix_log_helper.h>
-
-#if defined(__has_include) && __has_include(<version>)
-#include <version>
-#endif
-
-#if __cpp_lib_memory_resource
-#include <memory_resource>
-#endif
-
-namespace celix::async_rsa {
-        class AsyncTopologyManager {
-        public:
-            explicit AsyncTopologyManager(celix_log_helper_t *logger) noexcept;
-            ~AsyncTopologyManager() ;
-
-            AsyncTopologyManager(AsyncTopologyManager const &) = delete;
-            AsyncTopologyManager(AsyncTopologyManager&&) = delete;
-            AsyncTopologyManager& operator=(AsyncTopologyManager const &) = 
delete;
-            AsyncTopologyManager& operator=(AsyncTopologyManager&&) = delete;
-
-            // Imported endpoint add/remove functions
-            void addExportedService(celix::async_rsa::IExportedService 
*endpoint, Properties&& properties);
-            void removeExportedService(celix::async_rsa::IExportedService 
*endpoint, Properties&& properties);
-
-            void setDiscovery(celix::rsa::IEndpointAnnouncer *discovery);
-
-        private:
-            celix_log_helper_t *_logger;
-            std::mutex _m{}; // protects below
-
-#if __cpp_lib_memory_resource
-            std::pmr::unsynchronized_pool_resource _memResource{};
-            std::pmr::unordered_map<std::string, 
celix::async_rsa::IExportedService*> _exportedServices{&_memResource};
-#else
-            std::unordered_map<std::string, 
celix::async_rsa::IExportedService*> _exportedServices{};
-#endif
-            celix::rsa::IEndpointAnnouncer *_discovery{};
-        };
-}
\ No newline at end of file
diff --git 
a/bundles/cxx_remote_services/topology_manager/src/topology_manager.cc 
b/bundles/cxx_remote_services/topology_manager/src/topology_manager.cc
deleted file mode 100644
index 5ca4ef42..00000000
--- a/bundles/cxx_remote_services/topology_manager/src/topology_manager.cc
+++ /dev/null
@@ -1,116 +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 <topology_manager.h>
-#include <celix_api.h>
-#include <ConfiguredEndpoint.h>
-
-#define L_DEBUG(...) \
-    celix_logHelper_log(_logger, CELIX_LOG_LEVEL_DEBUG, __VA_ARGS__)
-#define L_INFO(...) \
-    celix_logHelper_log(_logger, CELIX_LOG_LEVEL_INFO, __VA_ARGS__)
-#define L_WARN(...) \
-    celix_logHelper_log(_logger, CELIX_LOG_LEVEL_WARNING, __VA_ARGS__)
-#define L_ERROR(...) \
-    celix_logHelper_log(_logger, CELIX_LOG_LEVEL_ERROR, __VA_ARGS__)
-
-celix::async_rsa::AsyncTopologyManager::AsyncTopologyManager(celix_log_helper_t
 *logger) noexcept : _logger(logger) {
-
-}
-
-celix::async_rsa::AsyncTopologyManager::~AsyncTopologyManager() {
-    celix_logHelper_destroy(_logger);
-}
-
-void 
celix::async_rsa::AsyncTopologyManager::addExportedService(celix::async_rsa::IExportedService
 *exportedService, Properties &&properties) {
-    auto interface = properties.get(celix::rsa::Endpoint::EXPORTS);
-
-    if(interface.empty()) {
-        L_DEBUG("Adding exported service but no exported interfaces");
-        return;
-    }
-
-    std::unique_lock l(_m);
-
-    auto existingFactory = _exportedServices.find(interface);
-
-    if(existingFactory != end(_exportedServices)) {
-        L_WARN("Adding service factory but factory already exists");
-        return;
-    }
-
-    if(_discovery != nullptr) {
-        
_discovery->announceEndpoint(std::make_unique<celix::rsa::Endpoint>(std::move(properties)));
-    } else {
-        L_WARN("Discovery null");
-        return;
-    }
-
-    _exportedServices.emplace(interface, exportedService);
-}
-
-void 
celix::async_rsa::AsyncTopologyManager::removeExportedService([[maybe_unused]] 
celix::async_rsa::IExportedService *exportedService, Properties &&properties) {
-    auto interface = properties.get(celix::rsa::Endpoint::EXPORTS);
-
-    if(interface.empty()) {
-        L_WARN("Removing exported service but missing exported interfaces");
-        return;
-    }
-
-    std::unique_lock l(_m);
-
-    if(_exportedServices.erase(interface) > 0) {
-        if(_discovery != nullptr) {
-            
_discovery->revokeEndpoint(std::make_unique<celix::rsa::Endpoint>(std::move(properties)));
-        } else {
-            L_WARN("Discovery null");
-            return;
-        }
-    }
-}
-
-void 
celix::async_rsa::AsyncTopologyManager::setDiscovery(celix::rsa::IEndpointAnnouncer
 *discovery) {
-    std::unique_lock l(_m);
-    _discovery = discovery;
-}
-
-class TopologyManagerActivator {
-public:
-    explicit TopologyManagerActivator(const 
std::shared_ptr<celix::dm::DependencyManager> &mng) :
-    
_cmp(mng->createComponent(std::make_unique<celix::async_rsa::AsyncTopologyManager>(celix_logHelper_create(mng->bundleContext(),
 "celix_async_rsa_admin")))) {
-        _cmp.createServiceDependency<celix::async_rsa::IExportedService>()
-                .setRequired(false)
-                
.setCallbacks(&celix::async_rsa::AsyncTopologyManager::addExportedService, 
&celix::async_rsa::AsyncTopologyManager::removeExportedService)
-                .build();
-
-        _cmp.createServiceDependency<celix::rsa::IEndpointAnnouncer>()
-                .setRequired(true)
-                
.setCallbacks(&celix::async_rsa::AsyncTopologyManager::setDiscovery)
-                .build();
-
-        _cmp.build();
-    }
-
-    TopologyManagerActivator(const TopologyManagerActivator &) = delete;
-    TopologyManagerActivator &operator=(const TopologyManagerActivator &) = 
delete;
-private:
-    celix::dm::Component<celix::async_rsa::AsyncTopologyManager>& _cmp;
-};
-
-CELIX_GEN_CXX_BUNDLE_ACTIVATOR(TopologyManagerActivator)

Reply via email to