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 "========================================")
+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
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
# 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} ]
namespace {
inline std::string GetDefaultEncryptKeyPath() {
- return "/opt/apps/widget/data/";
+ return "/opt/share/widget/data/";
}
}
namespace WRTDecryptor{
const char* DECRYPTION_FILE = "_dec";
inline std::string GetDefaultEncryptKeyPath() {
- return "/opt/apps/widget/data";
+ return "/opt/share/widget/data";
}
}
namespace WRTEncryptor{
#
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
)
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
)
--- /dev/null
+/*
+ * 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 */
};
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
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
--- /dev/null
+/*
+ * 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"");
+}
#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; }
//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] == '/') {
}
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) {
namespace W3CFileLocalization {
DPL::Optional<DPL::String> getFilePathInWidgetPackageFromUrl(
DbWidgetHandle widgetHandle,
- const LanguageTagsList &languageTags,
const DPL::String &url)
{
DPL::String req = url;
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;
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");
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);
}
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) {
}
WidgetIconList getValidIconsList(
- WrtDB::DbWidgetHandle widgetHandle,
- const LanguageTagsList &languageTags)
+ WrtDB::DbWidgetHandle widgetHandle)
{
- using namespace LocalizationUtils;
WidgetDAOReadOnly dao(widgetHandle);
WidgetDAOReadOnly::WidgetIconList list = dao.getIconList();
{
LogDebug(":" << it->iconSrc);
if (!!getFilePathInWidgetPackage(widgetHandle,
- languageTags,
it->iconSrc))
{
WidgetIcon ret;
}
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)
{
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);
}
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; \
#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>
: private Noncopyable
{
private:
- ReadWriteMutex m_spinLock;
-
typedef std::list<AbstractLogProvider *> AbstractLogProviderPtrList;
AbstractLogProviderPtrList m_providers;
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);
}
NONE,
FAILED,
IGNORED,
- TODO,
INTERNAL
};
};
#include <vector>
#include <list>
#include <set>
+#include <map>
namespace DPL
{
{
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)();
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
{
}
};
- 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:
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;
#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
// 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");
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());
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;
}
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();
}
}
- 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;
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);
}
{
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");
}
int TestRunner::ExecTestRunner(const ArgsList& value)
{
+ m_runIgnored = false;
ArgsList args = value;
// Parse command line
if (args.size() == 1)
bool showHelp = false;
+ TestResultsCollectorBasePtr currentCollector;
+
// Parse each argument
FOREACH(it, args)
{
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) {
return -1;
}
}
+ else if (arg == runIgnored)
+ {
+ m_runIgnored = true;
+ }
else if (arg == listCmd)
{
FOREACH(group, m_testGroups) {
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)
{
}
}
+ currentCollector.Reset();
+
// Show help
if (showHelp)
{
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
return 0;
}
+bool TestRunner::getRunIgnored() const
+{
+ return m_runIgnored;
+}
+
}
} // namespace DPL
#
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
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
--- /dev/null
+/*
+ * 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
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();
}
* 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_
--- /dev/null
+/*
+ * 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 + "\"";
+}
+
+}
*/
#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;
#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
{
};
struct Settings {
- bool testMode;
+ int testModes;
bool isEmulator;
Settings()
- : testMode(false),
- isEmulator(false)
+ : isEmulator(false), testModes(0)
{}
};
// 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
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()
* 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;
}
${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}
)
}
}
+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
}
}
+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
}
}
+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
{
}
+WidgetDAO::WidgetDAO(DPL::String pkgName) :
+ WidgetDAOReadOnly(WidgetDAOReadOnly::getHandle(pkgName))
+{
+}
+
WidgetDAO::~WidgetDAO()
{
}
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);
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)
}
}
-void WidgetDAO::registerLaunchCertificates(DbWidgetHandle widgetHandle,
+void WidgetDAO::registerCertificatesChains(DbWidgetHandle widgetHandle,
+ CertificateSource certificateSource,
const CertificateChainList &certificateChainList)
{
using namespace DPL::DB::ORM;
{
WidgetCertificate::Row row;
row.Set_app_id(widgetHandle);
+ row.Set_cert_source(certificateSource);
row.Set_encoded_chain(DPL::FromASCIIString(*certChain));
DO_INSERT(row, WidgetCertificate);
}
}
+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)
#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 {
{
}
+WidgetDAOReadOnly::WidgetDAOReadOnly(DPL::String pkgName) :
+ m_widgetHandle(WidgetDAOReadOnly::getHandle(pkgName))
+{
+
+}
+
WidgetDAOReadOnly::~WidgetDAOReadOnly()
{
}
DPL::OStringStream strAppId;
strAppId << m_widgetHandle;
DPL::OptionalString pkgname = getPkgname();
- path += L"/" + *pkgname + L"/";
+ path += L"/" + *pkgname;
path += srcPath + L"/";
}
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);
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();
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
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;
}
}
+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
#include <list>
#include <dpl/optional_typedefs.h>
#include <dpl/shared_ptr.h>
+#include <memory>
namespace WrtDB {
class PluginMetafileData
*/
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
*
bool flashNeeded;
DPL::OptionalString minVersionRequired;
- StringsList powderDescriptionLinks;
bool backSupported;
bool accessNetwork;
DependsPkgList dependsPkgList;
// Splash image path
DPL::OptionalString splashImgSrc;
+ // Background page filename
+ DPL::OptionalString backgroundPage;
ConfigParserData() :
flashNeeded(false),
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);
static NameMap GetNames();
static DeviceCapabilitiesMap GetDevCapWithFeatureHandle();
+ static FeatureMap GetFeatures(const std::list<std::string>& featureNames);
+
protected:
FeatureHandle m_featureHandle;
};
typedef int FeatureSetHandle;
typedef std::list<FeatureSetHandle> FeatureSetHandleList;
+typedef struct {
+ std::string featureName;
+ DbPluginHandle pluginHandle;
+} FeatureData;
+
class FeatureModel : public DPL::Event::Model
{
public:
*/
inline const char* GetFactoryInstalledWidgetPath()
{
- return "/opt/apps/widget/system";
+ return "/opt/share/widget/system";
}
/**
*/
inline const char* GetWidgetSrcPath()
{
- return "res/wgt";
+ return "/res/wgt";
}
/**
*/
inline const char* GetPublicVirtualRootPath()
{
- return "/opt/apps/widget/data/Public";
+ return "/opt/share/widget/data/Public";
}
/**
*/
inline const char* GetTestsDataPath()
{
- return "/opt/apps/widget/tests";
+ return "/opt/share/widget/tests";
}
/**
*/
inline const char* GetUserWidgetExecPath()
{
- return "bin";
+ return "/bin";
}
/**
*/
// 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()
*/
inline const char* GetPluginInstallInitializerName()
{
- return "/opt/apps/widget/plugin-installation-required";
+ return "/opt/share/widget/plugin-installation-required";
}
/**
inline const char* GetTempInstallInfoPath()
{
- return "/opt/apps/widget/temp_info";
+ return "/opt/share/widget/temp_info";
}
} // namespace GlobalConfig
} // namespace WrtDB
SIGNATURE_TYPE_UNIDENTIFIED
};
+enum CertificateSource {
+ SIGNATURE_DISTRIBUTOR = 0,
+ SIGNATURE_AUTHOR = 1
+};
+
typedef std::list<DPL::String> StringList;
struct WidgetLocalizedInfo
virtual bool isWacSigned() const = 0;
- virtual void getCertificateChainList(CertificateChainList& list) const = 0;
+ virtual void getCertificateChainList(CertificateChainList& list,
+ CertificateSource source) const = 0;
};
/**
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
{
};
typedef std::list<WidgetLocalizedStartFileRow> LocalizedStartFileList;
-
/**
* This is a constructor.
*
*/
WidgetDAOReadOnly(DbWidgetHandle widgetHandle);
WidgetDAOReadOnly(DPL::OptionalString widgetGUID);
+ WidgetDAOReadOnly(DPL::String pkgName);
/**
* Destructor
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.
*/
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.
*
LanguageTagList getLanguageTags() const;
LanguageTagList getIconLanguageTags() const;
+
+
WidgetLocalizedInfo getLocalizedInfo(const DPL::String& languageTag) const;
std::string getCookieDatabasePath() const;
// Local storage
*/
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;
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
typedef WrtDB::DbWidgetHandle WidgetHandle;
typedef WrtDB::DbWidgetHandleList WidgetHandleList;
+typedef WrtDB::DbWidgetDAOReadOnlyList WidgetDAOReadOnlyList;
typedef WrtDB::DbWidgetFeature WidgetFeature;
typedef WrtDB::DbWidgetFeatureSet WidgetFeatureSet;
namespace FeatureDAO {
FeatureHandle RegisterFeature(const PluginMetafileData::Feature &feature,
const DbPluginHandle pluginHandle);
+ void UnregisterFeature(FeatureHandle featureHandle);
} // namespace FeatureDB
} // namespace WrtDB
static void setPluginInstallationStatus(
DbPluginHandle,
PluginInstallationState);
+
+ static void unregisterPlugin(DbPluginHandle pluginHandle);
};
} // namespace WrtDB
*/
WidgetDAO(DbWidgetHandle widgetHandle);
WidgetDAO(DPL::OptionalString widgetGUID);
+ WidgetDAO(DPL::String pkgName);
/**
* Destructor
*/
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,
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,
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
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
)
)
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),)
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)
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)
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)
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");
-#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
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
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/*
--- /dev/null
+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.
+
+----------------------------------------------------------
+
--- /dev/null
+<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>