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 #include "static_subscriber_extension_module_loader.h"
17 
18 #include "event_log_wrapper.h"
19 #include "static_subscriber_extension.h"
20 
21 namespace OHOS {
22 namespace EventFwk {
23 StaticSubscriberExtensionModuleLoader::StaticSubscriberExtensionModuleLoader() = default;
24 StaticSubscriberExtensionModuleLoader::~StaticSubscriberExtensionModuleLoader() = default;
25 
Create(const std::unique_ptr<AbilityRuntime::Runtime> & runtime) const26 AbilityRuntime::Extension* StaticSubscriberExtensionModuleLoader::Create(
27     const std::unique_ptr<AbilityRuntime::Runtime>& runtime) const
28 {
29     EVENT_LOGD("Create module loader.");
30     return StaticSubscriberExtension::Create(runtime);
31 }
32 
GetParams()33 std::map<std::string, std::string> StaticSubscriberExtensionModuleLoader::GetParams()
34 {
35     EVENT_LOGD("Get params.");
36     std::map<std::string, std::string> params;
37     // type means extension type in ExtensionAbilityType of extension_ability_info.h, 7 means static_subscriber.
38     params.insert(std::pair<std::string, std::string>("type", "7"));
39     // extension name
40     params.insert(std::pair<std::string, std::string>("name", "StaticSubscriberExtension"));
41     return params;
42 }
43 
OHOS_EXTENSION_GetExtensionModule()44 extern "C" __attribute__((visibility("default"))) void* OHOS_EXTENSION_GetExtensionModule()
45 {
46     return &StaticSubscriberExtensionModuleLoader::GetInstance();
47 }
48 } // namespace EventFwk
49 } // namespace OHOS
50