Update wrt-commons_0.2.67
authorSoyoung Kim <sy037.kim@samsung.com>
Thu, 25 Oct 2012 10:14:06 +0000 (19:14 +0900)
committerSoyoung Kim <sy037.kim@samsung.com>
Thu, 25 Oct 2012 10:14:06 +0000 (19:14 +0900)
46 files changed:
CMakeLists.txt
debian/changelog
etc/wrt_commons_create_clean_db.sh
etc/wrt_commons_reset_db.sh
modules/encryption/src/resource_decryption.cpp
modules/encryption/src/resource_encryption.cpp
modules/localization/config.cmake
modules/localization/include/LanguageTagsProvider.h [new file with mode: 0644]
modules/localization/include/dpl/localization/localization_utils.h
modules/localization/include/dpl/localization/w3c_file_localization.h
modules/localization/src/LanguageTagsProvider.cpp [new file with mode: 0644]
modules/localization/src/w3c_file_localization.cpp
modules/log/include/dpl/log/log.h
modules/log/src/log.cpp
modules/test/include/dpl/test/test_results_collector.h
modules/test/include/dpl/test/test_runner.h
modules/test/src/test_results_collector.cpp
modules/test/src/test_runner.cpp
modules/utils/config.cmake
modules/utils/include/dpl/utils/bash_utils.h [new file with mode: 0644]
modules/utils/include/dpl/utils/wrt_global_settings.h
modules/utils/include/dpl/utils/wrt_utility.h
modules/utils/src/bash_utils.cpp [new file with mode: 0644]
modules/utils/src/folder_size.cpp
modules/utils/src/wrt_global_settings.cpp
modules/utils/src/wrt_utility.cpp
modules/widget_dao/CMakeLists.txt
modules/widget_dao/dao/feature_dao.cpp
modules/widget_dao/dao/feature_dao_read_only.cpp
modules/widget_dao/dao/plugin_dao.cpp
modules/widget_dao/dao/widget_dao.cpp
modules/widget_dao/dao/widget_dao_read_only.cpp
modules/widget_dao/include/dpl/wrt-dao-ro/common_dao_types.h
modules/widget_dao/include/dpl/wrt-dao-ro/config_parser_data.h
modules/widget_dao/include/dpl/wrt-dao-ro/feature_dao_read_only.h
modules/widget_dao/include/dpl/wrt-dao-ro/feature_model.h
modules/widget_dao/include/dpl/wrt-dao-ro/global_config.h
modules/widget_dao/include/dpl/wrt-dao-ro/widget_dao_read_only.h
modules/widget_dao/include/dpl/wrt-dao-ro/wrt_db_types.h
modules/widget_dao/include/dpl/wrt-dao-rw/feature_dao.h
modules/widget_dao/include/dpl/wrt-dao-rw/plugin_dao.h
modules/widget_dao/include/dpl/wrt-dao-rw/widget_dao.h
modules/widget_dao/orm/wrt_db
packaging/wrt-commons.spec
wrt-commons [new file with mode: 0644]
wrt-commons.manifest [new file with mode: 0644]

index cd2d925..35ebc04 100644 (file)
@@ -44,9 +44,17 @@ ADD_DEFINITIONS("-DGLOBAL_SETTINGS_CONTROL")
 IF(NOT CMAKE_BUILD_TYPE)
     SET(CMAKE_BUILD_TYPE "Release")
 ENDIF(NOT CMAKE_BUILD_TYPE)
-SET(CMAKE_C_FLAGS           "${CMAKE_C_FLAGS} -fPIC")
-SET(CMAKE_CXX_FLAGS         "-O2 -g -fPIC -D_FORTIFY_SOURCE=0")
-SET(CMAKE_CXX_FLAGS_CCOV    "-O0 -g -fPIC -D_FORTIFY_SOURCE=0 --coverage")
+
+# Compiler flags
+SET(CMAKE_C_FLAGS_PROFILING    "-O0 -g -pg")
+SET(CMAKE_CXX_FLAGS_PROFILING  "-O0 -std=c++0x -g -pg")
+SET(CMAKE_C_FLAGS_DEBUG        "-O0 -g")
+SET(CMAKE_CXX_FLAGS_DEBUG      "-O0 -std=c++0x -g")
+SET(CMAKE_C_FLAGS_RELEASE      "-O2 -g")
+SET(CMAKE_CXX_FLAGS_RELEASE    "-O2 -std=c++0x -g")
+SET(CMAKE_CXX_FLAGS_CCOV       "-O0 -std=c++0x -g --coverage")
+
+ADD_DEFINITIONS("-fPIC")                        # If supported for the target machine, emit position-independent code, suitable for dynamic linking and avoiding any limit on the size of the global offset table. This option makes a difference on the m68k, PowerPC and SPARC. (BJ: our ARM too?)
 
 # CMake settings
 MESSAGE(STATUS "========================================")
index dbc7c88..face727 100644 (file)
@@ -1,3 +1,147 @@
+wrt-commons (0.2.67) unstable; urgency=low
+
+  * Localization cleaning from unused API (restore)
+  * Removing old, unused _WrtUtil* functions
+  * Database reset affects security-server
+  * Removing FileUtils
+  * Replacing recursive opendir with fts
+
+  * Release wrt-commons_0.2.67
+
+  * Git : framework/web/wrt-commons
+  * Tag : wrt-commons_0.2.67
+
+ -- Soyoung Kim <sy037.kim@samsung.com>  Wed, 24 Oct 2012 17:02:50 +0900
+
+wrt-commons (0.2.66) unstable; urgency=low
+
+  * Release wrt-commons_0.2.66
+
+  * Git : framework/web/wrt-commons
+  * Tag : wrt-commons_0.2.66
+
+ -- Soyoung Kim <sy037.kim@samsung.com>  Thu, 18 Oct 2012 11:33:54 +0900
+
+wrt-commons (0.2.65) unstable; urgency=low
+
+  * [Engine] Add method to get widget list
+  * [Commons] New utility functions in wrt_utility
+  * [Commons] Escaping bash sequences in argument programs
+  * [Engine] Allow to call methods using dao pointer
+  * [Engine] Remove mutex from log system.
+  * [Engine] Support for authors certificates (part 4).
+
+  * Git : framework/web/wrt-commons
+  * Tag : wrt-commons_0.2.65
+
+ -- Soyoung Kim <sy037.kim@samsung.com>  Wed, 17 Oct 2012 22:08:33 +0900
+
+wrt-commons (0.2.64) unstable; urgency=low
+
+  * Revert "Localization cleaning from unused API"
+
+  * Git : framework/web/wrt-commons
+  * Tag : wrt-commons_0.2.64
+
+ -- Jihoon Chung <jihoon.chung@samsung.com>  Fri, 12 Oct 2012 14:21:43 +0900
+
+wrt-commons (0.2.63) unstable; urgency=low
+
+  * Support for authors certificate
+  * WidgetDAO new CTOR (based on TizenID)
+  * Localization related cleanup
+
+  * Git : framework/web/wrt-commons
+  * Tag : wrt-commons_0.2.63
+
+ -- Pawel Sikorski <p.sikorski@samsung.com>  Thu, 11 Oct 2012 12:53:19 +0200
+
+wrt-commons (0.2.62) unstable; urgency=low
+
+  * [Engine] Add license installing
+  * [Engine] clean up .gitignore
+
+  * Git : slp/pkgs/w/wrt-commons
+  * Tag : wrt-commons_0.2.62
+
+ -- Jihoon Chung <jihoon.chung@samsung.com>  Thu, 11 Oct 2012 08:02:04 +0900
+
+wrt-commons (0.2.61) unstable; urgency=low
+
+  * [Commons] Support for Debug and Release build configuration
+  * Deprecated localization API removal
+  * Localization refactoring and cleaning
+  * [Commons] Refactoring featureDAO, pluginDAO table
+
+  * Git : slp/pkgs/w/wrt-commons
+  * Tag : wrt-commons_0.2.61
+
+ -- Jihoon Chung <jihoon.chung@samsung.com>  Fri, 05 Oct 2012 07:29:49 +0900
+
+wrt-commons (0.2.60) unstable; urgency=low
+
+  * for SEL verification
+  * [Commons] POWDER remains removed
+  * [Commons] Fixed PLM P120926-3287
+
+  * Git : framework/web/wrt-commons
+  * Tag : wrt-commons_0.2.60
+
+ -- Soyoung Kim <sy037.kim@samsung.com>  Fri, 28 Sep 2012 15:27:25 +0900
+
+wrt-commons (0.2.59) unstalbe; urgency=low
+
+  * Add smack manifest
+
+  * Git : framework/web/wrt-commons
+  * Tag : wrt-commons_0.2.59
+
+ -- Tae-Jeong Lee <taejeong.lee@samsung.com>  Thu, 20 Sep 2012 20:08:44 +0900
+
+wrt-commons (0.2.58) unstalbe; urgency=low
+
+  * for SEL verification
+
+  * Git : framework/web/wrt-commons
+  * Tag : wrt-commons_0.2.58
+
+ -- Tae-Jeong Lee <taejeong.lee@samsung.com>  Thu, 20 Sep 2012 12:02:41 +0900
+
+wrt-commons (0.2.57) unstalbe; urgency=low
+
+  * Proper list support in LanguageTagsProvider
+  * User Agent Database update
+  * Language tags providing class added
+  * Add a feature dao function giving requested features' data
+
+  * Git : framework/web/wrt-commons
+  * Tag : wrt-commons_0.2.57
+
+ -- Tae-Jeong Lee <taejeong.lee@samsung.com>  Wed, 19 Sep 2012 12:03:09 +0900
+
+wrt-commons (0.2.56) unstalbe; urgency=low
+
+  * [Commons] Test mode environment variable changed
+
+  * Git : slp/pkgs/w/wrt-commons
+  * Tag : wrt-commons_0.2.56
+
+ -- Jihoon Chung <jihoon.chung@samsung.com>  Wed, 12 Sep 2012 15:46:28 +0900
+
+wrt-commons (0.2.55) unstable; urgency=low
+
+  * [Commons] Table ExternalFiles renamed to ExternalLocations
+  * [Commons] Fix in base path removal in localization module.
+  * [Commons] Add multiple output types in test framework
+  * [Commons] Slash added to global config paths
+  * [Commons] Background page support in WidgetModel
+  * [Commons] New table - WidgetExternalFiles
+
+  * Git : slp/pkgs/w/wrt-commons
+  * Tag : wrt-commons_0.2.55
+
+ -- Yunchan Cho <yunchan.cho@samsung.com>  Thu, 06 Sep 2012 00:34:12 +0900
+
 wrt-commons (0.2.54) unstable; urgency=low
 
   * [common] Add XML test collector
index b5275a2..a9d9dc6 100755 (executable)
@@ -27,6 +27,7 @@ do
     chown 0:6026 /opt/dbspace/.$name.db-journal
     chmod 660 /opt/dbspace/.$name.db
     chmod 660 /opt/dbspace/.$name.db-journal
+    pkill -9 security-serv
 done
 
 
index 3016223..bc536a5 100755 (executable)
 #    limitations under the License.
 #
 
-rm -rf /opt/apps/widget/system/*
+rm -rf /opt/share/widget/system/*
 
 #Removing of widget desktop icons
 WIDGET_EXEC_PATH=/opt/apps/
 WIDGET_DESKTOP_PATH=/opt/share/applications/
 WRT_DB=/opt/dbspace/.wrt.db
-PLUGINS_INSTALLATION_REQUIRED_PATH=/opt/apps/widget/
+PLUGINS_INSTALLATION_REQUIRED_PATH=/opt/share/widget/
 PLUGINS_INSTALLATION_REQUIRED=plugin-installation-required
 
 if [ -f ${WRT_DB} ]
index 499d82e..e8f1590 100644 (file)
@@ -28,7 +28,7 @@
 
 namespace {
 inline std::string GetDefaultEncryptKeyPath() {
-    return "/opt/apps/widget/data/";
+    return "/opt/share/widget/data/";
 }
 }
 namespace WRTDecryptor{
index 62201bf..8f6de46 100644 (file)
@@ -30,7 +30,7 @@ const char* ENCRYPTION_FILE = "_enc";
 const char* DECRYPTION_FILE = "_dec";
 
 inline std::string GetDefaultEncryptKeyPath() {
-    return "/opt/apps/widget/data";
+    return "/opt/share/widget/data";
 }
 }
 namespace WRTEncryptor{
index 5f52e6f..80f77c4 100644 (file)
@@ -20,8 +20,8 @@
 #
 
 SET(DPL_LOCALIZATION_SOURCES
-    ${PROJECT_SOURCE_DIR}/modules/localization/src/localization_utils.cpp
     ${PROJECT_SOURCE_DIR}/modules/localization/src/w3c_file_localization.cpp
+    ${PROJECT_SOURCE_DIR}/modules/localization/src/LanguageTagsProvider.cpp
     PARENT_SCOPE
 )
 
@@ -29,6 +29,7 @@ SET(DPL_LOCALIZATION_SOURCES
 SET(DPL_LOCALIZATION_HEADERS
     ${PROJECT_SOURCE_DIR}/modules/localization/include/dpl/localization/localization_utils.h
     ${PROJECT_SOURCE_DIR}/modules/localization/include/dpl/localization/w3c_file_localization.h
+    ${PROJECT_SOURCE_DIR}/modules/localization/include/LanguageTagsProvider.h
     PARENT_SCOPE
 )
 
diff --git a/modules/localization/include/LanguageTagsProvider.h b/modules/localization/include/LanguageTagsProvider.h
new file mode 100644 (file)
index 0000000..c32d0fe
--- /dev/null
@@ -0,0 +1,81 @@
+/*
+ * 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    LanguageTagsProvider.h
+ * @author  Marcin Kaminski (marcin.ka@samsung.com)
+ * @version 1.0
+ */
+
+#ifndef LANGUAGETAGSPROVIDER_H
+#define LANGUAGETAGSPROVIDER_H
+
+#include <dpl/optional.h>
+#include <dpl/string.h>
+#include <dpl/singleton.h>
+#include <list>
+
+typedef std::list<DPL::String> LanguageTags;
+
+class LanguageTagsProvider {
+
+public:
+    /*
+     * Get list of currently set language tags
+     */
+    const LanguageTags getLanguageTags() const;
+
+    /*
+     * Set new language tags (other than based on system locales)
+     */
+    void setLanguageTags(const LanguageTags& taglist );
+
+    /*
+     * Set language tags from given locales.
+     * Supported format is: xx[-yy[-zz]][.encoding]
+     */
+    void setLanguageTagsFromLocales(const char* locales);
+
+    /*
+     * Set language tags based on system language settings
+     */
+    void resetLanguageTags();
+
+    /*
+     * Function converts language tag string (i.e. en-US)
+     * into locales string (en_US).
+     */
+    static DPL::String BCP47LanguageTagToLocale(const DPL::String&);
+
+    /*
+     * Function converts locales string (i.e. en_US.UTF-8) into language tag (i.e. en-US)
+     */
+    static DPL::String LocaleToBCP47LanguageTag(const DPL::String&);
+
+private:
+    friend class DPL::Singleton<LanguageTagsProvider>;
+
+    LanguageTags m_languageTagsList;
+
+    LanguageTagsProvider();
+    virtual ~LanguageTagsProvider();
+
+    void loadSystemTags();
+    void createTagsFromLocales(const char* language);
+};
+
+typedef DPL::Singleton<LanguageTagsProvider> LanguageTagsProviderSingleton;
+
+#endif /* LANGUAGETAGSPROVIDER_H */
index 8130838..f971f93 100644 (file)
@@ -73,14 +73,6 @@ struct WidgetStartFileInfo
 };
 
 typedef DPL::Optional<WidgetIcon> OptionalWidgetIcon;
-typedef std::list<DPL::String> LanguageTagsList;
 typedef DPL::Optional<WidgetStartFileInfo> OptionalWidgetStartFileInfo;
 
-namespace LocalizationUtils {
-DPL::String BCP47LanguageTagToLocale(const DPL::String&);
-DPL::String LocaleToBCP47LanguageTag(const DPL::String&);
-
-void SetSystemLanguageTags(const LanguageTagsList& tags);
-LanguageTagsList GetUserAgentLanguageTags();
-}
 #endif //LOCALIZATION_UTILS_H
