2 * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
19 * @file AceDAOReadOnly.h
20 * @author Krzysztof Jackiewicz (k.jackiewicz@samsung.com)
21 * @author Grzegorz Krawczyk (g.krawczyk@samsung.com)
26 #ifndef ACE_DAO_READ_ONLY_H_
27 #define ACE_DAO_READ_ONLY_H_
31 #include <openssl/md5.h>
32 #include <dpl/string.h>
33 #include <dpl/exception.h>
34 #include <ace-dao-ro/PreferenceTypes.h>
35 #include <ace-dao-ro/BaseAttribute.h>
36 #include <ace-dao-ro/BasePermission.h>
37 #include <ace-dao-ro/AppTypes.h>
38 #include <ace-dao-ro/IRequest.h>
39 #include <ace/PolicyEffect.h>
40 #include <ace/PolicyResult.h>
41 #include <ace/PromptDecision.h>
42 #include <ace-dao-ro/common_dao_types.h>
46 typedef std::map<DPL::String, bool> RequestedDevCapsMap;
47 typedef DPL::String FeatureName;
48 typedef std::vector<FeatureName> FeatureNameVector;
56 DECLARE_EXCEPTION_TYPE(DPL::Exception, Base)
57 DECLARE_EXCEPTION_TYPE(Base, DatabaseError)
62 static void attachToThreadRO(void);
63 static void attachToThreadRW(void);
64 static void detachFromThread(void);
66 // policy effect/decision
67 static OptionalExtendedPolicyResult getPolicyResult(
68 const BaseAttributeSet &attributes);
70 static OptionalExtendedPolicyResult getPolicyResult(
71 const DPL::String &attrHash);
73 static OptionalCachedPromptDecision getPromptDecision(
74 WidgetHandle widgetHandle,
78 static PreferenceTypes getDevCapSetting(const std::string &resource);
79 static void getDevCapSettings(PreferenceTypesMap *preferences);
82 static void getWidgetDevCapSettings(BasePermissionList *permissions);
83 static PreferenceTypes getWidgetDevCapSetting(
84 const std::string &resource,
85 WidgetHandle handler);
87 static void getAttributes(BaseAttributeSet *attributes);
89 // Getter for device capabilities that are requested in widgets config.
91 // Additional boolean flag means whether widget will always get
92 // (at launch) the SMACK permissions needed to use the device cap).
94 // 'permissions' is the map of device cap names and smack status for
95 // given widget handle.
96 static void getRequestedDevCaps(
97 WidgetHandle widgetHandle,
98 RequestedDevCapsMap *permissions);
100 static void getAcceptedFeature(
101 WidgetHandle widgetHandle,
102 FeatureNameVector *featureVector);
104 static WidgetHandleList getHandleList();
106 static AppTypes getWidgetType(WidgetHandle handle);
107 static std::string getVersion(WidgetHandle widgetHandle);
108 static std::string getAuthorName(WidgetHandle widgetHandle);
109 static std::string getGUID(WidgetHandle widgetHandle);
111 static WidgetCertificateCNList getKeyCommonNameList(
112 WidgetHandle widgetHandle,
113 WidgetCertificateData::Owner owner,
114 WidgetCertificateData::Type type);
115 static FingerPrintList getKeyFingerprints(
116 WidgetHandle widgetHandle,
117 WidgetCertificateData::Owner owner,
118 WidgetCertificateData::Type type);
120 static std::string getShareHref(WidgetHandle widgetHandle);
121 static bool isWidgetInstalled(WidgetHandle handle);
124 static int promptDecisionToInt(PromptDecision decision);
125 static PromptDecision intToPromptDecision(int decision);
126 static int appTypeToInt(AppTypes app_type);
127 static AppTypes intToAppType(int app_type);