2 * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
17 * @file job_plugin_install.cpp
18 * @author Pawel Sikorski (p.sikorski@samgsung.com)
22 #include <plugin_install/job_plugin_install.h>
23 #include <plugin_install/plugin_install_task.h>
24 #include <widget_install/widget_installer_struct.h> //TODO remove
26 //#include <plugin_logic.h>
27 #include "plugin_objects.h"
30 namespace PluginInstall {
31 JobPluginInstall::JobPluginInstall(DPL::Utils::Path const &pluginPath,
32 const PluginInstallerStruct &installerStruct)
34 Job(PluginInstallation),
35 JobContextBase<PluginInstallerStruct>(installerStruct)
38 // Init installer context
40 m_context.pluginFilePath = pluginPath;
41 m_context.pluginHandle = INVALID_HANDLE;
42 m_context.installationCompleted = false;
44 m_context.installerTask = this;
46 // Create main installation tasks
48 AddTask(new PluginInstallTask(&m_context));
51 void JobPluginInstall::SendProgress()
53 if (GetProgressFlag() && getInstallerStruct().progressCallback != NULL) {
54 LogDebug("Call Plugin install progressCallback");
55 getInstallerStruct().progressCallback(getInstallerStruct().userParam,
57 GetProgressDescription());
61 void JobPluginInstall::SendFinishedSuccess()
63 PluginHandle handle = getNewPluginHandle();
65 if (handle != Jobs::PluginInstall::JobPluginInstall::INVALID_HANDLE &&
68 LogDebug("Call Plugin install success finishedCallback");
69 getInstallerStruct().finishedCallback(getInstallerStruct().userParam,
70 Jobs::Exceptions::Success);
72 LogDebug("Call Plugin install waiting finishedCallback");
73 getInstallerStruct().finishedCallback(getInstallerStruct().userParam,
74 Jobs::Exceptions::ErrorPluginInstallationFailed);
76 LogDebug("Installation: " << getFilePath() <<
81 void JobPluginInstall::SendFinishedFailure()
83 LogError("Error in plugin installation step: " << m_exceptionCaught);
84 LogError("Message: " << m_exceptionMessage);
86 LogDebug("Call Plugin install failure finishedCallback");
87 getInstallerStruct().finishedCallback(getInstallerStruct().userParam,
91 void JobPluginInstall::SaveExceptionData(const Jobs::JobExceptionBase &e)
93 m_exceptionCaught = static_cast<Jobs::Exceptions::Type>(e.getParam());
94 m_exceptionMessage = e.GetMessage();
97 } //namespace PluginInstall