Update wrt-plugins-common_0.3.60
[platform/framework/web/wrt-plugins-common.git] / src / plugins-installer / logic / installer_logic.h
1 /*
2  * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
3  *
4  *    Licensed under the Apache License, Version 2.0 (the "License");
5  *    you may not use this file except in compliance with the License.
6  *    You may obtain a copy of the License at
7  *
8  *        http://www.apache.org/licenses/LICENSE-2.0
9  *
10  *    Unless required by applicable law or agreed to in writing, software
11  *    distributed under the License is distributed on an "AS IS" BASIS,
12  *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  *    See the License for the specific language governing permissions and
14  *    limitations under the License.
15  */
16 #ifndef WRT_SRC_INSTALLER_CORE_INSTALLER_LOGIC_H_
17 #define WRT_SRC_INSTALLER_CORE_INSTALLER_LOGIC_H_
18
19 #include <dpl/wrt-dao-rw/widget_dao.h>
20 #include <dpl/wrt-dao-rw/global_dao.h>
21 #include <dpl/wrt-dao-ro/feature_model.h>
22 #include <plugin_install/plugin_installer_struct.h>
23 #include <job.h>
24 #include <wrt_common_types.h>
25
26 namespace Logic {
27
28 class InstallerLogic
29 {
30     typedef std::map<Jobs::JobHandle, Jobs::Job*> JobsContainer;
31     JobsContainer m_jobs;
32
33 //    void InstallDeferredWidgetPackages();
34 //    void InstallSingleDeferredPackage();
35
36     void InstallWaitingPlugins();
37     bool resolvePluginDependencies(PluginHandle handle);
38
39     Jobs::JobHandle m_NextHandle;
40     Jobs::JobHandle GetNewJobHandle()
41     {
42         return m_NextHandle++;
43     }
44     Jobs::JobHandle AddAndStartJob(Jobs::Job *job);
45   public:
46     virtual ~InstallerLogic();
47
48     void Initialize();
49
50     void Terminate();
51
52 //    Jobs::JobHandle InstallWidget(std::string const & widgetPath,
53 //            const WidgetInstallationStruct &installerStruct);
54 //
55 //    Jobs::JobHandle UninstallWidget(WidgetHandle widgetHandle,
56 //            const WidgetUninstallationStruct &uninstallerStruct);
57 //
58     Jobs::JobHandle InstallPlugin(std::string const & pluginPath,
59             const PluginInstallerStruct &installerStruct);
60
61     bool NextStep(Jobs::Job* installModel);
62
63     //TODO implement me
64     bool AbortJob(const Jobs::JobHandle & /*handle*/)
65     {
66         LogWarning("Not implemented");
67         return true;
68     }
69
70   private:
71     InstallerLogic();
72
73     friend class InstallerController;
74 };
75
76 }
77
78 #endif // INSTALLER_LOGIC_H