1 /* 2 * Copyright (c) 2023 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 #ifndef FOUNDATION_BUNDLE_FRAMEWORK_SERVICE_INCLUDE_SANDBOX_MANAGER_RDB_H 17 #define FOUNDATION_BUNDLE_FRAMEWORK_SERVICE_INCLUDE_SANDBOX_MANAGER_RDB_H 18 19 #include "bundle_sandbox_manager_db_interface.h" 20 #include "rdb_data_manager.h" 21 22 namespace OHOS { 23 namespace AppExecFwk { 24 class SandboxManagerRdb final : 25 public ISandboxManagerDb, 26 public std::enable_shared_from_this<SandboxManagerRdb> { 27 public: 28 SandboxManagerRdb(); 29 ~SandboxManagerRdb(); 30 31 bool QueryAllSandboxInnerBundleInfo(std::unordered_map<std::string, InnerBundleInfo> &innerBundleInfos) override; 32 bool QuerySandboxInnerBundleInfo(const std::string &bundleName, InnerBundleInfo &innerBundleInfos) override; 33 bool SaveSandboxInnerBundleInfo(const std::string &bundleName, const InnerBundleInfo &innerBundleInfos) override; 34 bool DeleteSandboxInnerBundleInfo(const std::string &bundleName) override; 35 36 private: 37 bool GetAllDataFromDb(std::unordered_map<std::string, InnerBundleInfo> &innerBundleInfos); 38 bool GetDataFromDb(const std::string &bundleName, InnerBundleInfo &innerBundleInfo); 39 bool SaveDataToDb(const std::string &bundleName, const InnerBundleInfo &innerBundleInfo); 40 bool DeleteDataFromDb(const std::string &bundleName); 41 42 std::shared_ptr<RdbDataManager> rdbDataManager_; 43 }; 44 } // namespace AppExecFwk 45 } // namespace OHOS 46 #endif // FOUNDATION_BUNDLE_FRAMEWORK_SERVICE_INCLUDE_SANDBOX_MANAGER_RDB_H 47