Remove boost dependency
[platform/core/appfw/app-installers.git] / src / common / step / pkgmgr / step_register_app.cc
1 /* 2014, Copyright © Intel Coporation, license APACHE-2.0, see LICENSE file */
2
3 #include "common/step/pkgmgr/step_register_app.h"
4
5 #include <unistd.h>
6 #include <cassert>
7 #include <cstring>
8 #include <cstdio>
9 #include <string>
10
11 #include "common/pkgmgr_registration.h"
12 #include "common/utils/file_util.h"
13
14 namespace common_installer {
15 namespace pkgmgr {
16
17 Step::Status StepRegisterApplication::process() {
18   if (!RegisterAppInPkgmgr(context_->manifest_data.get(),
19                            context_->pkgid.get(),
20                            context_->certificate_info.get(),
21                            context_->uid.get(),
22                            context_->storage.get(),
23                            context_->request_mode.get(),
24                            context_->tep_path.get())) {
25     LOG(ERROR) << "Failed to register the app";
26     return Step::Status::REGISTER_ERROR;
27   }
28
29   LOG(INFO) << "Successfully registered the app";
30   return Status::OK;
31 }
32
33 Step::Status StepRegisterApplication::undo() {
34   if (!UnregisterAppInPkgmgr(context_->manifest_data.get(),
35                              context_->pkgid.get(),
36                              context_->uid.get(),
37                              context_->request_mode.get())) {
38     LOG(ERROR) << "Application couldn't be unregistered";
39     return Status::REGISTER_ERROR;
40   }
41
42   LOG(INFO) << "Successfuly clean database";
43   return Status::OK;
44 }
45
46 }  // namespace pkgmgr
47 }  // namespace common_installer