From 87100e24fbb381d5d253f61079ac868fae889b53 Mon Sep 17 00:00:00 2001 From: jongmyeong ko Date: Tue, 16 May 2017 05:11:27 +0000 Subject: [PATCH] Revert "Revert "[Refactor] AppInstaller logic export"" This should be submitted with: - https://review.tizen.org/gerrit/#/c/93998/ - https://review.tizen.org/gerrit/#/c/93999/ This reverts commit 35519ad818702263ead855736499c174b3e97dbe. Change-Id: Ied92513c761f8c52c42b854d74d49eef72fc3144 Signed-off-by: jongmyeongko --- src/hybrid/hybrid_installer.cc | 89 ++++++++++++++++++++++------------------- src/hybrid/hybrid_installer.h | 20 ++++++++++ src/wgt/wgt_installer.cc | 90 +----------------------------------------- src/wgt/wgt_installer.h | 39 +++++++++--------- 4 files changed, 89 insertions(+), 149 deletions(-) diff --git a/src/hybrid/hybrid_installer.cc b/src/hybrid/hybrid_installer.cc index 48612d8..6f727f7 100644 --- a/src/hybrid/hybrid_installer.cc +++ b/src/hybrid/hybrid_installer.cc @@ -107,11 +107,12 @@ namespace hybrid { HybridInstaller::HybridInstaller(common_installer::PkgMgrPtr pkgmgr) : AppInstaller("wgt", pkgmgr) { + Init(); context_->cross_app_rules.set(true); context_->backend_data.set(new HybridBackendData()); +} - switch (pkgmgr_->GetRequestType()) { - case ci::RequestType::Install: +void HybridInstaller::InstallSteps() { AddStep(pkgmgr_); AddStep(); AddStep( @@ -162,8 +163,9 @@ HybridInstaller::HybridInstaller(common_installer::PkgMgrPtr pkgmgr) wgt::filesystem::HybridAdditionalSharedDirs); AddStep(); AddStep(); - break; - case ci::RequestType::Update: +} + +void HybridInstaller::UpdateSteps() { AddStep(pkgmgr_); AddStep(); AddStep( @@ -218,8 +220,9 @@ HybridInstaller::HybridInstaller(common_installer::PkgMgrPtr pkgmgr) AddStep(); AddStep(); AddStep(); - break; - case ci::RequestType::Uninstall: +} + +void HybridInstaller::UninstallSteps() { AddStep(pkgmgr_); AddStep(); AddStep(); @@ -246,12 +249,14 @@ HybridInstaller::HybridInstaller(common_installer::PkgMgrPtr pkgmgr) AddStep(); AddStep(); AddStep(); - break; - case ci::RequestType::Reinstall: +} + +void HybridInstaller::ReinstallSteps() { // RDS is not supported for hybrid apps AddStep(); - break; - case ci::RequestType::Delta: +} + +void HybridInstaller::DeltaSteps() { AddStep(pkgmgr_); AddStep(); AddStep( @@ -310,8 +315,9 @@ HybridInstaller::HybridInstaller(common_installer::PkgMgrPtr pkgmgr) AddStep(); AddStep(); AddStep(); - break; - case ci::RequestType::Recovery: +} + +void HybridInstaller::RecoverySteps() { AddStep(pkgmgr_); AddStep(); AddStep( @@ -328,8 +334,9 @@ HybridInstaller::HybridInstaller(common_installer::PkgMgrPtr pkgmgr) AddStep(); AddStep(); AddStep(); - break; - case ci::RequestType::MountInstall: +} + +void HybridInstaller::MountInstallSteps() { AddStep(pkgmgr_); AddStep(); AddStep( @@ -380,8 +387,9 @@ HybridInstaller::HybridInstaller(common_installer::PkgMgrPtr pkgmgr) wgt::filesystem::HybridAdditionalSharedDirs); AddStep(true); AddStep(); - break; - case ci::RequestType::MountUpdate: +} + +void HybridInstaller::MountUpdateSteps() { AddStep(pkgmgr_); AddStep(); AddStep( @@ -435,8 +443,9 @@ HybridInstaller::HybridInstaller(common_installer::PkgMgrPtr pkgmgr) AddStep(); AddStep(true); AddStep(); - break; - case ci::RequestType::ManifestDirectInstall: +} + +void HybridInstaller::ManifestDirectInstallSteps() { AddStep(pkgmgr_); AddStep( ci::configuration::StepParseManifest::ManifestLocation::INSTALLED, @@ -473,8 +482,9 @@ HybridInstaller::HybridInstaller(common_installer::PkgMgrPtr pkgmgr) wgt::filesystem::HybridAdditionalSharedDirs); AddStep(); AddStep(); - break; - case ci::RequestType::ManifestDirectUpdate: +} + +void HybridInstaller::ManifestDirectUpdateSteps() { AddStep(pkgmgr_); AddStep( ci::configuration::StepParseManifest::ManifestLocation::PACKAGE, @@ -512,8 +522,9 @@ HybridInstaller::HybridInstaller(common_installer::PkgMgrPtr pkgmgr) AddStep(); AddStep(); AddStep(); - break; - case ci::RequestType::ManifestPartialInstall: { +} + +void HybridInstaller::ManifestPartialInstallSteps() { AddStep(pkgmgr_); AddStep( ci::configuration::StepParseManifest::ManifestLocation::INSTALLED, @@ -536,9 +547,9 @@ HybridInstaller::HybridInstaller(common_installer::PkgMgrPtr pkgmgr) AddStep( wgt::filesystem::HybridAdditionalSharedDirs); AddStep(); - break; - } - case ci::RequestType::ManifestPartialUpdate: { +} + +void HybridInstaller::ManifestPartialUpdateSteps() { AddStep(pkgmgr_); AddStep( ci::configuration::StepParseManifest::ManifestLocation::INSTALLED, @@ -564,9 +575,9 @@ HybridInstaller::HybridInstaller(common_installer::PkgMgrPtr pkgmgr) ci::Plugin::ActionType::Upgrade); AddStep(); AddStep(); - break; - } - case ci::RequestType::PartialUninstall: { +} + +void HybridInstaller::PartialUninstallSteps() { AddStep(pkgmgr_); AddStep(); AddStep(); @@ -585,9 +596,9 @@ HybridInstaller::HybridInstaller(common_installer::PkgMgrPtr pkgmgr) AddStep( ci::security::StepPrivacyPrivilege::ActionType::Uninstall); AddStep(); - break; - } - case ci::RequestType::EnablePkg: +} + +void HybridInstaller::EnablePkgSteps() { AddStep(pkgmgr_); AddStep( ci::configuration::StepParseManifest::ManifestLocation::INSTALLED, @@ -597,8 +608,9 @@ HybridInstaller::HybridInstaller(common_installer::PkgMgrPtr pkgmgr) ci::pkgmgr::StepUpdatePkgDisableInfo::ActionType::Enable); AddStep( ci::Plugin::ActionType::Uninstall); - break; - case ci::RequestType::DisablePkg: +} + +void HybridInstaller::DisablePkgSteps() { AddStep(pkgmgr_); AddStep( ci::configuration::StepParseManifest::ManifestLocation::INSTALLED, @@ -608,17 +620,12 @@ HybridInstaller::HybridInstaller(common_installer::PkgMgrPtr pkgmgr) ci::pkgmgr::StepUpdatePkgDisableInfo::ActionType::Disable); AddStep( ci::Plugin::ActionType::Uninstall); - break; - case ci::RequestType::MigrateExtImg: { +} + +void HybridInstaller::MigrateExtImgSteps() { AddStep(pkgmgr_); AddStep(); AddStep(); - break; - } - default: - AddStep(); - break; - } } } // namespace hybrid diff --git a/src/hybrid/hybrid_installer.h b/src/hybrid/hybrid_installer.h index 9824d21..8331393 100644 --- a/src/hybrid/hybrid_installer.h +++ b/src/hybrid/hybrid_installer.h @@ -8,6 +8,8 @@ #include "common/app_installer.h" #include "common/pkgmgr_interface.h" +namespace ci = common_installer; + namespace hybrid { /** @@ -24,6 +26,24 @@ class HybridInstaller : public common_installer::AppInstaller { explicit HybridInstaller(common_installer::PkgMgrPtr pkgmgr); SCOPE_LOG_TAG(HybridInstaller) + + private: + void InstallSteps() override; + void UpdateSteps() override; + void UninstallSteps() override; + void ReinstallSteps() override; + void DeltaSteps() override; + void RecoverySteps() override; + void MountInstallSteps() override; + void MountUpdateSteps() override; + void ManifestDirectInstallSteps() override; + void ManifestDirectUpdateSteps() override; + void DisablePkgSteps() override; + void EnablePkgSteps() override; + void ManifestPartialInstallSteps() override; + void ManifestPartialUpdateSteps() override; + void PartialUninstallSteps() override; + void MigrateExtImgSteps() override; }; } // namespace hybrid diff --git a/src/wgt/wgt_installer.cc b/src/wgt/wgt_installer.cc index 05d8dad..ed2f0ad 100755 --- a/src/wgt/wgt_installer.cc +++ b/src/wgt/wgt_installer.cc @@ -116,90 +116,8 @@ namespace wgt { WgtInstaller::WgtInstaller(ci::PkgMgrPtr pkgrmgr) : AppInstaller("wgt", pkgrmgr) { + Init(); context_->backend_data.set(new WgtBackendData()); - - /* treat the request */ - switch (pkgmgr_->GetRequestType()) { - case ci::RequestType::Install : { - InstallSteps(); - break; - } - case ci::RequestType::Update: { - UpdateSteps(); - break; - } - case ci::RequestType::Uninstall: { - UninstallSteps(); - break; - } - case ci::RequestType::Reinstall: { - ReinstallSteps(); - break; - } - case ci::RequestType::Delta: { - DeltaSteps(); - break; - } - case ci::RequestType::Recovery: { - RecoverySteps(); - break; - } - case ci::RequestType::MountInstall: { - MountInstallSteps(); - break; - } - case ci::RequestType::MountUpdate: { - MountUpdateSteps(); - break; - } - case ci::RequestType::ManifestDirectInstall: { - ManifestDirectInstallSteps(); - break; - } - case ci::RequestType::ManifestDirectUpdate: { - ManifestDirectUpdateSteps(); - break; - } - case ci::RequestType::ReadonlyUpdateInstall: { - ReadonlyUpdateInstallSteps(); - break; - } - case ci::RequestType::ReadonlyUpdateUninstall: { - ReadonlyUpdateUninstallSteps(); - break; - } - case ci::RequestType::ManifestPartialInstall: { - ManifestPartialInstallSteps(); - break; - } - case ci::RequestType::ManifestPartialUpdate: { - ManifestPartialUpdateSteps(); - break; - } - case ci::RequestType::PartialUninstall: { - ManifestPartialUninstallSteps(); - break; - } - case ci::RequestType::Move: { - MoveSteps(); - break; - } - case ci::RequestType::EnablePkg: { - EnablePkgSteps(); - break; - } - case ci::RequestType::DisablePkg: { - DisablePkgSteps(); - break; - } - case ci::RequestType::MigrateExtImg: { - MigrateExtImgSteps(); - break; - } - default: { - DefaultSteps(); - } - } } void WgtInstaller::InstallSteps() { AddStep(pkgmgr_); @@ -714,7 +632,7 @@ WgtInstaller::WgtInstaller(ci::PkgMgrPtr pkgrmgr) AddStep(); } - void WgtInstaller::ManifestPartialUninstallSteps() { + void WgtInstaller::PartialUninstallSteps() { AddStep(pkgmgr_); AddStep(); AddStep(); @@ -776,8 +694,4 @@ WgtInstaller::WgtInstaller(ci::PkgMgrPtr pkgrmgr) AddStep(); } - void WgtInstaller::DefaultSteps() { - AddStep(); - } - } // namespace wgt diff --git a/src/wgt/wgt_installer.h b/src/wgt/wgt_installer.h index 0c3a5e9..c25c2e1 100644 --- a/src/wgt/wgt_installer.h +++ b/src/wgt/wgt_installer.h @@ -26,26 +26,25 @@ class WgtInstaller : public common_installer::AppInstaller { explicit WgtInstaller(common_installer::PkgMgrPtr pkgrmgr); private: - void InstallSteps(); - void UpdateSteps(); - void UninstallSteps(); - void ReinstallSteps(); - void DeltaSteps(); - void RecoverySteps(); - void MountInstallSteps(); - void MountUpdateSteps(); - void ManifestDirectInstallSteps(); - void ManifestDirectUpdateSteps(); - void ReadonlyUpdateInstallSteps(); - void ReadonlyUpdateUninstallSteps(); - void ManifestPartialInstallSteps(); - void ManifestPartialUpdateSteps(); - void ManifestPartialUninstallSteps(); - void MoveSteps(); - void EnablePkgSteps(); - void DisablePkgSteps(); - void MigrateExtImgSteps(); - void DefaultSteps(); + void InstallSteps() override; + void UpdateSteps() override; + void UninstallSteps() override; + void ReinstallSteps() override; + void DeltaSteps() override; + void MoveSteps() override; + void RecoverySteps() override; + void MountInstallSteps() override; + void MountUpdateSteps() override; + void ManifestDirectInstallSteps() override; + void ManifestDirectUpdateSteps() override; + void ManifestPartialInstallSteps() override; + void ManifestPartialUpdateSteps() override; + void PartialUninstallSteps() override; + void ReadonlyUpdateInstallSteps() override; + void ReadonlyUpdateUninstallSteps() override; + void DisablePkgSteps() override; + void EnablePkgSteps() override; + void MigrateExtImgSteps() override; }; } // namespace wgt -- 2.7.4