/* * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * @file job_plugin_install.cpp * @author Pawel Sikorski (p.sikorski@samgsung.com) * @version * @brief */ #include #include #include //TODO remove //#include #include "plugin_objects.h" namespace Jobs { namespace PluginInstall { JobPluginInstall::JobPluginInstall(std::string const &pluginPath, const PluginInstallerStruct &installerStruct) : Job(PluginInstallation), JobContextBase(installerStruct) { // // Init installer context // m_context.pluginFilePath = pluginPath; m_context.pluginHandle = INVALID_HANDLE; m_context.installationCompleted = false; m_context.installerTask = this; // // Create main installation tasks // AddTask(new PluginInstallTask(&m_context)); } void JobPluginInstall::SendProgress() { if (GetProgressFlag() && getInstallerStruct().progressCallback != NULL) { LogDebug("Call Plugin install progressCallback"); getInstallerStruct().progressCallback(getInstallerStruct().userParam, GetProgressPercent(), GetProgressDescription()); } } void JobPluginInstall::SendFinishedSuccess() { PluginHandle handle = getNewPluginHandle(); if (handle != Jobs::PluginInstall::JobPluginInstall::INVALID_HANDLE && isReadyToInstall()) { LogDebug("Call Plugin install success finishedCallback"); getInstallerStruct().finishedCallback(getInstallerStruct().userParam, Exceptions::Success); } else { LogDebug("Call Plugin install waiting finishedCallback"); getInstallerStruct().finishedCallback(getInstallerStruct().userParam, Exceptions::InstallationWaiting); LogInfo("Installation: " << getFilePath() << " NOT possible"); } } void JobPluginInstall::SendFinishedFailure() { LogError("Error in plugin installation step: " << m_exceptionCaught); LogError("Message: " << m_exceptionMessage); LogDebug("Call Plugin install failure finishedCallback"); getInstallerStruct().finishedCallback(getInstallerStruct().userParam, m_exceptionCaught); } void JobPluginInstall::SaveExceptionData(const Jobs::JobExceptionBase &e) { m_exceptionCaught = static_cast(e.getParam()); m_exceptionMessage = e.GetMessage(); } } //namespace Jobs } //namespace PluginInstall