index 156923c..7f26a5b 100644 (file)
@@ -37,24 +37,23 @@ typedef std::list<WidgetIcon> WidgetIconList;
 
 DPL::Optional<DPL::String> getFilePathInWidgetPackageFromUrl(
         WrtDB::DbWidgetHandle widgetHandle,
-        const LanguageTagsList &languageTags,
         const DPL::String &url);
 
 DPL::Optional<DPL::String> getFilePathInWidgetPackage(
         WrtDB::DbWidgetHandle widgetHandle,
-        const LanguageTagsList &languageTags,
         const DPL::String& file);
 
-DPL::OptionalString getStartFile(WrtDB::DbWidgetHandle widgetHandle);
+DPL::OptionalString getStartFile(WrtDB::DbWidgetHandle handle);
+DPL::OptionalString getStartFile(WrtDB::WidgetDAOReadOnlyPtr dao);
 OptionalWidgetIcon getIcon(WrtDB::DbWidgetHandle widgetHandle);
 WidgetIconList getValidIconsList(
-        WrtDB::DbWidgetHandle widgetHandle,
-        const LanguageTagsList &languageTags);
+        WrtDB::DbWidgetHandle widgetHandle);
 
 OptionalWidgetStartFileInfo getStartFileInfo(
-        WrtDB::DbWidgetHandle widgetHandle,
-        const LanguageTagsList &tagsList);
+        WrtDB::DbWidgetHandle widgetHandle);
+
 WrtDB::WidgetLocalizedInfo getLocalizedInfo(WrtDB::DbWidgetHandle widgetHandle);
+WrtDB::WidgetLocalizedInfo getLocalizedInfo(WrtDB::WidgetDAOReadOnlyPtr dao);
 }
 
 #endif //W3C_FILE_LOCALIZATION_H
diff --git a/modules/localization/src/LanguageTagsProvider.cpp b/modules/localization/src/LanguageTagsProvider.cpp
new file mode 100644 (file)
index 0000000..69e6d41
--- /dev/null
@@ -0,0 +1,152 @@
+/*
+ * Copyright (c) 2012 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    LanguageTagsProvider.cpp
+ * @author  Marcin Kaminski (marcin.ka@samsung.com)
+ * @version 1.0
+ */
+
+#include "LanguageTagsProvider.h"
+
+#include <dpl/log/log.h>
+#include <vconf.h>
+#include <algorithm>
+#include <iostream>
+#include <cassert>
+#include <dpl/singleton_impl.h>
+IMPLEMENT_SINGLETON(LanguageTagsProvider)
+
+/* ========== public ========== */
+const LanguageTags LanguageTagsProvider::getLanguageTags() const
+{
+    return m_languageTagsList;
+}
+
+void LanguageTagsProvider::setLanguageTags(const LanguageTags& taglist)
+{
+    m_languageTagsList = taglist;
+    /* If given list does not contain default values ("en" and empty string)
+     * than append them to the list.
+     * In case of empty list given as parameter only two default values
+     * will exist on m_languageTagsList. */
+    DPL::String tofind = L"en";
+    if(std::find(m_languageTagsList.begin(), m_languageTagsList.end(),
+            tofind) == m_languageTagsList.end()) {
+        m_languageTagsList.push_back(L"en");
+    }
+    tofind = L"";
+    if(std::find(m_languageTagsList.begin(), m_languageTagsList.end(),
+            tofind) == m_languageTagsList.end()) {
+        m_languageTagsList.push_back(L"");
+    }
+}
+
+void LanguageTagsProvider::setLanguageTagsFromLocales(const char* locales)
+{
+    LogDebug("Setting new language tags for locales " << locales);
+    this->createTagsFromLocales(locales);
+}
+
+void LanguageTagsProvider::resetLanguageTags()
+{
+    this->loadSystemTags();
+}
+
+DPL::String LanguageTagsProvider::BCP47LanguageTagToLocale(const DPL::String& inLanguageTag)
+{
+    DPL::String languageTag(inLanguageTag);
+    /* Replace all */
+    std::replace(languageTag.begin(), languageTag.end(), '-', '_');
+    return languageTag;
+}
+
+DPL::String LanguageTagsProvider::LocaleToBCP47LanguageTag(const DPL::String& inLocaleString)
+{
+    /* Cut off codepage information from given string (if any exists)
+     * i.e. change en_US.UTF-8 into en_US */
+    DPL::String localeString = inLocaleString.substr(
+            0, inLocaleString.find_first_of(L"."));
+    /* Replace all '_' with '-' */
+    std::replace(localeString.begin(), localeString.end(), '_', '-');
+    return localeString;
+}
+
+/* ========== private ========== */
+LanguageTagsProvider::LanguageTagsProvider()
+{
+    LogDebug("Creating LanguageTagsProvider instance");
+    this->loadSystemTags();
+}
+
+LanguageTagsProvider::~LanguageTagsProvider()
+{
+}
+
+void LanguageTagsProvider::loadSystemTags()
+{
+    char* language = vconf_get_str(VCONFKEY_LANGSET);
+    if(!language) {
+        LogError("Failed to get language from vconf");
+    }
+    else {
+        LogDebug("Language fetched from vconf: " << language);
+    }
+    createTagsFromLocales(language);
+    free(language);
+}
+
+void LanguageTagsProvider::createTagsFromLocales(const char* language)
+{
+    m_languageTagsList.clear();
+    if(!language) {
+        LogDebug("Setting default language tags");
+        /* If NULL language given than set default language tags
+         * and return. */
+        m_languageTagsList.push_back(L"en");
+        m_languageTagsList.push_back(L"");
+        return;
+    }
+
+    LogDebug("Setting tags for language: " << language);
+    DPL::String langdescr = LocaleToBCP47LanguageTag(DPL::FromUTF8String(language));
+
+    size_t position;
+    if(langdescr.empty()) {
+        LogError("Empty language description while correct value needed");
+    }
+    else {
+        /* Language tags list should not be cleared before this place to
+         * avoid losing current data when new data are invalid */
+        while (true) {
+            LogDebug("Processing language description: " << langdescr);
+            m_languageTagsList.push_back(langdescr);
+
+            position = langdescr.find_last_of(L"-");
+            if (position == DPL::String::npos) {
+                break;
+            }
+            langdescr = langdescr.substr(0, position);
+        }
+    }
+    /* If current content of langdescr (thus last added added tag)
+     * is not "en" then add english as default locales.
+     * "en" and empty tag are added even when langdescr is not valid. */
+    if (langdescr.compare(L"en") != 0){
+        m_languageTagsList.push_back(L"en");
+    }
+    /* Add empty tag for non-localized content */
+    m_languageTagsList.push_back(L"");
+}
index c0b4161..c0ddc01 100644 (file)
@@ -22,6 +22,7 @@
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <unistd.h>
+#include <assert.h>
 
 #include <dpl/localization/w3c_file_localization.h>
 
 #include <dpl/optional.h>
 #include <dpl/foreach.h>
 
