diff --git a/PersistentStore/CMakeLists.txt b/PersistentStore/CMakeLists.txt index 429bec4f2a..dc5c44a975 100644 --- a/PersistentStore/CMakeLists.txt +++ b/PersistentStore/CMakeLists.txt @@ -19,12 +19,6 @@ cmake_minimum_required(VERSION 3.14) set(PLUGIN_NAME PersistentStore) find_package(WPEFramework) -if (NOT WPEFramework_FOUND) - find_package(Thunder) - if (Thunder_FOUND) - add_compile_definitions(WITH_THUNDER_NAMESPACE) - endif () -endif () set(MODULE_NAME ${NAMESPACE}${PLUGIN_NAME}) set(CMAKE_CXX_STANDARD 11) diff --git a/PersistentStore/PersistentStore.cpp b/PersistentStore/PersistentStore.cpp index db2503746e..f435edf26b 100644 --- a/PersistentStore/PersistentStore.cpp +++ b/PersistentStore/PersistentStore.cpp @@ -31,11 +31,7 @@ namespace WPEFramework { namespace { -#ifdef WITH_THUNDER_NAMESPACE - static Thunder::Plugin::Metadata metadata( -#else static Plugin::Metadata metadata( -#endif // Version (Major, Minor, Patch) API_VERSION_NUMBER_MAJOR, API_VERSION_NUMBER_MINOR, API_VERSION_NUMBER_PATCH, // Preconditions @@ -112,6 +108,9 @@ namespace Plugin { _store = _service->Root(_connectionId, RPC::CommunicationTimeOut, _T("PersistentStoreImplementation")); if (_store != nullptr) { _store2 = _store->QueryInterface(); + if (_store2 != nullptr) { + _store2->Register(&_store2Sink); + } _storeCache = _store->QueryInterface(); _storeInspector = _store->QueryInterface(); _storeLimit = _store->QueryInterface(); @@ -137,6 +136,7 @@ namespace Plugin { if (_store != nullptr) { if (_store2 != nullptr) { + _store2->Unregister(&_store2Sink); _store2->Release(); _store2 = nullptr; } diff --git a/PersistentStore/PersistentStore.h b/PersistentStore/PersistentStore.h index 7af934b241..91c50655d2 100644 --- a/PersistentStore/PersistentStore.h +++ b/PersistentStore/PersistentStore.h @@ -61,6 +61,38 @@ namespace Plugin { Core::JSON::DecUInt64 Limit; }; + class Store2Notification : public Exchange::IStore2::INotification { + private: + Store2Notification(const Store2Notification&) = delete; + Store2Notification& operator=(const Store2Notification&) = delete; + + public: + explicit Store2Notification(PersistentStore& parent) + : _parent(parent) + { + } + ~Store2Notification() override = default; + + public: + void ValueChanged(const Exchange::IStore2::ScopeType scope, const string& ns, const string& key, const string& value) override + { + JsonData::PersistentStore::SetValueParamsData params; + params.Scope = JsonData::PersistentStore::ScopeType(scope); + params.Namespace = ns; + params.Key = key; + params.Value = value; + + _parent.event_onValueChanged(params); + } + + BEGIN_INTERFACE_MAP(Store2Notification) + INTERFACE_ENTRY(Exchange::IStore2::INotification) + END_INTERFACE_MAP + + private: + PersistentStore& _parent; + }; + class RemoteConnectionNotification : public RPC::IRemoteConnection::INotification { private: RemoteConnectionNotification() = delete; @@ -110,6 +142,7 @@ namespace Plugin { , _storeCache(nullptr) , _storeInspector(nullptr) , _storeLimit(nullptr) + , _store2Sink(*this) , _notification(*this) { RegisterAll(); @@ -164,6 +197,7 @@ namespace Plugin { Exchange::IStoreCache* _storeCache; Exchange::IStoreInspector* _storeInspector; Exchange::IStoreLimit* _storeLimit; + Core::Sink _store2Sink; Core::Sink _notification; }; diff --git a/PersistentStore/PersistentStoreJsonRpc.cpp b/PersistentStore/PersistentStoreJsonRpc.cpp index 023e818e57..a3b2858f8b 100644 --- a/PersistentStore/PersistentStoreJsonRpc.cpp +++ b/PersistentStore/PersistentStoreJsonRpc.cpp @@ -64,8 +64,6 @@ namespace Plugin { params.Ttl.Value()); if (result == Core::ERROR_NONE) { response.Success = true; - - event_onValueChanged(params); } return result; diff --git a/PersistentStore/grpc/l0test/CMakeLists.txt b/PersistentStore/grpc/l0test/CMakeLists.txt index 520fb656df..8e4aa0ab13 100644 --- a/PersistentStore/grpc/l0test/CMakeLists.txt +++ b/PersistentStore/grpc/l0test/CMakeLists.txt @@ -35,12 +35,6 @@ FetchContent_MakeAvailable(googletest) target_link_libraries(${PROJECT_NAME} PRIVATE gmock_main) find_package(WPEFramework) -if (NOT WPEFramework_FOUND) - find_package(Thunder) - if (Thunder_FOUND) - add_compile_definitions(WITH_THUNDER_NAMESPACE) - endif () -endif () find_package(${NAMESPACE}Plugins REQUIRED) target_link_libraries(${PROJECT_NAME} PRIVATE ${NAMESPACE}Plugins::${NAMESPACE}Plugins) diff --git a/PersistentStore/l0test/CMakeLists.txt b/PersistentStore/l0test/CMakeLists.txt index 8a7675f16d..d8f1e6ee20 100644 --- a/PersistentStore/l0test/CMakeLists.txt +++ b/PersistentStore/l0test/CMakeLists.txt @@ -29,12 +29,6 @@ FetchContent_Declare( FetchContent_MakeAvailable(googletest) find_package(WPEFramework) -if (NOT WPEFramework_FOUND) - find_package(Thunder) - if (Thunder_FOUND) - add_compile_definitions(WITH_THUNDER_NAMESPACE) - endif () -endif () find_package(${NAMESPACE}Plugins REQUIRED) find_package(${NAMESPACE}Definitions REQUIRED) diff --git a/PersistentStore/l1test/CMakeLists.txt b/PersistentStore/l1test/CMakeLists.txt index 13edcf8f87..67d7b50ff5 100644 --- a/PersistentStore/l1test/CMakeLists.txt +++ b/PersistentStore/l1test/CMakeLists.txt @@ -29,12 +29,6 @@ FetchContent_Declare( FetchContent_MakeAvailable(googletest) find_package(WPEFramework) -if (NOT WPEFramework_FOUND) - find_package(Thunder) - if (Thunder_FOUND) - add_compile_definitions(WITH_THUNDER_NAMESPACE) - endif () -endif () find_package(${NAMESPACE}Plugins REQUIRED) find_package(${NAMESPACE}Definitions REQUIRED) diff --git a/PersistentStore/sqlite/l1test/CMakeLists.txt b/PersistentStore/sqlite/l1test/CMakeLists.txt index b69de898b7..698833ebf3 100644 --- a/PersistentStore/sqlite/l1test/CMakeLists.txt +++ b/PersistentStore/sqlite/l1test/CMakeLists.txt @@ -28,13 +28,7 @@ FetchContent_Declare( ) FetchContent_MakeAvailable(googletest) -find_package(WPEFramework) -if (NOT WPEFramework_FOUND) - find_package(Thunder) - if (Thunder_FOUND) - add_compile_definitions(WITH_THUNDER_NAMESPACE) - endif () -endif () +find_package(WPEFramework REQUIRED) find_package(${NAMESPACE}Plugins REQUIRED) add_executable(${PROJECT_NAME}