1 /* 2 * Copyright (c) 2022 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 DISTRIBUTEDDATASERVICE_OBJECT_SERVICE_H 17 #define DISTRIBUTEDDATASERVICE_OBJECT_SERVICE_H 18 19 #include "object_manager.h" 20 #include "object_service_stub.h" 21 #include "visibility.h" 22 #include "object_data_listener.h" 23 24 namespace OHOS::DistributedObject { 25 class API_EXPORT ObjectServiceImpl : public ObjectServiceStub { 26 public: 27 ObjectServiceImpl(); 28 29 int32_t ObjectStoreSave(const std::string &bundleName, const std::string &sessionId, 30 const std::string &deviceId, const std::map<std::string, std::vector<uint8_t>> &data, 31 sptr<IObjectSaveCallback> callback) override; 32 int32_t ObjectStoreRetrieve( 33 const std::string &bundleName, const std::string &sessionId, sptr<IObjectRetrieveCallback> callback) override; 34 int32_t ObjectStoreRevokeSave(const std::string &bundleName, const std::string &sessionId, 35 sptr<IObjectRevokeSaveCallback> callback) override; 36 int32_t RegisterDataObserver(const std::string &bundleName, const std::string &sessionId, 37 sptr<IObjectChangeCallback> callback) override; 38 int32_t UnregisterDataChangeObserver(const std::string &bundleName, const std::string &sessionId) override; 39 int32_t IsBundleNameEqualTokenId( 40 const std::string &bundleName, const std::string &sessionId, const uint32_t &tokenId); 41 void Clear(); 42 int32_t ResolveAutoLaunch(const std::string &identifier, DistributedDB::AutoLaunchParam ¶m) override; 43 int32_t OnAppExit(pid_t uid, pid_t pid, uint32_t tokenId, const std::string &appId) override; 44 int32_t OnInitialize() override; 45 int32_t OnUserChange(uint32_t code, const std::string &user, const std::string &account) override; 46 int32_t OnAppUninstall(const std::string &bundleName, int32_t user, int32_t index, uint32_t tokenId) override; 47 48 private: 49 class Factory { 50 public: 51 Factory(); 52 ~Factory(); 53 }; 54 static Factory factory_; 55 }; 56 } // namespace OHOS::DistributedObject 57 #endif 58