1 /* 2 * Copyright (c) 2021 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 OHOS_DISTRIBUTED_DATA_SERVICES_CONFIG_CONFIG_FACTORY_H 17 #define OHOS_DISTRIBUTED_DATA_SERVICES_CONFIG_CONFIG_FACTORY_H 18 #include <cstdint> 19 #include "visibility.h" 20 #include "model/global_config.h" 21 namespace OHOS { 22 namespace DistributedData { 23 class ConfigFactory { 24 public: 25 API_EXPORT static ConfigFactory &GetInstance(); 26 API_EXPORT int32_t Initialize(); 27 API_EXPORT std::vector<ComponentConfig> *GetComponentConfig(); 28 API_EXPORT NetworkConfig *GetNetworkConfig(); 29 API_EXPORT CheckerConfig *GetCheckerConfig(); 30 API_EXPORT GlobalConfig *GetGlobalConfig(); 31 API_EXPORT DirectoryConfig *GetDirectoryConfig(); 32 API_EXPORT BackupConfig *GetBackupConfig(); 33 API_EXPORT CloudConfig *GetCloudConfig(); 34 API_EXPORT std::vector<AppIdMappingConfig> *GetAppIdMappingConfig(); 35 private: 36 static constexpr const char *CONF_PATH = "/system/etc/distributeddata/conf"; 37 ConfigFactory(); 38 ~ConfigFactory(); 39 40 std::string file_; 41 GlobalConfig config_; 42 bool isInited = false; 43 }; 44 } // namespace DistributedData 45 } // namespace OHOS 46 #endif // OHOS_DISTRIBUTED_DATA_SERVICES_CONFIG_CONFIG_FACTORY_H 47