From 8e5b6f2a7f22ca80b21438dab5ce754fa8daf2e2 Mon Sep 17 00:00:00 2001 From: Jihoon Chung Date: Sat, 20 Apr 2013 21:59:43 +0900 Subject: [PATCH 1/1] Clean-up application service [Issue#] N/A [Problem] N/A [Cause] N/A [Solution] Remove deprecated code, appservice [SCMRequest] must be imported with wrt-commons, wrt Change-Id: I270fb6e6a7e723d78c17c340ffe3cd8bd995803d --- src/configuration_parser/widget_parser.cpp | 127 ------------------------- src/configuration_parser/widget_parser.h | 1 - src/jobs/widget_install/task_manifest_file.cpp | 67 +------------ src/jobs/widget_install/task_manifest_file.h | 4 - 4 files changed, 2 insertions(+), 197 deletions(-) diff --git a/src/configuration_parser/widget_parser.cpp b/src/configuration_parser/widget_parser.cpp index 2f12265..8e25198 100644 --- a/src/configuration_parser/widget_parser.cpp +++ b/src/configuration_parser/widget_parser.cpp @@ -919,125 +919,6 @@ class SettingParser : public ElementParser ConfigParserData::Setting m_setting; }; -class AppServiceParser : public ElementParser -{ - public: - virtual ActionFunc GetElementParser(const DPL::String& /*ns*/, - const DPL::String& /*name*/) - { - return &IgnoringParser::Create; - } - - virtual void Accept(const XmlAttribute& attribute) - { - if (attribute.name == L"src") { - m_src = attribute.value; - } else if (attribute.name == L"operation") { - m_operation = attribute.value; - } else if (attribute.name == L"scheme") { - m_scheme = attribute.value; - } else if (attribute.name == L"mime") { - m_mime = attribute.value; - } else if (attribute.name == L"disposition") { - if (attribute.value == L"inline") - m_disposition = - ConfigParserData::ServiceInfo::Disposition::INLINE; - } - } - - virtual void Accept(const Element& element) - { - LogWarning("namespace for app service = " << element.ns); - if (element.ns == ConfigurationNamespace::W3CWidgetNamespaceName) { - ThrowMsg(Exception::ParseError, - "Wrong xml namespace for widget element"); - } - } - - virtual void Accept(const Text& /*text*/) - { - ThrowMsg(Exception::ParseError, "param element must be empty"); - } - - virtual void Verify() - { - if (m_src.IsNull()) { - LogWarning("service element must have target attribute"); - return; - } else if (m_operation.IsNull()) { - LogWarning("service element must have operation attribute"); - return; - } - NormalizeString(m_src); - NormalizeString(m_operation); - NormalizeString(m_scheme); - NormalizeString(m_mime); - - // exception - DPL::String ignoreUri(L"file"); - - if (!m_scheme.IsNull() && *m_scheme == ignoreUri) - { - LogInfo("exception : '" << *m_scheme << "' scheme will be ignored."); - m_scheme = DPL::OptionalString::Null; - } - - // verify duplicate element - DPL::String wildString(L"*/*"); - DPL::String nullString(L""); - ConfigParserData::ServiceInfo serviceInfo( - m_src.IsNull() ? nullString : *m_src, - m_operation.IsNull() ? nullString : *m_operation, - m_scheme.IsNull() ? nullString : *m_scheme, - m_mime.IsNull() ? nullString : *m_mime, - m_disposition); - - FOREACH(iterator, m_data.appServiceList) { - if (iterator->m_operation == serviceInfo.m_operation && - // check scheme - (iterator->m_scheme == serviceInfo.m_scheme || - // check input scheme is "*/*" case - (iterator->m_scheme == wildString && - serviceInfo.m_scheme != nullString) || - // check iterator scheme is "*/*" case - (serviceInfo.m_scheme == wildString && - iterator->m_scheme != nullString)) && - - (iterator->m_mime == serviceInfo.m_mime || - // check input mime is "*/*" case - (iterator->m_mime == wildString && - serviceInfo.m_mime != nullString) || - // check iterator mime is "*/*" case - (serviceInfo.m_mime == wildString && - iterator->m_mime != nullString))) - { - ThrowMsg(Exception::ParseError, - "service operation is duplicated " + - DPL::ToUTF8String(*m_operation)); - } - } - m_data.appServiceList.push_back(serviceInfo); - } - - AppServiceParser(ConfigParserData& data) : - ElementParser(), - m_src(DPL::OptionalString::Null), - m_operation(DPL::OptionalString::Null), - m_scheme(DPL::OptionalString::Null), - m_mime(DPL::OptionalString::Null), - m_disposition(ConfigParserData::ServiceInfo::Disposition::WINDOW), - m_data(data) - {} - - private: - DPL::OptionalString m_src; - DPL::OptionalString m_operation; - DPL::OptionalString m_scheme; - DPL::OptionalString m_mime; - ConfigParserData::ServiceInfo::Disposition m_disposition; - ConfigParserData& m_data; -}; - class AppControlParser : public ElementParser { public: @@ -2453,9 +2334,6 @@ WidgetParser::WidgetParser(ConfigParserData& data) : m_map[L"link"] = DPL::MakeDelegate(this, &WidgetParser::OnLinkElement); m_map[L"setting"] = DPL::MakeDelegate(this, &WidgetParser::OnSettingElement); - // TODO: appservice will be removed - m_map[L"appservice"] = DPL::MakeDelegate(this, - &WidgetParser::OnAppServiceElement); m_map[L"application"] = DPL::MakeDelegate( this, &WidgetParser:: @@ -2555,11 +2433,6 @@ ElementParserPtr WidgetParser::OnPrivilegeElement() return ElementParserPtr(new PrivilegeParser(m_data)); } -ElementParserPtr WidgetParser::OnAppServiceElement() -{ - return ElementParserPtr(new AppServiceParser(m_data)); -} - ElementParserPtr WidgetParser::OnAppControlElement() { return ElementParserPtr(new AppControlParser(m_data)); diff --git a/src/configuration_parser/widget_parser.h b/src/configuration_parser/widget_parser.h index 7dba4f5..883a5fc 100644 --- a/src/configuration_parser/widget_parser.h +++ b/src/configuration_parser/widget_parser.h @@ -78,7 +78,6 @@ class WidgetParser : public ElementParser ElementParserPtr OnSplashElement(); ElementParserPtr OnBackgroundElement(); ElementParserPtr OnPrivilegeElement(); - ElementParserPtr OnAppServiceElement(); ElementParserPtr OnAppControlElement(); ElementParserPtr OnCategoryElement(); ElementParserPtr OnAppWidgetElement(); diff --git a/src/jobs/widget_install/task_manifest_file.cpp b/src/jobs/widget_install/task_manifest_file.cpp index c204226..3596659 100644 --- a/src/jobs/widget_install/task_manifest_file.cpp +++ b/src/jobs/widget_install/task_manifest_file.cpp @@ -148,10 +148,9 @@ void TaskManifestFile::stepCreateExecFile() #ifdef MULTIPROCESS_SERVICE_SUPPORT //services - std::size_t serviceCount = + std::size_t appcontrolCount = m_context.widgetConfig.configInfo.appControlList.size(); - serviceCount += m_context.widgetConfig.configInfo.appServiceList.size(); - for (std::size_t i = 0; i < serviceCount; ++i) { + for (std::size_t i = 0; i < appcontrolCount; ++i) { std::stringstream postfix; postfix << "-__SERVICE_PROCESS__" << i; std::string serviceExec = exec; @@ -576,7 +575,6 @@ void TaskManifestFile::writeManifest(const DPL::String & path) setWidgetManifest(manifest); setWidgetOtherInfo(uiApp); #ifndef MULTIPROCESS_SERVICE_SUPPORT - setAppServicesInfo(uiApp); setAppControlsInfo(uiApp); #endif setAppCategory(uiApp); @@ -615,35 +613,6 @@ void TaskManifestFile::writeManifest(const DPL::String & path) manifest.addUiApplication(uiApp); } - //TODO: AppService tag will be removed - //services AppService tag - WrtDB::ConfigParserData::ServiceInfoList appServiceList = - m_context.widgetConfig.configInfo.appServiceList; - FOREACH(it, appServiceList) { - it->m_index = count; - UiApplication uiApp; - - uiApp.setTaskmanage(true); - uiApp.setNodisplay(true); -#ifdef MULTIPROCESS_SERVICE_SUPPORT_INLINE - uiApp.setTaskmanage(ConfigParserData::ServiceInfo::Disposition::INLINE != it->m_disposition); - uiApp.setMultiple(ConfigParserData::ServiceInfo::Disposition::INLINE == it->m_disposition); -#endif - - std::stringstream postfix; - postfix << "-__SERVICE_PROCESS__" << count++; - - setWidgetExecPath(uiApp, postfix.str()); - setWidgetName(manifest, uiApp); - setWidgetIds(manifest, uiApp, postfix.str()); - setWidgetIcons(uiApp); - setAppServiceInfo(uiApp, *it); - setAppCategory(uiApp); - setAccount(manifest); - setPrivilege(manifest); - - manifest.addUiApplication(uiApp); - } #endif manifest.generate(path); LogDebug("Manifest file serialized"); @@ -857,22 +826,6 @@ void TaskManifestFile::setWidgetOtherInfo(UiApplication & uiApp) //that were in desktop file } -void TaskManifestFile::setAppServicesInfo(UiApplication & uiApp) -{ - WrtDB::ConfigParserData::ServiceInfoList appServiceList = - m_context.widgetConfig.configInfo.appServiceList; - - if (appServiceList.empty()) { - LogInfo("Widget doesn't contain application service"); - return; - } - - // x-tizen-svc=http://tizen.org/appcontrol/operation/pick|NULL|image; - FOREACH(it, appServiceList) { - setAppServiceInfo(uiApp, *it); - } - } - void TaskManifestFile::setAppControlsInfo(UiApplication & uiApp) { WrtDB::ConfigParserData::AppControlInfoList appControlList = @@ -889,22 +842,6 @@ void TaskManifestFile::setAppControlsInfo(UiApplication & uiApp) } } -void TaskManifestFile::setAppServiceInfo(UiApplication & uiApp, - const ConfigParserData::ServiceInfo & service) -{ - AppControl appControl; - if (!service.m_operation.empty()) { - appControl.addOperation(service.m_operation); //TODO: encapsulation? - } - if (!service.m_scheme.empty()) { - appControl.addUri(service.m_scheme); - } - if (!service.m_mime.empty()) { - appControl.addMime(service.m_mime); - } - uiApp.addAppControl(appControl); -} - void TaskManifestFile::setAppControlInfo(UiApplication & uiApp, const WrtDB::ConfigParserData::AppControlInfo & service) { diff --git a/src/jobs/widget_install/task_manifest_file.h b/src/jobs/widget_install/task_manifest_file.h index 54a3bbb..14e33fc 100644 --- a/src/jobs/widget_install/task_manifest_file.h +++ b/src/jobs/widget_install/task_manifest_file.h @@ -98,11 +98,7 @@ class TaskManifestFile : void setWidgetIcons(UiApplication & uiApp); void setWidgetManifest(Manifest & manifest); void setWidgetOtherInfo(UiApplication & uiApp); - /* please use AppControl. this function will be removed. */ - void setAppServicesInfo(UiApplication & uiApp); void setAppControlsInfo(UiApplication & uiApp); - void setAppServiceInfo(UiApplication & uiApp, - const WrtDB::ConfigParserData::ServiceInfo & service); void setAppControlInfo(UiApplication & uiApp, const WrtDB::ConfigParserData::AppControlInfo & service); void setAppCategory(UiApplication & uiApp); -- 2.7.4