Skip to content

Commit

Permalink
Merge pull request #5405 from npoltorapavlo/DELIA-65378
Browse files Browse the repository at this point in the history
Delia 65378
  • Loading branch information
anand-ky committed Jun 17, 2024
2 parents 9db9b79 + d4fbd55 commit f9ffabd
Show file tree
Hide file tree
Showing 8 changed files with 37 additions and 39 deletions.
6 changes: 6 additions & 0 deletions PersistentStore/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,12 @@ 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)
Expand Down
8 changes: 4 additions & 4 deletions PersistentStore/PersistentStore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,11 @@ namespace WPEFramework {

namespace {

#ifdef WITH_THUNDER_NAMESPACE
static Thunder::Plugin::Metadata<Plugin::PersistentStore> metadata(
#else
static Plugin::Metadata<Plugin::PersistentStore> metadata(
#endif
// Version (Major, Minor, Patch)
API_VERSION_NUMBER_MAJOR, API_VERSION_NUMBER_MINOR, API_VERSION_NUMBER_PATCH,
// Preconditions
Expand Down Expand Up @@ -108,9 +112,6 @@ namespace Plugin {
_store = _service->Root<Exchange::IStore>(_connectionId, RPC::CommunicationTimeOut, _T("PersistentStoreImplementation"));
if (_store != nullptr) {
_store2 = _store->QueryInterface<Exchange::IStore2>();
if (_store2 != nullptr) {
_store2->Register(&_store2Sink);
}
_storeCache = _store->QueryInterface<Exchange::IStoreCache>();
_storeInspector = _store->QueryInterface<Exchange::IStoreInspector>();
_storeLimit = _store->QueryInterface<Exchange::IStoreLimit>();
Expand All @@ -136,7 +137,6 @@ namespace Plugin {

if (_store != nullptr) {
if (_store2 != nullptr) {
_store2->Unregister(&_store2Sink);
_store2->Release();
_store2 = nullptr;
}
Expand Down
34 changes: 0 additions & 34 deletions PersistentStore/PersistentStore.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,38 +61,6 @@ 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;
Expand Down Expand Up @@ -142,7 +110,6 @@ namespace Plugin {
, _storeCache(nullptr)
, _storeInspector(nullptr)
, _storeLimit(nullptr)
, _store2Sink(*this)
, _notification(*this)
{
RegisterAll();
Expand Down Expand Up @@ -197,7 +164,6 @@ namespace Plugin {
Exchange::IStoreCache* _storeCache;
Exchange::IStoreInspector* _storeInspector;
Exchange::IStoreLimit* _storeLimit;
Core::Sink<Store2Notification> _store2Sink;
Core::Sink<RemoteConnectionNotification> _notification;
};

Expand Down
2 changes: 2 additions & 0 deletions PersistentStore/PersistentStoreJsonRpc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@ namespace Plugin {
params.Ttl.Value());
if (result == Core::ERROR_NONE) {
response.Success = true;

event_onValueChanged(params);
}

return result;
Expand Down
6 changes: 6 additions & 0 deletions PersistentStore/grpc/l0test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,12 @@ 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)

Expand Down
6 changes: 6 additions & 0 deletions PersistentStore/l0test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,12 @@ 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)

Expand Down
6 changes: 6 additions & 0 deletions PersistentStore/l1test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,12 @@ 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)

Expand Down
8 changes: 7 additions & 1 deletion PersistentStore/sqlite/l1test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,13 @@ FetchContent_Declare(
)
FetchContent_MakeAvailable(googletest)

find_package(WPEFramework REQUIRED)
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)

add_executable(${PROJECT_NAME}
Expand Down

0 comments on commit f9ffabd

Please sign in to comment.