+#include <LanguageTagsProvider.h>
+
 using namespace WrtDB;
 
 namespace {
 const DPL::String FILE_URI_BEGIN = L"file://";
 const DPL::String WIDGET_URI_BEGIN = L"widget://";
+const DPL::String LOCALE_PREFIX = L"locales/";
 
 DPL::Optional<std::string> GetFilePathInWidgetPackageInternal(
-        const LanguageTagsList &tags,
         const std::string& basePath,
         std::string filePath)
 {
     LogDebug("Looking for file: " << filePath << "  in: " << basePath);
-    using namespace LocalizationUtils;
+
+    const LanguageTags& ltags = LanguageTagsProviderSingleton::Instance().getLanguageTags();
 
     //Check if string isn't empty
     if (filePath.size() == 0) { return DPL::Optional<std::string>::Null; }
@@ -54,10 +58,10 @@ DPL::Optional<std::string> GetFilePathInWidgetPackageInternal(
     //Check if string isn't empty
     if (filePath.size() == 0) { return DPL::Optional<std::string>::Null; }
 
-    LogDebug("locales size = " << tags.size());
-    for (LanguageTagsList::const_iterator it = tags.begin();
-         it != tags.end();
-         ++it) {
+    LogDebug("locales size = " << ltags.size());
+    for (LanguageTags::const_iterator it = ltags.begin();
+            it != ltags.end();
+            ++it) {
         LogDebug("Trying locale: " << *it);
         std::string path = basePath;
         if (path[path.size() - 1] == '/') {
@@ -84,13 +88,11 @@ DPL::Optional<std::string> GetFilePathInWidgetPackageInternal(
 }
 
 DPL::Optional<DPL::String> GetFilePathInWidgetPackageInternal(
-        const LanguageTagsList &languageTags,
         const DPL::String& basePath,
         const DPL::String& filePath)
 {
     DPL::Optional<std::string> path =
-        GetFilePathInWidgetPackageInternal(languageTags,
-                                           DPL::ToUTF8String(basePath),
+        GetFilePathInWidgetPackageInternal(DPL::ToUTF8String(basePath),
                                            DPL::ToUTF8String(filePath));
     DPL::Optional<DPL::String> dplPath;
     if (!!path) {
@@ -103,7 +105,6 @@ DPL::Optional<DPL::String> GetFilePathInWidgetPackageInternal(
 namespace W3CFileLocalization {
 DPL::Optional<DPL::String> getFilePathInWidgetPackageFromUrl(
         DbWidgetHandle widgetHandle,
-        const LanguageTagsList &languageTags,
         const DPL::String &url)
 {
     DPL::String req = url;
@@ -116,6 +117,15 @@ DPL::Optional<DPL::String> getFilePathInWidgetPackageFromUrl(
         if (req.find(dao.getPath()) == 0) {
             req.erase(0, dao.getPath().length());
         }
+        if (req.find(LOCALE_PREFIX) == 0) {
+            req.erase(0, LOCALE_PREFIX.length());
+            int position = req.find('/');
+            // should always be >0 as correct locales path is
+            // always locales/xx/ or locales/xx-XX/
+            if (position != std::string::npos && position > 0) {
+                req.erase(0, position+1);
+            }
+        }
     } else {
         LogDebug("Unknown path format, ignoring");
         return DPL::Optional<DPL::String>::Null;
@@ -124,7 +134,7 @@ DPL::Optional<DPL::String> getFilePathInWidgetPackageFromUrl(
     auto widgetPath = dao.getPath();
 
     DPL::Optional<DPL::String> found =
-        GetFilePathInWidgetPackageInternal(languageTags, widgetPath, req);
+        GetFilePathInWidgetPackageInternal(widgetPath, req);
 
     if (!found) {
         LogError("Path not found within current locale in current widget");
@@ -138,24 +148,24 @@ DPL::Optional<DPL::String> getFilePathInWidgetPackageFromUrl(
 
 DPL::Optional<DPL::String> getFilePathInWidgetPackage(
         WrtDB::DbWidgetHandle widgetHandle,
-        const LanguageTagsList &languageTags,
         const DPL::String& file)
 {
     WidgetDAOReadOnly dao(widgetHandle);
-    return GetFilePathInWidgetPackageInternal(languageTags, dao.getPath(), file);
+    return GetFilePathInWidgetPackageInternal(dao.getPath(), file);
 }
 
-DPL::OptionalString getStartFile(const WrtDB::DbWidgetHandle widgetHandle)
+DPL::OptionalString getStartFile(const WrtDB::DbWidgetHandle handle)
 {
-    using namespace LocalizationUtils;
-
-    WidgetDAOReadOnly dao(widgetHandle);
+    return getStartFile(WidgetDAOReadOnlyPtr(new WidgetDAOReadOnly(handle)));
+}
 
-    WidgetDAOReadOnly::LocalizedStartFileList locList = dao.getLocalizedStartFileList();
-    WidgetDAOReadOnly::WidgetStartFileList list = dao.getStartFileList();
-    LanguageTagsList tagsList = LocalizationUtils::GetUserAgentLanguageTags();
+DPL::OptionalString getStartFile(WrtDB::WidgetDAOReadOnlyPtr dao)
+{
+    WidgetDAOReadOnly::LocalizedStartFileList locList = dao->getLocalizedStartFileList();
+    WidgetDAOReadOnly::WidgetStartFileList list = dao->getStartFileList();
+    LanguageTags tagsList = LanguageTagsProviderSingleton::Instance().getLanguageTags();
 
-    DPL::OptionalString defaultLoc = dao.getDefaultlocale();
+    DPL::OptionalString defaultLoc = dao->getDefaultlocale();
     if (!!defaultLoc) {
         tagsList.push_back(*defaultLoc);
     }
@@ -180,12 +190,11 @@ DPL::OptionalString getStartFile(const WrtDB::DbWidgetHandle widgetHandle)
 
 OptionalWidgetIcon getIcon(const WrtDB::DbWidgetHandle widgetHandle)
 {
-    using namespace LocalizationUtils;
     WidgetDAOReadOnly dao(widgetHandle);
 
     WidgetDAOReadOnly::WidgetLocalizedIconList locList = dao.getLocalizedIconList();
     WidgetDAOReadOnly::WidgetIconList list = dao.getIconList();
-    LanguageTagsList tagsList = LocalizationUtils::GetUserAgentLanguageTags();
+    LanguageTags tagsList = LanguageTagsProviderSingleton::Instance().getLanguageTags();
 
     DPL::OptionalString defaultLoc = dao.getDefaultlocale();
     if (!!defaultLoc) {
@@ -215,10 +224,8 @@ OptionalWidgetIcon getIcon(const WrtDB::DbWidgetHandle widgetHandle)
 }
 
 WidgetIconList getValidIconsList(
-        WrtDB::DbWidgetHandle widgetHandle,
-        const LanguageTagsList &languageTags)
+        WrtDB::DbWidgetHandle widgetHandle)
 {
-    using namespace LocalizationUtils;
     WidgetDAOReadOnly dao(widgetHandle);
     WidgetDAOReadOnly::WidgetIconList list = dao.getIconList();
 
@@ -228,7 +235,6 @@ WidgetIconList getValidIconsList(
     {
         LogDebug(":" << it->iconSrc);
         if (!!getFilePathInWidgetPackage(widgetHandle,
-                                         languageTags,
                                          it->iconSrc))
         {
             WidgetIcon ret;
@@ -242,17 +248,15 @@ WidgetIconList getValidIconsList(
 }
 
 OptionalWidgetStartFileInfo getStartFileInfo(
-        WrtDB::DbWidgetHandle widgetHandle,
-        const LanguageTagList &tagsList)
+        WrtDB::DbWidgetHandle widgetHandle)
 {
-    using namespace LocalizationUtils;
-
     WidgetStartFileInfo info;
 
     WidgetDAOReadOnly dao(widgetHandle);
     WidgetDAOReadOnly::LocalizedStartFileList locList =
         dao.getLocalizedStartFileList();
     WidgetDAOReadOnly::WidgetStartFileList list = dao.getStartFileList();
+    const LanguageTags tagsList = LanguageTagsProviderSingleton::Instance().getLanguageTags();
 
     FOREACH(tag, tagsList)
     {
@@ -284,10 +288,13 @@ OptionalWidgetStartFileInfo getStartFileInfo(
 
 WidgetLocalizedInfo getLocalizedInfo(const WrtDB::DbWidgetHandle handle)
 {
-    LanguageTagList languages =
-        LocalizationUtils::GetUserAgentLanguageTags();
-    WidgetDAOReadOnly dao(handle);
-    DPL::OptionalString dl = dao.getDefaultlocale();
+    return getLocalizedInfo(WidgetDAOReadOnlyPtr(new WidgetDAOReadOnly(handle)));
+}
+
+WidgetLocalizedInfo getLocalizedInfo(WidgetDAOReadOnlyPtr dao)
+{
+    LanguageTags languages = LanguageTagsProviderSingleton::Instance().getLanguageTags();
+    DPL::OptionalString dl = dao->getDefaultlocale();
     if (!!dl) {
         languages.push_back(*dl);
     }
@@ -295,7 +302,7 @@ WidgetLocalizedInfo getLocalizedInfo(const WrtDB::DbWidgetHandle handle)
     WidgetLocalizedInfo result;
     FOREACH(i, languages)
     {
-        WidgetLocalizedInfo languageResult = dao.getLocalizedInfo(*i);
+        WidgetLocalizedInfo languageResult = dao->getLocalizedInfo(*i);
 
 #define OVERWRITE_IF_NULL(FIELD) if (!result.FIELD) { \
         result.FIELD = languageResult.FIELD; \
index c9564bb..7be5c9d 100644 (file)
@@ -27,7 +27,6 @@
 #include <dpl/log/abstract_log_provider.h>
 #include <dpl/log/dlog_log_provider.h>
 #include <dpl/log/old_style_log_provider.h>
-#include <dpl/read_write_mutex.h>
 #include <sstream>
 #include <list>
 
@@ -45,8 +44,6 @@ class LogSystem
     : private Noncopyable
 {
 private:
-    ReadWriteMutex m_spinLock;
-
     typedef std::list<AbstractLogProvider *> AbstractLogProviderPtrList;
     AbstractLogProviderPtrList m_providers;
 
index b03ab61..b24970a 100644 (file)
@@ -140,52 +140,40 @@ void LogSystem::SetTag(const char* tag)
 
 void LogSystem::AddProvider(AbstractLogProvider *provider)
 {
-    ReadWriteMutex::ScopedWriteLock lock(&m_spinLock);
     m_providers.push_back(provider);
 }
 
 void LogSystem::RemoveProvider(AbstractLogProvider *provider)
 {
-    ReadWriteMutex::ScopedWriteLock lock(&m_spinLock);
     m_providers.remove(provider);
 }
 
 void LogSystem::Debug(const char *message, const char *filename, int line, const char *function)
 {
-    ReadWriteMutex::ScopedReadLock lock(&m_spinLock);
-
     for (AbstractLogProviderPtrList::iterator iterator = m_providers.begin(); iterator != m_providers.end(); ++iterator)
         (*iterator)->Debug(message, filename, line, function);
 }
 
 void LogSystem::Info(const char *message, const char *filename, int line, const char *function)
 {
-    ReadWriteMutex::ScopedReadLock lock(&m_spinLock);
-
     for (AbstractLogProviderPtrList::iterator iterator = m_providers.begin(); iterator != m_providers.end(); ++iterator)
         (*iterator)->Info(message, filename, line, function);
 }
 
 void LogSystem::Warning(const char *message, const char *filename, int line, const char *function)
 {
-    ReadWriteMutex::ScopedReadLock lock(&m_spinLock);
-
     for (AbstractLogProviderPtrList::iterator iterator = m_providers.begin(); iterator != m_providers.end(); ++iterator)
         (*iterator)->Warning(message, filename, line, function);
 }
 
 void LogSystem::Error(const char *message, const char *filename, int line, const char *function)
 {
-    ReadWriteMutex::ScopedReadLock lock(&m_spinLock);
-
     for (AbstractLogProviderPtrList::iterator iterator = m_providers.begin(); iterator != m_providers.end(); ++iterator)
         (*iterator)->Error(message, filename, line, function);
 }
 
 void LogSystem::Pedantic(const char *message, const char *filename, int line, const char *function)
 {
-    ReadWriteMutex::ScopedReadLock lock(&m_spinLock);
-
     for (AbstractLogProviderPtrList::iterator iterator = m_providers.begin(); iterator != m_providers.end(); ++iterator)
         (*iterator)->Pedantic(message, filename, line, function);
 }
index 6c4e24b..cf8fa4e 100644 (file)
@@ -52,7 +52,6 @@ class TestResultsCollectorBase
             NONE,
             FAILED,
             IGNORED,
-            TODO,
             INTERNAL
         };
     };
index ab1a626..a4db750 100644 (file)
@@ -32,6 +32,7 @@
 #include <vector>
 #include <list>
 #include <set>
+#include <map>
 
 namespace DPL
 {
@@ -39,9 +40,12 @@ namespace Test
 {
 class TestRunner
 {
-    TestResultsCollectorBasePtr m_collector;
-    std::string m_collectorName;
+    typedef std::map<std::string, TestResultsCollectorBasePtr>
+            TestResultsCollectors;
+    TestResultsCollectors m_collectors;
+
     std::string m_startTestId;
+    bool m_runIgnored;
 
 public:
     typedef void (*TestCase)();
@@ -82,15 +86,21 @@ private:
     DPL::Atomic m_totalAssertions;
 
     void Banner();
-    void InvalidArgs();
+    void InvalidArgs(const std::string& message = "Invalid arguments!");
     void Usage();
 
-    enum Status { FAILED, TODO, IGNORED, PASS };
+    enum Status { FAILED, IGNORED, PASS };
 
     Status RunTestCase(const TestCaseStruct& testCase);
 
     void RunTests();
 
+    void CollectResult(const std::string& id,
+                       const std::string& description,
+                       const TestResultsCollectorBase::FailStatus::Type status
+                           = TestResultsCollectorBase::FailStatus::NONE,
+                       const std::string& reason = std::string());
+
 public:
     class TestFailed
     {
@@ -116,27 +126,6 @@ public:
         }
     };
 
-    class ToDo
-    {
-    private:
-        std::string m_message;
-
-    public:
-        ToDo()
-        {
-        }
-
-        ToDo(const std::string &message)
-            : m_message(message)
-        {
-        }
-
-        std::string GetMessage() const
-        {
-            return m_message;
-        }
-    };
-
     class Ignored
     {
     private:
@@ -166,6 +155,7 @@ public:
     int ExecTestRunner(int argc, char *argv[]);
     typedef std::vector<std::string> ArgsList;
     int ExecTestRunner(const ArgsList& args);
+    bool getRunIgnored() const;
 };
 
 typedef DPL::Singleton<TestRunner> TestRunnerSingleton;
@@ -211,8 +201,6 @@ do
 
 #define RUNNER_FAIL RUNNER_ASSERT(false)
 
-#define RUNNER_TODO_MSG(message) do { std::ostringstream assertMsg; assertMsg << message; throw DPL::Test::TestRunner::ToDo(assertMsg.str()); } while (0)
-
 #define RUNNER_IGNORED_MSG(message) do { std::ostringstream assertMsg; assertMsg << message; throw DPL::Test::TestRunner::Ignored(assertMsg.str()); } while (0)
 
 #endif // DPL_TEST_RUNNER_H
index e36e868..4a91712 100644 (file)
@@ -427,11 +427,12 @@ class XmlCollector
         // Show result
         FOREACH(group, m_groupsStats) {
             PrintStats(group->first, group->second);
+            size_t posBegin = m_outputBuffer.find("<testcase name=\"unknown\"");
+            size_t posEnd = m_outputBuffer.find("</testcase>", posBegin);
+            m_outputBuffer.erase(posBegin - 3, posEnd - posBegin + sizeof("</testcase>") + 2);
         }
 
-        size_t posBegin = m_outputBuffer.find("<testcase name=\"unknown\"");
-        size_t posEnd = m_outputBuffer.find("</testcase>", posBegin);
-        m_outputBuffer.erase(posBegin - 3, posEnd - posBegin + sizeof("</testcase>") + 2);
+
         remove(m_filename.c_str());
         m_fp.Reset(fopen (m_filename.c_str(), "w"));
         Assert(!!m_fp && "File handle must not be null");
@@ -482,8 +483,9 @@ class XmlCollector
             default:
                 Assert(false && "Bad status");
         }
-        size_t pos = m_outputBuffer.find("<testcase name=\"unknown\"");
-        m_outputBuffer.insert(pos - 2, m_resultBuffer);
+        size_t group_pos = m_outputBuffer.find(m_currentGroup);
+        size_t last_case_pos = m_outputBuffer.find("<testcase name=\"unknown\"", group_pos);
+        m_outputBuffer.insert(last_case_pos - 2, m_resultBuffer);
         fseek(m_fp.Get(), 0L, SEEK_SET);
         fprintf(m_fp.Get(), "%s", m_outputBuffer.c_str());
         fflush(m_fp.Get());
index c53be69..98f1ba1 100644 (file)
@@ -99,67 +99,59 @@ TestRunner::Status TestRunner::RunTestCase(const TestCaseStruct& testCase)
     catch (const TestFailed &e)
     {
         // Simple test failure
-        m_collector->CollectResult(testCase.name,
-                                   "",
-                                   TestResultsCollectorBase::FailStatus::FAILED,
-                                   e.GetMessage());
+        CollectResult(testCase.name,
+                      "",
+                      TestResultsCollectorBase::FailStatus::FAILED,
+                      e.GetMessage());
         return FAILED;
     }
     catch (const Ignored &e)
     {
-        // Simple test have to be implemented
-        m_collector->CollectResult(testCase.name,
-                                   "",
-                                   TestResultsCollectorBase::FailStatus::IGNORED,
-                                   e.GetMessage());
+        if (m_runIgnored) {
+            // Simple test have to be implemented
+            CollectResult(testCase.name,
+                          "",
+                          TestResultsCollectorBase::FailStatus::IGNORED,
+                          e.GetMessage());
+        }
 
         return IGNORED;
     }
-    catch (const ToDo &e)
-    {
-        // Simple test have to be implemented
-        m_collector->CollectResult(testCase.name,
-                                   "",
-                                   TestResultsCollectorBase::FailStatus::TODO,
-                                   e.GetMessage());
-
-        return TODO;
-    }
     catch (const DPL::Exception &e)
     {
         // DPL exception failure
-        m_collector->CollectResult(testCase.name,
-                                   "",
-                                   TestResultsCollectorBase::FailStatus::INTERNAL,
-                                   "DPL exception:" +
-                                   e.GetMessage());
+        CollectResult(testCase.name,
+                      "",
+                      TestResultsCollectorBase::FailStatus::INTERNAL,
+                      "DPL exception:" + e.GetMessage());
 
         return FAILED;
     }
     catch (const std::exception &)
     {
         // std exception failure
-        m_collector->CollectResult(testCase.name,
-                                   "",
-                                   TestResultsCollectorBase::FailStatus::INTERNAL,
-                                   "std exception");
+        CollectResult(testCase.name,
+                      "",
+                      TestResultsCollectorBase::FailStatus::INTERNAL,
+                      "std exception");
 
         return FAILED;
     }
     catch (...)
     {
         // Unknown exception failure
-        m_collector->CollectResult(testCase.name,
-                                   "",
-                                   TestResultsCollectorBase::FailStatus::INTERNAL,
-                                   "unknown exception");
+        CollectResult(testCase.name,
+                      "",
+                      TestResultsCollectorBase::FailStatus::INTERNAL,
+                      "unknown exception");
 
         return FAILED;
     }
 
-    m_collector->CollectResult(testCase.name,
-                               "",
-                               TestResultsCollectorBase::FailStatus::NONE);
+    CollectResult(testCase.name,
+                  "",
+                  TestResultsCollectorBase::FailStatus::NONE);
+
     // Everything OK
     return PASS;
 }
@@ -169,13 +161,25 @@ void TestRunner::RunTests()
     using namespace DPL::Colors::Text;
 
     Banner();
-    m_collector->Start();
+    std::for_each(m_collectors.begin(),
+                  m_collectors.end(),
+                  [](const TestResultsCollectors::value_type& collector)
+                  {
+                      collector.second->Start();
+                  });
 
     fprintf(stderr, "%s%s%s\n", GREEN_BEGIN, "Running tests...", GREEN_END);
     FOREACH(group, m_testGroups) {
         TestCaseStructList list = group->second;
         if (!list.empty()) {
-            m_collector->CollectCurrentTestGroupName(group->first);
+            std::for_each(
+                    m_collectors.begin(),
+                    m_collectors.end(),
+                    [&group](const TestResultsCollectors::value_type& collector)
+                    {
+                        collector.second->
+                                CollectCurrentTestGroupName(group->first);
+                    });
             list.sort();
 
             for (TestCaseStructList::const_iterator iterator = list.begin();
@@ -193,11 +197,34 @@ void TestRunner::RunTests()
         }
     }
 
-    m_collector->Finish();
+    std::for_each(m_collectors.begin(),
+                  m_collectors.end(),
+                  [](const TestResultsCollectors::value_type& collector)
+                  {
+                      collector.second->Finish();
+                  });
+
     // Finished
     fprintf(stderr, "%s%s%s\n\n", GREEN_BEGIN, "Finished", GREEN_END);
 }
 
+void TestRunner::CollectResult(
+        const std::string& id,
+        const std::string& description,
+        const TestResultsCollectorBase::FailStatus::Type status,
+        const std::string& reason)
+{
+    std::for_each(m_collectors.begin(),
+                  m_collectors.end(),
+                  [&](const TestResultsCollectors::value_type& collector)
+                  {
+                      collector.second->CollectResult(id,
+                                                      description,
+                                                      status,
+                                                      reason);
+                  });
+}
+
 void TestRunner::Banner()
 {
     using namespace DPL::Colors::Text;
@@ -214,13 +241,13 @@ void TestRunner::Banner()
             GREEN_END);
 }
 
-void TestRunner::InvalidArgs()
+void TestRunner::InvalidArgs(const std::string& message)
 {
     using namespace DPL::Colors::Text;
     fprintf(stderr,
             "%s%s%s\n",
             BOLD_RED_BEGIN,
-            "Invalid parameters!",
+            message.c_str(),
             BOLD_RED_END);
 }
 
@@ -228,25 +255,36 @@ void TestRunner::Usage()
 {
     fprintf(stderr, "Usage: runner [options]\n\n");
     fprintf(stderr, "Output type:\n");
-    fprintf(stderr, "  --output=<output type>\n");
-    fprintf(stderr, "  possible output types:\n");
+    fprintf(stderr, "  --output=<output type> --output=<output type> ...\n");
+    fprintf(stderr, "\n  possible output types:\n");
     FOREACH (type, TestResultsCollectorBase::GetCollectorsNames()) {
-        fprintf(stderr, "  --output=%s\n", type->c_str());
+        fprintf(stderr, "    --output=%s\n", type->c_str());
     }
+    fprintf(stderr, "\n  example:\n");
+    fprintf(stderr, "    test-binary --output=text --output=xml --file=output.xml\n\n");
     fprintf(stderr, "Other parameters:\n");
     fprintf(stderr,
             "  --regexp='regexp'\t Only selected tests"
             " which names match regexp run\n\n");
     fprintf(stderr, "  --start=<test id>\tStart from concrete test id");
     fprintf(stderr, "  --group=<group name>\t Run tests only from one group\n");
+    fprintf(stderr, "  --runignored\t Run also ignored tests\n");
     fprintf(stderr, "  --list\t Show a list of Test IDs\n");
     fprintf(stderr, "  --listgroups\t Show a list of Test Group names \n");
     fprintf(stderr, "  --listingroup=<group name>\t Show a list of Test IDS in one group\n");
     fprintf(stderr, "  --help\t This help\n\n");
-    if (m_collector) {
-        fprintf(stderr, "Output %s has specific args:\n", m_collectorName.c_str());
-        fprintf(stderr, "%s\n", m_collector->CollectorSpecificHelp().c_str());
-    }
+    std::for_each(m_collectors.begin(),
+                  m_collectors.end(),
+                  [](const TestResultsCollectors::value_type& collector)
+                  {
+                      fprintf(stderr,
+                              "Output %s has specific args:\n",
+                              collector.first.c_str());
+                      fprintf(stderr,
+                              "%s\n",
+                              collector.second->
+                                      CollectorSpecificHelp().c_str());
+                  });
     fprintf(stderr, "For bug reporting, please write to:\n");
     fprintf(stderr, "<p.dobrowolsk@samsung.com>\n");
 }
@@ -268,6 +306,7 @@ void TestRunner::MarkAssertion()
 
 int TestRunner::ExecTestRunner(const ArgsList& value)
 {
+    m_runIgnored = false;
     ArgsList args = value;
     // Parse command line
     if (args.size() == 1)
@@ -281,6 +320,8 @@ int TestRunner::ExecTestRunner(const ArgsList& value)
 
     bool showHelp = false;
 
+    TestResultsCollectorBasePtr currentCollector;
+
     // Parse each argument
     FOREACH(it, args)
     {
@@ -288,13 +329,21 @@ int TestRunner::ExecTestRunner(const ArgsList& value)
         const std::string regexp = "--regexp=";
         const std::string output = "--output=";
         const std::string groupId = "--group=";
+        const std::string runIgnored = "--runignored";
         const std::string listCmd = "--list";
         const std::string startCmd = "--start=";
         const std::string listGroupsCmd = "--listgroups";
         const std::string listInGroup = "--listingroup=";
 
-        if (m_collector && m_collector->ParseCollectorSpecificArg(arg)) continue;
-        else if (arg.find(startCmd) == 0)
+        if (currentCollector)
+        {
+            if (currentCollector->ParseCollectorSpecificArg(arg))
+            {
+                continue;
+            }
+        }
+
+        if (arg.find(startCmd) == 0)
         {
             arg.erase(0, startCmd.length());
             FOREACH(group, m_testGroups) {
@@ -328,6 +377,10 @@ int TestRunner::ExecTestRunner(const ArgsList& value)
                 return -1;
             }
         }
+        else if (arg == runIgnored)
+        {
+            m_runIgnored = true;
+        }
         else if (arg == listCmd)
         {
             FOREACH(group, m_testGroups) {
@@ -357,14 +410,19 @@ int TestRunner::ExecTestRunner(const ArgsList& value)
         else if (arg.find(output) == 0)
         {
             arg.erase(0, output.length());
-            m_collector.Reset(TestResultsCollectorBase::Create(arg));
-            if (!m_collector) {
-                InvalidArgs();
+            if (m_collectors.find(arg) != m_collectors.end())
+            {
+                InvalidArgs("Multiple outputs of the same type are not supported!");
                 Usage();
                 return -1;
-            } else {
-                m_collectorName = arg;
             }
+            currentCollector.Reset(TestResultsCollectorBase::Create(arg));
+            if (!currentCollector) {
+                InvalidArgs("Unsupported output type!");
+                Usage();
+                return -1;
+            }
+            m_collectors[arg] = currentCollector;
         }
         else if (arg.find(regexp) == 0)
         {
@@ -410,6 +468,8 @@ int TestRunner::ExecTestRunner(const ArgsList& value)
         }
     }
 
+    currentCollector.Reset();
+
     // Show help
     if (showHelp)
     {
@@ -417,12 +477,20 @@ int TestRunner::ExecTestRunner(const ArgsList& value)
         return 0;
     }
 
-    if (!m_collector)
-        m_collector.Reset(TestResultsCollectorBase::Create("text"));
+    if (m_collectors.empty())
+    {
+        TestResultsCollectorBasePtr collector(
+                TestResultsCollectorBase::Create("text"));
+        m_collectors["text"] = collector;
+    }
 
-    if (!m_collector->Configure()) {
-        fprintf(stderr, "Could not configure selected output");
-        return 0;
+    for (auto it = m_collectors.begin(); it != m_collectors.end(); ++it)
+    {
+        if (!it->second->Configure())
+        {
+            fprintf(stderr, "Could not configure selected output");
+            return 0;
+        }
     }
 
     // Run tests
@@ -431,5 +499,10 @@ int TestRunner::ExecTestRunner(const ArgsList& value)
     return 0;
 }
 
+bool TestRunner::getRunIgnored() const
+{
+    return m_runIgnored;
+}
+
 }
 } // namespace DPL
index 4c65949..2b0beca 100644 (file)
@@ -20,7 +20,7 @@
 #
 
 SET(DPL_UTILS_SOURCES
-    ${PROJECT_SOURCE_DIR}/modules/utils/src/file_utils.cpp
+    ${PROJECT_SOURCE_DIR}/modules/utils/src/bash_utils.cpp
     ${PROJECT_SOURCE_DIR}/modules/utils/src/folder_size.cpp
     ${PROJECT_SOURCE_DIR}/modules/utils/src/mime_type_utils.cpp
     ${PROJECT_SOURCE_DIR}/modules/utils/src/warp_iri.cpp
@@ -32,7 +32,7 @@ SET(DPL_UTILS_SOURCES
 
 
 SET(DPL_UTILS_HEADERS
-    ${PROJECT_SOURCE_DIR}/modules/utils/include/dpl/utils/file_utils.h
+    ${PROJECT_SOURCE_DIR}/modules/utils/include/dpl/utils/bash_utils.h
     ${PROJECT_SOURCE_DIR}/modules/utils/include/dpl/utils/folder_size.h
     ${PROJECT_SOURCE_DIR}/modules/utils/include/dpl/utils/mime_type_utils.h
     ${PROJECT_SOURCE_DIR}/modules/utils/include/dpl/utils/warp_iri.h
diff --git a/modules/utils/include/dpl/utils/bash_utils.h b/modules/utils/include/dpl/utils/bash_utils.h
new file mode 100644 (file)
index 0000000..1eb2ba9
--- /dev/null
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2012 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    bash_utils.h
+ * @author  Iwanek Tomasz
+ * @version 1.0
+ */
+
+#ifndef BASH_UTILS_H
+#define BASH_UTILS_H
+
+#include<string>
+
+namespace BashUtils {
+
+/**
+ * Escapes bash special characters in string and return string in double quotes
+ * @param source string to be escaped
+ * @return escaped string
+ */
+std::string escape_arg(const std::string & source);
+
+}
+
+#endif // BASH_UTILS_H
index f012542..35fabb3 100644 (file)
 
 namespace GlobalSettings {
 
-// Methods for getting/setting test mode environment flag
+// Methods for getting test mode environment flag
 bool TestModeEnabled();
+bool PopupsTestModeEnabled();
+bool WarpTestModeEnabled();
+bool RoamingTestModeEnabled();
+bool OCSPTestModeEnabled();
+bool CrlTestModeEnabled();
+bool MakeScreenTestModeEnabled();
 bool IsEmulator();
 
 }
index 30f8114..91f08fd 100644 (file)
  *    limitations under the License.
  */
 /**
- * @file    wrt_utility.h
- * @version    0.6
- * @author    Wei Dong(d.wei@samsung.com)
- * @author    Ma Quan(jason.ma@samsung.com)
- * @brief     Header file of widget manager common functions
+ * @file        wrt_utility.h
+ * @version     0.8
+ * @author      Janusz Majnert <j.majnert@samsung.com>
+ * @brief       Common utility functions
  */
 
 #ifndef _WRT_UTILITY_H_
 #define _WRT_UTILITY_H_
 
-#include <stdbool.h>
-
-#ifdef __cplusplus
-extern "C"
-{
-#endif
-
-#ifndef MAX_WIDGET_PATH_LENGTH
-#define MAX_WIDGET_PATH_LENGTH    1024
-#endif
-
-/**
- * File options
- */
-enum
-{
-    WRT_FILEUTILS_PRESERVE_STATUS = 1,
-    WRT_FILEUTILS_PRESERVE_SYMLINKS = 2,
-    WRT_FILEUTILS_RECUR = 4,
-    WRT_FILEUTILS_FORCE = 8,
-    WRT_FILEUTILS_INTERACTIVE = 16
-};
-
-/**
- * Combine the parentPath and fileName into a new absolute file name.
- *
- * @param[out]    absolutePath
- * @param[in]    parentPath
- * @param[in]    fileName
- *
- * @return    if success, return true; or return false.
- */
-bool _WrtUtilSetAbsolutePath(char* absolutePath,
-        const char* parentPath,
-        const char* fileName);
-
-/**
- * Change the string to bool value,no case sensitive, e.x., "true" or "1" to ture; "False" or "0" to false.
- *
- * @param[in]    value
- * @param[out]    result
- *
- * @return    if success, return true; or return false.
- */
-// KW bool _WrtUtilConvertStrToBool(char* value, bool *result);
+#include <sys/stat.h>
 
 /**
- * Get the dir path and file name from the full path. e.x., "/opt/lib/filename" as fullPath, "/opt/lib/" as dirName, "filename" as fileName.
- * it's necessary to free *dirName or *fileName if either of them is not NULL.
+ * Joins two paths into one
  *
- * @param[in]    fullPath
- * @param[out]    dirName
- * @param[out]    fileName
+ * @param[out] joined  String for storing joined paths
+ * @param[in] parent   String containing the first part of path
+ * @param[in] child    String containing the second part of the path
  *
- * @return
+ * Data stored in joined before the function call will be replaced with joined
+ * paths.
  */
-void _WrtUtilGetDirAndFileName(const char* fullPath,
-        char** dirName,
-        char** fileName);
+void WrtUtilJoinPaths(std::string &joined, const std::string &parent, const std::string &child);
 
-#if 0
 /**
- * Change the provided string into lower case, caller should allocate the memory of source and dest.
+ * Creates directories specified by path
  *
- * @param[in] source    the source string to be changed
- * @param[out] dest    the dest string with lower case
+ * @param[in]  path    Path to create
+ * @param[in]  mode    access flags, default to 0755
+ * @return    true on success, false on failure
  *
- * return        if success, return true, or return false.
+ * Function creates directory specified by path argument and all directories
+ * leading up to it, if they don't exist. Note that if yout wish to create
+ * several nested directories, you must make sure that the mode flag allows you
+ * to write and search the direcotries you create.
  */
-bool _WrtUtilStringToLower(const char* source,
-        char* dest);
-#endif
+bool WrtUtilMakeDir(const std::string &newpath, mode_t mode=0755);
 
 /**
- * Compare two string, no case sensitive.
+ * This function removes the directory or file pointed to by path
  *
- * @param[in] srcStr
- * @param[in] destStr
+ * @param[in] path  Path to the file/directory to be deleted
  *
- * return        return true if the two strings are identical, or return false.
+ * @return true on success, false otherwise
  */
-// KW bool _WrtUtilStringCmp(const char* srcStr, const char* destStr);
+bool WrtUtilRemove(const std::string &path);
 
 /**
- * This function is used to make a directory.
- * it's neccessary to free the returned dir path.
+ * This function converts a string to lowercase
  *
- * @param[in] path    Specified the directory path
- * @param[in] mode    Operation mode the you want to set
- * @param[in] flags   WRT_FILEUTILS_RECUR if you want to make parent's directory recusively,
- *                    WRT_FILEUTILS_NONE if not.
+ * @param[in]    in   the string to be converted
+ * @param[out] out  the string for placing converted values in
  *
- * @return    TRUE on success or FALSE on failure.
+ * The previous data stored in string out will be replaced with converted
+ * string from string in
  */
-bool _WrtMakeDir (const char *path,
-        long mode,
-        int flags);
+void WrtUtilStringToLower(std::string &out, const std::string &in);
 
 /**
- * This function is used to change to specified directory.
- * If the directory does not exist, it will create it directly.
+ * Checks if path exists and is a regular file
  *
- * @param[in]  path    Specified the directory path
+ * @param[in] path   the string representing path to check
  *
- * @return    TRUE on success or FALSE on failure.
+ * @return true if regular file is accessible under path, false otherwise
  */
-bool _WrtUtilChangeDir(const char* path);
+bool WrtUtilFileExists(const std::string &path);
 
 /**
- * This function is used to remove a directory from the file system.
+ * Checks if path exists and is a directory
  *
- * @param[in]  path    Specified the directory path
+ * @param[in] path   the string representing path to check
  *
- * @return    TRUE on success or FALSE on failure.
+ * @return true if directory is accessible under path, false otherwise
  */
-bool _WrtUtilRemoveDir(const char* path);
-
-// KW /**
-// KW  * This function is used to make a temp directory in root directory.
-// KW  *
-// KW  * @param[in]  root    Specified the root directory
-// KW  *
-// KW  * @return    if fails, return NULL, else return the temp path.
-// KW  * it's necessary to free the returned memory space.
-// KW  */
-// KW char* _WrtUtilMakeTempDir(const char* root);
-
-/**
- * This function is used to convert a string to lowercase.
- *
- * @param[in]  str            the string need to be converted.
- * @param[in]  lowerStr    the converted string.
- *
- * @return    TRUE on success or FALSE on failure.
- */
-bool _WrtUtilStringToLower(const char* str,
-        char** lowerStr);
-
-#ifdef __cplusplus
-}
-#endif
+bool WrtUtilDirExists(const std::string &path);
 
 #endif //_WRT_UTILITY_H_
 
diff --git a/modules/utils/src/bash_utils.cpp b/modules/utils/src/bash_utils.cpp
new file mode 100644 (file)
index 0000000..5796bc6
--- /dev/null
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2012 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    bash_utils.cpp
+ * @author  Iwanek Tomasz
+ * @version 1.0
+ */
+
+#include<dpl/utils/bash_utils.h>
+#include<dpl/log/log.h>
+
+#include<string>
+
+namespace BashUtils {
+
+std::string escape_arg(const std::string & source)
+{
+    static const std::string special("!$`\\\"");
+    std::string ret = "\"";
+    for(std::string::const_iterator iter = source.begin(); iter != source.end(); ++iter)
+    {
+        if(special.find(*iter) != std::string::npos)
+        {
+            ret += std::string("\\") + *iter;
+        }
+        else
+        {
+            ret += *iter;
+        }
+    }
+    return ret + "\"";
+}
+
+}
index 47f8229..bc2afdb 100644 (file)
@@ -22,9 +22,9 @@
  */
 
 #include <string.h>
-#include <dirent.h>
 #include <sys/types.h>
 #include <sys/stat.h>
+#include <fts.h>
 
 #include <sstream>
 #include <vector>
 #include <dpl/utils/folder_size.h>
 
 namespace Utils {
-namespace {
-
-size_t getObjectSize(const std::string& path)
-{
-    struct stat tmp;
-
-    if (stat(path.c_str(), &tmp) == -1) {
-        LogError("Failed to open file" << path);
-        return 0;
-    }
-    //it is not a file nor a directory
-    //not counting
-    if (!S_ISDIR(tmp.st_mode) && !S_ISREG(tmp.st_mode)) {
-        LogWarning("Not a regular file nor a directory: " << path);
-        return 0;
-    }
-    return tmp.st_size;
-}
-}
 
 size_t getFolderSize(const std::string& path)
 {
     size_t size = 0;
-
-    DIR *dir;
-    std::vector<std::string> localDirs;
-    if ((dir=opendir(path.c_str())) == NULL) {
-        LogError("Cannot open dir " << path);
+    FTS *fts;
+    FTSENT *ftsent;
+    char * const paths[] = {const_cast<char * const>(path.c_str()), NULL};
+
+    if ((fts = fts_open(paths, FTS_PHYSICAL|FTS_NOCHDIR, NULL)) == NULL) {
+        //ERROR
+        int error = errno;
+        LogWarning(__PRETTY_FUNCTION__ << ": fts_open failed with error: "
+                << strerror(error));
         return 0;
     }
-    struct dirent* el;
-    while ((el = readdir(dir)) != 0) {
-        if (strcmp(el->d_name, ".") == 0 || strcmp(el->d_name, "..") == 0) {
-            continue;
-        }
-        struct stat tmp;
-        std::string local = path + el->d_name;
-        if (stat(local.c_str(), &tmp) == -1) {
-            LogError("Failed to open file " << local);
-            char* errstring = strerror(errno);
-            LogError("Reason: " << errstring);
-            continue;
-        }
 
-        size += getObjectSize(local);
-        if (S_ISDIR(tmp.st_mode)) {
-            localDirs.push_back(local + "/");
+    while ((ftsent = fts_read(fts)) != NULL) {
+        switch (ftsent->fts_info) {
+            case FTS_DP:
+            case FTS_DC:
+                //directory in postorder and directory causing a loop
+                break;
+            case FTS_F:
+            case FTS_D:
+            case FTS_NSOK:
+            case FTS_SL:
+            case FTS_SLNONE:
+            case FTS_DEFAULT:
+                //regular files and other objects that can be counted
+                size += ftsent->fts_statp->st_size;
+                break;
+            case FTS_NS:
+            case FTS_DOT:
+            case FTS_DNR:
+            case FTS_ERR:
+            default:
+                LogWarning(__PRETTY_FUNCTION__
+                        << ": traversal failed on file: "
+                        << ftsent->fts_path
+                        << " with error: "
+                        << strerror(ftsent->fts_errno));
+                return 0;
         }
     }
 
-    closedir(dir);
-
-    FOREACH (localDir, localDirs) {
-        size += getFolderSize(*localDir);
+    if (fts_close(fts) == -1) {
+        int error = errno;
+        LogWarning(__PRETTY_FUNCTION__ << ": fts_close failed with error: "
+                << strerror(error));
+        return 0;
     }
 
     return size;
index a0877f6..1a420f7 100644 (file)
 #include <cstdlib>
 #include <cstring>
 #include <string>
+#include <sstream>
 #include <sys/utsname.h>
 #include <dpl/utils/wrt_global_settings.h>
 
 namespace GlobalSettings {
 
 namespace {
+const int ROAMING_TEST = 0x00000001;
+const int POPUPS_TEST =  0x00000002;
+const int OCSP_TEST = 0x00000004;
+const int WARP_TEST = 0x00000008;
+const int CRL_TEST = 0x00000010;
+const int SCREEN_SHOT_TEST = 0x00000020;
+const int ALL_TEST = (ROAMING_TEST | POPUPS_TEST | OCSP_TEST | WARP_TEST
+                      | CRL_TEST | SCREEN_SHOT_TEST);
+const char* WRT_TEST_MODE = "WRT_TEST_MODE";
 const char* MACHINE_NAME_EMUL = "emulated"; // "arch_emulated"
 enum MachineType
 {
@@ -38,12 +48,11 @@ enum MachineType
 };
 
 struct Settings {
-    bool testMode;
+    int testModes;
     bool isEmulator;
 
     Settings()
-    : testMode(false),
-    isEmulator(false)
+    : isEmulator(false), testModes(0)
     {}
 };
 
@@ -81,8 +90,32 @@ bool initializeGlobalSettings()
 
     // ignore environment variables if this flag is not set
 #ifdef GLOBAL_SETTINGS_CONTROL
-    const char *env = getenv("WRT_TEST_MODE");
-    gSettings.testMode = (env != NULL && 0 == strncmp(env, "1", 1));
+    char * envStr = getenv(WRT_TEST_MODE);
+    int testMode = 0;
+    if (NULL != envStr) {
+        std::string env = envStr;
+        if ("1" == env) {
+            testMode = ALL_TEST;
+        } else {
+            std::istringstream str(envStr);
+            while (std::getline(str, env, '|')) {
+                if ("popups" == env) {
+                        testMode |= POPUPS_TEST;
+                } else if ("roaming" == env) {
+                        testMode |= ROAMING_TEST;;
+                } else if ("ocsp" == env) {
+                        testMode |= OCSP_TEST;;
+                } else if ("warp" == env) {
+                        testMode |= WARP_TEST;;
+                } else if ("crl" == env) {
+                        testMode |= CRL_TEST;
+                } else if ("screen" == env) {
+                        testMode |= SCREEN_SHOT_TEST;;
+                }
+            }
+        }
+        gSettings.testModes = testMode;
+    }
     // TODO other settings initialization
 
 #endif
@@ -93,7 +126,26 @@ bool initializeGlobalSettings()
 
 bool TestModeEnabled()
 {
-    return gSettings.testMode;
+    return ((gSettings.testModes & ALL_TEST) == ALL_TEST);
+}
+
+bool PopupsTestModeEnabled() {
+    return (gSettings.testModes & POPUPS_TEST);
+}
+bool WarpTestModeEnabled() {
+    return (gSettings.testModes & WARP_TEST);
+}
+bool RoamingTestModeEnabled() {
+    return (gSettings.testModes & ROAMING_TEST);
+}
+bool OCSPTestModeEnabled() {
+    return (gSettings.testModes & OCSP_TEST);
+}
+bool CrlTestModeEnabled() {
+    return (gSettings.testModes & CRL_TEST);
+}
+bool MakeScreenTestModeEnabled() {
+    return (gSettings.testModes & SCREEN_SHOT_TEST);
 }
 
 bool IsEmulator()
index 756e00c..fbe2f8a 100644 (file)
  *    limitations under the License.
  */
 /**
- * @file       wrt_utility.cpp
- * @version    0.6
- * @author Wei Dong(d.wei@samsung.com)
- * @author Ma Quan(jason.ma@samsung.com)
- * @brief  This file implemented some common functions for widget manager
+ * @file        wrt_utility.cpp
+ * @version     0.8
+ * @author      Janusz Majnert <j.majnert@samsung.com>
+ * @brief       Implementation of some common utility functions
  */
 
-#include <assert.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <ctype.h>
-#include <dirent.h>
-#include <fcntl.h>
-#include <unistd.h>
-#include <stdarg.h>
-#include <errno.h>
-#include <libgen.h>
-#include <sys/types.h>
+#include <fts.h>
+#include <string>
 #include <sys/stat.h>
+#include <sys/types.h>
+#include <errno.h>
+#include <ctype.h>
 #include <dpl/log/log.h>
 #include <dpl/utils/wrt_utility.h>
 
-using namespace std;
-
-bool _WrtUtilSetAbsolutePath(char* absolutePath,
-        const char* parentPath,
-        const char* fileName)
+void WrtUtilJoinPaths(std::string &joined, const std::string &parent, const std::string &child)
 {
-    int len;
-    if (NULL == absolutePath || NULL == parentPath || NULL == fileName) {
-        return false;
+    size_t parent_len = parent.length();;
+    joined=parent;
+    joined+=child;
+    //In case someone used windows-style paths
+    std::replace(joined.begin(), joined.end(), '\\', '/');
+
+    if (parent_len != 0 && child.length() != 0) {
+        if (joined[parent_len-1] != '/' && joined[parent_len] != '/')
+            joined.insert(parent_len, "/");
+        else if (joined[parent_len-1] == '/' && joined[parent_len] == '/')
+            joined.erase(parent_len, 1);
     }
-    len = strlen(parentPath);
-    if (len > 0) {
-        // not check the valid of parentPath and fileName.
-        if (parentPath[len - 1] == '/') {
-            snprintf(absolutePath,
-                     MAX_WIDGET_PATH_LENGTH,
-                     "%s%s",
-                     parentPath,
-                     fileName);
-        } else {
-            snprintf(absolutePath,
-                     MAX_WIDGET_PATH_LENGTH,
-                     "%s/%s",
-                     parentPath,
-                     fileName);
-        }
-    } else {
-        LogDebug("The parent path is null");
-        return false;
-    }
-
-    //some widget use Windows notation. We need to change '\' to '/'
-    for (int i = 0; absolutePath[i] != 0; ++i) {
-        if (absolutePath[i] == '\\') {
-            absolutePath[i] = '/';
-        }
-    }
-
-    return true;
 }
 
-// KW bool _WrtUtilConvertStrToBool(char* value, bool *result)
-// KW {
-// KW     bool ret = false;
-// KW     if (NULL == value || NULL == result)
-// KW     {
-// KW         return ret;
-// KW     }
-// KW
-// KW     char* source = value;
-// KW     char* changed = (char*)malloc(strlen(value) + 1);
-// KW     if (NULL == changed)
-// KW     {
-// KW         return ret;
-// KW     }
-// KW     memset(changed, 0, strlen(value) + 1);
-// KW
-// KW     char* cur = changed;
-// KW     while(*source)
-// KW     {
-// KW         *cur++ = tolower(*source++);
-// KW     }
-// KW     if (!strcmp(changed,"false") || !strcmp(changed,"0"))
-// KW     {
-// KW         *result = false;
-// KW         ret = true;
-// KW     }
-// KW     else if(!strcmp(changed,"true") || !strcmp(changed,"1"))
-// KW     {
-// KW         *result = true;
-// KW         ret = true;
-// KW     }
-// KW     free(changed);
-// KW
-// KW     return ret;
-// KW }
-
-void _WrtUtilGetDirAndFileName(const char* fullPath,
-        char** dirName,
-        char** fileName)
+bool WrtUtilMakeDir(const std::string &newpath, mode_t mode)
 {
-    int length = 0;
-    int index = 0;
-    if (NULL == fullPath || (NULL == dirName && NULL == fileName)) {
-        return;
-    }
+    size_t pos = 0;
+    int error;
 
-    length = strlen(fullPath);
-    for (index = length - 1; index >= 0; index--) {
-        if ('/' == fullPath[index]) {
-            if (index == length - 1) {
-                LogDebug(" Warning: The end of directroy is '/'! ");
-                if (dirName) {
-                    *dirName = (char*)malloc(sizeof(char) * (length + 1));
-                    if (*dirName != NULL) {
-                        memset(*dirName, 0, sizeof(char) * (length + 1));
-                        strncpy(*dirName, fullPath, length);
-                    }
-                }
-                return;
-            }
-            break;
-        }
-    }
-    if (index >= 0) {
-        if (dirName) {
-            int dirName_len = index + 2;
+    if (newpath.length() == 0) return false;
 
-            *dirName = (char*)malloc(sizeof(char) * dirName_len);
-            if (*dirName != NULL) {
-                memset(*dirName, 0, sizeof(char) * dirName_len);
-                strncpy(*dirName, fullPath, dirName_len - 1);
-            }
-        }
+    std::string path=newpath;
 
-        if (fileName) {
-            int fileName_len = length - index;
+    if (*(path.rbegin()) != '/') path += '/';
 
-            *fileName = (char*)malloc(sizeof(char) * fileName_len);
-            if (*fileName != NULL) {
-                memset(*fileName, 0, sizeof(char) * fileName_len);
-                strncpy(*fileName, &fullPath[index + 1], fileName_len - 1);
-            }
-        }
-    } else {
-        if (fileName) {
-            *fileName = (char*)malloc(sizeof(char) * (length + 1));
-            if (*fileName != NULL) {
-                memset(*fileName, 0, sizeof(char) * (length + 1));
-                strncpy(*fileName, fullPath, length);
-            }
+    while ((pos = path.find('/', pos+1)) != std::string::npos) {
+        if (mkdir(path.substr(0, pos).c_str(), mode) != 0) {
+            error=errno;
+            if (error == EEXIST) continue;
+            LogWarning(__PRETTY_FUNCTION__ << ": failed to create directory "
+                        << path.substr(0,pos)
+                        << ". Error: "
+                        << strerror(error));
+            return false;
         }
     }
+    return true;
 }
 
-// KW bool _WrtUtilStringCmp(const char* srcStr, const char* destStr)
-// KW {
-// KW     bool ret = false;
-// KW     char* strString = NULL;
-// KW     char* destString = NULL;
-// KW
-// KW     if (NULL == srcStr || NULL == destStr )
-// KW     {
-// KW         return ret;
-// KW     }
-// KW
-// KW     _WrtUtilStringToLower(srcStr, &strString);
-// KW     _WrtUtilStringToLower(destStr,&destString);
-// KW
-// KW     if(!strcmp(strString, destString))
-// KW     {
-// KW         ret = true;
-// KW     }
-// KW
-// KW     free(strString);
-// KW     free(destString);
-// KW
-// KW     return ret;
-// KW }
-
-// check it deeply later.
-bool _WrtMakeDir (const char *path,
-        long mode,
-        int flags)
+bool WrtUtilRemove(const std::string &path)
 {
-    if (NULL == path) {
+    FTS *fts;
+    FTSENT *ftsent;
+    bool rv = true;
+    int error = 0;
+    char * const paths[] = {const_cast<char * const>(path.c_str()), NULL};
+
+    if ((fts = fts_open(paths, FTS_PHYSICAL|FTS_NOCHDIR, NULL)) == NULL) {
+        //ERROR
+        error = errno;
+        LogWarning(__PRETTY_FUNCTION__ << ": fts_open failed with error: "
+                    << strerror(error));
         return false;
     }
 
-    const int defaultMode = 0777;
-    if (!(flags & WRT_FILEUTILS_RECUR)) {
-        if (mkdir(path, defaultMode) < 0) {
-            LogDebug("Failed to make dir " << path);
-            return false;
-        }
-        if (mode != -1 && chmod(path, mode) < 0) {
-            LogDebug("Failed to chmod");
-            remove(path);
-            return false;
-        }
-    } else {
-        struct stat st;
-        if (stat(path, &st) < 0 && errno == ENOENT) {
-            bool ret;
-            char *buf = NULL;
-            char *parent = NULL;
-            //            mode_t mask;
-
-            //            mask = umask (0);
-            //            umask (mask);
-
-            buf = strdup(path);
-            parent = dirname(buf);
-            //ret = _WrtMakeDir(parent, (defaultMode & ~mask) | 0300, WRT_FILEUTILS_RECUR);
-            ret = _WrtMakeDir(parent, (defaultMode) | 0300, WRT_FILEUTILS_RECUR);
-            free(buf);
-
-            if ((!ret) || (!_WrtMakeDir(path, mode, 0))) {
-                LogDebug("Failed to _WrtMakeDir");
-                return false;
-            }
+    while ((ftsent = fts_read(fts)) != NULL) {
+        switch (ftsent->fts_info) {
+            case FTS_D:
+                //directory in preorder - do nothing
+                break;
+            case FTS_DP:
+                //directory in postorder - remove
+                if (rmdir(ftsent->fts_accpath) != 0) {
+                    error = errno;
+                    LogWarning(__PRETTY_FUNCTION__
+                                << ": rmdir failed with error: "
+                                << strerror(error));
+                    rv = false;
+                }
+                break;
+            case FTS_DC:
+            case FTS_F:
+            case FTS_NSOK:
+            case FTS_SL:
+            case FTS_SLNONE:
+            case FTS_DEFAULT:
+                //regular files and other objects that can safely be removed
+                if (unlink(ftsent->fts_accpath) != 0) {
+                    error = errno;
+                    LogWarning(__PRETTY_FUNCTION__
+                                << ": unlink failed with error: "
+                                << strerror(error));
+                    rv = false;
+                }
+                break;
+            case FTS_NS:
+                LogWarning(__PRETTY_FUNCTION__
+                            << ": couldn't get stat info for file: "
+                            << ftsent->fts_path
+                            << ". The error was: "
+                            << strerror(ftsent->fts_errno));
+                rv = false;
+                break;
+            case FTS_DOT:
+            case FTS_DNR:
+            case FTS_ERR:
+            default:
+                LogWarning(__PRETTY_FUNCTION__
+                            << ": traversal failed with error: "
+                            << strerror(ftsent->fts_errno));
+                rv = false;
+                break;
         }
     }
 
-    return true;
+    if (fts_close(fts) == -1) {
+        error = errno;
+        LogWarning(__PRETTY_FUNCTION__ << ": fts_close failed with error: "
+                    << strerror(error));
+        rv = false;
+    }
+    return rv;
 }
 
-bool _WrtUtilChangeDir(const char* path)
+void WrtUtilStringToLower(std::string &out, const std::string &in)
 {
-    if (NULL == path) {
-        return false;
+    out.clear();
+    for (std::string::const_iterator it=in.begin(); it<in.end(); ++it) {
+        out += static_cast<char>(tolower(*it));
     }
-    if (-1 == chdir(path)) {
-        if (ENOENT == errno) {
-            if (!_WrtMakeDir(path, 0664, WRT_FILEUTILS_RECUR)) {
-                return false;
-            }
-            if (-1 == chdir(path)) {
-                remove(path);
-                return false;
-            }
-        } else {
-            return false;
-        }
-    }
-
-    return true;
 }
 
-bool _WrtUtilRemoveDir(const char* path)
+bool WrtUtilFileExists(const std::string &path)
 {
-    DIR* dir = NULL;
-    struct dirent* ptr = NULL;
-    char childPath[MAX_WIDGET_PATH_LENGTH + 1] = { 0 };
-    if (path == NULL) {
-        LogWarning("Path is null");
-        return false;
-    }
-    dir = opendir(path);
-    if (NULL != dir) {
-        while ((ptr = readdir(dir)) != NULL) {
-            if ((!strcmp(ptr->d_name, ".")) || (!strcmp(ptr->d_name, ".."))) {
-                continue;
-            }
-            int len = strlen(path);
-            if (path[len - 1] == '/') {
-                snprintf(childPath,
-                         MAX_WIDGET_PATH_LENGTH,
-                         "%s%s",
-                         path,
-                         ptr->d_name);
-            } else {
-                snprintf(childPath,
-                         MAX_WIDGET_PATH_LENGTH,
-                         "%s/%s",
-                         path,
-                         ptr->d_name);
-            }
-            if (ptr->d_type == DT_DIR) {
-                if (!_WrtUtilRemoveDir(childPath)) {
-                    closedir(dir);
-                    return false;
-                }
-            } else {
-                if (unlink(childPath) != 0) {
-                    closedir(dir);
-                    LogWarning("Failed to remove file " << childPath);
-                    return false;
-                }
-            }
-        }
-        closedir(dir);
-    } else if (errno == ENOTDIR) {
-        if (unlink(path) != 0) {
-            LogWarning("Failed to remove file " << path);
-            return false;
-        }
-        return true;
-    } else if (errno == ENOENT) { //not exist
-        LogWarning("Cannot remove non existent directory " << path);
-        return true;
+    struct stat tmp;
+    if (stat(path.c_str(),&tmp) == 0) {
+        return S_ISREG(tmp.st_mode);
     } else {
-        LogWarning("Can't remove directory " << path);
         return false;
     }
-    if (rmdir(path) != 0) {
-        LogWarning("Removing directory failed :" << path << " errno: " << errno);
-        return false;
-    }
-
-    return true;
 }
 
-bool
-_WrtUtilStringToLower(const char* str,
-        char** lowerStr)
+bool WrtUtilDirExists(const std::string &path)
 {
-    if (!str || !lowerStr) {
-        return true;
-    }
-
-    char* cur = NULL;
-    int length = strlen(str);
-
-    *lowerStr = (char*)malloc(length + 1);
-
-    if (!(*lowerStr)) {
+    struct stat tmp;
+    if (stat(path.c_str(),&tmp) == 0) {
+        return S_ISDIR(tmp.st_mode);
+    } else {
         return false;
     }
-
-    memset(*lowerStr, 0, length + 1);
-    strncpy(*lowerStr, str, length);
-
-    cur = *lowerStr;
-
-    while (*str != '\0') {
-        *cur++ = tolower(*str++);
-        //cur++;
-    }
-
-    return true;
 }
 
index a509ff0..c6f7057 100644 (file)
@@ -67,6 +67,7 @@ SET(WRT_DAO_INCLUDE_DIRS
     ${PROJECT_SOURCE_DIR}/modules/core/include
     ${PROJECT_SOURCE_DIR}/modules/db/include
     ${PROJECT_SOURCE_DIR}/modules/log/include
+    ${PROJECT_SOURCE_DIR}/modules/localization/include
     ${WRT_DAO_DEPS_INCLUDE_DIRS}
     )
 
index 31979e9..7701019 100755 (executable)
@@ -113,5 +113,48 @@ FeatureHandle RegisterFeature(const PluginMetafileData::Feature &feature,
     }
 }
 
+void UnregisterFeature(FeatureHandle featureHandle)
+{
+    Try
+    {
+        LogDebug("Unregistering Feature " << featureHandle);
+        DPL::DB::ORM::wrt::ScopedTransaction transaction(
+                &WrtDatabase::interface());
+
+        if (FeatureDAOReadOnly::isFeatureInstalled(featureHandle)) {
+            LogError("Feature handle is invalid");
+            return;
+        }
+
+        using namespace DPL::DB::ORM;
+        using namespace DPL::DB::ORM::wrt;
+
+        // Unregister DeviceCapabilities
+        FeatureDAOReadOnly::DeviceCapabilitiesList capabilitiesList =
+            FeatureDAOReadOnly(featureHandle).GetDeviceCapabilities();
+
+        FOREACH(it, capabilitiesList) {
+            WRT_DB_DELETE(del, DeviceCapabilities, &WrtDatabase::interface())
+            del->Where(
+                Equals<DeviceCapabilities::DeviceCapName>(
+                    DPL::FromUTF8String(*it)));
+            del->Execute();
+        }
+
+        // Unregister Feature
+        WRT_DB_DELETE(del, FeaturesList, &WrtDatabase::interface())
+        del->Where(Equals<FeaturesList::FeatureUUID>(featureHandle));
+        del->Execute();
+        transaction.Commit();
+
+        return;
+    }
+    Catch(DPL::DB::SqlConnection::Exception::Base){
+        ReThrowMsg(FeatureDAOReadOnly::Exception::DatabaseError,
+                   "Fail to unregister Feature");
+    }
+}
+
+
 } // namespace FeatureDAO
 } // namespace WrtDB
index 6ce4fd1..6db3f0d 100644 (file)
@@ -356,4 +356,38 @@ FeatureDAOReadOnly::GetDevCapWithFeatureHandle()
     }
 }
 
+FeatureDAOReadOnly::FeatureMap
+FeatureDAOReadOnly::GetFeatures(const std::list<std::string>& featureNames)
+{
+    Try {
+        using namespace DPL::DB::ORM;
+        using namespace DPL::DB::ORM::wrt;
+
+        std::set<typename FeaturesList::FeatureName::ColumnType> nameList;
+        FOREACH(nm, featureNames) {
+            nameList.insert(DPL::FromUTF8String(*nm));
+        }
+
+        WRT_DB_SELECT(select, FeaturesList, &WrtDatabase::interface())
+        select->Where(In<FeaturesList::FeatureName>(nameList));
+
+        FeatureMap featureMap;
+        FeatureData featureData;
+        FeaturesList::Select::RowList rows = select->GetRowList();
+        FOREACH(rowIt, rows) {
+            featureData.featureName = DPL::ToUTF8String(
+                    rowIt->Get_FeatureName());
+            featureData.pluginHandle = rowIt->Get_PluginPropertiesId();
+            featureMap.insert(std::pair<FeatureHandle, FeatureData>(
+                    rowIt->Get_FeatureUUID(), featureData));
+        }
+
+        return featureMap;
+    }
+    Catch(DPL::DB::SqlConnection::Exception::Base){
+        ReThrowMsg(FeatureDAOReadOnly::Exception::DatabaseError,
+                   "Failure during getting GetFeatures");
+    }
+}
+
 } // namespace WrtDB
index ea151f6..a80ae85 100644 (file)
@@ -209,4 +209,37 @@ void PluginDAO::setPluginInstallationStatus(DbPluginHandle pluginHandle,
     }
 }
 
+void PluginDAO::unregisterPlugin(DbPluginHandle pluginHandle)
+{
+    LogDebug("unregisterPlugin plugin. Handle: " << pluginHandle);
+
+    Try {
+        DPL::DB::ORM::wrt::ScopedTransaction transaction(
+                &WrtDatabase::interface());
+        DbPluginHandle handle;
+
+        if (!isPluginInstalled(pluginHandle)) {
+            LogInfo("PluginHandle is invalid. Handle: " << handle);
+            return;
+
+        } else {
+            using namespace DPL::DB::ORM;
+            using namespace DPL::DB::ORM::wrt;
+
+            WRT_DB_DELETE(del, PluginProperties, &WrtDatabase::interface())
+            del->Where(
+                Equals<PluginProperties::PluginPropertiesId>(pluginHandle));
+            del->Execute();
+
+            transaction.Commit();
+            LogDebug(" >> Plugin Unregistered. Handle: " << handle);
+        }
+    }
+    Catch(DPL::DB::SqlConnection::Exception::Base)
+    {
+        ReThrowMsg(PluginDAO::Exception::DatabaseError,
+                   "Failed in UnregisterPlugin");
+    }
+}
+
 } // namespace WrtDB
index e04fd47..4c7084a 100644 (file)
@@ -71,6 +71,11 @@ WidgetDAO::WidgetDAO(DPL::OptionalString widgetGUID) :
 {
 }
 
+WidgetDAO::WidgetDAO(DPL::String pkgName) :
+    WidgetDAOReadOnly(WidgetDAOReadOnly::getHandle(pkgName))
+{
+}
+
 WidgetDAO::~WidgetDAO()
 {
 }
@@ -157,8 +162,12 @@ void WidgetDAO::registerWidget(
         registerWidgetCertificates(widgetHandle, wacSecurity);
 
         CertificateChainList list;
-        wacSecurity.getCertificateChainList(list);
-        registerLaunchCertificates(widgetHandle,list);
+        wacSecurity.getCertificateChainList(list, SIGNATURE_DISTRIBUTOR);
+        registerCertificatesChains(widgetHandle, SIGNATURE_DISTRIBUTOR, list);
+
+        list.clear();
+        wacSecurity.getCertificateChainList(list, SIGNATURE_AUTHOR);
+        registerCertificatesChains(widgetHandle, SIGNATURE_AUTHOR, list);
 
         registerWidgetSettings(widgetHandle, widgetRegInfo);
 
@@ -194,6 +203,7 @@ void WidgetDAO::registerWidgetExtendedInfo(DbWidgetHandle widgetHandle,
     row.Set_test_widget(regInfo.isTestWidget);
     row.Set_install_time(regInfo.installedTime);
     row.Set_splash_img_src(regInfo.configInfo.splashImgSrc);
+    row.Set_background_page(regInfo.configInfo.backgroundPage);
 
 
     DO_INSERT(row, WidgetExtendedInfo)
@@ -481,7 +491,8 @@ void WidgetDAO::registerWidgetCertificates(DbWidgetHandle widgetHandle,
     }
 }
 
-void WidgetDAO::registerLaunchCertificates(DbWidgetHandle widgetHandle,
+void WidgetDAO::registerCertificatesChains(DbWidgetHandle widgetHandle,
+        CertificateSource certificateSource,
         const CertificateChainList &certificateChainList)
 {
     using namespace DPL::DB::ORM;
@@ -490,6 +501,7 @@ void WidgetDAO::registerLaunchCertificates(DbWidgetHandle widgetHandle,
     {
         WidgetCertificate::Row row;
         row.Set_app_id(widgetHandle);
+        row.Set_cert_source(certificateSource);
         row.Set_encoded_chain(DPL::FromASCIIString(*certChain));
 
         DO_INSERT(row, WidgetCertificate);
@@ -552,6 +564,37 @@ void WidgetDAO::registerEncryptedResouceInfo(DbWidgetHandle widgetHandle,
     }
 }
 
+void WidgetDAO::registerExternalLocations(const ExternalLocationList & externals)
+{
+    SQL_CONNECTION_EXCEPTION_HANDLER_BEGIN
+    {
+        using namespace DPL::DB::ORM;
+        using namespace DPL::DB::ORM::wrt;
+        DPL::DB::ORM::wrt::ScopedTransaction transaction(&WrtDatabase::interface());
+        LogDebug("Inserting external files for widgetHandle: " << m_widgetHandle);
+        FOREACH(it, externals)
+        {
+            WidgetExternalLocations::Row row;
+            row.Set_app_id(m_widgetHandle);
+            row.Set_path(DPL::FromUTF8String(*it));
+
+            DO_INSERT(row, WidgetExternalLocations)
+        }
+        transaction.Commit();
+    }
+    SQL_CONNECTION_EXCEPTION_HANDLER_END("Failed to register external files");
+}
+
+void WidgetDAO::unregisterAllExternalLocations()
+{
+    using namespace DPL::DB::ORM;
+    using namespace DPL::DB::ORM::wrt;
+    LogDebug("Deleting external files for widgetHandle: " << m_widgetHandle);
+    WRT_DB_DELETE(del, WidgetExternalLocations, &WrtDatabase::interface());
+    del->Where(Equals<WidgetExternalLocations::app_id>(m_widgetHandle));
+    del->Execute();
+}
+
 #undef DO_INSERT
 
 void WidgetDAO::unregisterWidget(DbWidgetHandle widgetHandle)
index a89233b..e9fc3ec 100644 (file)
@@ -35,6 +35,7 @@
 #include <dpl/wrt-dao-ro/widget_config.h>
 #include <dpl/wrt-dao-ro/feature_dao_read_only.h>
 #include <orm_generator_wrt.h>
+#include <LanguageTagsProvider.h>
 
 namespace WrtDB {
 
@@ -104,6 +105,12 @@ WidgetDAOReadOnly::WidgetDAOReadOnly(DPL::OptionalString widgetGUID) :
 {
 }
 
+WidgetDAOReadOnly::WidgetDAOReadOnly(DPL::String pkgName) :
+    m_widgetHandle(WidgetDAOReadOnly::getHandle(pkgName))
+{
+
+}
+
 WidgetDAOReadOnly::~WidgetDAOReadOnly()
 {
 }
@@ -205,7 +212,7 @@ DPL::String WidgetDAOReadOnly::getPath() const
         DPL::OStringStream strAppId;
         strAppId << m_widgetHandle;
         DPL::OptionalString pkgname = getPkgname();
-        path += L"/" + *pkgname + L"/";
+        path += L"/" + *pkgname;
         path += srcPath + L"/";
     }
 
@@ -373,6 +380,16 @@ DbWidgetHandleList WidgetDAOReadOnly::getHandleList()
     SQL_CONNECTION_EXCEPTION_HANDLER_END("Failed to get handle list")
 }
 
+DbWidgetDAOReadOnlyList WidgetDAOReadOnly::getWidgetList()
+{
+    LogDebug("Getting DbWidget List");
+    DbWidgetDAOReadOnlyList list;
+    FOREACH(iterator, getHandleList()) {
+        list.push_back(WidgetDAOReadOnlyPtr(new WidgetDAOReadOnly(*iterator)));
+    }
+    return list;
+}
+
 bool WidgetDAOReadOnly::isWidgetInstalled(DbWidgetHandle handle)
 {
     LogDebug("Checking if widget exist. Handle: " << handle);
@@ -407,12 +424,36 @@ bool WidgetDAOReadOnly::isWidgetInstalled(DPL::String pkgName)
     SQL_CONNECTION_EXCEPTION_HANDLER_END("Failed to check if widget exist")
 }
 
-CertificateChainList WidgetDAOReadOnly::getWidgetCertificate() const
+ExternalLocationList WidgetDAOReadOnly::getWidgetExternalLocations() const
+{
+    LogDebug("Getting WidgetExtranalFiles List");
+    ExternalLocationList result;
+    SQL_CONNECTION_EXCEPTION_HANDLER_BEGIN
+    {
+        using namespace DPL::DB::ORM;
+        using namespace DPL::DB::ORM::wrt;
+        WRT_DB_SELECT(select, WidgetExternalLocations, &WrtDatabase::interface());
+        select->Where(Equals<WidgetExternalLocations::app_id>(m_widgetHandle));
+        WidgetExternalLocations::Select::RowList rows = select->GetRowList();
+        FOREACH(it, rows)
+        {
+            result.push_back(DPL::ToUTF8String(it->Get_path()));
+        }
+    }
+    SQL_CONNECTION_EXCEPTION_HANDLER_END("Failed to get handle list")
+    return result;
+}
+
+CertificateChainList WidgetDAOReadOnly::getWidgetCertificate(
+        CertificateSource source) const
 {
     using namespace DPL::DB::ORM;
     using namespace DPL::DB::ORM::wrt;
     WRT_DB_SELECT(select, WidgetCertificate, &WrtDatabase::interface())
-    select->Where(Equals<WidgetCertificate::app_id>(m_widgetHandle));
+    select->Where(
+        And(
+            Equals<WidgetCertificate::app_id>(m_widgetHandle),
+            Equals<WidgetCertificate::cert_source>(source)));
 
     std::list<DPL::DB::ORM::wrt::WidgetCertificate::Row> chainList = select->GetRowList();
 
@@ -961,7 +1002,7 @@ void WidgetDAOReadOnly::getWidgetAccessInfo(
     SQL_CONNECTION_EXCEPTION_HANDLER_END("Failed to get accessinfo list")
 }
 
-LanguageTagList WidgetDAOReadOnly::getLanguageTags() const
+LanguageTags WidgetDAOReadOnly::getLanguageTags() const
 {
     //TODO check widget existance
     SQL_CONNECTION_EXCEPTION_HANDLER_BEGIN
@@ -975,7 +1016,7 @@ LanguageTagList WidgetDAOReadOnly::getLanguageTags() const
     SQL_CONNECTION_EXCEPTION_HANDLER_END("Failed to get language tags")
 }
 
-LanguageTagList WidgetDAOReadOnly::getIconLanguageTags() const
+LanguageTags WidgetDAOReadOnly::getIconLanguageTags() const
 {
     //TODO check widget existance
     using namespace DPL::DB::ORM;
@@ -1104,6 +1145,26 @@ void WidgetDAOReadOnly::getEncryptedFileList(EncryptedFileList& filesList) const
     }
 }
 
+DPL::OptionalString WidgetDAOReadOnly::getBackgroundPage() const
+{
+    SQL_CONNECTION_EXCEPTION_HANDLER_BEGIN
+    {
+        using namespace DPL::DB::ORM;
+        using namespace DPL::DB::ORM::wrt;
+        WRT_DB_SELECT(select, WidgetExtendedInfo, &WrtDatabase::interface())
+        select->Where(Equals<WidgetExtendedInfo::app_id>(m_widgetHandle));
+
+        WidgetExtendedInfo::Select::RowList rows = select->GetRowList();
+        if (rows.empty()) {
+            ThrowMsg(WidgetDAOReadOnly::Exception::WidgetNotExist,
+                     "Cannot find widget. Handle: " << m_widgetHandle);
+        }
+
+        return rows.front().Get_background_page();
+    }
+    SQL_CONNECTION_EXCEPTION_HANDLER_END("Failed to get background page")
+}
+
 #undef SQL_CONNECTION_EXCEPTION_HANDLER_BEGIN
 #undef SQL_CONNECTION_EXCEPTION_HANDLER_END
 #undef CHECK_WIDGET_EXISTENCE
index 1b8d466..c13dd75 100644 (file)
@@ -31,6 +31,7 @@
 #include <list>
 #include <dpl/optional_typedefs.h>
 #include <dpl/shared_ptr.h>
+#include <memory>
 
 namespace WrtDB {
 class PluginMetafileData
@@ -234,6 +235,13 @@ typedef std::multiset<DbWidgetFeature> DbWidgetFeatureSet;
  */
 typedef std::list<DbWidgetHandle> DbWidgetHandleList;
 
+class WidgetDAOReadOnly; //forward declaration
+typedef std::shared_ptr<WidgetDAOReadOnly> WidgetDAOReadOnlyPtr;
+/**
+ * @brief Default container with WidgetDAOReadOnly
+ */
+typedef std::list<WidgetDAOReadOnlyPtr> DbWidgetDAOReadOnlyList;
+
 /**
  * @brief Widget specific type
  *
index 9b9b74f..a0e3a99 100644 (file)
@@ -219,7 +219,6 @@ class ConfigParserData
     bool flashNeeded;
 
     DPL::OptionalString minVersionRequired;
-    StringsList powderDescriptionLinks;
 
     bool backSupported;
     bool accessNetwork;
@@ -241,6 +240,8 @@ class ConfigParserData
     DependsPkgList dependsPkgList;
     // Splash image path
     DPL::OptionalString splashImgSrc;
+    // Background page filename
+    DPL::OptionalString backgroundPage;
 
     ConfigParserData() :
         flashNeeded(false),
index 75f673e..1a736f9 100644 (file)
@@ -50,6 +50,7 @@ class FeatureDAOReadOnly
     typedef std::set<std::string> DeviceCapabilitiesList;
     typedef std::multimap<FeatureHandle, std::string> DeviceCapabilitiesMap;
     typedef std::map<FeatureHandle, std::string> NameMap;
+    typedef std::map<FeatureHandle, FeatureData> FeatureMap;
 
     static bool isDeviceCapabilityInstalled(const std::string &deviceCapName);
 
@@ -73,6 +74,8 @@ class FeatureDAOReadOnly
     static NameMap                 GetNames();
     static DeviceCapabilitiesMap   GetDevCapWithFeatureHandle();
 
+    static FeatureMap GetFeatures(const std::list<std::string>& featureNames);
+
   protected:
     FeatureHandle m_featureHandle;
 };
index fc40c8a..d9440da 100644 (file)
@@ -39,6 +39,11 @@ typedef DPL::SharedPtr<FeatureHandleList> FeatureHandleListPtr;
 typedef int FeatureSetHandle;
 typedef std::list<FeatureSetHandle> FeatureSetHandleList;
 
+typedef struct {
+    std::string     featureName;
+    DbPluginHandle  pluginHandle;
+} FeatureData;
+
 class FeatureModel : public DPL::Event::Model
 {
   public:
index e5f2fe7..a2b1402 100644 (file)
@@ -57,7 +57,7 @@ inline const char* GetDevicePluginPath()
  */
 inline const char* GetFactoryInstalledWidgetPath()
 {
-    return "/opt/apps/widget/system";
+    return "/opt/share/widget/system";
 }
 
 /**
@@ -73,7 +73,7 @@ inline const char* GetUserInstalledWidgetPath()
  */
 inline const char* GetWidgetSrcPath()
 {
-    return "res/wgt";
+    return "/res/wgt";
 }
 
 /**
@@ -81,7 +81,7 @@ inline const char* GetWidgetSrcPath()
  */
 inline const char* GetPublicVirtualRootPath()
 {
-    return "/opt/apps/widget/data/Public";
+    return "/opt/share/widget/data/Public";
 }
 
 /**
@@ -97,7 +97,7 @@ inline const char* GetWidgetLocalStoragePath()
  */
 inline const char* GetTestsDataPath()
 {
-    return "/opt/apps/widget/tests";
+    return "/opt/share/widget/tests";
 }
 
 /**
@@ -105,7 +105,7 @@ inline const char* GetTestsDataPath()
  */
 inline const char* GetUserWidgetExecPath()
 {
-    return "bin";
+    return "/bin";
 }
 
 /**
@@ -154,7 +154,7 @@ inline const char* GetUserWidgetDefaultIconFile()
  */
 // KW inline const char* GetDownloadedWidgetPath()
 // KW {
-// KW     return "/opt/apps/widget/test-widgets";
+// KW     return "/opt/share/widget/test-widgets";
 // KW }
 
 inline const char* GetSignatureXmlSchema()
@@ -215,7 +215,7 @@ inline const char* GetPluginSuffix()
  */
 inline const char* GetPluginInstallInitializerName()
 {
-    return "/opt/apps/widget/plugin-installation-required";
+    return "/opt/share/widget/plugin-installation-required";
 }
 
 /**
@@ -275,7 +275,7 @@ inline const char* GetShareDirectoryPath()
 
 inline const char* GetTempInstallInfoPath()
 {
-    return "/opt/apps/widget/temp_info";
+    return "/opt/share/widget/temp_info";
 }
 } // namespace GlobalConfig
 } // namespace WrtDB
index db1de98..37229ea 100644 (file)
@@ -51,6 +51,11 @@ enum WidgetSignatureType
     SIGNATURE_TYPE_UNIDENTIFIED
 };
 
+enum CertificateSource {
+    SIGNATURE_DISTRIBUTOR = 0,
+    SIGNATURE_AUTHOR = 1
+};
+
 typedef std::list<DPL::String> StringList;
 
 struct WidgetLocalizedInfo
@@ -190,7 +195,8 @@ class IWacSecurity
 
     virtual bool isWacSigned() const = 0;
 
-    virtual void getCertificateChainList(CertificateChainList& list) const = 0;
+    virtual void getCertificateChainList(CertificateChainList& list,
+            CertificateSource source) const = 0;
 };
 
 /**
@@ -221,6 +227,7 @@ typedef std::list<DPL::String> LanguageTagList;
 typedef std::list<std::string> HostList;
 typedef std::list<std::string> FingerPrintList;
 typedef std::list<std::string> ResourceAttributeList;
+typedef std::list<std::string> ExternalLocationList; //TODO: if there will be many files registered std::set is better
 
 class WidgetDAOReadOnly
 {
@@ -280,7 +287,6 @@ class WidgetDAOReadOnly
     };
     typedef std::list<WidgetLocalizedStartFileRow> LocalizedStartFileList;
 
-
     /**
      * This is a constructor.
      *
@@ -288,6 +294,7 @@ class WidgetDAOReadOnly
      */
     WidgetDAOReadOnly(DbWidgetHandle widgetHandle);
     WidgetDAOReadOnly(DPL::OptionalString widgetGUID);
+    WidgetDAOReadOnly(DPL::String pkgName);
 
     /**
      * Destructor
@@ -537,7 +544,7 @@ class WidgetDAOReadOnly
     bool getWebkitPluginsRequired() const;
 
     /**
-     * This method returns a list of all the installed widgets.
+     * This method returns a list of all the installed widgets' app id.
      *
      * @return list of installed widgets' app id.
      * @exception WRT_CONF_ERR_EMDB_FAILURE - Fail to query DB table.
@@ -546,6 +553,16 @@ class WidgetDAOReadOnly
      */
     static DbWidgetHandleList getHandleList();
 
+    /**
+     * This method returns a list of all the installed widgets.
+     *
+     * @return list of installed widgets.
+     * @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.
+     */
+    static DbWidgetDAOReadOnlyList getWidgetList();
+
    /**
      * This method removes a widget's information from EmDB.
      *
@@ -679,6 +696,8 @@ class WidgetDAOReadOnly
     LanguageTagList getLanguageTags() const;
     LanguageTagList getIconLanguageTags() const;
 
+
+
     WidgetLocalizedInfo getLocalizedInfo(const DPL::String& languageTag) const;
     std::string getCookieDatabasePath() const;
     // Local storage
@@ -695,7 +714,14 @@ class WidgetDAOReadOnly
      */
     DPL::OptionalString getSplashImgSrc() const;
 
-    CertificateChainList getWidgetCertificate() const;
+    ExternalLocationList getWidgetExternalLocations() const;
+
+    /*
+     * Default value is required to keep compatibility with
+     * wrt-installer and wrt.
+     */
+    CertificateChainList getWidgetCertificate(
+            CertificateSource source = SIGNATURE_DISTRIBUTOR) const;
 
     void getWidgetSettings(WidgetSettings& outWidgetSettings) const;
 
@@ -719,6 +745,13 @@ class WidgetDAOReadOnly
     PkgType getPkgType() const;
 
     void getEncryptedFileList(EncryptedFileList& filesList) const;
+
+    /**
+     * This method returns widget's background page filename.
+     *
+     * @return Name of file containing background page
+     */
+    DPL::OptionalString getBackgroundPage() const;
 };
 
 } // namespace WrtDB
index ed1dc82..1702433 100644 (file)
@@ -27,6 +27,7 @@
 
 typedef WrtDB::DbWidgetHandle WidgetHandle;
 typedef WrtDB::DbWidgetHandleList WidgetHandleList;
+typedef WrtDB::DbWidgetDAOReadOnlyList WidgetDAOReadOnlyList;
 
 typedef WrtDB::DbWidgetFeature WidgetFeature;
 typedef WrtDB::DbWidgetFeatureSet WidgetFeatureSet;
index dd98aaf..c525e86 100755 (executable)
@@ -31,6 +31,7 @@ namespace WrtDB {
 namespace FeatureDAO {
     FeatureHandle RegisterFeature(const PluginMetafileData::Feature &feature,
                                   const DbPluginHandle pluginHandle);
+    void UnregisterFeature(FeatureHandle featureHandle);
 } // namespace FeatureDB
 } // namespace WrtDB
 
index e8a86d3..70d35f9 100644 (file)
@@ -54,6 +54,8 @@ class PluginDAO : public PluginDAOReadOnly
     static void setPluginInstallationStatus(
             DbPluginHandle,
             PluginInstallationState);
+
+    static void unregisterPlugin(DbPluginHandle pluginHandle);
 };
 
 } // namespace WrtDB
index cdc1f73..e15ac5a 100644 (file)
@@ -52,6 +52,7 @@ class WidgetDAO : public WidgetDAOReadOnly
      */
     WidgetDAO(DbWidgetHandle widgetHandle);
     WidgetDAO(DPL::OptionalString widgetGUID);
+    WidgetDAO(DPL::String pkgName);
 
     /**
      * Destructor
@@ -102,6 +103,17 @@ class WidgetDAO : public WidgetDAOReadOnly
      */
     void removeProperty(const PropertyDAOReadOnly::WidgetPropertyKey &key);
 
+    /**
+     * @brief registerExternalLocations Inserts new rows to WidgetExternalLocations
+     * @param externals list of files
+     */
+    void registerExternalLocations(const ExternalLocationList & externals);
+
+    /**
+     * @brief registerExternalLocations Removes rows from WidgetExternalLocations
+     */
+    void unregisterAllExternalLocations();
+
     /* This method sets widget property
      */
     void setProperty(const PropertyDAOReadOnly::WidgetPropertyKey &key,
@@ -151,8 +163,9 @@ class WidgetDAO : public WidgetDAOReadOnly
     static void registerWidgetCertificates(
             DbWidgetHandle widgetHandle,
             const IWacSecurity &wacSecurity);
-    static void registerLaunchCertificates(
+    static void registerCertificatesChains(
             DbWidgetHandle widgetHandle,
+            CertificateSource certificateSource,
             const CertificateChainList &list);
     static void registerWidgetSettings(
             DbWidgetHandle widgetHandle,
index 607b362..ecd3d04 100644 (file)
@@ -42,8 +42,13 @@ CREATE_TABLE(WidgetInfo)
     COLUMN(pkg_type,                INT,  DEFAULT 0)
 CREATE_TABLE_END()
 
+SQL(
+    CREATE INDEX IF NOT EXISTS WidgetInfo_PkgnameIndex ON WidgetInfo(pkgname);
+)
+
 CREATE_TABLE(WidgetCertificate)
     COLUMN_NOT_NULL(app_id,                 INT,)
+    COLUMN_NOT_NULL(cert_source,            INT,    CHECK(cert_source between 0 and 1))
     COLUMN_NOT_NULL(encoded_chain,          VARCHAR(16000),)
     TABLE_CONSTRAINTS(
         FOREIGN KEY (app_id) REFERENCES WidgetInfo (app_id) ON DELETE CASCADE
@@ -86,6 +91,7 @@ CREATE_TABLE(WidgetExtendedInfo)
     COLUMN(update_policy,       INT,            DEFAULT 0)
     COLUMN_NOT_NULL(test_widget, INT, CHECK(test_widget between 0 and 1) DEFAULT 0)
     COLUMN(splash_img_src,      VARCHAR(256),   DEFAULT '')
+    COLUMN(background_page,      VARCHAR(256),   DEFAULT '')
     TABLE_CONSTRAINTS(
         FOREIGN KEY(app_id) REFERENCES WidgetInfo (app_id) ON DELETE CASCADE
     )
@@ -166,6 +172,15 @@ CREATE_TABLE(WidgetLocalizedStartFile)
     )
 CREATE_TABLE_END()
 
+CREATE_TABLE(WidgetExternalLocations)
+    COLUMN_NOT_NULL(app_id,         INT,)
+    COLUMN_NOT_NULL(path,  TEXT,)
+    TABLE_CONSTRAINTS(
+        FOREIGN KEY(app_id) REFERENCES WidgetInfo (app_id) ON DELETE CASCADE,
+        PRIMARY KEY(app_id, path)
+    )
+CREATE_TABLE_END()
+
 CREATE_TABLE(WidgetAccessHost)
     COLUMN_NOT_NULL(app_id,     INT,)
     COLUMN_NOT_NULL(host,       VARCHAR(256),)
@@ -205,6 +220,10 @@ CREATE_TABLE(FeaturesList)
     COLUMN_NOT_NULL(FeatureUUID,            INTEGER,    primary key autoincrement)
     COLUMN_NOT_NULL(FeatureName,            TEXT,       unique)
     COLUMN_NOT_NULL(PluginPropertiesId,     INT,)
+
+    TABLE_CONSTRAINTS(
+        FOREIGN KEY (PluginPropertiesId) REFERENCES PluginProperties (PluginPropertiesId) ON DELETE CASCADE
+    )
 CREATE_TABLE_END()
 
 CREATE_TABLE(PluginProperties)
@@ -217,16 +236,28 @@ CREATE_TABLE_END()
 CREATE_TABLE(PluginDependencies)
     COLUMN_NOT_NULL(PluginPropertiesId,              INTEGER,    not null)
     COLUMN_NOT_NULL(RequiredPluginPropertiesId,      INTEGER,    not null)
+
+    TABLE_CONSTRAINTS(
+        FOREIGN KEY (PluginPropertiesId) REFERENCES PluginProperties (PluginPropertiesId) ON DELETE CASCADE
+    )
 CREATE_TABLE_END()
 
 CREATE_TABLE(PluginImplementedObjects)
     COLUMN_NOT_NULL(PluginObject,           TEXT,       unique)
     COLUMN_NOT_NULL(PluginPropertiesId,     INTEGER,    not null)
+
+    TABLE_CONSTRAINTS(
+        FOREIGN KEY (PluginPropertiesId) REFERENCES PluginProperties (PluginPropertiesId) ON DELETE CASCADE
+    )
 CREATE_TABLE_END()
 
 CREATE_TABLE(PluginRequiredObjects)
     COLUMN_NOT_NULL(PluginPropertiesId,     INTEGER,    not null)
     COLUMN_NOT_NULL(PluginObject,           TEXT,       not null)
+
+    TABLE_CONSTRAINTS(
+        FOREIGN KEY (PluginPropertiesId) REFERENCES PluginProperties (PluginPropertiesId) ON DELETE CASCADE
+    )
 CREATE_TABLE_END()
 
 CREATE_TABLE(DeviceCapabilities)
@@ -239,7 +270,11 @@ CREATE_TABLE(FeatureDeviceCapProxy)
     COLUMN_NOT_NULL(FeatureUUID,            INT,        not null)
     COLUMN_NOT_NULL(DeviceCapID,            INT,        not null)
 
-    TABLE_CONSTRAINTS(PRIMARY KEY(FeatureUUID,DeviceCapID))
+    TABLE_CONSTRAINTS(
+        FOREIGN KEY (FeatureUUID) REFERENCES FeaturesList (FeatureUUID) ON DELETE CASCADE
+        FOREIGN KEY (DeviceCapID) REFERENCES DeviceCapabilities (DeviceCapID) ON DELETE CASCADE
+        PRIMARY KEY(FeatureUUID,DeviceCapID)
+    )
 CREATE_TABLE_END()
 
 CREATE_TABLE(OCSPResponseStorage)
@@ -311,7 +346,7 @@ SQL(
    INSERT INTO UserAgents VALUES("Galaxy S II", "Mozilla/5.0 (Linux; U; Android 2.3.5; en-gb; GT-I9100 Build/GINGERBREAD) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1");
    INSERT INTO UserAgents VALUES("Galaxy S III", "Mozilla/5.0 (Linux; U; Android 4.0.3; en-gb; GT-I9300 Build/IML74K) AppleWebkit/534.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30");
    INSERT INTO UserAgents VALUES("SLP Galaxy", "Mozilla/5.0 (Linux; U; Android 2.3.4; en-us; GT-I9500 Build/GINGERBREAD) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1");
-   INSERT INTO UserAgents VALUES("Tizen", "Mozilla/5.0 (Linux; U; Tizen 2.0; en-us) AppleWebKit/537.1 (KHTML, like Gecko) Mobile TizenBrowser/2.0");
+   INSERT INTO UserAgents VALUES("Tizen", "Mozilla/5.0 (Linux; U; Tizen 2.0; en-us; GT-I8800) AppleWebKit/537.1 (KHTML, like Gecko) Mobile TizenBrowser/2.0");
    INSERT INTO UserAgents VALUES("Galaxy Nexus", "Mozilla/5.0 (Linux; U; Android 4.0.3; en-us; Galaxy Nexus Build/IML74K) AppleWebKit/535.7 (KHTML, like Gecko) Mobile Safari/535.7");
    INSERT INTO UserAgents VALUES("Samsung", "Mozilla/5.0 (SAMSUNG; SAMSUNG-GT-I9200/1.0; U; Linux/SLP/2.0; ko-kr) AppleWebKit/534.4 (KHTML, like Gecko) Dolfin/2.0 Mobile");
    INSERT INTO UserAgents VALUES("Samsung Dolfin", "SAMSUNG-GT-S8500/S8500XXJD2 SHP/VPP/R5 Dolfin/2.0 Nextreaming SMM-MMS/1.2.0 profile/MIDP-2.1 configuration/CLDC-1.1");
index 0d0898d..fca13c5 100644 (file)
@@ -1,7 +1,7 @@
-#sbs-git:slp/pkgs/w/wrt-commons wrt-commons 0.2.54
+#sbs-git:slp/pkgs/w/wrt-commons wrt-commons 0.2.67
 Name:       wrt-commons
 Summary:    Wrt common library
-Version:    0.2.54
+Version:    0.2.67
 Release:    1
 Group:      Development/Libraries
 License:    Apache License, Version 2.0
@@ -48,16 +48,18 @@ cmake . -DVERSION=%{version} \
 make %{?jobs:-j%jobs}
 
 %install
+mkdir -p %{buildroot}/usr/share/license
+cp %{name} %{buildroot}/usr/share/license/
 %make_install
 
 %clean
 rm -rf %{buildroot}
 
 %post
-mkdir -p /opt/apps/widget/system
-mkdir -p /opt/apps/widget/user
-mkdir -p /opt/apps/widget/exec
-mkdir -p /opt/apps/widget/data/Public
+mkdir -p /opt/share/widget/system
+mkdir -p /opt/share/widget/user
+mkdir -p /opt/share/widget/exec
+mkdir -p /opt/share/widget/data/Public
 mkdir -p /usr/lib/wrt-plugins
 
 if [ -z ${2} ]; then
@@ -108,14 +110,22 @@ else
     cp /usr/var/lib/dbus/machine-id /var/lib/dbus/
 fi
 
+# Set Smack label for db files
+chsmack -a 'wrt-commons::db_wrt' /opt/dbspace/.wrt.db
+chsmack -a 'wrt-commons::db_wrt' /opt/dbspace/.wrt.db-journal
+chsmack -a 'wrt-commons::db_wrt_autosave' /opt/dbspace/.wrt_autosave.db
+chsmack -a 'wrt-commons::db_wrt_autosave' /opt/dbspace/.wrt_autosave.db-journal
+
 echo "[WRT] wrt-commons postinst done ..."
 
 %files
+%manifest wrt-commons.manifest
 %{_libdir}/*.so
 %{_libdir}/*.so.*
 /usr/share/wrt-engine/*
 %attr(775,root,root) %{_bindir}/wrt_commons_reset_db.sh
 %attr(775,root,root) %{_bindir}/wrt_commons_create_clean_db.sh
+%{_datadir}/license/%{name}
 
 %files devel
 %{_includedir}/dpl-efl/*
diff --git a/wrt-commons b/wrt-commons
new file mode 100644 (file)
index 0000000..12a4281
--- /dev/null
@@ -0,0 +1,290 @@
+wrt-commons:
+Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+
+                                 Apache License
+                           Version 2.0, January 2004
+                        http://www.apache.org/licenses/
+
+   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+   1. Definitions.
+
+      "License" shall mean the terms and conditions for use, reproduction,
+      and distribution as defined by Sections 1 through 9 of this document.
+
+      "Licensor" shall mean the copyright owner or entity authorized by
+      the copyright owner that is granting the License.
+
+      "Legal Entity" shall mean the union of the acting entity and all
+      other entities that control, are controlled by, or are under common
+      control with that entity. For the purposes of this definition,
+      "control" means (i) the power, direct or indirect, to cause the
+      direction or management of such entity, whether by contract or
+      otherwise, or (ii) ownership of fifty percent (50%) or more of the
+      outstanding shares, or (iii) beneficial ownership of such entity.
+
+      "You" (or "Your") shall mean an individual or Legal Entity
+      exercising permissions granted by this License.
+
+      "Source" form shall mean the preferred form for making modifications,
+      including but not limited to software source code, documentation
+      source, and configuration files.
+
+      "Object" form shall mean any form resulting from mechanical
+      transformation or translation of a Source form, including but
+      not limited to compiled object code, generated documentation,
+      and conversions to other media types.
+
+      "Work" shall mean the work of authorship, whether in Source or
+      Object form, made available under the License, as indicated by a
+      copyright notice that is included in or attached to the work
+      (an example is provided in the Appendix below).
+
+      "Derivative Works" shall mean any work, whether in Source or Object
+      form, that is based on (or derived from) the Work and for which the
+      editorial revisions, annotations, elaborations, or other modifications
+      represent, as a whole, an original work of authorship. For the purposes
+      of this License, Derivative Works shall not include works that remain
+      separable from, or merely link (or bind by name) to the interfaces of,
+      the Work and Derivative Works thereof.
+
+      "Contribution" shall mean any work of authorship, including
+      the original version of the Work and any modifications or additions
+      to that Work or Derivative Works thereof, that is intentionally
+      submitted to Licensor for inclusion in the Work by the copyright owner
+      or by an individual or Legal Entity authorized to submit on behalf of
+      the copyright owner. For the purposes of this definition, "submitted"
+      means any form of electronic, verbal, or written communication sent
+      to the Licensor or its representatives, including but not limited to
+      communication on electronic mailing lists, source code control systems,
+      and issue tracking systems that are managed by, or on behalf of, the
+      Licensor for the purpose of discussing and improving the Work, but
+      excluding communication that is conspicuously marked or otherwise
+      designated in writing by the copyright owner as "Not a Contribution."
+
+      "Contributor" shall mean Licensor and any individual or Legal Entity
+      on behalf of whom a Contribution has been received by Licensor and
+      subsequently incorporated within the Work.
+
+   2. Grant of Copyright License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      copyright license to reproduce, prepare Derivative Works of,
+      publicly display, publicly perform, sublicense, and distribute the
+      Work and such Derivative Works in Source or Object form.
+
+   3. Grant of Patent License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      (except as stated in this section) patent license to make, have made,
+      use, offer to sell, sell, import, and otherwise transfer the Work,
+      where such license applies only to those patent claims licensable
+      by such Contributor that are necessarily infringed by their
+      Contribution(s) alone or by combination of their Contribution(s)
+      with the Work to which such Contribution(s) was submitted. If You
+      institute patent litigation against any entity (including a
+      cross-claim or counterclaim in a lawsuit) alleging that the Work
+      or a Contribution incorporated within the Work constitutes direct
+      or contributory patent infringement, then any patent licenses
+      granted to You under this License for that Work shall terminate
+      as of the date such litigation is filed.
+
+   4. Redistribution. You may reproduce and distribute copies of the
+      Work or Derivative Works thereof in any medium, with or without
+      modifications, and in Source or Object form, provided that You
+      meet the following conditions:
+
+      (a) You must give any other recipients of the Work or
+          Derivative Works a copy of this License; and
+
+      (b) You must cause any modified files to carry prominent notices
+          stating that You changed the files; and
+
+      (c) You must retain, in the Source form of any Derivative Works
+          that You distribute, all copyright, patent, trademark, and
+          attribution notices from the Source form of the Work,
+          excluding those notices that do not pertain to any part of
+          the Derivative Works; and
+
+      (d) If the Work includes a "NOTICE" text file as part of its
+          distribution, then any Derivative Works that You distribute must
+          include a readable copy of the attribution notices contained
+          within such NOTICE file, excluding those notices that do not
+          pertain to any part of the Derivative Works, in at least one
+          of the following places: within a NOTICE text file distributed
+          as part of the Derivative Works; within the Source form or
+          documentation, if provided along with the Derivative Works; or,
+          within a display generated by the Derivative Works, if and
+          wherever such third-party notices normally appear. The contents
+          of the NOTICE file are for informational purposes only and
+          do not modify the License. You may add Your own attribution
+          notices within Derivative Works that You distribute, alongside
+          or as an addendum to the NOTICE text from the Work, provided
+          that such additional attribution notices cannot be construed
+          as modifying the License.
+
+      You may add Your own copyright statement to Your modifications and
+      may provide additional or different license terms and conditions
+      for use, reproduction, or distribution of Your modifications, or
+      for any such Derivative Works as a whole, provided Your use,
+      reproduction, and distribution of the Work otherwise complies with
+      the conditions stated in this License.
+
+   5. Submission of Contributions. Unless You explicitly state otherwise,
+      any Contribution intentionally submitted for inclusion in the Work
+      by You to the Licensor shall be under the terms and conditions of
+      this License, without any additional terms or conditions.
+      Notwithstanding the above, nothing herein shall supersede or modify
+      the terms of any separate license agreement you may have executed
+      with Licensor regarding such Contributions.
+
+   6. Trademarks. This License does not grant permission to use the trade
+      names, trademarks, service marks, or product names of the Licensor,
+      except as required for reasonable and customary use in describing the
+      origin of the Work and reproducing the content of the NOTICE file.
+
+   7. Disclaimer of Warranty. Unless required by applicable law or
+      agreed to in writing, Licensor provides the Work (and each
+      Contributor provides its Contributions) on an "AS IS" BASIS,
+      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+      implied, including, without limitation, any warranties or conditions
+      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+      PARTICULAR PURPOSE. You are solely responsible for determining the
+      appropriateness of using or redistributing the Work and assume any
+      risks associated with Your exercise of permissions under this License.
+
+   8. Limitation of Liability. In no event and under no legal theory,
+      whether in tort (including negligence), contract, or otherwise,
+      unless required by applicable law (such as deliberate and grossly
+      negligent acts) or agreed to in writing, shall any Contributor be
+      liable to You for damages, including any direct, indirect, special,
+      incidental, or consequential damages of any character arising as a
+      result of this License or out of the use or inability to use the
+      Work (including but not limited to damages for loss of goodwill,
+      work stoppage, computer failure or malfunction, or any and all
+      other commercial damages or losses), even if such Contributor
+      has been advised of the possibility of such damages.
+
+   9. Accepting Warranty or Additional Liability. While redistributing
+      the Work or Derivative Works thereof, You may choose to offer,
+      and charge a fee for, acceptance of support, warranty, indemnity,
+      or other liability obligations and/or rights consistent with this
+      License. However, in accepting such obligations, You may act only
+      on Your own behalf and on Your sole responsibility, not on behalf
+      of any other Contributor, and only if You agree to indemnify,
+      defend, and hold each Contributor harmless for any liability
+      incurred by, or claims asserted against, such Contributor by reason
+      of your accepting any such warranty or additional liability.
+
+   END OF TERMS AND CONDITIONS
+
+   APPENDIX: How to apply the Apache License to your work.
+
+      To apply the Apache License to your work, attach the following
+      boilerplate notice, with the fields enclosed by brackets "[]"
+      replaced with your own identifying information. (Don't include
+      the brackets!)  The text should be enclosed in the appropriate
+      comment syntax for the file format. We also recommend that a
+      file or class name and description of purpose be included on the
+      same "printed page" as the copyright notice for easier
+      identification within third-party archives.
+
+   Copyright [yyyy] [name of copyright owner]
+
+   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.
+
+
+3rdparty/fastdelegate :
+License
+
+The source code attached to this article is released into the public domain.
+You may use it for any purpose. Frankly, writing the article was about ten
+times as much work as writing the code. Of course, if you create great software
+using the code, I would be interested to hear about it. And submissions are always welcome.
+
+
+3rdparty/minizip :
+MiniZip - Copyright (c) 1998-2010 - by Gilles Vollant - version 1.1 64 bits from Mathias Svensson
+
+Introduction
+---------------------
+MiniZip 1.1 is built from MiniZip 1.0 by Gilles Vollant ( http://www.winimage.com/zLibDll/minizip.html )
+
+When adding ZIP64 support into minizip it would result into risk of breaking compatibility with minizip 1.0.
+All possible work was done for compatibility.
+
+
+Background
+---------------------
+When adding ZIP64 support Mathias Svensson found that Even Rouault have added ZIP64 
+support for unzip.c into minizip for a open source project called gdal ( http://www.gdal.org/ )
+
+That was used as a starting point. And after that ZIP64 support was added to zip.c
+some refactoring and code cleanup was also done.
+
+
+Changed from MiniZip 1.0 to MiniZip 1.1
+---------------------------------------
+* Added ZIP64 support for unzip ( by Even Rouault )
+* Added ZIP64 support for zip ( by Mathias Svensson )
+* Reverted some changed that Even Rouault did.
+* Bunch of patches received from Gulles Vollant that he received for MiniZip from various users.
+* Added unzip patch for BZIP Compression method (patch create by Daniel Borca)
+* Added BZIP Compress method for zip
+* Did some refactoring and code cleanup
+
+
+Credits
+
+ Gilles Vollant    - Original MiniZip author
+ Even Rouault      - ZIP64 unzip Support
+ Daniel Borca      - BZip Compression method support in unzip
+ Mathias Svensson  - ZIP64 zip support
+ Mathias Svensson  - BZip Compression method support in zip
+
+ Resources
+
+ ZipLayout   http://result42.com/projects/ZipFileLayout
+             Command line tool for Windows that shows the layout and information of the headers in a zip archive.
+             Used when debugging and validating the creation of zip files using MiniZip64
+
+
+ ZIP App Note  http://www.pkware.com/documents/casestudies/APPNOTE.TXT
+               Zip File specification
+
+
+Notes.
+ * To be able to use BZip compression method in zip64.c or unzip64.c the BZIP2 lib is needed and HAVE_BZIP2 need to be defined.
+
+License
+----------------------------------------------------------
+   Condition of use and distribution are the same than zlib :
+
+  This software is provided 'as-is', without any express or implied
+  warranty.  In no event will the authors be held liable for any damages
+  arising from the use of this software.
+
+  Permission is granted to anyone to use this software for any purpose,
+  including commercial applications, and to alter it and redistribute it
+  freely, subject to the following restrictions:
+
+  1. The origin of this software must not be misrepresented; you must not
+     claim that you wrote the original software. If you use this software
+     in a product, an acknowledgment in the product documentation would be
+     appreciated but is not required.
+  2. Altered source versions must be plainly marked as such, and must not be
+     misrepresented as being the original software.
+  3. This notice may not be removed or altered from any source distribution.
+
+----------------------------------------------------------
+
diff --git a/wrt-commons.manifest b/wrt-commons.manifest
new file mode 100644 (file)
index 0000000..e797580
--- /dev/null
@@ -0,0 +1,12 @@
+<manifest>
+  <define>
+    <domain name="wrt-commons"/>
+    <provide>   
+        <label name="wrt-commons::db_wrt"/>
+        <label name="wrt-commons::db_wrt_autosave"/>
+    </provide>
+  </define>
+  <request>
+    <domain name="_"/>
+  </request>
+</manifest>