From efc1a32cdd2de2d7769e18faed1d41ada9f82982 Mon Sep 17 00:00:00 2001 From: Jihoon Chung Date: Wed, 6 Mar 2013 19:45:32 +0900 Subject: [PATCH] [Release] wrt-commons_0.2.101.1 Change-Id: I2fe15371e652ebb4414be9bc713d4db004333e3e --- packaging/wrt-commons.spec | 4 +- .../dpl/wrt-dao-ro/common_dao_types.h | 481 ------------------ .../dpl/wrt-dao-rw/widget_dao.h | 232 --------- .../mockup_src/widget_dao.cpp | 110 ---- 4 files changed, 2 insertions(+), 825 deletions(-) delete mode 100644 tests/files_localization/mockup_include/dpl/wrt-dao-ro/common_dao_types.h delete mode 100644 tests/files_localization/mockup_include/dpl/wrt-dao-rw/widget_dao.h delete mode 100644 tests/files_localization/mockup_src/widget_dao.cpp diff --git a/packaging/wrt-commons.spec b/packaging/wrt-commons.spec index 448f84a..8ef3064 100644 --- a/packaging/wrt-commons.spec +++ b/packaging/wrt-commons.spec @@ -1,7 +1,7 @@ -#git:framework/web/wrt-commons wrt-commons 0.2.101 +#git:framework/web/wrt-commons wrt-commons 0.2.101.1 Name: wrt-commons Summary: Wrt common library -Version: 0.2.101 +Version: 0.2.101.1 Release: 1 Group: Development/Libraries License: Apache License, Version 2.0 diff --git a/tests/files_localization/mockup_include/dpl/wrt-dao-ro/common_dao_types.h b/tests/files_localization/mockup_include/dpl/wrt-dao-ro/common_dao_types.h deleted file mode 100644 index 06b7294..0000000 --- a/tests/files_localization/mockup_include/dpl/wrt-dao-ro/common_dao_types.h +++ /dev/null @@ -1,481 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * - * @file common_dao_types.h - * @author Michal Ciepielski (m.ciepielski@samsung.com) - * @version 1.0 - * @brief This file contains the declaration of common data types for wrtdb - */ - -#ifndef WRT_SRC_CONFIGURATION_COMMON_DAO_TYPES_H_ -#define WRT_SRC_CONFIGURATION_COMMON_DAO_TYPES_H_ - -#include -#include -#include -#include -#include -#include -#include - -namespace WrtDB { -namespace Powder { -typedef std::set StringSet; -//! Widget description -struct Description -{ - //!Content level - typedef enum - { - Level0 = 0, - Level1, - Level2, - Level3, - Level4, - Level5, - LevelUnknown - } LevelEnum; - struct LevelEntry - { - LevelEnum level; //!< content level - - typedef StringSet Context; - - //! POWDER context - //! xa This material appears in an artistic context - //! xb This material appears in an educational context - //! xc This material appears in a medical context - //! xd This material appears in a sports context - //! xe This material appears in a violent context - Context context; - explicit LevelEntry(LevelEnum level = LevelUnknown); - //! Function checks if context is valid - //! \param[in] level POWDER content level - //! \param[in] context POWDER context - bool isContextValid(LevelEnum level, - const DPL::OptionalString& context) const; - }; - - struct CategoryEntry - { - //! Levels entries for POWDER description - typedef std::vector LevelsContainer; - LevelsContainer levels; - //! Function checks if context is valid - //! \param[out] reason set if context invalid - //! \param[in] level POWDER content level - //! \param[in] context POWDER context - bool isCategoryValid(LevelEntry& reason, - LevelEnum level, - const DPL::OptionalString& context) const; - }; - - //! POWDER Category -> Category entry map for Widget - //! - //! nu Nudity - //! se Sex - //! vi Violence - //! la Potentially offensive language - //! dr Drug use - //! ga Gambling - //! ha Hate or harmful activities - //! ug Use of user-generated content - typedef std::map CategoryEntries; - - CategoryEntries categories; - - //! Age rating for widget - //! If Null not set - DPL::OptionalInt ageRating; -}; -} // namespace Powder - -namespace ChildProtection { -//! Blacklist with forbidden URLs -//! It should be stored in WidgetDAO -typedef std::vector BlackList; - -//! Widget Child protection record -//! Record should be stored in WingetDAO -struct Record -{ - //! Child protection enabled - bool enabled; - explicit Record(bool enabled) : - enabled(enabled) - {} -}; - -//! Powder processing -struct PowderRules -{ - //! Rule set by parent about forbidden category - //! Powder category - //! nu Nudity - //! se Sex - //! vi Violence - //! la Potentially offensive language - //! dr Drug use - //! ga Gambling - //! ha Hate or harmful activities - //! ug Use of user-generated content - //! Powder context - //! xa This material appears in an artistic conteaxt - //! xb This material appears in an educational context - //! xc This material appears in a medical context - //! xd This material appears in a sports context - //! xe This material appears in a violent context - struct CategoryRule - { - DPL::String category; - Powder::Description::LevelEnum level; - DPL::OptionalString context; - explicit CategoryRule( - const DPL::String& category = DPL::String(), - Powder::Description::LevelEnum level = - Powder::Description::LevelUnknown, - const DPL::OptionalString& context = - DPL::OptionalString()); - }; - - struct PowderResult - { - //! Reasoning outcome: part of POWDER description used to invalidate - Powder::Description::LevelEntry invalidDescription; - //! Reasoning outcome: rule set by parent not full filed by description - CategoryRule invalidRule; - - //! Reasoning outcome: type of invalidity - enum InvalidReason - { - InvalidRule, //!< One of rules was not fulfilled - InvalidAge, //!< Age is invalid - AgeRatingNotSet, //!< Age rating for widget is not set - Valid //!< Description valid - }; - InvalidReason reason; - explicit PowderResult( - InvalidReason reason = Valid, - const Powder::Description::LevelEntry& - invalidDescription = - Powder::Description::LevelEntry(), - const CategoryRule& invalidRule = CategoryRule()); - }; - - typedef std::pair ResultPair; - - //! Function checks if rule is fulfilled by description - //! \param[in] rule checked rule - //! \param[in] description - //! \retval true rule is valid - //! \retval false rule is invalid - ResultPair isRuleValidForDescription(const CategoryRule& rule, - const Powder::Description& description) - const; - //! Function checks if age limit is fulfilled by description - //! \param[in] description - //! \retval true age is valid - //! \retval false age is invalid - ResultPair isAgeValidForDescription( - const Powder::Description& description) const; - - //! It is the maximum age rating valid for child - //! Uniform age is stored in WidgetDAO - DPL::OptionalInt ageLimit; - - //! Set to true if age rating is required - //! If ageLimit is not set value is ignored - bool isAgeRatingRequired; - - //! Set of rules configured by parent - //! Rules are stored in WidgetDAO and are uniform for all widgets - typedef std::vector RulesContainer; - RulesContainer rules; - - //! Function check if Widget description is valid for ChildProtection - //! configuration - //! \param description widget description - //! \retval true widget is valid - //! \retval false widget is invalid - ResultPair isDescriptionValid(const Powder::Description& description) - const; - - PowderRules() : - isAgeRatingRequired(false) - {} -}; -} // namespace ChildProtection - -class PluginMetafileData -{ - public: - struct Feature - { - std::string m_name; - std::set m_deviceCapabilities; - - bool operator< (const Feature& obj) const - { - return m_name < obj.m_name; - } - }; - typedef std::set FeatureContainer; - - public: - - PluginMetafileData() - {} - - std::string m_libraryName; - std::string m_featuresInstallURI; - std::string m_featuresKeyCN; - std::string m_featuresRootCN; - std::string m_featuresRootFingerprint; - - FeatureContainer m_featureContainer; -}; - -class PluginObjectsDAO -{ - public: - typedef std::set Objects; - typedef std::shared_ptr ObjectsPtr; - - public: - explicit PluginObjectsDAO() {} - - protected: - ObjectsPtr m_implemented; - ObjectsPtr m_dependent; -}; - -/** - * @brief Widget id describes web-runtime global widget identifier. - * - * Notice that only up to one widget can exist at the same time. - * DbWidgetHandle can be translated into corresponding WidgetModel by invoking - * FindWidgetModel routine. - */ -typedef int DbWidgetHandle; - -/** - * @brief Structure to hold the information of widget's size - */ -struct DbWidgetSize -{ - DPL::OptionalInt width; - DPL::OptionalInt height; - - DbWidgetSize(DPL::OptionalInt w = DPL::OptionalInt::Null, - DPL::OptionalInt h = DPL::OptionalInt::Null) : - width(w), - height(h) - {} -}; - -inline bool operator ==(const DbWidgetSize &objA, const DbWidgetSize &objB) -{ - if (!objA.height || !objA.width || !objB.width || !objB.height) { - return false; - } else { - return *objA.height == *objB.height && *objA.width == *objB.width; - } -} - -/** - * Widget [G]lobal [U]nique [ID]entifier - * Orginated from appstore ID - */ -typedef DPL::OptionalString WidgetGUID; - -struct WidgetAccessInfo -{ - DPL::String strIRI; /* origin iri */ - bool bSubDomains; /* do we want access to subdomains ? */ - - bool operator ==(const WidgetAccessInfo& info) const - { - return info.strIRI == strIRI && - info.bSubDomains == bSubDomains; - } -}; - -typedef std::list WidgetAccessInfoList; - -typedef std::list WindowModeList; - -/** - * @brief Widget configuration parameter key - */ -typedef DPL::String WidgetParamKey; - -/** - * @brief Widget configuration parameter value - */ -typedef DPL::String WidgetParamValue; - -/** - * @brief A map of widget configuration parameters. - * - * Widget configuration parameters are read from database and are stored - * along with feature that they describe. - */ -typedef std::multimap WidgetParamMap; - -/** - * @brief Widget feature host information about possible javascript extensions - * that widget may use - * - * Widget features are declared in configuration file in widget installation - * package. Each declared special feature is contained in some wrt-plugin that - * declares to implement it. After widget launch wrt searches for proper plugin - * libraries and load needed features. - * - * Widget features can be required or optional. It is possible to start widget - * without missing feature. When required feature cannot be loaded widget will - * not start. - */ - -enum { - INVALID_PLUGIN_HANDLE = -1 -}; -typedef int DbPluginHandle; - -struct DbWidgetFeature -{ - DPL::String name; /// Feature name - bool required; /// Whether feature is required - DbPluginHandle pluginId; /// Plugin id that implement this - // feature - WidgetParamMap params; /// Widget's params - - DbWidgetFeature() : - required(false), - pluginId(INVALID_PLUGIN_HANDLE) - {} -}; - -inline bool operator < (const DbWidgetFeature &objA, - const DbWidgetFeature &objB) -{ - return objA.name.compare(objB.name) < 0; -} - -inline bool operator==(const DbWidgetFeature &featureA, - const DbWidgetFeature &featureB) -{ - return featureA.name == featureB.name && - featureA.required == featureB.required && - featureA.pluginId == featureB.pluginId; -} - -/** - * @brief Default container for features list - */ -typedef std::multiset DbWidgetFeatureSet; - -/** - * @brief Default container with DbWidgetHandle's - */ -typedef std::list DbWidgetHandleList; - -/** - * @brief Widget specific type - * - * Widget type describes belowed in WAC, TIZEN WebApp - */ -enum AppType -{ - APP_TYPE_UNKNOWN = 0, // unknown - APP_TYPE_WAC20, // WAC 2.0 - APP_TYPE_TIZENWEBAPP, // slp webapp -}; - -class WidgetType -{ - public: - WidgetType() : - appType(APP_TYPE_UNKNOWN) - {} - WidgetType(const AppType type) : - appType(type) - {} - bool operator== (const AppType& other) const - { - return appType == other; - } - std::string getApptypeToString() - { - switch (appType) { -#define X(x) case x: return #x; - X(APP_TYPE_UNKNOWN) - X(APP_TYPE_WAC20) - X(APP_TYPE_TIZENWEBAPP) -#undef X - default: - return "UNKNOWN"; - } - } - - AppType appType; -}; -} // namespace WrtDB - -struct WidgetSetting -{ - DPL::String settingName; - DPL::String settingValue; - - bool operator ==(const WidgetSetting& info) const - { - return (info.settingName == settingName && - info.settingValue == settingValue); - } - bool operator !=(const WidgetSetting& info) const - { - return (info.settingName != settingName || - info.settingValue != settingValue); - } -}; - -typedef std::list WidgetSettings; - -/** - * @brief Widget Application Service - * - * Application sercvice describes details of behaviour - * when widget receives aul bundle data. - */ -struct WidgetApplicationService -{ - public: - DPL::String src; /* start uri */ - DPL::String operation; /* service name */ - DPL::String scheme; /* scheme type*/ - DPL::String mime; /* mime type */ - - bool operator== (const WidgetApplicationService& other) const - { - return src == other.src && - operation == other.operation && - scheme == other.scheme && - mime == other.mime; - } -}; - -typedef std::list WidgetApplicationServiceList; -#endif /* WRT_SRC_CONFIGURATION_COMMON_DAO_TYPES_H_ */ diff --git a/tests/files_localization/mockup_include/dpl/wrt-dao-rw/widget_dao.h b/tests/files_localization/mockup_include/dpl/wrt-dao-rw/widget_dao.h deleted file mode 100644 index 264c6e4..0000000 --- a/tests/files_localization/mockup_include/dpl/wrt-dao-rw/widget_dao.h +++ /dev/null @@ -1,232 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * This file contains the declaration of widget dao class. - * - * @file widget_dao_read_only.h - * @author Yang Jie (jie2.yang@samsung.com) - * @author Przemyslaw Dobrowolski (p.dobrowolsk@samsung.com) - * @author Pawel Sikorski (p.sikorski@samsung.com) - * @version 1.0 - * @brief This file contains the declaration of widget dao - */ - -#ifndef _WRT_SRC_CONFIGURATION_WIDGET_DAO_READ_ONLY_H_ -#define _WRT_SRC_CONFIGURATION_WIDGET_DAO_READ_ONLY_H_ - -#include - -#include -#include -#include -#include - -#include -#include -#include - -#include -//#include "../wrt-dao-ro/common_dao_types.h" - -typedef DPL::OptionalString WidgetGUID; - -namespace ConfigParserData { -struct Icon -{ - Icon(const DPL::String& src) : src(src) - {} - DPL::String src; - DPL::OptionalInt width; - DPL::OptionalInt height; - bool operator==(const Icon&) const; - bool operator!=(const Icon&) const; - bool operator >(const Icon&) const; - bool operator>=(const Icon&) const; - bool operator <(const Icon&) const; - bool operator<=(const Icon&) const; -}; -} // namespace ConfigParserData -namespace WrtDB { -typedef std::list StringList; - -struct WidgetLocalizedInfo -{ - DPL::OptionalString name; - DPL::OptionalString shortName; - DPL::OptionalString description; - DPL::OptionalString license; - DPL::OptionalString licenseHref; -}; - -typedef std::list LanguageTagList; - -class WidgetDAO -{ - public: - /** - * WidgetDAO Exception classes - */ - class Exception - { - public: - DECLARE_EXCEPTION_TYPE(DPL::Exception, Base) - DECLARE_EXCEPTION_TYPE(Base, DatabaseError) - DECLARE_EXCEPTION_TYPE(Base, ReadOnlyProperty) - DECLARE_EXCEPTION_TYPE(Base, GUIDisNull) - DECLARE_EXCEPTION_TYPE(Base, UnexpectedEmptyResult) - DECLARE_EXCEPTION_TYPE(Base, WidgetNotExist) - DECLARE_EXCEPTION_TYPE(Base, AlreadyRegistered) - }; - - protected: - DbWidgetHandle m_widgetHandle; - - public: - struct WidgetLocalizedIconRow - { - int appId; - int iconId; - DPL::String widgetLocale; - }; - typedef std::list WidgetLocalizedIconList; - - struct WidgetIconRow - { - int iconId; - int appId; - DPL::String iconSrc; - DPL::OptionalInt iconWidth; - DPL::OptionalInt iconHeight; - }; - typedef std::list WidgetIconList; - - struct WidgetStartFileRow - { - int startFileId; - int appId; - DPL::String src; - }; - typedef std::list WidgetStartFileList; - - struct WidgetLocalizedStartFileRow - { - int startFileId; - int appId; - DPL::String widgetLocale; - DPL::String type; - DPL::String encoding; - }; - typedef std::list LocalizedStartFileList; - - /** - * This is a constructor. - * - * @param[in] widgetHandle application id of widget. - */ - WidgetDAO(DbWidgetHandle widgetHandle) : - m_widgetHandle(widgetHandle) - {} - - /** - * Destructor - */ - virtual ~WidgetDAO(){} - - /** - * This method returns widget handle(m_widgetHandle). - * - * @return widget handle(m_widgetHandle). - * @exception WRT_CONF_ERR_EMDB_FAILURE - Fail to query DB table. - * @exception WRT_CONF_ERR_EMDB_NO_RECORD - Can not find matching records in - * DB table. - */ - DbWidgetHandle getHandle() const - { - return m_widgetHandle; - } - DbWidgetHandle getHandle(const WidgetGUID GUID) const; - static DbWidgetHandle getHandle(const DPL::String tizenAppId); - - /** - * This method returns the root directory of widget resource. - * - * @return path name of root directory. - * @exception WRT_CONF_ERR_EMDB_FAILURE - Fail to query DB table. - * @exception WRT_CONF_ERR_EMDB_NO_RECORD - Can not find matching records in - * DB table. - */ - DPL::String getPath() const; - void setPath(const DPL::String &path) const; - - /** - * This method returns the defaultlocale for the widget. - * - * @return defaultlocale - * @exception WRT_CONF_ERR_EMDB_FAILURE - Fail to query DB table. - * @exception WRT_CONF_ERR_EMDB_NO_RECORD - Can not find matching records in - * DB table. - */ - DPL::OptionalString getDefaultlocale() const; - - /** - * This method returns list of localized icons files; - * - * @exception WRT_CONF_ERR_EMDB_FAILURE - Fail to query DB table. - * @exception WRT_CONF_ERR_EMDB_NO_RECORD - Can not find matching records in - * DB table. - */ - WidgetLocalizedIconList getLocalizedIconList() const; - - /** - * This method returns list of icons files; - * - * @exception WRT_CONF_ERR_EMDB_FAILURE - Fail to query DB table. - * @exception WRT_CONF_ERR_EMDB_NO_RECORD - Can not find matching records in - * DB table. - */ - WidgetIconList getIconList() const; - - /** - * This method returns list of localized start files; - * - * @exception WRT_CONF_ERR_EMDB_FAILURE - Fail to query DB table. - * @exception WRT_CONF_ERR_EMDB_NO_RECORD - Can not find matching records in - * DB table. - */ - LocalizedStartFileList getLocalizedStartFileList() const; - void setLocalizedStartFileList(const LocalizedStartFileList &list) const; - /** - * This method returns list of start files; - * - * @exception WRT_CONF_ERR_EMDB_FAILURE - Fail to query DB table. - * @exception WRT_CONF_ERR_EMDB_NO_RECORD - Can not find matching records in - * DB table. - */ - WidgetStartFileList getStartFileList() const; - void setStartFileList(const WidgetStartFileList &list) const; - - WidgetLocalizedInfo getLocalizedInfo(const DPL::String& languageTag) const; - - protected: - static std::map s_startFileMap; - static std::map s_localizedStartFileMap; - static std::map s_pathMap; -}; -} // namespace WrtDB - -#endif // _WRT_SRC_CONFIGURATION_WIDGET_DAO_READ_ONLY_H_ - diff --git a/tests/files_localization/mockup_src/widget_dao.cpp b/tests/files_localization/mockup_src/widget_dao.cpp deleted file mode 100644 index 170aad7..0000000 --- a/tests/files_localization/mockup_src/widget_dao.cpp +++ /dev/null @@ -1,110 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * This file contains the declaration of widget dao class. - * - * @file widget_dao_read_only.cpp - * @author Yang Jie (jie2.yang@samsung.com) - * @author Przemyslaw Dobrowolski (p.dobrowolsk@samsung.com) - * @author Pawel Sikorski (p.sikorski@samsung.com) - * @version 1.0 - * @brief This file contains the declaration of widget dao - */ - -//#include "../mockup_include/dpl/wrt-dao-rw/widget_dao.h" -#include - -#include -#include -#include -#include - -namespace WrtDB { -std::map WidgetDAO::s_startFileMap; -std::map WidgetDAO::s_localizedStartFileMap; -std::map WidgetDAO::s_pathMap; - -DbWidgetHandle WidgetDAO::getHandle(const WidgetGUID /* GUID */) const -{ - LogError("Not impleneted!"); - return 0; -} - -DbWidgetHandle WidgetDAO::getHandle(const DPL::String /* tizenAppId */) -{ - LogError("Not implemented!"); - return 0; -} - -DPL::String WidgetDAO::getPath() const -{ - return s_pathMap[m_widgetHandle]; -} - -void WidgetDAO::setPath(const DPL::String &path) const -{ - s_pathMap[m_widgetHandle] = path; -} - -WidgetLocalizedInfo -WidgetDAO::getLocalizedInfo(const DPL::String& /* languageTag */) -const -{ - LogError("Not implemented!"); - return WidgetLocalizedInfo(); -} - -DPL::OptionalString WidgetDAO::getDefaultlocale() const -{ - LogError("Not implemented!"); - return DPL::OptionalString(); -} - -WidgetDAO::WidgetLocalizedIconList WidgetDAO::getLocalizedIconList() const -{ - LogError("Not implemented!"); - return WidgetLocalizedIconList(); -} - -WidgetDAO::WidgetIconList WidgetDAO::getIconList() const -{ - LogError("Not implemented!"); - return WidgetIconList(); -} - -WidgetDAO::LocalizedStartFileList WidgetDAO::getLocalizedStartFileList() const -{ - return s_localizedStartFileMap[m_widgetHandle]; -} - -void WidgetDAO::setLocalizedStartFileList(const LocalizedStartFileList &list) -const -{ - s_localizedStartFileMap[m_widgetHandle] = list; -} - -WidgetDAO::WidgetStartFileList WidgetDAO::getStartFileList() const -{ - return s_startFileMap[m_widgetHandle]; -} - -void WidgetDAO::setStartFileList(const WidgetStartFileList &list) const -{ - s_startFileMap[m_widgetHandle] = list; -} -} // namespace WrtDB -- 2.34.1