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 REMOTE_COMMAND_FACTORY_H 17 #define REMOTE_COMMAND_FACTORY_H 18 19 #include <memory> 20 #include <string> 21 #include <vector> 22 23 #include "access_token.h" 24 #include "delete_remote_token_command.h" 25 #include "hap_token_info.h" 26 #include "sync_remote_hap_token_command.h" 27 #include "sync_remote_native_token_command.h" 28 #include "update_remote_hap_token_command.h" 29 30 namespace OHOS { 31 namespace Security { 32 namespace AccessToken { 33 class RemoteCommandFactory { 34 public: 35 static RemoteCommandFactory &GetInstance(); 36 37 std::shared_ptr<SyncRemoteHapTokenCommand> NewSyncRemoteHapTokenCommand(const std::string &srcDeviceId, 38 const std::string &dstDeviceId, AccessTokenID tokenID); 39 40 std::shared_ptr<DeleteRemoteTokenCommand> NewDeleteRemoteTokenCommand(const std::string &srcDeviceId, 41 const std::string &dstDeviceId, AccessTokenID tokenID); 42 43 std::shared_ptr<UpdateRemoteHapTokenCommand> NewUpdateRemoteHapTokenCommand(const std::string &srcDeviceId, 44 const std::string &dstDeviceId, const HapTokenInfoForSync& tokenInfo); 45 46 std::shared_ptr<SyncRemoteNativeTokenCommand> NewSyncRemoteNativeTokenCommand(const std::string &srcDeviceId, 47 const std::string &dstDeviceId); 48 49 std::shared_ptr<BaseRemoteCommand> NewRemoteCommandFromJson( 50 const std::string &commandName, const std::string &commandJsonString); 51 52 private: 53 const std::string TAG = "RemoteCommandFactory"; 54 }; 55 } // namespace AccessToken 56 } // namespace Security 57 } // namespace OHOS 58 #endif // REMOTE_COMMAND_FACTORY_H 59