#include <dpl/wrt-dao-ro/common_dao_types.h>
/**
-* Widget version is optional
-*/
+ * Widget version is optional
+ */
typedef DPL::Optional<WidgetVersion> OptionalWidgetVersion;
/* Define db type */
AlreadyRunning, ///< Widget is already running
AlreadyStopped, ///< Widget is already stopped
InvalidLanguage, ///< Widget is invalid in current locales
- StillAuthorizing, ///< Widget is still autorizing and has not yet finished it
+ StillAuthorizing, ///< Widget is still autorizing and has not yet
+ // finished it
EarlyKilled, ///< Widget was early killed during launch
AccessDenied, ///< Access denied from ACE
CertificateRevoked, ///< Some certificate was revoked.
}
bool WidgetConfigurationManager::locateAndParseConfigurationFile(
- const std::string& _currentPath,
- WrtDB::WidgetRegisterInfo& pWidgetConfigInfo,
- const std::string& baseFolder,
- int* pErrCode)
+ const std::string& _currentPath,
+ WrtDB::WidgetRegisterInfo& pWidgetConfigInfo,
+ const std::string& baseFolder,
+ int* pErrCode)
{
using namespace WrtDB;
// check if this installation from browser, or not.
size_t pos = _currentPath.rfind("/");
std::ostringstream infoPath;
- infoPath << _currentPath.substr(pos+1);
+ infoPath << _currentPath.substr(pos + 1);
ParserRunner parser;
std::string language = "";
//TODO why don't we use fopen here
bool has_config_xml = false;
errno = 0;
- while ((ptr = readdir(dir)) != NULL) { //Find configuration file, based on its name
+ while ((ptr = readdir(dir)) != NULL) { //Find configuration file, based
+ // on its name
if (ptr->d_type == DT_REG) {
if (!strcmp(ptr->d_name, WRT_WIDGET_CONFIG_FILE_NAME)) {
_WrtUtilSetAbsolutePath(cfgAbsPath,
}
//
- // WidgetConfigurationParser & parser = WidgetConfigurationParserSingleton::Instance();
- // if (!parser.parseConfigurationFile(cfgAbsPath, configInfo, baseFolder.c_str(), pWidgetConfigInfo.signature_type)) {
- // LogDebug("Invalid widget configuration file!");
- // *pErrCode = WRT_WM_ERR_INVALID_ARCHIVE;
+ // WidgetConfigurationParser & parser =
+ // WidgetConfigurationParserSingleton::Instance();
+ // if
+ // (!parser.parseConfigurationFile(cfgAbsPath, configInfo,
+ // baseFolder.c_str(), pWidgetConfigInfo.signature_type)) {
+ // LogDebug("Invalid widget configuration
+ // file!");
+ // *pErrCode =
+ // WRT_WM_ERR_INVALID_ARCHIVE;
// closedir(dir);
// return false;
// }
Try
{
parser.Parse(_currentPath, ElementParserPtr(new
- RootParser<
- WidgetParser>(
- configInfo,
- DPL::FromUTF32String(
- L"widget"))));
+ RootParser<
+ WidgetParser>(
+ configInfo,
+ DPL::
+ FromUTF32String(
+ L"widget"))));
}
Catch(ElementParser::Exception::Base)
{
}
}
-
char *tmp_language;
if (!_WrtUtilStringToLower(baseFolder.c_str(), &tmp_language)) {
*pErrCode = WRT_ERR_UNKNOWN;
return true;
}
-void WidgetConfigurationManager::processFile(const std::string& path,
- WrtDB::WidgetRegisterInfo &widgetConfiguration)
+void WidgetConfigurationManager::processFile(
+ const std::string& path,
+ WrtDB::WidgetRegisterInfo &
+ widgetConfiguration)
{
int pErrCode;
if (!locateAndParseConfigurationFile(path, widgetConfiguration,
- DEFAULT_LANGUAGE, &pErrCode)) {
+ DEFAULT_LANGUAGE, &pErrCode))
+ {
LogWarning("Widget archive: Failed while parsing config file");
ThrowMsg(Exception::ProcessFailed, path);
}
private:
typedef std::list<std::pair<DPL::String, DPL::String> > StringPairList;
- bool locateAndParseConfigurationFile(const std::string& currentPath,
- WrtDB::WidgetRegisterInfo& pWidgetConfigInfo,
- const std::string& baseFolder,
- int* pErrCode);
+ bool locateAndParseConfigurationFile(
+ const std::string& currentPath,
+ WrtDB::WidgetRegisterInfo&
+ pWidgetConfigInfo,
+ const std::string& baseFolder,
+ int* pErrCode);
};
typedef DPL::Singleton<WidgetConfigurationManager>
#include <dpl/assert.h>
DenyAllParser::DenyAllParser() : ElementParser()
-{
-}
+{}
ElementParserPtr DenyAllParser::Create()
{
}
ElementParser::ActionFunc DenyAllParser::GetElementParser(const DPL::String& /*ns*/,
- const DPL::String& /*name*/)
+ const DPL::String& /*name*/)
{
ThrowMsg(Exception::ParseError, "There must not be any subelement");
}
virtual void Accept(const XmlAttribute& /*attribute*/);
virtual void Accept(const Text& /*text*/);
virtual void Verify()
- {
- }
+ {}
virtual ActionFunc GetElementParser(const DPL::String& ns,
- const DPL::String& name);
+ const DPL::String& name);
DenyAllParser();
};
virtual void Accept(const Text&) = 0;
virtual void Verify() = 0;
virtual ActionFunc GetElementParser(const DPL::String &ns,
- const DPL::String &name) = 0;
+ const DPL::String &name) = 0;
virtual ~ElementParser()
- {
- }
+ {}
protected:
ElementParser()
- {
- }
+ {}
};
#endif // ELEMENT_PARSER_H_
#include <memory>
IgnoringParser::IgnoringParser() : ElementParser()
-{
-}
+{}
ElementParserPtr IgnoringParser::Create()
{
}
ElementParser::ActionFunc IgnoringParser::GetElementParser(const DPL::String& /*ns*/,
- const DPL::String& /*name*/)
+ const DPL::String& /*name*/)
{
return DPL::MakeDelegate(this, &IgnoringParser::Reuse);
}
void IgnoringParser::Accept(const Element& /*element*/)
-{
-}
+{}
void IgnoringParser::Accept(const Text& /*text*/)
-{
-}
+{}
void IgnoringParser::Accept(const XmlAttribute& /*attribute*/)
-{
-}
+{}
void IgnoringParser::Verify()
-{
-}
+{}
{
static ElementParserPtr Create();
virtual ActionFunc GetElementParser(const DPL::String& ns,
- const DPL::String& name);
+ const DPL::String& name);
virtual void Accept(const Element&);
virtual void Accept(const Text&);
virtual void Accept(const XmlAttribute&);
namespace LibIri {
Wrapper::Wrapper(const char* aIri) : m_Iri(iri_parse(aIri))
-{
-}
+{}
Wrapper::~Wrapper()
{
iri_destroy(m_Iri);
}
std::ostream & operator<<(std::ostream& a_stream,
- const Wrapper& a_wrapper)
+ const Wrapper& a_wrapper)
{
iri_t& iri = *a_wrapper.m_Iri;
-#define PRINT_FIELD(field) "] " # field " [" << (iri.field ? iri.field : "null")
+#define PRINT_FIELD(field) "] " #field " [" << (iri.field ? iri.field : "null")
a_stream <<
" display [" << (iri.display ? iri.display : "null") <<
PRINT_FIELD(scheme) <<
};
std::ostream & operator<<(std::ostream& a_stream,
- const Wrapper& a_wrapper);
+ const Wrapper& a_wrapper);
} //namespace LibIri
#endif // _WRT_ENGINE_SRC_INSTALLERCORE_CONFIGURATION_PARSER_LIBIRIWRAPPER_H_
{
public:
void Parse(const std::string& filename,
- const ElementParserPtr& root)
+ const ElementParserPtr& root)
{
DPL::FileInput input(filename);
Parse(&input, root);
}
void Parse (DPL::AbstractInput *input,
- const ElementParserPtr& root)
+ const ElementParserPtr& root)
{
Try
{
Impl() :
m_reader(NULL),
m_parsingError(false)
- {
- }
+ {}
~Impl()
{
private:
static void xmlTextReaderErrorHandler(void* arg,
- const char* msg,
- xmlParserSeverities /* severity */,
- xmlTextReaderLocatorPtr /* locator */)
+ const char* msg,
+ xmlParserSeverities /* severity */,
+ xmlTextReaderLocatorPtr /* locator */)
{
ParserRunner::Impl* impl = static_cast<ParserRunner::Impl*>(arg);
impl->ErrorHandler(DPL::FromASCIIString(msg));
}
static void xmlTextReaderStructuredErrorHandler(void* arg,
- xmlErrorPtr error)
+ xmlErrorPtr error)
{
ParserRunner::Impl* impl = static_cast<ParserRunner::Impl*>(arg);
impl->StructuredErrorHandler(error);
}
static int XMLCALL IoRead(void *context,
- char *buffer,
- int len)
+ char *buffer,
+ int len)
{
DPL::AbstractInput *input = static_cast<DPL::AbstractInput *>(context);
DPL::BinaryQueueAutoPtr data = input->Read(static_cast<size_t>(len));
ParserRunner::ParserRunner() :
m_impl(new ParserRunner::Impl())
-{
-}
+{}
void ParserRunner::Parse(const std::string& filename,
- ElementParserPtr root)
+ ElementParserPtr root)
{
m_impl->Parse(filename, root);
}
void ParserRunner::Parse(DPL::AbstractInput *input,
- ElementParserPtr root)
+ ElementParserPtr root)
{
m_impl->Parse(input, root);
}
{
public:
void Parse(const std::string& filename,
- ElementParserPtr root);
+ ElementParserPtr root);
void Parse(DPL::AbstractInput *input,
- ElementParserPtr root);
+ ElementParserPtr root);
ParserRunner();
~ParserRunner();
public:
typedef typename ta_Parser::Data Data;
virtual ActionFunc GetElementParser(const DPL::String& /*ns*/,
- const DPL::String& name)
+ const DPL::String& name)
{
if (name == m_tag) {
return DPL::MakeDelegate(this,
}
RootParser(Data data,
- const DPL::String& tag) :
+ const DPL::String& tag) :
m_data(data),
m_tag(tag)
- {
- }
+ {}
virtual ~RootParser()
- {
- }
+ {}
virtual void Accept(const Element& /*element*/)
{
* See the License for the specific language governing permissions and
* limitations under the License.
*/
- /**
+/**
* This file have been implemented in compliance with W3C WARP SPEC.
* but there are some patent issue between W3C WARP SPEC and APPLE.
* so if you want to use this file, refer to the README file in root directory
}
void UpdateTextWithDirectionMark(Direction direction,
- DPL::String* text)
+ DPL::String* text)
{
Assert(text);
switch (direction) {
{
public:
virtual ActionFunc GetElementParser(const DPL::String& /*ns*/,
- const DPL::String& /*name*/)
+ const DPL::String& /*name*/)
{
return DPL::MakeDelegate(this, &InnerElementsParser::Other);
}
virtual void Accept(const Element& /*element*/)
- {
- }
+ {}
virtual void Accept(const Text& text)
{
InnerElementsParser(ElementParserPtr parent) :
m_parentParser(parent),
m_textDirection(Unicode::EMPTY)
- {
- }
+ {}
ElementParserPtr Other()
{
{
public:
virtual ActionFunc GetElementParser(const DPL::String& /*ns*/,
- const DPL::String& /*name*/)
+ const DPL::String& /*name*/)
{
return DPL::MakeDelegate(this, &NameParser::Other);
}
}
NameParser(Unicode::Direction direction,
- ConfigParserData& data) :
+ ConfigParserData& data) :
m_data(data),
m_textDirection(direction)
- {
- }
+ {}
ElementParserPtr Other()
{
};
virtual ActionFunc GetElementParser(const DPL::String& /*ns*/,
- const DPL::String& /*name*/)
+ const DPL::String& /*name*/)
{
return DPL::MakeDelegate(this, &AccessParser::Other);
}
}
virtual void Accept(const Text& /*text*/)
- {
- }
+ {}
void AcceptWac(const XmlAttribute& attribute)
{
m_standardType(STANDARD_TYPE_NONE),
m_network(false),
m_data(data)
- {
- }
+ {}
ElementParserPtr Other()
{
{
public:
virtual ActionFunc GetElementParser(const DPL::String& /*ns*/,
- const DPL::String& /*name*/)
+ const DPL::String& /*name*/)
{
return DPL::MakeDelegate(this, &DescriptionParser::Other);
}
}
DescriptionParser(Unicode::Direction direction,
- ConfigParserData& data) :
+ ConfigParserData& data) :
m_data(data),
m_lang(),
m_description(),
m_textDirection(direction)
- {
- }
+ {}
private:
ConfigParserData& m_data;
{
public:
virtual ActionFunc GetElementParser(const DPL::String& /*ns*/,
- const DPL::String& /*name*/)
+ const DPL::String& /*name*/)
{
return DPL::MakeDelegate(this, &AuthorParser::Other);
}
AuthorParser(Unicode::Direction direction,
- ConfigParserData& data) :
+ ConfigParserData& data) :
m_data(data),
m_textDirection(direction)
- {
- }
+ {}
virtual void Accept(const Element& /*element*/)
{
{
public:
virtual ActionFunc GetElementParser(const DPL::String& /*ns*/,
- const DPL::String& /*name*/)
+ const DPL::String& /*name*/)
{
return DPL::MakeDelegate(this, &LicenseParser::Other);
}
LicenseParser(Unicode::Direction direction,
- ConfigParserData& data) :
+ ConfigParserData& data) :
m_data(data),
m_ignore(true),
m_textDirection(direction)
- {
- }
+ {}
virtual void Accept(const Element& element)
{
public:
virtual ActionFunc GetElementParser(const DPL::String& /*ns*/,
- const DPL::String& /*name*/)
+ const DPL::String& /*name*/)
{
return &IgnoringParser::Create;
}
IconParser(ConfigParserData& data) : ElementParser(),
m_data(data)
- {
- }
+ {}
virtual void Accept(const Element& /*element*/)
- {
- }
+ {}
virtual void Accept(const XmlAttribute& attribute)
{
strtol(DPL::ToUTF8String(value).c_str(), &reterr, 10);
if (errno != 0 ||
std::string(reterr) == DPL::ToUTF8String(value) ||
- valueInt <= 0) {
+ valueInt <= 0)
+ {
return DPL::OptionalInt::Null;
} else {
return valueInt;
}
/**
- * @brief delocalizePath removes locales folder from relative path if neccessary
+ * @brief delocalizePath removes locales folder from relative path if
+ * neccessary
* @param source source string
*
* @throw BadSrcError if string is bad value of src attribute
DPL::String result = source;
- if(source.substr(0,index) == localeFolder)
- {
- size_t pos = result.find_first_of('/',index);
- if(pos != std::string::npos && pos + 1 < source.size())
- {
- result = result.substr(pos + 1,source.size());
- }
- else
- {
+ if (source.substr(0, index) == localeFolder) {
+ size_t pos = result.find_first_of('/', index);
+ if (pos != std::string::npos && pos + 1 < source.size()) {
+ result = result.substr(pos + 1, source.size());
+ } else {
Throw(BadSrcError);
}
}
{
public:
virtual ActionFunc GetElementParser(const DPL::String& /*ns*/,
- const DPL::String& /*name*/)
+ const DPL::String& /*name*/)
{
return &IgnoringParser::Create;
}
ContentParser(ConfigParserData& data) :
ElementParser(),
m_data(data)
- {
- }
+ {}
virtual void Accept(const Element& /*element*/)
- {
- }
+ {}
virtual void Accept(const Text& /*text*/)
- {
- }
+ {}
virtual void Accept(const XmlAttribute& attribute)
{
struct ParamParser : public ElementParser
{
virtual ActionFunc GetElementParser(const DPL::String& /*ns*/,
- const DPL::String& /*name*/)
+ const DPL::String& /*name*/)
{
return &IgnoringParser::Create;
}
}
virtual void Accept(const Element& /*element*/)
- {
- }
+ {}
virtual void Accept(const Text& /*text*/)
{
ParamParser(ConfigParserData::Feature& data) :
ElementParser(),
m_data(data)
- {
- }
+ {}
private:
DPL::OptionalString m_name;
};
virtual ActionFunc GetElementParser(const DPL::String& /*ns*/,
- const DPL::String& name)
+ const DPL::String& name)
{
if (name == L"param") {
return DPL::MakeDelegate(this, &FeatureParser::OnParamElement);
}
virtual void Accept(const Text& /*text*/)
- {
- }
+ {}
virtual void Accept(const Element& /*element*/)
- {
- }
+ {}
virtual void Accept(const XmlAttribute& attribute)
{
if (m_feature.name != L"") {
if (iri.Validate()) {
if (m_data.featuresList.find(m_feature) ==
- m_data.featuresList.end()) {
+ m_data.featuresList.end())
+ {
m_data.featuresList.insert(m_feature);
} else {
LogDebug("Ignoring feature with name" <<
ElementParser(),
m_data(data),
m_feature(L"")
- {
- }
+ {}
private:
ConfigParserData& m_data;
{
public:
virtual ActionFunc GetElementParser(const DPL::String& /*ns*/,
- const DPL::String& /*name*/)
+ const DPL::String& /*name*/)
{
return &IgnoringParser::Create;
}
}
virtual void Accept(const Element& /*element*/)
- {
- }
+ {}
virtual void Accept(const Text& /*text*/)
{
ConfigParserData::Preference preference(*m_name, m_required);
preference.value = m_value;
if (m_data.preferencesList.find(preference) ==
- m_data.preferencesList.end()) {
+ m_data.preferencesList.end())
+ {
m_data.preferencesList.insert(preference);
}
}
ElementParser(),
m_required(false),
m_data(data)
- {
- }
+ {}
private:
DPL::OptionalString m_name;
{
public:
virtual ActionFunc GetElementParser(const DPL::String& /*ns*/,
- const DPL::String& /*name*/)
+ const DPL::String& /*name*/)
{
return &DenyAllParser::Create;
}
ThrowMsg(Exception::ParseError,
"rel attribute must have describedby value");
}
- } else if (attribute.name == L"type") {
- } else if (attribute.name == L"href") {
+ } else if (attribute.name == L"type") {} else if (attribute.name ==
+ L"href")
+ {
LogDebug("here is href");
m_href = attribute.value;
} else {
m_properNamespace(false),
m_data(data),
m_href(DPL::OptionalString::Null)
- {
- }
+ {}
private:
bool m_properNamespace;
{
public:
virtual ActionFunc GetElementParser(const DPL::String& /*ns*/,
- const DPL::String& /*name*/)
+ const DPL::String& /*name*/)
{
return &IgnoringParser::Create;
}
virtual void Accept(const Text& /*text*/)
- {
- }
+ {}
virtual void Accept(const Element& /*element*/)
- {
- }
+ {}
virtual void Accept(const XmlAttribute& attribute)
{
}
virtual void Verify()
- {
- }
+ {}
SettingParser(ConfigParserData& data) :
ElementParser(),
m_data(data),
m_setting(L"", L"")
- {
- }
+ {}
private:
ConfigParserData& m_data;
LogWarning("namespace for app service = " << element.ns);
if (element.ns == ConfigurationNamespace::W3CWidgetNamespaceName) {
ThrowMsg(Exception::ParseError,
- "Wrong xml namespace for widget element");
+ "Wrong xml namespace for widget 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_src.IsNull() ? nullString : *m_src,
+ m_operation.IsNull() ? nullString : *m_operation,
+ m_scheme.IsNull() ? nullString : *m_scheme,
+ m_mime.IsNull() ? nullString : *m_mime);
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)) &&
+ // 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)))
+ // 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));
+ "service operation is duplicated " +
+ DPL::ToUTF8String(*m_operation));
}
}
m_data.appServiceList.push_back(serviceInfo);
m_scheme(DPL::OptionalString::Null),
m_mime(DPL::OptionalString::Null),
m_data(data)
- {
- }
+ {}
private:
DPL::OptionalString m_src;
class AppControlParser : public ElementParser
{
public:
- struct SourceParser : public ElementParser
- {
- public:
- virtual ActionFunc GetElementParser(const DPL::String& /*ns*/,
- const DPL::String& /*name*/)
- {
- 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") {
- if (attribute.value.size() > 0) {
- m_value = attribute.value;
- NormalizeString(m_value);
- }
- }
- }
-
- virtual void Verify()
- {
- if (m_value.IsNull() || *m_value== L"") {
- return;
- }
-
- m_data.m_src = *m_value;
- }
-
- SourceParser(ConfigParserData::AppControlInfo& data) :
- ElementParser(),
- m_properNamespace(false),
- m_data(data)
- {
- }
-
- private:
- bool m_properNamespace;
- DPL::OptionalString m_value;
- ConfigParserData::AppControlInfo& m_data;
- };
-
- struct OperationParser : public ElementParser
- {
- public:
- virtual ActionFunc GetElementParser(const DPL::String& /*ns*/,
- const DPL::String& /*name*/)
- {
- 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") {
- if (attribute.value.size() > 0) {
- m_value = attribute.value;
- NormalizeString(m_value);
- }
- }
- }
-
- virtual void Verify()
- {
- if (m_value.IsNull() || *m_value== L"") {
- return;
- }
-
- m_data.m_operation = *m_value;
- }
-
- OperationParser(ConfigParserData::AppControlInfo& data) :
- ElementParser(),
- m_properNamespace(false),
- m_data(data)
- {
- }
-
- private:
- bool m_properNamespace;
- DPL::OptionalString m_value;
- ConfigParserData::AppControlInfo& m_data;
- };
-
- struct UriParser : public ElementParser
- {
- public:
- virtual ActionFunc GetElementParser(const DPL::String& /*ns*/,
- const DPL::String& /*name*/)
- {
- 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") {
- if (attribute.value.size() > 0) {
- m_value = attribute.value;
- NormalizeString(m_value);
- }
- }
- }
-
- virtual void Verify()
- {
- if (m_value.IsNull() || *m_value == L"") {
- return;
- }
-
- DPL::String wildString(L"*/*");
- if ((m_data.m_uriList.find(wildString) ==
- m_data.m_uriList.end())
- && (m_data.m_uriList.find(*m_value) ==
- m_data.m_uriList.end())) {
-
- m_data.m_uriList.insert(*m_value);
- } else {
- LogDebug("Ignoring uri with name" <<
- DPL::ToUTF8String(*m_value));
- }
- }
-
- UriParser(ConfigParserData::AppControlInfo& data) :
- ElementParser(),
- m_properNamespace(false),
- m_data(data)
- {
- }
-
- private:
- bool m_properNamespace;
- DPL::OptionalString m_value;
- ConfigParserData::AppControlInfo& m_data;
- };
-
- struct MimeParser : public ElementParser
- {
- public:
- virtual ActionFunc GetElementParser(const DPL::String& /*ns*/,
- const DPL::String& /*name*/)
- {
- 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") {
- if (attribute.value.size() > 0) {
- m_value = attribute.value;
- NormalizeString(m_value);
- }
- }
- }
-
- virtual void Verify()
- {
- if (m_value.IsNull() || *m_value == L"") {
- return;
- }
-
- DPL::String wildString(L"*/*");
- if ((m_data.m_mimeList.find(wildString) ==
- m_data.m_mimeList.end())
- && (m_data.m_mimeList.find(*m_value) ==
- m_data.m_mimeList.end())) {
- m_data.m_mimeList.insert(*m_value);
- } else {
- LogDebug("Ignoring mime with name" <<
- DPL::ToUTF8String(*m_value));
- }
- }
-
- MimeParser(ConfigParserData::AppControlInfo& data) :
- ElementParser(),
- m_properNamespace(false),
- m_data(data)
- {
- }
-
- private:
- bool m_properNamespace;
- DPL::OptionalString m_value;
- ConfigParserData::AppControlInfo& m_data;
- };
+ struct SourceParser : public ElementParser
+ {
+ public:
+ virtual ActionFunc GetElementParser(const DPL::String& /*ns*/,
+ const DPL::String& /*name*/)
+ {
+ 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") {
+ if (attribute.value.size() > 0) {
+ m_value = attribute.value;
+ NormalizeString(m_value);
+ }
+ }
+ }
+
+ virtual void Verify()
+ {
+ if (m_value.IsNull() || *m_value == L"") {
+ return;
+ }
+
+ m_data.m_src = *m_value;
+ }
+
+ SourceParser(ConfigParserData::AppControlInfo& data) :
+ ElementParser(),
+ m_properNamespace(false),
+ m_data(data)
+ {}
+
+ private:
+ bool m_properNamespace;
+ DPL::OptionalString m_value;
+ ConfigParserData::AppControlInfo& m_data;
+ };
+
+ struct OperationParser : public ElementParser
+ {
+ public:
+ virtual ActionFunc GetElementParser(const DPL::String& /*ns*/,
+ const DPL::String& /*name*/)
+ {
+ 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") {
+ if (attribute.value.size() > 0) {
+ m_value = attribute.value;
+ NormalizeString(m_value);
+ }
+ }
+ }
+
+ virtual void Verify()
+ {
+ if (m_value.IsNull() || *m_value == L"") {
+ return;
+ }
+
+ m_data.m_operation = *m_value;
+ }
+
+ OperationParser(ConfigParserData::AppControlInfo& data) :
+ ElementParser(),
+ m_properNamespace(false),
+ m_data(data)
+ {}
+
+ private:
+ bool m_properNamespace;
+ DPL::OptionalString m_value;
+ ConfigParserData::AppControlInfo& m_data;
+ };
+
+ struct UriParser : public ElementParser
+ {
+ public:
+ virtual ActionFunc GetElementParser(const DPL::String& /*ns*/,
+ const DPL::String& /*name*/)
+ {
+ 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") {
+ if (attribute.value.size() > 0) {
+ m_value = attribute.value;
+ NormalizeString(m_value);
+ }
+ }
+ }
+
+ virtual void Verify()
+ {
+ if (m_value.IsNull() || *m_value == L"") {
+ return;
+ }
+
+ DPL::String wildString(L"*/*");
+ if ((m_data.m_uriList.find(wildString) ==
+ m_data.m_uriList.end())
+ && (m_data.m_uriList.find(*m_value) ==
+ m_data.m_uriList.end()))
+ {
+ m_data.m_uriList.insert(*m_value);
+ } else {
+ LogDebug("Ignoring uri with name" <<
+ DPL::ToUTF8String(*m_value));
+ }
+ }
+
+ UriParser(ConfigParserData::AppControlInfo& data) :
+ ElementParser(),
+ m_properNamespace(false),
+ m_data(data)
+ {}
+
+ private:
+ bool m_properNamespace;
+ DPL::OptionalString m_value;
+ ConfigParserData::AppControlInfo& m_data;
+ };
+
+ struct MimeParser : public ElementParser
+ {
+ public:
+ virtual ActionFunc GetElementParser(const DPL::String& /*ns*/,
+ const DPL::String& /*name*/)
+ {
+ 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") {
+ if (attribute.value.size() > 0) {
+ m_value = attribute.value;
+ NormalizeString(m_value);
+ }
+ }
+ }
+
+ virtual void Verify()
+ {
+ if (m_value.IsNull() || *m_value == L"") {
+ return;
+ }
+
+ DPL::String wildString(L"*/*");
+ if ((m_data.m_mimeList.find(wildString) ==
+ m_data.m_mimeList.end())
+ && (m_data.m_mimeList.find(*m_value) ==
+ m_data.m_mimeList.end()))
+ {
+ m_data.m_mimeList.insert(*m_value);
+ } else {
+ LogDebug("Ignoring mime with name" <<
+ DPL::ToUTF8String(*m_value));
+ }
+ }
+
+ MimeParser(ConfigParserData::AppControlInfo& data) :
+ ElementParser(),
+ m_properNamespace(false),
+ m_data(data)
+ {}
+
+ private:
+ bool m_properNamespace;
+ DPL::OptionalString m_value;
+ ConfigParserData::AppControlInfo& m_data;
+ };
virtual ActionFunc GetElementParser(const DPL::String& /*ns*/,
- const DPL::String& name)
+ const DPL::String& name)
{
if (name == L"src") {
return DPL::MakeDelegate(this, &AppControlParser::OnSourceElement);
} else if (name == L"operation") {
- return DPL::MakeDelegate(this, &AppControlParser::OnOperationElement);
+ return DPL::MakeDelegate(this,
+ &AppControlParser::OnOperationElement);
} else if (name == L"uri") {
return DPL::MakeDelegate(this, &AppControlParser::OnUriElement);
- } else if (name == L"mime") {
+ } else if (name == L"mime") {
return DPL::MakeDelegate(this, &AppControlParser::OnMimeElement);
} else {
return &IgnoringParser::Create;
}
virtual void Accept(const XmlAttribute& attribute)
- {
- }
+ {}
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");
+ "Wrong xml namespace for widget element");
}
}
virtual void Verify()
{
- if (m_appControl.m_src == L""){
+ if (m_appControl.m_src == L"") {
LogWarning("service element must have src element");
return;
}
- if (m_appControl.m_operation == L""){
+ if (m_appControl.m_operation == L"") {
LogWarning("service element must have operation element");
return;
}
FOREACH(iterator, m_data.appControlList) {
if (iterator->m_src == m_appControl.m_src &&
- iterator->m_operation == m_appControl.m_operation )
+ iterator->m_operation == m_appControl.m_operation)
{
ThrowMsg(Exception::ParseError,
- "app control element is duplicated " +
- DPL::ToUTF8String(m_appControl.m_src) + ", " +
- DPL::ToUTF8String(m_appControl.m_operation));
+ "app control element is duplicated " +
+ DPL::ToUTF8String(m_appControl.m_src) + ", " +
+ DPL::ToUTF8String(m_appControl.m_operation));
}
}
m_data.appControlList.push_back(m_appControl);
ElementParser(),
m_data(data),
m_appControl(L"")
- {
- }
+ {}
private:
ConfigParserData& m_data;
{
public:
virtual ActionFunc GetElementParser(const DPL::String& /*ns*/,
- const DPL::String& /*name*/)
+ const DPL::String& /*name*/)
{
return &IgnoringParser::Create;
}
virtual void Verify()
{
- if(!m_id) {
+ if (!m_id) {
ThrowMsg(Exception::ParseError,
"application element must have id attribute");
}
- if(!!m_package) {
+ if (!!m_package) {
m_data.tizenPkgId = m_package;
}
- if(!m_version) {
+ if (!m_version) {
ThrowMsg(Exception::ParseError,
"application element must have required_version attribute");
}
m_id(DPL::OptionalString::Null),
m_version(DPL::OptionalString::Null),
m_properNamespace(false)
- {
- }
+ {}
private:
ConfigParserData& m_data;
}
virtual void Accept(const Element& element)
- {
- }
+ {}
virtual void Accept(const Text& /*text*/)
- {
- }
+ {}
virtual void Verify()
{
if (m_src.IsNull()) {
- LogWarning("src attribute of splash element is mandatory - ignoring");
+ LogWarning(
+ "src attribute of splash element is mandatory - ignoring");
return;
}
SplashParser(ConfigParserData& data) :
ElementParser(),
m_data(data)
- {
- }
+ {}
private:
DPL::OptionalString m_src;
}
virtual void Accept(const Element& /*element*/)
- {
- }
+ {}
virtual void Accept(const Text& /*text*/)
- {
- }
+ {}
virtual void Verify()
{
if (m_src.IsNull()) {
- LogWarning("src attribute of background element is mandatory - ignoring");
+ LogWarning(
+ "src attribute of background element is mandatory - ignoring");
return;
}
explicit BackgroundParser(ConfigParserData& data) :
m_data(data)
- {
- }
+ {}
private:
DPL::OptionalString m_src;
{
public:
virtual ActionFunc GetElementParser(const DPL::String& /*ns*/,
- const DPL::String& name)
+ const DPL::String& name)
{
return &IgnoringParser::Create;
}
virtual void Accept(const Text& /*text*/)
- {
- }
+ {}
virtual void Accept(const Element& element)
{
if (m_feature.name != L"") {
if (iri.Validate()) {
if (m_data.featuresList.find(m_feature) ==
- m_data.featuresList.end()) {
+ m_data.featuresList.end())
+ {
m_data.featuresList.insert(m_feature);
} else {
LogDebug("Ignoring feature with name" <<
if (m_privilege.name != L"") {
if (iriPrivilege.Validate()) {
if (m_data.privilegeList.find(m_privilege) ==
- m_data.privilegeList.end()) {
+ m_data.privilegeList.end())
+ {
m_data.privilegeList.insert(m_privilege);
} else {
LogDebug("Ignoring privilege with name" <<
m_feature(L""),
m_privilege(L""),
m_properNamespace(false)
- {
- }
+ {}
private:
ConfigParserData& m_data;
}
virtual void Accept(const Element& /*element*/)
- {
- }
+ {}
virtual void Accept(const Text& /*text*/)
- {
- }
+ {}
virtual void Verify()
{
if (m_name.IsNull()) {
- LogWarning("name attribute of category element is mandatory - ignoring");
+ LogWarning(
+ "name attribute of category element is mandatory - ignoring");
return;
}
if (m_data.categoryList.find(*m_name) ==
- m_data.categoryList.end()) {
+ m_data.categoryList.end())
+ {
m_data.categoryList.insert(*m_name);
}
}
explicit CategoryParser(ConfigParserData& data) :
m_data(data)
- {
- }
+ {}
private:
DPL::OptionalString m_name;
class LiveboxParser : public ElementParser
{
- public:
+ public:
struct BoxLabelParser : public ElementParser
{
virtual ActionFunc GetElementParser(const DPL::String& /*ns*/,
- const DPL::String& /*name*/)
+ const DPL::String& /*name*/)
{
return &IgnoringParser::Create;
}
virtual void Accept(const XmlAttribute& attribute)
- {
- }
+ {}
virtual void Accept(const Element& element)
{
if (element.ns ==
- ConfigurationNamespace::TizenWebAppNamespaceName)
+ ConfigurationNamespace::TizenWebAppNamespaceName)
{
m_properNamespace = true;
}
virtual void Accept(const Text& text)
{
- if(m_properNamespace)
+ if (m_properNamespace) {
m_label = text.value;
+ }
}
virtual void Verify()
ElementParser(),
m_properNamespace(false),
m_data(data)
- {
- }
+ {}
- private:
+ private:
DPL::String m_label;
bool m_properNamespace;
ConfigParserData::LiveboxInfo& m_data;
struct BoxIconParser : public ElementParser
{
virtual ActionFunc GetElementParser(const DPL::String& /*ns*/,
- const DPL::String& /*name*/)
+ const DPL::String& /*name*/)
{
return &IgnoringParser::Create;
}
virtual void Accept(const XmlAttribute& attribute)
{
- if(m_properNamespace) {
+ if (m_properNamespace) {
if (attribute.name == L"src") {
m_icon = attribute.value;
}
virtual void Accept(const Element& element)
{
if (element.ns ==
- ConfigurationNamespace::TizenWebAppNamespaceName)
+ ConfigurationNamespace::TizenWebAppNamespaceName)
{
m_properNamespace = true;
}
}
virtual void Accept(const Text& /*text*/)
- {
- }
+ {}
virtual void Verify()
{
ElementParser(),
m_properNamespace(false),
m_data(data)
- {
- }
+ {}
- private:
+ private:
DPL::String m_icon;
bool m_properNamespace;
ConfigParserData::LiveboxInfo& m_data;
struct BoxSizeParser : public ElementParser
{
virtual ActionFunc GetElementParser(const DPL::String& /*ns*/,
- const DPL::String& /*name*/)
+ const DPL::String& /*name*/)
{
return &IgnoringParser::Create;
}
virtual void Accept(const XmlAttribute& attribute)
{
- if(m_properNamespace) {
+ if (m_properNamespace) {
if (attribute.name == L"preview") {
m_preview = attribute.value;
}
virtual void Accept(const Element& element)
{
if (element.ns ==
- ConfigurationNamespace::TizenWebAppNamespaceName)
+ ConfigurationNamespace::TizenWebAppNamespaceName)
{
m_properNamespace = true;
}
virtual void Accept(const Text& text)
{
- if(m_properNamespace)
+ if (m_properNamespace) {
m_size = text.value;
+ }
}
virtual void Verify()
m_data.m_boxSize.push_back(boxSize);
}
- explicit BoxSizeParser(ConfigParserData::LiveboxInfo::BoxContentInfo& data) :
+ explicit BoxSizeParser(
+ ConfigParserData::LiveboxInfo::BoxContentInfo& data) :
ElementParser(),
m_data(data)
- {
- }
+ {}
- private:
+ private:
DPL::String m_size;
DPL::String m_preview;
bool m_properNamespace;
struct PdParser : public ElementParser
{
virtual ActionFunc GetElementParser(const DPL::String& /*ns*/,
- const DPL::String& name)
+ const DPL::String& name)
{
return &IgnoringParser::Create;
}
virtual void Accept(const XmlAttribute& attribute)
{
- if(m_properNamespace) {
+ if (m_properNamespace) {
if (attribute.name == L"src") {
m_src = attribute.value;
} else if (attribute.name == L"width") {
virtual void Accept(const Element& element)
{
if (element.ns ==
- ConfigurationNamespace::TizenWebAppNamespaceName)
+ ConfigurationNamespace::TizenWebAppNamespaceName)
{
m_properNamespace = true;
}
}
virtual void Accept(const Text& /*text*/)
- {
- }
+ {}
virtual void Verify()
{
m_data.m_pdHeight = m_height;
}
- explicit PdParser(ConfigParserData::LiveboxInfo::BoxContentInfo& data) :
+ explicit PdParser(
+ ConfigParserData::LiveboxInfo::BoxContentInfo& data) :
ElementParser(),
m_properNamespace(false),
m_data(data)
- {
- }
+ {}
- private:
+ private:
DPL::String m_src;
DPL::String m_width;
DPL::String m_height;
};
virtual ActionFunc GetElementParser(const DPL::String& /*ns*/,
- const DPL::String& name)
+ const DPL::String& name)
{
if (name == L"box-size") {
- return DPL::MakeDelegate(this, &LiveboxParser::BoxContentParser::OnBoxSizeElement);
+ return DPL::MakeDelegate(
+ this,
+ &LiveboxParser::BoxContentParser::
+ OnBoxSizeElement);
} else if (name == L"pd") {
- return DPL::MakeDelegate(this, &LiveboxParser::BoxContentParser::OnPdElement);
- } else{
- ThrowMsg(Exception::ParseError, "No element parser for name: " << name);
+ return DPL::MakeDelegate(
+ this,
+ &LiveboxParser::BoxContentParser::
+ OnPdElement);
+ } else {
+ ThrowMsg(Exception::ParseError,
+ "No element parser for name: " << name);
}
}
virtual void Accept(const XmlAttribute& attribute)
{
if (m_properNamespace) {
- if (attribute.name == L"src")
+ if (attribute.name == L"src") {
m_box.m_boxSrc = attribute.value;
- if (attribute.name == L"mouse-event")
+ }
+ if (attribute.name == L"mouse-event") {
m_box.m_boxMouseEvent = attribute.value;
+ }
}
}
virtual void Accept(const Element& element)
{
if (element.ns ==
- ConfigurationNamespace::TizenWebAppNamespaceName)
+ ConfigurationNamespace::TizenWebAppNamespaceName)
{
m_properNamespace = true;
}
}
virtual void Accept(const Text& /*text*/)
- {
- }
+ {}
virtual void Verify()
{
ElementParser(),
m_properNamespace(false),
m_data(data)
- {
- }
+ {}
ElementParserPtr OnBoxSizeElement()
{
return ElementParserPtr(new PdParser(m_box));
}
- private:
+ private:
DPL::String m_src;
bool m_properNamespace;
ConfigParserData::LiveboxInfo& m_data;
};
virtual ActionFunc GetElementParser(const DPL::String& /*ns*/,
- const DPL::String& name)
+ const DPL::String& name)
{
if (name == L"box-label") {
return DPL::MakeDelegate(this, &LiveboxParser::OnBoxLabelElement);
} else if (name == L"box-icon") {
return DPL::MakeDelegate(this, &LiveboxParser::OnBoxIconElement);
- } else if (name == L"box-content") {
+ } else if (name == L"box-content") {
return DPL::MakeDelegate(this, &LiveboxParser::OnBoxContentElement);
} else {
return &IgnoringParser::Create;
virtual void Accept(const Element& element)
{
if (element.ns ==
- ConfigurationNamespace::TizenWebAppNamespaceName)
+ ConfigurationNamespace::TizenWebAppNamespaceName)
{
m_properNamespace = true;
}
}
virtual void Accept(const Text& /*text*/)
- {
- }
+ {}
virtual void Verify()
{
{
public:
virtual ActionFunc GetElementParser(const DPL::String& ns,
- const DPL::String& name)
+ const DPL::String& name)
{
return &IgnoringParser::Create;
}
ElementParser(),
m_data(data),
m_properNamespace(false)
- {
- }
+ {}
virtual void Accept(const Element& element)
{
- if (element.ns == ConfigurationNamespace::TizenWebAppNamespaceName)
- {
+ if (element.ns == ConfigurationNamespace::TizenWebAppNamespaceName) {
m_properNamespace = true;
}
}
virtual void Accept(const XmlAttribute& attribute)
- {
- }
+ {}
virtual void Accept(const Text& text)
{
- if (m_properNamespace)
+ if (m_properNamespace) {
m_policy = text.value;
+ }
}
virtual void Verify()
{
- if (!m_policy.IsNull())
+ if (!m_policy.IsNull()) {
m_data.cspPolicy = *m_policy;
+ }
}
private:
DPL::OptionalString m_policy;
};
-
-ElementParser::ActionFunc WidgetParser::GetElementParser(const DPL::String& /*ns*/,
- const DPL::String& name)
+ElementParser::ActionFunc WidgetParser::GetElementParser(
+ const DPL::String& /*ns*/,
+ const DPL::String&
+ name)
{
FuncMap::const_iterator it = m_map.find(name);
if (it != m_map.end()) {
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::OnApplicationElement);
+ m_map[L"appservice"] = DPL::MakeDelegate(this,
+ &WidgetParser::OnAppServiceElement);
+ m_map[L"application"] = DPL::MakeDelegate(
+ this,
+ &WidgetParser::
+ OnApplicationElement);
m_map[L"splash"] = DPL::MakeDelegate(this, &WidgetParser::OnSplashElement);
- m_map[L"background"] = DPL::MakeDelegate(this, &WidgetParser::OnBackgroundElement);
- m_map[L"privilege"] = DPL::MakeDelegate(this, &WidgetParser::OnPrivilegeElement);
- m_map[L"app-control"] = DPL::MakeDelegate(this,
- &WidgetParser::OnAppControlElement);
+ m_map[L"background"] = DPL::MakeDelegate(this,
+ &WidgetParser::OnBackgroundElement);
+ m_map[L"privilege"] = DPL::MakeDelegate(this,
+ &WidgetParser::OnPrivilegeElement);
+ m_map[L"app-control"] = DPL::MakeDelegate(
+ this,
+ &WidgetParser::
+ OnAppControlElement);
m_map[L"category"] = DPL::MakeDelegate(this,
- &WidgetParser::OnCategoryElement);
+ &WidgetParser::OnCategoryElement);
m_map[L"livebox"] = DPL::MakeDelegate(this, &WidgetParser::OnLiveboxElement);
#ifdef CSP_ENABLED
- m_map[L"Content-Security-Policy"] = DPL::MakeDelegate(this, &WidgetParser::OnCspElement);
+ m_map[L"Content-Security-Policy"] = DPL::MakeDelegate(
+ this,
+ &WidgetParser::
+ OnCspElement);
#endif
}
m_defaultlocale = attribute.value;
NormalizeString(m_defaultlocale);
if (!LanguageSubtagRstTreeSingleton::Instance().ValidateLanguageTag(
- DPL::ToUTF8String(*m_defaultlocale))) {
+ DPL::ToUTF8String(*m_defaultlocale)))
+ {
LogWarning("Language tag: " <<
m_defaultlocale << " is not valid");
m_defaultlocale = DPL::OptionalString::Null;
- }
- else
+ } else {
LogDebug("Default Locale Found " << m_defaultlocale);
+ }
} else {
LogWarning("Ignoring subsequent default locale");
}
- //Any other value consider as a namespace definition
+ //Any other value consider as a namespace definition
} else if (attribute.name == L"xmlns" || attribute.prefix == L"xmlns") {
LogInfo("Namespace domain: " << attribute.name);
LogInfo("Namespace value: " << attribute.value);
m_nameSpaces[attribute.name] = attribute.value;
} else {
LogError("Unknown attirbute: namespace=" << attribute.ns <<
- ", name=" << attribute.name <<
- ", value=" << attribute.value);
+ ", name=" << attribute.name <<
+ ", value=" << attribute.value);
}
}
FOREACH(mode, m_windowModes) {
if (L"windowed" == *mode || L"floating" == *mode ||
L"fullscreen" == *mode || L"maximized" == *mode ||
- L"minimized" == *mode) {
+ L"minimized" == *mode)
+ {
m_data.windowModes.insert(*mode);
}
}
* See the License for the specific language governing permissions and
* limitations under the License.
*/
- /**
+/**
* This file have been implemented in compliance with W3C WARP SPEC.
* but there are some patent issue between W3C WARP SPEC and APPLE.
* so if you want to use this file, refer to the README file in root directory
ElementParserPtr OnCspElement();
virtual ActionFunc GetElementParser(const DPL::String& ns,
- const DPL::String& name);
+ const DPL::String& name);
virtual void Accept(const Element&);
virtual void Accept(const Text&);
m_installationType(installType),
m_UndoType(false),
m_paused(false)
-{
-}
+{}
InstallationType Job::GetInstallationType() const
{
}
void Job::SendProgress()
-{
-}
+{}
void Job::SendFinishedSuccess()
-{
-}
+{}
void Job::SendFinishedFailure()
-{
-}
+{}
void Job::SaveExceptionData(const Jobs::JobExceptionBase&)
-{
-}
+{}
} //namespace Jobs
virtual void SendFinishedFailure();
virtual void SaveExceptionData(const Jobs::JobExceptionBase&);
+
private:
JobHandle m_handle;
InstallationType m_installationType;
public:
JobProgressBase() : m_progressFlag(false),
m_progresPercent(0.0)
- {
- }
+ {}
void SetProgressFlag(bool flag)
{
}
void UpdateProgress(T_InstallationStep step,
- ProgressDescription const &description)
+ ProgressDescription const &description)
{
m_progresPercent =
((static_cast<ProgressPercent>(step) + 1.0) /
public:
JobContextBase(const T_JobStruct& jobStruct) :
m_jobStruct(jobStruct)
- {
- }
+ {}
T_JobStruct getInstallerStruct() const
{
return m_jobStruct;
- } //TODO RENAME
+ } //TODO
+ // RENAME
protected:
T_JobStruct m_jobStruct;
finishedCallback(0),
progressCallback(0),
userParam(0)
- {
- }
+ {}
JobCallbacksBase(T_finishedCb finished,
- T_progressCb progress,
- void *param) :
+ T_progressCb progress,
+ void *param) :
finishedCallback(finished),
progressCallback(progress),
userParam(param)
- {
- }
+ {}
};
} //namespace Jobs
const char *function, \
int line, \
const std::string & message = std::string()) : \
- Base(path, function, line, message) \
- { \
- m_className = # Class; \
- m_param = Param; \
- } \
+ Base(path, function, line, message) \
+ { \
+ m_className = #Class; \
+ m_param = Param; \
+ } \
\
- Class(const char *path, \
- const char *function, \
- int line, \
- const Exception &reason, \
- const std::string & message = std::string()) : \
- Base(path, function, line, reason, message) \
- { \
- m_className = # Class; \
- m_param = Param; \
- } \
+ Class(const char *path, \
+ const char *function, \
+ int line, \
+ const Exception &reason, \
+ const std::string & message = std::string()) : \
+ Base(path, function, line, reason, message) \
+ { \
+ m_className = #Class; \
+ m_param = Param; \
+ } \
\
- virtual int getParam() const \
+ virtual int getParam() const \
{ \
return m_param; \
} \
const char *function, \
int line, \
const std::string & message = std::string()) : \
- Base(path, function, line, message) \
- { \
- m_className = # Class; \
- m_param = Param; \
- } \
+ Base(path, function, line, message) \
+ { \
+ m_className = #Class; \
+ m_param = Param; \
+ } \
\
- Class(const char *path, \
- const char *function, \
- int line, \
- const Exception &reason, \
- const std::string & message = std::string()) : \
- Base(path, function, line, reason, message) \
- { \
- m_className = # Class; \
- m_param = Param; \
- } \
+ Class(const char *path, \
+ const char *function, \
+ int line, \
+ const Exception &reason, \
+ const std::string & message = std::string()) : \
+ Base(path, function, line, reason, message) \
+ { \
+ m_className = #Class; \
+ m_param = Param; \
+ } \
\
- virtual int getParam() const \
+ virtual int getParam() const \
{ \
return m_param; \
} \
namespace Jobs {
namespace PluginInstall {
JobPluginInstall::JobPluginInstall(std::string const &pluginPath,
- const PluginInstallerStruct &installerStruct) :
+ const PluginInstallerStruct &installerStruct)
+ :
Job(PluginInstallation),
JobContextBase<PluginInstallerStruct>(installerStruct)
{
if (GetProgressFlag() && getInstallerStruct().progressCallback != NULL) {
LogDebug("Call Plugin install progressCallback");
getInstallerStruct().progressCallback(getInstallerStruct().userParam,
- GetProgressPercent(), GetProgressDescription());
+ GetProgressPercent(),
+ GetProgressDescription());
}
}
{
LogDebug("Call Plugin install success finishedCallback");
getInstallerStruct().finishedCallback(getInstallerStruct().userParam,
- Exceptions::Success);
+ Exceptions::Success);
} else {
LogDebug("Call Plugin install waiting finishedCallback");
getInstallerStruct().finishedCallback(getInstallerStruct().userParam,
- Exceptions::InstallationWaiting);
+ Exceptions::InstallationWaiting);
LogInfo("Installation: " << getFilePath() <<
" NOT possible");
LogDebug("Call Plugin install failure finishedCallback");
getInstallerStruct().finishedCallback(getInstallerStruct().userParam,
- m_exceptionCaught);
+ m_exceptionCaught);
}
void JobPluginInstall::SaveExceptionData(const Jobs::JobExceptionBase &e)
* @brief Automaticaly sets installation process
*/
JobPluginInstall(std::string const &pluginPath,
- const PluginInstallerStruct &installerStruct);
+ const PluginInstallerStruct &installerStruct);
WrtDB::DbPluginHandle getNewPluginHandle() const
{
void SendFinishedSuccess();
void SendFinishedFailure();
void SaveExceptionData(const Jobs::JobExceptionBase &e);
+
private:
//TODO move somewhere this attribute
//(as it is in all Jobs...)
PluginInstallerContext::step, desc);
#define DISABLE_IF_PLUGIN_WITHOUT_LIB() \
- if(m_pluginInfo.m_libraryName.empty()) \
+ if (m_pluginInfo.m_libraryName.empty()) \
{ \
LogWarning("Plugin without library."); \
return; \
namespace Jobs {
namespace PluginInstall {
-
PluginInstallTask::PluginInstallTask(PluginInstallerContext *inCont) :
DPL::TaskDecl<PluginInstallTask>(this),
m_context(inCont),
}
PluginInstallTask::~PluginInstallTask()
-{
-}
+{}
void PluginInstallTask::stepCheckPluginPath()
{
FOREACH(it, m_pluginInfo.m_featureContainer)
{
LogDebug("Parsed feature : " << it->m_name);
- FOREACH (devCap, it->m_deviceCapabilities) {
+ FOREACH(devCap, it->m_deviceCapabilities) {
LogDebug(" | DevCap : " << *devCap);
}
}
void PluginInstallTask::stepFindPluginLibrary()
{
- if (m_dataFromConfigXML)
- {
+ if (m_dataFromConfigXML) {
return;
}
LogDebug("Plugin installation: step find plugin library");
std::string pluginPath = m_context->pluginFilePath;
size_t indexpos = pluginPath.find_last_of('/');
- if (std::string::npos == indexpos)
- {
+ if (std::string::npos == indexpos) {
indexpos = 0;
- }
- else
- {
+ } else {
indexpos += 1; // move after '/'
}
std::string libName = pluginPath.substr(indexpos);
- libName = GlobalConfig::GetPluginPrefix() + libName + GlobalConfig::GetPluginSuffix();
+ libName = GlobalConfig::GetPluginPrefix() + libName +
+ GlobalConfig::GetPluginSuffix();
LogDebug("Plugin .so: " << libName);
m_pluginInfo.m_libraryName = libName;
}
LogDebug("Loading plugin: " << filename);
void *dlHandle = dlopen(filename.c_str(), RTLD_NOW);
- if (dlHandle == NULL ) {
+ if (dlHandle == NULL) {
LogError(
- "Failed to load plugin: " << filename <<
- ". Reason: " << dlerror());
+ "Failed to load plugin: " << filename <<
+ ". Reason: " << dlerror());
ThrowMsg(Exceptions::PluginLibraryError, "Library error");
}
getWidgetEntityMapProcPtr =
reinterpret_cast<get_widget_entity_map_proc *>(dlsym(dlHandle,
- PLUGIN_GET_CLASS_MAP_PROC_NAME));
+ PLUGIN_GET_CLASS_MAP_PROC_NAME));
if (getWidgetEntityMapProcPtr) {
rawEntityList = (*getWidgetEntityMapProcPtr)();
} else {
rawEntityList =
static_cast<const js_entity_definition_t *>(dlsym(dlHandle,
- PLUGIN_CLASS_MAP_NAME));
+ PLUGIN_CLASS_MAP_NAME));
}
if (rawEntityList == NULL) {
ThrowMsg(Exceptions::PluginLibraryError, "Library error");
}
- if (!m_dataFromConfigXML)
- {
+ if (!m_dataFromConfigXML) {
on_widget_init_proc *onWidgetInitProc =
reinterpret_cast<on_widget_init_proc *>(
dlsym(dlHandle, PLUGIN_WIDGET_INIT_PROC_NAME));
- if (NULL == onWidgetInitProc)
- {
+ if (NULL == onWidgetInitProc) {
dlclose(dlHandle);
LogError("Failed to read onWidgetInit symbol" << filename);
ThrowMsg(Exceptions::PluginLibraryError, "Library error");
LogDebug("Getting mapping from features to device capabilities");
- for (size_t i = 0; i < devcapMapping->featuresCount; ++i)
- {
+ for (size_t i = 0; i < devcapMapping->featuresCount; ++i) {
PluginMetafileData::Feature feature;
feature.m_name = devcapMapping->features[i].feature_name;
LogDebug("Feature: " << feature.m_name);
const devcaps_t* dc =
- mappingInterface.dcGetter(devcapMapping,
- devcapMapping->features[i].feature_name);
+ mappingInterface.dcGetter(
+ devcapMapping,
+ devcapMapping->features[i].
+ feature_name);
LogDebug("device=cap: " << dc);
- if (dc)
- {
+ if (dc) {
LogDebug("devcaps count: " << dc->devCapsCount);
- for (size_t j = 0; j < dc->devCapsCount; ++j)
- {
+ for (size_t j = 0; j < dc->devCapsCount; ++j) {
LogDebug("devcap: " << dc->deviceCaps[j]);
feature.m_deviceCapabilities.insert(dc->deviceCaps[j]);
}
LogInfo("#####");
while (rawEntityListIterator->parent_name != NULL &&
- rawEntityListIterator->object_name != NULL)
+ rawEntityListIterator->object_name != NULL)
{
LogInfo("##### [" << rawEntityListIterator->object_name << "]: ");
LogInfo("##### Parent: " << rawEntityListIterator->parent_name);
LogInfo("#####");
m_libraryObjects->addObjects(rawEntityListIterator->parent_name,
- rawEntityListIterator->object_name);
+ rawEntityListIterator->object_name);
++rawEntityListIterator;
}
LogInfo("Plugin installation: step resolve dependencies ");
//DISABLE_IF_PLUGIN_WITHOUT_LIB
- if(m_pluginInfo.m_libraryName.empty())
- {
- PluginDAO::setPluginInstallationStatus(m_pluginHandle,
- PluginDAO::INSTALLATION_COMPLETED);
+ if (m_pluginInfo.m_libraryName.empty()) {
+ PluginDAO::setPluginInstallationStatus(
+ m_pluginHandle,
+ PluginDAO::
+ INSTALLATION_COMPLETED);
//Installation completed
m_context->pluginHandle = m_pluginHandle;
m_context->installationCompleted = true;
} //namespace
} //namespace
-#endif /* WRT_SRC_INSTALLER_CORE_PLUGIN_INSTALLER_TASKS_PLUGIN_INSTALLER_ERRORS_H_ */
+#endif
+//WRT_SRC_INSTALLER_CORE_PLUGIN_INSTALLER_TASKS_PLUGIN_INSTALLER_ERRORS_H_
}
void PluginMetafileReader::blankFunction(PluginMetafileData & /* data */)
-{
-}
+{}
void PluginMetafileReader::tokenEndLibraryName(PluginMetafileData &data)
{
}
if (!objectName.compare(0, GLOBAL_OBJECT_NAME.size(),
- GLOBAL_OBJECT_NAME)) {
+ GLOBAL_OBJECT_NAME))
+ {
return objectName;
}
}
std::string normalizeName(const std::string& objectName,
- const std::string& parentName)
+ const std::string& parentName)
{
if (objectName.empty() || parentName.empty()) {
LogError("Normalize name, name size or parent name size is 0");
}
void PluginObjects::addObjects(const std::string& parentName,
- const std::string& name)
+ const std::string& name)
{
addImplementedObject(normalizeName(name, parentName));
addDependentObject(normalizeName(parentName));
//add object declaration
void addObjects(const std::string& parentName,
- const std::string& name);
+ const std::string& name);
//check if library implemements object given as name
bool hasObject(const std::string& name) const;
#include <ace_api_install.h>
namespace {
-
char* toAceString(const DPL::OptionalString& os)
{
- if (!os.IsNull())
+ if (!os.IsNull()) {
return strdup(DPL::ToUTF8String(*os).c_str());
- else
+ } else {
return NULL;
+ }
}
char* toAceString(const std::string& str)
{
- if (!str.empty())
+ if (!str.empty()) {
return strdup(str.c_str());
- else
+ } else {
return NULL;
+ }
}
-
} //anonymous namespace
namespace AceApi {
-
bool registerAceWidget(const WrtDB::DbWidgetHandle& widgetHandle,
- const WrtDB::WidgetRegisterInfo& widgetConfig,
- const WrtDB::WidgetCertificateDataList& certList)
+ const WrtDB::WidgetRegisterInfo& widgetConfig,
+ const WrtDB::WidgetCertificateDataList& certList)
{
LogDebug("Updating Ace database");
struct widget_info wi;
DPL::OptionalString os;
- switch(widgetConfig.webAppType.appType)
- {
- case WrtDB::APP_TYPE_WAC20:
- wi.type = WAC20;
- break;
- case WrtDB::APP_TYPE_TIZENWEBAPP:
- wi.type = Tizen;
- break;
- default:
- LogError("Unknown application type");
- return false;
+ switch (widgetConfig.webAppType.appType) {
+ case WrtDB::APP_TYPE_WAC20:
+ wi.type = WAC20;
+ break;
+ case WrtDB::APP_TYPE_TIZENWEBAPP:
+ wi.type = Tizen;
+ break;
+ default:
+ LogError("Unknown application type");
+ return false;
}
wi.id = toAceString(widgetConfig.configInfo.widget_id);
//one more element for NULL termination
LogDebug("Found: " << certList.size() << " certificates");
- ace_certificate_data** certData = new ace_certificate_data*[certList.size() + 1];
+ ace_certificate_data** certData = new ace_certificate_data *
+ [certList.size() + 1];
certData[certList.size()] = NULL; // last element set to NULL
int i = 0;
{
certData[i] = new ace_certificate_data;
switch (it->owner) {
- case WrtDB::WidgetCertificateData::AUTHOR :
+ case WrtDB::WidgetCertificateData::AUTHOR:
certData[i]->owner = AUTHOR;
break;
- case WrtDB::WidgetCertificateData::DISTRIBUTOR :
+ case WrtDB::WidgetCertificateData::DISTRIBUTOR:
certData[i]->owner = DISTRIBUTOR;
break;
- default :
+ default:
LogDebug("Unknown owner type of cert");
certData[i]->owner = UNKNOWN;
}
switch (it->type) {
- case WrtDB::WidgetCertificateData::ENDENTITY :
- certData[i]->type = ENDENTITY;
- break;
- case WrtDB::WidgetCertificateData::ROOT :
- certData[i]->type = ROOT;
- break;
- default :
- LogError("Unknown type of cert");
- certData[i]->type = ENDENTITY;
+ case WrtDB::WidgetCertificateData::ENDENTITY:
+ certData[i]->type = ENDENTITY;
+ break;
+ case WrtDB::WidgetCertificateData::ROOT:
+ certData[i]->type = ROOT;
+ break;
+ default:
+ LogError("Unknown type of cert");
+ certData[i]->type = ENDENTITY;
}
certData[i]->chain_id = it->chainId;
certData[i]->md5_fp = toAceString(it->strMD5Fingerprint);
certData[i]->sha1_fp = toAceString(it->strSHA1Fingerprint);
- certData[i]->common_name = toAceString(DPL::ToUTF8String(it->strCommonName));
+ certData[i]->common_name =
+ toAceString(DPL::ToUTF8String(it->strCommonName));
++i;
}
LogDebug("Registerign widget in ace");
ace_return_t retval = ACE_ACE_UNKNOWN_ERROR;
retval = ace_register_widget(
- static_cast<ace_widget_handle_t>(widgetHandle), &wi, certData);
+ static_cast<ace_widget_handle_t>(widgetHandle), &wi, certData);
//clean up - WidgetInfo
free(wi.author);
#include <dpl/wrt-dao-ro/widget_dao_read_only.h>
namespace AceApi {
-
bool registerAceWidget(const WrtDB::DbWidgetHandle& widgetHandle,
const WrtDB::WidgetRegisterInfo& widgetConfig,
const WrtDB::WidgetCertificateDataList& certList);
-
}
-#endif /* WRT_SRC_INSTALLER_CORE_ACE_REGISTRATION_H_ */
+#endif /* WRT_SRC_INSTALLER_CORE_ACE_REGISTRATION_H_ */
const std::string XML_EXTENSION = ".xml";
-bool hasExtension(const std::string& filename, const std::string& extension) {
- LogDebug("Looking for extension " << extension << " in: " << filename);
+bool hasExtension(const std::string& filename, const std::string& extension)
+{
+ LogDebug("Looking for extension " << extension << " in: " << filename);
size_t fileLen = filename.length();
size_t extLen = extension.length();
if (fileLen < extLen) {
LogError("Filename " << filename << " is shorter than extension "
- << extension);
+ << extension);
return false;
}
- return (0 == filename.compare(fileLen-extLen, extLen, extension));
+ return (0 == filename.compare(fileLen - extLen, extLen, extension));
}
-bool checkTizenPkgIdExist(const std::string& tizenPkgId) {
+bool checkTizenPkgIdExist(const std::string& tizenPkgId)
+{
std::string installPath =
std::string(GlobalConfig::GetUserInstalledWidgetPath()) +
"/" + tizenPkgId;
struct stat dirStat;
if ((stat(installPath.c_str(), &dirStat) == 0) &&
- (stat(preinstallPath.c_str(), &dirStat) == 0)) {
+ (stat(preinstallPath.c_str(), &dirStat) == 0))
+ {
return true;
}
return false;
namespace Jobs {
namespace WidgetInstall {
-JobWidgetInstall::JobWidgetInstall(std::string const &widgetPath,
- const WidgetInstallationStruct &installerStruct) :
+JobWidgetInstall::JobWidgetInstall(
+ std::string const &widgetPath,
+ const WidgetInstallationStruct &
+ installerStruct) :
Job(Installation),
JobContextBase<WidgetInstallationStruct>(installerStruct),
m_exceptionCaught(Exceptions::Success)
// Create installation tasks
if (m_installerContext.widgetConfig.packagingType !=
- WrtDB::PKG_TYPE_DIRECTORY_WEB_APP &&
+ WrtDB::PKG_TYPE_DIRECTORY_WEB_APP &&
m_installerContext.widgetConfig.packagingType !=
- WrtDB::PKG_TYPE_HOSTED_WEB_APP &&
+ WrtDB::PKG_TYPE_HOSTED_WEB_APP &&
!m_isDRM)
{
AddTask(new TaskUnzip(m_installerContext));
}
AddTask(new TaskWidgetConfig(m_installerContext));
- if (m_installerContext.widgetConfig.packagingType ==
- WrtDB::PKG_TYPE_HOSTED_WEB_APP)
+ if (m_installerContext.widgetConfig.packagingType ==
+ WrtDB::PKG_TYPE_HOSTED_WEB_APP)
{
AddTask(new TaskPrepareFiles(m_installerContext));
}
AddTask(new TaskManifestFile(m_installerContext));
AddTask(new TaskCertificates(m_installerContext));
if (m_installerContext.widgetConfig.packagingType ==
- PKG_TYPE_HYBRID_WEB_APP) {
+ PKG_TYPE_HYBRID_WEB_APP)
+ {
AddTask(new TaskInstallOspsvc(m_installerContext));
}
AddTask(new TaskPluginsCopy(m_installerContext));
LogInfo("Widget Update");
m_installerContext.job->SetProgressFlag(true);
if (m_installerContext.widgetConfig.packagingType !=
- WrtDB::PKG_TYPE_HOSTED_WEB_APP &&
+ WrtDB::PKG_TYPE_HOSTED_WEB_APP &&
m_installerContext.widgetConfig.packagingType !=
- WrtDB::PKG_TYPE_DIRECTORY_WEB_APP &&
+ WrtDB::PKG_TYPE_DIRECTORY_WEB_APP &&
!m_isDRM)
{
AddTask(new TaskUnzip(m_installerContext));
AddTask(new TaskWidgetConfig(m_installerContext));
if (m_installerContext.widgetConfig.packagingType ==
- WrtDB::PKG_TYPE_HOSTED_WEB_APP)
+ WrtDB::PKG_TYPE_HOSTED_WEB_APP)
{
AddTask(new TaskPrepareFiles(m_installerContext));
}
AddTask(new TaskManifestFile(m_installerContext));
if (m_installerContext.widgetConfig.packagingType ==
- PKG_TYPE_HYBRID_WEB_APP) {
+ PKG_TYPE_HYBRID_WEB_APP)
+ {
AddTask(new TaskInstallOspsvc(m_installerContext));
}
if (m_installerContext.widgetConfig.packagingType !=
//TODO: remove widgetHandle from this task and move before database task
// by now widget handle is needed in ace check
// Any error in acecheck while update will break widget
-
} else if (result == ConfigureResult::Deferred) {
// Installation is deferred
LogInfo("Configure installation deferred");
}
JobWidgetInstall::ConfigureResult JobWidgetInstall::PrePareInstallation(
- const std::string &widgetPath)
+ const std::string &widgetPath)
{
ConfigureResult result;
m_needEncryption = false;
m_isDRM = isDRMWidget(widgetPath);
if (true == m_isDRM) {
LogDebug("decrypt DRM widget");
- if(DecryptDRMWidget(widgetPath, tempDir)) {
+ if (DecryptDRMWidget(widgetPath, tempDir)) {
LogDebug("Failed decrypt DRM widget");
return ConfigureResult::Failed;
}
m_installerContext.widgetConfig.packagingType =
checkPackageType(widgetPath, tempDir);
ConfigParserData configData = getWidgetDataFromXML(
- widgetPath,
- tempDir,
- m_installerContext.widgetConfig.packagingType,
- m_isDRM);
+ widgetPath,
+ tempDir,
+ m_installerContext.widgetConfig.packagingType,
+ m_isDRM);
LogDebug("widget packaging type : " <<
- m_installerContext.widgetConfig.packagingType.pkgType);
+ m_installerContext.widgetConfig.packagingType.pkgType);
setTizenId(configData);
setApplicationType(configData);
}
void JobWidgetInstall::setTizenId(
- const WrtDB::ConfigParserData &configInfo)
+ const WrtDB::ConfigParserData &configInfo)
{
bool shouldMakeAppid = false;
using namespace PackageManager;
- if(!!configInfo.tizenAppId) {
+ if (!!configInfo.tizenAppId) {
LogDebug("Setting tizenAppId provided in config.xml: " <<
- configInfo.tizenAppId);
+ configInfo.tizenAppId);
m_installerContext.widgetConfig.tzAppid = *configInfo.tizenAppId;
//check package id.
- if(!!configInfo.tizenPkgId) {
+ if (!!configInfo.tizenPkgId) {
LogDebug("Setting tizenPkgId provided in config.xml: " <<
- configInfo.tizenPkgId);
+ configInfo.tizenPkgId);
m_installerContext.widgetConfig.tzPkgid = *configInfo.tizenPkgId;
} else {
DPL::String appid = *configInfo.tizenAppId;
- if(appid.length() > PACKAGE_ID_LENGTH) {
+ if (appid.length() > PACKAGE_ID_LENGTH) {
m_installerContext.widgetConfig.tzPkgid =
appid.substr(0, PACKAGE_ID_LENGTH);
} else {
m_installerContext.widgetConfig.tzPkgid = pkgId;
LogInfo("tizen_id name was generated by WRT: " <<
m_installerContext.widgetConfig.tzPkgid);
-
}
- if(shouldMakeAppid == true) {
+ if (shouldMakeAppid == true) {
DPL::OptionalString name;
DPL::OptionalString defaultLocale = configInfo.defaultlocale;
name = localizedData->second.name;
break;
}
-
} else {
name = localizedData->second.name;
break;
}
}
regex_t regx;
- if(regcomp(®x, REG_NAME_PATTERN, REG_NOSUB | REG_EXTENDED)!=0){
+ if (regcomp(®x, REG_NAME_PATTERN, REG_NOSUB | REG_EXTENDED) != 0) {
LogDebug("Regcomp failed");
}
LogDebug("Name : " << name);
if (!name || (regexec(®x, DPL::ToUTF8String(*name).c_str(),
- static_cast<size_t>(0), NULL, 0) != REG_NOERROR)) {
+ static_cast<size_t>(0), NULL, 0) != REG_NOERROR))
+ {
// TODO : generate name move to wrt-commons
std::string allowedString("ABCDEFGHIJKLMNOPQRSTUVWXYZ");
std::ostringstream genName;
genName << "_" << allowedString[rand() % allowedString.length()];
name = DPL::FromUTF8String(genName.str());
- LogDebug("name was generated by WRT" );
+ LogDebug("name was generated by WRT");
}
regfree(®x);
LogDebug("Name : " << name);
// send start signal of pkgmgr
getInstallerStruct().pkgmgrInterface->setPkgname(DPL::ToUTF8String(
- m_installerContext.widgetConfig.tzAppid));
+ m_installerContext.
+ widgetConfig.
+ tzAppid));
getInstallerStruct().pkgmgrInterface->sendSignal(
- PKGMGR_START_KEY,
- PKGMGR_START_INSTALL);
+ PKGMGR_START_KEY,
+ PKGMGR_START_INSTALL);
LogInfo("Tizen App Id : " << m_installerContext.widgetConfig.tzAppid);
LogInfo("Tizen Pkg Id : " << m_installerContext.widgetConfig.tzPkgid);
const std::string& tempPath)
{
m_installerContext.locations =
- WidgetLocation(DPL::ToUTF8String(m_installerContext.widgetConfig.tzPkgid),
- widgetPath, tempPath,
- m_installerContext.widgetConfig.packagingType,
- m_installerContext.locationType);
+ WidgetLocation(DPL::ToUTF8String(m_installerContext.widgetConfig.
+ tzPkgid),
+ widgetPath, tempPath,
+ m_installerContext.widgetConfig.packagingType,
+ m_installerContext.locationType);
m_installerContext.locations->registerAppid(
- DPL::ToUTF8String(m_installerContext.widgetConfig.tzAppid));
+ DPL::ToUTF8String(m_installerContext.widgetConfig.tzAppid));
LogInfo("widgetSource " << widgetPath);
}
JobWidgetInstall::ConfigureResult JobWidgetInstall::ConfigureInstallation(
- const std::string &widgetSource,
- const WrtDB::ConfigParserData &configData,
- const std::string &tempPath)
+ const std::string &widgetSource,
+ const WrtDB::ConfigParserData &configData,
+ const std::string &tempPath)
{
- WidgetUpdateInfo update = detectWidgetUpdate(configData,
- m_installerContext.widgetConfig.webAppType,
- m_installerContext.widgetConfig.tzAppid);
+ WidgetUpdateInfo update = detectWidgetUpdate(
+ configData,
+ m_installerContext.
+ widgetConfig.webAppType,
+ m_installerContext.
+ widgetConfig.tzAppid);
ConfigureResult result = checkWidgetUpdate(update);
// Validate tizenId
regex_t reg;
- if(regcomp(®, REG_TIZENID_PATTERN, REG_NOSUB | REG_EXTENDED)!=0){
+ if (regcomp(®, REG_TIZENID_PATTERN, REG_NOSUB | REG_EXTENDED) != 0) {
LogDebug("Regcomp failed");
}
if ((regexec(®,
- DPL::ToUTF8String(m_installerContext.widgetConfig.tzAppid).c_str(),
- static_cast<size_t>(0), NULL, 0) != REG_NOERROR) ||
- (checkTizenPkgIdExist(DPL::ToUTF8String(m_installerContext.widgetConfig.tzPkgid)) &&
- result != ConfigureResult::Updated))
+ DPL::ToUTF8String(m_installerContext.widgetConfig.tzAppid).
+ c_str(),
+ static_cast<size_t>(0), NULL, 0) != REG_NOERROR) ||
+ (checkTizenPkgIdExist(DPL::ToUTF8String(m_installerContext.widgetConfig
+ .tzPkgid)) &&
+ result != ConfigureResult::Updated))
{
//it is true when tizenId does not fit REG_TIZENID_PATTERN
LogError("tizen_id provided but not proper or pkgId directory exists");
- //TODO(t.iwanek): appId is unique, what about installation of abcdefghij.test1 and abcdefghij.test2?
+ //TODO(t.iwanek): appId is unique, what about installation of
+ // abcdefghij.test1 and abcdefghij.test2?
regfree(®);
return ConfigureResult::Failed;
}
}
JobWidgetInstall::ConfigureResult JobWidgetInstall::checkWidgetUpdate(
- const WidgetUpdateInfo &update)
+ const WidgetUpdateInfo &update)
{
LogInfo(
"Widget install/update: incoming guid = '" <<
// Check running state
int retval = APP_MANAGER_ERROR_NONE;
bool isRunning = false;
- retval = app_manager_is_running(DPL::ToUTF8String(tzAppid).c_str(), &isRunning);
+ retval = app_manager_is_running(DPL::ToUTF8String(
+ tzAppid).c_str(), &isRunning);
if (APP_MANAGER_ERROR_NONE != retval) {
LogError("Fail to get running state");
return ConfigureResult::Failed;
// Calc proceed flag
if ((m_jobStruct.updateMode & updateTypeCheckBit) > 0 ||
m_jobStruct.updateMode ==
- WidgetUpdateMode::PolicyDirectoryForceInstall)
+ WidgetUpdateMode::PolicyDirectoryForceInstall)
{
LogInfo("Whether widget policy allow proceed ok");
return ConfigureResult::Updated;
- }
- else
+ } else {
return ConfigureResult::Failed;
+ }
}
return ConfigureResult::Ok;
}
WidgetUpdateMode::Type JobWidgetInstall::CalcWidgetUpdatePolicy(
- const OptionalWidgetVersion &existingVersion,
- const OptionalWidgetVersion &incomingVersion) const
+ const OptionalWidgetVersion &existingVersion,
+ const OptionalWidgetVersion &incomingVersion) const
{
// Widget is installed, check versions
if (!existingVersion && !incomingVersion) {
}
ConfigParserData JobWidgetInstall::getWidgetDataFromXML(
- const std::string &widgetSource,
- const std::string &tempPath,
- WrtDB::PackagingType pkgType,
- bool isDRM)
+ const std::string &widgetSource,
+ const std::string &tempPath,
+ WrtDB::PackagingType pkgType,
+ bool isDRM)
{
// Parse config
ParserRunner parser;
{
if (pkgType == PKG_TYPE_HOSTED_WEB_APP) {
parser.Parse(widgetSource,
- ElementParserPtr(
- new RootParser<WidgetParser>(configInfo,
- DPL::FromUTF32String(
- L"widget"))));
+ ElementParserPtr(
+ new RootParser<WidgetParser>(configInfo,
+ DPL::FromUTF32String(
+ L"widget"))));
} else if (pkgType == PKG_TYPE_DIRECTORY_WEB_APP) {
parser.Parse(widgetSource + '/' + WITH_OSP_XML,
ElementParserPtr(
new RootParser<WidgetParser>(
- configInfo,
- DPL::FromUTF32String(L"widget"))));
+ configInfo,
+ DPL::FromUTF32String(L"widget"))));
} else {
if (!isDRM) {
std::unique_ptr<DPL::ZipInput> zipFile(
- new DPL::ZipInput(widgetSource));
+ new DPL::ZipInput(widgetSource));
std::unique_ptr<DPL::ZipInput::File> configFile;
DPL::AbstractWaitableOutputAdapter outputAdapter(&buffer);
DPL::Copy(&inputAdapter, &outputAdapter);
parser.Parse(&buffer,
- ElementParserPtr(
- new RootParser<WidgetParser>(configInfo,
- DPL::FromUTF32String(
- L"widget"))));
+ ElementParserPtr(
+ new RootParser<WidgetParser>(configInfo,
+ DPL::
+ FromUTF32String(
+ L"widget"))));
} else {
// DRM widget
std::string configFile;
}
parser.Parse(configFile,
- ElementParserPtr(
- new RootParser<WidgetParser>(configInfo,
- DPL::FromUTF32String(
- L"widget"))));
+ ElementParserPtr(
+ new RootParser<WidgetParser>(configInfo,
+ DPL::
+ FromUTF32String(
+ L"widget"))));
}
}
}
}
WidgetUpdateInfo JobWidgetInstall::detectWidgetUpdate(
- const ConfigParserData &configInfo,
- const WrtDB::WidgetType appType,
- const WrtDB::TizenAppId &tizenId)
+ const ConfigParserData &configInfo,
+ const WrtDB::WidgetType appType,
+ const WrtDB::TizenAppId &tizenId)
{
LogInfo("Checking up widget package for config.xml...");
// Search widget handle by GUID
WidgetDAOReadOnly dao(widgetGUID);
return WidgetUpdateInfo(
- widgetGUID,
- widgetVersion,
- WidgetUpdateInfo::ExistingWidgetInfo(
- dao.getTzAppId(), dao.getVersion()));
+ widgetGUID,
+ widgetVersion,
+ WidgetUpdateInfo::ExistingWidgetInfo(
+ dao.getTzAppId(), dao.getVersion()));
}
Catch(WidgetDAOReadOnly::Exception::WidgetNotExist)
{
// GUID isn't installed
return WidgetUpdateInfo(
- widgetGUID,
- widgetVersion,
- WidgetUpdateInfo::ExistingWidgetInfo());
+ widgetGUID,
+ widgetVersion,
+ WidgetUpdateInfo::ExistingWidgetInfo());
}
} else {
Try
// Search widget handle by appId
WidgetDAOReadOnly dao(tizenId);
return WidgetUpdateInfo(
- widgetGUID,
- widgetVersion,
- WidgetUpdateInfo::ExistingWidgetInfo(
- dao.getTzAppId(), dao.getVersion()));
+ widgetGUID,
+ widgetVersion,
+ WidgetUpdateInfo::ExistingWidgetInfo(
+ dao.getTzAppId(), dao.getVersion()));
}
Catch(WidgetDAOReadOnly::Exception::WidgetNotExist)
{
// GUID isn't installed
return WidgetUpdateInfo(
- widgetGUID,
- widgetVersion,
- WidgetUpdateInfo::ExistingWidgetInfo());
+ widgetGUID,
+ widgetVersion,
+ WidgetUpdateInfo::ExistingWidgetInfo());
}
-
}
}
std::ostringstream percent;
percent << static_cast<int>(GetProgressPercent());
getInstallerStruct().pkgmgrInterface->sendSignal(
- PKGMGR_PROGRESS_KEY,
- percent.str());
+ PKGMGR_PROGRESS_KEY,
+ percent.str());
LogDebug("Call widget install progressCallbak");
- getInstallerStruct().progressCallback(getInstallerStruct().userParam,
- GetProgressPercent(),GetProgressDescription());
+ getInstallerStruct().progressCallback(
+ getInstallerStruct().userParam,
+ GetProgressPercent(),
+ GetProgressDescription());
}
}
}
// TODO : sync should move to separate task.
sync();
-
if (INSTALL_LOCATION_TYPE_EXTERNAL == m_installerContext.locationType) {
if (false == m_installerContext.existingWidgetInfo.isExist) {
WidgetInstallToExtSingleton::Instance().postInstallation(true);
// send signal of pkgmgr
getInstallerStruct().pkgmgrInterface->sendSignal(
- PKGMGR_END_KEY,
- PKGMGR_END_SUCCESS);
+ PKGMGR_END_KEY,
+ PKGMGR_END_SUCCESS);
LogDebug("Call widget install successfinishedCallback");
getInstallerStruct().finishedCallback(getInstallerStruct().userParam,
- DPL::ToUTF8String(tizenId), Exceptions::Success);
+ DPL::ToUTF8String(
+ tizenId), Exceptions::Success);
}
void JobWidgetInstall::SendFinishedFailure()
// send signal of pkgmgr
getInstallerStruct().pkgmgrInterface->sendSignal(
- PKGMGR_END_KEY,
- PKGMGR_END_FAILURE);
+ PKGMGR_END_KEY,
+ PKGMGR_END_FAILURE);
getInstallerStruct().finishedCallback(getInstallerStruct().userParam,
- DPL::ToUTF8String(tizenId), m_exceptionCaught);
+ DPL::ToUTF8String(
+ tizenId), m_exceptionCaught);
}
void JobWidgetInstall::SaveExceptionData(const Jobs::JobExceptionBase &e)
W3CFileLocalization::getLocalizedInfo(dao.getTzAppId());
out << std::endl <<
- "===================================== INSTALLED WIDGET INFO ========="\
- "============================";
+ "===================================== INSTALLED WIDGET INFO =========" \
+ "============================";
out << std::endl << "Name: " << localizedInfo.name;
out << std::endl << "AppId: " << dao.getTzAppId();
WidgetSize size = dao.getPreferredSize();
out << std::endl << "Width: " << size.width;
out << std::endl << "Height: " << size.height;
out << std::endl << "Start File: " <<
- W3CFileLocalization::getStartFile(dao.getTzAppId());
+ W3CFileLocalization::getStartFile(dao.getTzAppId());
out << std::endl << "Version: " << dao.getVersion();
out << std::endl << "Licence: " <<
- localizedInfo.license;
+ localizedInfo.license;
out << std::endl << "Licence Href: " <<
- localizedInfo.licenseHref;
+ localizedInfo.licenseHref;
out << std::endl << "Description: " <<
- localizedInfo.description;
+ localizedInfo.description;
out << std::endl << "Widget Id: " << dao.getGUID();
out << std::endl << "Widget recognized: " << dao.isRecognized();
out << std::endl << "Widget wac signed: " << dao.isWacSigned();
out << std::endl << "Widget distributor signed: " <<
- dao.isDistributorSigned();
+ dao.isDistributorSigned();
out << std::endl << "Widget trusted: " << dao.isTrusted();
OptionalWidgetIcon icon = W3CFileLocalization::getIcon(dao.getTzAppId());
- DPL::OptionalString iconSrc = !!icon ? icon->src : DPL::OptionalString::Null;
+ DPL::OptionalString iconSrc =
+ !!icon ? icon->src : DPL::OptionalString::Null;
out << std::endl << "Icon: " << iconSrc;
out << std::endl << "Preferences:";
FOREACH(it, list)
{
out << std::endl << " Key: " <<
- it->key_name;
+ it->key_name;
out << std::endl << " Readonly: " <<
- it->readonly;
+ it->readonly;
}
}
}
WrtDB::PackagingType JobWidgetInstall::checkPackageType(
- const std::string &widgetSource,
- const std::string &tempPath)
+ const std::string &widgetSource,
+ const std::string &tempPath)
{
// Check installation type (direcotory/ or config.xml or widget.wgt)
- if (WidgetUpdateMode::PolicyDirectoryForceInstall == m_jobStruct.updateMode)
+ if (WidgetUpdateMode::PolicyDirectoryForceInstall ==
+ m_jobStruct.updateMode)
{
LogDebug("Install directly from directory");
return PKG_TYPE_DIRECTORY_WEB_APP;
{
// Open zip file
zipFile.reset(new DPL::ZipInput(widgetSource));
-
}
Catch(DPL::ZipInput::Exception::OpenFailed)
{
{
// Open config.xml file in package root
std::unique_ptr<DPL::ZipInput::File> configFile(
- zipFile->OpenFile(CONFIG_XML));
+ zipFile->OpenFile(CONFIG_XML));
return PKG_TYPE_NOMAL_WEB_APP;
}
Catch(DPL::ZipInput::Exception::OpenFileFailed)
{
// Open config.xml file in package root
std::unique_ptr<DPL::ZipInput::File> configFile(
- zipFile->OpenFile(WITH_OSP_XML));
+ zipFile->OpenFile(WITH_OSP_XML));
return PKG_TYPE_HYBRID_WEB_APP;
}
}
void JobWidgetInstall::setApplicationType(
- const WrtDB::ConfigParserData &configInfo)
+ const WrtDB::ConfigParserData &configInfo)
{
-
FOREACH(iterator, configInfo.nameSpaces) {
LogInfo("namespace = [" << *iterator << "]");
AppType currentAppType = APP_TYPE_UNKNOWN;
{
currentAppType = APP_TYPE_WAC20;
} else if (*iterator ==
- ConfigurationNamespace::TizenWebAppNamespaceName) {
+ ConfigurationNamespace::TizenWebAppNamespaceName)
+ {
currentAppType = APP_TYPE_TIZENWEBAPP;
}
if (m_installerContext.widgetConfig.webAppType ==
- APP_TYPE_UNKNOWN) {
+ APP_TYPE_UNKNOWN)
+ {
m_installerContext.widgetConfig.webAppType = currentAppType;
} else if (m_installerContext.widgetConfig.webAppType ==
- currentAppType) {
+ currentAppType)
+ {
continue;
} else {
ThrowMsg(Exceptions::WidgetConfigFileInvalid,
}
LogInfo("type = [" <<
- m_installerContext.widgetConfig.webAppType.getApptypeToString() << "]");
+ m_installerContext.widgetConfig.webAppType.getApptypeToString() <<
+ "]");
}
-bool JobWidgetInstall::detectResourceEncryption(const WrtDB::ConfigParserData &configData)
+bool JobWidgetInstall::detectResourceEncryption(
+ const WrtDB::ConfigParserData &configData)
{
FOREACH(it, configData.settingsList)
{
if (it->m_name == SETTING_VALUE_ENCRYPTION &&
- it->m_value == SETTING_VALUE_ENCRYPTION_ENABLE) {
+ it->m_value == SETTING_VALUE_ENCRYPTION_ENABLE)
+ {
LogDebug("resource need encryption");
return true;
}
return false;
}
-void JobWidgetInstall::setInstallLocationType(const
- WrtDB::ConfigParserData &configData)
+void JobWidgetInstall::setInstallLocationType(
+ const
+ WrtDB::ConfigParserData &
+ configData)
{
m_installerContext.locationType = INSTALL_LOCATION_TYPE_NOMAL;
FOREACH(it, configData.settingsList)
{
if (it->m_name == SETTING_VALUE_INSTALLTOEXT_NAME &&
- it->m_value ==
- SETTING_VALUE_INSTALLTOEXT_PREPER_EXT) {
+ it->m_value ==
+ SETTING_VALUE_INSTALLTOEXT_PREPER_EXT)
+ {
LogDebug("This widget will be installed to sd card");
m_installerContext.locationType =
INSTALL_LOCATION_TYPE_EXTERNAL;
bool JobWidgetInstall::isDRMWidget(std::string widgetPath)
{
/* TODO :
- drm_bool_type_e is_drm_file = DRM_UNKNOWN;
- int ret = -1;
-
- ret = drm_is_drm_file(widgetPath.c_str(), &is_drm_file);
- if(DRM_RETURN_SUCCESS == ret && DRM_TRUE == is_drm_file) {
- */
+ * drm_bool_type_e is_drm_file = DRM_UNKNOWN;
+ * int ret = -1;
+ *
+ * ret = drm_is_drm_file(widgetPath.c_str(), &is_drm_file);
+ * if(DRM_RETURN_SUCCESS == ret && DRM_TRUE == is_drm_file) {
+ */
/* blow code temporary code for drm. */
int ret = drm_oem_intel_isDrmFile(const_cast<char*>(widgetPath.c_str()));
- if ( 1 == ret) {
+ if (1 == ret) {
return true;
} else {
return false;
}
bool JobWidgetInstall::DecryptDRMWidget(std::string widgetPath,
- std::string destPath)
+ std::string destPath)
{
/* TODO :
- drm_trusted_sapps_decrypt_package_info_s package_info;
-
- strncpy(package_info.sadcf_filepath, widgetPath.c_str(),
- sizeof(package_info.sadcf_filepath));
- strncpy(package_info.decrypt_filepath, destPath.c_str(),
- sizeof(package_info.decrypt_filepath));
-
- drm_trusted_request_type_e requestType =
- DRM_TRUSTED_REQ_TYPE_SAPPS_DECRYPT_PACKAGE;
-
- int ret = drm_trusted_handle_request(requestType,
- (void *)&package_info, NULL);
- if (DRM_TRUSTED_RETURN_SUCCESS == ret) {
- return true;
- } else {
- return false;
- }
- */
+ * drm_trusted_sapps_decrypt_package_info_s package_info;
+ *
+ * strncpy(package_info.sadcf_filepath, widgetPath.c_str(),
+ * sizeof(package_info.sadcf_filepath));
+ * strncpy(package_info.decrypt_filepath, destPath.c_str(),
+ * sizeof(package_info.decrypt_filepath));
+ *
+ * drm_trusted_request_type_e requestType =
+ * DRM_TRUSTED_REQ_TYPE_SAPPS_DECRYPT_PACKAGE;
+ *
+ * int ret = drm_trusted_handle_request(requestType,
+ * (void *)&package_info, NULL);
+ * if (DRM_TRUSTED_RETURN_SUCCESS == ret) {
+ * return true;
+ * } else {
+ * return false;
+ * }
+ */
if (drm_oem_intel_decrypt_package(const_cast<char*>(widgetPath.c_str()),
- const_cast<char*>(destPath.c_str())) != 0) {
+ const_cast<char*>(destPath.c_str())) != 0)
+ {
return true;
} else {
return false;
}
}
-
} //namespace WidgetInstall
} //namespace Jobs
Exceptions::Type m_exceptionCaught;
std::string m_exceptionMessage;
WidgetUpdateInfo m_widgetUpdateInfo;
- bool m_needEncryption;
- bool m_isDRM;
+ bool m_needEncryption;
+ bool m_isDRM;
enum class ConfigureResult
{
&configData,
const std::string &tempPath);
static WrtDB::ConfigParserData getWidgetDataFromXML(
- const std::string &widgetSource,
- const std::string &tempPath,
- WrtDB::PackagingType pkgType,
- bool isDRM);
+ const std::string &widgetSource,
+ const std::string &tempPath,
+ WrtDB::PackagingType pkgType,
+ bool isDRM);
static WidgetUpdateInfo detectWidgetUpdate(
- const WrtDB::ConfigParserData &configInfo,
- const WrtDB::WidgetType appType,
- const WrtDB::TizenAppId &tizenId);
+ const WrtDB::ConfigParserData &configInfo,
+ const WrtDB::WidgetType appType,
+ const WrtDB::TizenAppId &tizenId);
WidgetUpdateMode::Type CalcWidgetUpdatePolicy(
- const OptionalWidgetVersion &existingVersion,
- const OptionalWidgetVersion &incomingVersion) const;
+ const OptionalWidgetVersion &existingVersion,
+ const OptionalWidgetVersion &incomingVersion) const;
void setTizenId(const WrtDB::ConfigParserData &configInfo);
void displayWidgetInfo();
void configureWidgetLocation(const std::string & widgetPath,
const std::string &tempPath);
WrtDB::PackagingType checkPackageType(
- const std::string &widgetSource,
- const std::string &tempPath);
+ const std::string &widgetSource,
+ const std::string &tempPath);
bool detectResourceEncryption(const WrtDB::ConfigParserData &configData);
void setInstallLocationType(const WrtDB::ConfigParserData
- &configData);
+ &configData);
bool isDRMWidget(std::string widgetPath);
bool DecryptDRMWidget(std::string widgetPath, std::string destPath);
ConfigureResult PrePareInstallation(const std::string &widgetPath);
* @brief Automaticaly sets installation process
*/
JobWidgetInstall(std::string const & widgetPath,
- const WidgetInstallationStruct &installerStruct);
+ const WidgetInstallationStruct &installerStruct);
//overrides
void SendProgress();
namespace Jobs {
namespace WidgetInstall {
-
void writeElement(xmlTextWriterPtr writer, const char * name, DPL::String body)
{
int state = xmlTextWriterWriteElement(writer, BAD_CAST name,
- BAD_CAST DPL::ToUTF8String(body).c_str());
- if (state < 0)
- {
+ BAD_CAST DPL::ToUTF8String(
+ body).c_str());
+ if (state < 0) {
ThrowMsg(LibxmlUtils::Libxml2Error, "xmlTextWriterWriteElement failed");
}
}
void writeText(xmlTextWriterPtr writer, DPL::String text)
{
int state = xmlTextWriterWriteString(writer,
- BAD_CAST DPL::ToUTF8String(text).c_str());
- if (state < 0)
- {
+ BAD_CAST DPL::ToUTF8String(text).c_str());
+ if (state < 0) {
ThrowMsg(LibxmlUtils::Libxml2Error, "xmlTextWriterWriteText failed");
}
}
void writeElement(xmlTextWriterPtr writer, const char * name, const char * body)
{
int state = xmlTextWriterWriteElement(writer, BAD_CAST name, BAD_CAST body);
- if (state < 0)
- {
+ if (state < 0) {
ThrowMsg(LibxmlUtils::Libxml2Error, "xmlTextWriterWriteElement failed");
}
}
-void writeElementWithOneAttribute(xmlTextWriterPtr writer, const char * name,
- DPL::String body, const char * nameAttr, DPL::String bodyAttr,
- bool condition = true)
+void writeElementWithOneAttribute(xmlTextWriterPtr writer,
+ const char * name,
+ DPL::String body,
+ const char * nameAttr,
+ DPL::String bodyAttr,
+ bool condition = true)
{
startElement(writer, name);
writeAttribute(writer, nameAttr, bodyAttr, condition);
void startElement(xmlTextWriterPtr writer, const char * name)
{
int state = xmlTextWriterStartElement(writer, BAD_CAST name);
- if (state < 0)
- {
+ if (state < 0) {
ThrowMsg(LibxmlUtils::Libxml2Error, "xmlTextWriterStartElement failed");
}
}
void endElement(xmlTextWriterPtr writer)
{
int state = xmlTextWriterEndElement(writer);
- if (state < 0)
- {
+ if (state < 0) {
ThrowMsg(LibxmlUtils::Libxml2Error, "xmlTextWriterEndElement failed");
}
}
-void writeAttribute(xmlTextWriterPtr writer, const char * name, DPL::String body,
- bool condition = true)
+void writeAttribute(xmlTextWriterPtr writer,
+ const char * name,
+ DPL::String body,
+ bool condition = true)
{
- if (!condition)
+ if (!condition) {
return;
+ }
int state = xmlTextWriterWriteAttribute(writer, BAD_CAST name,
- BAD_CAST DPL::ToUTF8String(body).c_str());
- if (state < 0)
- {
- ThrowMsg(LibxmlUtils::Libxml2Error, "xmlTextWriterWriteAttribute failed");
+ BAD_CAST DPL::ToUTF8String(
+ body).c_str());
+ if (state < 0) {
+ ThrowMsg(LibxmlUtils::Libxml2Error,
+ "xmlTextWriterWriteAttribute failed");
}
}
-void writeAttribute(xmlTextWriterPtr writer, const char * name, const char * body,
- bool condition = true)
+void writeAttribute(xmlTextWriterPtr writer,
+ const char * name,
+ const char * body,
+ bool condition = true)
{
- if (!condition)
+ if (!condition) {
return;
- int state = xmlTextWriterWriteAttribute(writer, BAD_CAST name, BAD_CAST body);
- if (state < 0)
- {
- ThrowMsg(LibxmlUtils::Libxml2Error, "xmlTextWriterWriteAttribute failed");
+ }
+ int state = xmlTextWriterWriteAttribute(writer,
+ BAD_CAST name,
+ BAD_CAST body);
+ if (state < 0) {
+ ThrowMsg(LibxmlUtils::Libxml2Error,
+ "xmlTextWriterWriteAttribute failed");
}
}
{
xmlTextWriterPtr writer;
int state;
- writer = xmlNewTextWriterFilename(DPL::ToUTF8String(filename).c_str(), 0); //compression set to 0
- if (writer == NULL)
+
+ //compression set to 0
+ writer = xmlNewTextWriterFilename(DPL::ToUTF8String(filename).c_str(), 0);
+
+ if (writer == NULL) {
ThrowMsg(LibxmlUtils::Libxml2Error, "xmlNewTextWriterFilename failed");
- state = xmlTextWriterSetIndent (writer, 1);
- if (state < 0)
- {
+ }
+ state = xmlTextWriterSetIndent(writer, 1);
+ if (state < 0) {
ThrowMsg(LibxmlUtils::Libxml2Error, "xmlTextWriterSetIndent failed");
}
state = xmlTextWriterStartDocument(writer, NULL, "utf-8", NULL);
- if (state < 0)
- {
+ if (state < 0) {
ThrowMsg(LibxmlUtils::Libxml2Error, "xmlTextWriterStartDocument failed");
}
this->serialize(writer);
state = xmlTextWriterEndDocument(writer);
- if (state < 0)
- {
+ if (state < 0) {
ThrowMsg(LibxmlUtils::Libxml2Error, "xmlTextWriterEndDocument failed");
}
- if (writer != NULL)
- {
+ if (writer != NULL) {
xmlFreeTextWriter(writer);
writer = NULL;
}
writeAttribute(writer, "package", this->package);
writeAttribute(writer, "type", this->type);
writeAttribute(writer, "version", this->version);
- if (!this->installLocation.IsNull())
+ if (!this->installLocation.IsNull()) {
writeAttribute(writer, "install-location", (*this->installLocation),
- (*this->installLocation).empty());
+ (*this->installLocation).empty());
+ }
FOREACH(l, this->label)
{
writeElementWithOneAttribute(writer, "label", l->getString(),
- "xml:lang", l->getLang(), l->hasLang());
+ "xml:lang", l->getLang(), l->hasLang());
}
FOREACH(i, this->icon)
{
writeElementWithOneAttribute(writer, "icon", i->getString(),
- "xml:lang", i->getLang(), i->hasLang());
+ "xml:lang", i->getLang(), i->hasLang());
}
FOREACH(a, this->author)
{
FOREACH(d, this->description)
{
writeElementWithOneAttribute(writer, "description", d->getString(),
- "xml:lang", d->getLang(), d->hasLang());
+ "xml:lang", d->getLang(), d->hasLang());
}
//FOREACH(c, this->compatibility) { c->serialize(writer); }
//FOREACH(d, this->deviceProfile) { d->serialize(writer); }
- FOREACH(s, this->serviceApplication) { s->serialize(writer); }
- FOREACH(u, this->uiApplication) { u->serialize(writer); }
- FOREACH(i, this->imeApplication) { i->serialize(writer); }
+ FOREACH(s, this->serviceApplication) {
+ s->serialize(writer);
+ }
+ FOREACH(u, this->uiApplication) {
+ u->serialize(writer);
+ }
+ FOREACH(i, this->imeApplication) {
+ i->serialize(writer);
+ }
//FOREACH(f, this->font) { f->serialize(writer); }
- FOREACH(l, this->livebox) { l->serialize(writer); }
+ FOREACH(l, this->livebox) {
+ l->serialize(writer);
+ }
}
endElement(writer);
}
{
startElement(writer, "service-application");
writeAttribute(writer, "appid", this->appid);
- writeAttribute(writer, "auto-restart", (!this->autoRestart.IsNull() &&
- (*this->autoRestart)) ? "true" : "false");
+ writeAttribute(writer, "auto-restart",
+ (!this->autoRestart.IsNull() &&
+ (*this->autoRestart)) ? "true" :
+ "false");
writeAttribute(writer, "exec", this->exec);
writeAttribute(writer, "on-boot", (!this->onBoot.IsNull() &&
- (*this->onBoot)) ? "true" : "false");
+ (*this->onBoot)) ? "true" : "false");
writeAttribute(writer, "type", this->type);
FOREACH(l, this->label)
{
- writeElementWithOneAttribute(writer, "label", l->getString(), "xml:lang",
- l->getLang(), l->hasLang());
+ writeElementWithOneAttribute(writer, "label",
+ l->getString(), "xml:lang",
+ l->getLang(), l->hasLang());
}
FOREACH(i, this->icon)
{
writeElementWithOneAttribute(writer, "icon", i->getString(), "xml:lang",
- i->getLang(), i->hasLang());
+ i->getLang(), i->hasLang());
}
FOREACH(a, this->appControl)
{
startElement(writer, "ui-application");
writeAttribute(writer, "appid", this->appid);
writeAttribute(writer, "exec", this->exec);
- if (!this->multiple.IsNull())
+ if (!this->multiple.IsNull()) {
writeAttribute(writer, "multiple", (*this->multiple) ? "true" : "false");
- if (!this->nodisplay.IsNull())
- writeAttribute(writer, "nodisplay", (*this->nodisplay) ? "true" : "false");
- if (!this->taskmanage.IsNull())
- writeAttribute(writer, "taskmanage", (*this->taskmanage) ? "true" : "false");
+ }
+ if (!this->nodisplay.IsNull()) {
+ writeAttribute(writer,
+ "nodisplay",
+ (*this->nodisplay) ? "true" : "false");
+ }
+ if (!this->taskmanage.IsNull()) {
+ writeAttribute(writer,
+ "taskmanage",
+ (*this->taskmanage) ? "true" : "false");
+ }
writeAttribute(writer, "type", this->type);
writeAttribute(writer, "extraid", this->extraid);
- if (!this->categories.IsNull())
+ if (!this->categories.IsNull()) {
writeAttribute(writer, "categories", (*this->categories));
+ }
FOREACH(l, this->label)
{
- writeElementWithOneAttribute(writer, "label", l->getString(), "xml:lang",
- l->getLang(), l->hasLang());
+ writeElementWithOneAttribute(writer, "label",
+ l->getString(), "xml:lang",
+ l->getLang(), l->hasLang());
}
FOREACH(i, this->icon)
{
writeElementWithOneAttribute(writer, "icon", i->getString(), "xml:lang",
- i->getLang(), i->hasLang());
+ i->getLang(), i->hasLang());
}
FOREACH(a, this->appControl)
{
startElement(writer, "ime-application");
writeAttribute(writer, "appid", this->appid);
writeAttribute(writer, "exec", this->exec);
- if (!this->multiple.IsNull())
+ if (!this->multiple.IsNull()) {
writeAttribute(writer, "multiple", (*this->multiple) ? "true" : "false");
- if (!this->nodisplay.IsNull())
- writeAttribute(writer, "nodisplay", (*this->nodisplay) ? "true" : "false");
+ }
+ if (!this->nodisplay.IsNull()) {
+ writeAttribute(writer,
+ "nodisplay",
+ (*this->nodisplay) ? "true" : "false");
+ }
writeAttribute(writer, "type", this->type);
FOREACH(l, this->label)
{
- writeElementWithOneAttribute(writer, "label", l->getString(), "xml:lang",
- l->getLang(), l->hasLang());
+ writeElementWithOneAttribute(writer, "label",
+ l->getString(), "xml:lang",
+ l->getLang(), l->hasLang());
}
FOREACH(i, this->icon)
{
writeElementWithOneAttribute(writer, "icon", i->getString(), "xml:lang",
- i->getLang(), i->hasLang());
+ i->getLang(), i->hasLang());
}
endElement(writer);
}
void LiveBox::serialize(xmlTextWriterPtr writer)
{
startElement(writer, "livebox");
- if(!this->liveboxId.empty()) {
+ if (!this->liveboxId.empty()) {
writeAttribute(writer, "appid", this->liveboxId);
}
- if(!this->primary.empty()) {
+ if (!this->primary.empty()) {
writeAttribute(writer, "primary", this->primary);
}
- if(!this->updatePeriod.empty()) {
+ if (!this->updatePeriod.empty()) {
writeAttribute(writer, "period", this->updatePeriod);
}
writeAttribute(writer, "network", "true");
writeAttribute(writer, "nodisplay", "false");
- if(!this->label.empty()) {
+ if (!this->label.empty()) {
startElement(writer, "label");
writeText(writer, this->label);
endElement(writer);
}
- if(!this->icon.empty()) {
+ if (!this->icon.empty()) {
startElement(writer, "icon");
writeText(writer, this->icon);
endElement(writer);
}
- if(!this->autoLaunch.empty()) {
+ if (!this->autoLaunch.empty()) {
startElement(writer, "launch");
writeText(writer, this->autoLaunch);
endElement(writer);
}
- if(!this->box.boxSrc.empty() &&
- !this->box.boxMouseEvent.empty() &&
- !this->box.boxSize.empty())
+ if (!this->box.boxSrc.empty() &&
+ !this->box.boxMouseEvent.empty() &&
+ !this->box.boxSize.empty())
{
startElement(writer, "box");
writeAttribute(writer, "type", "buffer");
{
std::pair<DPL::String, DPL::String> boxSize = *m;
startElement(writer, "size");
- if(!boxSize.second.empty())
+ if (!boxSize.second.empty()) {
writeAttribute(writer, "preview", boxSize.second);
+ }
writeText(writer, boxSize.first);
endElement(writer);
}
endElement(writer);
- if(!this->box.pdSrc.empty() &&
- !this->box.pdWidth.empty() &&
- !this->box.pdHeight.empty())
+ if (!this->box.pdSrc.empty() &&
+ !this->box.pdWidth.empty() &&
+ !this->box.pdHeight.empty())
{
startElement(writer, "pd");
writeAttribute(writer, "type", "buffer");
startElement(writer, "size");
- DPL::String pdSize = this->box.pdWidth+DPL::String(L"x")+this->box.pdHeight;
+ DPL::String pdSize = this->box.pdWidth + DPL::String(L"x") +
+ this->box.pdHeight;
writeText(writer, pdSize);
endElement(writer);
endElement(writer);
}
-
} //namespace Jobs
} //namespace WidgetInstall
namespace Jobs {
namespace WidgetInstall {
-
/**
* @brief string with optional language attribute
*/
class StringWithLang
{
-public:
+ public:
StringWithLang() { }
- StringWithLang(DPL::String s): string(s) { }
- StringWithLang(DPL::String s, DPL::String l): string(s), lang(l) { }
- DPL::String getString() { return this->string; }
- DPL::String getLang() { return this->lang; }
- bool hasLang() { return !this->lang.empty(); }
-private:
+ StringWithLang(DPL::String s) : string(s) { }
+ StringWithLang(DPL::String s, DPL::String l) : string(s), lang(l) { }
+ DPL::String getString()
+ {
+ return this->string;
+ }
+ DPL::String getLang()
+ {
+ return this->lang;
+ }
+ bool hasLang()
+ {
+ return !this->lang.empty();
+ }
+
+ private:
DPL::String string;
DPL::String lang;
};
/**
* These types are basicaly strings but they should allow usage of different
* range of characters or words (details in XML spec.).
- * For simplicity DPL::Strings are used, although this can lead to XML validation
+ * For simplicity DPL::Strings are used, although this can lead to XML
+ * validation
* errors (related to usage of not allowed characters in given places).
*/
typedef DPL::String NcnameType, NmtokenType, AnySimpleType, LangType;
void writeElement(xmlTextWriterPtr writer, const char * name, DPL::String body);
void writeText(xmlTextWriterPtr writer, DPL::String text);
void writeElement(xmlTextWriterPtr writer, const char * name, const char * body);
-void writeElementWithOneAttribute(xmlTextWriterPtr writer, const char * name,
- const char * body, const char * nameAttr, DPL::String bodyAttr,
- bool condition = true);
+void writeElementWithOneAttribute(xmlTextWriterPtr writer,
+ const char * name,
+ const char * body,
+ const char * nameAttr,
+ DPL::String bodyAttr,
+ bool condition = true);
void startElement(xmlTextWriterPtr writer, const char * name);
void endElement(xmlTextWriterPtr writer);
void writeAttribute(xmlTextWriterPtr writer, const char * name,
- DPL::String body, bool condition);
+ DPL::String body, bool condition);
void writeAttribute(xmlTextWriterPtr writer, const char * name,
- const char * body, bool condition);
+ const char * body, bool condition);
/**
* @brief author element
*/
class Author
{
-public:
+ public:
Author() {}
Author(AnySimpleType e,
- NcnameType h,
- LangType l,
- DPL::String b)
- : email(e), href(h), lang(l), body(b) {}
+ NcnameType h,
+ LangType l,
+ DPL::String b) :
+ email(e), href(h), lang(l), body(b) {}
void serialize(xmlTextWriterPtr writer);
-private:
+
+ private:
AnySimpleType email;
NcnameType href;
LangType lang;
*/
class AppControl
{
-public:
+ public:
AppControl() {}
- void addOperation(const OperationType &x) { this->operation.push_back(x); }
- void addUri(const UriType &x) { this->uri.push_back(x); }
- void addMime(const MimeType &x) { this->mime.push_back(x); }
+ void addOperation(const OperationType &x)
+ {
+ this->operation.push_back(x);
+ }
+ void addUri(const UriType &x)
+ {
+ this->uri.push_back(x);
+ }
+ void addMime(const MimeType &x)
+ {
+ this->mime.push_back(x);
+ }
void serialize(xmlTextWriterPtr writer);
-private:
+
+ private:
std::list<OperationType> operation; //attr name AnySimpleType
std::list<UriType> uri; //attr name AnySimpleType
std::list<MimeType> mime; //attr name AnySimpleType
*/
class ImeApplication
{
-public:
+ public:
ImeApplication() {}
- void setAppid(const NcnameType &x) { this->appid = x; }
- void setExec(const NcnameType &x) { this->exec = x; }
- void setMultiple(bool x) { this->multiple = x; }
- void setNodisplay(bool x) { this->nodisplay = x; }
- void setType(const TypeType &x) { this->type = x; }
- void addLabel(const LabelType &x) { this->label.push_back(x); }
- void addIcon(const IconType &x) { this->icon.push_back(x); }
+ void setAppid(const NcnameType &x)
+ {
+ this->appid = x;
+ }
+ void setExec(const NcnameType &x)
+ {
+ this->exec = x;
+ }
+ void setMultiple(bool x)
+ {
+ this->multiple = x;
+ }
+ void setNodisplay(bool x)
+ {
+ this->nodisplay = x;
+ }
+ void setType(const TypeType &x)
+ {
+ this->type = x;
+ }
+ void addLabel(const LabelType &x)
+ {
+ this->label.push_back(x);
+ }
+ void addIcon(const IconType &x)
+ {
+ this->icon.push_back(x);
+ }
void serialize(xmlTextWriterPtr writer);
-private:
+
+ private:
NcnameType appid;
NcnameType exec;
DPL::OptionalBool multiple;
*/
class ServiceApplication
{
-public:
+ public:
ServiceApplication() {}
- void setAppid(const NcnameType &x) { this->appid = x; }
- void setAutoRestart(bool x) { this->autoRestart = x; }
- void setExec(const AnySimpleType &x) { this->exec = x; }
- void setOnBoot(bool x) { this->onBoot = x; }
- void setType(const TypeType &x) { this->type = x; }
- void addLabel(const LabelType &x) { this->label.push_back(x); }
- void addIcon(const IconType &x) { this->icon.push_back(x); }
+ void setAppid(const NcnameType &x)
+ {
+ this->appid = x;
+ }
+ void setAutoRestart(bool x)
+ {
+ this->autoRestart = x;
+ }
+ void setExec(const AnySimpleType &x)
+ {
+ this->exec = x;
+ }
+ void setOnBoot(bool x)
+ {
+ this->onBoot = x;
+ }
+ void setType(const TypeType &x)
+ {
+ this->type = x;
+ }
+ void addLabel(const LabelType &x)
+ {
+ this->label.push_back(x);
+ }
+ void addIcon(const IconType &x)
+ {
+ this->icon.push_back(x);
+ }
void addAppControl(const AppControlType &x)
{
this->appControl.push_back(x);
}
void serialize(xmlTextWriterPtr writer);
-private:
+
+ private:
NcnameType appid;
DPL::OptionalBool autoRestart;
AnySimpleType exec;
*/
class UiApplication
{
-public:
+ public:
UiApplication() {}
- void setAppid(const NcnameType &x) { this->appid = x; }
- void setExtraid(const NcnameType &x) { this->extraid = x; }
- void setExec(const AnySimpleType &x) { this->exec = x; }
- void setMultiple(bool x) { this->multiple = x; }
- void setNodisplay(bool x) { this->nodisplay = x; }
- void setTaskmanage(bool x) { this->taskmanage = x; }
- void setType(const TypeType &x) { this->type = x; }
- void setCategories(const NcnameType &x) { this->categories = x; }
- void addLabel(const LabelType &x) { this->label.push_back(x); }
- void addIcon(const IconType &x) { this->icon.push_back(x); }
+ void setAppid(const NcnameType &x)
+ {
+ this->appid = x;
+ }
+ void setExtraid(const NcnameType &x)
+ {
+ this->extraid = x;
+ }
+ void setExec(const AnySimpleType &x)
+ {
+ this->exec = x;
+ }
+ void setMultiple(bool x)
+ {
+ this->multiple = x;
+ }
+ void setNodisplay(bool x)
+ {
+ this->nodisplay = x;
+ }
+ void setTaskmanage(bool x)
+ {
+ this->taskmanage = x;
+ }
+ void setType(const TypeType &x)
+ {
+ this->type = x;
+ }
+ void setCategories(const NcnameType &x)
+ {
+ this->categories = x;
+ }
+ void addLabel(const LabelType &x)
+ {
+ this->label.push_back(x);
+ }
+ void addIcon(const IconType &x)
+ {
+ this->icon.push_back(x);
+ }
void addAppControl(const AppControlType &x)
{
this->appControl.push_back(x);
this->appCategory.push_back(x);
}
void serialize(xmlTextWriterPtr writer);
-private:
+
+ private:
NcnameType appid;
NcnameType extraid;
AnySimpleType exec;
/**
* @brief LiveBox element
*/
-typedef std::list<std::pair<DPL::String, DPL::String>> boxSizeType;
-
+typedef std::list<std::pair<DPL::String, DPL::String> > boxSizeType;
struct BoxInfo
{
class LiveBox
{
-public:
+ public:
LiveBox() { }
- void setLiveboxId(const NcnameType &x) { this->liveboxId = x; }
- void setPrimary(const NcnameType &x) { this->primary = x; }
- void setAutoLaunch(const NcnameType &x) { this->autoLaunch = x; }
- void setUpdatePeriod(const NcnameType &x) { this->updatePeriod = x; }
- void setLabel(const NcnameType &x) { this->label = x; }
- void setIcon(const NcnameType &x) { this->icon = x; }
- void setBox(const BoxInfoType &x) { this->box = x; }
+ void setLiveboxId(const NcnameType &x)
+ {
+ this->liveboxId = x;
+ }
+ void setPrimary(const NcnameType &x)
+ {
+ this->primary = x;
+ }
+ void setAutoLaunch(const NcnameType &x)
+ {
+ this->autoLaunch = x;
+ }
+ void setUpdatePeriod(const NcnameType &x)
+ {
+ this->updatePeriod = x;
+ }
+ void setLabel(const NcnameType &x)
+ {
+ this->label = x;
+ }
+ void setIcon(const NcnameType &x)
+ {
+ this->icon = x;
+ }
+ void setBox(const BoxInfoType &x)
+ {
+ this->box = x;
+ }
void serialize(xmlTextWriterPtr writer);
-private:
+ private:
NcnameType liveboxId;
NcnameType primary;
NcnameType autoLaunch;
*/
class Manifest
{
-public:
+ public:
Manifest() {}
void serialize(xmlTextWriterPtr writer);
void generate(DPL::String filename);
- void addLabel(const LabelType &x) { this->label.push_back(x); }
- void addIcon(const IconType &x) { this->icon.push_back(x); }
- void addAuthor(const AuthorType &x) { this->author.push_back(x); };
+ void addLabel(const LabelType &x)
+ {
+ this->label.push_back(x);
+ }
+ void addIcon(const IconType &x)
+ {
+ this->icon.push_back(x);
+ }
+ void addAuthor(const AuthorType &x)
+ {
+ this->author.push_back(x);
+ }
void addDescription(const DescriptionType &x)
{
this->description.push_back(x);
}
-// void addCompatibility(const CompatibilityType &x)
-// {
-// this->compatibility.push_back(x);
-// }
-// void addDeviceProfile(const DeviceProfileType &x)
-// {
-// this->deviceProfile.push_back(x);
-// }
+ // void addCompatibility(const CompatibilityType &x)
+ // {
+ // this->compatibility.push_back(x);
+ // }
+ // void addDeviceProfile(const DeviceProfileType &x)
+ // {
+ // this->deviceProfile.push_back(x);
+ // }
void addServiceApplication(const ServiceApplicationType &x)
{
this->serviceApplication.push_back(x);
{
this->imeApplication.push_back(x);
}
-// void addFont(const FontType &x) { this->font.push_back(x); }
+ // void addFont(const FontType &x) { this->font.push_back(x); }
void addLivebox(const LiveBoxInfo &x)
{
{
this->installLocation = x;
}
- void setPackage(const NcnameType &x) { this->package = x; }
- void setType(const PackageType &x) { this->type = x; }
- void setVersion(const NmtokenType &x) { this->version = x; }
-private:
+ void setPackage(const NcnameType &x)
+ {
+ this->package = x;
+ }
+ void setType(const PackageType &x)
+ {
+ this->type = x;
+ }
+ void setVersion(const NmtokenType &x)
+ {
+ this->version = x;
+ }
+
+ private:
std::list<LabelType> label;
std::list<IconType> icon;
std::list<AuthorType> author;
std::list<DescriptionType> description;
-// std::list<CompatibilityType> compatibility;
-// std::list<DeviceProfileType> deviceProfile;
+ // std::list<CompatibilityType> compatibility;
+ // std::list<DeviceProfileType> deviceProfile;
std::list<ServiceApplicationType> serviceApplication;
std::list<UiApplicationType> uiApplication;
std::list<ImeApplicationType> imeApplication;
-// std::list<FontType> font;
+ // std::list<FontType> font;
std::list<LiveBoxInfo> livebox;
InstallLocationType installLocation;
NcnameType package;
PackageType type;
NmtokenType version;
};
-
} //namespace Jobs
} //namespace WidgetInstall
namespace Jobs {
namespace WidgetInstall {
-
TaskAceCheck::TaskAceCheck(InstallerContext& context) :
DPL::TaskDecl<TaskAceCheck>(this),
m_context(context)
std::string devCapStr = DPL::ToUTF8String(deviceCap);
ace_policy_result_t policyResult = ACE_DENY;
+
+ //TODO: remove dao.getHandle()
ace_return_t ret = ace_get_policy_result(
const_cast<const ace_resource_t>(devCapStr.c_str()),
- dao.getHandle(), //TODO: remove dao.getHandle()
+ dao.getHandle(),
&policyResult);
if (ACE_OK != ret) {
ThrowMsg(Exceptions::NotAllowed, "Instalation failure. "
- "ACE check failure");
+ "ACE check failure");
}
LogInfo("PolicyResult is : " << static_cast<int>(policyResult));
m_context.staticPermittedDevCaps.insert(std::make_pair(deviceCap,
- policyResult == ACE_PERMIT));
+ policyResult ==
+ ACE_PERMIT));
m_context.featureLogic->setAceResponse(policyResult != ACE_DENY);
}
{
WrtDB::WidgetDAO dao(m_context.widgetConfig.tzAppid);
if (m_context.widgetConfig.packagingType ==
- WrtDB::PKG_TYPE_HOSTED_WEB_APP) {
+ WrtDB::PKG_TYPE_HOSTED_WEB_APP)
+ {
return;
}
std::vector<std::string> devCaps;
std::vector<bool> devCapsSmack;
// Saving static dev cap permissions
- FOREACH (cap, m_context.staticPermittedDevCaps) {
+ FOREACH(cap, m_context.staticPermittedDevCaps) {
LogInfo("staticPermittedDevCaps : " << cap->first
- << " smack: " << cap->second);
+ << " smack: " << cap->second);
std::string devCapStr = DPL::ToUTF8String(cap->first);
devCaps.push_back(devCapStr);
devCapsSmack.push_back(cap->second);
for (unsigned int i = 0; i < devCaps.size(); ++i) {
list.items[i].device_capability =
- const_cast<const ace_resource_t>(devCaps[i].c_str());
+ const_cast<const ace_resource_t>(devCaps[i].c_str());
list.items[i].smack_granted =
- devCapsSmack[i] ? ACE_TRUE : ACE_FALSE;
+ devCapsSmack[i] ? ACE_TRUE : ACE_FALSE;
}
- ace_return_t ret = ace_set_requested_dev_caps(dao.getHandle(), //TODO: remove dao.getHandle()
+ //TODO: remove dao.getHandle()
+ ace_return_t ret = ace_set_requested_dev_caps(dao.getHandle(),
&list);
if (ACE_OK != ret) {
ThrowMsg(Exceptions::NotAllowed, "Instalation failure. "
- "ACE failure");
+ "ACE failure");
}
- delete [] list.items;
+ delete[] list.items;
std::set<std::string> acceptedFeature;
auto it = m_context.featureLogic->resultBegin();
- for (;it != m_context.featureLogic->resultEnd(); ++it) {
+ for (; it != m_context.featureLogic->resultEnd(); ++it) {
if (!(it->rejected)) {
acceptedFeature.insert(DPL::ToUTF8String(it->name));
}
featureList.count = acceptedFeature.size();
featureList.items = new ace_string_t[featureList.count];
- size_t i=0;
+ size_t i = 0;
for (std::set<std::string>::const_iterator iter = acceptedFeature.begin();
- iter != acceptedFeature.end(); ++iter) {
+ iter != acceptedFeature.end(); ++iter)
+ {
LogDebug("Accepted feature item: " << iter->c_str());
featureList.items[i] = const_cast<char *>(iter->c_str());
i++;
}
- ret = ace_set_accepted_feature(dao.getHandle(), &featureList); //TODO: remove dao.getHandle()
+ //TODO: remove dao.getHandle()
+ ret = ace_set_accepted_feature(dao.getHandle(), &featureList);
- delete [] featureList.items;
+ delete[] featureList.items;
if (ACE_OK != ret) {
LogError("Error in ace_set_feature");
ThrowMsg(Exceptions::NotAllowed, "Instalation failure. "
- "ace_set_feature failure.");
+ "ace_set_feature failure.");
}
return;
}
LogInfo("Checking ACE response");
if (m_context.featureLogic->isRejected()) {
LogError("Installation failure. Some devCap was not accepted by ACE.");
- ThrowMsg(Exceptions::NotAllowed, "Instalation failure. "
+ ThrowMsg(
+ Exceptions::NotAllowed,
+ "Instalation failure. "
"Some deviceCap was not accepted by ACE.");
}
LogInfo("Updating \"feature reject status\" in database!");
auto it = m_context.featureLogic->resultBegin();
auto end = m_context.featureLogic->resultEnd();
- for(;it != end; ++it){
- LogInfo(" |- Feature: " << it->name << " has reject status: " << it->rejected);
+ for (; it != end; ++it) {
+ LogInfo(
+ " |- Feature: " << it->name << " has reject status: " <<
+ it->rejected);
if (it->rejected) {
WrtDB::WidgetDAO dao(m_context.widgetConfig.tzAppid);
dao.updateFeatureRejectStatus(*it);
InstallerContext::INSTALL_ACE_CHECK,
"Widget Access Control Check Finished");
}
-
} //namespace WidgetInstall
} //namespace Jobs
namespace Jobs {
namespace WidgetInstall {
-
TaskCertificates::TaskCertificates(InstallerContext& context) :
DPL::TaskDecl<TaskCertificates>(this),
m_context(context)
if (pkgmgr_installer_create_certinfo_set_handle(&m_pkgHandle) < 0) {
LogError("pkgmgrInstallerCreateCertinfoSetHandle fail");
ThrowMsg(Exceptions::SetCertificateInfoFailed,
- "Failed to create certificate handle");
+ "Failed to create certificate handle");
}
SetCertiInfo(SIGNATURE_AUTHOR);
SetCertiInfo(SIGNATURE_DISTRIBUTOR);
if ((pkgmgr_installer_save_certinfo(
- const_cast<char*>(DPL::ToUTF8String(
- m_context.widgetConfig.tzPkgid).c_str()),
- m_pkgHandle)) < 0) {
+ const_cast<char*>(DPL::ToUTF8String(
+ m_context.widgetConfig.tzPkgid).c_str()),
+ m_pkgHandle)) < 0)
+ {
LogError("pkgmgrInstallerSaveCertinfo fail");
ThrowMsg(Exceptions::SetCertificateInfoFailed,
- "Failed to Installer Save Certinfo");
+ "Failed to Installer Save Certinfo");
} else {
LogDebug("Succeed to save Certinfo");
}
if (false == chain.load(*it)) {
LogError("Chain is broken");
ThrowMsg(Exceptions::SetCertificateInfoFailed,
- "Failed to Installer Save Certinfo");
+ "Failed to Installer Save Certinfo");
}
- if (!chain.sort()){
+ if (!chain.sort()) {
LogError("Chain failed at sorting");
}
ValidationCore::CertificateList list = chain.getCertificateList();
- FOREACH(certIt, list)
+ FOREACH(certIt, list)
{
pkgmgr_instcert_type instCertType;
if (source == SIGNATURE_DISTRIBUTOR) {
std::string
- Name(DPL::ToUTF8String(*(*certIt)->getOrganizationName()));
+ Name(DPL::ToUTF8String(*(*certIt)->getOrganizationName()));
size_t found = Name.find("Tizen");
if (found != std::string::npos) {
instCertType = PM_SET_DISTRIBUTOR2_ROOT_CERT;
} else {
if ((*certIt)->isCA()) {
- instCertType = PM_SET_DISTRIBUTOR2_INTERMEDIATE_CERT;
+ instCertType =
+ PM_SET_DISTRIBUTOR2_INTERMEDIATE_CERT;
} else {
instCertType = PM_SET_DISTRIBUTOR2_SIGNER_CERT;
}
}
}
LogDebug("cert type : " << instCertType);
- if((pkgmgr_installer_set_cert_value(
- m_pkgHandle,
- instCertType,
- const_cast<char*>(((*certIt)->getBase64()).c_str()))) < 0) {
+ if ((pkgmgr_installer_set_cert_value(
+ m_pkgHandle,
+ instCertType,
+ const_cast<char*>(((*certIt)->getBase64()).c_str()))) < 0)
+ {
LogError("pkgmgrInstallerSetCertValue fail");
ThrowMsg(Exceptions::SetCertificateInfoFailed,
- "Failed to Set CertValue");
+ "Failed to Set CertValue");
}
}
}
void TaskCertificates::StepAbortCertiInfo()
{
if ((pkgmgr_installer_delete_certinfo(
- const_cast<char*>(DPL::ToUTF8String(
- m_context.widgetConfig.tzPkgid).c_str()))) < 0) {
+ const_cast<char*>(DPL::ToUTF8String(
+ m_context.widgetConfig.tzPkgid).c_str()))) <
+ 0)
+ {
LogError("pkgmgr_installer_delete_certinfo fail");
}
}
-
} //namespace WidgetInstall
} //namespace Jobs
namespace Jobs {
namespace WidgetInstall {
-class TaskCertificates:
+class TaskCertificates :
public DPL::TaskDecl<TaskCertificates>,
public DPL::Event::ICDelegateSupport<TaskCertificates>
{
namespace {
const std::string LABEL_NEW_LINE = "<br>";
const std::string LABEL_NEW_LINE_2 = "<br><br>";
-const std::string UNTRUSTED_WIDGET ="It is an Untrusted Widget";
-const char *QUESTION ="Do you wanto to install?";
+const std::string UNTRUSTED_WIDGET = "It is an Untrusted Widget";
+const char *QUESTION = "Do you wanto to install?";
WidgetCertificateData toWidgetCertificateData(const SignatureData &data,
bool root)
}
Assert(certificate && !certificate->getCommonName().IsNull() &&
- "CommonName is Null");
+ "CommonName is Null");
result.strCommonName = *certificate->getCommonName();
// Block until fixed popup issues
if (!GlobalSettings::PopupsTestModeEnabled()
- && !m_installContext.m_quiet && !isTizenWebApp()) {
+ && !m_installContext.m_quiet && !isTizenWebApp())
+ {
AddStep(&TaskCertify::stepWarningPopup);
AddStep(&TaskCertify::stepWarningPopupAnswer);
AddStep(&TaskCertify::stepAuthorInfoPopup);
CertificateCollection collection;
collection.load(data.getCertList());
Assert(collection.sort() &&
- "Certificate collection can't sort");
+ "Certificate collection can't sort");
Assert(collection.isChain() &&
"Certificate collection is not able to create chain. "
"It is not possible to verify this signature.");
m_contextData.wacSecurity.getCertificateChainListRef().push_back(
- collection);
+ collection);
if (first) {
m_contextData.wacSecurity.getCertificateListRef().push_back(
"It is not possible to verify this signature.");
m_contextData.wacSecurity.getAuthorsCertificateChainListRef().push_back(
- collection);
+ collection);
FOREACH(it, dnsIdentity){
if (widgetId.matchHost(*it)) {
{
LogInfo("================ Step: <<Signature>> ENTER ===============");
- std::string widgetPath = m_contextData.locations->getTemporaryRootDir() + "/";
+ std::string widgetPath = m_contextData.locations->getTemporaryRootDir() +
+ "/";
SignatureFileInfoSet signatureFiles;
SignatureFinder signatureFinder(widgetPath);
xml.initialize(data, GlobalConfig::GetSignatureXmlSchema());
xml.read(data);
- WrtSignatureValidator::AppType appType = WrtSignatureValidator::WAC20;
+ WrtSignatureValidator::AppType appType =
+ WrtSignatureValidator::WAC20;
- if (m_installContext.widgetConfig.webAppType == APP_TYPE_TIZENWEBAPP) {
+ if (m_installContext.widgetConfig.webAppType ==
+ APP_TYPE_TIZENWEBAPP)
+ {
appType = WrtSignatureValidator::TIZEN;
}
WrtSignatureValidator::Result result;
if (m_contextData.widgetConfig.packagingType
- == WrtDB::PKG_TYPE_DIRECTORY_WEB_APP)
+ == WrtDB::PKG_TYPE_DIRECTORY_WEB_APP)
{
// In directory installation mode, the validation is skipped.
result = WrtSignatureValidator::SIGNATURE_VERIFIED;
- }
- else
- {
- WrtSignatureValidator validator(appType,
- !GlobalSettings::OCSPTestModeEnabled(),
- !GlobalSettings::CrlTestModeEnabled(),
- complianceMode);
+ } else {
+ WrtSignatureValidator validator(
+ appType,
+ !GlobalSettings::
+ OCSPTestModeEnabled(),
+ !GlobalSettings::
+ CrlTestModeEnabled(),
+ complianceMode);
result = validator.check(data, widgetPath);
}
m_contextData.wacSecurity.isDistributorSigned())
{
processAuthorSignature(data);
- } else if (result == WrtSignatureValidator::SIGNATURE_DISREGARD) {
+ } else if (result ==
+ WrtSignatureValidator::SIGNATURE_DISREGARD)
+ {
continue;
}
} else {
std::string realMEID;
TapiHandle *tapiHandle = tel_init(NULL);
char *meid = tel_get_misc_me_sn_sync(tapiHandle);
- if (meid)
- {
+ if (meid) {
realMEID = meid;
free(meid);
}
void TaskCertify::createInstallPopup(PopupType type, const std::string &label)
{
m_contextData.job->Pause();
- if(m_popup)
+ if (m_popup) {
destroyPopup();
+ }
bool ret = createPopup();
- if(ret)
- {
+ if (ret) {
loadPopup(type, label);
showPopup();
}
void TaskCertify::stepAuthorInfoPopup()
{
LogInfo("Step:: <<Author Popup Information>>");
- std::string label
- = createAuthorWidgetInfo() + LABEL_NEW_LINE_2 + QUESTION;
- createInstallPopup(PopupType::WIDGET_AUTHOR_INFO, label);
+ std::string label
+ = createAuthorWidgetInfo() + LABEL_NEW_LINE_2 + QUESTION;
+ createInstallPopup(PopupType::WIDGET_AUTHOR_INFO, label);
}
void TaskCertify::stepFinalize()
"Widget Certification Check Finished");
}
-
void TaskCertify::stepWarningPopupAnswer()
{
LogInfo("Step: <<Warning Popup Answer>>");
if (false == m_contextData.wacSecurity.isDistributorSigned() &&
- WRT_POPUP_BUTTON_CANCEL == m_installCancel)
+ WRT_POPUP_BUTTON_CANCEL == m_installCancel)
{
LogWarning("User does not agreed to install unsigned widgets!");
m_installCancel = WRT_POPUP_BUTTON;
void TaskCertify::stepAuthorInfoPopupAnswer()
{
LogInfo("Step: <<Author Info Popup Answer>>");
- if ( WRT_POPUP_BUTTON_CANCEL == m_installCancel) {
+ if (WRT_POPUP_BUTTON_CANCEL == m_installCancel) {
LogWarning("User does not agreed to install widget!");
m_installCancel = WRT_POPUP_BUTTON;
destroyPopup();
{
bool ret = FALSE;
if (m_installContext.widgetConfig.webAppType.appType
- == WrtDB::AppType::APP_TYPE_TIZENWEBAPP)
+ == WrtDB::AppType::APP_TYPE_TIZENWEBAPP)
+ {
ret = TRUE;
+ }
return ret;
}
void createInstallPopup(PopupType type, const std::string &label);
void processDistributorSignature(const ValidationCore::SignatureData &data,
- bool first);
+ bool first);
void processAuthorSignature(const ValidationCore::SignatureData &data);
std::string createAuthorWidgetInfo() const;
bool isTizenWebApp() const;
-
};
} //namespace WidgetInstall
} //namespace Jobs
namespace Jobs {
namespace WidgetInstall {
-
namespace {
-
const char * const TEMPORARY_PATH_POSTFIX = "temp";
const mode_t TEMPORARY_PATH_MODE = 0775;
-
} // namespace
-
std::string createTempPath(bool preload)
{
LogInfo("Step: Creating temporary path");
- // Temporary path
- std::ostringstream tempPathBuilder;
-
- if (preload) {
- tempPathBuilder << WrtDB::GlobalConfig::GetUserPreloadedWidgetPath();
- } else {
- tempPathBuilder << WrtDB::GlobalConfig::GetUserInstalledWidgetPath();
- }
- tempPathBuilder << WrtDB::GlobalConfig::GetTmpDirPath();
- tempPathBuilder << "/";
- tempPathBuilder << TEMPORARY_PATH_POSTFIX;
- tempPathBuilder << "_";
-
- timeval tv;
- gettimeofday(&tv, NULL);
- tempPathBuilder <<
- (static_cast<unsigned long long>(tv.tv_sec) * 1000000ULL +
- static_cast<unsigned long long>(tv.tv_usec));
-
- std::string tempPath = tempPathBuilder.str();
-
- // Remove old path if any
- struct stat fileInfo;
-
- if (stat(tempPath.c_str(), &fileInfo) == 0) {
- if(!WrtUtilRemove(tempPath)){
- ThrowMsg(Exceptions::RemovingFolderFailure,
- "Failed to to remove temporary directory");
- }
- }
- // Create new path
- if(!WrtUtilMakeDir(tempPath, TEMPORARY_PATH_MODE)){
- ThrowMsg(Exceptions::InternalError, "Failed to create temporary directory");
- }
-
- return tempPath;
+ // Temporary path
+ std::ostringstream tempPathBuilder;
+
+ if (preload) {
+ tempPathBuilder << WrtDB::GlobalConfig::GetUserPreloadedWidgetPath();
+ } else {
+ tempPathBuilder << WrtDB::GlobalConfig::GetUserInstalledWidgetPath();
+ }
+ tempPathBuilder << WrtDB::GlobalConfig::GetTmpDirPath();
+ tempPathBuilder << "/";
+ tempPathBuilder << TEMPORARY_PATH_POSTFIX;
+ tempPathBuilder << "_";
+
+ timeval tv;
+ gettimeofday(&tv, NULL);
+ tempPathBuilder <<
+ (static_cast<unsigned long long>(tv.tv_sec) * 1000000ULL +
+ static_cast<unsigned long long>(tv.tv_usec));
+
+ std::string tempPath = tempPathBuilder.str();
+
+ // Remove old path if any
+ struct stat fileInfo;
+
+ if (stat(tempPath.c_str(), &fileInfo) == 0) {
+ if (!WrtUtilRemove(tempPath)) {
+ ThrowMsg(Exceptions::RemovingFolderFailure,
+ "Failed to to remove temporary directory");
+ }
+ }
+ // Create new path
+ if (!WrtUtilMakeDir(tempPath, TEMPORARY_PATH_MODE)) {
+ ThrowMsg(Exceptions::InternalError,
+ "Failed to create temporary directory");
+ }
+
+ return tempPath;
}
void createTempPath(const std::string& path)
{
- if(!WrtUtilMakeDir(path, TEMPORARY_PATH_MODE)){
- ThrowMsg(Exceptions::InternalError, "Failed to create temporary directory");
- }
+ if (!WrtUtilMakeDir(path, TEMPORARY_PATH_MODE)) {
+ ThrowMsg(Exceptions::InternalError,
+ "Failed to create temporary directory");
+ }
}
-
} // WidgetInstall
} // Jobs
namespace Jobs {
namespace WidgetInstall {
-
//TODO make directory like jobs common?
std::string createTempPath(bool preload = false);
std::string createTempPath(bool preload);
void createTempPath(const std::string& path);
-
} // WidgetInstall
} // Jobs
-
#endif /* INSTALLER_CORE_JOS_WIDGET_INSTALL_TASK_COMMONS_H_ */
* @author Lukasz Wrzosek(l.wrzosek@samsung.com)
* @author Soyoung kim(sy037.kim@samsung.com)
* @version 1.0
- * @brief Implementation file for installer task database updating for widget update
+ * @brief Implementation file for installer task database updating for widget
+ * update
*/
#include <time.h>
#include <sys/stat.h>
namespace Jobs {
namespace WidgetInstall {
-
TaskDatabase::TaskDatabase(InstallerContext& context) :
DPL::TaskDecl<TaskDatabase>(this),
m_context(context),
/* Set install Time */
time(&m_context.widgetConfig.installedTime);
- if (m_context.existingWidgetInfo.isExist) //update
- {
+ if (m_context.existingWidgetInfo.isExist) { //update
LogInfo("Registering widget... (update)");
Try
{
m_handleToRemove = WidgetDAOReadOnly::getHandle(
- m_context.widgetConfig.tzAppid);
+ m_context.widgetConfig.tzAppid);
}
Catch(WidgetDAOReadOnly::Exception::WidgetNotExist)
{
- LogError("Given tizenId not found for update installation (Same GUID?)");
- ThrowMsg(Exceptions::InvalidPackage, "Given tizenId not found for update installation");
+ LogError(
+ "Given tizenId not found for update installation (Same GUID?)");
+ ThrowMsg(Exceptions::InvalidPackage,
+ "Given tizenId not found for update installation");
}
WidgetDAO::registerOrUpdateWidget(
- m_context.widgetConfig.tzAppid,
- m_context.widgetConfig,
- m_context.wacSecurity);
+ m_context.widgetConfig.tzAppid,
+ m_context.widgetConfig,
+ m_context.wacSecurity);
m_handle = WidgetDAOReadOnly::getHandle(
- m_context.widgetConfig.tzAppid);
- }
- else //new installation
- {
+ m_context.widgetConfig.tzAppid);
+ } else { //new installation
LogInfo("Registering widget...");
WidgetDAO::registerWidget(
- m_context.widgetConfig.tzAppid,
- m_context.widgetConfig,
- m_context.wacSecurity);
+ m_context.widgetConfig.tzAppid,
+ m_context.widgetConfig,
+ m_context.wacSecurity);
m_handle = WidgetDAOReadOnly::getHandle(
- m_context.widgetConfig.tzAppid);
+ m_context.widgetConfig.tzAppid);
}
- FOREACH (cap, m_context.staticPermittedDevCaps) {
- LogInfo("staticPermittedDevCaps : " << cap->first
- << " smack status: " << cap->second);
+ FOREACH(cap, m_context.staticPermittedDevCaps) {
+ LogInfo(
+ "staticPermittedDevCaps : " << cap->first
+ << " smack status: " <<
+ cap->second);
}
LogInfo("Widget registered");
if (ACE_OK != ace_unregister_widget(
static_cast<ace_widget_handle_t>(m_handleToRemove)))
{
- LogWarning("Error while removing ace entry for previous insallation");
- };
+ LogWarning(
+ "Error while removing ace entry for previous insallation");
+ }
}
- if(!AceApi::registerAceWidget(m_handle, m_context.widgetConfig,
- m_context.wacSecurity.getCertificateList()))
+ if (!AceApi::registerAceWidget(m_handle, m_context.widgetConfig,
+ m_context.wacSecurity.getCertificateList()))
{
LogError("ace database insert failed");
- ThrowMsg(Exceptions::UpdateFailed, "Update failure. ace_register_widget failed");
+ ThrowMsg(Exceptions::UpdateFailed,
+ "Update failure. ace_register_widget failed");
}
LogDebug("Ace data inserted");
void TaskDatabase::StepRegisterExternalFiles()
{
- WrtDB::ExternalLocationList externalLocationsUpdate = m_context.locations->listExternalLocations();
- if (m_context.existingWidgetInfo.isExist) //update
- {
+ WrtDB::ExternalLocationList externalLocationsUpdate =
+ m_context.locations->listExternalLocations();
+ if (m_context.existingWidgetInfo.isExist) { //update
Try
{
WidgetDAO dao(m_context.widgetConfig.tzAppid);
- WrtDB::ExternalLocationList externalLocationsDB = dao.getWidgetExternalLocations();
+ WrtDB::ExternalLocationList externalLocationsDB =
+ dao.getWidgetExternalLocations();
FOREACH(file, externalLocationsDB)
{
- if(std::find(externalLocationsUpdate.begin(), externalLocationsUpdate.end(), *file) == externalLocationsUpdate.end())
+ if (std::find(externalLocationsUpdate.begin(),
+ externalLocationsUpdate.end(),
+ *file) == externalLocationsUpdate.end())
{
m_externalLocationsToRemove.push_back(*file);
}
}
Catch(WidgetDAOReadOnly::Exception::WidgetNotExist)
{
- LogError("Given tizenId not found for update installation (Same GUID?)");
- ThrowMsg(Exceptions::UpdateFailed, "Given tizenId not found for update installation");
+ LogError(
+ "Given tizenId not found for update installation (Same GUID?)");
+ ThrowMsg(Exceptions::UpdateFailed,
+ "Given tizenId not found for update installation");
}
}
LogDebug("Registering external files:");
void TaskDatabase::StepRemoveExternalFiles()
{
- if(!m_externalLocationsToRemove.empty())
- {
+ if (!m_externalLocationsToRemove.empty()) {
LogDebug("Removing external files:");
}
FOREACH(file, m_externalLocationsToRemove)
{
- if(WrtUtilFileExists(*file))
- {
+ if (WrtUtilFileExists(*file)) {
LogDebug(" -> " << *file);
if (-1 == TEMP_FAILURE_RETRY(remove(file->c_str()))) {
ThrowMsg(Exceptions::RemovingFileFailure,
"Failed to remove external file");
}
- }
- else if(WrtUtilDirExists(*file))
- {
+ } else if (WrtUtilDirExists(*file)) {
LogDebug(" -> " << *file);
- if(!WrtUtilRemove(*file)){
+ if (!WrtUtilRemove(*file)) {
ThrowMsg(Exceptions::RemovingFolderFailure,
- "Failed to remove external directory");
+ "Failed to remove external directory");
}
- }
- else
- {
+ } else {
LogWarning(" -> " << *file << "(no such a path)");
}
}
command << " \"" << static_cast<int>((*it).second) << "\"";
int ret = system(command.str().c_str());
if (-1 == ret) {
- ThrowMsg(Exceptions::CreateVconfFailure, "Failed to create vconf files");
+ ThrowMsg(Exceptions::CreateVconfFailure,
+ "Failed to create vconf files");
}
}
}
ace_unregister_widget(static_cast<ace_widget_handle_t>(m_handle));
// Remove also old one. If it was already updated nothing wrong will happen,
// but if not old widget will be removed.
- if (INVALID_WIDGET_HANDLE != m_handleToRemove)
+ if (INVALID_WIDGET_HANDLE != m_handleToRemove) {
ace_unregister_widget(static_cast<ace_widget_handle_t>(m_handle));
+ }
}
void TaskDatabase::StepLiveboxDBInsert()
std::string tizenId = DPL::ToUTF8String(m_context.widgetConfig.tzAppid);
for (auto it = m_context.widgetConfig.configInfo.m_livebox.begin();
- it != m_context.widgetConfig.configInfo.m_livebox.end(); ++it)
+ it != m_context.widgetConfig.configInfo.m_livebox.end(); ++it)
{
std::string boxId = DPL::ToUTF8String((**it).m_liveboxId);
std::string boxType;
int ret =
web_provider_info_insert_box_type(
- boxId.c_str(), tizenId.c_str(), boxType.c_str());
+ boxId.c_str(), tizenId.c_str(), boxType.c_str());
if (ret < 0) {
LogDebug("failed to set type of livebox: " << boxId);
}
}
}
-
} //namespace WidgetInstall
} //namespace Jobs
namespace Jobs {
namespace WidgetInstall {
-class TaskDatabase:
+class TaskDatabase :
public DPL::TaskDecl<TaskDatabase>
{
private:
LogDebug("Step Encrypt resource");
m_resEnc = new ResourceEncryptor;
m_resEnc->CreateEncryptionKey(DPL::ToUTF8String(m_context.
- widgetConfig.tzAppid));
+ widgetConfig.tzAppid));
EncryptDirectory(m_context.locations->getTemporaryRootDir());
}
{
FTS *fts;
FTSENT *ftsent;
- char * const paths[] = {const_cast<char * const>(path.c_str()), NULL};
+ char * const paths[] = { const_cast<char * const>(path.c_str()), NULL };
- if ((fts = fts_open(paths, FTS_PHYSICAL|FTS_NOCHDIR, NULL)) == 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));
+ << strerror(error));
ThrowMsg(Exceptions::InternalError, "Error reading directory: "
- << path);
+ << path);
}
while ((ftsent = fts_read(fts)) != NULL) {
switch (ftsent->fts_info) {
- case FTS_DP:
- case FTS_DC:
- case FTS_D:
- case FTS_DEFAULT:
- case FTS_SLNONE:
- //directories, non-regular files, dangling symbolic links
- break;
- case FTS_F:
- case FTS_NSOK:
- case FTS_SL:
- //regular files and other objects that can be counted
- if (isSupportedForEncryption(ftsent->fts_path)) {
- EncryptFile(ftsent->fts_path);
- }
- 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));
- ThrowMsg(Exceptions::InternalError, "Error reading file");
+ case FTS_DP:
+ case FTS_DC:
+ case FTS_D:
+ case FTS_DEFAULT:
+ case FTS_SLNONE:
+ //directories, non-regular files, dangling symbolic links
+ break;
+ case FTS_F:
+ case FTS_NSOK:
+ case FTS_SL:
+ //regular files and other objects that can be counted
+ if (isSupportedForEncryption(ftsent->fts_path)) {
+ EncryptFile(ftsent->fts_path);
+ }
+ 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));
+ ThrowMsg(Exceptions::InternalError, "Error reading file");
}
}
if (fts_close(fts) == -1) {
int error = errno;
LogWarning(__PRETTY_FUNCTION__ << ": fts_close failed with error: "
- << strerror(error));
+ << strerror(error));
}
}
struct stat buf;
int ret = stat(fileName.c_str(), &buf);
- if(ret == 0) {
+ if (ret == 0) {
size_t fileSize = buf.st_size;
FILE* resFp = fopen(fileName.c_str(), "r");
- if ( NULL == resFp) {
+ if (NULL == resFp) {
LogError("Couldnot open file : " << fileName);
return;
}
memset(outEncBuf, 0, blockSize);
ret = fread(readBuf, sizeof(unsigned char), fileSize, resFp);
- if (ret!=fileSize){
- LogError("Failed to read ecryption buffer with error: " << strerror(errno) );
+ if (ret != fileSize) {
+ LogError(
+ "Failed to read ecryption buffer with error: " <<
+ strerror(errno) );
fclose(resFp);
- return;
+ return;
}
m_resEnc->EncryptChunk(readBuf, outEncBuf, fileSize);
}
std::string realPath = fileName;
- realPath.replace(0, m_context.locations->getTemporaryRootDir().length(),
- m_context.locations->getSourceDir());
+ realPath.replace(0,
+ m_context.locations->getTemporaryRootDir().length(),
+ m_context.locations->getSourceDir());
WrtDB::EncryptedFileInfo info;
info.fileName = DPL::FromUTF8String(realPath);
namespace Jobs {
namespace WidgetInstall {
-
class TaskEncryptResource : public DPL::TaskDecl<TaskEncryptResource>
{
-private:
+ private:
// Installation context
InstallerContext &m_context;
std::string tempInstalledPath;
public:
explicit TaskEncryptResource(InstallerContext &installerContext);
};
-
} // namespace WidgetInstall
} // namespace Jobs
#endif /* SRC_JOBS_WIDGET_INSTALL_TASK_ENCRYPT_RESOURCE_H_ */
}
if (S_ISDIR(statInfo.st_mode)) {
- if(("." == fileName) || (".." == fileName)) {
+ if (("." == fileName) || (".." == fileName)) {
continue;
}
std::string destFolder = dest + "/" + fileName;
outfile.close();
infile.close();
}
- } while(dEntry);
+ } while (dEntry);
closedir(dir);
return true;
}
m_context(context)
{
if (INSTALL_LOCATION_TYPE_EXTERNAL !=
- m_context.locationType) {
+ m_context.locationType)
+ {
AddStep(&TaskFileManipulation::StepCreateDirs);
AddStep(&TaskFileManipulation::StepCreatePrivateStorageDir);
if (m_context.widgetConfig.packagingType !=
- WrtDB::PKG_TYPE_DIRECTORY_WEB_APP)
+ WrtDB::PKG_TYPE_DIRECTORY_WEB_APP)
{
AddStep(&TaskFileManipulation::StepRenamePath);
AddAbortStep(&TaskFileManipulation::StepAbortRenamePath);
std::string storagePath = m_context.locations->getPrivateStorageDir();
if (euidaccess(storagePath.c_str(), F_OK) != 0) {
- if(!WrtUtilMakeDir(storagePath, PRIVATE_STORAGE_MODE)){
+ if (!WrtUtilMakeDir(storagePath, PRIVATE_STORAGE_MODE)) {
LogError("Failed to create directory for private storage");
ThrowMsg(Exceptions::InternalError,
- "Failed to create directory for private storage");
+ "Failed to create directory for private storage");
}
// '5000' is default uid, gid for applications.
- // So installed applications should be launched as process of uid '5000'.
+ // So installed applications should be launched as process of uid
+ // '5000'.
// the process can access private directory 'data' of itself.
- if(chown(storagePath.c_str(),
- WEBAPP_DEFAULT_UID,
- WEBAPP_DEFAULT_GID) != 0)
+ if (chown(storagePath.c_str(),
+ WEBAPP_DEFAULT_UID,
+ WEBAPP_DEFAULT_GID) != 0)
{
ThrowMsg(Exceptions::InternalError,
- "Chown to invaild user");
+ "Chown to invaild user");
}
} else if (euidaccess(storagePath.c_str(), W_OK | R_OK | X_OK) == 0) {
LogInfo("Private storage already exists.");
// Even if private directory already is created, private dircetory
// should change owner.
- if(chown(storagePath.c_str(),
- WEBAPP_DEFAULT_UID,
- WEBAPP_DEFAULT_GID) != 0)
+ if (chown(storagePath.c_str(),
+ WEBAPP_DEFAULT_UID,
+ WEBAPP_DEFAULT_GID) != 0)
{
ThrowMsg(Exceptions::InternalError,
- "Chown to invaild user");
+ "Chown to invaild user");
}
- if(chmod(storagePath.c_str(), PRIVATE_STORAGE_MODE) != 0) {
+ if (chmod(storagePath.c_str(), PRIVATE_STORAGE_MODE) != 0) {
ThrowMsg(Exceptions::InternalError,
- "chmod to 0700");
+ "chmod to 0700");
}
-
} else {
ThrowMsg(Exceptions::InternalError,
"No access to private storage.");
LogDebug("Copy file from temp directory to " << instDir);
if (!WrtUtilRemove(instDir)) {
ThrowMsg(Exceptions::RemovingFolderFailure,
- "Error occurs during removing existing folder");
+ "Error occurs during removing existing folder");
}
- if (!(rename(m_context.locations->getTemporaryPackageDir().c_str(), instDir.c_str()) == 0)) {
+ if (!(rename(m_context.locations->getTemporaryPackageDir().c_str(),
+ instDir.c_str()) == 0))
+ {
ThrowMsg(Exceptions::UnknownError,
- "Error occurs during renaming widget folder");
+ "Error occurs during renaming widget folder");
}
m_context.job->UpdateProgress(
InstallerContext::INSTALL_RENAME_PATH,
widgetPath = m_context.locations->getPackageInstallationDir();
if (!WrtUtilRemove(widgetPath)) {
ThrowMsg(Exceptions::RemovingFolderFailure,
- "Error occurs during removing existing folder");
+ "Error occurs during removing existing folder");
}
}
LogDebug("Rename widget path sucessful!");
GList *list = NULL;
app2ext_dir_details* dirDetail = NULL;
- std::string dirNames[2] = {GLIST_RES_DIR, GLIST_BIN_DIR};
+ std::string dirNames[2] = { GLIST_RES_DIR, GLIST_BIN_DIR };
for (int i = 0; i < 2; i++) {
dirDetail = (app2ext_dir_details*) calloc(1,
- sizeof(app2ext_dir_details));
+ sizeof(
+ app2ext_dir_details));
if (NULL == dirDetail) {
- ThrowMsg(Exceptions::ErrorExternalInstallingFailure, "error in app2ext");
+ ThrowMsg(Exceptions::ErrorExternalInstallingFailure,
+ "error in app2ext");
}
dirDetail->name = strdup(dirNames[i].c_str());
dirDetail->type = APP2EXT_DIR_RO;
if (false == m_context.existingWidgetInfo.isExist) {
WidgetInstallToExtSingleton::Instance().preInstallation(list,
- folderSize);
+ folderSize);
} else {
WidgetInstallToExtSingleton::Instance().preUpgrade(list,
- folderSize);
+ folderSize);
}
free(dirDetail);
g_list_free(list);
}
- Catch (WidgetInstallToExt::Exception::ErrorInstallToExt)
+ Catch(WidgetInstallToExt::Exception::ErrorInstallToExt)
{
- ReThrowMsg(Exceptions::ErrorExternalInstallingFailure, "Error during \
+ ReThrowMsg(Exceptions::ErrorExternalInstallingFailure,
+ "Error during \
create external folder ");
}
}
{
LogDebug("StepInstallExternal");
if (!WrtUtilMakeDir(m_context.locations->getSourceDir())) {
- ThrowMsg(Exceptions::ErrorExternalInstallingFailure, "To make src \
+ ThrowMsg(Exceptions::ErrorExternalInstallingFailure,
+ "To make src \
directory failed");
}
LogDebug("Resource move to external storage " <<
- m_context.locations->getSourceDir());
+ m_context.locations->getSourceDir());
if (!_FolderCopy(m_context.locations->getTemporaryPackageDir(),
- m_context.locations->getSourceDir()))
+ m_context.locations->getSourceDir()))
{
ThrowMsg(Exceptions::UnknownError,
- "Error occurs during renaming widget folder");
+ "Error occurs during renaming widget folder");
}
}
LogInfo("Step: installation for osp service");
std::ostringstream commStr;
- commStr << OSP_INSTALL_STR << BashUtils::escape_arg(m_context.locations->getPackageInstallationDir());
+ commStr << OSP_INSTALL_STR << BashUtils::escape_arg(
+ m_context.locations->getPackageInstallationDir());
//commStr << " 2>&1";
LogDebug("osp install command : " << commStr.str());
fd = popen(commStr.str().c_str(), "r");
if (NULL == fd) {
LogError("Failed to installtion osp service");
- ThrowMsg(Exceptions::InstallOspsvcFailed, "Error occurs during\
+ ThrowMsg(Exceptions::InstallOspsvcFailed,
+ "Error occurs during\
install osp service");
}
fgets(readBuf, MAX_BUF_SIZE, fd);
int result = atoi(readBuf);
if (0 != result) {
- ThrowMsg(Exceptions::InstallOspsvcFailed, "Error occurs during\
+ ThrowMsg(Exceptions::InstallOspsvcFailed,
+ "Error occurs during\
install osp service");
}
namespace Jobs {
namespace WidgetInstall {
-
class TaskInstallOspsvc : public DPL::TaskDecl<TaskInstallOspsvc>
{
-private:
+ private:
// Installation context
InstallerContext &m_context;
// return callback
static int StatusCallback(
- int req_id, const char *pkg_type, const char *pkg_name,
- const char *key, const char *val, const void *pmsg,
- void *priv_data);
+ int req_id, const char *pkg_type, const char *pkg_name,
+ const char *key, const char *val, const void *pmsg,
+ void *priv_data);
public:
explicit TaskInstallOspsvc(InstallerContext &installerContext);
};
-
} // namespace WidgetInstall
} // namespace Jobs
#endif /* SRC_JOBS_WIDGET_INSTALL_TASK_INSTALL_OSPSVC_H_ */
{
LanguageTagMap map;
-#define ADD(tag, l_tag) map.insert(std::make_pair(L ## # tag, L ## # l_tag));
+#define ADD(tag, l_tag) map.insert(std::make_pair(L###tag, L###l_tag));
#include "languages.def"
#undef ADD
namespace Jobs {
namespace WidgetInstall {
-
const char * TaskManifestFile::encoding = "UTF-8";
TaskManifestFile::TaskManifestFile(InstallerContext &inCont) :
AddAbortStep(&TaskManifestFile::stepAbortParseManifest);
} else {
- // for widget update.
+ // for widget update.
AddStep(&TaskManifestFile::stepBackupIconFiles);
AddStep(&TaskManifestFile::stepCopyIconFiles);
AddStep(&TaskManifestFile::stepGenerateManifest);
}
TaskManifestFile::~TaskManifestFile()
-{
-}
+{}
void TaskManifestFile::stepCreateExecFile()
{
//which there is at least one icon in widget for, icon file is copied.
//Coping prioritize last positions when coping. If there is several icons
//with given locale, the one, that will be copied, will be icon
- //which is declared by <icon> tag later than the others in config.xml of widget
+ //which is declared by <icon> tag later than the others in config.xml of
+ // widget
std::vector<Locale> generatedLocales;
- WrtDB::WidgetRegisterInfo::LocalizedIconList & icons = m_context.widgetConfig.localizationData.icons;
+ WrtDB::WidgetRegisterInfo::LocalizedIconList & icons =
+ m_context.widgetConfig.localizationData.icons;
- //reversed: last <icon> has highest priority to be copied if it has given locale (TODO: why was that working that way?)
- for(WrtDB::WidgetRegisterInfo::LocalizedIconList::const_reverse_iterator icon = icons.rbegin(); icon != icons.rend(); icon++)
+ //reversed: last <icon> has highest priority to be copied if it has given
+ // locale (TODO: why was that working that way?)
+ for (WrtDB::WidgetRegisterInfo::LocalizedIconList::const_reverse_iterator
+ icon = icons.rbegin();
+ icon != icons.rend();
+ icon++)
{
FOREACH(locale, icon->availableLocales)
{
DPL::String src = icon->src;
LogDebug("Icon for locale: " << *locale << "is : " << src);
- if(std::find(generatedLocales.begin(), generatedLocales.end(), *locale) != generatedLocales.end())
+ if (std::find(generatedLocales.begin(), generatedLocales.end(),
+ *locale) != generatedLocales.end())
{
LogDebug("Skipping - has that locale");
continue;
- }
- else
- {
+ } else {
generatedLocales.push_back(*locale);
}
targetFile << GlobalConfig::GetUserWidgetDesktopIconPath() << "/";
targetFile << getIconTargetFilename(*locale);
-
if (m_context.widgetConfig.packagingType ==
- WrtDB::PKG_TYPE_HOSTED_WEB_APP) {
- m_context.locations->setIconTargetFilenameForLocale(targetFile.str());
+ WrtDB::PKG_TYPE_HOSTED_WEB_APP)
+ {
+ m_context.locations->setIconTargetFilenameForLocale(
+ targetFile.str());
}
LogDebug("Copying icon: " << sourceFile.str() <<
Catch(DPL::FileInput::Exception::Base)
{
// Error while opening or closing source file
- //ReThrowMsg(InstallerException::CopyIconFailed, sourceFile.str());
+ //ReThrowMsg(InstallerException::CopyIconFailed,
+ // sourceFile.str());
LogError(
- "Copying widget's icon failed. Widget's icon will not be"\
+ "Copying widget's icon failed. Widget's icon will not be" \
"available from Main Screen");
}
Catch(DPL::FileOutput::Exception::Base)
{
// Error while opening or closing target file
- //ReThrowMsg(InstallerException::CopyIconFailed, targetFile.str());
+ //ReThrowMsg(InstallerException::CopyIconFailed,
+ // targetFile.str());
LogError(
- "Copying widget's icon failed. Widget's icon will not be"\
+ "Copying widget's icon failed. Widget's icon will not be" \
"available from Main Screen");
}
Catch(DPL::CopyFailed)
{
// Error while copying
- //ReThrowMsg(InstallerException::CopyIconFailed, targetFile.str());
+ //ReThrowMsg(InstallerException::CopyIconFailed,
+ // targetFile.str());
LogError(
- "Copying widget's icon failed. Widget's icon will not be"\
+ "Copying widget's icon failed. Widget's icon will not be" \
"available from Main Screen");
}
}
Catch(DPL::FileInput::Exception::Base)
{
LogError("Restoration icon File Failed." << backup_file.str()
- << " to " << res_file.str());
+ << " to " << res_file.str());
}
Catch(DPL::FileOutput::Exception::Base)
{
LogError("Restoration icon File Failed." << backup_file.str()
- << " to " << res_file.str());
+ << " to " << res_file.str());
}
Catch(DPL::CopyFailed)
{
LogError("Restoration icon File Failed." << backup_file.str()
- << " to " << res_file.str());
+ << " to " << res_file.str());
}
}
}
}
DPL::String TaskManifestFile::getIconTargetFilename(
- const DPL::String& languageTag) const
+ const DPL::String& languageTag) const
{
DPL::OStringStream filename;
TizenAppId appid = m_context.widgetConfig.tzAppid;
filename << DPL::ToUTF8String(appid).c_str();
if (!languageTag.empty()) {
- DPL::OptionalString tag = getLangTag(languageTag); // translate en -> en_US etc
- if (tag.IsNull()) { tag = languageTag; }
+ DPL::OptionalString tag = getLangTag(languageTag); // translate en ->
+ // en_US etc
+ if (tag.IsNull()) {
+ tag = languageTag;
+ }
DPL::String locale =
LanguageTagsProvider::BCP47LanguageTagToLocale(*tag);
- if(locale.empty()) {
+ if (locale.empty()) {
filename << L"." << languageTag;
} else {
filename << L"." << locale;
LogInfo("Finished ManifestFile step");
}
-
void TaskManifestFile::saveLocalizedKey(std::ofstream &file,
- const DPL::String& key,
- const DPL::String& languageTag)
+ const DPL::String& key,
+ const DPL::String& languageTag)
{
DPL::String locale =
- LanguageTagsProvider::BCP47LanguageTagToLocale(languageTag);
+ LanguageTagsProvider::BCP47LanguageTagToLocale(languageTag);
file << key;
if (!locale.empty()) {
FOREACH(it, fileList)
{
if (0 == (strncmp((*it).c_str(), appid.c_str(),
- strlen(appid.c_str())))) {
+ strlen(appid.c_str()))))
+ {
std::ostringstream icon_file, backup_icon;
icon_file << GlobalConfig::GetUserWidgetDesktopIconPath();
icon_file << "/" << (*it);
backup_icon << b_icon_dir.str() << "/" << (*it);
LogDebug("Backup icon file " << icon_file.str() << " to " <<
- backup_icon.str());
+ backup_icon.str());
Try
{
DPL::FileInput input(icon_file.str());
}
void TaskManifestFile::getFileList(const char* path,
- std::list<std::string> &list)
+ std::list<std::string> &list)
{
DIR* dir = opendir(path);
if (!dir) {
struct dirent* d_ent;
do {
if ((d_ent = readdir(dir))) {
- if(strcmp(d_ent->d_name, ".") == 0 ||
- strcmp(d_ent->d_name, "..") == 0) {
+ if (strcmp(d_ent->d_name, ".") == 0 ||
+ strcmp(d_ent->d_name, "..") == 0)
+ {
continue;
}
std::string file_name = d_ent->d_name;
list.push_back(file_name);
}
- }while(d_ent);
+ } while (d_ent);
if (-1 == TEMP_FAILURE_RETRY(closedir(dir))) {
LogError("Failed to close dir: " << path << " with error: "
- << DPL::GetErrnoString());
+ << DPL::GetErrnoString());
}
}
int code = pkgmgr_parser_parse_manifest_for_installation(
DPL::ToUTF8String(manifest_file).c_str(), NULL);
- if(code != 0)
- {
+ if (code != 0) {
LogError("Manifest parser error: " << code);
ThrowMsg(ManifestParsingError, "Parser returncode: " << code);
}
- // TODO : It will be removed. AIL update is temporary code request by pkgmgr team.
+ // TODO : It will be removed. AIL update is temporary code request by pkgmgr
+ // team.
updateAilInfo();
m_context.job->UpdateProgress(
int code = pkgmgr_parser_parse_manifest_for_upgrade(
DPL::ToUTF8String(manifest_file).c_str(), NULL);
- if(code != 0)
- {
+ if (code != 0) {
LogError("Manifest parser error: " << code);
ThrowMsg(ManifestParsingError, "Parser returncode: " << code);
}
- // TODO : It will be removed. AIL update is temporary code request by pkgmgr team.
+ // TODO : It will be removed. AIL update is temporary code request by pkgmgr
+ // team.
updateAilInfo();
m_context.job->UpdateProgress(
{
bool defaultNameSaved = false;
- DPL::OptionalString defaultLocale = m_context.widgetConfig.configInfo.defaultlocale;
- std::pair<DPL::String, WrtDB::ConfigParserData::LocalizedData> defaultLocalizedData;
+ DPL::OptionalString defaultLocale =
+ m_context.widgetConfig.configInfo.defaultlocale;
+ std::pair<DPL::String,
+ WrtDB::ConfigParserData::LocalizedData> defaultLocalizedData;
//labels
FOREACH(localizedData, m_context.widgetConfig.configInfo.localizedDataSet)
{
Locale i = localizedData->first;
DPL::OptionalString tag = getLangTag(i); // translate en -> en_US etc
- if (tag.IsNull())
- {
+ if (tag.IsNull()) {
tag = i;
}
DPL::OptionalString name = localizedData->second.name;
generateWidgetName(manifest, uiApp, tag, name, defaultNameSaved);
//store default locale localized data
- if(!!defaultLocale && defaultLocale == i)
- {
+ if (!!defaultLocale && defaultLocale == i) {
defaultLocalizedData = *localizedData;
}
}
- if (!!defaultLocale && !defaultNameSaved)
- {
+ if (!!defaultLocale && !defaultNameSaved) {
DPL::OptionalString name = defaultLocalizedData.second.name;
- generateWidgetName(manifest, uiApp, DPL::OptionalString::Null, name, defaultNameSaved);
+ generateWidgetName(manifest,
+ uiApp,
+ DPL::OptionalString::Null,
+ name,
+ defaultNameSaved);
}
//appid
TizenAppId appid = m_context.widgetConfig.tzAppid;
uiApp.setAppid(appid);
-
//extraid
- if(!!m_context.widgetConfig.guid) {
+ if (!!m_context.widgetConfig.guid) {
uiApp.setExtraid(*m_context.widgetConfig.guid);
} else {
- if(!appid.empty()) {
+ if (!appid.empty()) {
uiApp.setExtraid(DPL::String(L"http://") + appid);
}
}
manifest.setType(L"wgt");
}
-void TaskManifestFile::generateWidgetName(Manifest & manifest, UiApplication &uiApp, const DPL::OptionalString& tag, DPL::OptionalString name, bool & defaultNameSaved)
+void TaskManifestFile::generateWidgetName(Manifest & manifest,
+ UiApplication &uiApp,
+ const DPL::OptionalString& tag,
+ DPL::OptionalString name,
+ bool & defaultNameSaved)
{
if (!!name) {
- if (!!tag)
- {
+ if (!!tag) {
DPL::String locale =
- LanguageTagsProvider::BCP47LanguageTagToLocale(*tag);
+ LanguageTagsProvider::BCP47LanguageTagToLocale(*tag);
if (!locale.empty()) {
- uiApp.addLabel(LabelType(*name,*tag));
- }
- else
- {
+ uiApp.addLabel(LabelType(*name, *tag));
+ } else {
uiApp.addLabel(LabelType(*name));
manifest.addLabel(LabelType(*name));
}
- }
- else
- {
+ } else {
defaultNameSaved = true;
uiApp.addLabel(LabelType(*name));
manifest.addLabel(LabelType(*name));
//changes.
bool defaultIconSaved = false;
- DPL::OptionalString defaultLocale = m_context.widgetConfig.configInfo.defaultlocale;
+ DPL::OptionalString defaultLocale =
+ m_context.widgetConfig.configInfo.defaultlocale;
std::vector<Locale> generatedLocales;
- WrtDB::WidgetRegisterInfo::LocalizedIconList & icons = m_context.widgetConfig.localizationData.icons;
-
- //reversed: last <icon> has highest priority to be writen to manifest if it has given locale (TODO: why was that working that way?)
- for(WrtDB::WidgetRegisterInfo::LocalizedIconList::const_reverse_iterator icon = icons.rbegin(); icon != icons.rend(); icon++)
+ WrtDB::WidgetRegisterInfo::LocalizedIconList & icons =
+ m_context.widgetConfig.localizationData.icons;
+
+ //reversed: last <icon> has highest priority to be writen to manifest if it
+ // has given locale (TODO: why was that working that way?)
+ for (WrtDB::WidgetRegisterInfo::LocalizedIconList::const_reverse_iterator
+ icon = icons.rbegin();
+ icon != icons.rend();
+ icon++)
{
FOREACH(locale, icon->availableLocales)
{
- if(std::find(generatedLocales.begin(), generatedLocales.end(), *locale) != generatedLocales.end())
+ if (std::find(generatedLocales.begin(), generatedLocales.end(),
+ *locale) != generatedLocales.end())
{
LogDebug("Skipping - has that locale - already in manifest");
continue;
- }
- else
- {
+ } else {
generatedLocales.push_back(*locale);
}
- DPL::OptionalString tag = getLangTag(*locale); // translate en -> en_US etc
- if (tag.IsNull()) { tag = *locale; }
+ DPL::OptionalString tag = getLangTag(*locale); // translate en ->
+ // en_US etc
+ if (tag.IsNull()) {
+ tag = *locale;
+ }
generateWidgetIcon(uiApp, tag, *locale, defaultIconSaved);
}
}
- if (!!defaultLocale && !defaultIconSaved)
- {
+ if (!!defaultLocale && !defaultIconSaved) {
generateWidgetIcon(uiApp, DPL::OptionalString::Null,
DPL::String(),
defaultIconSaved);
}
}
-void TaskManifestFile::generateWidgetIcon(UiApplication & uiApp, const DPL::OptionalString& tag,
- const DPL::String& language, bool & defaultIconSaved)
+void TaskManifestFile::generateWidgetIcon(UiApplication & uiApp,
+ const DPL::OptionalString& tag,
+ const DPL::String& language,
+ bool & defaultIconSaved)
{
DPL::String locale;
- if (!!tag)
- {
+ if (!!tag) {
locale = LanguageTagsProvider::BCP47LanguageTagToLocale(*tag);
- }
- else
- {
+ } else {
defaultIconSaved = true;
}
DPL::String iconText;
iconText += getIconTargetFilename(language);
- if(!locale.empty())
- {
+ if (!locale.empty()) {
uiApp.addIcon(IconType(iconText, locale));
- }
- else
- {
+ } else {
uiApp.addIcon(IconType(iconText));
}
}
{
manifest.setPackage(m_context.widgetConfig.tzPkgid);
- if(!!m_context.widgetConfig.version)
- {
+ if (!!m_context.widgetConfig.version) {
manifest.setVersion(*m_context.widgetConfig.version);
}
DPL::String email = (!!m_context.widgetConfig.configInfo.authorEmail ?
- *m_context.widgetConfig.configInfo.authorEmail : L"");
+ *m_context.widgetConfig.configInfo.authorEmail : L"");
DPL::String href = (!!m_context.widgetConfig.configInfo.authorHref ?
- *m_context.widgetConfig.configInfo.authorHref : L"");
+ *m_context.widgetConfig.configInfo.authorHref : L"");
DPL::String name = (!!m_context.widgetConfig.configInfo.authorName ?
- *m_context.widgetConfig.configInfo.authorName : L"");
- manifest.addAuthor(Author(email,href,L"",name));
+ *m_context.widgetConfig.configInfo.authorName : L"");
+ manifest.addAuthor(Author(email, href, L"", name));
}
void TaskManifestFile::setWidgetOtherInfo(UiApplication & uiApp)
{
FOREACH(it, m_context.widgetConfig.configInfo.settingsList)
{
- if(!strcmp(DPL::ToUTF8String(it->m_name).c_str(), ST_NODISPLAY)) {
- if(!strcmp(DPL::ToUTF8String(it->m_value).c_str(), ST_TRUE)) {
+ if (!strcmp(DPL::ToUTF8String(it->m_name).c_str(), ST_NODISPLAY)) {
+ if (!strcmp(DPL::ToUTF8String(it->m_value).c_str(), ST_TRUE)) {
uiApp.setNodisplay(true);
uiApp.setTaskmanage(false);
- }
- else {
+ } else {
uiApp.setNodisplay(false);
uiApp.setTaskmanage(true);
}
- }
- }
+ }
+ }
//TODO
//There is no "X-TIZEN-PackageType=wgt"
- //There is no X-TIZEN-PackageID in manifest "X-TIZEN-PackageID=" << DPL::ToUTF8String(*widgetID).c_str()
+ //There is no X-TIZEN-PackageID in manifest "X-TIZEN-PackageID=" <<
+ // DPL::ToUTF8String(*widgetID).c_str()
//There is no Comment in pkgmgr "Comment=Widget application"
//that were in desktop file
}
void TaskManifestFile::setAppServiceInfo(UiApplication & uiApp)
{
- WrtDB::ConfigParserData::ServiceInfoList appServiceList = m_context.widgetConfig.configInfo.appServiceList;
+ WrtDB::ConfigParserData::ServiceInfoList appServiceList =
+ m_context.widgetConfig.configInfo.appServiceList;
if (appServiceList.empty()) {
LogInfo("Widget doesn't contain application service");
int code = pkgmgr_parser_parse_manifest_for_uninstallation(
DPL::ToUTF8String(manifest_file).c_str(), NULL);
- if (0 != code)
- {
+ if (0 != code) {
LogWarning("Manifest parser error: " << code);
ThrowMsg(ManifestParsingError, "Parser returncode: " << code);
}
int ret = unlink(DPL::ToUTF8String(manifest_file).c_str());
- if (0 != ret)
- {
+ if (0 != ret) {
LogWarning("No manifest file found: " << manifest_file);
}
}
DPL::String appid = m_context.widgetConfig.tzAppid;
size_t found;
- if(ConfigInfo->m_liveboxId != L"") {
+ if (ConfigInfo->m_liveboxId != L"") {
found = ConfigInfo->m_liveboxId.find_last_of(L".");
- if(found != std::string::npos) {
- if(0 == ConfigInfo->m_liveboxId.compare(0, found, appid))
+ if (found != std::string::npos) {
+ if (0 == ConfigInfo->m_liveboxId.compare(0, found, appid)) {
liveBox.setLiveboxId(ConfigInfo->m_liveboxId);
- else {
+ } else {
DPL::String liveboxId =
appid + DPL::String(L".") + ConfigInfo->m_liveboxId;
liveBox.setLiveboxId(liveboxId);
}
}
- if(ConfigInfo->m_primary != L"")
+ if (ConfigInfo->m_primary != L"") {
liveBox.setPrimary(ConfigInfo->m_primary);
+ }
- if(ConfigInfo->m_autoLaunch == L"true")
+ if (ConfigInfo->m_autoLaunch == L"true") {
liveBox.setAutoLaunch(appid);
+ }
- if(ConfigInfo->m_updatePeriod != L"")
+ if (ConfigInfo->m_updatePeriod != L"") {
liveBox.setUpdatePeriod(ConfigInfo->m_updatePeriod);
+ }
- if(ConfigInfo->m_label != L"")
+ if (ConfigInfo->m_label != L"") {
liveBox.setLabel(ConfigInfo->m_label);
+ }
DPL::String defaultLocale
- = DPL::FromUTF8String(m_context.locations->getPackageInstallationDir())
- + DPL::String(L"/res/wgt/");
+ = DPL::FromUTF8String(
+ m_context.locations->getPackageInstallationDir())
+ + DPL::String(L"/res/wgt/");
- if(ConfigInfo->m_icon!=L"") {
- liveBox.setIcon(defaultLocale+ConfigInfo->m_icon);
+ if (ConfigInfo->m_icon != L"") {
+ liveBox.setIcon(defaultLocale + ConfigInfo->m_icon);
}
- if (ConfigInfo->m_boxInfo.m_boxSrc.empty() || ConfigInfo->m_boxInfo.m_boxSize.empty()) {
+ if (ConfigInfo->m_boxInfo.m_boxSrc.empty() ||
+ ConfigInfo->m_boxInfo.m_boxSize.empty())
+ {
LogInfo("Widget doesn't contain box");
return;
} else {
BoxInfoType box;
if (!ConfigInfo->m_boxInfo.m_boxSrc.empty()) {
- if((0 == ConfigInfo->m_boxInfo.m_boxSrc.compare(0, 4, L"http"))
- || (0 == ConfigInfo->m_boxInfo.m_boxSrc.compare(0, 5, L"https")))
+ if ((0 == ConfigInfo->m_boxInfo.m_boxSrc.compare(0, 4, L"http"))
+ || (0 ==
+ ConfigInfo->m_boxInfo.m_boxSrc.compare(0, 5, L"https")))
+ {
box.boxSrc = ConfigInfo->m_boxInfo.m_boxSrc;
- else
+ } else {
box.boxSrc = defaultLocale + ConfigInfo->m_boxInfo.m_boxSrc;
+ }
}
if (ConfigInfo->m_boxInfo.m_boxMouseEvent == L"true") {
box.boxMouseEvent = L"false";
}
- std::list<std::pair<DPL::String,DPL::String>> BoxSizeList
+ std::list<std::pair<DPL::String, DPL::String> > BoxSizeList
= ConfigInfo->m_boxInfo.m_boxSize;
FOREACH(im, BoxSizeList) {
std::pair<DPL::String, DPL::String> boxSize = *im;
- if(!boxSize.second.empty())
+ if (!boxSize.second.empty()) {
boxSize.second = defaultLocale + boxSize.second;
+ }
box.boxSize.push_back(boxSize);
}
if (!ConfigInfo->m_boxInfo.m_pdSrc.empty()
- && !ConfigInfo->m_boxInfo.m_pdWidth.empty()
- && !ConfigInfo->m_boxInfo.m_pdHeight.empty()) {
+ && !ConfigInfo->m_boxInfo.m_pdWidth.empty()
+ && !ConfigInfo->m_boxInfo.m_pdHeight.empty())
+ {
box.pdSrc = defaultLocale + ConfigInfo->m_boxInfo.m_pdSrc;
box.pdWidth = ConfigInfo->m_boxInfo.m_pdWidth;
box.pdHeight = ConfigInfo->m_boxInfo.m_pdHeight;
}
manifest.addLivebox(liveBox);
}
-
}
-
} //namespace WidgetInstall
} //namespace Jobs
#include <dpl/wrt-dao-ro/widget_dao_read_only.h>
-
class InstallerContext;
namespace Jobs {
void stepAbortIconFiles();
//private data
- std::list<std::string> icon_list; //TODO: this should be registered as external files
+ std::list<std::string> icon_list; //TODO: this should be registered as
+ // external files
std::ostringstream backup_dir;
xmlTextWriterPtr writer;
DPL::String manifest_name;
void setAppCategory(UiApplication & uiApp);
void setLiveBoxInfo(Manifest& manifest);
- void generateWidgetName(Manifest & manifest, UiApplication &uiApp, const DPL::OptionalString& tag, DPL::OptionalString name, bool & defaultNameSaved);
- void generateWidgetIcon(UiApplication & uiApp, const DPL::OptionalString& tag, const DPL::String& language, bool & defaultIconSaved);
+ void generateWidgetName(Manifest & manifest,
+ UiApplication &uiApp,
+ const DPL::OptionalString& tag,
+ DPL::OptionalString name,
+ bool & defaultNameSaved);
+ void generateWidgetIcon(UiApplication & uiApp,
+ const DPL::OptionalString& tag,
+ const DPL::String& language,
+ bool & defaultIconSaved);
//for widget update
void backupIconFiles();
DPL::String getIconTargetFilename(const DPL::String& languageTag) const;
static void saveLocalizedKey(std::ofstream &file,
- const DPL::String& key,
- const DPL::String& languageTag);
+ const DPL::String& key,
+ const DPL::String& languageTag);
static const char * encoding;
-
};
} //namespace WidgetInstall
} //namespace Jobs
#endif
namespace {
- const std::string PackagePluginsDir = "/plugins/";
- const std::string InstallationPluginsDir = "/data/.netscape/plugins/";
- const mode_t InstallationPluginsDirMode = 0755;
+const std::string PackagePluginsDir = "/plugins/";
+const std::string InstallationPluginsDir = "/data/.netscape/plugins/";
+const mode_t InstallationPluginsDirMode = 0755;
}
namespace Jobs {
namespace WidgetInstall {
-
TaskPluginsCopy::TaskPluginsCopy(InstallerContext& context) :
DPL::TaskDecl<TaskPluginsCopy>(this),
m_context(context)
AddStep(&TaskPluginsCopy::StepCopyingFinished);
LogDebug("Widget plugins copy task ended");
m_npsource = m_context.locations->getSourceDir() + PackagePluginsDir
- + plugins_dir;
+ + plugins_dir;
m_npdestination = m_context.locations->getPackageInstallationDir()
- + InstallationPluginsDir;
+ + InstallationPluginsDir;
}
void TaskPluginsCopy::StepFindPlugins()
LogDebug("Starting plugins finding step");
/* Check whether plugins directory for actual architecture exists
* (plugins for other architectures are omitted even they exists). */
- if(!WrtUtilDirExists(m_npsource)) {
- LogDebug("Plugins directory (" <<m_npsource
- <<") does not exists - skipping copy step");
+ if (!WrtUtilDirExists(m_npsource)) {
+ LogDebug(
+ "Plugins directory (" << m_npsource
+ <<
+ ") does not exists - skipping copy step");
SwitchToStep(&TaskPluginsCopy::StepCopyingFinished);
return;
}
struct stat st;
LogDebug("Opening plugins directory");
dir = opendir(m_npsource.c_str());
- if(dir == NULL) {
+ if (dir == NULL) {
LogError("Unable to open plugins directory");
ThrowMsg(Exceptions::InternalError, "Unable to read plugins directory");
}
std::string tempname;
const std::string ext(".so");
/* Listing directory and checking entries found inside */
- while ((entry = readdir(dir)) != NULL){
+ while ((entry = readdir(dir)) != NULL) {
tempname = m_npsource + "/" + entry->d_name;
- if(lstat(tempname.c_str(), &st) != 0) {
- LogWarning("Failed to call \"lstat\" (errno:" <<errno
- <<") on entry - skipping");
+ if (lstat(tempname.c_str(), &st) != 0) {
+ LogWarning(
+ "Failed to call \"lstat\" (errno:" << errno
+ <<
+ ") on entry - skipping");
continue;
}
/* Directories other than "." and ".." should not be found*/
- if(S_ISDIR(st.st_mode)){
- if(strncmp(entry->d_name, "..", 2)!=0
- && strncmp(entry->d_name, ".", 1)!=0) {
+ if (S_ISDIR(st.st_mode)) {
+ if (strncmp(entry->d_name, "..", 2) != 0
+ && strncmp(entry->d_name, ".", 1) != 0)
+ {
LogError("Directory detected instead of plugin file: "
- << entry->d_name);
+ << entry->d_name);
/* Subdirectories inside plugins/ARCH are not supported */
if (-1 == TEMP_FAILURE_RETRY(closedir(dir))) {
- LogError("Failed to close dir: " << m_npsource
- << " with error: " << DPL::GetErrnoString());
+ LogError(
+ "Failed to close dir: " << m_npsource
+ << " with error: " <<
+ DPL::GetErrnoString());
}
- ThrowMsg(Exceptions::PluginsSubdirectory,
- "Subdirectories inside plugins directory are not supported");
- }
- else {
+ ThrowMsg(
+ Exceptions::PluginsSubdirectory,
+ "Subdirectories inside plugins directory are not supported");
+ } else {
continue;
}
}
tempname = std::string(entry->d_name);
/* Check whether file extension is ".so" */
- if(tempname.compare(tempname.size()-ext.size(), ext.size(), ext) == 0) {
+ if (tempname.compare(tempname.size() - ext.size(), ext.size(),
+ ext) == 0)
+ {
/* Plugin file found */
- LogDebug("Plugin file found: " <<tempname);
+ LogDebug("Plugin file found: " << tempname);
m_nplugins.push_back(tempname);
- }
- else {
+ } else {
/* Non-.so file found in plugins directory- skipping */
- LogWarning("Non-plugin file found: " <<tempname);
+ LogWarning("Non-plugin file found: " << tempname);
}
}
if (-1 == TEMP_FAILURE_RETRY(closedir(dir))) {
LogError("Failed to close dir: " << m_npsource << " with error: "
- << DPL::GetErrnoString());
+ << DPL::GetErrnoString());
}
/* If no .so files found (list is empty) abort taks*/
- if(m_nplugins.empty()) {
+ if (m_nplugins.empty()) {
LogError("No valid plugin files found");
ThrowMsg(Exceptions::EmptyPluginsDirectory, "No valid plugin found");
}
- LogDebug("Number of detected plugins: " <<m_nplugins.size());
+ LogDebug("Number of detected plugins: " << m_nplugins.size());
LogDebug("Plugins finding step ended");
}
/* Create new directory for plugins (data/.netscape/plugins/) */
LogDebug("Creating destination plugin directory");
- if(!WrtUtilMakeDir(m_npdestination, InstallationPluginsDirMode)){
+ if (!WrtUtilMakeDir(m_npdestination, InstallationPluginsDirMode)) {
LogError("Failed to create directory for plugins");
- ThrowMsg(Exceptions::InternalError, "Failed to create directory for plugins");
+ ThrowMsg(Exceptions::InternalError,
+ "Failed to create directory for plugins");
}
- LogDebug("Copying plugins to: " <<m_npdestination);
+ LogDebug("Copying plugins to: " << m_npdestination);
/* Copy plugins from widget package into
* .netscape/plugins in widget's target directory */
- for(std::list<std::string>::const_iterator it = m_nplugins.begin();
- it != m_nplugins.end(); it++) {
+ for (std::list<std::string>::const_iterator it = m_nplugins.begin();
+ it != m_nplugins.end(); it++)
+ {
LogDebug("Copying plugin file: " << (*it));
source = m_npsource + "/" + (*it);
destination = m_npdestination + (*it);
- if(rename(source.c_str(), destination.c_str()) != 0) {
- LogError("Failed to move " <<source <<" to " <<destination);
- LogError("(errno: " <<errno <<")");
+ if (rename(source.c_str(), destination.c_str()) != 0) {
+ LogError("Failed to move " << source << " to " << destination);
+ LogError("(errno: " << errno << ")");
ThrowMsg(Exceptions::InternalError, "Failed to copy plugin file");
}
}
LogDebug("Removing unnecessary directory: " << source);
/* Remove source directory with plugins (possibly for multiple
* architectures). */
- if(!WrtUtilRemove(source)){
+ if (!WrtUtilRemove(source)) {
LogError("Failed to plugins source remove directory");
- ThrowMsg(Exceptions::InternalError, "Failed to plugins source remove directory");
+ ThrowMsg(Exceptions::InternalError,
+ "Failed to plugins source remove directory");
}
LogDebug("Plugins copying step ended");
}
{
LogDebug("Plugins copy task finished");
}
-
} //namespace WidgetInstall
} //namespace Jobs
namespace WidgetInstall {
class TaskPluginsCopy : public DPL::TaskDecl<TaskPluginsCopy>
{
-public:
+ public:
TaskPluginsCopy(InstallerContext &context);
-private:
+
+ private:
/* Widget installer context */
InstallerContext &m_context;
/* Path to plugins directory in unpacked widget*/
namespace Jobs {
namespace WidgetInstall {
-
TaskPrepareFiles::TaskPrepareFiles(InstallerContext &installerContext) :
DPL::TaskDecl<TaskPrepareFiles>(this),
m_installerContext(installerContext)
void TaskPrepareFiles::CopyFile(const std::string& source)
{
- if(source.empty()) {
+ if (source.empty()) {
LogWarning("No source file specified");
return;
}
std::string filename = source;
- size_t last = source.find_last_of( "\\/" );
- if(last != std::string::npos) {
- filename = source.substr( last+1 );
+ size_t last = source.find_last_of("\\/");
+ if (last != std::string::npos) {
+ filename = source.substr(last + 1);
}
- std::string target = m_installerContext.locations->getTemporaryPackageDir() + '/' + filename;
+ std::string target =
+ m_installerContext.locations->getTemporaryPackageDir() + '/' +
+ filename;
LogDebug("source " << source);
LogDebug("target " << target);
{
CopyFile(m_installerContext.locations->getWidgetSource());
- size_t last = m_installerContext.locations->getWidgetSource().find_last_of("\\/");
+ size_t last = m_installerContext.locations->getWidgetSource().find_last_of(
+ "\\/");
std::string sourceDir = "";
if (last != std::string::npos) {
- sourceDir = m_installerContext.locations->getWidgetSource().substr(0,last+1);
+ sourceDir = m_installerContext.locations->getWidgetSource().substr(
+ 0,
+ last
+ + 1);
}
LogDebug("Icons copy...");
CopyFile(os.str());
}
}
-
} // namespace WidgetInstall
} // namespace Jobs
namespace Jobs {
namespace WidgetInstall {
-
class TaskPrepareFiles : public DPL::TaskDecl<TaskPrepareFiles>
{
-private:
+ private:
// Installation context
InstallerContext &m_installerContext;
public:
explicit TaskPrepareFiles(InstallerContext &installerContext);
};
-
} // namespace WidgetInstall
} // namespace Jobs
#endif /* SRC_JOBS_WIDGET_INSTALL_TASK_PREPARE_FILES_H_ */
std::ostringstream infoPath;
infoPath << GlobalConfig::GetTempInstallInfoPath();
infoPath << "/";
- infoPath << m_context.locations->getWidgetSource().substr(pos+1);
+ infoPath << m_context.locations->getWidgetSource().substr(pos + 1);
FILE *temp = fopen(infoPath.str().c_str(), "w+");
if (temp != NULL) {
namespace Jobs {
namespace WidgetInstall {
-
class TaskRecovery : public DPL::TaskDecl<TaskRecovery>
{
-private:
+ private:
// Installation context
InstallerContext &m_context;
public:
explicit TaskRecovery(InstallerContext &installerContext);
};
-
} // namespace WidgetInstall
} // namespace Jobs
#endif /* SRC_JOBS_WIDGET_INSTALL_TASK_RECOVERY_FILES_H_ */
InstallerContext::INSTALL_REMOVE_BACKUP_FILE,
"Backup widget file delete Finished");
}
-
} //namespace WidgetInstall
} //namespace Jobs
namespace Jobs {
namespace WidgetInstall {
-class TaskRemoveBackupFiles:
+class TaskRemoveBackupFiles :
public DPL::TaskDecl<TaskRemoveBackupFiles>
{
private:
FOREACH(it, m_context.staticPermittedDevCaps) {
if (it->second) {
std::string utf8 = DPL::ToUTF8String(it->first);
- if (it != m_context.staticPermittedDevCaps.begin())
+ if (it != m_context.staticPermittedDevCaps.begin()) {
devcaps << ",";
+ }
devcaps << utf8;
}
}
TizenAppId tzAppid = m_context.widgetConfig.tzAppid;
int result = handle_access_control_conf_forWAC(
- DPL::ToUTF8String(tzAppid).c_str(),
- devcaps.str().c_str(),
- OPERATION_INSTALL);
- Assert(result==PC_OPERATION_SUCCESS && "access control setup failed");
+ DPL::ToUTF8String(tzAppid).c_str(),
+ devcaps.str().c_str(),
+ OPERATION_INSTALL);
+ Assert(result == PC_OPERATION_SUCCESS && "access control setup failed");
m_context.job->UpdateProgress(
UninstallerContext::INSTALL_SMACK_ENABLE,
"Widget SMACK Enabled");
#endif
}
-
} //namespace WidgetInstall
} //namespace Jobs
namespace Jobs {
namespace WidgetInstall {
-class TaskSmack:
+class TaskSmack :
public DPL::TaskDecl<TaskSmack>,
public DPL::Event::ICDelegateSupport<TaskSmack>
{
std::string file;
PathAndFilePair(const std::string &p,
- const std::string &f) :
+ const std::string &f) :
path(p),
file(f)
- {
- }
+ {}
};
PathAndFilePair SplitFileAndPath(const std::string &filePath)
}
void TaskUnzip::ExtractFile(DPL::ZipInput::File *input,
- const std::string &destFileName)
+ const std::string &destFileName)
{
Try
{
Try
{
- m_zip.reset(new DPL::ZipInput(m_installerContext.locations->getWidgetSource()));
+ m_zip.reset(new DPL::ZipInput(m_installerContext.locations->
+ getWidgetSource()));
LogInfo("Widget package comment: " << m_zip->GetGlobalComment());
// Widget package must not be empty
if (m_zip->empty()) {
- ThrowMsg(Exceptions::ZipEmpty, m_installerContext.locations->getWidgetSource());
+ ThrowMsg(Exceptions::ZipEmpty,
+ m_installerContext.locations->getWidgetSource());
}
// Set iterator to first file
}
Catch(DPL::ZipInput::Exception::OpenFailed)
{
- ReThrowMsg(Exceptions::OpenZipFailed, m_installerContext.locations->getWidgetSource());
+ ReThrowMsg(Exceptions::OpenZipFailed,
+ m_installerContext.locations->getWidgetSource());
}
Catch(DPL::ZipInput::Exception::SeekFileFailed)
{
- ThrowMsg(Exceptions::ExtractFileFailed,"m_installerContext.locations->getWidgetSource()");
+ ThrowMsg(Exceptions::ExtractFileFailed,
+ "m_installerContext.locations->getWidgetSource()");
}
}
if (fileName[fileName.size() - 1] == '/') {
// This is path
- std::string newPath = m_installerContext.locations->getTemporaryPackageDir() + "/" +
+ std::string newPath =
+ m_installerContext.locations->getTemporaryPackageDir() + "/" +
fileName.substr(0, fileName.size() - 1);
LogPedantic("Path to extract: " << newPath);
} else {
// This is regular file
std::string fileExtractPath =
- m_installerContext.locations->getTemporaryPackageDir() + "/" + fileName;
+ m_installerContext.locations->getTemporaryPackageDir() + "/" +
+ fileName;
LogPedantic("File to extract: " << fileExtractPath);
// Done
LogInfo("Unzip finished");
}
-
} //namespace WidgetInstall
} //namespace Jobs
WRTEncryptor::ResourceEncryptor *m_resEnc;
void ExtractFile(DPL::ZipInput::File *input,
- const std::string &destFileName);
+ const std::string &destFileName);
void EncryptionFile(const std::string &fileName);
using namespace WrtDB;
namespace {
-
inline const char* GetWidgetBackupDirPath()
{
return "backup";
namespace Jobs {
namespace WidgetInstall {
-
TaskUpdateFiles::TaskUpdateFiles(InstallerContext& context) :
DPL::TaskDecl<TaskUpdateFiles>(this),
m_context(context)
std::string srcBuPath = m_context.locations->getBackupSourceDir();
LogDebug("backup resource directory path : " << srcBuPath);
- if(!WrtUtilMakeDir(srcBuPath)) {
- ThrowMsg(Exceptions::BackupFailed, "Error occurs during create \
+ if (!WrtUtilMakeDir(srcBuPath)) {
+ ThrowMsg(
+ Exceptions::BackupFailed,
+ "Error occurs during create \
backup directory.");
}
std::string binBuPath = m_context.locations->getBackupBinaryDir();
LogDebug("backup execution directory path : " << binBuPath);
- if(!WrtUtilMakeDir(binBuPath)) {
- ThrowMsg(Exceptions::BackupFailed, "Error occurs during create backup \
+ if (!WrtUtilMakeDir(binBuPath)) {
+ ThrowMsg(
+ Exceptions::BackupFailed,
+ "Error occurs during create backup \
directory.");
}
}
void TaskUpdateFiles::ReadDirList(std::string dirPath, ExistFileList &list,
- size_t subLen)
+ size_t subLen)
{
DIR* pkgDir = opendir(dirPath.c_str());
if (!pkgDir) {
LogError("Package directory " << dirPath << " doesn't exist");
- ThrowMsg(Exceptions::InternalError, "Error occurs during read \
+ ThrowMsg(Exceptions::InternalError,
+ "Error occurs during read \
directory");
}
}
if (S_ISDIR(statInfo.st_mode)) {
- if(strcmp(dirent->d_name, ".") == 0 || strcmp(dirent->d_name,
- "..") == 0) {
+ if (strcmp(dirent->d_name, ".") == 0 || strcmp(dirent->d_name,
+ "..") == 0)
+ {
continue;
}
ReadDirList(absFileName, list, subLen);
list.insert(absFileName.substr(subLen));
}
- }
- while(dirent);
+ } while (dirent);
//closing the directory
if (-1 == TEMP_FAILURE_RETRY(closedir(pkgDir))) {
LogError("Failed to close dir: " << dirPath << " with error: "
- << DPL::GetErrnoString());
+ << DPL::GetErrnoString());
}
}
ExistFileList tempList;
std::string pkgSrc = m_context.locations->getSourceDir();
- ReadDirList(pkgSrc, resList, strlen(pkgSrc.c_str())+1);
-
+ ReadDirList(pkgSrc, resList, strlen(pkgSrc.c_str()) + 1);
std::string tempSrc = m_context.locations->getTemporaryPackageDir();
- ReadDirList(tempSrc, tempList, strlen(tempSrc.c_str())+1);
+ ReadDirList(tempSrc, tempList, strlen(tempSrc.c_str()) + 1);
FOREACH(it, tempList) {
std::set<std::string>::iterator res;
res = resList.find(*it);
std::string resFile = pkgSrc + "/" + (*it);
- std::string newFile = tempSrc + "/" +(*it);
+ std::string newFile = tempSrc + "/" + (*it);
if (res != resList.end()) {
- std::string backupFile = m_context.locations->getBackupSourceDir() +
- "/"+ (*it);
+ std::string backupFile =
+ m_context.locations->getBackupSourceDir() +
+ "/" + (*it);
struct stat sInfo;
if (stat(resFile.c_str(), &sInfo) != 0) {
if (S_ISDIR(sInfo.st_mode)) {
LogDebug(resFile << " is a directory. so create a folder : " <<
- backupFile);
+ backupFile);
WrtUtilMakeDir(backupFile);
} else {
if ((rename(resFile.c_str(), backupFile.c_str())) != 0) {
- LogError("Failed to rename " << resFile << " to " << backupFile);
- ThrowMsg(Exceptions::BackupFailed, "Error occurs during \
+ LogError(
+ "Failed to rename " << resFile << " to " <<
+ backupFile);
+ ThrowMsg(
+ Exceptions::BackupFailed,
+ "Error occurs during \
rename file");
}
LogDebug("backup : " << resFile << " to " << backupFile);
if ((rename(newFile.c_str(), resFile.c_str())) != 0) {
- LogError("Failed to rename " << newFile << " to " << resFile);
- ThrowMsg(Exceptions::BackupFailed, "Error occurs during \
+ LogError(
+ "Failed to rename " << newFile << " to " << resFile);
+ ThrowMsg(
+ Exceptions::BackupFailed,
+ "Error occurs during \
rename file");
}
LogDebug("copy : " << newFile << " to " << resFile);
} else {
if ((rename(newFile.c_str(), resFile.c_str())) != 0) {
LogError("Failed to rename " << newFile << " to " << resFile);
- ThrowMsg(Exceptions::BackupFailed, "Error occurs during \
+ ThrowMsg(
+ Exceptions::BackupFailed,
+ "Error occurs during \
rename file");
}
LogDebug("only copy : " << newFile << " to " << resFile);
std::string backFile = tempSrc + "/" + (*remain);
if ((rename(pkgFile.c_str(), backFile.c_str())) != 0) {
LogError("Failed to backup : " << pkgFile << " to " << backFile);
- ThrowMsg(Exceptions::BackupFailed, "Error occurs during \
+ ThrowMsg(
+ Exceptions::BackupFailed,
+ "Error occurs during \
rename file");
}
LogDebug("only backup : " << pkgFile << " to " << backFile);
LogDebug(" source : " << execFile);
- std::string tempSource= m_context.locations->getBackupExecFile();
+ std::string tempSource = m_context.locations->getBackupExecFile();
LogDebug(" source : " << tempSource);
if ((rename(execFile.c_str(), tempSource.c_str())) != 0) {
LogError("Failed to rename " << execFile << " to " <<
- tempSource);
- ThrowMsg(Exceptions::BackupFailed, "Error occurs during \
+ tempSource);
+ ThrowMsg(Exceptions::BackupFailed,
+ "Error occurs during \
rename file");
}
LogDebug("Backup : " << execFile << " to " << tempSource);
LogDebug("Backup Folder " << srcBuPath << " to " << srcPath);
- if(!WrtUtilRemove(srcPath)) {
+ if (!WrtUtilRemove(srcPath)) {
LogError("Failed to remove " << srcPath);
}
LogDebug("StepAbortExecFileBackup");
std::string binPath = m_context.locations->getBinaryDir();
- if(!WrtUtilRemove(binPath)) {
+ if (!WrtUtilRemove(binPath)) {
LogError("Failed to remove " << binPath);
}
path << m_context.locations->getBackupDir();
LogDebug("Remove backup directory : " << path.str());
- if(!WrtUtilRemove(path.str())) {
+ if (!WrtUtilRemove(path.str())) {
LogError("Failed to remove " << path);
}
}
-
} //namespace WidgetInstall
} //namespace Jobs
#include <widget_parser.h>
#include <wrt_error.h>
-
namespace { // anonymous
const DPL::String BR = DPL::FromUTF8String("<br>");
const std::string WIDGET_NOT_COMPATIBLE = "This widget is "
- "not compatible with WRT.<br><br>";
+ "not compatible with WRT.<br><br>";
const std::string QUESTION = "Do you want to install it anyway?";
const char *const DEFAULT_LANGUAGE = "default";
const std::string WINDGET_INSTALL_NETWORK_ACCESS = "network access";
}
-
namespace Jobs {
namespace WidgetInstall {
void InstallerTaskWidgetPopupData::PopupData::addWidgetInfo(
- const DPL::String &info)
+ const DPL::String &info)
{
widgetInfo = info;
}
DPL::TaskDecl<TaskWidgetConfig>(this),
WidgetInstallPopup(installContext),
m_installContext(installContext)
-
{
AddStep(&TaskWidgetConfig::StepProcessConfigurationFile);
AddStep(&TaskWidgetConfig::ReadLocaleFolders);
AddStep(&TaskWidgetConfig::StepCheckMinVersionInfo);
if (!GlobalSettings::TestModeEnabled() && !m_installContext.m_quiet) {
- AddStep(&TaskWidgetConfig::StepCancelWidgetInstallationAfterVerifyFeatures);
+ AddStep(
+ &TaskWidgetConfig::
+ StepCancelWidgetInstallationAfterVerifyFeatures);
AddStep(&TaskWidgetConfig::StepShowWidgetInfo);
AddStep(&TaskWidgetConfig::StepCancelWidgetInstallation);
AddStep(&TaskWidgetConfig::StepCancelWidgetInstallationAfterMinVersion);
//Adding default locale
m_localeFolders.insert(L"");
- std::string localePath = m_installContext.locations->getConfigurationDir() + "/locales";
+ std::string localePath =
+ m_installContext.locations->getConfigurationDir() + "/locales";
DIR* localeDir = opendir(localePath.c_str());
if (!localeDir) {
LogDebug("No /locales directory in the widget package.");
}
}
}
- }
- while (dirent);
+ } while (dirent);
if (errno != 0) {
LogError("readdir() failed with " << DPL::GetErrnoString());
if (-1 == TEMP_FAILURE_RETRY(closedir(localeDir))) {
LogError("Failed to close dir: " << localePath << " with error: "
- << DPL::GetErrnoString());
+ << DPL::GetErrnoString());
}
}
ProcessStartFile(S(L"index.svg"), S(L"image/svg+xml"));
ProcessStartFile(S(L"index.xhtml"), S(L"application/xhtml+xml"));
ProcessStartFile(S(L"index.xht"), S(L"application/xhtml+xml"));
- // TODO: (l.wrzosek) we need better check if in current locales widget is valid.
+ // TODO: (l.wrzosek) we need better check if in current locales widget is
+ // valid.
FOREACH(it, m_installContext.widgetConfig.localizationData.startFiles) {
if (it->propertiesForLocales.size() > 0) {
return;
}
void TaskWidgetConfig::ProcessStartFile(const DPL::OptionalString& path,
- const DPL::OptionalString& type,
- const DPL::OptionalString& encoding,
- bool typeForcedInConfig)
+ const DPL::OptionalString& type,
+ const DPL::OptionalString& encoding,
+ bool typeForcedInConfig)
{
using namespace WrtDB;
DPL::String relativePath = pathPrefix + *path;
DPL::String absolutePath = DPL::FromUTF8String(
- m_installContext.locations->getConfigurationDir()) + L"/" + relativePath;
+ m_installContext.locations->getConfigurationDir()) + L"/" +
+ relativePath;
// get property data from packaged app
if (WrtUtilFileExists(DPL::ToUTF8String(absolutePath))) {
} else {
MimeTypeUtils::MimeAttributes attributes =
MimeTypeUtils::getMimeAttributes(
- startFileProperties.type);
+ startFileProperties.type);
if (attributes.count(L"charset") > 0) {
startFileProperties.encoding =
attributes[L"charset"];
// set property data for hosted start url
// Hosted start url only support TIZEN WebApp
if (m_installContext.widgetConfig.webAppType ==
- APP_TYPE_TIZENWEBAPP)
+ APP_TYPE_TIZENWEBAPP)
{
- std::string startPath = DPL::ToUTF8String(startFileData.path);
+ std::string startPath = DPL::ToUTF8String(
+ startFileData.path);
- if (strstr(startPath.c_str(), "http") == startPath.c_str()) {
+ if (strstr(startPath.c_str(),
+ "http") == startPath.c_str())
+ {
WidgetRegisterInfo::StartFileProperties
startFileProperties;
if (!!type) {
if (!!m_installContext.widgetConfig.configInfo.backgroundPage) {
// check whether file exists
DPL::String backgroundPagePath = DPL::FromUTF8String(
- m_installContext.locations->getConfigurationDir()) + L"/" +
+ m_installContext.locations->getConfigurationDir()) + L"/" +
*m_installContext.widgetConfig.configInfo.backgroundPage;
//if no then cancel installation
if (!WrtUtilFileExists(DPL::ToUTF8String(backgroundPagePath))) {
ThrowMsg(Exceptions::WidgetConfigFileInvalid,
- L"Given background page file not found in archive");
+ L"Given background page file not found in archive");
}
}
}
LogInfo("enter");
bool isAnyIconValid = false;
//In case a default filename is passed as custom filename in config.xml, we
- //need to keep a set of already processed filenames to avoid icon duplication
+ //need to keep a set of already processed filenames to avoid icon
+ // duplication
//in database.
using namespace WrtDB;
DPL::String relativePath = pathPrefix + icon.src;
DPL::String absolutePath = DPL::FromUTF8String(
- m_installContext.locations->getConfigurationDir()) + L"/" + relativePath;
+ m_installContext.locations->getConfigurationDir()) + L"/" +
+ relativePath;
if (WrtUtilFileExists(DPL::ToUTF8String(absolutePath))) {
DPL::String type = MimeTypeUtils::identifyFileMimeType(absolutePath);
}
}
- if(isAnyIconValid)
- {
+ if (isAnyIconValid) {
WidgetRegisterInfo::LocalizedIcon localizedIcon(icon,
localesAvailableForIcon);
m_installContext.widgetConfig.localizationData.icons.push_back(
{
LogDebug("ProcessWidgetInstalledPath");
m_installContext.widgetConfig.widgetInstalledPath =
- DPL::FromUTF8String(m_installContext.locations->getPackageInstallationDir());
+ DPL::FromUTF8String(
+ m_installContext.locations->getPackageInstallationDir());
}
void TaskWidgetConfig::StepCancelWidgetInstallationAfterVerifyFeatures()
}
}
-void TaskWidgetConfig::createInstallPopup(PopupType type, const std::string &label)
+void TaskWidgetConfig::createInstallPopup(PopupType type,
+ const std::string &label)
{
m_installContext.job->Pause();
- if (m_popup)
+ if (m_popup) {
destroyPopup();
+ }
bool ret = createPopup();
- if (ret)
- {
- loadPopup( type, label);
+ if (ret) {
+ loadPopup(type, label);
showPopup();
}
}
void TaskWidgetConfig::StepShowWidgetInfo()
{
if (!m_popupData.widgetInfo.empty()) {
- std::string label = DPL::ToUTF8String(m_popupData.widgetInfo);
- createInstallPopup(PopupType::WIDGET_FEATURE_INFO, label);
+ std::string label = DPL::ToUTF8String(m_popupData.widgetInfo);
+ createInstallPopup(PopupType::WIDGET_FEATURE_INFO, label);
m_installContext.job->UpdateProgress(
InstallerContext::INSTALL_WIDGET_CONFIG2,
"Show Widget Info Finished");
void TaskWidgetConfig::StepCheckMinVersionInfo()
{
if (!isMinVersionCompatible(
- m_installContext.widgetConfig.webAppType.appType,
- m_installContext.widgetConfig.minVersion)) {
- if(!GlobalSettings::TestModeEnabled() && !m_installContext.m_quiet)
- {
+ m_installContext.widgetConfig.webAppType.appType,
+ m_installContext.widgetConfig.minVersion))
+ {
+ if (!GlobalSettings::TestModeEnabled() && !m_installContext.m_quiet) {
LogDebug("Platform version to low - launching");
std::string label = WIDGET_NOT_COMPATIBLE + QUESTION;
createInstallPopup(PopupType::WIDGET_MIN_VERSION, label);
- }
- else
- {
- LogError("Platform version lower than required -> cancelling installation");
+ } else {
+ LogError(
+ "Platform version lower than required -> cancelling installation");
ThrowMsg(Exceptions::NotAllowed,
- "Platform version does not meet requirements");
+ "Platform version does not meet requirements");
}
}
m_installContext.job->UpdateProgress(
- InstallerContext::INSTALL_WIDGET_CONFIG2,
- "Check MinVersion Finished");
+ InstallerContext::INSTALL_WIDGET_CONFIG2,
+ "Check MinVersion Finished");
}
void TaskWidgetConfig::StepVerifyFeatures()
ThrowMsg(
Exceptions::WidgetConfigFileInvalid,
"This app type [" <<
- m_installContext.widgetConfig.webAppType.getApptypeToString() <<
+ m_installContext.widgetConfig.webAppType.getApptypeToString()
+ <<
"] cannot be allowed to use [" <<
DPL::ToUTF8String(it->name) + "] feature");
}
if (!WrtDB::FeatureDAOReadOnly::isFeatureInstalled(
- DPL::ToUTF8String(it->name))) {
+ DPL::ToUTF8String(it->name)))
+ {
LogWarning("Feature not found. Checking if required :[" <<
DPL::ToUTF8String(it->name) << "]");
* supported.
*/
std::ostringstream os;
- os << "Widget cannot be installed, required feature is missing:["
- << DPL::ToUTF8String(it->name) << "]";
+ 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);
+ createInstallPopup(PopupType::WIDGET_WRONG_FEATURE_INFO,
+ label);
}
ThrowMsg(Exceptions::WidgetConfigFileInvalid, os.str());
}
featureInfo += DPL::ToUTF8String(BR);
}
}
- if(!data.accessInfoSet.empty()) {
+ if (!data.accessInfoSet.empty()) {
featureInfo += WINDGET_INSTALL_NETWORK_ACCESS;
featureInfo += DPL::ToUTF8String(BR);
}
}
bool TaskWidgetConfig::parseVersionString(const std::string &version,
- long &majorVersion, long &minorVersion, long µVersion) const
+ long &majorVersion,
+ long &minorVersion,
+ long µVersion) const
{
std::istringstream inputString(version);
inputString >> majorVersion;
return true;
}
-bool TaskWidgetConfig::isMinVersionCompatible(WrtDB::AppType appType,
- const DPL::OptionalString &widgetVersion) const
+bool TaskWidgetConfig::isMinVersionCompatible(
+ WrtDB::AppType appType,
+ const DPL::OptionalString &
+ widgetVersion) const
{
- if (widgetVersion.IsNull() || (*widgetVersion).empty())
- {
+ if (widgetVersion.IsNull() || (*widgetVersion).empty()) {
LogWarning("minVersion attribute is empty. WRT assumes platform "
- "supports this widget.");
+ "supports this widget.");
return true;
}
//Parse widget version
long majorWidget = 0, minorWidget = 0, microWidget = 0;
if (!parseVersionString(DPL::ToUTF8String(*widgetVersion), majorWidget,
- minorWidget, microWidget)) {
+ minorWidget, microWidget))
+ {
LogWarning("Invalid format of widget version string.");
return true;
}
}
if (!parseVersionString(version,
- majorSupported, minorSupported, microSupported)) {
+ majorSupported, minorSupported, microSupported))
+ {
LogWarning("Invalid format of platform version string.");
return true;
}
if (majorWidget > majorSupported ||
- (majorWidget == majorSupported && minorWidget > minorSupported) ||
- (majorWidget == majorSupported && minorWidget == minorSupported
- && microWidget > microSupported))
+ (majorWidget == majorSupported && minorWidget > minorSupported) ||
+ (majorWidget == majorSupported && minorWidget == minorSupported
+ && microWidget > microSupported))
{
LogInfo("Platform doesn't support this widget.");
return false;
{
bool ret = FALSE;
if (m_installContext.widgetConfig.webAppType.appType
- == WrtDB::AppType::APP_TYPE_TIZENWEBAPP)
+ == WrtDB::AppType::APP_TYPE_TIZENWEBAPP)
+ {
ret = TRUE;
+ }
return ret;
}
-bool TaskWidgetConfig::parseConfigurationFileBrowser(WrtDB::ConfigParserData& configInfo,
- const std::string& _currentPath, int* pErrCode)
+bool TaskWidgetConfig::parseConfigurationFileBrowser(
+ WrtDB::ConfigParserData& configInfo,
+ const std::string&
+ _currentPath,
+ int* pErrCode)
{
ParserRunner parser;
Try
{
parser.Parse(_currentPath, ElementParserPtr(new
- RootParser<
- WidgetParser>(
- configInfo,
- DPL::FromUTF32String(
- L"widget"))));
+ RootParser<
+ WidgetParser>(
+ configInfo,
+ DPL::FromUTF32String(
+ L"widget"))));
}
Catch(ElementParser::Exception::Base)
{
return true;
}
-bool TaskWidgetConfig::parseConfigurationFileWidget(WrtDB::ConfigParserData& configInfo,
- const std::string& _currentPath, int* pErrCode)
+bool TaskWidgetConfig::parseConfigurationFileWidget(
+ WrtDB::ConfigParserData& configInfo,
+ const std::string&
+ _currentPath,
+ int* pErrCode)
{
ParserRunner parser;
}
bool has_config_xml = false;
errno = 0;
- while ((ptr = readdir(dir)) != NULL) { //Find configuration file, based on its name
+ while ((ptr = readdir(dir)) != NULL) { //Find configuration file, based on
+ // its name
if (ptr->d_type == DT_REG) {
if (!strcmp(ptr->d_name, WRT_WIDGET_CONFIG_FILE_NAME)) {
std::string dName(ptr->d_name);
// _rethrown_exception.Dump();
*pErrCode = WRT_WM_ERR_INVALID_ARCHIVE;
if (-1 == TEMP_FAILURE_RETRY(closedir(dir))) {
- LogError("Failed to close dir: " << _currentPath << " with error: "
- << DPL::GetErrnoString());
+ LogError(
+ "Failed to close dir: " << _currentPath <<
+ " with error: "
+ << DPL::GetErrnoString());
}
return false;
}
}
if (-1 == TEMP_FAILURE_RETRY(closedir(dir))) {
LogError("Failed to close dir: " << _currentPath << " with error: "
- << DPL::GetErrnoString());
+ << DPL::GetErrnoString());
}
//We must have config.xml so leaveing if we doesn't
}
bool TaskWidgetConfig::locateAndParseConfigurationFile(
- const std::string& _currentPath,
- WrtDB::WidgetRegisterInfo& pWidgetConfigInfo,
- const std::string& baseFolder,
- int* pErrCode)
+ const std::string& _currentPath,
+ WrtDB::WidgetRegisterInfo& pWidgetConfigInfo,
+ const std::string& baseFolder,
+ int* pErrCode)
{
using namespace WrtDB;
// check if this installation from browser, or not.
size_t pos = _currentPath.rfind("/");
std::ostringstream infoPath;
- infoPath << _currentPath.substr(pos+1);
+ infoPath << _currentPath.substr(pos + 1);
if (infoPath.str() != WRT_WIDGET_CONFIG_FILE_NAME) {
if (_currentPath.empty() || baseFolder.empty()) {
return false;
}
// in case of general installation using wgt archive
- if(!parseConfigurationFileWidget(configInfo, _currentPath, pErrCode))
+ if (!parseConfigurationFileWidget(configInfo, _currentPath,
+ pErrCode))
{
return false;
}
} else {
// in case of browser installation
- if(!parseConfigurationFileBrowser(configInfo, _currentPath, pErrCode))
+ if (!parseConfigurationFileBrowser(configInfo, _currentPath,
+ pErrCode))
{
return false;
}
}
- if(!fillWidgetConfig(pWidgetConfigInfo, configInfo))
- {
+ if (!fillWidgetConfig(pWidgetConfigInfo, configInfo)) {
*pErrCode = WRT_WM_ERR_INVALID_ARCHIVE;
return false;
}
return true;
}
-bool TaskWidgetConfig::fillWidgetConfig(WrtDB::WidgetRegisterInfo& pWidgetConfigInfo,
- WrtDB::ConfigParserData& configInfo)
+bool TaskWidgetConfig::fillWidgetConfig(
+ WrtDB::WidgetRegisterInfo& pWidgetConfigInfo,
+ WrtDB::ConfigParserData& configInfo)
{
if (!!configInfo.widget_id) {
if (!pWidgetConfigInfo.guid) {
}
}
if (!!configInfo.tizenAppId) {
- if(DPL::ToUTF8String(pWidgetConfigInfo.tzAppid).compare(
- DPL::ToUTF8String(*configInfo.tizenAppId)) < 0) {
- LogError("Invalid archive - Tizen App ID not same error");
- return false;
- }
+ if (DPL::ToUTF8String(pWidgetConfigInfo.tzAppid).compare(
+ DPL::ToUTF8String(*configInfo.tizenAppId)) < 0)
+ {
+ LogError("Invalid archive - Tizen App ID not same error");
+ return false;
+ }
}
if (!!configInfo.tizenPkgId) {
- if (pWidgetConfigInfo.tzPkgid != *configInfo.tizenPkgId) {
- LogError("Invalid archive - Tizen Pkg ID not same error");
- return false;
- }
+ if (pWidgetConfigInfo.tzPkgid != *configInfo.tizenPkgId) {
+ LogError("Invalid archive - Tizen Pkg ID not same error");
+ return false;
+ }
}
if (!!configInfo.version) {
if (!pWidgetConfigInfo.version) {
return true;
}
-void TaskWidgetConfig::processFile(const std::string& path,
- WrtDB::WidgetRegisterInfo &widgetConfiguration)
+void TaskWidgetConfig::processFile(
+ const std::string& path,
+ WrtDB::WidgetRegisterInfo &
+ widgetConfiguration)
{
int pErrCode;
if (!locateAndParseConfigurationFile(path, widgetConfiguration,
- DEFAULT_LANGUAGE, &pErrCode)) {
+ DEFAULT_LANGUAGE, &pErrCode))
+ {
LogWarning("Widget archive: Failed while parsing config file");
ThrowMsg(Exception::ConfigParseFailed, path);
}
}
-
} //namespace WidgetInstall
} //namespace Jobs
void StepProcessConfigurationFile();
void ReadLocaleFolders();
void ProcessLocalizedStartFiles();
- void ProcessStartFile(const DPL::OptionalString& path,
- const DPL::OptionalString& type,
- const DPL::OptionalString& encoding = DPL::OptionalString::Null,
- bool typeForcedInConfig = false);
+ void ProcessStartFile(
+ const DPL::OptionalString& path,
+ const DPL::OptionalString& type,
+ const DPL::OptionalString& encoding =
+ DPL::OptionalString::Null,
+ bool typeForcedInConfig = false);
void ProcessBackgroundPageFile();
void ProcessLocalizedIcons();
void ProcessIcon(const WrtDB::ConfigParserData::Icon& icon);
void createInstallPopup(PopupType type, const std::string &label);
DPL::String createAuthorWidgetInfo() const;
bool isFeatureAllowed(
- WrtDB::AppType appType, DPL::String featureName);
+ WrtDB::AppType appType, DPL::String featureName);
bool isMinVersionCompatible(
- WrtDB::AppType appType,
- const DPL::OptionalString &widgetVersion) const;
+ WrtDB::AppType appType,
+ const DPL::OptionalString &widgetVersion) const;
/**
* @brief Parses version string in format "major.minor.micro anything"
* Returns false if format is invalid
*/
bool isTizenWebApp() const;
bool parseVersionString(const std::string &version, long &majorVersion,
- long &minorVersion, long µVersion) const;
+ long &minorVersion, long µVersion) const;
/**
* This method is used to process the config.xml of widget, get
* the corresponding configuration to pWidgetConfigInfo
void processFile(const std::string& path,
WrtDB::WidgetRegisterInfo &wConfig);
- bool locateAndParseConfigurationFile(const std::string& currentPath,
- WrtDB::WidgetRegisterInfo& pWidgetConfigInfo,
- const std::string& baseFolder,
- int* pErrCode);
+ bool locateAndParseConfigurationFile(
+ const std::string& currentPath,
+ WrtDB::WidgetRegisterInfo&
+ pWidgetConfigInfo,
+ const std::string& baseFolder,
+ int* pErrCode);
bool parseConfigurationFileBrowser(WrtDB::ConfigParserData& configInfo,
- const std::string& _currentPath, int* pErrCode);
+ const std::string& _currentPath,
+ int* pErrCode);
bool parseConfigurationFileWidget(WrtDB::ConfigParserData& configInfo,
- const std::string& _currentPath, int* pErrCode);
+ const std::string& _currentPath,
+ int* pErrCode);
bool fillWidgetConfig(WrtDB::WidgetRegisterInfo& pWidgetConfigInfo,
- WrtDB::ConfigParserData& configInfo);
+ WrtDB::ConfigParserData& configInfo);
+
public:
TaskWidgetConfig(InstallerContext& installTaskContext);
};
namespace Jobs {
namespace WidgetInstall {
-
enum ViewMode
{
WINDOWED = 0,
MAXIMIZED,
MINIMIZED
};
-
} // WidgetInstall
} // Jobs
namespace Jobs {
namespace WidgetInstall {
-
void WacSecurity::getCertificateChainList(
- WrtDB::CertificateChainList& list,
- WrtDB::CertificateSource source) const
+ WrtDB::CertificateChainList& list,
+ WrtDB::CertificateSource source) const
{
- if (source == WrtDB::CertificateSource::SIGNATURE_DISTRIBUTOR){
+ if (source == WrtDB::CertificateSource::SIGNATURE_DISTRIBUTOR) {
FOREACH(certIter, mCertificateChainList)
- list.push_back(certIter->toBase64String());
+ list.push_back(certIter->toBase64String());
} else {
FOREACH(certIter, mAuthorsCertificateChainList)
- list.push_back(certIter->toBase64String());
+ list.push_back(certIter->toBase64String());
}
}
-
} // namespace WidgetInstall
} // namespace Jobs
namespace Jobs {
namespace WidgetInstall {
-
class WacSecurity : public WrtDB::IWacSecurity
{
public:
mRecognized(false),
mDistributorSigned(false),
mWacSigned(false)
- {
- }
+ {}
// from IWacSecurity
virtual const WrtDB::WidgetCertificateDataList& getCertificateList() const
return mCertificateList;
}
- virtual bool isRecognized() const { return mRecognized; }
+ virtual bool isRecognized() const
+ {
+ return mRecognized;
+ }
- virtual bool isDistributorSigned() const { return mDistributorSigned; }
+ virtual bool isDistributorSigned() const
+ {
+ return mDistributorSigned;
+ }
- virtual bool isWacSigned() const { return mWacSigned; }
+ virtual bool isWacSigned() const
+ {
+ return mWacSigned;
+ }
virtual void getCertificateChainList(
- WrtDB::CertificateChainList& list,
- WrtDB::CertificateSource source) const;
+ WrtDB::CertificateChainList& list,
+ WrtDB::CertificateSource source) const;
- void setRecognized(bool recognized) { mRecognized = recognized; }
+ void setRecognized(bool recognized)
+ {
+ mRecognized = recognized;
+ }
void setDistributorSigned(bool distributorSigned)
{
mDistributorSigned = distributorSigned;
}
- void setWacSigned(bool wacSigned) { mWacSigned = wacSigned; }
+ void setWacSigned(bool wacSigned)
+ {
+ mWacSigned = wacSigned;
+ }
- ValidationCore::CertificatePtr getAuthorCertificatePtr() const { return mAuthorCertificate;}
+ ValidationCore::CertificatePtr getAuthorCertificatePtr() const
+ {
+ return mAuthorCertificate;
+ }
ValidationCore::CertificateCollectionList& getCertificateChainListRef()
{
return mCertificateChainList;
}
- ValidationCore::CertificateCollectionList& getAuthorsCertificateChainListRef()
+ ValidationCore::CertificateCollectionList&
+ getAuthorsCertificateChainListRef()
{
return mAuthorsCertificateChainList;
}
// This authors certificates are used by tizen
ValidationCore::CertificateCollectionList mAuthorsCertificateChainList;
};
-
} // namespace WidgetInstall
} // namespace Jobs
// Installation state variables
WrtDB::WidgetRegisterInfo widgetConfig; ///< WidgetConfigInfo
DPL::Optional<WidgetLocation> locations;
- Jobs::WidgetInstall::WacSecurity wacSecurity;///< Widget Domain information.
+ Jobs::WidgetInstall::WacSecurity wacSecurity; ///< Widget Domain
+ // information.
InstallStep installStep; ///< current step of installation
Jobs::WidgetInstall::JobWidgetInstall *job;
- ///< pointer of instance of JobWidgetInstall
+ ///< pointer of instance of JobWidgetInstall
WidgetUpdateInfo::ExistingWidgetInfo existingWidgetInfo;
- ///< Whether this is an update or normal installation
+ ///< Whether this is an update or normal installation
Jobs::WidgetInstall::FeatureLogicPtr featureLogic;
/** List of dev-caps that are requested in widget config file.
- * Additional flag tells whether dev cap gets "static" permission
- * (will always have PERMIT from ACE Policy). They will therefore receive
- * static SMACK permission. (They may be forbidden because
- * of ACE User Settings, but for now we do not protect this
- * case with SMACK). */
+ * Additional flag tells whether dev cap gets "static" permission
+ * (will always have PERMIT from ACE Policy). They will therefore receive
+ * static SMACK permission. (They may be forbidden because
+ * of ACE User Settings, but for now we do not protect this
+ * case with SMACK). */
RequestedDevCapsMap staticPermittedDevCaps;
std::string installInfo; ///<For recovery>
bool m_quiet;
ErrorInvalidPackage, ///< Widget signature is invalid.
ErrorAlreadyInstalled, ///< ?
ErrorInternal, ///< ?
- ErrorNotAllowed, ///< Widget installation or update not allowed
+ ErrorNotAllowed, ///< Widget installation or update not
+ // allowed
///< because violation of policy ocurred
- ErrorDeferred, ///< Widget installation was deferred and will be continued when possible
+ ErrorDeferred, ///< Widget installation was deferred and
+ // will be continued when possible
ErrorDatabaseFailure, ///< Failure in database
- ErrorRemovingFolderFailure, ///< Failure in removing existing widget folder
+ ErrorRemovingFolderFailure, ///< Failure in removing existing widget
+ // folder
ErrorCreateVconfFailure, ///< Failure in creating vconf
ErrorInstallOspServcie, ///< Failure in installing osp service
ErrorUpdateWidget, ///< Failure in widget update.
DECLARE_JOB_EXCEPTION(Base, PluginsSubdirectory, ErrorInvalidWidgetPackage)
DECLARE_JOB_EXCEPTION(Base, SetCertificateInfoFailed, ErrorUnknown)
-
} //namespace
} //namespace
} //namespace
#include <widget_install_popup.h>
namespace {
-const char * const EDJFILE ="/usr/share/edje/wrt/widget_install_popup.edj";
+const char * const EDJFILE = "/usr/share/edje/wrt/widget_install_popup.edj";
const char * const EDJGROUP = "widget_install_popup";
-const char * const TITLE_TEXT ="title,text";
-const char * const name ="WidgetInstallPopup";
+const char * const TITLE_TEXT = "title,text";
+const char * const name = "WidgetInstallPopup";
const char * const FEATURE_TITLE = "Widget Feature Info";
const char * const INFO_TITLE = "Widget Info";
const char * const INSTALLATION_FAILURE = "Installation failure";
-const char * const INFO_LEFT_BUTTON ="OK";
+const char * const INFO_LEFT_BUTTON = "OK";
const char * const INFO_RIGHT_BUTTON = "CANCEL ";
const char * const WARNING_TITLE = "Widget Warning";
const char * const WARNING_LEFT_BUTTON = "YES";
const char * const WARNING_RIGHT_BUTTON = "NO";
-const char * const QUESTION ="Widget use Device API below. <br>Do you want to install?";
+const char * const QUESTION =
+ "Widget use Device API below. <br>Do you want to install?";
}
namespace Jobs {
{
int w, h;
m_win = elm_win_add(NULL, name, ELM_WIN_DIALOG_BASIC);
- if(!m_win)
- {
+ if (!m_win) {
LogError("addWin failed");
return false;
}
bool WidgetInstallPopup::addPopup()
{
m_popup = elm_popup_add(m_win);
- if(!m_popup)
+ if (!m_popup) {
return false;
+ }
evas_object_size_hint_align_set(m_popup, EVAS_HINT_FILL, EVAS_HINT_FILL);
- evas_object_size_hint_weight_set(m_popup, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_weight_set(m_popup,
+ EVAS_HINT_EXPAND,
+ EVAS_HINT_EXPAND);
return true;
}
void WidgetInstallPopup::addTitle(PopupType type)
{
switch (type) {
- case PopupType::WIDGET_FEATURE_INFO :
+ case PopupType::WIDGET_FEATURE_INFO:
elm_object_part_text_set(m_popup, TITLE_TEXT, FEATURE_TITLE);
- break;
- case PopupType::WIDGET_AUTHOR_INFO :
+ break;
+ case PopupType::WIDGET_AUTHOR_INFO:
elm_object_part_text_set(m_popup, TITLE_TEXT, INFO_TITLE);
- break;
- case PopupType::WIDGET_MIN_VERSION :
- case PopupType::WIDGET_UNRECOGNIZED :
+ break;
+ case PopupType::WIDGET_MIN_VERSION:
+ case PopupType::WIDGET_UNRECOGNIZED:
elm_object_part_text_set(m_popup, TITLE_TEXT, WARNING_TITLE);
- break;
- case PopupType::WIDGET_WRONG_FEATURE_INFO :
+ break;
+ case PopupType::WIDGET_WRONG_FEATURE_INFO:
elm_object_part_text_set(m_popup, TITLE_TEXT, INSTALLATION_FAILURE);
- break;
- default :
- break;
-}
+ break;
+ default:
+ break;
+ }
}
void WidgetInstallPopup::addScrollLabel(const std::string &str)
{
Evas_Object *ly = elm_layout_add(m_popup);
- if (!ly)
- {
+ if (!ly) {
LogError(" install popup layout add failed");
return;
}
elm_object_content_set(m_popup, ly);
Evas_Object *question_label = elm_label_add(m_popup);
- if(!question_label)
+ if (!question_label) {
return;
- evas_object_size_hint_align_set(question_label, EVAS_HINT_FILL, EVAS_HINT_FILL);
- evas_object_size_hint_weight_set(question_label, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ }
+ evas_object_size_hint_align_set(question_label,
+ EVAS_HINT_FILL,
+ EVAS_HINT_FILL);
+ evas_object_size_hint_weight_set(question_label,
+ EVAS_HINT_EXPAND,
+ EVAS_HINT_EXPAND);
evas_object_show(question_label);
elm_object_text_set(question_label, QUESTION);
elm_object_part_content_set(ly, "elm.swallow.label", question_label);
Evas_Object *scroller = elm_scroller_add(m_popup);
- if(!scroller)
+ if (!scroller) {
return;
+ }
evas_object_size_hint_align_set(scroller, EVAS_HINT_FILL, EVAS_HINT_FILL);
- evas_object_size_hint_weight_set(scroller, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_weight_set(scroller,
+ EVAS_HINT_EXPAND,
+ EVAS_HINT_EXPAND);
elm_scroller_bounce_set(scroller, EINA_TRUE, EINA_TRUE);
- elm_scroller_policy_set(scroller, ELM_SCROLLER_POLICY_AUTO, ELM_SCROLLER_POLICY_AUTO);
+ elm_scroller_policy_set(scroller,
+ ELM_SCROLLER_POLICY_AUTO,
+ ELM_SCROLLER_POLICY_AUTO);
elm_object_part_content_set(ly, "elm.swallow.scroller", scroller);
evas_object_show(scroller);
Evas_Object *feature_label = elm_label_add(m_popup);
- if(!feature_label)
+ if (!feature_label) {
return;
- evas_object_size_hint_align_set(feature_label, EVAS_HINT_FILL, EVAS_HINT_FILL);
- evas_object_size_hint_weight_set(feature_label, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ }
+ evas_object_size_hint_align_set(feature_label,
+ EVAS_HINT_FILL,
+ EVAS_HINT_FILL);
+ evas_object_size_hint_weight_set(feature_label,
+ EVAS_HINT_EXPAND,
+ EVAS_HINT_EXPAND);
evas_object_show(feature_label);
elm_object_text_set(feature_label, str.c_str());
elm_object_content_set(scroller, feature_label);
}
-void WidgetInstallPopup::addContent(PopupType type, const std::string &str)
+void WidgetInstallPopup::addContent(PopupType type, const std::string &str)
{
switch (type) {
- case PopupType::WIDGET_FEATURE_INFO :
+ case PopupType::WIDGET_FEATURE_INFO:
addScrollLabel(str);
- break;
- default :
+ break;
+ default:
elm_object_part_text_set(m_popup, "default", str.c_str());
- break;
+ break;
}
}
-void WidgetInstallPopup::addButton(PopupType type)
+void WidgetInstallPopup::addButton(PopupType type)
{
Evas_Object *lbutton = elm_button_add(m_popup);
Evas_Object *rbutton = elm_button_add(m_popup);
- if(!lbutton || !rbutton)
+ if (!lbutton || !rbutton) {
return;
+ }
switch (type) {
- case PopupType::WIDGET_WRONG_FEATURE_INFO :
- elm_object_text_set(lbutton, INFO_LEFT_BUTTON);
- elm_object_part_content_set(m_popup, "button1", lbutton);
- evas_object_smart_callback_add(lbutton,
- "clicked",
- userCancelCallback,
- this);
- return;
- case PopupType::WIDGET_FEATURE_INFO :
- elm_object_text_set(lbutton, INFO_LEFT_BUTTON);
- elm_object_text_set(rbutton, INFO_RIGHT_BUTTON);
- break;
- default :
- elm_object_text_set(lbutton, WARNING_LEFT_BUTTON);
- elm_object_text_set(rbutton, WARNING_RIGHT_BUTTON);
- break;
+ case PopupType::WIDGET_WRONG_FEATURE_INFO:
+ elm_object_text_set(lbutton, INFO_LEFT_BUTTON);
+ elm_object_part_content_set(m_popup, "button1", lbutton);
+ evas_object_smart_callback_add(lbutton,
+ "clicked",
+ userCancelCallback,
+ this);
+ return;
+ case PopupType::WIDGET_FEATURE_INFO:
+ elm_object_text_set(lbutton, INFO_LEFT_BUTTON);
+ elm_object_text_set(rbutton, INFO_RIGHT_BUTTON);
+ break;
+ default:
+ elm_object_text_set(lbutton, WARNING_LEFT_BUTTON);
+ elm_object_text_set(rbutton, WARNING_RIGHT_BUTTON);
+ break;
}
elm_object_part_content_set(m_popup, "button1", lbutton);
evas_object_smart_callback_add(lbutton,
- "clicked",
- userPermitCallback,
- this);
+ "clicked",
+ userPermitCallback,
+ this);
elm_object_part_content_set(m_popup, "button2", rbutton);
evas_object_smart_callback_add(rbutton,
- "clicked",
- userCancelCallback,
- this);
+ "clicked",
+ userCancelCallback,
+ this);
}
bool WidgetInstallPopup::createPopup()
{
bool ret = addWin(name);
- if(!ret)
+ if (!ret) {
return false;
+ }
evas_object_show(m_win);
ret = addPopup();
- if(!ret)
- {
+ if (!ret) {
evas_object_del(m_win);
m_win = NULL;
return false;
void WidgetInstallPopup::destroyPopup()
{
- if(m_win) {
- evas_object_del(m_win);
- m_win = NULL;
- m_popup = NULL;
- }
+ if (m_win) {
+ evas_object_del(m_win);
+ m_win = NULL;
+ m_popup = NULL;
+ }
}
void WidgetInstallPopup::loadPopup(PopupType type, const std::string &label)
}
void WidgetInstallPopup::userPermitCallback(void * data,
- Evas_Object */*obj*/,
- void */*event_info*/)
+ Evas_Object */*obj*/,
+ void */*event_info*/)
{
WidgetInstallPopup *This = static_cast<WidgetInstallPopup *>(data);
This->m_installCancel = WRT_POPUP_BUTTON_OK;
}
void WidgetInstallPopup::userCancelCallback(void *data,
- Evas_Object */*obj*/,
- void */*event_info*/)
+ Evas_Object */*obj*/,
+ void */*event_info*/)
{
WidgetInstallPopup *This = static_cast<WidgetInstallPopup *>(data);
This->m_installCancel = WRT_POPUP_BUTTON_CANCEL;
}
}
-
#include <Ecore_X.h>
#include <Elementary.h>
-
class InstallerContext;
namespace Jobs {
namespace WidgetInstall {
-
enum PopupType {
WIDGET_INSTALL_POPUP = 0,
WIDGET_FEATURE_INFO, //sp-2390
WRT_POPUP_BUTTON_CANCEL
};
-
class WidgetInstallPopup
{
- public :
- explicit WidgetInstallPopup(InstallerContext &installContext);
- virtual ~WidgetInstallPopup();
+ public:
+ explicit WidgetInstallPopup(InstallerContext &installContext);
+ virtual ~WidgetInstallPopup();
- bool createPopup();
- void destroyPopup();
- void loadPopup(PopupType type, const std::string &label);
- void showPopup();
- bool addWin(const char *name);
- bool addPopup();
- void addTitle(PopupType type);
- void addScrollLabel(const std::string &str);
- void addContent(PopupType type, const std::string &str);
- void addButton(PopupType type);
+ bool createPopup();
+ void destroyPopup();
+ void loadPopup(PopupType type, const std::string &label);
+ void showPopup();
+ bool addWin(const char *name);
+ bool addPopup();
+ void addTitle(PopupType type);
+ void addScrollLabel(const std::string &str);
+ void addContent(PopupType type, const std::string &str);
+ void addButton(PopupType type);
- static void userPermitCallback(void *data,
- Evas_Object *obj,
- void *event_info);
- static void userCancelCallback(void *data,
- Evas_Object *obj,
- void *event_info);
+ static void userPermitCallback(void *data,
+ Evas_Object *obj,
+ void *event_info);
+ static void userCancelCallback(void *data,
+ Evas_Object *obj,
+ void *event_info);
- protected :
- Evas_Object *m_win;
- Evas_Object *m_popup;
- InstallerContext &m_installContext;
- int m_installCancel;
+ protected:
+ Evas_Object *m_win;
+ Evas_Object *m_popup;
+ InstallerContext &m_installContext;
+ int m_installCancel;
};
}
}
Zero = 0,
// Bits
- NotInstalled = 1 << 0,
+ NotInstalled = 1 << 0,
IncomingVersionNotStd = 1 << 1,
ExistingVersionNotStd = 1 << 2,
- BothVersionsNotStd = 1 << 3,
- ExistingVersionOlder = 1 << 4,
- ExistingVersionEqual = 1 << 5,
- ExistingVersionNewer = 1 << 6,
+ BothVersionsNotStd = 1 << 3,
+ ExistingVersionOlder = 1 << 4,
+ ExistingVersionEqual = 1 << 5,
+ ExistingVersionNewer = 1 << 6,
// Policies
PolicyNeverUpdate = NotInstalled,
};
inline Type operator | (const Type &a,
- const Type &b)
+ const Type &b)
{
return static_cast<Type>(static_cast<unsigned long>(a) |
static_cast<unsigned long>(b));
}
inline Type operator & (const Type &a,
- const Type &b)
+ const Type &b)
{
return static_cast<Type>(static_cast<unsigned long>(a) &
static_cast<unsigned long>(b));
// It must be empty-constructible as a parameter of generic event
WidgetInstallationStruct() : updateMode(WidgetUpdateMode::Zero),
- m_quiet(true),
- m_preload(false)
- {
- }
-
- WidgetInstallationStruct(InstallerFinishedCallback finished,
- InstallerProgressCallback progress,
- void *param,
- WidgetUpdateMode::Type mode,
- bool quiet,
- bool preload,
- std::shared_ptr<PackageManager::IPkgmgrSignal> _pkgmgrInterface
- ) :
+ m_quiet(true),
+ m_preload(false)
+ {}
+
+ WidgetInstallationStruct(
+ InstallerFinishedCallback finished,
+ InstallerProgressCallback progress,
+ void *param,
+ WidgetUpdateMode::Type mode,
+ bool quiet,
+ bool preload,
+ std::shared_ptr<PackageManager::IPkgmgrSignal>
+ _pkgmgrInterface
+ ) :
WidgetInstallCallbackBase(finished, progress, param),
updateMode(mode),
m_quiet(quiet),
m_preload(preload),
pkgmgrInterface(_pkgmgrInterface)
- {
- }
+ {}
};
#endif // WRT_SRC_INSTALLER_CORE_INSTALLER_TASKS_WIDGET_INSTALLER_STRUCT_H_
WidgetUpdateInfo::ExistingWidgetInfo::ExistingWidgetInfo() :
isExist(false)
-{
-}
+{}
WidgetUpdateInfo::ExistingWidgetInfo::ExistingWidgetInfo(
const WrtDB::TizenAppId & appid,
tzAppid(appid),
isExist(true),
existingVersion(version)
-{
-}
+{}
WidgetUpdateInfo::ExistingWidgetInfo::ExistingWidgetInfo(
const WrtDB::TizenAppId & appid,
WidgetUpdateInfo::WidgetUpdateInfo() :
existingWidgetInfo()
-{
-}
+{}
WidgetUpdateInfo::WidgetUpdateInfo(
const DPL::Optional<WrtDB::WidgetGUID> &guid,
incomingGUID(guid),
incomingVersion(version),
existingWidgetInfo(widgetInfo)
-{
-}
+{}
void StepFail()
{
- if(m_uninstalled) {
+ if (m_uninstalled) {
ThrowMsg(Jobs::WidgetUninstall::Exceptions::WidgetNotExist,
- "Widget does not exist");
+ "Widget does not exist");
} else {
Throw(Jobs::WidgetUninstall::Exceptions::Base);
}
namespace Jobs {
namespace WidgetUninstall {
-JobWidgetUninstall::JobWidgetUninstall(const std::string & tizenAppId,
- const WidgetUninstallationStruct &uninstallerStruct) :
+JobWidgetUninstall::JobWidgetUninstall(
+ const std::string & tizenAppId,
+ const WidgetUninstallationStruct &
+ uninstallerStruct) :
Job(Uninstallation),
JobContextBase<WidgetUninstallationStruct>(uninstallerStruct)
{
AddTask(new TaskDeleteCertificates(m_context));
// send start signal of pkgmgr
- if (getInstallerStruct().pkgmgrInterface->setPkgname(m_context.tzAppid)) {
+ if (getInstallerStruct().pkgmgrInterface->setPkgname(m_context.tzAppid))
+ {
getInstallerStruct().pkgmgrInterface->sendSignal(
- PKGMGR_START_KEY,
- PKGMGR_START_UNINSTALL);
+ PKGMGR_START_KEY,
+ PKGMGR_START_UNINSTALL);
}
- } Catch (WidgetDAOReadOnly::Exception::WidgetNotExist) {
+ } Catch(WidgetDAOReadOnly::Exception::WidgetNotExist) {
AddTask(new UninstallerTaskFail(true));
- } Catch (WidgetDAOReadOnly::Exception::Base) {
+ } Catch(WidgetDAOReadOnly::Exception::Base) {
AddTask(new UninstallerTaskFail(false));
}
}
{
using namespace PackageManager;
if (!getRemoveStartedFlag() ||
- (getRemoveStartedFlag() && getRemoveFinishedFlag())) {
+ (getRemoveStartedFlag() && getRemoveFinishedFlag()))
+ {
if (NULL != getInstallerStruct().progressCallback) {
// send progress signal of pkgmgr
std::ostringstream percent;
percent << static_cast<int>(GetProgressPercent());
getInstallerStruct().pkgmgrInterface->sendSignal(
- PKGMGR_PROGRESS_KEY,
- percent.str());
+ PKGMGR_PROGRESS_KEY,
+ percent.str());
LogDebug("Call widget uninstall progressCallback");
getInstallerStruct().progressCallback(
- getInstallerStruct().userParam,
- GetProgressPercent(), GetProgressDescription());
+ getInstallerStruct().userParam,
+ GetProgressPercent(), GetProgressDescription());
}
}
}
using namespace PackageManager;
// send signal of pkgmgr
getInstallerStruct().pkgmgrInterface->sendSignal(
- PKGMGR_END_KEY,
- PKGMGR_END_SUCCESS);
+ PKGMGR_END_KEY,
+ PKGMGR_END_SUCCESS);
LogDebug("Call widget uninstall success finishedCallback");
getInstallerStruct().finishedCallback(getInstallerStruct().userParam,
- getRemovedTizenId(),Exceptions::Success);
+ getRemovedTizenId(),
+ Exceptions::Success);
}
void JobWidgetUninstall::SendFinishedFailure()
// send signal of pkgmgr
getInstallerStruct().pkgmgrInterface->sendSignal(
- PKGMGR_END_KEY,
- PKGMGR_END_FAILURE);
+ PKGMGR_END_KEY,
+ PKGMGR_END_FAILURE);
LogDebug("Call widget uninstall failure finishedCallback");
getInstallerStruct().finishedCallback(getInstallerStruct().userParam,
- getRemovedTizenId(), m_exceptionCaught); //TODO
+ getRemovedTizenId(),
+ m_exceptionCaught); //TODO
LogDebug("[JobWidgetUninstall] Asynchronous failure callback status sent");
}
bool JobWidgetUninstall::getExternalWidgetFlag() const
{
-
LogDebug("Get external widget");
- if (APP2EXT_SD_CARD == app2ext_get_app_location(m_context.tzAppid.c_str())) {
+ if (APP2EXT_SD_CARD ==
+ app2ext_get_app_location(m_context.tzAppid.c_str()))
+ {
LogDebug("This widget is in external stroage");
return true;
}
return false;
}
-
} //namespace WidgetUninstall
} //namespace Jobs
* @param[in] WrtDB::TizenAppId tzAppId - widget to uninstall
*/
JobWidgetUninstall(const std::string &tizenAppId,
- const WidgetUninstallationStruct& uninstallerStruct);
+ const WidgetUninstallationStruct& uninstallerStruct);
std::string getRemovedTizenId() const;
bool getRemoveStartedFlag() const;
}
TaskCheck::~TaskCheck()
-{
-}
+{}
void TaskCheck::StepUninstallPreCheck()
{
m_context.job->UpdateProgress(UninstallerContext::UNINSTALL_PRECHECK,
"Uninstall pre-checking Finished");
}
-
} //namespace WidgetUninstall
} //namespace Jobs
}
TaskDbUpdate::~TaskDbUpdate()
-{
-}
+{}
void TaskDbUpdate::StepDbUpdate()
{
{
//TODO: widget handle should not be used any more
ace_unregister_widget(static_cast<ace_widget_handle_t>(
- WidgetDAOReadOnly::getHandle(DPL::FromUTF8String(m_context.tzAppid))));
+ WidgetDAOReadOnly::getHandle(DPL::
+ FromUTF8String(
+ m_context.
+ tzAppid))));
WidgetDAO::unregisterWidget(DPL::FromUTF8String(m_context.tzAppid));
LogDebug("Unregistered widget successfully!");
LogInfo("delete box info: " << m_context.tzAppid);
}
}
-
} //namespace WidgetUninstall
} //namespace Jobs
}
TaskDeleteCertificates::~TaskDeleteCertificates()
-{
-}
+{}
void TaskDeleteCertificates::StepDeleteCertificates()
{
pkgmgr_instcertinfo_h handle;
if ((pkgmgr_installer_delete_certinfo(
- const_cast<char*>((
- m_context.tzAppid).c_str()))) < 0) {
+ const_cast<char*>((
+ m_context.tzAppid).c_str()))) < 0)
+ {
LogError("pkgmgr_installer_delete_certinfo fail");
}
}
} //namespace WidgetUninstall
} //namespace Jobs
-#endif // WRT_SRC_INSTALLER_CORE_JOB_WIDGET_UNINSTALL_TASK_DELETE_CERTIFICATES_H_
+#endif
+// WRT_SRC_INSTALLER_CORE_JOB_WIDGET_UNINSTALL_TASK_DELETE_CERTIFICATES_H_
namespace Jobs {
namespace WidgetUninstall {
-TaskRemoveCustomHandlers::TaskRemoveCustomHandlers(UninstallerContext& context) :
+TaskRemoveCustomHandlers::TaskRemoveCustomHandlers(UninstallerContext& context)
+ :
DPL::TaskDecl<TaskRemoveCustomHandlers>(this),
m_context(context)
{
CustomHandlerDB::Interface::attachDatabaseRW();
CustomHandlerDB::CustomHandlerDAO handlersDao(
- DPL::FromASCIIString(m_context.tzAppid));
+ DPL::FromASCIIString(m_context.tzAppid));
handlersDao.removeWidgetProtocolHandlers();
handlersDao.removeWidgetContentHandlers();
CustomHandlerDB::Interface::detachDatabase();
}
-
} //namespace WidgetUninstall
} //namespace Jobs
namespace Jobs {
namespace WidgetUninstall {
-class TaskRemoveCustomHandlers:
+class TaskRemoveCustomHandlers :
public DPL::TaskDecl<TaskRemoveCustomHandlers>
{
private:
namespace Jobs {
namespace WidgetUninstall {
-
using namespace WrtDB;
namespace {
}
TaskRemoveFiles::~TaskRemoveFiles()
-{
-}
+{}
void TaskRemoveFiles::StepRemoveInstallationDirectory()
{
m_context.removeStarted = true;
std::string widgetDir =
m_context.locations->getPackageInstallationDir();
- if(!WrtUtilRemove(widgetDir)){
+ if (!WrtUtilRemove(widgetDir)) {
LogWarning("Removing widget installation directory failed");
}
std::string dataDir = m_context.locations->getUserDataRootDir();
- if(!WrtUtilRemove(dataDir)){
+ if (!WrtUtilRemove(dataDir)) {
LogWarning(dataDir + " is already removed");
}
m_context.job->UpdateProgress(
}
if (AIL_ERROR_OK == ret) {
- if ( 0 > ail_desktop_remove(package)) {
+ if (0 > ail_desktop_remove(package)) {
LogWarning("Failed to remove ail information : " << package);
}
}
void TaskRemoveFiles::StepRemoveManifest()
{
std::ostringstream manifest_name;
- manifest_name << m_context.tzPkgid<< ".xml";
+ manifest_name << m_context.tzPkgid << ".xml";
std::ostringstream destFile;
destFile << "/opt/share/packages" << "/"; //TODO constant with path
destFile << manifest_name.str();
- int ret1 = pkgmgr_parser_parse_manifest_for_uninstallation(destFile.str().c_str(), NULL);
+ int ret1 = pkgmgr_parser_parse_manifest_for_uninstallation(
+ destFile.str().c_str(), NULL);
int ret2 = unlink(destFile.str().c_str());
- if(ret1 != 0)
- {
+ if (ret1 != 0) {
LogWarning("Manifest file failed to parse for uninstallation");
}
- if(ret2 != 0)
- {
+ if (ret2 != 0) {
LogWarning("No manifest file found: " << destFile.str());
- }
- else
- {
+ } else {
LogDebug("Manifest file removed: " << destFile.str());
}
}
WrtDB::ExternalLocationList externalPaths = dao.getWidgetExternalLocations();
FOREACH(path, externalPaths)
{
- if(WrtUtilFileExists(*path))
- {
+ if (WrtUtilFileExists(*path)) {
LogDebug(" -> " << *path);
int ret = remove(path->c_str());
if (ret != 0) {
- LogError("Failed to remove the file: " << path->c_str() << " with error: " << strerror(errno));
+ LogError(
+ "Failed to remove the file: " << path->c_str() <<
+ " with error: " << strerror(errno));
}
- }
- else if(WrtUtilDirExists(*path))
- {
+ } else if (WrtUtilDirExists(*path)) {
LogDebug(" -> " << *path);
- if(!WrtUtilRemove(*path)){
- Throw(Jobs::WidgetUninstall::TaskRemoveFiles::Exception::RemoveFilesFailed);
+ if (!WrtUtilRemove(*path)) {
+ Throw(
+ Jobs::WidgetUninstall::TaskRemoveFiles::Exception::
+ RemoveFilesFailed);
}
- }
- else
- {
+ } else {
LogWarning(" -> " << *path << "(no such a path)");
}
}
void TaskRemoveFiles::StepRemoveVconf()
{
std::string key =
- WrtDB::VconfConfig::GetVconfKeyRootPath(DPL::FromUTF8String(m_context.tzAppid));
- if(vconf_unset_recursive(key.c_str())) {
+ WrtDB::VconfConfig::GetVconfKeyRootPath(DPL::FromUTF8String(m_context.
+ tzAppid));
+ if (vconf_unset_recursive(key.c_str())) {
LogError("Fail to unset vconf file");
} else {
LogDebug("vconf file is removed");
WidgetInstallToExtSingleton::Instance().uninstallation();
WidgetInstallToExtSingleton::Instance().deinitialize();
}
- Catch (WidgetInstallToExt::Exception::ErrorInstallToExt)
+ Catch(WidgetInstallToExt::Exception::ErrorInstallToExt)
{
- Throw(Jobs::WidgetUninstall::TaskRemoveFiles::Exception::RemoveFilesFailed);
+ Throw(
+ Jobs::WidgetUninstall::TaskRemoveFiles::Exception::
+ RemoveFilesFailed);
}
}
-
} //namespace WidgetUninstall
} //namespace Jobs
void TaskSmack::Step()
{
- LogInfo("------------------------> SMACK: Jobs::WidgetUninstall::TaskSmack::Step()");
+ LogInfo(
+ "------------------------> SMACK: Jobs::WidgetUninstall::TaskSmack::Step()");
#ifdef WRT_SMACK_ENABLED
try {
- WrtDB::WidgetDAOReadOnly dao(m_context.widgetConfig.tzAppid);
- TizenAppId tzAppid = dao.getTizenAppId();
- const char *devCap = "";
- int result = handle_access_control_conf_forWAC(
- DPL::ToUTF8String(tzAppid).c_str(),
- NULL,
- OPERATION_UNINSTALL);
- Assert(result==PC_OPERATION_SUCCESS && "access control setup failed");
+ WrtDB::WidgetDAOReadOnly dao(m_context.widgetConfig.tzAppid);
+ TizenAppId tzAppid = dao.getTizenAppId();
+ const char *devCap = "";
+ int result = handle_access_control_conf_forWAC(
+ DPL::ToUTF8String(tzAppid).c_str(),
+ NULL,
+ OPERATION_UNINSTALL);
+ Assert(result == PC_OPERATION_SUCCESS && "access control setup failed");
} catch (WrtDB::WidgetDAOReadOnly::Exception) {
- Assert(false && "can't access widget data");
+ Assert(false && "can't access widget data");
}
m_context.job->UpdateProgress(
"Widget SMACK Enabled");
#endif
}
-
} //namespace WidgetUninstall
} //namespace Jobs
namespace Jobs {
namespace WidgetUninstall {
-class TaskSmack:
+class TaskSmack :
public DPL::TaskDecl<TaskSmack>
{
private:
}
TaskUninstallOspsvc::~TaskUninstallOspsvc()
-{
-}
+{}
void TaskUninstallOspsvc::StepUninstallOspsvc()
{
fd = popen(commStr.str().c_str(), "r");
if (NULL == fd) {
LogError("Failed to uninstalltion osp service");
- ThrowMsg(Exceptions::UninstallOspSvcFailed, "Error occurs during\
+ ThrowMsg(Exceptions::UninstallOspSvcFailed,
+ "Error occurs during\
uninstall osp service");
}
- fgets( readBuf, MAX_BUF_SIZE, fd);
+ fgets(readBuf, MAX_BUF_SIZE, fd);
LogDebug("return value : " << readBuf);
int result = atoi(readBuf);
if (0 != result) {
- ThrowMsg(Exceptions::UninstallOspSvcFailed, "Error occurs during\
+ ThrowMsg(Exceptions::UninstallOspSvcFailed,
+ "Error occurs during\
install osp service");
}
pclose(fd);
-
+
LogInfo("Widget Can be uninstalled. Pkgname : " << m_context.tzPkgid);
m_context.job->UpdateProgress(UninstallerContext::UNINSTALL_REMOVE_OSPSVC,
"Uninstall OSP service finished");
}
-
} //namespace WidgetUninstall
} //namespace Jobs
DECLARE_JOB_EXCEPTION(Base, WidgetNotExist, ErrorWidgetDoesNotExist)
DECLARE_JOB_EXCEPTION(Base, UninstallOspSvcFailed, ErrorUninstallOspSvcFailed)
DECLARE_JOB_EXCEPTION(Base, PlatformAPIFailure, ErrorPlatformAPI)
-
} //namespace
} //namespace
} //namespace
UninstallerProgressCallback>
WidgetUninstallCallbackBase;
-
struct WidgetUninstallationStruct : public WidgetUninstallCallbackBase
{
std::shared_ptr<PackageManager::IPkgmgrSignal> pkgmgrInterface;
// It must be empty-constructible as a parameter of generic event
WidgetUninstallationStruct()
- {
- }
+ {}
- WidgetUninstallationStruct(UninstallerFinishedCallback finished,
- UninstallerProgressCallback progress,
- void *param,
- std::shared_ptr<PackageManager::IPkgmgrSignal> _pkgmgrInterface
- ) :
+ WidgetUninstallationStruct(
+ UninstallerFinishedCallback finished,
+ UninstallerProgressCallback progress,
+ void *param,
+ std::shared_ptr<PackageManager::IPkgmgrSignal>
+ _pkgmgrInterface
+ ) :
WidgetUninstallCallbackBase(finished, progress, param),
pkgmgrInterface(_pkgmgrInterface)
- {
- }
+ {}
};
#endif // WRT_SRC_INSTALLER_CORE_UNINSTALLER_TASKS_WIDGET_INSTALLER_STRUCT_H_
IMPLEMENT_SINGLETON(Logic::InstallerController)
-namespace Logic
-{
-
+namespace Logic {
InstallerController::InstallerController()
-{
-}
+{}
void InstallerController::OnEventReceived(
- const InstallerControllerEvents::InstallWidgetEvent &event)
+ const InstallerControllerEvents::InstallWidgetEvent &event)
{
std::string fileName = event.GetArg0();
WidgetInstallationStruct installerStruct = event.GetArg1();
}
void InstallerController::OnEventReceived(
- const InstallerControllerEvents::InstallPluginEvent &event)
+ const InstallerControllerEvents::InstallPluginEvent &event)
{
std::string dirName = event.GetArg0();
PluginInstallerStruct installerStruct = event.GetArg1();
}
void InstallerController::OnEventReceived(
- const InstallerControllerEvents::UninstallWidgetEvent &event)
+ const InstallerControllerEvents::UninstallWidgetEvent &event)
{
std::string widgetPkgName = event.GetArg0();
WidgetUninstallationStruct uninstallerStruct = event.GetArg1();
{
Jobs::Job* model = static_cast<Jobs::Job *>(data);
CONTROLLER_POST_EVENT(InstallerController,
- InstallerControllerEvents::NextStepEvent(model));
+ InstallerControllerEvents::NextStepEvent(model));
return ECORE_CALLBACK_CANCEL;
}
void InstallerController::OnEventReceived(
- const InstallerControllerEvents::NextStepEvent &event)
+ const InstallerControllerEvents::NextStepEvent &event)
{
Jobs::Job* model = event.GetArg0();
Assert(model != NULL);
}
void InstallerController::OnEventReceived(
- const InstallerControllerEvents::InstallDeferredWidgetPackagesEvent &
- event)
+ const InstallerControllerEvents::InstallDeferredWidgetPackagesEvent &
+ event)
{
(void)event;
m_installerLogic.InstallDeferredWidgetPackages();
}
void InstallerController::OnEventReceived(
- const InstallerControllerEvents::InitializeEvent & /*event*/)
+ const InstallerControllerEvents::InitializeEvent & /*event*/)
{
m_installerLogic.Initialize();
}
void InstallerController::OnEventReceived(
- const InstallerControllerEvents::TerminateEvent & /*event*/)
+ const InstallerControllerEvents::TerminateEvent & /*event*/)
{
m_installerLogic.Terminate();
}
-
} //Logic
* This event holds std::string witch should be path to widget package
*/
DECLARE_GENERIC_EVENT_2(InstallWidgetEvent,
- std::string,
- WidgetInstallationStruct) // (zipFileName, installerStruct)
+ std::string, // zipFileName
+ WidgetInstallationStruct) // installerStruct
/**
* @brief Event for iniciating plugin instalation process.
DECLARE_GENERIC_EVENT_0(InitializeEvent)
DECLARE_GENERIC_EVENT_0(TerminateEvent)
-
} // namespace InstallerEvents
-
namespace Logic {
-
/**
* @brief Controls Widget installation
*
InstallerControllerEvents::TerminateEvent>::Type
InstallerControllerEventsSet;
-class InstallerController : public DPL::Event::Controller<InstallerControllerEventsSet>
+class InstallerController : public DPL::Event::Controller<
+ InstallerControllerEventsSet>
{
protected:
/**
* @brief Executed on InstallWidgetEvent received.
*/
virtual void OnEventReceived(
- const InstallerControllerEvents::InstallWidgetEvent &event);
+ const InstallerControllerEvents::InstallWidgetEvent &event);
/**
* @brief Executed on InstallPluginEvent received.
*/
virtual void OnEventReceived(
- const InstallerControllerEvents::InstallPluginEvent &event);
+ const InstallerControllerEvents::InstallPluginEvent &event);
/**
* @brief Executed on UninstallWidgetEvent received.
*/
virtual void OnEventReceived(
- const InstallerControllerEvents::UninstallWidgetEvent &event);
+ const InstallerControllerEvents::UninstallWidgetEvent &event);
/**
* @brief Executed on NextStepEvent received.
*/
virtual void OnEventReceived(
- const InstallerControllerEvents::NextStepEvent &event);
+ const InstallerControllerEvents::NextStepEvent &event);
virtual void OnEventReceived(
- const InstallerControllerEvents::InstallDeferredWidgetPackagesEvent
- &event);
+ const InstallerControllerEvents::InstallDeferredWidgetPackagesEvent
+ &event);
virtual void OnEventReceived(
- const InstallerControllerEvents::InitializeEvent &event);
+ const InstallerControllerEvents::InitializeEvent &event);
virtual void OnEventReceived(
- const InstallerControllerEvents::TerminateEvent &event);
+ const InstallerControllerEvents::TerminateEvent &event);
private:
// Embedded logic
};
typedef DPL::Singleton<InstallerController> InstallerControllerSingleton;
-
}
#endif // INSTALLER_CONTROLLER_H
using namespace WrtDB;
namespace Logic {
-
InstallerLogic::InstallerLogic() :
m_NextHandle(0)
-{
-}
+{}
InstallerLogic::~InstallerLogic()
{
//InstallWidget, UninstallWidget InstallPlugin method are almost the same
// But each Job has different constructor, so creating new Job is specific
-Jobs::JobHandle InstallerLogic::InstallWidget(const std::string & widgetPath,
- const WidgetInstallationStruct &installerStruct)
+Jobs::JobHandle InstallerLogic::InstallWidget(
+ const std::string & widgetPath,
+ const WidgetInstallationStruct &
+ installerStruct)
{
LogDebug("New Widget Installation:");
return AddAndStartJob(job);
}
-Jobs::JobHandle InstallerLogic::UninstallWidget(const std::string & widgetPkgName,
- const WidgetUninstallationStruct &uninstallerStruct)
+Jobs::JobHandle InstallerLogic::UninstallWidget(
+ const std::string & widgetPkgName,
+ const
+ WidgetUninstallationStruct &uninstallerStruct)
{
LogDebug("New Widget Uninstallation");
return AddAndStartJob(job);
}
-Jobs::JobHandle InstallerLogic::InstallPlugin(std::string const & pluginPath,
- const PluginInstallerStruct &installerStruct)
+Jobs::JobHandle InstallerLogic::InstallPlugin(
+ std::string const & pluginPath,
+ const PluginInstallerStruct &
+ installerStruct)
{
LogDebug("New Plugin Installation");
delete job;
return false;
- }
- catch (Jobs::JobExceptionBase &exc) {
+ } catch (Jobs::JobExceptionBase &exc) {
//start revert job
LogInfo("Exception occured: " << exc.getParam() <<
". Reverting job...");
LogWarning("Not implemented");
// LogInfo("Installing deferred widget packages...");
//
- // WidgetPackageList packages = GlobalDAO::GetDefferedWidgetPackageInstallationList();
+ // WidgetPackageList packages =
+ // GlobalDAO::GetDefferedWidgetPackageInstallationList();
//
// LogInfo(packages.size() << " widget package(s) to install");
//
//
// // Post installation
// CONTROLLER_POST_EVENT(
- // InstallerController, InstallerControllerEvents::InstallWidgetEvent(
- // DPL::ToUTF8String(widgetPackage).c_str(), WidgetInstallationStruct(
+ // InstallerController,
+ // InstallerControllerEvents::InstallWidgetEvent(
+ // DPL::ToUTF8String(widgetPackage).c_str(),
+ // WidgetInstallationStruct(
// &DummyInstallCallback, &DummyProgressCallback, NULL,
// WidgetUpdateMode::PolicyWac)));
}
PluginDAO::getPluginHandleForImplementedObject(*requiredObject);
if (depHandle ==
- Jobs::PluginInstall::JobPluginInstall::INVALID_HANDLE) {
+ Jobs::PluginInstall::JobPluginInstall::INVALID_HANDLE)
+ {
LogError("Library implementing: " <<
*requiredObject << " NOT FOUND");
return true;
}
-
}
#include <job.h>
namespace Logic {
-
class InstallerLogic
{
typedef std::map<Jobs::JobHandle, Jobs::Job*> JobsContainer;
return m_NextHandle++;
}
Jobs::JobHandle AddAndStartJob(Jobs::Job *job);
+
public:
virtual ~InstallerLogic();
void Terminate();
- Jobs::JobHandle InstallWidget(const std::string & widgetPath,
- const WidgetInstallationStruct &installerStruct);
+ Jobs::JobHandle InstallWidget(
+ const std::string & widgetPath,
+ const WidgetInstallationStruct &
+ installerStruct);
- Jobs::JobHandle UninstallWidget(const std::string & widgetPkgName,
- const WidgetUninstallationStruct &uninstallerStruct);
+ Jobs::JobHandle UninstallWidget(
+ const std::string & widgetPkgName,
+ const WidgetUninstallationStruct &
+ uninstallerStruct);
Jobs::JobHandle InstallPlugin(std::string const & pluginPath,
- const PluginInstallerStruct &installerStruct);
+ const PluginInstallerStruct &installerStruct);
bool NextStep(Jobs::Job* installModel);
friend class InstallerController;
};
-
}
#endif // INSTALLER_LOGIC_H
namespace Jobs {
namespace WidgetInstall {
-
-FeatureLogic::FeatureLogic(const WrtDB::TizenAppId & tzAppid)
- : m_rejected(false)
+FeatureLogic::FeatureLogic(const WrtDB::TizenAppId & tzAppid) :
+ m_rejected(false)
{
WrtDB::WidgetDAOReadOnly widgetDao(tzAppid);
WidgetFeatureSet featureSet = widgetDao.getFeaturesList();
FOREACH(it, featureSet) {
LogInfo("Feature name : " << it->name);
WrtDB::DeviceCapabilitySet dcs =
- WrtDB::GlobalDAOReadOnly::GetDeviceCapability(it->name);
- FOREACH (devCap, dcs) {
+ WrtDB::GlobalDAOReadOnly::GetDeviceCapability(it->name);
+ FOREACH(devCap, dcs) {
LogInfo("--- dev cap : " << *devCap);
}
Feature feature(*it, dcs);
bool FeatureLogic::next()
{
while (!isDone()) {
- if (m_currentFeature->currentCap != m_currentFeature->devCapSet.end()) {
+ if (m_currentFeature->currentCap !=
+ m_currentFeature->devCapSet.end())
+ {
m_currentFeature->currentCap++;
} else {
++m_currentFeature;
return false;
}
-
void FeatureLogic::setAceResponse(bool allowed)
{
Assert(isProcessable() && "Wrong usage");
return true;
}
-
} // namespace WidgetInstall
} // namespace Jobs
namespace Jobs {
namespace WidgetInstall {
-
-class FeatureLogic : DPL::Noncopyable {
+class FeatureLogic : DPL::Noncopyable
+{
public:
FeatureLogic(const WrtDB::TizenAppId & tzAppid);
WrtDB::DeviceCapabilitySet devCapSet;
WrtDB::DeviceCapabilitySet::const_iterator currentCap;
- Feature(const WidgetFeature &wf, const WrtDB::DeviceCapabilitySet &set)
- : WidgetFeature(wf)
- , devCapSet(set)
+ Feature(const WidgetFeature &wf,
+ const WrtDB::DeviceCapabilitySet &set) :
+ WidgetFeature(wf)
+ , devCapSet(set)
{
currentCap = devCapSet.begin();
}
currentCap = devCapSet.find(*second.currentCap);
rejected = second.rejected;
}
+
private:
- void operator=(const Feature &second) {
+ void operator=(const Feature &second)
+ {
name = second.name;
devCapSet = second.devCapSet;
required = second.required;
typedef std::list<Feature> FeatureList;
typedef FeatureList::const_iterator FeatureIterator;
- FeatureIterator resultBegin() { return m_featureList.begin(); }
- FeatureIterator resultEnd() { return m_featureList.end(); }
+ FeatureIterator resultBegin()
+ {
+ return m_featureList.begin();
+ }
+ FeatureIterator resultEnd()
+ {
+ return m_featureList.end();
+ }
private:
bool isProcessable() const;
};
typedef std::shared_ptr<FeatureLogic> FeatureLogicPtr;
-
} // namespace WidgetInstall
} // namespace Jobs
IMPLEMENT_SINGLETON(LibxmlUtils)
LibxmlUtils::LibxmlUtils() : isInitialized(false)
-{
-}
+{}
LibxmlUtils::~LibxmlUtils()
{
- if(isInitialized)
- {
+ if (isInitialized) {
LogDebug("Libxml - cleaning");
// Cleanup function for the XML library.
xmlCleanupParser();
void LibxmlUtils::init()
{
- if(!isInitialized)
- {
+ if (!isInitialized) {
LIBXML_TEST_VERSION
- isInitialized = true;
+ isInitialized = true;
LogDebug("Libxml have been initialized");
}
LogDebug("Libxml already initialized");
}
-
*/
class LibxmlUtils
{
-public:
+ public:
DECLARE_EXCEPTION_TYPE(DPL::Exception, Base)
DECLARE_EXCEPTION_TYPE(Base, Libxml2Error)
~LibxmlUtils();
void init();
-private:
+
+ private:
bool isInitialized;
friend class DPL::Singleton<LibxmlUtils>;
LogDebug("Widget id to parse: " << url);
std::unique_ptr<iri_struct, std::function<void(iri_struct*)> >
- iri(iri_parse(url), iri_destroy);
+ iri(iri_parse(url), iri_destroy);
if (!iri.get()) {
LogError("Error in parsing widget id.");
}
// should we support HTTP and HTTPS? wac says nothing
- // std::transform(m_scheme.begin(), m_scheme.end(), m_scheme.begin(), tolower);
+ // std::transform(m_scheme.begin(), m_scheme.end(), m_scheme.begin(),
+ // tolower);
// We only match "http" and "https" schemas
if ((scheme != SCHEME_HTTP) && (scheme != SCHEME_HTTPS)) {
WidgetInstallToExt::WidgetInstallToExt() :
m_handle(NULL),
m_appId("")
-{
-}
+{}
WidgetInstallToExt::~WidgetInstallToExt()
-{
-}
+{}
void WidgetInstallToExt::initialize(std::string appId)
{
{
LogDebug("WidgetInstallToExt::deinitialize()");
if (NULL != m_handle) {
- if ( 0 < app2ext_deinit(m_handle)) {
- ThrowMsg(Exception::ErrorInstallToExt, "app2ext deinitialize \
+ if (0 < app2ext_deinit(m_handle)) {
+ ThrowMsg(Exception::ErrorInstallToExt,
+ "app2ext deinitialize \
failed");
}
}
int ret = m_handle->interface.pre_install(m_appId.c_str(), dirList, dSize);
- if (APP2EXT_SUCCESS == ret ) {
+ if (APP2EXT_SUCCESS == ret) {
LogDebug("App2Ext pre install success");
} else {
postInstallation(false);
if (status) {
m_handle->interface.post_install(m_appId.c_str(),
- APP2EXT_STATUS_SUCCESS);
+ APP2EXT_STATUS_SUCCESS);
} else {
m_handle->interface.post_install(m_appId.c_str(),
- APP2EXT_STATUS_FAILED);
+ APP2EXT_STATUS_FAILED);
}
}
Assert(m_handle);
int ret = m_handle->interface.pre_upgrade(m_appId.c_str(), dirList, dSize);
- if (APP2EXT_SUCCESS == ret ) {
+ if (APP2EXT_SUCCESS == ret) {
LogDebug("App2Ext pre-upgrade success");
} else {
postUpgrade(false);
if (status) {
m_handle->interface.post_upgrade(m_appId.c_str(),
- APP2EXT_STATUS_SUCCESS);
+ APP2EXT_STATUS_SUCCESS);
} else {
m_handle->interface.post_upgrade(m_appId.c_str(),
- APP2EXT_STATUS_FAILED);
+ APP2EXT_STATUS_FAILED);
}
}
Assert(m_handle);
int ret = m_handle->interface.pre_uninstall(m_appId.c_str());
- if (APP2EXT_SUCCESS == ret ) {
+ if (APP2EXT_SUCCESS == ret) {
if (APP2EXT_SUCCESS ==
- m_handle->interface.post_uninstall(m_appId.c_str())) {
+ m_handle->interface.post_uninstall(m_appId.c_str()))
+ {
LogDebug("App2Ext pre-uninstall success");
} else {
ThrowMsg(Exception::ErrorInstallToExt, "post-uninstall failed");
#include <dpl/string.h>
#include <app2ext_interface.h>
-
class WidgetInstallToExt
{
-public:
+ public:
class Exception
{
public:
void postUpgrade(bool status);
void uninstallation();
-private:
+ private:
app2ext_handle *m_handle;
std::string m_appId;
#include <widget_install/task_commons.h>
-
WidgetLocation::DirectoryDeletor::DirectoryDeletor()
{
m_dirpath = Jobs::WidgetInstall::createTempPath();
WidgetLocation::DirectoryDeletor::~DirectoryDeletor()
{
- LogDebug("Removing widget installation temporary directory: " << m_dirpath.c_str());
- if(!WrtUtilRemove(m_dirpath)){
+ LogDebug(
+ "Removing widget installation temporary directory: " << m_dirpath.c_str());
+ if (!WrtUtilRemove(m_dirpath)) {
LogError("Fail at removing directory: " << m_dirpath.c_str());
}
}
}
WidgetLocation::WidgetLocation()
-{
-}
+{}
WidgetLocation::WidgetLocation(const std::string & widgetname) :
- m_pkgid(widgetname)
-{
-}
+ m_pkgid(widgetname)
+{}
WidgetLocation::~WidgetLocation()
-{
-}
+{}
WidgetLocation::WidgetLocation(const std::string & widgetname,
std::string sourcePath,
WrtDB::PackagingType t,
- InstallLocationType locationType):
- m_pkgid(widgetname),
- m_widgetSource(sourcePath),
- m_type(t),
- m_temp(new WidgetLocation::DirectoryDeletor())
+ InstallLocationType locationType) :
+ m_pkgid(widgetname),
+ m_widgetSource(sourcePath),
+ m_type(t),
+ m_temp(new WidgetLocation::DirectoryDeletor())
{
if (INSTALL_LOCATION_TYPE_PRELOAD == locationType) {
m_installedPath += WrtDB::GlobalConfig::GetUserPreloadedWidgetPath();
std::string sourcePath,
std::string dirPath,
WrtDB::PackagingType t,
- InstallLocationType locationType):
- m_pkgid(widgetname),
- m_widgetSource(sourcePath),
- m_type(t),
- m_temp(new
- WidgetLocation::DirectoryDeletor(dirPath))
+ InstallLocationType locationType) :
+ m_pkgid(widgetname),
+ m_widgetSource(sourcePath),
+ m_type(t),
+ m_temp(new
+ WidgetLocation::DirectoryDeletor(dirPath))
{
if (INSTALL_LOCATION_TYPE_PRELOAD == locationType) {
m_installedPath += WrtDB::GlobalConfig::GetUserPreloadedWidgetPath();
std::string WidgetLocation::getSourceDir() const
{
return m_installedPath + "/"
- + m_pkgid + WrtDB::GlobalConfig::GetWidgetSrcPath();
+ + m_pkgid + WrtDB::GlobalConfig::GetWidgetSrcPath();
}
std::string WidgetLocation::getBinaryDir() const
{
return m_installedPath + "/"
- + m_pkgid + WrtDB::GlobalConfig::GetUserWidgetExecPath();
+ + m_pkgid + WrtDB::GlobalConfig::GetUserWidgetExecPath();
}
std::string WidgetLocation::getExecFile() const
std::string WidgetLocation::getUserDataRootDir() const
{
return std::string(WrtDB::GlobalConfig::GetWidgetUserDataPath()) +
- "/" + m_pkgid;
+ "/" + m_pkgid;
}
std::string WidgetLocation::getPrivateStorageDir() const
{
return getUserDataRootDir() + "/" +
- WrtDB::GlobalConfig::GetWidgetPrivateStoragePath();
+ WrtDB::GlobalConfig::GetWidgetPrivateStoragePath();
}
std::string WidgetLocation::getTemporaryPackageDir() const
if (m_type == WrtDB::PKG_TYPE_DIRECTORY_WEB_APP) {
return getWidgetSource() + WrtDB::GlobalConfig::GetWidgetSrcPath();
}
- if(m_type == WrtDB::PKG_TYPE_HYBRID_WEB_APP)
- {
+ if (m_type == WrtDB::PKG_TYPE_HYBRID_WEB_APP) {
return getTemporaryPackageDir() + WrtDB::GlobalConfig::GetWidgetSrcPath();
- }
- else
- {
+ } else {
return getTemporaryPackageDir();
}
}
std::string WidgetLocation::getConfigurationDir() const
{
- if(m_type == WrtDB::PKG_TYPE_HOSTED_WEB_APP)
- {
+ if (m_type == WrtDB::PKG_TYPE_HOSTED_WEB_APP) {
std::string path = ".";
int index = m_widgetSource.find_last_of("\\/");
- if (index != std::string::npos)
- {
+ if (index != std::string::npos) {
path = m_widgetSource.substr(0, index);
}
return path;
- }
- else if (m_type == WrtDB::PKG_TYPE_DIRECTORY_WEB_APP)
- {
+ } else if (m_type == WrtDB::PKG_TYPE_DIRECTORY_WEB_APP) {
return getWidgetSource() + WrtDB::GlobalConfig::GetWidgetSrcPath();
- } else
- {
+ } else {
return getTemporaryRootDir();
}
}
* \___ [widgets_archive_content]
*
* 1) Normal Widget
- * Developer provides content of res/wgt directory (package contains that directory as root).
+ * Developer provides content of res/wgt directory (package contains that
+ * directory as root).
*
* 2) For OSP Service Hybrid App is actually a bit different:
* Root is OSP Service directory, WebApp content is located in [root]/res/wgt
*
* Temporary directory is directory when widget is placed at the begining
- * of installation process. After parsing process of config.xml, destination directory is created.
+ * of installation process. After parsing process of config.xml, destination
+ * directory is created.
*/
class WidgetLocation
{
class DirectoryDeletor
{
- public:
+ public:
DirectoryDeletor();
DirectoryDeletor(std::string tempPath);
~DirectoryDeletor();
std::string getTempPath() const;
- private:
+
+ private:
std::string m_dirpath;
};
-public:
+ public:
DECLARE_EXCEPTION_TYPE(DPL::Exception, Base)
DECLARE_EXCEPTION_TYPE(Base, NoTemporaryPath)
/**
*/
WidgetLocation();
/**
- * @brief WidgetLocation Builds paths for widget location during uninstallation
+ * @brief WidgetLocation Builds paths for widget location during
+ * uninstallation
*
* Uninstallation process needs only installed package directory.
*
*/
WidgetLocation(const std::string & widgetname);
/**
- * @brief WidgetLocation Builds paths for widget location during installation
+ * @brief WidgetLocation Builds paths for widget location during
+ * installation
*
* @param widgetname name of widget
* @param sourcePath given source path
WidgetLocation(const std::string & widgetname, std::string sourcePath,
WrtDB::PackagingType t = WrtDB::PKG_TYPE_NOMAL_WEB_APP,
InstallLocationType ltype =
- INSTALL_LOCATION_TYPE_NOMAL);
+ INSTALL_LOCATION_TYPE_NOMAL);
WidgetLocation(const std::string & widgetname, std::string sourcePath,
std::string dirPath,
WrtDB::PackagingType t = WrtDB::PKG_TYPE_NOMAL_WEB_APP,
InstallLocationType ltype =
- INSTALL_LOCATION_TYPE_NOMAL);
+ INSTALL_LOCATION_TYPE_NOMAL);
~WidgetLocation();
// Installed paths
- std::string getInstallationDir() const; // /opt/apps or /usr/apps
- std::string getPackageInstallationDir() const; // /opt/apps/[package]
- std::string getSourceDir() const; // /opt/apps/[package]/res/wgt
- std::string getBinaryDir() const; // /opt/apps/[package]/bin
- std::string getExecFile() const; // /opt/apps/[package]/bin/[package]
- std::string getBackupDir() const; // /opt/apps/[package]/backup
- std::string getBackupSourceDir() const; // /opt/apps/[package]/backup/res/wgt
- std::string getBackupBinaryDir() const; // /opt/apps/[package]/backup/bin
- std::string getBackupExecFile() const; // /opt/apps/[package]/backup/bin/[package]
- std::string getUserDataRootDir() const; // /opt/usr/apps/[package]
- std::string getPrivateStorageDir() const; // /opt/usr/apps/[package]/data
+ std::string getInstallationDir() const; // /opt/apps or /usr/apps
+ std::string getPackageInstallationDir() const; // /opt/apps/[package]
+ std::string getSourceDir() const; // /opt/apps/[package]/res/wgt
+ std::string getBinaryDir() const; // /opt/apps/[package]/bin
+ std::string getExecFile() const; // /opt/apps/[package]/bin/[package]
+ std::string getBackupDir() const; // /opt/apps/[package]/backup
+ std::string getBackupSourceDir() const; // /opt/apps/[pkg]/backup/res/wgt
+ std::string getBackupBinaryDir() const; // /opt/apps/[pkg]/backup/bin
+ std::string getBackupExecFile() const; // /opt/apps/[pkg]/backup/bin/[pkg]
+ std::string getUserDataRootDir() const; // /opt/usr/apps/[package]
+ std::string getPrivateStorageDir() const; // /opt/usr/apps/[package]/data
// Temporary paths
/**
* @brief getTemporaryRootDir
- * @return value of root for developer's provide package (root of unpacked .wgt file)
+ * @return value of root for developer's provide package (root of unpacked
+ * .wgt file)
*/
std::string getTemporaryPackageDir() const;
/**
*
* Value of this will differs according to type of installed widget.
*
- * @return value of root for content in temporary directory to be copied into 'res/wgt'
+ * @return value of root for content in temporary directory to be copied
+ * into 'res/wgt'
*/
std::string getTemporaryRootDir() const;
/**
- * @brief getConfigurationDir Returns rott directory for configuration requirements
+ * @brief getConfigurationDir Returns rott directory for configuration
+ * requirements
*
* 1) For packed widgets it is just root of unpacked sources
- * 2) For browser installation it is directory name of widget passed to installer
+ * 2) For browser installation it is directory name of widget passed to
+ * installer
*
* @return configuration directory
*/
//icons
/**
- * @brief setIconTargetFilenameForLocale set installed ion path according to locale
+ * @brief setIconTargetFilenameForLocale set installed ion path according to
+ * locale
* @param icon path of application icon
*/
void setIconTargetFilenameForLocale(const std::string &icon);
*/
void registerAppid(const std::string & appid);
-private:
- std::string m_widgetSource; // Source widget zip file/widget url
+ private:
+ std::string m_widgetSource; // Source widget zip
+ // file/widget url
std::string m_appid; //id of app
std::string m_pkgid; //id of package
std::string m_iconPath; //installed icon path
#undef FALSE
#define TRUE 0
#define FALSE -1
-#define GET_DIRECTORY_SIZE_KB(x) (x)/1024
+#define GET_DIRECTORY_SIZE_KB(x) (x) / 1024
#ifdef __cplusplus
extern "C"
static void pkg_native_plugin_on_unload();
static int pkg_plugin_app_is_installed(const char *pkg_name);
static int pkg_plugin_get_installed_apps_list(const char *category,
- const char *option, package_manager_pkg_info_t **list, int *count);
-static int pkg_plugin_get_app_detail_info(const char *pkg_name,
- package_manager_pkg_detail_info_t *pkg_detail_info);
-static int pkg_plugin_get_app_detail_info_from_package(const char *pkg_path,
- package_manager_pkg_detail_info_t *pkg_detail_info);
+ const char *option,
+ package_manager_pkg_info_t **list,
+ int *count);
+static int pkg_plugin_get_app_detail_info(
+ const char *pkg_name,
+ package_manager_pkg_detail_info_t *
+ pkg_detail_info);
+static int pkg_plugin_get_app_detail_info_from_package(
+ const char *pkg_path,
+ package_manager_pkg_detail_info_t
+ *pkg_detail_info);
static void pkg_native_plugin_on_unload()
{
WrtDB::WrtDatabase::attachToThreadRO();
bool result = WidgetDAOReadOnly::isWidgetInstalled(
- DPL::FromUTF8String(pkg_name));
+ DPL::FromUTF8String(pkg_name));
WrtDB::WrtDatabase::detachFromThread();
if (result) {
}
static int pkg_plugin_get_installed_apps_list(const char * /*category*/,
- const char * /*option*/, package_manager_pkg_info_t **list, int *count)
+ const char * /*option*/,
+ package_manager_pkg_info_t **list,
+ int *count)
{
LogDebug("pkg_plugin_get_installed_apps_list() is called");
package_manager_pkg_info_t *pkg_list = NULL;
package_manager_pkg_info_t *pkg_last = NULL;
-
WrtDB::WrtDatabase::attachToThreadRO();
TizenAppIdList tizenAppidList = WidgetDAOReadOnly::getTizenAppidList();
*count = 0;
WidgetDAOReadOnly widget(tzAppid);
strncpy(pkg_info->pkg_type, "wgt", PKG_TYPE_STRING_LEN_MAX);
snprintf(pkg_info->pkg_name, PKG_NAME_STRING_LEN_MAX, "%s",
- DPL::ToUTF8String(tzAppid).c_str());
+ DPL::ToUTF8String(tzAppid).c_str());
DPL::Optional<DPL::String> version = widget.getVersion();
if (!version.IsNull()) {
return TRUE;
}
-static int pkg_plugin_get_app_detail_info(const char *pkg_name,
- package_manager_pkg_detail_info_t *pkg_detail_info)
+static int pkg_plugin_get_app_detail_info(
+ const char *pkg_name,
+ package_manager_pkg_detail_info_t *
+ pkg_detail_info)
{
LogDebug("pkg_plugin_get_app_detail_info() is called");
-
WrtDB::WrtDatabase::attachToThreadRO();
int handle = WidgetDAOReadOnly::getHandle(
- DPL::FromUTF8String(pkg_name));
+ DPL::FromUTF8String(pkg_name));
WidgetDAOReadOnly widget(handle);
DPL::Optional<DPL::String> version = widget.getVersion();
PKG_VERSION_STRING_LEN_MAX - 1);
}
snprintf(pkg_detail_info->optional_id, PKG_NAME_STRING_LEN_MAX, "%d",
- handle);
+ handle);
WidgetLocalizedInfo localizedInfo;
if (locale.IsNull()) {
}
static int pkg_plugin_get_app_detail_info_from_package(
- const char * /*pkg_path*/,
- package_manager_pkg_detail_info_t * /*pkg_detail_info*/)
+ const char * /*pkg_path*/,
+ package_manager_pkg_detail_info_t * /*pkg_detail_info*/)
{
LogDebug("pkg_plugin_get_app_detail_info_from_package() is called");
#include <pkgmgr_installer.h>
#include <pkg-manager/pkgmgr_signal.h>
-
namespace PackageManager {
-
PkgmgrSignal::PkgmgrSignal() :
m_initialized(false),
m_handle(NULL),
m_noPopup(false),
m_reqType(PKGMGR_REQ_INVALID)
-{
-}
+{}
PkgmgrSignal::~PkgmgrSignal()
-{
-}
+{}
bool PkgmgrSignal::initialize(int argc, char* argv[])
{
- if(m_handle)
- {
+ if (m_handle) {
LogInfo("Release already allocated pkgmgr handle");
pkgmgr_installer_free(m_handle);
m_handle = NULL;
}
m_handle = pkgmgr_installer_new();
- if(!m_handle) {
+ if (!m_handle) {
LogError("Fail to get pkgmgr installer handle");
return false;
}
// set information from pkgmgr
if (!pkgmgr_installer_receive_request(
- m_handle, argc, argv))
+ m_handle, argc, argv))
{
m_noPopup = pkgmgr_installer_is_quiet(m_handle);
m_reqType = pkgmgr_installer_get_request_type(m_handle);
if (m_reqType != PKGMGR_REQ_INSTALL &&
- m_reqType != PKGMGR_REQ_UNINSTALL)
+ m_reqType != PKGMGR_REQ_UNINSTALL)
{
LogError("Fail to get request type of pkgmgr");
pkgmgr_installer_free(m_handle);
bool PkgmgrSignal::deinitialize()
{
- if (!m_initialized)
- {
+ if (!m_initialized) {
LogError("PkgmgrSingal not yet intialized");
return false;
}
bool PkgmgrSignal::setPkgname(const std::string& name)
{
- if (!m_initialized)
- {
+ if (!m_initialized) {
LogError("PkgmgrSingal not yet intialized");
return false;
}
- if (name.empty())
- {
+ if (name.empty()) {
LogError("name is empty");
return false;
}
return true;
}
-bool PkgmgrSignal::sendSignal(const std::string& key, const std::string& value) const
+bool PkgmgrSignal::sendSignal(const std::string& key,
+ const std::string& value) const
{
- if (!m_initialized)
- {
+ if (!m_initialized) {
LogError("PkgmgrSingal not yet intialized");
return false;
}
- if (key.empty() || value.empty())
- {
+ if (key.empty() || value.empty()) {
LogDebug("key or value is empty");
return false;
}
- if (m_handle == NULL || m_type.empty() || m_pkgname.empty())
- {
+ if (m_handle == NULL || m_type.empty() || m_pkgname.empty()) {
LogError("Some data of PkgmgrSignal is empty");
return false;
}
// send pkgmgr signal
if (pkgmgr_installer_send_signal(
- m_handle, m_type.c_str(), m_pkgname.c_str(),
- key.c_str(), value.c_str()))
+ m_handle, m_type.c_str(), m_pkgname.c_str(),
+ key.c_str(), value.c_str()))
{
LogError("Fail to send pkgmgr signal");
return false;
std::string PkgmgrSignal::getPkgname() const
{
- if (!m_initialized)
- {
+ if (!m_initialized) {
LogError("PkgmgrSingal not yet intialized");
}
int PkgmgrSignal::getRequestedType() const
{
- if (!m_initialized)
- {
+ if (!m_initialized) {
LogError("PkgmgrSingal not yet intialized");
}
bool PkgmgrSignal::isNoPopupRequired() const
{
- if (!m_initialized)
- {
+ if (!m_initialized) {
LogError("PkgmgrSingal not yet intialized");
}
#include <pkg-manager/pkgmgr_signal_interface.h>
#include <pkgmgr_installer.h>
-namespace PackageManager{
-
+namespace PackageManager {
#define PKGMGR_WEBAPP_TYPE "wgt"
#define PKGMGR_START_KEY "start"
#define PKGMGR_START_INSTALL "install"
typedef pkgmgr_installer* PkgmgrHandle;
-class PkgmgrSignal: public IPkgmgrSignal
+class PkgmgrSignal : public IPkgmgrSignal
{
- public:
- bool initialize(int argc, char* argv[]);
- bool deinitialize();
- bool setPkgname(const std::string& name);
- bool sendSignal(const std::string& key, const std::string& value) const;
- std::string getPkgname() const;
- int getRequestedType() const;
- bool isNoPopupRequired() const;
+ public:
+ bool initialize(int argc, char* argv[]);
+ bool deinitialize();
+ bool setPkgname(const std::string& name);
+ bool sendSignal(const std::string& key, const std::string& value) const;
+ std::string getPkgname() const;
+ int getRequestedType() const;
+ bool isNoPopupRequired() const;
- PkgmgrSignal();
- virtual ~PkgmgrSignal();
+ PkgmgrSignal();
+ virtual ~PkgmgrSignal();
- private:
- bool m_initialized;
- PkgmgrHandle m_handle;
- std::string m_type;
- std::string m_pkgname;
- bool m_noPopup;
- int m_reqType;
+ private:
+ bool m_initialized;
+ PkgmgrHandle m_handle;
+ std::string m_type;
+ std::string m_pkgname;
+ bool m_noPopup;
+ int m_reqType;
};
} // PackageManager
#include <pkg-manager/pkgmgr_signal_interface.h>
namespace PackageManager {
-
-class PkgmgrSignalDummy: public IPkgmgrSignal
+class PkgmgrSignalDummy : public IPkgmgrSignal
{
-public:
+ public:
PkgmgrSignalDummy()
- {
- }
+ {}
virtual ~PkgmgrSignalDummy()
- {
- }
+ {}
bool setPkgname(const std::string& name)
{
return false;
return "";
}
};
-
} // PkgmgrSignalDummy
#endif // WRT_PKGMGR_SIGNAL_DUMMY_H_
#include <string>
namespace PackageManager {
-
class IPkgmgrSignal
{
-public:
+ public:
virtual bool setPkgname(const std::string& name) = 0;
- virtual bool sendSignal(const std::string& key, const std::string& value) const = 0;
+ virtual bool sendSignal(const std::string& key,
+ const std::string& value) const = 0;
virtual std::string getPkgname() const = 0;
- virtual ~IPkgmgrSignal(){};
+ virtual ~IPkgmgrSignal(){}
};
-
} // IPkgmgrSignal
#endif // WRT_PKGMGR_SIGNAL_INTERFACE_H_
}
void StatusCallback(std::string tizenId,
- CommonError::Type result,
- void *data)
+ CommonError::Type result,
+ void *data)
{
LogDebug("StatusCallback called " << tizenId << " | " << result);
Assert(data != NULL);
// callback for finished install
void installFinishedCallback(void *userParam,
- std::string tizenId,
- Jobs::WidgetInstall::Exceptions::Type status)
+ std::string tizenId,
+ Jobs::WidgetInstall::Exceptions::Type status)
{
Assert(userParam != NULL);
// callback for finished install
void uninstallFinishedCallback(void *userParam,
- std::string tizenId,
- Jobs::WidgetUninstall::Exceptions::Type status)
+ std::string tizenId,
+ Jobs::WidgetUninstall::Exceptions::Type status)
{
Assert(userParam != NULL);
}
void pluginInstallFinishedCallback(void *userParam,
- Jobs::PluginInstall::Exceptions::Type status)
+ Jobs::PluginInstall::Exceptions::Type status)
{
Assert(userParam);
// callback for progress of install OR uninstall
void installProgressCallback(void *userParam,
- ProgressPercent percent,
- const ProgressDescription &description)
+ ProgressPercent percent,
+ const ProgressDescription &description)
{
Assert(userParam != NULL);
LogInfo("installProgressCallback: ignoring NULL callback pointer");
}
}
-
} //namespace
WrtProgressCallback progress_callback;
StatusCallbackStruct(void* u,
- WrtInstallerStatusCallback s,
- WrtProgressCallback p) :
+ WrtInstallerStatusCallback s,
+ WrtProgressCallback p) :
userdata(u),
status_callback(s),
progress_callback(p)
- {
- }
+ {}
};
struct PluginStatusCallbackStruct
WrtProgressCallback progressCallback;
PluginStatusCallbackStruct(void* u,
- WrtPluginInstallerStatusCallback s,
- WrtProgressCallback p) :
+ WrtPluginInstallerStatusCallback s,
+ WrtProgressCallback p) :
userdata(u),
statusCallback(s),
progressCallback(p)
- {
- }
+ {}
};
void StatusCallback(std::string tizenId,
- CommonError::Type result,
- void *data);
+ CommonError::Type result,
+ void *data);
void installFinishedCallback(void *userParam,
- std::string tizenId,
- Jobs::WidgetInstall::Exceptions::Type status);
+ std::string tizenId,
+ Jobs::WidgetInstall::Exceptions::Type status);
void uninstallFinishedCallback(void *userParam,
- std::string tizenId,
- Jobs::WidgetUninstall::Exceptions::Type status);
+ std::string tizenId,
+ Jobs::WidgetUninstall::Exceptions::Type status);
void pluginInstallFinishedCallback(void *userParam,
- Jobs::PluginInstall::Exceptions::Type status);
+ Jobs::PluginInstall::Exceptions::Type status);
// callback for progress of install OR uninstall
void installProgressCallback(void *userParam,
- ProgressPercent percent,
- const ProgressDescription &description);
-
+ ProgressPercent percent,
+ const ProgressDescription &description);
} //namespace
#endif /* WRT_SRC_API_API_CALLBACKS_TRANSLATE_H_ */
using namespace WrtDB;
-InstallerMainThread::InstallerMainThread() : m_attached(false) {
-}
+InstallerMainThread::InstallerMainThread() : m_attached(false) {}
-InstallerMainThread::~InstallerMainThread() {
+InstallerMainThread::~InstallerMainThread()
+{
Assert(!m_attached);
}
#include <dpl/singleton.h>
-class InstallerMainThread {
+class InstallerMainThread
+{
public:
void AttachDatabases();
void DetachDatabases();
if (token == parts.end()) {
return false;
}
- if (WrtDB::GlobalDAOReadOnly::IsValidSubTag(*token, RECORD_TYPE_LANGUAGE)) {
+ if (WrtDB::GlobalDAOReadOnly::IsValidSubTag(*token,
+ RECORD_TYPE_LANGUAGE))
+ {
++token;
} else {
return false;
bool one_or_more = false;
while (token != parts.end() &&
token->size() > 1 &&
- token->size() <= 8) {
+ token->size() <= 8)
+ {
one_or_more = true;
++token;
}
bool one_or_more = false;
while (token != parts.end() &&
!token->empty() &&
- token->size() <= 8) {
+ token->size() <= 8)
+ {
one_or_more = true;
++token;
}
bool one_or_more = false;
while (token != parts.end() &&
!token->empty() &&
- token->size() <= 8) {
+ token->size() <= 8)
+ {
one_or_more = true;
++token;
}
}
#define TEST_LANG(str, cond) \
- if (LanguageSubtagRstTreeSingleton::Instance().\
- ValidateLanguageTag(str) == cond) {\
- LogDebug("Good validate status for lang: " << str);\
- } else {\
- LogError("Wrong validate status for lang: " << str\
- << ", should be " << cond);\
+ if (LanguageSubtagRstTreeSingleton::Instance(). \
+ ValidateLanguageTag(str) == cond) { \
+ LogDebug("Good validate status for lang: " << str); \
+ } else { \
+ LogError("Wrong validate status for lang: " << str \
+ << ", should be " << cond); \
}
void LanguageSubtagRstTree::Initialize()
{
/* Temporarily added unit test. Commented out due to performance drop.
- TEST_LANG("zh", true);
- TEST_LANG("esx-al", true);
- TEST_LANG("zh-Hant", true);
- TEST_LANG("zh-Hant-CN", true);
- TEST_LANG("zh-Hant-CN-x-private1-private2", true);
- TEST_LANG("plxxx", false);
- TEST_LANG("pl-x-private111", false);
- TEST_LANG("x-private1", false); //do not support pure private ones
- TEST_LANG("x-private22", false);
- TEST_LANG("i-private22", false); //do not support i-*
- */
+ * TEST_LANG("zh", true);
+ * TEST_LANG("esx-al", true);
+ * TEST_LANG("zh-Hant", true);
+ * TEST_LANG("zh-Hant-CN", true);
+ * TEST_LANG("zh-Hant-CN-x-private1-private2", true);
+ * TEST_LANG("plxxx", false);
+ * TEST_LANG("pl-x-private111", false);
+ * TEST_LANG("x-private1", false); //do not support pure private ones
+ * TEST_LANG("x-private22", false);
+ * TEST_LANG("i-private22", false); //do not support i-*
+ */
}
#undef TEST_LANG
auto it = std::find_if(args.begin(),
args.end(),
- [&name](const std::string& option){
- return (option == name);
+ [&name](const std::string & option){
+ return (option == name);
});
- if (it != args.end())
- {
+ if (it != args.end()) {
std::string value;
- while ((++it != args.end()) && !IsOption(*it))
- {
+ while ((++it != args.end()) && !IsOption(*it)) {
value += *it + " ";
}
result = DPL::FromUTF8String(value);
class OptionParser
{
-public:
+ public:
static DPL::OptionalString QueryOption(int argc,
char* argv[],
- const std::string& name);
+ const std::string & name);
-private:
+ private:
static bool IsOption(const std::string& name);
};
LogInfo("Try to lock for plugins installation.");
s_plugin_install_lock_fd =
- open(PLUGIN_INSTALL_LOCK_FILE, O_RDONLY|O_CREAT, 0666);
+ open(PLUGIN_INSTALL_LOCK_FILE, O_RDONLY | O_CREAT, 0666);
- if (s_plugin_install_lock_fd == -1)
- {
+ if (s_plugin_install_lock_fd == -1) {
LogError("Lock file open failed!");
return false;
ret = flock(s_plugin_install_lock_fd, LOCK_EX); //lock with waiting
- if (ret == -1)
- {
+ if (ret == -1) {
LogError("Lock failed!");
close(s_plugin_install_lock_fd);
{
LogInfo("Unlock for plugins installation.");
- if (s_plugin_install_lock_fd != -1)
- {
+ if (s_plugin_install_lock_fd != -1) {
int ret = 0;
ret = flock(s_plugin_install_lock_fd, LOCK_UN); //unlock
- if (ret == -1)
- {
+ if (ret == -1) {
LogError("Unlock failed!");
}
s_plugin_install_lock_fd = -1;
return true;
- }
- else
- {
+ } else {
LogError("Lock file was not created!");
}
checkFile(installRequest);
switch (installationRequest) {
- case FileState::FILE_EXISTS:
- return true;
- case FileState::FILE_NOT_EXISTS:
- return false;
- default:
+ case FileState::FILE_EXISTS:
+ return true;
+ case FileState::FILE_NOT_EXISTS:
+ return false;
+ default:
LogWarning("Opening installation request file failed");
return false;
}
bool removeInstallationRequiredFlag();
FileState::Type checkFile(const std::string& filename);
bool removeFile(const std::string& filename);
-
}
#endif // PLUGIN_UTILS_H
#include <widget_parser.h>
#include <root_parser.h>
-
-
#define NOFILE_CNT_FOR_INSTALLER 9999
using namespace WrtDB;
struct free_deleter
{
- void operator()(void* x) { free(x); }
+ void operator()(void* x)
+ {
+ free(x);
+ }
};
struct PluginInstallerData
std::string arg = m_argv[0];
- pkgmgrSignalInterface = std::static_pointer_cast<PackageManager::IPkgmgrSignal>(
- std::shared_ptr<PackageManager::PkgmgrSignalDummy>(
- new PackageManager::PkgmgrSignalDummy()
- )
- );
+ pkgmgrSignalInterface =
+ std::static_pointer_cast<PackageManager::IPkgmgrSignal>(
+ std::shared_ptr<PackageManager::PkgmgrSignalDummy>(
+ new PackageManager::PkgmgrSignalDummy()
+ )
+ );
if (arg.empty()) {
return showHelpAndQuit();
installNewPlugins();
- if (arg.find("wrt-installer") != std::string::npos)
- {
+ if (arg.find("wrt-installer") != std::string::npos) {
if (m_argc <= 1) {
return showHelpAndQuit();
}
if (-1 != stat(m_argv[2], &info) && S_ISDIR(info.st_mode)) {
LogInfo("Installing package directly from directory");
m_installPolicy = WRT_WIM_POLICY_DIRECTORY_FORCE_INSTALL;
- }
- else
- {
+ } else {
LogInfo("Installing from regular location");
m_installPolicy = WRT_WIM_POLICY_WAC;
}
} else {
return showHelpAndQuit();
}
-
} else if (arg.find("backend") != std::string::npos) {
using namespace PackageManager;
m_installByPkgmgr = true;
- auto pkgmgrSignal = std::shared_ptr<PackageManager::PkgmgrSignal>(
- new PackageManager::PkgmgrSignal()
- );
+ auto pkgmgrSignal = std::shared_ptr<PackageManager::PkgmgrSignal>(
+ new PackageManager::PkgmgrSignal()
+ );
pkgmgrSignal->initialize(m_argc, m_argv);
m_quiet = pkgmgrSignal->isNoPopupRequired();
- LogDebug("backend m_quiet"<<m_quiet);
+ LogDebug("backend m_quiet" << m_quiet);
int reqType = pkgmgrSignal->getRequestedType();
pkgmgrSignalInterface =
- std::static_pointer_cast<PackageManager::IPkgmgrSignal>(pkgmgrSignal);
+ std::static_pointer_cast<PackageManager::IPkgmgrSignal>(
+ pkgmgrSignal);
switch (reqType) {
- case PKGMGR_REQ_INSTALL:
- m_packagePath = m_argv[4];
- struct stat info;
- if (-1 != stat(m_argv[4], &info) && S_ISDIR(info.st_mode)) {
- LogInfo("Installing package directly from directory");
- m_installPolicy = WRT_WIM_POLICY_DIRECTORY_FORCE_INSTALL;
- }
- else
- {
- LogInfo("Installing from regular location");
- m_installPolicy = WRT_WIM_POLICY_WAC;
- }
- AddStep(&WrtInstaller::installStep);
- break;
- case PKGMGR_REQ_UNINSTALL:
- m_name = m_argv[4];
- AddStep(&WrtInstaller::uninstallPkgNameStep);
- break;
- default:
- LogDebug("Not available type");
- break;
+ case PKGMGR_REQ_INSTALL:
+ m_packagePath = m_argv[4];
+ struct stat info;
+ if (-1 != stat(m_argv[4], &info) && S_ISDIR(info.st_mode)) {
+ LogInfo("Installing package directly from directory");
+ m_installPolicy = WRT_WIM_POLICY_DIRECTORY_FORCE_INSTALL;
+ } else {
+ LogInfo("Installing from regular location");
+ m_installPolicy = WRT_WIM_POLICY_WAC;
+ }
+ AddStep(&WrtInstaller::installStep);
+ break;
+ case PKGMGR_REQ_UNINSTALL:
+ m_name = m_argv[4];
+ AddStep(&WrtInstaller::uninstallPkgNameStep);
+ break;
+ default:
+ LogDebug("Not available type");
+ break;
}
}
AddStep(&WrtInstaller::shutdownStep);
- DPL::Event::ControllerEventHandler<WRTInstallerNS::NextStepEvent>::PostEvent(
+ DPL::Event::ControllerEventHandler<WRTInstallerNS::NextStepEvent>::
+ PostEvent(
WRTInstallerNS::NextStepEvent());
}
if (m_initialized) {
LogDebug("Wrt Shutdown now");
SwitchToStep(&WrtInstaller::shutdownStep);
- DPL::Event::ControllerEventHandler<WRTInstallerNS::NextStepEvent>::PostEvent(
+ DPL::Event::ControllerEventHandler<WRTInstallerNS::NextStepEvent>::
+ PostEvent(
WRTInstallerNS::NextStepEvent());
} else {
LogDebug("Quiting application");
(*m_pluginsPaths).pop_front();
wrt_install_plugin(privateData->pluginPath.c_str(),
- static_cast<void*>(privateData),
- &staticWrtPluginInstallationCallback,
- &staticWrtPluginInstallProgressCb);
+ static_cast<void*>(privateData),
+ &staticWrtPluginInstallationCallback,
+ &staticWrtPluginInstallProgressCb);
} else {
delete privateData;
}
{
LogDebug("Installing widget ...");
std::unique_ptr<char, free_deleter> packagePath(canonicalize_file_name(
- m_packagePath.c_str()));
+ m_packagePath.c_str()));
wrt_install_widget(packagePath ? packagePath.get() : m_packagePath.c_str(),
this, &staticWrtStatusCallback,
void WrtInstaller::installPluginsStep()
{
LogDebug("Installing plugins ...");
- fprintf(stderr,"Installing plugins ...\n");
+ fprintf(stderr, "Installing plugins ...\n");
if (m_startupPluginInstallation) {
LogInfo("Plugin installation started because new plugin package found");
} else if (!PluginUtils::lockPluginInstallation()) {
LogError("Failed to open plugin installation lock file"
- " Plugins are currently installed by other process");
+ " Plugins are currently installed by other process");
staticWrtPluginInstallationCallback(WRT_PLUGIN_INSTALLER_ERROR_LOCK,
- this);
+ this);
return;
}
if (-1 == TEMP_FAILURE_RETRY(closedir(dir))) {
LogError("Failed to close dir: " << PLUGIN_PATH << " with error: "
- << DPL::GetErrnoString());
+ << DPL::GetErrnoString());
}
}
LogDebug("Uninstalling widget ...");
LogDebug("Package name : " << m_name);
wrt_uninstall_widget(m_name.c_str(), this, &staticWrtStatusCallback,
- (!m_quiet || m_installByPkgmgr)
- ? &staticWrtUninstallProgressCallback : NULL,
- pkgmgrSignalInterface);
+ (!m_quiet || m_installByPkgmgr)
+ ? &staticWrtUninstallProgressCallback : NULL,
+ pkgmgrSignalInterface);
}
void WrtInstaller::uninstallGuidStep()
WrtErrStatus status = wrt_get_widget_by_guid(appid, m_name);
if (status == WRT_SUCCESS) {
LogDebug("Guid : " << m_name);
- wrt_uninstall_widget(appid.c_str(), this, &staticWrtStatusCallback,
- !m_quiet ? &staticWrtUninstallProgressCallback : NULL,
- pkgmgrSignalInterface);
+ wrt_uninstall_widget(
+ appid.c_str(), this, &staticWrtStatusCallback,
+ !m_quiet ? &staticWrtUninstallProgressCallback :
+ NULL,
+ pkgmgrSignalInterface);
} else {
printf("failed: can not uninstall widget\n");
LogError("Fail to uninstalling widget... ");
m_returnStatus = -1;
- DPL::Event::ControllerEventHandler<WRTInstallerNS::QuitEvent>::PostEvent(
+ DPL::Event::ControllerEventHandler<WRTInstallerNS::QuitEvent>::
+ PostEvent(
WRTInstallerNS::QuitEvent());
}
}
// Open zip file
std::unique_ptr<DPL::ZipInput> zipFile(
- new DPL::ZipInput(m_packagePath));
+ new DPL::ZipInput(m_packagePath));
// Open config.xml file
std::unique_ptr<DPL::ZipInput::File> configFile(
- zipFile->OpenFile(CONFIG_XML));
+ zipFile->OpenFile(CONFIG_XML));
// Extract config
DPL::BinaryQueue buffer;
DPL::AbstractWaitableOutputAdapter outputAdapter(&buffer);
DPL::Copy(&inputAdapter, &outputAdapter);
parser.Parse(&buffer,
- ElementParserPtr(
- new RootParser<WidgetParser>(configInfo,
- DPL::FromUTF32String(
- L"widget"))));
+ ElementParserPtr(
+ new RootParser<WidgetParser>(configInfo,
+ DPL::FromUTF32String(
+ L"widget"))));
DPL::OptionalString widgetGUID = configInfo.widget_id;
WrtErrStatus status = wrt_get_widget_by_guid(appid, guid);
if (status == WRT_SUCCESS) {
LogDebug("Appid from packagePath : " << appid);
- wrt_uninstall_widget(appid.c_str(), this, &staticWrtStatusCallback,
- !m_quiet ? &staticWrtUninstallProgressCallback : NULL,
- pkgmgrSignalInterface);
+ wrt_uninstall_widget(
+ appid.c_str(), this, &staticWrtStatusCallback,
+ !m_quiet ? &staticWrtUninstallProgressCallback
+ : NULL,
+ pkgmgrSignalInterface);
} else {
LogError("Fail to uninstalling widget... ");
m_returnStatus = -1;
- DPL::Event::ControllerEventHandler<WRTInstallerNS::QuitEvent>::PostEvent(
- WRTInstallerNS::QuitEvent());
+ DPL::Event::ControllerEventHandler<WRTInstallerNS::QuitEvent>::
+ PostEvent(
+ WRTInstallerNS::QuitEvent());
}
}
Catch(DPL::ZipInput::Exception::OpenFailed)
LogError("Failed to open widget package");
printf("failed: widget package does not exist\n");
m_returnStatus = -1;
- DPL::Event::ControllerEventHandler<WRTInstallerNS::QuitEvent>::PostEvent(
- WRTInstallerNS::QuitEvent());
+ DPL::Event::ControllerEventHandler<WRTInstallerNS::QuitEvent>::
+ PostEvent(
+ WRTInstallerNS::QuitEvent());
}
Catch(DPL::ZipInput::Exception::OpenFileFailed)
{
printf("failed: widget config file does not exist\n");
LogError("Failed to open config.xml file");
m_returnStatus = -1;
- DPL::Event::ControllerEventHandler<WRTInstallerNS::QuitEvent>::PostEvent(
- WRTInstallerNS::QuitEvent());
+ DPL::Event::ControllerEventHandler<WRTInstallerNS::QuitEvent>::
+ PostEvent(
+ WRTInstallerNS::QuitEvent());
}
Catch(ElementParser::Exception::ParseError)
{
printf("failed: can not parse config file\n");
LogError("Failed to parse config.xml file");
m_returnStatus = -1;
- DPL::Event::ControllerEventHandler<WRTInstallerNS::QuitEvent>::PostEvent(
- WRTInstallerNS::QuitEvent());
+ DPL::Event::ControllerEventHandler<WRTInstallerNS::QuitEvent>::
+ PostEvent(
+ WRTInstallerNS::QuitEvent());
}
}
if (m_initialized) {
wrt_installer_shutdown();
m_initialized = false;
- DPL::Event::ControllerEventHandler<WRTInstallerNS::QuitEvent>::PostEvent(
+ DPL::Event::ControllerEventHandler<WRTInstallerNS::QuitEvent>::
+ PostEvent(
WRTInstallerNS::QuitEvent());
}
}
void WrtInstaller::staticWrtInitCallback(WrtErrStatus status,
- void* userdata)
+ void* userdata)
{
WrtInstaller *This = static_cast<WrtInstaller*>(userdata);
Assert(This);
} else {
LogError("Init unsuccesfull");
This->m_returnStatus = -1;
- This->DPL::Event::ControllerEventHandler<WRTInstallerNS::QuitEvent>::PostEvent(
+ This->DPL::Event::ControllerEventHandler<WRTInstallerNS::QuitEvent>::
+ PostEvent(
WRTInstallerNS::QuitEvent());
}
}
DPL::String resultMsg;
std::string printMsg;
- if (current == &WrtInstaller::installStep)
- {
+ if (current == &WrtInstaller::installStep) {
resultMsg = DPL::FromUTF8String(PKGMGR_INSTALL_MSG);
printMsg = "installation";
} else if (current == &WrtInstaller::uninstallPkgNameStep ||
- current == &WrtInstaller::uninstallGuidStep ||
- current == &WrtInstaller::unistallWgtFileStep)
+ current == &WrtInstaller::uninstallGuidStep ||
+ current == &WrtInstaller::unistallWgtFileStep)
{
resultMsg = DPL::FromUTF8String(PKGMGR_UNINSTALL_MSG);
printMsg = "uninstallation";
This->m_returnStatus = -1;
if (This->popupsEnabled()) {
- resultMsg += L" : " + DPL::FromUTF8String(PKGMGR_END_FAILURE);
+ resultMsg += L" : " + DPL::FromUTF8String(PKGMGR_END_FAILURE);
This->m_popup->showPopup(This, resultMsg, failResultCallback);
} else {
This->DPL::Event::ControllerEventHandler<WRTInstallerNS::QuitEvent>
}
switch (status) {
- case WRT_INSTALLER_ERROR_INVALID_WIDGET_PACKAGE:
- This->m_returnStatus = 1; //this status is specific
- fprintf(stderr, "## wrt-installer : %s %s has failed - invalid widget package\n",
- tizenId.c_str(), printMsg.c_str());
- break;
-
- case WRT_INSTALLER_ERROR_WIDGET_DOES_NOT_EXIST:
- fprintf(stderr, "## wrt-installer : %s %s has failed - widget package does not exist\n",
- tizenId.c_str(), printMsg.c_str());
- break;
-
- case WRT_INSTALLER_ERROR_ALREADY_UNINSTALLING:
- fprintf(stderr, "## wrt-installer : %s %s has failed - already uninstalling\n",
- tizenId.c_str(), printMsg.c_str());
- break;
-
- case WRT_INSTALLER_ERROR_OUT_OUT_DISK_SPACE:
- fprintf(stderr,"## wrt-installer : %s %s has failed - out of disk space\n",
- tizenId.c_str(), printMsg.c_str());
- break;
-
- case WRT_INSTALLER_ERROR_INVALID_CERTIFICATE:
- fprintf(stderr,"## wrt-installer : %s %s has failed - invalid certificate\n",
- tizenId.c_str(), printMsg.c_str());
- break;
-
- case WRT_INSTALLER_ERROR_ALREADY_INSTALLED:
- fprintf(stderr,"## wrt-installer : %s %s has failed - already installed\n",
- tizenId.c_str(), printMsg.c_str());
- break;
-
- case WRT_INSTALLER_ERROR_INTERNAL:
- fprintf(stderr,"## wrt-installer : %s %s has failed - internal error\n",
- tizenId.c_str(), printMsg.c_str());
- break;
-
- case WRT_INSTALLER_ERROR_NOT_ALLOWED:
- fprintf(stderr,"## wrt-installer : %s %s has failed - installation or update not allowed; invalid"
- " mode\n", tizenId.c_str(), printMsg.c_str());
- break;
-
- case WRT_INSTALLER_ERROR_DEFERRED:
- fprintf(stderr,"## wrt-installer : deferred: widget update will continue after the widget"
- " has been stopped\n");
- break;
-
- case WRT_INSTALLER_ERROR_DATABASE_FAILURE:
- fprintf(stderr,"## wrt-installer : %s %s has failed - database failure\n",
- tizenId.c_str(), printMsg.c_str());
- break;
-
- case WRT_INSTALLER_ERROR_OSPSVC:
- fprintf(stderr,"## wrt-installer : %s %s has failed - during installation or"
- " uninstallation osp service\n", tizenId.c_str(),
- printMsg.c_str());
- break;
-
- case WRT_INSTALLER_ERROR_UNKNOWN:
- fprintf(stderr,"## wrt-installer : %s %s has failed - unknown error\n",
- tizenId.c_str(), printMsg.c_str());
- break;
-
- default:
- break;
-
+ case WRT_INSTALLER_ERROR_INVALID_WIDGET_PACKAGE:
+ This->m_returnStatus = 1; //this status is specific
+ fprintf(
+ stderr,
+ "## wrt-installer : %s %s has failed - invalid widget package\n",
+ tizenId.c_str(),
+ printMsg.c_str());
+ break;
+
+ case WRT_INSTALLER_ERROR_WIDGET_DOES_NOT_EXIST:
+ fprintf(
+ stderr,
+ "## wrt-installer : %s %s has failed - widget package does not exist\n",
+ tizenId.c_str(),
+ printMsg.c_str());
+ break;
+
+ case WRT_INSTALLER_ERROR_ALREADY_UNINSTALLING:
+ fprintf(
+ stderr,
+ "## wrt-installer : %s %s has failed - already uninstalling\n",
+ tizenId.c_str(),
+ printMsg.c_str());
+ break;
+
+ case WRT_INSTALLER_ERROR_OUT_OUT_DISK_SPACE:
+ fprintf(stderr,
+ "## wrt-installer : %s %s has failed - out of disk space\n",
+ tizenId.c_str(),
+ printMsg.c_str());
+ break;
+
+ case WRT_INSTALLER_ERROR_INVALID_CERTIFICATE:
+ fprintf(
+ stderr,
+ "## wrt-installer : %s %s has failed - invalid certificate\n",
+ tizenId.c_str(),
+ printMsg.c_str());
+ break;
+
+ case WRT_INSTALLER_ERROR_ALREADY_INSTALLED:
+ fprintf(stderr,
+ "## wrt-installer : %s %s has failed - already installed\n",
+ tizenId.c_str(),
+ printMsg.c_str());
+ break;
+
+ case WRT_INSTALLER_ERROR_INTERNAL:
+ fprintf(stderr,
+ "## wrt-installer : %s %s has failed - internal error\n",
+ tizenId.c_str(),
+ printMsg.c_str());
+ break;
+
+ case WRT_INSTALLER_ERROR_NOT_ALLOWED:
+ fprintf(
+ stderr,
+ "## wrt-installer : %s %s has failed - installation or update not allowed; invalid"
+ " mode\n",
+ tizenId.c_str(),
+ printMsg.c_str());
+ break;
+
+ case WRT_INSTALLER_ERROR_DEFERRED:
+ fprintf(
+ stderr,
+ "## wrt-installer : deferred: widget update will continue after the widget"
+ " has been stopped\n");
+ break;
+
+ case WRT_INSTALLER_ERROR_DATABASE_FAILURE:
+ fprintf(stderr,
+ "## wrt-installer : %s %s has failed - database failure\n",
+ tizenId.c_str(),
+ printMsg.c_str());
+ break;
+
+ case WRT_INSTALLER_ERROR_OSPSVC:
+ fprintf(
+ stderr,
+ "## wrt-installer : %s %s has failed - during installation or"
+ " uninstallation osp service\n",
+ tizenId.c_str(),
+ printMsg.c_str());
+ break;
+
+ case WRT_INSTALLER_ERROR_UNKNOWN:
+ fprintf(stderr,
+ "## wrt-installer : %s %s has failed - unknown error\n",
+ tizenId.c_str(),
+ printMsg.c_str());
+ break;
+
+ default:
+ break;
}
} else {
- fprintf(stderr, "## wrt-installer : %s %s was successful.\n", tizenId.c_str(), printMsg.c_str());
+ fprintf(stderr,
+ "## wrt-installer : %s %s was successful.\n",
+ tizenId.c_str(),
+ printMsg.c_str());
LogDebug("Status succesfull");
This->m_returnStatus = 0;
- resultMsg += L" : " + DPL::FromUTF8String(PKGMGR_END_SUCCESS);
+ resultMsg += L" : " + DPL::FromUTF8String(PKGMGR_END_SUCCESS);
if (This->popupsEnabled()) {
This->m_popup->showPopup(This, resultMsg, showResultCallback);
} else {
- This->DPL::Event::ControllerEventHandler<WRTInstallerNS::NextStepEvent>
+ This->DPL::Event::ControllerEventHandler<WRTInstallerNS::
+ NextStepEvent>
::PostEvent(WRTInstallerNS::NextStepEvent());
}
}
}
void WrtInstaller::staticWrtPluginInstallationCallback(WrtErrStatus status,
- void* userdata)
+ void* userdata)
{
Assert(userdata);
if (This->m_numPluginsToInstall < 1) {
LogDebug("All plugins installation completed");
- fprintf(stderr,"All plugins installation completed.\n");
+ fprintf(stderr, "All plugins installation completed.\n");
//remove installation request
if (!PluginUtils::removeInstallationRequiredFlag()) {
} else {
if (This->popupsEnabled()) {
This->m_popup->init();
- float percent = (This->m_totalPlugins - This->m_numPluginsToInstall)/(float)This->m_totalPlugins;
+ float percent =
+ (This->m_totalPlugins -
+ This->m_numPluginsToInstall) / (float)This->m_totalPlugins;
elm_progressbar_value_set(This->m_popup->m_progressbar, percent);
evas_object_show(This->m_popup->m_popup);
}
- This->DPL::Event::ControllerEventHandler<WRTInstallerNS::InstallPluginEvent>::PostEvent(
- WRTInstallerNS::InstallPluginEvent());
+ This->DPL::Event::ControllerEventHandler<WRTInstallerNS::
+ InstallPluginEvent>::
+ PostEvent(
+ WRTInstallerNS::InstallPluginEvent());
}
if (WRT_SUCCESS == status) {
This->m_returnStatus = 0;
- fprintf(stderr, "## wrt-installer : plugin installation successfull [%s]\n",
+ fprintf(stderr,
+ "## wrt-installer : plugin installation successfull [%s]\n",
path.c_str());
LogDebug("One plugin Installation succesfull: " << path);
return;
}
void WrtInstaller::staticWrtInstallProgressCallback(float percent,
- const char* description, void* userdata)
+ const char* description,
+ void* userdata)
{
WrtInstaller *This = static_cast<WrtInstaller*>(userdata);
std::stringstream percentStr;
if (This->popupsEnabled()) {
This->m_popup->init();
- elm_progressbar_value_set(This->m_popup->m_progressbar, percent/100.0);
+ elm_progressbar_value_set(This->m_popup->m_progressbar, percent / 100.0);
evas_object_show(This->m_popup->m_popup);
}
}
void WrtInstaller::staticWrtUninstallProgressCallback(float percent,
- const char* description, void* userdata)
+ const char* description,
+ void* userdata)
{
WrtInstaller *This = static_cast<WrtInstaller*>(userdata);
std::stringstream percentStr;
if (This->popupsEnabled()) {
This->m_popup->init();
- elm_progressbar_value_set(This->m_popup->m_progressbar, percent/100.0);
+ elm_progressbar_value_set(This->m_popup->m_progressbar, percent / 100.0);
evas_object_show(This->m_popup->m_popup);
}
}
m_win(NULL),
m_popup(NULL),
m_progressbar(NULL)
-{
-}
+{}
WrtInstaller::InstallerPopup::~InstallerPopup()
{
elm_object_style_set(m_progressbar, "list_progress");
elm_progressbar_horizontal_set(m_progressbar, EINA_TRUE);
evas_object_size_hint_align_set(m_progressbar, EVAS_HINT_FILL,
- EVAS_HINT_FILL);
+ EVAS_HINT_FILL);
evas_object_size_hint_weight_set(m_progressbar, EVAS_HINT_EXPAND,
- EVAS_HINT_EXPAND);
+ EVAS_HINT_EXPAND);
elm_object_content_set(m_popup, m_progressbar);
elm_progressbar_value_set(m_progressbar, 0.0);
evas_object_show(m_progressbar);
win = elm_win_add(NULL, name, ELM_WIN_DIALOG_BASIC);
int w, h;
- if(!win)
+ if (!win) {
return NULL;
+ }
elm_win_alpha_set(win, EINA_TRUE);
elm_win_title_set(win, name);
{
Evas_Object *btn;
-
LogDebug("Result Popup Created");
evas_object_del(m_popup);
m_popup = NULL;
m_popup = elm_popup_add(m_win);
- if (!m_popup)
+ if (!m_popup) {
return;
+ }
btn = elm_button_add(m_popup);
if (!btn) {
evas_object_show(m_popup);
evas_object_show(m_win);
-
}
void WrtInstaller::showResultCallback(void *data, Evas_Object* /*obj*/,
// Check and re-set the file open limitation
struct rlimit rlim;
if (getrlimit(RLIMIT_NOFILE, &rlim) != -1) {
- LogDebug("RLIMIT_NOFILE sft(" << rlim.rlim_cur << ")" );
- LogDebug("RLIMIT_NOFILE hrd(" << rlim.rlim_max << ")" );
+ LogDebug("RLIMIT_NOFILE sft(" << rlim.rlim_cur << ")");
+ LogDebug("RLIMIT_NOFILE hrd(" << rlim.rlim_max << ")");
if (rlim.rlim_cur < NOFILE_CNT_FOR_INSTALLER) {
rlim.rlim_cur = NOFILE_CNT_FOR_INSTALLER;
};
class WrtInstaller :
- public DPL::Application,
- private DPL::Event::Controller<DPL::TypeListDecl<
- WRTInstallerNS::QuitEvent,
- WRTInstallerNS::NextStepEvent,
- WRTInstallerNS::InstallPluginEvent>::Type>,
- public DPL::TaskDecl<WrtInstaller>
+ public DPL::Application,
+ private DPL::Event::Controller<DPL::TypeListDecl<
+ WRTInstallerNS::QuitEvent,
+ WRTInstallerNS::NextStepEvent,
+ WRTInstallerNS::InstallPluginEvent>::
+ Type>,
+ public DPL::TaskDecl<WrtInstaller>
{
public:
WrtInstaller(int argc,
- char **argv);
+ char **argv);
virtual ~WrtInstaller();
-
int getReturnStatus() const;
class InstallerPopup
{
- public:
- InstallerPopup();
- virtual ~InstallerPopup();
-
- void init();
- Evas_Object* createWin(const char* name);
- void showPopup(void* userdata, const DPL::String& pkgMsg,
- ShowResultCallback callback);
-
- Evas_Object* m_win;
- Evas_Object* m_popup;
- Evas_Object* m_progressbar;
+ public:
+ InstallerPopup();
+ virtual ~InstallerPopup();
+
+ void init();
+ Evas_Object* createWin(const char* name);
+ void showPopup(void* userdata, const DPL::String& pkgMsg,
+ ShowResultCallback callback);
+
+ Evas_Object* m_win;
+ Evas_Object* m_popup;
+ Evas_Object* m_progressbar;
};
protected:
// Events
virtual void OnEventReceived(const WRTInstallerNS::QuitEvent &event);
virtual void OnEventReceived(const WRTInstallerNS::NextStepEvent& event);
- virtual void OnEventReceived(const WRTInstallerNS::InstallPluginEvent& event);
+ virtual void OnEventReceived(
+ const WRTInstallerNS::InstallPluginEvent& event);
// Installation steps
void initStep();
void registerCallbackStep();
void queryListStep();
-
// Static callbacks
static void staticWrtInitCallback(WrtErrStatus status,
void* userdata);
const char* description,
void* userdata);
static void staticWrtInstallProgressCallback(float percent,
- const char* description,
- void* userdata);
+ const char* description,
+ void* userdata);
static void staticWrtUninstallProgressCallback(float percent,
- const char* description,
- void* userdata);
+ const char* description,
+ void* userdata);
static void showResultCallback(void *data, Evas_Object *obj,
void *event_info);
extern "C"
{
#endif
- inline WidgetUpdateMode::Type translateWidgetUpdateMode(
- wrt_widget_update_mode_t updateMode)
- {
- if (updateMode == WRT_WIM_POLICY_DIRECTORY_FORCE_INSTALL)
- return WidgetUpdateMode::PolicyDirectoryForceInstall;
-
- WidgetUpdateMode::Type result = WidgetUpdateMode::Zero;
- if (updateMode & WRT_WIM_NOT_INSTALLED) {
- result = result | WidgetUpdateMode::NotInstalled;
- }
-
- if (updateMode & WRT_WIM_INCOMING_VERSION_NOT_STD) {
- result = result | WidgetUpdateMode::IncomingVersionNotStd;
- }
-
- if (updateMode & WRT_WIM_EXISTING_VERSION_NOT_STD) {
- result = result | WidgetUpdateMode::ExistingVersionNotStd;
- }
-
- if (updateMode & WRT_WIM_BOTH_VERSIONS_NOT_STD) {
- result = result | WidgetUpdateMode::BothVersionsNotStd;
- }
-
- if (updateMode & WRT_WIM_EXISTING_VERSION_OLDER) {
- result = result | WidgetUpdateMode::ExistingVersionOlder;
- }
+inline WidgetUpdateMode::Type translateWidgetUpdateMode(
+ wrt_widget_update_mode_t updateMode)
+{
+ if (updateMode == WRT_WIM_POLICY_DIRECTORY_FORCE_INSTALL) {
+ return WidgetUpdateMode::PolicyDirectoryForceInstall;
+ }
- if (updateMode & WRT_WIM_EXISTING_VERSION_EQUAL) {
- result = result | WidgetUpdateMode::ExistingVersionEqual;
- }
+ WidgetUpdateMode::Type result = WidgetUpdateMode::Zero;
+ if (updateMode & WRT_WIM_NOT_INSTALLED) {
+ result = result | WidgetUpdateMode::NotInstalled;
+ }
- if (updateMode & WRT_WIM_EXISTING_VERSION_NEWER) {
- result = result | WidgetUpdateMode::ExistingVersionNewer;
- }
+ if (updateMode & WRT_WIM_INCOMING_VERSION_NOT_STD) {
+ result = result | WidgetUpdateMode::IncomingVersionNotStd;
+ }
- return result;
+ if (updateMode & WRT_WIM_EXISTING_VERSION_NOT_STD) {
+ result = result | WidgetUpdateMode::ExistingVersionNotStd;
}
- const char PLUGIN_INSTALL_SEMAPHORE[] = "/.wrt_plugin_install_lock";
- static int wrt_count_plugin;
+ if (updateMode & WRT_WIM_BOTH_VERSIONS_NOT_STD) {
+ result = result | WidgetUpdateMode::BothVersionsNotStd;
+ }
- static std::string cutOffFileName(const std::string& path)
- {
- size_t found = path.find_last_of("/");
- if (found == std::string::npos) {
- return path;
- } else {
- return path.substr(0, found);
- }
+ if (updateMode & WRT_WIM_EXISTING_VERSION_OLDER) {
+ result = result | WidgetUpdateMode::ExistingVersionOlder;
}
- static bool checkPath(const std::string& path)
- {
- struct stat st;
- if (0 == stat(path.c_str(), &st) && S_ISDIR(st.st_mode)) {
- return true;
- }
- LogError("Cannot access directory [ " << path << " ]");
- return false;
+ if (updateMode & WRT_WIM_EXISTING_VERSION_EQUAL) {
+ result = result | WidgetUpdateMode::ExistingVersionEqual;
}
- static bool checkPaths()
- {
- bool if_ok = true;
- if_ok &= (checkPath(cutOffFileName(
- GlobalConfig::GetWrtDatabaseFilePath())));
- if (!if_ok) {
- LogError(
- "Path <" << GlobalConfig::GetWrtDatabaseFilePath() <<
- "> does not exist.");
- }
+ if (updateMode & WRT_WIM_EXISTING_VERSION_NEWER) {
+ result = result | WidgetUpdateMode::ExistingVersionNewer;
+ }
- if_ok &= (checkPath(GlobalConfig::GetDevicePluginPath()));
- if (!if_ok) {
- LogError(
- "Path <" << GlobalConfig::GetDevicePluginPath() <<
- "> does not exist.");
- }
+ return result;
+}
- if_ok &= (checkPath(GlobalConfig::GetUserInstalledWidgetPath()));
- if (!if_ok) {
- LogError(
- "Path <" << GlobalConfig::GetUserInstalledWidgetPath() <<
- "> does not exist.");
- }
+const char PLUGIN_INSTALL_SEMAPHORE[] = "/.wrt_plugin_install_lock";
+static int wrt_count_plugin;
- if_ok &= (checkPath(GlobalConfig::GetUserPreloadedWidgetPath()));
- if (!if_ok) {
- LogError(
- "Path <" << GlobalConfig::GetUserPreloadedWidgetPath() <<
- "> does not exist.");
- }
- return if_ok;
+static std::string cutOffFileName(const std::string& path)
+{
+ size_t found = path.find_last_of("/");
+ if (found == std::string::npos) {
+ return path;
+ } else {
+ return path.substr(0, found);
}
+}
- void plugin_install_status_cb(WrtErrStatus status,
- void* userparam)
- {
- Assert(userparam);
-
- wrt_plugin_data *plugin_data = static_cast<wrt_plugin_data*>(userparam);
+static bool checkPath(const std::string& path)
+{
+ struct stat st;
+ if (0 == stat(path.c_str(), &st) && S_ISDIR(st.st_mode)) {
+ return true;
+ }
+ LogError("Cannot access directory [ " << path << " ]");
+ return false;
+}
- if (--wrt_count_plugin < 1) {
- LogDebug("All plugins installation completed");
+static bool checkPaths()
+{
+ bool if_ok = true;
+ if_ok &= (checkPath(cutOffFileName(
+ GlobalConfig::GetWrtDatabaseFilePath())));
+ if (!if_ok) {
+ LogError(
+ "Path <" << GlobalConfig::GetWrtDatabaseFilePath() <<
+ "> does not exist.");
+ }
- LogDebug("Call SetAllinstallpluginsCallback");
- plugin_data->plugin_installed_cb(plugin_data->user_data);
- }
+ if_ok &= (checkPath(GlobalConfig::GetDevicePluginPath()));
+ if (!if_ok) {
+ LogError(
+ "Path <" << GlobalConfig::GetDevicePluginPath() <<
+ "> does not exist.");
+ }
- if (status == WRT_SUCCESS) {
- LogInfo(
- "plugin installation is successful: " <<
- plugin_data->plugin_path);
- return;
- }
+ if_ok &= (checkPath(GlobalConfig::GetUserInstalledWidgetPath()));
+ if (!if_ok) {
+ LogError(
+ "Path <" << GlobalConfig::GetUserInstalledWidgetPath() <<
+ "> does not exist.");
+ }
- LogError("Fail to install plugin : " << plugin_data->plugin_path);
-
- switch (status) {
- case WRT_PLUGIN_INSTALLER_ERROR_WRONG_PATH:
- LogError("Failed : Plugin install path is wrong");
- break;
- case WRT_PLUGIN_INSTALLER_ERROR_METAFILE:
- LogError("Failed : Plugin Metafile Error");
- break;
- case WRT_PLUGIN_INSTALLER_ERROR_ALREADY_INSTALLED:
- LogError("Failed : This Plugin is already installed");
- break;
- case WRT_PLUGIN_INSTALLER_ERROR_LIBRARY_ERROR:
- LogError("Failed : Library Error. Missing symbol or structures");
- break;
- case WRT_PLUGIN_INSTALLER_ERROR_WAITING:
- LogError("Failed : Waiting for plugin dependencies");
- break;
- case WRT_PLUGIN_INSTALLER_ERROR_LOCK:
- LogError("Failed : Lock Error");
- break;
- case WRT_PLUGIN_INSTALLER_ERROR_UNKNOWN:
- LogError("Failed : Unkown Error");
- break;
- default:
- break;
- }
+ if_ok &= (checkPath(GlobalConfig::GetUserPreloadedWidgetPath()));
+ if (!if_ok) {
+ LogError(
+ "Path <" << GlobalConfig::GetUserPreloadedWidgetPath() <<
+ "> does not exist.");
}
+ return if_ok;
+}
- void plugin_install_progress_cb(float percent,
- const char* description,
- void* userdata)
- {
- char *plugin_path = static_cast<char*>(userdata);
+void plugin_install_status_cb(WrtErrStatus status,
+ void* userparam)
+{
+ Assert(userparam);
- LogInfo("Install plugin : " << plugin_path <<
- ", Progress : " << percent <<
- ", Description : " << description);
- }
+ wrt_plugin_data *plugin_data = static_cast<wrt_plugin_data*>(userparam);
- EXPORT_API int wrt_installer_init(void *userdata,
- WrtInstallerInitCallback callback)
- {
- // Set DPL/LOG MID
- DPL::Log::LogSystemSingleton::Instance().SetTag("WRT");
+ if (--wrt_count_plugin < 1) {
+ LogDebug("All plugins installation completed");
- try
- {
- LogInfo("[WRT-API] INITIALIZING WRT INSTALLER...");
- LogInfo("[WRT-API] BUILD: " << __TIMESTAMP__);
-
- // Touch InstallerController Singleton
- InstallerMainThreadSingleton::Instance().TouchArchitecture();
-
- // Check paths
- if (!checkPaths()) {
- if (callback) {
- callback(WRT_ERROR_NO_PATH, userdata);
- }
- return TRUE;
- }
+ LogDebug("Call SetAllinstallpluginsCallback");
+ plugin_data->plugin_installed_cb(plugin_data->user_data);
+ }
- // Initialize ValidationCore - this must be done before AttachDatabases
- ValidationCore::VCoreInit(
- std::string(GlobalConfig::GetFingerprintListFile()),
- std::string(GlobalConfig::GetFingerprintListSchema()),
- std::string(GlobalConfig::GetVCoreDatabaseFilePath()));
+ if (status == WRT_SUCCESS) {
+ LogInfo(
+ "plugin installation is successful: " <<
+ plugin_data->plugin_path);
+ return;
+ }
- InstallerMainThreadSingleton::Instance().AttachDatabases();
+ LogError("Fail to install plugin : " << plugin_data->plugin_path);
+
+ switch (status) {
+ case WRT_PLUGIN_INSTALLER_ERROR_WRONG_PATH:
+ LogError("Failed : Plugin install path is wrong");
+ break;
+ case WRT_PLUGIN_INSTALLER_ERROR_METAFILE:
+ LogError("Failed : Plugin Metafile Error");
+ break;
+ case WRT_PLUGIN_INSTALLER_ERROR_ALREADY_INSTALLED:
+ LogError("Failed : This Plugin is already installed");
+ break;
+ case WRT_PLUGIN_INSTALLER_ERROR_LIBRARY_ERROR:
+ LogError("Failed : Library Error. Missing symbol or structures");
+ break;
+ case WRT_PLUGIN_INSTALLER_ERROR_WAITING:
+ LogError("Failed : Waiting for plugin dependencies");
+ break;
+ case WRT_PLUGIN_INSTALLER_ERROR_LOCK:
+ LogError("Failed : Lock Error");
+ break;
+ case WRT_PLUGIN_INSTALLER_ERROR_UNKNOWN:
+ LogError("Failed : Unkown Error");
+ break;
+ default:
+ break;
+ }
+}
- //checking for correct DB version
-// if (!WrtDB::WrtDatabase::CheckTableExist(DB_CHECKSUM_STR)) {
-// LogError("WRONG VERSION OF WRT DATABASE");
-// Assert(false && "WRONG VERSION OF WRT DATABASE");
-// return FALSE;
-// }
- LogWarning("Database check not implemented!");
+void plugin_install_progress_cb(float percent,
+ const char* description,
+ void* userdata)
+{
+ char *plugin_path = static_cast<char*>(userdata);
- LogInfo("Prepare libxml2 to work in multithreaded program.");
- xmlInitParser();
+ LogInfo("Install plugin : " << plugin_path <<
+ ", Progress : " << percent <<
+ ", Description : " << description);
+}
- // Initialize Language Subtag registry
- LanguageSubtagRstTreeSingleton::Instance().Initialize();
+EXPORT_API int wrt_installer_init(void *userdata,
+ WrtInstallerInitCallback callback)
+{
+ // Set DPL/LOG MID
+ DPL::Log::LogSystemSingleton::Instance().SetTag("WRT");
- // Installer init
- CONTROLLER_POST_SYNC_EVENT(
- Logic::InstallerController,
- InstallerControllerEvents::
- InitializeEvent());
+ try {
+ LogInfo("[WRT-API] INITIALIZING WRT INSTALLER...");
+ LogInfo("[WRT-API] BUILD: " << __TIMESTAMP__);
- // Install deferred widget packages
- CONTROLLER_POST_EVENT(
- Logic::InstallerController,
- InstallerControllerEvents::
- InstallDeferredWidgetPackagesEvent());
+ // Touch InstallerController Singleton
+ InstallerMainThreadSingleton::Instance().TouchArchitecture();
+ // Check paths
+ if (!checkPaths()) {
if (callback) {
- LogInfo("[WRT-API] WRT INSTALLER INITIALIZATION CALLBACK");
- callback(WRT_SUCCESS, userdata);
- }
- }
- catch (const DPL::Exception& ex)
- {
- LogError("Internal Error during Init:");
- DPL::Exception::DisplayKnownException(ex);
- if (callback) {
- callback(WRT_ERROR_INTERNAL, userdata);
+ callback(WRT_ERROR_NO_PATH, userdata);
}
- return FALSE;
+ return TRUE;
}
- // OK
- return TRUE;
- }
-
- EXPORT_API void wrt_installer_shutdown()
- {
- try
- {
- LogInfo("[WRT-API] DEINITIALIZING WRT INSTALLER...");
-
- // Installer termination
- CONTROLLER_POST_SYNC_EVENT(
- Logic::InstallerController,
- InstallerControllerEvents::
- TerminateEvent());
-
- InstallerMainThreadSingleton::Instance().DetachDatabases();
-
- // This must be done after DetachDatabase
- ValidationCore::VCoreDeinit();
-
- // Global deinit check
- LogInfo("Cleanup libxml2 global values.");
- xmlCleanupParser();
+ // Initialize ValidationCore - this must be done before AttachDatabases
+ ValidationCore::VCoreInit(
+ std::string(GlobalConfig::GetFingerprintListFile()),
+ std::string(GlobalConfig::GetFingerprintListSchema()),
+ std::string(GlobalConfig::GetVCoreDatabaseFilePath()));
+
+ InstallerMainThreadSingleton::Instance().AttachDatabases();
+
+ //checking for correct DB version
+ // if (!WrtDB::WrtDatabase::CheckTableExist(DB_CHECKSUM_STR))
+ // {
+ // LogError("WRONG VERSION OF WRT DATABASE");
+ // Assert(false && "WRONG VERSION OF WRT DATABASE");
+ // return FALSE;
+ // }
+ LogWarning("Database check not implemented!");
+
+ LogInfo("Prepare libxml2 to work in multithreaded program.");
+ xmlInitParser();
+
+ // Initialize Language Subtag registry
+ LanguageSubtagRstTreeSingleton::Instance().Initialize();
+
+ // Installer init
+ CONTROLLER_POST_SYNC_EVENT(
+ Logic::InstallerController,
+ InstallerControllerEvents::
+ InitializeEvent());
+
+ // Install deferred widget packages
+ CONTROLLER_POST_EVENT(
+ Logic::InstallerController,
+ InstallerControllerEvents::
+ InstallDeferredWidgetPackagesEvent());
+
+ if (callback) {
+ LogInfo("[WRT-API] WRT INSTALLER INITIALIZATION CALLBACK");
+ callback(WRT_SUCCESS, userdata);
}
- catch (const DPL::Exception& ex)
- {
- LogError("Internal Error during Shutdown:");
- DPL::Exception::DisplayKnownException(ex);
+ } catch (const DPL::Exception& ex) {
+ LogError("Internal Error during Init:");
+ DPL::Exception::DisplayKnownException(ex);
+ if (callback) {
+ callback(WRT_ERROR_INTERNAL, userdata);
}
+ return FALSE;
}
+ // OK
+ return TRUE;
+}
+
+EXPORT_API void wrt_installer_shutdown()
+{
+ try {
+ LogInfo("[WRT-API] DEINITIALIZING WRT INSTALLER...");
+
+ // Installer termination
+ CONTROLLER_POST_SYNC_EVENT(
+ Logic::InstallerController,
+ InstallerControllerEvents::
+ TerminateEvent());
+
+ InstallerMainThreadSingleton::Instance().DetachDatabases();
+
+ // This must be done after DetachDatabase
+ ValidationCore::VCoreDeinit();
+
+ // Global deinit check
+ LogInfo("Cleanup libxml2 global values.");
+ xmlCleanupParser();
+ } catch (const DPL::Exception& ex) {
+ LogError("Internal Error during Shutdown:");
+ DPL::Exception::DisplayKnownException(ex);
+ }
+}
- EXPORT_API void wrt_install_widget(const char *path,
- void* userdata,
- WrtInstallerStatusCallback status_cb,
- WrtProgressCallback progress_cb,
- wrt_widget_update_mode_t update_mode,
- bool quiet,
- bool preload,
- std::shared_ptr<PackageManager::IPkgmgrSignal> pkgmgrInterface
- )
+EXPORT_API void wrt_install_widget(
+ const char *path,
+ void* userdata,
+ WrtInstallerStatusCallback status_cb,
+ WrtProgressCallback progress_cb,
+ wrt_widget_update_mode_t update_mode,
+ bool quiet,
+ bool preload,
+ std::shared_ptr<PackageManager::
+ IPkgmgrSignal> pkgmgrInterface
+ )
+{
+ UNHANDLED_EXCEPTION_HANDLER_BEGIN
{
- UNHANDLED_EXCEPTION_HANDLER_BEGIN
- {
- LogInfo("[WRT-API] INSTALL WIDGET: " << path);
- // Post installation event
- CONTROLLER_POST_EVENT(
- Logic::InstallerController,
- InstallerControllerEvents::InstallWidgetEvent(
- path, WidgetInstallationStruct(
- InstallerCallbacksTranslate::installFinishedCallback,
- InstallerCallbacksTranslate::installProgressCallback,
- new InstallerCallbacksTranslate::StatusCallbackStruct(
- userdata, status_cb, progress_cb),
- translateWidgetUpdateMode(update_mode),
- quiet,
- preload,
- pkgmgrInterface)));
- }
- UNHANDLED_EXCEPTION_HANDLER_END
+ LogInfo("[WRT-API] INSTALL WIDGET: " << path);
+ // Post installation event
+ CONTROLLER_POST_EVENT(
+ Logic::InstallerController,
+ InstallerControllerEvents::InstallWidgetEvent(
+ path, WidgetInstallationStruct(
+ InstallerCallbacksTranslate::installFinishedCallback,
+ InstallerCallbacksTranslate::installProgressCallback,
+ new InstallerCallbacksTranslate::StatusCallbackStruct(
+ userdata, status_cb, progress_cb),
+ translateWidgetUpdateMode(update_mode),
+ quiet,
+ preload,
+ pkgmgrInterface)));
}
+ UNHANDLED_EXCEPTION_HANDLER_END
+}
- EXPORT_API void wrt_uninstall_widget(const char * const tzAppid,
- void* userdata,
- WrtInstallerStatusCallback status_cb,
- WrtProgressCallback progress_cb,
- std::shared_ptr<PackageManager::IPkgmgrSignal> pkgmgrSignalInterface)
+EXPORT_API void wrt_uninstall_widget(
+ const char * const tzAppid,
+ void* userdata,
+ WrtInstallerStatusCallback status_cb,
+ WrtProgressCallback progress_cb,
+ std::shared_ptr<PackageManager::
+ IPkgmgrSignal> pkgmgrSignalInterface)
+{
+ UNHANDLED_EXCEPTION_HANDLER_BEGIN
{
- UNHANDLED_EXCEPTION_HANDLER_BEGIN
- {
- std::string tizenAppid(tzAppid);
- LogInfo("[WRT-API] UNINSTALL WIDGET: " << tizenAppid);
- // Post uninstallation event
- CONTROLLER_POST_EVENT(
- Logic::InstallerController,
- InstallerControllerEvents::UninstallWidgetEvent(
- tizenAppid,
- WidgetUninstallationStruct(
- InstallerCallbacksTranslate::uninstallFinishedCallback,
- InstallerCallbacksTranslate::installProgressCallback,
- new InstallerCallbacksTranslate::StatusCallbackStruct(
- userdata, status_cb, progress_cb),
- pkgmgrSignalInterface
- )
+ std::string tizenAppid(tzAppid);
+ LogInfo("[WRT-API] UNINSTALL WIDGET: " << tizenAppid);
+ // Post uninstallation event
+ CONTROLLER_POST_EVENT(
+ Logic::InstallerController,
+ InstallerControllerEvents::UninstallWidgetEvent(
+ tizenAppid,
+ WidgetUninstallationStruct(
+ InstallerCallbacksTranslate::uninstallFinishedCallback,
+ InstallerCallbacksTranslate::installProgressCallback,
+ new InstallerCallbacksTranslate::StatusCallbackStruct(
+ userdata, status_cb, progress_cb),
+ pkgmgrSignalInterface
)
+ )
);
- }
- UNHANDLED_EXCEPTION_HANDLER_END
}
+ UNHANDLED_EXCEPTION_HANDLER_END
+}
- EXPORT_API void wrt_install_plugin(
- const char *pluginDir,
- void *user_param,
- WrtPluginInstallerStatusCallback status_cb,
- WrtProgressCallback progress_cb)
+EXPORT_API void wrt_install_plugin(
+ const char *pluginDir,
+ void *user_param,
+ WrtPluginInstallerStatusCallback status_cb,
+ WrtProgressCallback progress_cb)
+{
+ UNHANDLED_EXCEPTION_HANDLER_BEGIN
{
- UNHANDLED_EXCEPTION_HANDLER_BEGIN
- {
- LogInfo("[WRT-API] INSTALL PLUGIN: " << pluginDir);
- //Private data for status callback
- //Resource is free in pluginInstallFinishedCallback
- InstallerCallbacksTranslate::PluginStatusCallbackStruct*
- callbackStruct =
- new InstallerCallbacksTranslate::PluginStatusCallbackStruct(
- user_param, status_cb, progress_cb);
-
- CONTROLLER_POST_EVENT(
- Logic::InstallerController,
- InstallerControllerEvents::InstallPluginEvent(
- std::string(pluginDir),
- PluginInstallerStruct(
- InstallerCallbacksTranslate::
+ LogInfo("[WRT-API] INSTALL PLUGIN: " << pluginDir);
+ //Private data for status callback
+ //Resource is free in pluginInstallFinishedCallback
+ InstallerCallbacksTranslate::PluginStatusCallbackStruct*
+ callbackStruct =
+ new InstallerCallbacksTranslate::PluginStatusCallbackStruct(
+ user_param, status_cb, progress_cb);
+
+ CONTROLLER_POST_EVENT(
+ Logic::InstallerController,
+ InstallerControllerEvents::InstallPluginEvent(
+ std::string(pluginDir),
+ PluginInstallerStruct(
+ InstallerCallbacksTranslate::
pluginInstallFinishedCallback,
- InstallerCallbacksTranslate::
+ InstallerCallbacksTranslate::
installProgressCallback, callbackStruct)));
- }
- UNHANDLED_EXCEPTION_HANDLER_END
}
+ UNHANDLED_EXCEPTION_HANDLER_END
+}
- EXPORT_API void wrt_install_all_plugins(
- WrtAllPluginInstalledCallback installed_cb,
- void *user_param)
+EXPORT_API void wrt_install_all_plugins(
+ WrtAllPluginInstalledCallback installed_cb,
+ void *user_param)
+{
+ UNHANDLED_EXCEPTION_HANDLER_BEGIN
{
- UNHANDLED_EXCEPTION_HANDLER_BEGIN
- {
- std::string installRequest =
- std::string(GlobalConfig::GetPluginInstallInitializerName());
-
- LogDebug("Install new plugins");
-
- Try {
- DPL::Semaphore lock(PLUGIN_INSTALL_SEMAPHORE);
- }
- Catch(DPL::Semaphore::Exception::Base){
- LogError("Failed to create installation lock");
- return;
- }
+ std::string installRequest =
+ std::string(GlobalConfig::GetPluginInstallInitializerName());
- struct stat tmp;
+ LogDebug("Install new plugins");
- if (-1 == stat(installRequest.c_str(), &tmp) ||
- !S_ISREG(tmp.st_mode))
- {
- if (ENOENT == errno) {
- LogDebug("Plugin installation not required");
+ Try {
+ DPL::Semaphore lock(PLUGIN_INSTALL_SEMAPHORE);
+ }
+ Catch(DPL::Semaphore::Exception::Base){
+ LogError("Failed to create installation lock");
+ return;
+ }
- LogDebug("Call SetAllinstallPluginCallback");
- installed_cb(user_param);
+ struct stat tmp;
- DPL::Semaphore::Remove(PLUGIN_INSTALL_SEMAPHORE);
- return;
- }
- LogWarning("Opening installation request file failed");
- }
+ if (-1 == stat(installRequest.c_str(), &tmp) ||
+ !S_ISREG(tmp.st_mode))
+ {
+ if (ENOENT == errno) {
+ LogDebug("Plugin installation not required");
- std::string PLUGIN_PATH =
- std::string(GlobalConfig::GetDevicePluginPath());
+ LogDebug("Call SetAllinstallPluginCallback");
+ installed_cb(user_param);
- DIR *dir;
- dir = opendir(PLUGIN_PATH.c_str());
- if (!dir) {
DPL::Semaphore::Remove(PLUGIN_INSTALL_SEMAPHORE);
return;
}
+ LogWarning("Opening installation request file failed");
+ }
- LogInfo("Plugin DIRECTORY IS" << PLUGIN_PATH);
- struct dirent* libdir;
+ std::string PLUGIN_PATH =
+ std::string(GlobalConfig::GetDevicePluginPath());
- errno = 0;
+ DIR *dir;
+ dir = opendir(PLUGIN_PATH.c_str());
+ if (!dir) {
+ DPL::Semaphore::Remove(PLUGIN_INSTALL_SEMAPHORE);
+ return;
+ }
- std::list<std::string> pluginsPaths;
+ LogInfo("Plugin DIRECTORY IS" << PLUGIN_PATH);
+ struct dirent* libdir;
- while ((libdir = readdir(dir)) != 0) {
- if (strcmp(libdir->d_name, ".") == 0 ||
- strcmp(libdir->d_name, "..") == 0)
- {
- continue;
- }
+ errno = 0;
- std::string path = PLUGIN_PATH;
- path += "/";
- path += libdir->d_name;
+ std::list<std::string> pluginsPaths;
- struct stat tmp;
+ while ((libdir = readdir(dir)) != 0) {
+ if (strcmp(libdir->d_name, ".") == 0 ||
+ strcmp(libdir->d_name, "..") == 0)
+ {
+ continue;
+ }
- if (stat(path.c_str(), &tmp) == -1) {
- LogError("Failed to open file" << path);
- continue;
- }
+ std::string path = PLUGIN_PATH;
+ path += "/";
+ path += libdir->d_name;
- if (!S_ISDIR(tmp.st_mode)) {
- LogError("Not a directory" << path);
- continue;
- }
+ struct stat tmp;
- pluginsPaths.push_back(path);
+ if (stat(path.c_str(), &tmp) == -1) {
+ LogError("Failed to open file" << path);
+ continue;
}
- wrt_count_plugin = pluginsPaths.size();
+ if (!S_ISDIR(tmp.st_mode)) {
+ LogError("Not a directory" << path);
+ continue;
+ }
- FOREACH(it, pluginsPaths) {
- wrt_plugin_data *plugin_data = new wrt_plugin_data;
+ pluginsPaths.push_back(path);
+ }
- plugin_data->plugin_installed_cb = installed_cb;
- plugin_data->plugin_path = const_cast<char*>(it->c_str());
- plugin_data->user_data = user_param;
+ wrt_count_plugin = pluginsPaths.size();
- wrt_install_plugin(
- it->c_str(), static_cast<void*>(plugin_data),
- plugin_install_status_cb,
- plugin_install_progress_cb);
- }
+ FOREACH(it, pluginsPaths) {
+ wrt_plugin_data *plugin_data = new wrt_plugin_data;
- if (-1 == TEMP_FAILURE_RETRY(closedir(dir))) {
- LogError("Failed to close dir: " << PLUGIN_PATH << " with error: "
- << DPL::GetErrnoString());
- }
+ plugin_data->plugin_installed_cb = installed_cb;
+ plugin_data->plugin_path = const_cast<char*>(it->c_str());
+ plugin_data->user_data = user_param;
- if (0 != unlink(installRequest.c_str())) {
- LogError("Failed to remove file initializing plugin "
- "installation");
- }
+ wrt_install_plugin(
+ it->c_str(), static_cast<void*>(plugin_data),
+ plugin_install_status_cb,
+ plugin_install_progress_cb);
+ }
- Try {
- DPL::Semaphore::Remove(PLUGIN_INSTALL_SEMAPHORE);
- }
- Catch(DPL::Semaphore::Exception::Base){
- LogInfo("Failed to remove installation lock");
- }
+ if (-1 == TEMP_FAILURE_RETRY(closedir(dir))) {
+ LogError("Failed to close dir: " << PLUGIN_PATH << " with error: "
+ << DPL::GetErrnoString());
+ }
+
+ if (0 != unlink(installRequest.c_str())) {
+ LogError("Failed to remove file initializing plugin "
+ "installation");
+ }
+
+ Try {
+ DPL::Semaphore::Remove(PLUGIN_INSTALL_SEMAPHORE);
+ }
+ Catch(DPL::Semaphore::Exception::Base){
+ LogInfo("Failed to remove installation lock");
}
- UNHANDLED_EXCEPTION_HANDLER_END
}
+ UNHANDLED_EXCEPTION_HANDLER_END
+}
- EXPORT_API int wrt_installer_init_for_tests(void *userdata,
- WrtInstallerInitCallback callback)
- {
- // Set DPL/LOG MID
- DPL::Log::LogSystemSingleton::Instance().SetTag("WRT");
+EXPORT_API int wrt_installer_init_for_tests(void *userdata,
+ WrtInstallerInitCallback callback)
+{
+ // Set DPL/LOG MID
+ DPL::Log::LogSystemSingleton::Instance().SetTag("WRT");
- try
- {
- LogInfo("[WRT-API] INITIALIZING WRT INSTALLER...");
- LogInfo("[WRT-API] BUILD: " << __TIMESTAMP__);
-
- // Touch InstallerController Singleton
- InstallerMainThreadSingleton::Instance().
- TouchArchitectureOnlyInstaller();
-
- // Check paths
- if (!checkPaths()) {
- if (callback) {
- callback(WRT_ERROR_NO_PATH, userdata);
- }
- return TRUE;
- }
+ try {
+ LogInfo("[WRT-API] INITIALIZING WRT INSTALLER...");
+ LogInfo("[WRT-API] BUILD: " << __TIMESTAMP__);
- CONTROLLER_POST_SYNC_EVENT(
- Logic::InstallerController,
- InstallerControllerEvents::
- InitializeEvent());
+ // Touch InstallerController Singleton
+ InstallerMainThreadSingleton::Instance().
+ TouchArchitectureOnlyInstaller();
+ // Check paths
+ if (!checkPaths()) {
if (callback) {
- LogInfo("[WRT-API] WRT INSTALLER INITIALIZATION CALLBACK");
- callback(WRT_SUCCESS, userdata);
+ callback(WRT_ERROR_NO_PATH, userdata);
}
- }
- catch (const DPL::Exception& ex)
- {
- LogError("Internal Error during Init:");
- DPL::Exception::DisplayKnownException(ex);
- if (callback) {
- callback(WRT_ERROR_INTERNAL, userdata);
- }
- return FALSE;
+ return TRUE;
}
- // OK
- return TRUE;
- }
+ CONTROLLER_POST_SYNC_EVENT(
+ Logic::InstallerController,
+ InstallerControllerEvents::
+ InitializeEvent());
- EXPORT_API void wrt_installer_shutdown_for_tests()
- {
- try
- {
- LogInfo("[WRT-API] DEINITIALIZING WRT INSTALLER...");
-
- // Installer termination
- CONTROLLER_POST_SYNC_EVENT(
- Logic::InstallerController,
- InstallerControllerEvents::
- TerminateEvent());
-
- // Global deinit check
- LogInfo("Cleanup libxml2 global values.");
- xmlCleanupParser();
+ if (callback) {
+ LogInfo("[WRT-API] WRT INSTALLER INITIALIZATION CALLBACK");
+ callback(WRT_SUCCESS, userdata);
}
- catch (const DPL::Exception& ex)
- {
- LogError("Internal Error during Shutdown:");
- DPL::Exception::DisplayKnownException(ex);
+ } catch (const DPL::Exception& ex) {
+ LogError("Internal Error during Init:");
+ DPL::Exception::DisplayKnownException(ex);
+ if (callback) {
+ callback(WRT_ERROR_INTERNAL, userdata);
}
+ return FALSE;
}
- EXPORT_API WrtErrStatus wrt_get_widget_by_guid(std::string & tzAppid,
- const std::string guid)
- {
- try
- {
- LogInfo("[WRT-API] GETTING WIDGET PACKAGE NAME BY WidgetID : "
- << guid);
+ // OK
+ return TRUE;
+}
- WidgetGUID widget_guid = DPL::FromUTF8String(guid);
- WrtDB::WidgetDAOReadOnly dao(widget_guid);
- tzAppid = DPL::ToUTF8String(dao.getTzAppId());
- return WRT_SUCCESS;
- }
- catch (WidgetDAOReadOnly::Exception::WidgetNotExist)
- {
- LogError("Error package name is not found");
- return WRT_ERROR_PKGNAME_NOT_FOUND;
- }
- catch (const DPL::Exception& ex)
- {
- LogError("Internal Error during get widget id by package name");
- DPL::Exception::DisplayKnownException(ex);
- return WRT_ERROR_INTERNAL;
- }
+EXPORT_API void wrt_installer_shutdown_for_tests()
+{
+ try {
+ LogInfo("[WRT-API] DEINITIALIZING WRT INSTALLER...");
+
+ // Installer termination
+ CONTROLLER_POST_SYNC_EVENT(
+ Logic::InstallerController,
+ InstallerControllerEvents::
+ TerminateEvent());
+
+ // Global deinit check
+ LogInfo("Cleanup libxml2 global values.");
+ xmlCleanupParser();
+ } catch (const DPL::Exception& ex) {
+ LogError("Internal Error during Shutdown:");
+ DPL::Exception::DisplayKnownException(ex);
}
+}
+
+EXPORT_API WrtErrStatus wrt_get_widget_by_guid(std::string & tzAppid,
+ const std::string guid)
+{
+ try {
+ LogInfo("[WRT-API] GETTING WIDGET PACKAGE NAME BY WidgetID : "
+ << guid);
+
+ WidgetGUID widget_guid = DPL::FromUTF8String(guid);
+ WrtDB::WidgetDAOReadOnly dao(widget_guid);
+ tzAppid = DPL::ToUTF8String(dao.getTzAppId());
+ return WRT_SUCCESS;
+ } catch (WidgetDAOReadOnly::Exception::WidgetNotExist) {
+ LogError("Error package name is not found");
+ return WRT_ERROR_PKGNAME_NOT_FOUND;
+ } catch (const DPL::Exception& ex) {
+ LogError("Internal Error during get widget id by package name");
+ DPL::Exception::DisplayKnownException(ex);
+ return WRT_ERROR_INTERNAL;
+ }
+}
#ifdef __cplusplus
}
#endif
* Callback function type invoked after async init function
*/
typedef void (*WrtInstallerInitCallback)(WrtErrStatus status,
- void *data);
+ void *data);
/**
* Callback function type invoked after async functions
* Callback function type invoked after async functions
*/
typedef void (*WrtInstallerStatusCallback)(std::string tizenId,
- WrtErrStatus status,
- void *data);
+ WrtErrStatus status,
+ void *data);
/**
* Callback function type invoked after async functions
} wrt_widget_update_mode_t;
int wrt_installer_init(void *userdata,
- WrtInstallerInitCallback callback);
+ WrtInstallerInitCallback callback);
/**
* @fn void wrt_installer_shutdown(void)
*
* @see wrt_installer_uninstall_widget
*/
-void wrt_install_widget(const char *path,
- void *user_parameter,
- WrtInstallerStatusCallback status_callback,
- WrtProgressCallback progress_callback,
- wrt_widget_update_mode_t update_mode,
- bool quiet,
- bool preload,
- std::shared_ptr<PackageManager::IPkgmgrSignal> pkgmgrInterface
- );
+void wrt_install_widget(
+ const char *path,
+ void *user_parameter,
+ WrtInstallerStatusCallback status_callback,
+ WrtProgressCallback progress_callback,
+ wrt_widget_update_mode_t update_mode,
+ bool quiet,
+ bool preload,
+ std::shared_ptr<PackageManager::IPkgmgrSignal>
+ pkgmgrInterface
+ );
/**
* @fn void wrt_installer_uninstall_widget (const char * const tizenAppid,
* @param [in] status_cb - Call to this one will be done at the end of
* operation
* The callback is called in the context of the
- application's
+ * application's
* @param [in] progress_cb - Callback function to get data of install progress
* If you don't want to get progress data, this
* should be NULL
*
* @see wrt_installer_install_widget
*/
-void wrt_uninstall_widget (const char * const tzAppid,
- void* userdata,
- WrtInstallerStatusCallback status_cb,
- WrtProgressCallback progress_cb,
- std::shared_ptr<PackageManager::IPkgmgrSignal> pkgmgrSignalInterface);
+void wrt_uninstall_widget (
+ const char * const tzAppid,
+ void* userdata,
+ WrtInstallerStatusCallback status_cb,
+ WrtProgressCallback progress_cb,
+ std::shared_ptr<PackageManager::IPkgmgrSignal>
+ pkgmgrSignalInterface);
/**
* @fn void wrt_install_plugin(const char *pluginDirectory,
* @see wrt_install_plugin
*/
void wrt_install_plugin(const char *pluginDirectory,
- void *userData,
- WrtPluginInstallerStatusCallback statusCallback,
- WrtProgressCallback progressCallback);
+ void *userData,
+ WrtPluginInstallerStatusCallback statusCallback,
+ WrtProgressCallback progressCallback);
/**
* @brief To install plugins for first excution
* @return nothing
*/
void wrt_install_all_plugins(WrtAllPluginInstalledCallback installed_cb,
- void *user_param);
+ void *user_param);
/**
* @brief To initialize for tests
* @return int
*/
int wrt_installer_init_for_tests(void *userdata,
- WrtInstallerInitCallback callback);
+ WrtInstallerInitCallback callback);
/**
* @brief To shutdown for tests
* @param guid guid that we look for
* @return error code
*/
-WrtErrStatus wrt_get_widget_by_guid(std::string &tzAppid, const std::string guid);
+WrtErrStatus wrt_get_widget_by_guid(std::string &tzAppid,
+ const std::string guid);
#ifdef __cplusplus
}
#endif
/* Error result */
WRT_ERROR_INTERNAL = -128, /*< Internal library error.
- Should never occur */
+ * Should never occur */
WRT_ERROR_INVALID_PARAMETER, /*< Invalid parameter value was given
- (eg. NULL) */
+ * (eg. NULL) */
WRT_ERROR_HANDLE_NOT_FOUND, /*< Widget handle was not found */
WRT_ERROR_ID_NOT_FOUND, /*< Widget id was not found */
WRT_ERROR_PKGNAME_NOT_FOUND, /*< package name was not found */
WRT_ERROR_ALREADY_RUNNING, /*< Widget is already running */
WRT_ERROR_ALREADY_STOPPED, /*< Widget is already stopped */
WRT_ERROR_STILL_AUTHORIZING, /*< Widget is still autorizing and has not
- yet finished it */
+ * yet finished it */
WRT_ERROR_EARLY_KILLED, /*< Widget was early killed during launch */
WRT_ERROR_ACCESS_DENIED, /*< Access denied from ACE */
WRT_ERROR_NOT_INITIALIZED, /*<Occur if wrt initialization fails*/
WRT_ERROR_INIT, /*<Occur if wrt initialization fails*/
WRT_ERROR_CONNECTION, /*<Connectiond error occured*/
WRT_ERROR_NO_PATH, /*<One of specific directory does not
- exist*/
+ * exist*/
/* Installer Errors*/
WRT_INSTALLER_ERROR_INVALID_WIDGET_PACKAGE, /*< */
WRT_INSTALLER_ERROR_WIDGET_DOES_NOT_EXIST, /*< */
WRT_INSTALLER_ERROR_ALREADY_UNINSTALLING, /*< Widget is already being
- uninstalled */
+ * uninstalled */
WRT_INSTALLER_ERROR_OUT_OUT_DISK_SPACE, /*< */
WRT_INSTALLER_ERROR_INVALID_CERTIFICATE, /*< */
WRT_INSTALLER_ERROR_ALREADY_INSTALLED, /*< Widget is already installed
*/
WRT_INSTALLER_ERROR_INTERNAL, /*< */
WRT_INSTALLER_ERROR_NOT_ALLOWED, /*< Widget installation or
- update not allowed */
+ * update not allowed */
/*< because violation of policy
- ocurred */
+ * ocurred */
WRT_INSTALLER_ERROR_DEFERRED, /*< Widget installation deferred
*/
WRT_INSTALLER_ERROR_DATABASE_FAILURE, /*< Failure in database */
WRT_INSTALLER_ERROR_UNKNOWN, /*< Temporary error. Try to not
- use this. */
+ * use this. */
WRT_INSTALLER_ERROR_OSPSVC, /*< */
WRT_ERROR_INVALID_LANGUAGE, /*< Widget is not valid in
- current locales*/
+ * current locales*/
/* Plugin Installer Errors */
WRT_PLUGIN_INSTALLER_ERROR_WRONG_PATH, /*< Wrong Path to plugin Dir */
WRT_PLUGIN_INSTALLER_ERROR_LIBRARY_ERROR, /*< Shared library error*/
WRT_PLUGIN_INSTALLER_ERROR_WAITING, /*< Missing dependencies*/
WRT_PLUGIN_INSTALLER_ERROR_LOCK, /*< Another installation
- in progress or lock file
- error*/
+ * in progress or lock file
+ * error*/
WRT_PLUGIN_INSTALLER_ERROR_UNKNOWN /*< Unknown error*/
} WrtErrStatus;
typedef struct
{
char* id; /**< the widget's id
- (read from its config.xml during installation)*/
+ * (read from its config.xml during installation)*/
char* name; /**< the widget's name
- (read from its config.xml during installation)*/
+ * (read from its config.xml during installation)*/
char* version; /**< the widget's varsion
- (read from its config.xml during installation)*/
+ * (read from its config.xml during installation)*/
char* icon_path; /**< the widget's icon_path
- (read from its config.xml during installation)*/
+ * (read from its config.xml during installation)*/
char* pkg_name; /**< the widget's pkg name */
/**< the widget's application storage size */
wrt_widget_info *widget_info; /**< the widget's info data*/
} wrt_widget_info_data;
-
/**
* @fn inline bool wrt_has_succeded(WrtErrStatus err)
* @brief Checks whether call succeded
AlreadyRunning, ///< Widget is already running
AlreadyStopped, ///< Widget is already stopped
InvalidLanguage, ///< Widget is invalid in current locales
- StillAuthorizing, ///< Widget is still autorizing and has not yet finished it
+ StillAuthorizing, ///< Widget is still autorizing and has not yet
+ // finished it
EarlyKilled, ///< Widget was early killed during launch
AccessDenied, ///< Access denied from ACE
CertificateRevoked, ///< Some certificate was revoked.
--- /dev/null
+indent_align_string=true\r
+indent_braces=false\r
+indent_braces_no_func=false\r
+indent_brace_parent=false\r
+indent_namespace=false\r
+indent_extern=false\r
+indent_class=true\r
+indent_class_colon=false\r
+indent_else_if=false\r
+indent_func_call_param=false\r
+indent_func_def_param=false\r
+indent_func_proto_param=false\r
+indent_func_class_param=false\r
+indent_func_ctor_var_param=false\r
+indent_template_param=false\r
+indent_func_param_double=false\r
+indent_relative_single_line_comments=false\r
+indent_col1_comment=true\r
+indent_access_spec_body=false\r
+indent_paren_nl=false\r
+indent_comma_paren=false\r
+indent_bool_paren=false\r
+indent_square_nl=false\r
+indent_preserve_sql=false\r
+indent_align_assign=false\r
+sp_balance_nested_parens=false\r
+align_keep_tabs=false\r
+align_with_tabs=false\r
+align_on_tabstop=false\r
+align_number_left=false\r
+align_func_params=false\r
+align_same_func_call_params=false\r
+align_var_def_colon=false\r
+align_var_def_attribute=false\r
+align_var_def_inline=false\r
+align_right_cmt_mix=false\r
+align_on_operator=false\r
+align_mix_var_proto=false\r
+align_single_line_func=false\r
+align_single_line_brace=false\r
+align_nl_cont=false\r
+align_left_shift=true\r
+nl_collapse_empty_body=true\r
+nl_assign_leave_one_liners=false\r
+nl_class_leave_one_liners=false\r
+nl_enum_leave_one_liners=false\r
+nl_getset_leave_one_liners=false\r
+nl_func_leave_one_liners=false\r
+nl_if_leave_one_liners=false\r
+nl_multi_line_cond=true\r
+nl_multi_line_define=false\r
+nl_before_case=false\r
+nl_after_case=false\r
+nl_after_return=false\r
+nl_after_semicolon=true\r
+nl_after_brace_open=false\r
+nl_after_brace_open_cmt=false\r
+nl_after_vbrace_open=false\r
+nl_after_brace_close=false\r
+nl_define_macro=false\r
+nl_squeeze_ifdef=false\r
+nl_ds_struct_enum_cmt=false\r
+nl_ds_struct_enum_close_brace=false\r
+nl_create_if_one_liner=false\r
+nl_create_for_one_liner=false\r
+nl_create_while_one_liner=false\r
+ls_for_split_full=true\r
+ls_func_split_full=true\r
+nl_after_multiline_comment=false\r
+eat_blanks_after_open_brace=true\r
+eat_blanks_before_close_brace=true\r
+mod_pawn_semicolon=false\r
+mod_full_paren_if_bool=false\r
+mod_remove_extra_semicolon=true\r
+mod_sort_import=false\r
+mod_sort_using=false\r
+mod_sort_include=false\r
+mod_move_case_break=false\r
+mod_remove_empty_return=false\r
+cmt_indent_multi=true\r
+cmt_c_group=false\r
+cmt_c_nl_start=false\r
+cmt_c_nl_end=false\r
+cmt_cpp_group=false\r
+cmt_cpp_nl_start=false\r
+cmt_cpp_nl_end=false\r
+cmt_cpp_to_c=false\r
+cmt_star_cont=true\r
+cmt_multi_check_last=true\r
+cmt_insert_before_preproc=false\r
+pp_indent_at_level=false\r
+pp_region_indent_code=false\r
+pp_if_indent_code=false\r
+pp_define_at_level=false\r
+indent_columns=4\r
+indent_member=4\r
+indent_access_spec=-2\r
+code_width=80\r
+nl_max=2\r
+nl_before_access_spec=2\r
+cmt_width=80\r
+indent_with_tabs=0\r
+sp_arith=force\r
+sp_assign=force\r
+sp_enum_assign=force\r
+sp_pp_concat=remove\r
+sp_pp_stringify=remove\r
+sp_bool=force\r
+sp_compare=force\r
+sp_paren_brace=force\r
+sp_angle_paren=remove\r
+sp_before_sparen=force\r
+sp_inside_sparen=remove\r
+sp_after_sparen=force\r
+sp_sparen_brace=force\r
+sp_before_semi=remove\r
+sp_after_semi_for_empty=remove\r
+sp_before_square=remove\r
+sp_before_squares=remove\r
+sp_inside_square=remove\r
+sp_after_comma=force\r
+sp_before_comma=remove\r
+sp_after_class_colon=force\r
+sp_before_class_colon=force\r
+sp_before_case_colon=remove\r
+sp_inside_braces=add\r
+sp_inside_fparens=remove\r
+sp_inside_fparen=remove\r
+sp_func_call_paren=remove\r
+sp_func_class_paren=remove\r
+sp_else_brace=force\r
+sp_brace_else=force\r
+sp_catch_brace=force\r
+sp_brace_catch=force\r
+sp_try_brace=force\r
+sp_before_dc=remove\r
+sp_after_dc=remove\r
+sp_not=remove\r
+sp_inv=remove\r
+sp_addr=remove\r
+sp_member=remove\r
+sp_deref=remove\r
+sp_sign=remove\r
+sp_incdec=remove\r
+sp_cond_colon=force\r
+sp_cond_question=force\r
+sp_case_label=force\r
+nl_assign_brace=remove\r
+nl_if_brace=remove\r
+nl_brace_else=remove\r
+nl_elseif_brace=remove\r
+nl_else_brace=remove\r
+nl_else_if=remove\r
+nl_try_brace=remove\r
+nl_for_brace=remove\r
+nl_catch_brace=remove\r
+nl_brace_catch=remove\r
+nl_while_brace=remove\r
+nl_do_brace=remove\r
+nl_brace_while=remove\r
+nl_switch_brace=remove\r
+nl_namespace_brace=remove\r
+nl_class_brace=force\r
+nl_fdef_brace=force\r
+pos_class_comma=trail\r
+pos_class_colon=trail\r
+mod_full_brace_do=add\r
+mod_full_brace_for=add\r
+mod_full_brace_if=add\r
+mod_full_brace_while=add\r
--- /dev/null
+uncrustify -c uncrustify.cfg --no-backup `find . -regex "\(.*\.cpp\|.*\.h\|.*\.c\|.*\.cc\)" | grep -v "orm.h\|orm_generator.h\|3rdparty\|examples"`