+++ /dev/null
-/*
- * 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 task_db_update.cpp
- * @author Lukasz Wrzosek(l.wrzosek@samsung.com)
- * @version 1.0
- * @brief Implementation file for installer task database updating
- */
-//#include <time.h>
-#include <widget_install/task_db_update.h>
-#include <widget_install/job_widget_install.h>
-#include <widget_install/widget_install_errors.h>
-#include <widget_install/widget_install_context.h>
-#include <dpl/wrt-dao-ro/config_parser_data.h>
-#include <dpl/utils/wrt_utility.h>
-#include <dpl/wrt-dao-rw/widget_dao.h>
-#include <dpl/foreach.h>
-#include <dpl/log/log.h>
-#include <dpl/assert.h>
-#include <dpl/wrt-dao-ro/global_config.h>
-#include <string>
-#include <Ecore_File.h>
-#include <sstream>
-
-using namespace WrtDB;
-
-namespace Jobs {
-namespace WidgetInstall {
-TaskDbUpdate::TaskDbUpdate(InstallerContext& context) :
- DPL::TaskDecl<TaskDbUpdate>(this),
- m_context(context)
-{
- AddStep(&TaskDbUpdate::StepDbUpdate);
-
- AddAbortStep(&TaskDbUpdate::StepAbortDBUpdate);
-}
-
-void TaskDbUpdate::StepDbUpdate()
-{
- Try
- {
- // If there is existing model, remove its database data
- if (true == m_context.existingWidgetInfo.isExist) {
- WidgetHandle old = m_context.existingWidgetInfo.existingHandle;
- LogInfo("Unregistering widget...: " << old);
- WidgetDAO::unregisterWidget(old);
- LogInfo("Widget unregistered");
- }
-
- /* Set install Time */
- time(&m_context.widgetConfig.installedTime);
-
- LogInfo("Registering widget...");
-
- WidgetDAO::registerWidget(
- *(m_context.widgetHandle),
- m_context.widgetConfig,
- m_context.wacSecurity);
-
- FOREACH (cap, m_context.staticPermittedDevCaps) {
- LogInfo("staticPermittedDevCaps : " << cap->first
- << " smack status: " << cap->second);
- }
-
- Assert(!!m_context.widgetConfig.pkgname
- && "pkgName should be initialized");
-
- WrtDB::WidgetDAO widgetDao(*m_context.widgetHandle);
- widgetDao.setPkgName(m_context.widgetConfig.pkgname);
-
- LogInfo("Widget registered");
- }
- Catch(WidgetDAO::Exception::DatabaseError)
- {
- LogWarning("Database failure!");
- ReThrowMsg(Exceptions::DatabaseFailure, "Database failure!");
- }
- Catch(DPL::DB::SqlConnection::Exception::Base)
- {
- LogDebug("Database failure!");
- ReThrowMsg(Exceptions::DatabaseFailure, "Database failure!");
- }
-
- m_context.job->UpdateProgress(
- InstallerContext::INSTALL_DB_UPDATE,
- "Widget DB UPDATE Finished");
-}
-
-void TaskDbUpdate::StepAbortDBUpdate()
-{
- LogWarning("[DB Update Task] Aborting... (DB Clean)");
- Assert(!!m_context.widgetHandle);
- Try
- {
- WidgetDAO::unregisterWidget(*m_context.widgetHandle);
-
- LogDebug("Cleaning DB successful!");
- }
- Catch(DPL::DB::SqlConnection::Exception::Base)
- {
- //TODO What should happen here?
- LogError("Failed to handle StepAbortDBClean!");
- // ReThrowMsg(Exceptions::DbStepFailed, "Failed to handle StepAbortDBClean!");
- }
-}
-
-} //namespace WidgetInstall
-} //namespace Jobs
+++ /dev/null
-/*
- * 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 task_db_update.h
- * @author Lukasz Wrzosek(l.wrzosek@samsung.com)
- * @version 1.0
- * @brief Header file for installer task database updating
- */
-#ifndef INSTALLER_CORE_JOS_WIDGET_INSTALL_TASK_DB_UPDATE_H
-#define INSTALLER_CORE_JOS_WIDGET_INSTALL_TASK_DB_UPDATE_H
-
-#include <dpl/task.h>
-
-class InstallerContext;
-
-namespace Jobs {
-namespace WidgetInstall {
-class TaskDbUpdate :
- public DPL::TaskDecl<TaskDbUpdate>
-{
- private:
- InstallerContext& m_context;
-
- void StepDbUpdate();
-
- void StepAbortDBUpdate();
-
- public:
- TaskDbUpdate(InstallerContext& context);
-};
-} //namespace WidgetInstall
-} //namespace Jobs
-
-#endif // INSTALLER_CORE_JOS_WIDGET_INSTALL_TASK_DB_UPDATE_H
+++ /dev/null
-/*
- * 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 task_new_db_insert.cpp
- * @author Lukasz Wrzosek(l.wrzosek@samsung.com)
- * @author Soyoung kim(sy037.kim@samsung.com)
- * @version 1.0
- * @brief Implementation file for installer task database updating for widget update
- */
-#include <time.h>
-#include <sys/stat.h>
-#include <widget_install/task_new_db_insert.h>
-#include <widget_install/job_widget_install.h>
-#include <widget_install/widget_install_errors.h>
-#include <widget_install/widget_install_context.h>
-//#include <dpl/wrt-dao-ro/config_parser_data.h>
-#include <dpl/wrt-dao-rw/widget_dao.h>
-#include <dpl/foreach.h>
-#include <dpl/log/log.h>
-#include <dpl/assert.h>
-//#include <dpl/wrt-dao-ro/global_config.h>
-#include <string>
-#include <sstream>
-
-using namespace WrtDB;
-
-namespace Jobs {
-namespace WidgetInstall {
-TaskNewDbInsert::TaskNewDbInsert(InstallerContext& context) :
- DPL::TaskDecl<TaskNewDbInsert>(this),
- m_context(context)
-{
- AddStep(&TaskNewDbInsert::StepDBInsert);
-
- AddAbortStep(&TaskNewDbInsert::StepAbortDBInsert);
-}
-
-void TaskNewDbInsert::StepDBInsert()
-{
- Try
- {
- /* Set install Time */
- time(&m_context.widgetConfig.installedTime);
-
- LogInfo("Registering widget...");
-
- WidgetDAO::registerWidget(
- *(m_context.widgetHandle),
- m_context.widgetConfig,
- m_context.wacSecurity);
-
- FOREACH (cap, m_context.staticPermittedDevCaps) {
- LogInfo("staticPermittedDevCaps : " << cap->first
- << " smack status: " << cap->second);
- }
-
- Assert(!!m_context.widgetConfig.pkgname
- && "pkgName should be initialized");
-
- WrtDB::WidgetDAO widgetDao(*m_context.widgetHandle);
- widgetDao.setPkgName(m_context.widgetConfig.pkgname);
-
- LogInfo("Widget registered");
- }
- Catch(WidgetDAO::Exception::DatabaseError)
- {
- LogWarning("Database failure!");
- ReThrowMsg(Exceptions::InsertNewWidgetFailed, "Database failure!");
- }
- Catch(DPL::DB::SqlConnection::Exception::Base)
- {
- LogDebug("Database failure!");
- ReThrowMsg(Exceptions::InsertNewWidgetFailed, "Database failure!");
- }
-
- m_context.job->UpdateProgress(
- InstallerContext::INSTALL_NEW_DB_INSERT,
- "New Widget DB UPDATE Finished");
-}
-
-void TaskNewDbInsert::StepAbortDBInsert()
-{
- LogWarning("[DB Update Task] Aborting... (DB Clean)");
- Assert(!!m_context.widgetHandle);
- Try
- {
- WidgetDAO::unregisterWidget(*m_context.widgetHandle);
-
- LogDebug("Cleaning DB successful!");
- }
- Catch(DPL::DB::SqlConnection::Exception::Base)
- {
- LogError("Failed to handle StepAbortDBClean!");
- }
-}
-
-} //namespace WidgetInstall
-} //namespace Jobs
+++ /dev/null
-/*
- * 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 task_new_db_insert.h
- * @author Lukasz Wrzosek(l.wrzosek@samsung.com)
- * @author Soyoung kim(sy037.kim@samsung.com)
- * @version 1.0
- * @brief Header file for installer task database updating for widget update
- */
-#ifndef INSTALLER_CORE_JOS_WIDGET_INSTALL_TASK_NEW_DB_INSERT_H
-#define INSTALLER_CORE_JOS_WIDGET_INSTALL_TASK_NEW_DB_INSERT_H
-
-#include <dpl/task.h>
-
-class InstallerContext;
-
-namespace Jobs {
-namespace WidgetInstall {
-class TaskNewDbInsert:
- public DPL::TaskDecl<TaskNewDbInsert>
-{
- private:
- InstallerContext& m_context;
-
- void StepDBInsert();
-
- void StepAbortDBInsert();
-
- public:
- TaskNewDbInsert(InstallerContext& context);
-};
-} //namespace WidgetInstall
-} //namespace Jobs
-
-#endif // INSTALLER_CORE_JOS_WIDGET_INSTALL_TASK_NEW_DB_INSERT_H
/**
* @brief Event for inicietig widget uninstallation.
*
- * WidgetHandler is used to point witch widget shuld be uninstalled
+ * tizen id is used to point witch widget shuld be uninstalled
*/
DECLARE_GENERIC_EVENT_2(UninstallWidgetEvent,
std::string,