These classes is moved to app-installer library.
Change-Id: I0a22d5b04826b53f7bec946951632daf7c02bf42
Signed-off-by: Sangyoon Jang <jeremy.jang@samsung.com>
+++ /dev/null
-// Copyright (c) 2020 Samsung Electronics Co., Ltd All Rights Reserved
-// Use of this source code is governed by an apache-2.0 license that can be
-// found in the LICENSE file.
-
-#ifndef UNIFIED_INSTALLER_FACTORY_H_
-#define UNIFIED_INSTALLER_FACTORY_H_
-
-#include <common/pkgmgr_interface.h>
-
-#include <memory>
-
-namespace common_installer {
-
-class AppInstaller;
-
-class InstallerFactory {
- public:
- virtual std::unique_ptr<AppInstaller> CreateInstaller(PkgMgrPtr pkgmgr,
- int idx) = 0;
-};
-
-} // namespace common_installer
-
-#endif // UNIFIED_INSTALLER_FACTORY_H_
+++ /dev/null
-// Copyright (c) 2020 Samsung Electronics Co., Ltd All Rights Reserved
-// Use of this source code is governed by an apache 2.0 license that can be
-// found in the LICENSE file.
-
-#include "unified/installer_runner.h"
-
-#include <common/app_installer.h>
-#include <common/pkgmgr_interface.h>
-#include <manifest_parser/utils/logging.h>
-
-#include <list>
-
-#include "unified/installer_factory.h"
-
-namespace common_installer {
-
-InstallerRunner::InstallerRunner(
- std::unique_ptr<InstallerFactory> factory, PkgMgrPtr pkgmgr)
- : factory_(std::move(factory)), pkgmgr_(pkgmgr) {
- if (!Init())
- LOG(ERROR) << "Initialize failed!";
-}
-
-AppInstaller::Result InstallerRunner::Run() {
- AppInstaller::Result result = AppInstaller::Result::OK;
- std::list<std::unique_ptr<AppInstaller>>::iterator it(installers_.begin());
- for (; it != installers_.end(); ++it) {
- result = (*it)->Process();
- if (result != AppInstaller::Result::OK)
- break;
- }
- if (it != installers_.end() && result == AppInstaller::Result::ERROR) {
- do {
- if ((*it)->Undo() != AppInstaller::Result::OK)
- result = AppInstaller::Result::UNDO_ERROR;
- } while (it-- != installers_.begin());
- } else {
- --it;
- do {
- if ((*it)->Clean() != AppInstaller::Result::OK)
- result = AppInstaller::Result::CLEANUP_ERROR;
- } while (it-- != installers_.begin());
- }
-
- return result;
-}
-
-bool InstallerRunner::Init() {
- for (int i = 0; i < pkgmgr_->GetRequestInfoCount(); i++) {
- std::unique_ptr<AppInstaller> installer =
- factory_->CreateInstaller(pkgmgr_, i);
- installers_.emplace_back(std::move(installer));
- }
-
- return true;
-}
-
-} // namespace common_installer
+++ /dev/null
-// Copyright (c) 2020 Samsung Electronics Co., Ltd All Rights Reserved
-// Use of this source code is governed by an apache 2.0 license that can be
-// found in the LICENSE file.
-
-#ifndef UNIFIED_INSTALLER_RUNNER_H_
-#define UNIFIED_INSTALLER_RUNNER_H_
-
-#include <common/app_installer.h>
-#include <common/pkgmgr_interface.h>
-
-#include <memory>
-#include <list>
-
-namespace common_installer {
-
-class InstallerFactory;
-
-class InstallerRunner {
- public:
- explicit InstallerRunner(
- std::unique_ptr<InstallerFactory> factory, PkgMgrPtr pkgmgr);
-
- AppInstaller::Result Run();
-
- private:
- bool Init();
-
- std::unique_ptr<InstallerFactory> factory_;
- PkgMgrPtr pkgmgr_;
- std::list<std::unique_ptr<AppInstaller>> installers_;
-};
-
-} // namespace common_installer
-
-#endif // UNIFIED_INSTALLER_RUNNER_H_
// found in the LICENSE file.
#include <common/app_installer.h>
+#include <common/installer_factory.h>
+#include <common/installer_runner.h>
-#include "unified/installer_factory.h"
-#include "unified/installer_runner.h"
#include "unified/unified_installer_factory.h"
namespace ci = common_installer;
#ifndef UNIFIED_UNIFIED_INSTALLER_FACTORY_H_
#define UNIFIED_UNIFIED_INSTALLER_FACTORY_H_
+#include <common/installer_factory.h>
#include <common/pkgmgr_interface.h>
#include <memory>
-#include "unified/installer_factory.h"
-
namespace common_installer {
class AppInstaller;