tizen beta release
[framework/web/wrt-installer.git] / src / security / attribute_facade.h
1 /*
2  * Copyright (c) 2011 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  * @file    attribute_facade.h
18  * @author  Jaroslaw Osmanski (j.osmanski@samsung.com)
19  * @author  Przemyslaw Dobrowolski (p.dobrowolsk@samsung.com)
20  * @version 1.0
21  * @brief   This file contains the declaration of WebRuntimeImpl,
22  *          ResourceInformationImpl, OperationSystemImpl
23  */
24
25 #ifndef ATTRIBUTE_FACADE_H
26 #define ATTRIBUTE_FACADE_H
27
28 #include <string>
29 #include <map>
30 #include <vector>
31
32 #include <dpl/ace/WRT_INTERFACE.h>
33
34 class Request;
35
36 class WebRuntimeImpl : public IWebRuntime
37 {
38   public:
39     // Return current sessionId
40     int getAttributesValuesLoop(const Request &request,
41             std::list<ATTRIBUTE>* attributes,
42             WidgetExecutionPhase executionPhase);
43
44     int getAttributesValues(const Request &request,
45             std::list<ATTRIBUTE>* attributes);
46     virtual std::string getSessionId(const Request &request);
47     WebRuntimeImpl();
48 };
49
50 class ResourceInformationImpl : public IResourceInformation
51 {
52   public:
53     int getAttributesValuesLoop(const Request &request,
54             std::list<ATTRIBUTE>* attributes,
55             WidgetExecutionPhase executionPhase);
56     int getAttributesValues(const Request &request,
57             std::list<ATTRIBUTE>* attributes);
58     ResourceInformationImpl();
59 };
60
61 class OperationSystemImpl : public IOperationSystem
62 {
63   public:
64     /**
65      * gather and set attributes values for specified attribute name
66      * @param attributes is a list of pairs(
67      *   first:   pointer to attribute name
68      *   second: list of values for attribute (std::string)  -
69      *   its a list of string (BONDI requirement), but usually there
70      *   will be only one string
71      */
72     int getAttributesValues(const Request &request,
73             std::list<ATTRIBUTE>* attributes);
74     OperationSystemImpl();
75 };
76
77 class FunctionParamImpl : public IFunctionParam
78 {
79   public:
80     virtual int getAttributesValues(const Request & /*request*/,
81             std::list<ATTRIBUTE> *attributes);
82     void addAttribute(const std::string &key,
83             const std::string &value)
84     {
85         paramMap.insert(make_pair(key, value));
86     }
87     virtual ~FunctionParamImpl()
88     {
89     }
90
91   private:
92     typedef std::multimap<std::string, std::string> ParamMap;
93     ParamMap paramMap;
94 };
95
96 typedef std::vector <FunctionParamImpl> FunctionParams;
97
98 #endif //ATTRIBUTE_FACADE_H