Fixed installer couldn't add account to manifest file
authorSoyoung Kim <sy037.kim@samsung.com>
Fri, 27 Sep 2013 06:44:30 +0000 (15:44 +0900)
committerSoo-Hyun Choi <sh9.choi@samsung.com>
Tue, 1 Oct 2013 07:08:16 +0000 (16:08 +0900)
[Issue#]   N_SE-53213
[Problem]  Can't add account to manifest file
           even if account information is in config.xml.
[Cause]    Wrt-installer did not create the account information
           to manifest file when parsing config.xml.
[Solution] Fixed parsing context to create the account information.

[SCMRequest] N/A

Change-Id: I51f2b3b7f1d6ff5a0593714c15e20cc64e09cdd9

src/configuration_parser/widget_parser.cpp
src/jobs/widget_install/manifest.cpp

index 9d7284a..f39b478 100644 (file)
@@ -2329,269 +2329,221 @@ class CspReportOnlyParser : public ElementParser
 class AccountParser : public ElementParser
 {
   public:
-    struct AccountProviderParser : public ElementParser
+      struct IconParser : public ElementParser
     {
-      public:
-
-          struct IconParser : public ElementParser
-        {
-            public:
-                virtual ActionFunc GetElementParser(const DPL::String& /*ns*/,
-                        const DPL::String& /*name*/)
-                {
-                    return &IgnoringParser::Create; //ignore unknown according to w3c
-                }
+        public:
+            virtual ActionFunc GetElementParser(const DPL::String& /*ns*/,
+                    const DPL::String& /*name*/)
+            {
+                return &IgnoringParser::Create; //ignore unknown according to w3c
+            }
 
-                virtual void Accept(const Text& text)
-                {
-                    if (text.value == L"") {
-                        return;
-                    }
-                    m_value = text.value;
+            virtual void Accept(const Text& text)
+            {
+                if (text.value == L"") {
+                    return;
                 }
+                m_value = text.value;
+            }
 
-                virtual void Accept(const Element& /*element*/)
-                {}
+            virtual void Accept(const Element& /*element*/)
+            {}
 
-                virtual void Accept(const XmlAttribute& attribute)
-                {
-                    if (attribute.name == L"section") {
-                        if (attribute.value == L"account") {
-                            m_type = ConfigParserData::IconSectionType::DefaultIcon;
-                        } else if (attribute.value == L"account-small") {
-                            m_type = ConfigParserData::IconSectionType::SmallIcon;
-                        }
+            virtual void Accept(const XmlAttribute& attribute)
+            {
+                if (attribute.name == L"section") {
+                    if (attribute.value == L"Account") {
+                        m_type = ConfigParserData::IconSectionType::DefaultIcon;
+                    } else if (attribute.value == L"AccountSmall") {
+                        m_type = ConfigParserData::IconSectionType::SmallIcon;
                     }
                 }
+            }
 
-                virtual void Verify()
-                {
-                    if (m_value.IsNull() || *m_value == L"") {
-                        return;
-                    }
-
-                    std::pair<ConfigParserData::IconSectionType, DPL::String> icon;
-                    icon.first = m_type;
-                    icon.second = *m_value;
-
-                    m_data.m_iconSet.insert(icon);
+            virtual void Verify()
+            {
+                if (m_value.IsNull() || *m_value == L"") {
+                    return;
                 }
 
-                IconParser(ConfigParserData::AccountProvider& data) :
-                    ElementParser(),
-                    m_properNamespace(false),
-                    m_type(ConfigParserData::DefaultIcon),
-                    m_data(data)
-            {}
+                std::pair<ConfigParserData::IconSectionType, DPL::String> icon;
+                icon.first = m_type;
+                icon.second = *m_value;
 
-            private:
-                bool m_properNamespace;
-                ConfigParserData::IconSectionType m_type;
-                ConfigParserData::AccountProvider& m_data;
-                DPL::OptionalString m_value;
-        };
+                m_data.m_iconSet.insert(icon);
+            }
 
-          struct DisplayNameParser : public ElementParser
-        {
-            public:
-                virtual ActionFunc GetElementParser(const DPL::String& /*ns*/,
-                        const DPL::String& /*name*/)
-                {
-                    return &IgnoringParser::Create; //ignore unknown according to w3c
-                }
+            IconParser(ConfigParserData::AccountProvider& data) :
+                ElementParser(),
+                m_properNamespace(false),
+                m_type(ConfigParserData::DefaultIcon),
+                m_data(data)
+        {}
 
-                virtual void Accept(const Text& text)
-                {
-                    if (text.value == L"") {
-                        return;
-                    }
-                    m_value = text.value;
-                }
+        private:
+            bool m_properNamespace;
+            ConfigParserData::IconSectionType m_type;
+            ConfigParserData::AccountProvider& m_data;
+            DPL::OptionalString m_value;
+    };
 
-                virtual void Accept(const Element& element)
-                {
-                    m_lang = element.lang;
-                    m_value= L"";
-                }
+      struct DisplayNameParser : public ElementParser
+    {
+        public:
+            virtual ActionFunc GetElementParser(const DPL::String& /*ns*/,
+                    const DPL::String& /*name*/)
+            {
+                return &IgnoringParser::Create; //ignore unknown according to w3c
+            }
 
-                virtual void Accept(const XmlAttribute& /*attribute*/)
-                {}
+            virtual void Accept(const Text& text)
+            {
+                if (text.value == L"") {
+                    return;
+                }
+                m_value = text.value;
+            }
 
-                virtual void Verify()
-                {
-                    if (m_value.IsNull() || *m_value == L"") {
-                        return;
-                    }
+            virtual void Accept(const Element& element)
+            {
+                m_lang = element.lang;
+                m_value= L"";
+            }
 
-                    std::pair<DPL::String, DPL::String> name;
-                    name.first = *m_lang;
-                    name.second = *m_value;
+            virtual void Accept(const XmlAttribute& /*attribute*/)
+            {}
 
-                    m_data.m_displayNameSet.insert(name);
+            virtual void Verify()
+            {
+                if (m_value.IsNull() || *m_value == L"") {
+                    return;
                 }
 
-                DisplayNameParser(ConfigParserData::AccountProvider& data) :
-                    ElementParser(),
-                    m_properNamespace(false),
-                    m_data(data)
-            {}
+                std::pair<DPL::String, DPL::String> name;
+                name.first = *m_lang;
+                name.second = *m_value;
 
-            private:
-                bool m_properNamespace;
-                DPL::OptionalString m_lang;
-                DPL::OptionalString m_value;
-                ConfigParserData::AccountProvider& m_data;
-        };
-
-          struct CapabilityParser : public ElementParser
-        {
-            public:
-                virtual ActionFunc GetElementParser(const DPL::String& /*ns*/,
-                        const DPL::String& /*name*/)
-                {
-                    return &IgnoringParser::Create; //ignore unknown according to w3c
-                }
+                m_data.m_displayNameSet.insert(name);
+            }
 
-                virtual void Accept(const Text& text)
-                {
-                    if (text.value == L"") {
-                        return;
-                    }
-                    m_value = text.value;
-                }
+            DisplayNameParser(ConfigParserData::AccountProvider& data) :
+                ElementParser(),
+                m_properNamespace(false),
+                m_data(data)
+        {}
 
-                virtual void Accept(const Element& /*element*/)
-                {}
+        private:
+            bool m_properNamespace;
+            DPL::OptionalString m_lang;
+            DPL::OptionalString m_value;
+            ConfigParserData::AccountProvider& m_data;
+    };
 
-                virtual void Accept(const XmlAttribute& /*attribute*/)
-                {}
+      struct CapabilityParser : public ElementParser
+    {
+        public:
+            virtual ActionFunc GetElementParser(const DPL::String& /*ns*/,
+                    const DPL::String& /*name*/)
+            {
+                return &IgnoringParser::Create; //ignore unknown according to w3c
+            }
 
-                virtual void Verify()
-                {
-                    if (m_value.IsNull() || *m_value == L"") {
-                        return;
-                    }
-                    m_data.m_capabilityList.push_back(*m_value);
+            virtual void Accept(const Text& text)
+            {
+                if (text.value == L"") {
+                    return;
                 }
+                m_value = text.value;
+            }
 
-                CapabilityParser(ConfigParserData::AccountProvider& data) :
-                    ElementParser(),
-                    m_properNamespace(false),
-                    m_data(data)
+            virtual void Accept(const Element& /*element*/)
             {}
 
-            private:
-                bool m_properNamespace;
-                DPL::OptionalString m_value;
-                ConfigParserData::AccountProvider& m_data;
-        };
-          virtual ActionFunc GetElementParser(const DPL::String& /*ns*/,
-                  const DPL::String& name)
-          {
-              if (name == L"icon") {
-                  return DPL::MakeDelegate(this, &AccountProviderParser::OnIconElement);
-              } else if (name == L"display-name") {
-                  return DPL::MakeDelegate(this,
-                          &AccountProviderParser::OnDisplayNameElement);
-              } else if (name == L"capability") {
-                  return DPL::MakeDelegate(this, &AccountProviderParser::OnCapabilityElement);
-              } else {
-                  return &IgnoringParser::Create; //ignore unknown according to w3c
-              }
-          }
-
-          virtual void Accept(const Text& /*text*/)
-          {}
+            virtual void Accept(const XmlAttribute& /*attribute*/)
+            {}
 
-          virtual void Accept(const Element& /*element*/)
-          {}
+            virtual void Verify()
+            {
+                if (m_value.IsNull() || *m_value == L"") {
+                    return;
+                }
+                m_data.m_capabilityList.push_back(*m_value);
+            }
 
-          virtual void Accept(const XmlAttribute& attribute)
-          {
-              if (attribute.name == L"multiple-accounts-support") {
-                  if (attribute.value == L"true") {
-                      m_multiSupport = true;
-                  }
-              }
-          }
+            CapabilityParser(ConfigParserData::AccountProvider& data) :
+                ElementParser(),
+                m_properNamespace(false),
+                m_data(data)
+        {}
 
-          virtual void Verify()
-          {
-              m_data.m_multiAccountSupport = m_multiSupport;
+        private:
+            bool m_properNamespace;
+            DPL::OptionalString m_value;
+            ConfigParserData::AccountProvider& m_data;
+    };
+      virtual ActionFunc GetElementParser(const DPL::String& /*ns*/,
+              const DPL::String& name)
+      {
+          if (name == L"icon") {
+              return DPL::MakeDelegate(this, &AccountParser::OnIconElement);
+          } else if (name == L"display-name") {
+              return DPL::MakeDelegate(this,
+                      &AccountParser::OnDisplayNameElement);
+          } else if (name == L"capability") {
+              return DPL::MakeDelegate(this, &AccountParser::OnCapabilityElement);
+          } else {
+              return &IgnoringParser::Create; //ignore unknown according to w3c
           }
+      }
 
-          ElementParserPtr OnIconElement()
-          {
-              return ElementParserPtr(new IconParser(m_data));
-          }
+      virtual void Accept(const Text& /*text*/)
+      {}
 
-          ElementParserPtr OnDisplayNameElement()
-          {
-              return ElementParserPtr(new DisplayNameParser(m_data));
-          }
+      virtual void Accept(const Element& /*element*/)
+      {}
 
-          ElementParserPtr OnCapabilityElement()
-          {
-              return ElementParserPtr(new CapabilityParser(m_data));
+      virtual void Accept(const XmlAttribute& attribute)
+      {
+          if (attribute.name == L"multiple-account-support") {
+              if (attribute.value == L"true") {
+                  m_account.m_multiAccountSupport = true;
+              }
           }
+      }
 
-          AccountProviderParser(ConfigParserData::AccountProvider& data) :
-              ElementParser(),
-              m_properNamespace(false),
-              m_multiSupport(false),
-              m_data(data)
-        {}
-
-      private:
-          bool m_properNamespace;
-          bool m_multiSupport;
-          ConfigParserData::AccountProvider& m_data;
-    };
-
-    virtual ActionFunc GetElementParser(const DPL::String& /*ns*/,
-            const DPL::String& name)
-    {
-        if (name == L"account-provider") {
-            return DPL::MakeDelegate(this, &AccountParser::OnProviderElement);
-        } else {
-            return &IgnoringParser::Create; //ignore unknown according to w3c
-        }
-    }
-
-    virtual void Accept(const Element& element)
-    {
-        if (element.ns == ConfigurationNamespace::TizenWebAppNamespaceName) {
-            m_properNamespace = true;
-        }
-    }
+      virtual void Verify()
+      {
+      }
 
-    virtual void Accept(const XmlAttribute& /*attribute*/)
-    {}
+      ElementParserPtr OnIconElement()
+      {
+          return ElementParserPtr(new IconParser(m_account));
+      }
 
-    virtual void Accept(const Text& /*text*/)
-    {}
+      ElementParserPtr OnDisplayNameElement()
+      {
+          return ElementParserPtr(new DisplayNameParser(m_account));
+      }
 
-    virtual void Verify()
-    {}
+      ElementParserPtr OnCapabilityElement()
+      {
+          return ElementParserPtr(new CapabilityParser(m_account));
+      }
 
-    ElementParserPtr OnProviderElement()
+      AccountParser(ConfigParserData& data) :
+          ElementParser(),
+          m_properNamespace(false),
+          m_multiSupport(false),
+          m_data(data),
+          m_account(data.accountProvider)
     {
-        return ElementParserPtr(new AccountProviderParser(m_account));
     }
 
-    AccountParser(ConfigParserData& data) :
-        ElementParser(),
-        m_data(data),
-        m_account(data.accountProvider),
-        m_properNamespace(false),
-        m_multiSupport(false)
-    {}
-
   private:
-    ConfigParserData& m_data;
-    ConfigParserData::AccountProvider& m_account;
-    bool m_properNamespace;
-    bool m_multiSupport;
+      bool m_properNamespace;
+      bool m_multiSupport;
+      ConfigParserData& m_data;
+      ConfigParserData::AccountProvider& m_account;
 };
 
 class MetadataParser : public ElementParser
index 80b37b0..977f58e 100644 (file)
@@ -460,7 +460,7 @@ void Account::serialize(xmlTextWriterPtr writer)
     startElement(writer, "account");
     {
         startElement(writer, "account-provider");
-        writeAttribute(writer, "app-id", this->provider.appid);
+        writeAttribute(writer, "appid", this->provider.appid);
         writeAttribute(writer, "multiple-accounts-support",
                 this->provider.multiAccount);