Imported Upstream version 0.9.2
[platform/upstream/iotivity.git] / service / resource-encapsulation / include / RCSResourceContainer.h
1 //******************************************************************
2 //
3 // Copyright 2015 Samsung Electronics All Rights Reserved.
4 //
5 //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
6 //
7 // Licensed under the Apache License, Version 2.0 (the "License");
8 // you may not use this file except in compliance with the License.
9 // You may obtain a copy of the License at
10 //
11 //      http://www.apache.org/licenses/LICENSE-2.0
12 //
13 // Unless required by applicable law or agreed to in writing, software
14 // distributed under the License is distributed on an "AS IS" BASIS,
15 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 // See the License for the specific language governing permissions and
17 // limitations under the License.
18 //
19 //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
20
21 /**
22  * @file
23  *
24  * This file contains the resource container APIs provided to the developers.
25  */
26
27 #ifndef RCSRESOURCECONTAINER_H_
28 #define RCSRESOURCECONTAINER_H_
29
30 #include <iostream>
31 #include <string>
32 #include <vector>
33 #include <map>
34 #include <list>
35
36 #include "RCSBundleInfo.h"
37
38 namespace OIC
39 {
40     namespace Service
41     {
42
43         /**
44          * @class   ResourceContainer
45          * @brief    This class provides APIs for managing the container and bundles in the container.
46          *
47          */
48         class RCSResourceContainer
49         {
50             public:
51                 /**
52                 * Constructor
53                 */
54                 RCSResourceContainer();
55
56                 /**
57                 *virtual Destructor
58                 */
59                 virtual ~RCSResourceContainer();
60
61                 /**
62                  * API for starting the Container
63                  *
64                  * @details This API start the container with the provided Configuration file.
65                  *
66                  * @param configFile - configuration File that contains the Bundle/Bundles information.
67                  *
68                  */
69                 virtual void startContainer(const std::string &configFile) = 0;
70                 /**
71                 * API for stopping the Container
72                 */
73                 virtual void stopContainer() = 0;
74
75                 // list of bundle ids
76                 /**
77                 * API for getting the list of all bundles in the container
78                 *
79                 * @return  list<BundleInfo*> -List of BundleInfo pointer each associated with a bundle
80                 *
81                 */
82                 virtual std::list<RCSBundleInfo *> listBundles() = 0;
83                 /**
84                  * API for starting the bundle.
85                  *
86                  * @param bundleId - Id of the Bundle
87                  *
88                  */
89                 virtual void startBundle(const std::string &bundleId) = 0;
90                 /**
91                 * API for Stopping the bundle
92                 *
93                 * @param bundleId - Id of the Bundle
94                 *
95                 */
96                 virtual void stopBundle(const std::string &bundleId) = 0;
97
98                 // dynamic configuration
99                 /**
100                  * API for adding the bundle to the Container
101                  *
102                  * @param bundleId - Id of the Bundle
103                  * @param bundleUri - Uri of the bundle
104                  * @param bundlePath - Path of the bundle
105                  * @param params  - key-value pairs in string form for other Bundle parameters
106                  *
107                  */
108                 virtual void addBundle(const std::string &bundleId, const std::string &bundleUri, const std::string &bundlePath,
109                                        std::map<std::string, std::string> params) = 0;
110                 /**
111                  * API for removing the bundle from the container
112                  *
113                  * @param bundleId - Id of the Bundle
114                  *
115                  */
116                 virtual void removeBundle(const std::string &bundleId) = 0;
117
118                 /**
119                 * API for adding the Resource configuration information to the bundle
120                 *
121                 * @param bundleId - Id of the Bundle
122                 * @param resourceUri - URI of the resource
123                 * @param params  - key-value pairs in string form for other Bundle parameters
124                 *
125                 */
126                 virtual void addResourceConfig(const std::string &bundleId, const std::string &esourceUri,
127                                                std::map<std::string, std::string> params) = 0;
128                 /**
129                 * API for removing the Resource configuration information from the bundle
130                 *
131                 * @param bundleId - Id of the Bundle
132                 * @param resourceUri - URI of the resource
133                 *
134                 */
135                 virtual void removeResourceConfig(const std::string &bundleId, const std::string &resourceUri) = 0;
136
137                 /**
138                 * API for getting the list of Bundle Resources
139                 *
140                 * @param bundleId - Id of the Bundle
141                 *
142                 */
143                 virtual std::list<std::string> listBundleResources(const std::string &bundleId) = 0;
144
145                 /**
146                  * API for getting the Instance of ResourceContainer class
147                  *
148                  * @return RCSResourceContainer - Instance of the "RCSResourceContainer" class
149                  *
150                  */
151                 static RCSResourceContainer *getInstance();
152         };
153     }
154 }
155
156 #endif /* RCSRESOURCECONTAINER_H_ */