Initialize Tizen 2.3
[framework/web/wrt-installer.git] / src / jobs / plugin_install / job_plugin_install.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 /**
17  * @file    job_plugin_install.h
18  * @author  Pawel Sikorski (p.sikorski@samgsung.com)
19  * @version
20  * @brief
21  */
22
23 #ifndef WRT_SRC_INSTALLER_CORE_JOB_JOB_PLUGIN_INSTALL_H_
24 #define WRT_SRC_INSTALLER_CORE_JOB_JOB_PLUGIN_INSTALL_H_
25
26 //SYSTEM INCLUDES
27 #include <string>
28
29 //WRT INCLUDES
30 #include <job.h>
31 #include <job_base.h>
32 #include <plugin_install/plugin_installer_struct.h>
33 #include <plugin_install/plugin_installer_context.h>
34 namespace Jobs {
35 namespace PluginInstall {
36 class JobPluginInstall :
37     public Job,
38     public JobProgressBase<PluginInstallerContext::PluginInstallStep,
39                            PluginInstallerContext::PLUGIN_INSTALL_END>,
40     public JobContextBase<PluginInstallerStruct>
41 {
42   public:
43     static const WrtDB::DbPluginHandle INVALID_HANDLE = -1;
44
45   public:
46     /**
47      * @brief Automaticaly sets installation process
48      */
49     JobPluginInstall(PluginPath const &pluginPath,
50                      const PluginInstallerStruct &installerStruct);
51
52     WrtDB::DbPluginHandle getNewPluginHandle() const
53     {
54         return m_context.pluginHandle;
55     }
56     std::string getFilePath() const
57     {
58         return m_context.pluginFilePath.Fullpath();
59     }
60     bool isReadyToInstall() const
61     {
62         return m_context.installationCompleted;
63     }
64
65     void SendProgress();
66     void SendFinishedSuccess();
67     void SendFinishedFailure();
68     void SaveExceptionData(const Jobs::JobExceptionBase &e);
69
70   private:
71    PluginInstallerContext m_context;
72
73     //TODO move it to base class of all jobs
74     //maybe separate JobBase class for this?
75     Jobs::Exceptions::Type m_exceptionCaught;
76     std::string m_exceptionMessage;
77 };
78 } //namespace Jobs
79 } //namespace PluginInstall
80
81 #endif /* WRT_SRC_INSTALLER_CORE_JOB_JOB_PLUGIN_INSTALL_H_ */