Fix to apply whitespace coding rules
[platform/core/security/krate.git] / lib / manager.cpp
1 /*
2  *  Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved
3  *
4  *  Licensed under the Apache License, Version 2.0 (the "License");
5  *  you may not use this file except in compliance with the License.
6  *  You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  *  Unless required by applicable law or agreed to in writing, software
11  *  distributed under the License is distributed on an "AS IS" BASIS,
12  *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  *  See the License for the specific language governing permissions and
14  *  limitations under the License
15  */
16
17 #include "rmi/manager.h"
18
19 namespace Krate {
20
21 Manager::Manager(KrateControlContext& ctx) :
22         context(ctx)
23 {
24 }
25
26 Manager::~Manager()
27 {
28 }
29
30 int Manager::createKrate(const std::string& name, const std::string& setupWizAppid)
31 {
32         try {
33                 return context->methodCall<int>("Manager::createKrate", name, setupWizAppid);
34         } catch (runtime::Exception& e) {
35                 return -1;
36         }
37 }
38
39 int Manager::removeKrate(const std::string& name)
40 {
41         try {
42                 return context->methodCall<int>("Manager::removeKrate", name);
43         } catch (runtime::Exception& e) {
44                 return -1;
45         }
46 }
47
48 int Manager::lockKrate(const std::string& name)
49 {
50         try {
51                 return context->methodCall<int>("Manager::lockKrate", name);
52         } catch (runtime::Exception& e) {
53                 return -1;
54         }
55 }
56
57 int Manager::unlockKrate(const std::string& name)
58 {
59         try {
60                 return context->methodCall<int>("Manager::unlockKrate", name);
61         } catch (runtime::Exception& e) {
62                 return -1;
63         }
64 }
65
66 int Manager::getKrateState(const std::string& name)
67 {
68         try {
69                 return context->methodCall<int>("Manager::getKrateState", name);
70         } catch (runtime::Exception& e) {
71                 return -1;
72         }
73 }
74
75 std::vector<std::string> Manager::getKrateList(int state)
76 {
77         std::vector<std::string> empty;
78         try {
79                 return context->methodCall<std::vector<std::string>>("Manager::getKrateList", state);
80         } catch (runtime::Exception& e) {
81                 return empty;
82         }
83 }
84
85 int Manager::resetKratePassword(const std::string& name, const std::string& newPassword)
86 {
87         try {
88                 return context->methodCall<int>("Manager::resetKratePassword", name, newPassword);
89         } catch (runtime::Exception& e) {
90                 return -1;
91         }
92 }
93
94 } // namespace Krate