From 7fb83d1e97cd557be2a3b16edd5dc651a2d27306 Mon Sep 17 00:00:00 2001 From: Jihoon Chung Date: Fri, 10 May 2013 20:19:23 +0900 Subject: [PATCH] [Release] wrt-installer_0.1.57 --- configuration/config.tizen.xsd | 11 +++- configuration/config.xml | 5 +- configuration/config.xsd | 1 + packaging/wrt-installer.spec | 4 +- src/configuration_parser/widget_parser.cpp | 69 ++++++++++++++++++++++++++ src/configuration_parser/widget_parser.h | 1 + src/jobs/widget_install/manifest.cpp | 11 ++++ src/jobs/widget_install/manifest.h | 23 +++++++++ src/jobs/widget_install/task_manifest_file.cpp | 18 +++++++ src/jobs/widget_install/task_manifest_file.h | 1 + src/misc/feature_logic.cpp | 17 ++++++- 11 files changed, 154 insertions(+), 7 deletions(-) mode change 100755 => 100644 configuration/config.xml diff --git a/configuration/config.tizen.xsd b/configuration/config.tizen.xsd index 72addb1..3d0c175 100644 --- a/configuration/config.tizen.xsd +++ b/configuration/config.tizen.xsd @@ -21,7 +21,7 @@ - + @@ -42,7 +42,7 @@ - + @@ -220,4 +220,11 @@ + + + + + + + diff --git a/configuration/config.xml b/configuration/config.xml old mode 100755 new mode 100644 index 9968071..038ec52 --- a/configuration/config.xml +++ b/configuration/config.xml @@ -4,7 +4,7 @@ - + @@ -23,4 +23,7 @@ test.com + + + diff --git a/configuration/config.xsd b/configuration/config.xsd index 4d7a823..0c83a1e 100644 --- a/configuration/config.xsd +++ b/configuration/config.xsd @@ -80,6 +80,7 @@ + diff --git a/packaging/wrt-installer.spec b/packaging/wrt-installer.spec index 1bd7f69..7730d48 100644 --- a/packaging/wrt-installer.spec +++ b/packaging/wrt-installer.spec @@ -1,7 +1,7 @@ -#git:framework/web/wrt-installer wrt-installer_0.1.56 +#git:framework/web/wrt-installer wrt-installer_0.1.57 Name: wrt-installer Summary: Installer for tizen Webruntime -Version: 0.1.56 +Version: 0.1.57 Release: 1 Group: Development/Libraries License: Apache License, Version 2.0 diff --git a/src/configuration_parser/widget_parser.cpp b/src/configuration_parser/widget_parser.cpp index 07d6d7d..56127be 100644 --- a/src/configuration_parser/widget_parser.cpp +++ b/src/configuration_parser/widget_parser.cpp @@ -2385,6 +2385,69 @@ class AccountParser : public ElementParser bool m_multiSupport; }; +class MetadataParser : public ElementParser +{ + public: + virtual ActionFunc GetElementParser(const DPL::String& /*ns*/, + const DPL::String& /*name*/) + { + return &IgnoringParser::Create; + } + + virtual void Accept(const XmlAttribute& attribute) + { + if (m_properNamespace) { + if (attribute.name == L"key") { + m_key = attribute.value; + } else if (attribute.name == L"value") { + m_value = attribute.value; + } + } + } + + virtual void Accept(const Element& element) + { + if (element.ns == ConfigurationNamespace::TizenWebAppNamespaceName) { + m_properNamespace = true; + } + } + + virtual void Accept(const Text& /*text*/) + { + ThrowMsg(Exception::ParseError, "param element must be empty"); + } + + virtual void Verify() + { + if (m_key.IsNull()) { + LogWarning("metadata element must have key attribute"); + return; + } + NormalizeString(m_key); + NormalizeString(m_value); + ConfigParserData::Metadata metaData(*m_key, *m_value); + FOREACH(it, m_data.metadataList) { + if (!DPL::StringCompare(it->key, *m_key)) { + LogError("Key isn't unique"); + return; + } + } + m_data.metadataList.push_back(metaData); + } + + MetadataParser(ConfigParserData& data) : + ElementParser(), + m_data(data), + m_properNamespace(false) + {} + + private: + DPL::OptionalString m_key; + DPL::OptionalString m_value; + ConfigParserData& m_data; + bool m_properNamespace; +}; + ElementParser::ActionFunc WidgetParser::GetElementParser( const DPL::String& /*ns*/, const DPL::String& @@ -2448,6 +2511,7 @@ WidgetParser::WidgetParser(ConfigParserData& data) : DPL::MakeDelegate(this, &WidgetParser::OnAllowNavigationElement); #endif m_map[L"account"] = DPL::MakeDelegate(this, &WidgetParser::OnAccountElement); + m_map[L"metadata"] = DPL::MakeDelegate(this, &WidgetParser::OnMetadataElement); } ElementParserPtr WidgetParser::OnNameElement() @@ -2555,6 +2619,11 @@ ElementParserPtr WidgetParser::OnAccountElement() return ElementParserPtr(new AccountParser(m_data)); } +ElementParserPtr WidgetParser::OnMetadataElement() +{ + return ElementParserPtr(new MetadataParser(m_data)); +} + void WidgetParser::Accept(const Element& element) { if (element.ns != ConfigurationNamespace::W3CWidgetNamespaceName && diff --git a/src/configuration_parser/widget_parser.h b/src/configuration_parser/widget_parser.h index c1147c9..b56e89a 100644 --- a/src/configuration_parser/widget_parser.h +++ b/src/configuration_parser/widget_parser.h @@ -85,6 +85,7 @@ class WidgetParser : public ElementParser ElementParserPtr OnCspReportOnlyElement(); ElementParserPtr OnAllowNavigationElement(); ElementParserPtr OnAccountElement(); + ElementParserPtr OnMetadataElement(); virtual ActionFunc GetElementParser(const DPL::String& ns, const DPL::String& name); diff --git a/src/jobs/widget_install/manifest.cpp b/src/jobs/widget_install/manifest.cpp index d78fbac..15f381e 100644 --- a/src/jobs/widget_install/manifest.cpp +++ b/src/jobs/widget_install/manifest.cpp @@ -289,6 +289,9 @@ void UiApplication::serialize(xmlTextWriterPtr writer) writeAttribute(writer, "name", *c); endElement(writer); } + FOREACH(m, this->metadata) { + m->serialize(writer); + } endElement(writer); } @@ -477,5 +480,13 @@ void Privilege::serialize(xmlTextWriterPtr writer) } endElement(writer); } + +void Metadata::serialize(xmlTextWriterPtr writer) +{ + startElement(writer, "metadata"); + writeAttribute(writer, "key", this->key); + writeAttribute(writer, "value", this->value); + endElement(writer); +} } //namespace Jobs } //namespace WidgetInstall diff --git a/src/jobs/widget_install/manifest.h b/src/jobs/widget_install/manifest.h index d30ef15..cb7e6d6 100644 --- a/src/jobs/widget_install/manifest.h +++ b/src/jobs/widget_install/manifest.h @@ -77,6 +77,7 @@ typedef DPL::String NcnameType, NmtokenType, AnySimpleType, LangType; typedef DPL::String OperationType, MimeType, UriType, TypeType, PackageType; typedef DPL::OptionalString InstallLocationType, CategoriesType; typedef DPL::String AppCategoryType; +typedef DPL::String KeyType, ValueType; /** * xmllib2 wrappers @@ -202,6 +203,23 @@ class Privilege typedef Privilege PrivilegeType; +class Metadata +{ + public: + Metadata(KeyType k, ValueType v) : + key(k), + value(v) + {} + void serialize(xmlTextWriterPtr writer); + + private: + KeyType key; + ValueType value; +}; + +typedef Metadata MetadataType; + + /** * @brief ime-application element */ @@ -360,6 +378,10 @@ class UiApplication { this->appCategory.push_back(x); } + void addMetadata(const MetadataType &m) + { + this->metadata.push_back(m); + } void serialize(xmlTextWriterPtr writer); private: @@ -375,6 +397,7 @@ class UiApplication std::list icon; std::list appControl; std::list appCategory; + std::list metadata; }; typedef UiApplication UiApplicationType; diff --git a/src/jobs/widget_install/task_manifest_file.cpp b/src/jobs/widget_install/task_manifest_file.cpp index 7c3e165..33b1283 100644 --- a/src/jobs/widget_install/task_manifest_file.cpp +++ b/src/jobs/widget_install/task_manifest_file.cpp @@ -604,6 +604,7 @@ void TaskManifestFile::writeManifest(const DPL::String & path) setWidgetManifest(manifest); setWidgetOtherInfo(uiApp); setAppCategory(uiApp); + setMetadata(uiApp); setLiveBoxInfo(manifest); setAccount(manifest); setPrivilege(manifest); @@ -629,6 +630,7 @@ void TaskManifestFile::writeManifest(const DPL::String & path) setWidgetIcons(uiApp); setAppControlInfo(uiApp, *it); setAppCategory(uiApp); + setMetadata(uiApp); manifest.addUiApplication(uiApp); } #else @@ -642,6 +644,7 @@ void TaskManifestFile::writeManifest(const DPL::String & path) setWidgetOtherInfo(uiApp); setAppControlsInfo(uiApp); setAppCategory(uiApp); + setMetadata(uiApp); setLiveBoxInfo(manifest); setAccount(manifest); setPrivilege(manifest); @@ -947,6 +950,21 @@ void TaskManifestFile::setAppCategory(UiApplication &uiApp) } } +void TaskManifestFile::setMetadata(UiApplication &uiApp) +{ + WrtDB::ConfigParserData::MetadataList metadataList = + m_context.widgetConfig.configInfo.metadataList; + + if (metadataList.empty()) { + LogInfo("Web application doesn't contain metadata"); + return; + } + FOREACH(it, metadataList) { + MetadataType metadataType(it->key, it->value); + uiApp.addMetadata(metadataType); + } +} + void TaskManifestFile::stepAbortParseManifest() { LogError("[Parse Manifest] Abroting...."); diff --git a/src/jobs/widget_install/task_manifest_file.h b/src/jobs/widget_install/task_manifest_file.h index c9106cb..d0c93b1 100644 --- a/src/jobs/widget_install/task_manifest_file.h +++ b/src/jobs/widget_install/task_manifest_file.h @@ -103,6 +103,7 @@ class TaskManifestFile : void setAppControlInfo(UiApplication & uiApp, const WrtDB::ConfigParserData::AppControlInfo & service); void setAppCategory(UiApplication & uiApp); + void setMetadata(UiApplication & uiApp); void setLiveBoxInfo(Manifest& manifest); void setAccount(Manifest& uiApp); void setPrivilege(Manifest& manifest); diff --git a/src/misc/feature_logic.cpp b/src/misc/feature_logic.cpp index 18b640b..6ae087e 100644 --- a/src/misc/feature_logic.cpp +++ b/src/misc/feature_logic.cpp @@ -28,6 +28,11 @@ namespace Jobs { namespace WidgetInstall { +namespace { +const DPL::String PRIVILEGE_TESTAUTOMATION = + L"http://tizen.org/privilege/testautomation"; +const DPL::String DEVICE_CAPABILITY_TESTAUTOMATION = L"testautomation"; +} FeatureLogic::FeatureLogic(const WrtDB::TizenAppId & tzAppid) : m_rejected(false) { @@ -35,8 +40,16 @@ FeatureLogic::FeatureLogic(const WrtDB::TizenAppId & tzAppid) : WidgetFeatureSet featureSet = widgetDao.getFeaturesList(); FOREACH(it, featureSet) { LogInfo("Feature name : " << it->name); - WrtDB::DeviceCapabilitySet dcs = - WrtDB::GlobalDAOReadOnly::GetDeviceCapability(it->name); + WrtDB::DeviceCapabilitySet dcs; + if (!DPL::StringCompare(it->name, PRIVILEGE_TESTAUTOMATION)) { + // special privilege + // This privilege doesn't have plugin in the target + // only use to special behavior + dcs.insert(DEVICE_CAPABILITY_TESTAUTOMATION); + } else { + // normal privilege + dcs = WrtDB::GlobalDAOReadOnly::GetDeviceCapability(it->name); + } FOREACH(devCap, dcs) { LogInfo("--- dev cap : " << *devCap); } -- 2.7.4