Clean-up unused feature data
authorJihoon Chung <jihoon.chung@samsung.com>
Sat, 23 Mar 2013 07:43:51 +0000 (16:43 +0900)
committerGerrit Code Review <gerrit2@kim11>
Tue, 2 Apr 2013 05:33:25 +0000 (14:33 +0900)
[Issue#] N/A
[Problem] N/A
[Cause] N/A
[Solution] Current WRT uses Privilege instead of Feature
Deprecated :
Parser for feature (FeatureParser, ParamParser, OnFeatureElement())
param and required field
[SCMRequest] N/A

Change-Id: I1936b0bff216bc501c8db6a40eff2baef87c794e

src/configuration_parser/widget_parser.cpp
src/configuration_parser/widget_parser.h
src/jobs/widget_install/job_widget_install.cpp
src/jobs/widget_install/task_widget_config.cpp
src/misc/feature_logic.cpp
src/misc/feature_logic.h

index 94e57e8..50c8137 100644 (file)
@@ -743,132 +743,6 @@ class ContentParser : public ElementParser
     ConfigParserData& m_data;
 };
 
-class FeatureParser : public ElementParser
-{
-  public:
-    struct ParamParser : public ElementParser
-    {
-        virtual ActionFunc GetElementParser(const DPL::String& /*ns*/,
-                                            const DPL::String& /*name*/)
-        {
-            return &IgnoringParser::Create;
-        }
-
-        virtual void Accept(const XmlAttribute& attribute)
-        {
-            if (attribute.name == L"name") {
-                m_name = attribute.value;
-                NormalizeString(m_name);
-            } else if (attribute.name == L"value") {
-                m_value = attribute.value;
-                NormalizeString(m_value);
-            }
-        }
-
-        virtual void Accept(const Element& /*element*/)
-        {}
-
-        virtual void Accept(const Text& /*text*/)
-        {
-            ThrowMsg(Exception::ParseError, "param element must be empty");
-        }
-
-        virtual void Verify()
-        {
-            if (m_name.IsNull() || *m_name == L"") {
-                return;
-            }
-            if (m_value.IsNull() || *m_value == L"") {
-                return;
-            }
-
-            ConfigParserData::Param param(*m_name);
-            param.value = *m_value;
-
-            if (m_data.paramsList.find(param) == m_data.paramsList.end()) {
-                m_data.paramsList.insert(param);
-            }
-        }
-
-        ParamParser(ConfigParserData::Feature& data) :
-            ElementParser(),
-            m_data(data)
-        {}
-
-      private:
-        DPL::OptionalString m_name;
-        DPL::OptionalString m_value;
-        ConfigParserData::Feature& m_data;
-    };
-
-    virtual ActionFunc GetElementParser(const DPL::String& /*ns*/,
-                                        const DPL::String& name)
-    {
-        if (name == L"param") {
-            return DPL::MakeDelegate(this, &FeatureParser::OnParamElement);
-        } else {
-            return &IgnoringParser::Create;
-        }
-    }
-
-    virtual void Accept(const Text& /*text*/)
-    {}
-
-    virtual void Accept(const Element& /*element*/)
-    {}
-
-    virtual void Accept(const XmlAttribute& attribute)
-    {
-        if (attribute.name == L"name") {
-            m_feature.name = attribute.value;
-        } else if (attribute.name == L"required") {
-            if (attribute.value == L"false") {
-                m_feature.required = false;
-            } else {
-                m_feature.required = true;
-            }
-        }
-    }
-
-    virtual void Verify()
-    {
-        LibIri::Wrapper iri(DPL::ToUTF8String(m_feature.name).c_str());
-
-        if (m_feature.name != L"") {
-            if (iri.Validate()) {
-                if (m_data.featuresList.find(m_feature) ==
-                    m_data.featuresList.end())
-                {
-                    m_data.featuresList.insert(m_feature);
-                } else {
-                    LogDebug("Ignoring feature with name" <<
-                             DPL::ToUTF8String(m_feature.name));
-                }
-            } else {
-                if (m_feature.required) {
-                    //Throw only if required
-                    ThrowMsg(Exception::ParseError, "invalid feature IRI");
-                }
-            }
-        }
-    }
-
-    ElementParserPtr OnParamElement()
-    {
-        return ElementParserPtr(new ParamParser(m_feature));
-    }
-
-    FeatureParser(ConfigParserData& data) :
-        ElementParser(),
-        m_data(data),
-        m_feature(L"")
-    {}
-
-  private:
-    ConfigParserData& m_data;
-    ConfigParserData::Feature m_feature;
-};
-
 class PreferenceParser : public ElementParser
 {
   public:
@@ -1661,7 +1535,6 @@ class PrivilegeParser : public ElementParser
                 m_privilege.name = attribute.value;
             }
         }
