diff options
author | Dongeup Ham <dongeup.ham@samsung.com> | 2013-01-07 16:25:37 +0900 |
---|---|---|
committer | Dongeup Ham <dongeup.ham@samsung.com> | 2013-01-07 16:25:37 +0900 |
commit | 448f0efa8bb948d230bafba10eaa7730d4093098 (patch) | |
tree | e15d0ae28dc8a1f68dae0c2bccc4b0bdde11667e /src/XmlHandler/ManifestHandler.cpp | |
parent | b41a01255153f8d1d4e66e6428fd198d22990fb0 (diff) | |
download | installer-448f0efa8bb948d230bafba10eaa7730d4093098.tar.gz installer-448f0efa8bb948d230bafba10eaa7730d4093098.tar.bz2 installer-448f0efa8bb948d230bafba10eaa7730d4093098.zip |
implementation appcontrols.
Change-Id: I814938ba7156023f20baa5f152964f9b4d3952b1
Signed-off-by: Dongeup Ham <dongeup.ham@samsung.com>
Diffstat (limited to 'src/XmlHandler/ManifestHandler.cpp')
-rwxr-xr-x | src/XmlHandler/ManifestHandler.cpp | 270 |
1 files changed, 52 insertions, 218 deletions
diff --git a/src/XmlHandler/ManifestHandler.cpp b/src/XmlHandler/ManifestHandler.cpp index 6e23824..223cbc5 100755 --- a/src/XmlHandler/ManifestHandler.cpp +++ b/src/XmlHandler/ManifestHandler.cpp @@ -27,8 +27,9 @@ #include "ManifestHandler.h" #include "PrivilegeHandler.h" #include "InstallerUtil.h" -#include "ManifestAccountsParser.h" #include "ManifestLiveboxesParser.h" +#include "ManifestAccountsParser.h" +#include "ManifestAppControlsParser.h" using namespace Tizen::Base; using namespace Tizen::Base::Collection; @@ -60,8 +61,7 @@ ManifestHandler::ManifestHandler(void) ,__isDefaultName(false) ,__isDefaultAppDetected(false) ,__pAppData(null) -,__pSubModeAppControlData(null) -,__pOperationData(null) +,__pSubModeAppControlDataList(null) ,__isParserMode(false) { } @@ -135,18 +135,6 @@ ManifestHandler::OnStartElement(const char *pName) { status = OnDataControlStartElement(); } - else if (strcasecmp(pName, "AppControl") == 0) - { - status = OnAppControlStartElement(); - } - else if (strcasecmp(pName, "Capability") == 0) - { - status = OnCapabilityStartElement(); - } - else if (strcasecmp(pName, "Resolution") == 0) - { - status = OnResolutionStartElement(); - } else if (strcasecmp(pName, "Privileges") == 0) { status = OnPrivilegesStartElement(); @@ -171,10 +159,6 @@ ManifestHandler::OnStartElement(const char *pName) { status = OnContentStartElement(); } - else if (strcasecmp(pName, "Operation") == 0) - { - status = OnOperationStartElement(); - } else if (strcasecmp(pName, "Liveboxes") == 0) { status = OnLiveboxesStartElement(pName); @@ -183,6 +167,10 @@ ManifestHandler::OnStartElement(const char *pName) { status = OnAccountsStartElement(pName); } + else if (strcasecmp(pName, "AppControls") == 0) + { + status = OnAppControlsStartElement(pName); + } if (!status) { @@ -205,13 +193,17 @@ ManifestHandler::OnEndElement(const char *pName) TryReturn(__pParser, false, "[osp-installer] __pParser is null"); __pParser->OnEndElement(pName); - if (strcasecmp(pName, "Accounts") == 0) + if (strcasecmp(pName, "Liveboxes") == 0) + { + status = OnLiveboxesEndElement(); + } + else if (strcasecmp(pName, "Accounts") == 0) { status = OnAccountsEndElement(); } - else if (strcasecmp(pName, "Liveboxes") == 0) + else if (strcasecmp(pName, "AppControls") == 0) { - status = OnLiveboxesEndElement(); + status = OnAppControlsEndElement(); } return status; @@ -229,10 +221,6 @@ ManifestHandler::OnEndElement(const char *pName) { status = OnServiceAppEndElement(); } - else if (strcasecmp(pName, "AppControl") == 0) - { - status = OnAppControlEndElement(); - } else if (strcasecmp(pName, "DataControl") == 0) { status = OnDataControlEndElement(); @@ -249,14 +237,6 @@ ManifestHandler::OnEndElement(const char *pName) { status = OnNotificationEndElement(); } - else if (strcasecmp(pName, "Capability") == 0) - { - status = OnCapabilityEndElement(); - } - else if (strcasecmp(pName, "Resolution") == 0) - { - status = OnResolutionEndElement(); - } else if (strcasecmp(pName, "Apps") == 0) { status = OnAppsEndElement(); @@ -281,10 +261,6 @@ ManifestHandler::OnEndElement(const char *pName) { status = OnManifestEndElement(); } - else if (strcasecmp(pName, "Operation") == 0) - { - status = OnOperationEndElement(); - } if (!status) { @@ -372,14 +348,6 @@ ManifestHandler::OnCharacters(const char *pCharacters) { status = OnCategoryValue(pCharacters); } - else if (strcasecmp(pName, "MimeType") == 0) - { - status = OnMimeTypeValue(pCharacters); - } - else if (strcasecmp(pName, "Uri") == 0) - { - status = OnUriValue(pCharacters); - } if (!status) { @@ -579,109 +547,6 @@ ManifestHandler::OnUiThemeStartElement(void) return true; } -bool -ManifestHandler::OnAppControlStartElement(void) -{ - XmlAttribute *pAttr = null; - char *pAttrValue1 = null; - char *pAttrValue2 = null; - - pAttr = GetAttribute(); - TryReturn(pAttr, true, "[osp-installer] pAttr is null"); - - pAttrValue1 = pAttr->Find("ProviderId"); - TryReturn(pAttrValue1, true, "[osp-installer] pAttrValue1 is null"); - - pAttrValue2 = pAttr->Find("Category"); - TryReturn(pAttrValue2, true, "[osp-installer] pAttrValue2 is null"); - - __pAppControlInfoImpl = new (std::nothrow) _AppControlInfoImpl; - TryReturn(__pAppControlInfoImpl, false, "[osp-installer] __pAppControlInfoImpl is null"); - - __pAppControlInfoImpl->SetProviderId(pAttrValue1); - __pAppControlInfoImpl->SetCategory(pAttrValue2); - - AppLogTag(OSP_INSTALLER, "<AppControl ProviderId=\"%s\" Category=\"%s\">", pAttrValue1, pAttrValue2); - - return true; -} - -bool -ManifestHandler::OnCapabilityStartElement(void) -{ - XmlAttribute *pAttr = null; - char *pAttrValue = null; - - pAttr = GetAttribute(); - TryReturn(pAttr, true, "[osp-installer] pAttr is null"); - - pAttrValue = pAttr->Find("OperationId"); - TryReturn(pAttrValue, true, "[osp-installer] pAttrValue1 is null"); - - __pAppControlCapabilityInfoImpl = new (std::nothrow) _AppControlCapabilityInfoImpl; - TryReturn(__pAppControlCapabilityInfoImpl, false, "[osp-installer] __pAppControlCapabilityInfoImpl is null"); - - __pAppControlCapabilityInfoImpl->SetOperationId(pAttrValue); - - AppLogTag(OSP_INSTALLER, "<Capability OperationId=\"%s\">", pAttrValue); - - return true; -} - -bool -ManifestHandler::OnResolutionStartElement(void) -{ - XmlAttribute *pAttr = null; - char *pAttrValue1 = null; - char *pAttrValue2 = null; - - pAttr = GetAttribute(); - TryReturn(pAttr, true, "[osp-installer] pAttr is null"); - - pAttrValue1 = pAttr->Find("MimeType"); - pAttrValue2 = pAttr->Find("UriScheme"); - - __pAppControlResolutionInfoImpl = new (std::nothrow) _AppControlResolutionInfoImpl; - TryReturn(__pAppControlResolutionInfoImpl, false, "[osp-installer] __pAppControlResolutionInfoImpl is null"); - - if (pAttrValue1) - { - String* pMimeType = new (std::nothrow) String(pAttrValue1); - __pAppControlResolutionInfoImpl->SetMimeType(pMimeType); - } - - if (pAttrValue2) - { - String* pUriScheme = new (std::nothrow) String(pAttrValue2); - __pAppControlResolutionInfoImpl->SetUriScheme(pUriScheme); - } - - AppLogTag(OSP_INSTALLER, "<Resolution MimeType=\"%s\" UriScheme=\"%s\">", pAttrValue1, pAttrValue2); - - return true; -} - -bool -ManifestHandler::OnOperationStartElement(void) -{ - XmlAttribute *pAttr = null; - char *pId = null; - - pAttr = GetAttribute(); - TryReturn(pAttr, true, "[osp-installer] pAttr is null"); - - pId = pAttr->Find("Id"); - TryReturn(pId, true, "[osp-installer] pId is null"); - - __pOperationData = new (std::nothrow) OperationData; - TryReturn(__pOperationData, false, "[osp-installer] __pOperationData is null"); - - __pOperationData->__id = pId; - - AppLogTag(OSP_INSTALLER, "<Operation Id=\"%s\">", pId); - - return true; -} bool ManifestHandler::OnDataControlStartElement(void) @@ -783,6 +648,19 @@ ManifestHandler::OnAccountsStartElement(const char *pName) } bool +ManifestHandler::OnAppControlsStartElement(const char *pName) +{ + __pParser = new (std::nothrow) ManifestAppControlsParser; + TryReturn(__pParser, false, "[osp-installer] __pParser is null"); + + __isParserMode = true; + AppLogTag(OSP_INSTALLER, "------------------------------------------"); + __pParser->Construct(this); + + return __pParser->OnStartElement(pName); +} + +bool ManifestHandler::OnPrivilegesEndElement(void) { if (__pContext->IsVerificationMode() == false) @@ -818,6 +696,12 @@ ManifestHandler::OnUiAppEndElement(void) __isDefaultName = false; + if (__pContext->__isSubMode == true) + { + __pSubModeAppControlDataList = __pAppData->__pAppControlDataList; + __pAppData->__pAppControlDataList = null; + } + __pContext->__pAppDataList->Add(__pAppData); __pAppData = null; @@ -834,6 +718,12 @@ ManifestHandler::OnServiceAppEndElement(void) __isDefaultName = false; + if (__pContext->__isSubMode == true) + { + __pSubModeAppControlDataList = __pAppData->__pAppControlDataList; + __pAppData->__pAppControlDataList = null; + } + __pContext->__pAppDataList->Add(__pAppData); __pAppData = null; @@ -850,8 +740,8 @@ ManifestHandler::OnAppsEndElement(void) __pAppData = new (std::nothrow) AppData; TryReturn(__pAppData, false, "[osp-installer] __pAppData is null"); - __pAppData->__pAppControlData = __pSubModeAppControlData; - __pSubModeAppControlData = null; + __pAppData->__pAppControlDataList = __pSubModeAppControlDataList; + __pSubModeAppControlDataList = null; __pContext->__pAppDataList->Add(__pAppData); } @@ -870,53 +760,6 @@ ManifestHandler::OnIconsEndElement(void) } bool -ManifestHandler::OnAppControlEndElement(void) -{ - __pPackageAppInfoImpl->AddAppControl(__pAppControlInfoImpl); - __pAppControlInfoImpl = null; - AppLogTag(OSP_INSTALLER, "</AppControl>"); - - if (__pContext->__isSubMode == true) - { - __pSubModeAppControlData = __pAppData->__pAppControlData; - __pAppData->__pAppControlData = null; - } - - return true; -} - -bool -ManifestHandler::OnCapabilityEndElement(void) -{ - if (__pAppControlInfoImpl) - { - __pAppControlInfoImpl->AddCapability(__pAppControlCapabilityInfoImpl); - __pAppControlCapabilityInfoImpl = null; - } - AppLogTag(OSP_INSTALLER, "</Capability>"); - - return true; -} - -bool -ManifestHandler::OnResolutionEndElement(void) -{ - __pAppControlCapabilityInfoImpl->AddResolution(__pAppControlResolutionInfoImpl); - __pAppControlResolutionInfoImpl = null; - AppLogTag(OSP_INSTALLER, "</Resolution>"); - - return true; -} - -bool -ManifestHandler::OnOperationEndElement(void) -{ - __pAppData->__pAppControlData->__pOperationDataList->Add(__pOperationData); - - return true; -} - -bool ManifestHandler::OnDataControlEndElement(void) { __pPackageAppInfoImpl->AddDataControl(__pDataControlInfoImpl); @@ -977,6 +820,16 @@ ManifestHandler::OnContentEndElement(void) } bool +ManifestHandler::OnLiveboxesEndElement(void) +{ + delete __pParser; + __isParserMode = false; + AppLogTag(OSP_INSTALLER, "------------------------------------------"); + + return true; +} + +bool ManifestHandler::OnAccountsEndElement(void) { delete __pParser; @@ -987,7 +840,7 @@ ManifestHandler::OnAccountsEndElement(void) } bool -ManifestHandler::OnLiveboxesEndElement(void) +ManifestHandler::OnAppControlsEndElement(void) { delete __pParser; __isParserMode = false; @@ -1335,25 +1188,6 @@ ManifestHandler::OnCategoryValue(const char *pCharacters) } bool -ManifestHandler::OnMimeTypeValue(const char* pCharacters) -{ - __pOperationData->__mimeType = pCharacters; - - AppLogTag(OSP_INSTALLER, "<MimeType>%s</MimeType>", pCharacters); - return true; -} - -bool -ManifestHandler::OnUriValue(const char* pCharacters) -{ - __pOperationData->__uri = pCharacters; - - AppLogTag(OSP_INSTALLER, "<Uri>%s</Uri>", pCharacters); - return true; - -} - -bool ManifestHandler::FindElement(const char *pName) { bool res = false; |