-        m_feature.required = false;
     }
 
     virtual void Verify()
@@ -1676,7 +1549,7 @@ class PrivilegeParser : public ElementParser
                     m_data.featuresList.insert(m_feature);
                 } else {
                     LogDebug("Ignoring feature with name" <<
-                             DPL::ToUTF8String(m_feature.name));
+                        DPL::ToUTF8String(m_feature.name));
                 }
             }
         }
@@ -2409,7 +2282,7 @@ class AccountParser : public ElementParser
 
                   if (attribute.value == L"ture") {
                       m_multiSupport = true;
-                  } 
+                  }
               }
           }
 
@@ -2518,8 +2391,6 @@ WidgetParser::WidgetParser(ConfigParserData& data) :
     m_map[L"icon"] = DPL::MakeDelegate(this, &WidgetParser::OnIconElement);
     m_map[L"content"] =
         DPL::MakeDelegate(this, &WidgetParser::OnContentElement);
-    m_map[L"feature"] =
-        DPL::MakeDelegate(this, &WidgetParser::OnFeatureElement);
     m_map[L"preference"] =
         DPL::MakeDelegate(this, &WidgetParser::OnPreferenceElement);
     m_map[L"link"] = DPL::MakeDelegate(this, &WidgetParser::OnLinkElement);
@@ -2592,11 +2463,6 @@ ElementParserPtr WidgetParser::OnContentElement()
     return ElementParserPtr(new ContentParser(m_data));
 }
 
-ElementParserPtr WidgetParser::OnFeatureElement()
-{
-    return ElementParserPtr(new FeatureParser(m_data));
-}
-
 ElementParserPtr WidgetParser::OnPreferenceElement()
 {
     return ElementParserPtr(new PreferenceParser(m_data));
index c171c9d..7dba4f5 100644 (file)
@@ -70,7 +70,6 @@ class WidgetParser : public ElementParser
     ElementParserPtr OnLicenseElement();
     ElementParserPtr OnIconElement();
     ElementParserPtr OnContentElement();
-    ElementParserPtr OnFeatureElement();
     ElementParserPtr OnPreferenceElement();
     ElementParserPtr OnAccessElement();
     ElementParserPtr OnLinkElement();
index e0a26bb..c311d8c 100644 (file)
@@ -925,8 +925,6 @@ void JobWidgetInstall::displayWidgetInfo()
         FOREACH(it, list)
         {
             out << std::endl << "  Name:                      " << it->name;
-            out << std::endl << "      Required:              " << it->required;
-            out << std::endl << "      Params:";
         }
     }
 
index b53bb25..cbf6590 100644 (file)
@@ -478,30 +478,6 @@ void TaskWidgetConfig::StepVerifyFeatures()
                                   <<
                 "] cannot be allowed to use [" <<
                 DPL::ToUTF8String(it->name) + "] feature");
-        }
-        if (!WrtDB::FeatureDAOReadOnly::isFeatureInstalled(
-                DPL::ToUTF8String(it->name)))
-        {
-            LogWarning("Feature not found. Checking if required :[" <<
-                       DPL::ToUTF8String(it->name) << "]");
-
-            if (it->required) {
-                /**
-                 * WL-3210 The WRT MUST inform the user if a widget cannot be
-                 * installed because one or more required features are not
-                 * supported.
-                 */
-                std::ostringstream os;
-                os <<
-                "Widget cannot be installed, required feature is missing:["
-                   << DPL::ToUTF8String(it->name) << "]";
-                if (!GlobalSettings::TestModeEnabled() && !isTizenWebApp()) {
-                    std::string label = os.str();
-                    createInstallPopup(PopupType::WIDGET_WRONG_FEATURE_INFO,
-                                       label);
-                }
-                ThrowMsg(Exceptions::WidgetConfigFileInvalid, os.str());
-            }
         } else {
             newList.insert(*it);
             featureInfo += DPL::ToUTF8String(it->name);
index de4b99c..aa8b873 100644 (file)
@@ -79,9 +79,8 @@ void FeatureLogic::setAceResponse(bool allowed)
     Assert(isProcessable() && "Wrong usage");
     if (!allowed) {
         m_currentFeature->rejected = true;
-        if (m_currentFeature->required) {
-            m_rejected = true;
-        }
+        // TODO: checking tizen specification regarding security for insatlling
+        // m_rejected = true;
     }
 }
 
index 03bb51a..8c4458f 100644 (file)
@@ -72,10 +72,8 @@ class FeatureLogic : DPL::Noncopyable
         {
             name = second.name;
             devCapSet = second.devCapSet;
-            required = second.required;
             rejected = second.rejected;
             pluginId = second.pluginId;
-            params = second.params;
             currentCap = devCapSet.find(*second.currentCap);
         }
     };