2 // Open Service Platform
3 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
5 // Licensed under the Apache License, Version 2.0 (the License);
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
9 // http://www.apache.org/licenses/LICENSE-2.0
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an "AS IS" BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
18 * @file ManifestHandler.cpp
19 * @brief This is the implementation file for %ManifestHandler class.
23 #include <FSys_SystemInfoImpl.h>
24 #include <FApp_PackageInfoImpl.h>
25 #include <FBase_StringConverter.h>
27 #include "ManifestHandler.h"
28 #include "PrivilegeHandler.h"
29 #include "InstallerUtil.h"
32 using namespace Osp::Base;
33 using namespace Osp::Base::Collection;
34 using namespace Osp::Base::Utility;
35 using namespace Osp::App;
36 using namespace Osp::Io;
37 using namespace Osp::System;
39 ManifestHandler::ManifestHandler(void)
41 ,__pPrivilegeList(null)
43 ,__pContentInfoList(null)
44 ,__pPackageInfoImpl(null)
45 ,__pPackageAppInfoImpl(null)
46 ,__pAppControlInfoImpl(null)
47 ,__pAppControlCapabilityInfoImpl(null)
48 ,__pAppControlResolutionInfoImpl(null)
49 ,__pDataControlInfoImpl(null)
50 ,__pDataControlTypeImpl(null)
51 ,__pLaunchConditionImpl(null)
52 ,__pNotificationImpl(null)
55 ,__pDefaultIconType(null)
56 ,__isDefaultMainmenu(false)
57 ,__isDefaultSetting(false)
58 ,__isDefaultTicker(false)
59 ,__isDefaultQuickpanel(false)
60 ,__isDefaultLaunchImage(false)
61 ,__isDefaultName(false)
62 ,__isDefaultAppDetected(false)
66 ManifestHandler::~ManifestHandler(void)
68 if (__pPackageAppInfoImpl)
70 delete __pPackageAppInfoImpl;
71 __pPackageAppInfoImpl = null;
76 ManifestHandler::Construct(InstallationContext* pContext)
78 __pContext = pContext;
79 __pPackageInfoImpl = pContext->GetPackageInfoImpl();
85 ManifestHandler::Parse(const char *pFilepath)
87 return ParseDocument(pFilepath);
91 ManifestHandler::OnStartElement(const char *pName)
93 TryReturn(pName, true, "[osp-installer] pName is null.");
97 if (strcasecmp(pName, "Manifest") == 0)
99 AppLogTag(OSP_INSTALLER, "------------------------------------------");
100 AppLogTag(OSP_INSTALLER, "manifest.xml");
101 AppLogTag(OSP_INSTALLER, "------------------------------------------");
102 AppLogTag(OSP_INSTALLER, "<%s>", pName);
104 else if (strcasecmp(pName, "Apps") == 0)
106 AppLogTag(OSP_INSTALLER, "<%s>", pName);
108 else if (strcasecmp(pName, "UiApp") == 0)
110 status = OnUiAppElement();
112 else if (strcasecmp(pName, "ServiceApp") == 0)
114 status = OnServiceAppElement();
116 else if (strcasecmp(pName, "DataControl") == 0)
118 status = OnDataControlElement();
120 else if (strcasecmp(pName, "AppControl") == 0)
122 status = OnAppControlElement();
124 else if (strcasecmp(pName, "Capability") == 0)
126 status = OnCapabilityElement();
128 else if (strcasecmp(pName, "Resolution") == 0)
130 status = OnResolutionElement();
132 else if (strcasecmp(pName, "Privileges") == 0)
134 status = OnPrivilegesElement();
136 else if (strcasecmp(pName, "UiScalability") == 0)
138 status = OnUiScalabilityElement();
140 else if (strcasecmp(pName, "UiTheme") == 0)
142 status = OnUiThemeElement();
144 else if (strcasecmp(pName, "Icons") == 0)
146 status = OnIconsElement();
148 else if (strcasecmp(pName, "LiveBoxes") == 0)
150 status = OnLiveBoxesElement();
152 else if (strcasecmp(pName, "LiveBox") == 0)
154 status = OnLiveBoxElement();
156 else if (strcasecmp(pName, "Contents") == 0)
158 status = OnContentsElement();
160 else if (strcasecmp(pName, "Content") == 0)
162 status = OnContentElement();
174 ManifestHandler::OnEndElement(const char *pName)
176 TryReturn(pName, true, "[osp-installer] pName is null.");
180 if (strcasecmp(pName, "Privileges") == 0)
182 status = OnPrivilegesEndElement();
184 else if (strcasecmp(pName, "UiApp") == 0)
186 __pPackageInfoImpl->AddAppInfo(*__pPackageAppInfoImpl);
187 __pPackageAppInfoImpl = null;
189 __isDefaultName = false;
190 AppLogTag(OSP_INSTALLER, "</%s>", pName);
192 else if (strcasecmp(pName, "ServiceApp") == 0)
194 __pPackageInfoImpl->AddAppInfo(*__pPackageAppInfoImpl);
195 __pPackageAppInfoImpl = null;
197 __isDefaultName = false;
198 AppLogTag(OSP_INSTALLER, "</%s>", pName);
200 else if (strcasecmp(pName, "AppControl") == 0)
202 __pPackageAppInfoImpl->AddAppControl(__pAppControlInfoImpl);
203 __pAppControlInfoImpl = null;
204 AppLogTag(OSP_INSTALLER, "</%s>", pName);
206 else if (strcasecmp(pName, "DataControl") == 0)
208 __pPackageAppInfoImpl->AddDataControl(__pDataControlInfoImpl);
209 __pDataControlInfoImpl = null;
210 AppLogTag(OSP_INSTALLER, "</%s>", pName);
212 else if (strcasecmp(pName, "DataControlType") == 0)
214 __pDataControlInfoImpl->AddControlType(__pDataControlTypeImpl);
215 __pDataControlTypeImpl = null;
216 AppLogTag(OSP_INSTALLER, "</%s>", pName);
218 else if (strcasecmp(pName, "Condition") == 0)
220 __pPackageAppInfoImpl->AddLaunchCondition(*__pLaunchConditionImpl);
221 __pLaunchConditionImpl = null;
222 AppLogTag(OSP_INSTALLER, "</%s>", pName);
224 else if (strcasecmp(pName, "Notification") == 0)
226 __pPackageAppInfoImpl->AddNotification(*__pNotificationImpl);
227 __pNotificationImpl = null;
228 AppLogTag(OSP_INSTALLER, "</%s>", pName);
230 else if (strcasecmp(pName, "Capability") == 0)
232 if (__pAppControlInfoImpl)
234 __pAppControlInfoImpl->AddCapability(__pAppControlCapabilityInfoImpl);
235 __pAppControlCapabilityInfoImpl = null;
237 AppLogTag(OSP_INSTALLER, "</%s>", pName);
239 else if (strcasecmp(pName, "Resolution") == 0)
241 __pAppControlCapabilityInfoImpl->AddResolution(__pAppControlResolutionInfoImpl);
242 __pAppControlResolutionInfoImpl = null;
243 AppLogTag(OSP_INSTALLER, "</%s>", pName);
245 else if (strcasecmp(pName, "Apps") == 0)
247 AppLogTag(OSP_INSTALLER, "</%s>", pName);
249 else if (strcasecmp(pName, "UiScalability") == 0)
251 AppLogTag(OSP_INSTALLER, "</%s>", pName);
253 else if (strcasecmp(pName, "Icons") == 0)
255 delete[] __pDefaultIconType;
256 __pDefaultIconType = null;
257 AppLogTag(OSP_INSTALLER, "</%s>", pName);
259 else if (strcasecmp(pName, "LiveBoxes") == 0)
261 __pContext->SetLiveBoxList(__pLiveBoxList);
262 __pLiveBoxList = null;
263 AppLogTag(OSP_INSTALLER, "</%s>", pName);
265 else if (strcasecmp(pName, "Contents") == 0)
267 __pContext->SetContentInfoList(__pContentInfoList);
268 __pContentInfoList = null;
269 AppLogTag(OSP_INSTALLER, "</%s>", pName);
271 else if (strcasecmp(pName, "LiveBox") == 0)
273 __pLiveBoxList->Add(*__pLiveboxInfo);
274 __pLiveboxInfo = null;
275 AppLogTag(OSP_INSTALLER, "</%s>", pName);
277 else if (strcasecmp(pName, "Content") == 0)
279 __pContentInfoList->Add(*__pContentInfo);
280 __pContentInfo = null;
281 AppLogTag(OSP_INSTALLER, "</%s>", pName);
283 else if (strcasecmp(pName, "Manifest") == 0)
285 if (__isDefaultAppDetected == false)
287 fprintf(stderr, "__isDefaultAppDetected is false.\n");
289 TryReturn(__isDefaultAppDetected, false, "[osp-installer][Error] Default App is not detected...");
290 AppLogTag(OSP_INSTALLER, "</%s>", pName);
302 ManifestHandler::OnCharacters(const char *pCharacters)
307 pName = GetElementName();
308 TryReturn(pName, false, "[osp-installer] pName is null.");
310 if (strcasecmp(pName, "Id") == 0)
312 status = OnIdValue(pCharacters);
314 else if (strcasecmp(pName, "Version") == 0)
316 status = OnVersionValue(pCharacters);
318 else if (strcasecmp(pName, "Type") == 0)
320 status = OnTypeValue(pCharacters);
322 else if (strcasecmp(pName, "Url") == 0)
324 status = OnUrlValue(pCharacters);
326 else if (strcasecmp(pName, "ApiVersion") == 0)
328 status = OnApiVersionValue(pCharacters);
330 else if (strcasecmp(pName, "Secret") == 0)
332 status = OnSecretValue(pCharacters);
334 else if (strcasecmp(pName, "Privilege") == 0)
336 status = OnPrivilegeValue(pCharacters);
338 else if (strcasecmp(pName, "Name") == 0)
340 status = OnNameValue(pCharacters);
342 else if (strcasecmp(pName, "Vendor") == 0)
344 status = OnVendorValue(pCharacters);
346 else if (strcasecmp(pName, "Description") == 0)
348 status = OnDescriptionValue(pCharacters);
350 else if (strcasecmp(pName, "Icon") == 0)
352 status = OnIconValue(pCharacters);
354 else if (strcasecmp(pName, "DataControlType") == 0)
356 status = OnDataControlTypeValue(pCharacters);
358 else if (strcasecmp(pName, "Condition") == 0)
360 status = OnConditionValue(pCharacters);
362 else if (strcasecmp(pName, "Notification") == 0)
364 status = OnNotificationValue(pCharacters);
366 else if (strcasecmp(pName, "Size") == 0)
368 status = OnSizeValue(pCharacters);
370 else if (strcasecmp(pName, "InstallationLocation") == 0)
372 status = OnInstallationLocationValue(pCharacters);
384 ManifestHandler::OnPrivilegesElement(void)
386 __pPrivilegeList = new ArrayList;
387 TryReturn(__pPrivilegeList, false, "[osp-installer] __pPrivilegeList is null");
389 AppLogTag(OSP_INSTALLER, "<Privileges>");
395 ManifestHandler::OnPrivilegesEndElement(void)
397 if (__pContext->IsVerificationMode() == false)
399 AppLogTag(OSP_INSTALLER, "Signature file not found. [%ls]\n", __pContext->GetSignatureXmlPath().GetPointer());
401 result r = E_SUCCESS;
403 String hmacPrivileges;
404 String appId = __pPackageInfoImpl->GetAppId();
405 r = PrivilegeHandler::GenerateCipherPrivilege(appId, *__pPrivilegeList, privileges, hmacPrivileges);
408 fprintf(stderr, "PrivilegeHandler::GenerateCipherPrivilege is failded. [%ls][%ls][%ls]\n", appId.GetPointer(), privileges.GetPointer(), hmacPrivileges.GetPointer());
410 TryReturn(!IsFailed(r), false, "[osp-installer] privMgr.GeneratePrivilegeString() failed");
412 __pPackageInfoImpl->SetPrivilegesValue(privileges, hmacPrivileges);
415 __pContext->SetPrivilegeList(__pPrivilegeList);
417 AppLogTag(OSP_INSTALLER, "</Privileges>");
423 ManifestHandler::OnLiveBoxesElement(void)
425 __pLiveBoxList = new ArrayList;
426 TryReturn(__pLiveBoxList, false, "[osp-installer] __pLiveBoxList is null");
428 AppLogTag(OSP_INSTALLER, "<LiveBoxes>");
434 ManifestHandler::OnLiveBoxElement(void)
436 TryReturn(__pLiveboxInfo == null, false, "[osp-installer] __pLiveboxInfo is not null");
438 XmlAttribute *pAttr = null;
439 char *pUpdatePeriod = null;
440 char *pPopupEnabled = null;
442 __pLiveboxInfo = new LiveboxInfo;
443 TryReturn(__pLiveboxInfo, false, "[osp-installer] __pLiveboxInfo is null");
445 pAttr = GetAttribute();
446 TryReturn(pAttr, true, "[osp-installer] pAttr is null");
448 pUpdatePeriod = pAttr->Find("UpdatePeriod");
449 TryReturn(pUpdatePeriod, false, "[osp-installer] pUpdatePeriod is null");
451 long long updatePeriod = atoll(pUpdatePeriod);
452 __pLiveboxInfo->SetUpdatePeriod(updatePeriod);
454 pPopupEnabled = pAttr->Find("LiveBoxPopupEnabled");
455 TryReturn(pPopupEnabled, false, "[osp-installer] pPopupEnabled is null");
457 __pLiveboxInfo->SetPopupEnabled(pPopupEnabled);
459 AppLogTag(OSP_INSTALLER, "<Livebox UpdatePeriod=\"%lld\" pPopupEnabled=\"%s\">", updatePeriod, pPopupEnabled);
465 ManifestHandler::OnContentsElement(void)
467 __pContentInfoList = new ArrayList;
468 TryReturn(__pContentInfoList, false, "[osp-installer] __pContentInfoList is null");
470 AppLogTag(OSP_INSTALLER, "<Contents>");
476 ManifestHandler::OnContentElement(void)
478 TryReturn(__pContentInfo == null, false, "[osp-installer] __pContentInfo is not null");
480 XmlAttribute *pAttr = null;
481 char *pDefault = null;
483 __pContentInfo = new ContentInfo;
484 TryReturn(__pContentInfo, false, "[osp-installer] __pLiveboxInfo is null");
486 pAttr = GetAttribute();
487 TryReturn(pAttr, true, "[osp-installer] pAttr is null");
489 char* pId = pAttr->Find("Id");
492 __pContentInfo->SetContentId(pId);
495 char* pEntryName = pAttr->Find("EntryName");
498 __pContentInfo->SetContentId(pEntryName);
501 pDefault = pAttr->Find("Default");
504 if (strcasecmp(pDefault, "True") == 0)
506 __isDefaultAppDetected = true;
510 AppLogTag(OSP_INSTALLER, "<Content Id=\"%s\" EntryName=\"%s\">", pId, pEntryName);
516 ManifestHandler::OnUiScalabilityElement(void)
518 XmlAttribute *pAttr = null;
519 char *pCoordinateSystem = null;
520 char *pBaseScreenSize = null;
521 char *pLogicalCoordinate = null;
523 AppLogTag(OSP_INSTALLER, "<UiScalability>");
525 pAttr = GetAttribute();
526 TryReturn(pAttr, true, "[osp-installer] pAttr is null");
528 pCoordinateSystem = pAttr->Find("CoordinateSystem");
529 if (pCoordinateSystem)
531 _AppFeatureInfoImpl* pAppFeatureInfo = new _AppFeatureInfoImpl;
532 TryReturn(pAppFeatureInfo, false, "[osp-installer] pAppFeatureInfo is null");
534 pAppFeatureInfo->SetName("CoordinateSystem");
535 pAppFeatureInfo->SetValue(pCoordinateSystem);
537 __pPackageAppInfoImpl->AddAppFeature(*pAppFeatureInfo);
539 AppLogTag(OSP_INSTALLER, "<CoordinateSystem=%s>", pCoordinateSystem);
542 pBaseScreenSize = pAttr->Find("BaseScreenSize");
545 _AppFeatureInfoImpl* pAppFeatureInfo = new _AppFeatureInfoImpl;
546 TryReturn(pAppFeatureInfo, false, "[osp-installer] pAppFeatureInfo is null");
548 pAppFeatureInfo->SetName("BaseScreenSize");
549 pAppFeatureInfo->SetValue(pBaseScreenSize);
551 __pPackageAppInfoImpl->AddAppFeature(*pAppFeatureInfo);
553 AppLogTag(OSP_INSTALLER, "<BaseScreenSize=%s>", pBaseScreenSize);
556 pLogicalCoordinate = pAttr->Find("LogicalCoordinate");
557 if (pLogicalCoordinate)
559 _AppFeatureInfoImpl* pAppFeatureInfo = new _AppFeatureInfoImpl;
560 TryReturn(pAppFeatureInfo, false, "[osp-installer] pAppFeatureInfo is null");
562 pAppFeatureInfo->SetName("LogicalCoordinate");
563 pAppFeatureInfo->SetValue(pLogicalCoordinate);
565 __pPackageAppInfoImpl->AddAppFeature(*pAppFeatureInfo);
567 AppLogTag(OSP_INSTALLER, "<LogicalCoordinate=%s>", pLogicalCoordinate);
574 ManifestHandler::OnUiThemeElement(void)
576 XmlAttribute *pAttr = null;
577 char *pSystemTheme = null;
578 char *pUserDefinedTheme = null;
580 AppLogTag(OSP_INSTALLER, "<UiTheme>");
582 pAttr = GetAttribute();
583 TryReturn(pAttr, true, "[osp-installer] pAttr is null");
585 pSystemTheme = pAttr->Find("SystemTheme");
588 _AppFeatureInfoImpl* pAppFeatureInfo = new _AppFeatureInfoImpl;
589 TryReturn(pAppFeatureInfo, false, "[osp-installer] pAppFeatureInfo is null");
591 pAppFeatureInfo->SetName("SystemTheme");
592 pAppFeatureInfo->SetValue(pSystemTheme);
594 __pPackageAppInfoImpl->AddAppFeature(*pAppFeatureInfo);
596 AppLogTag(OSP_INSTALLER, "<SystemTheme=%s>", pSystemTheme);
599 pUserDefinedTheme = pAttr->Find("UserDefinedTheme");
600 if (pUserDefinedTheme)
602 _AppFeatureInfoImpl* pAppFeatureInfo = new _AppFeatureInfoImpl;
603 TryReturn(pAppFeatureInfo, false, "[osp-installer] pAppFeatureInfo is null");
605 pAppFeatureInfo->SetName("UserDefinedTheme");
606 pAppFeatureInfo->SetValue(pUserDefinedTheme);
608 __pPackageAppInfoImpl->AddAppFeature(*pAppFeatureInfo);
610 AppLogTag(OSP_INSTALLER, "<UserDefinedTheme=%s>", pUserDefinedTheme);
617 ManifestHandler::OnIconsElement(void)
619 result r = E_SUCCESS;
621 String defaultIconType;
623 AppLogTag(OSP_INSTALLER, "<Icons>");
625 r = _SystemInfoImpl::GetSysInfo(L"ScreenWidth", width);
628 defaultIconType = L"Xhigh";
634 defaultIconType = L"High";
638 defaultIconType = L"Xhigh";
642 AppLogTag(OSP_INSTALLER, "ScreenWidth = [%d]", width);
644 __pDefaultIconType = _StringConverter::CopyToCharArrayN(defaultIconType);
645 TryReturn(__pDefaultIconType, false, "[osp-installer] __pDefaultIconType is null.");
647 AppLogTag(OSP_INSTALLER, "DefaultIconType = [%s]", __pDefaultIconType);
653 ManifestHandler::OnIdValue(const char *pCharacters)
655 __pPackageInfoImpl->SetAppId(pCharacters);
656 AppLogTag(OSP_INSTALLER, "<Id>%s</Id>", pCharacters);
662 ManifestHandler::OnVersionValue(const char *pCharacters)
664 __pPackageInfoImpl->SetAppVersion(pCharacters);
665 AppLogTag(OSP_INSTALLER, "<Version>%s</Version>", pCharacters);
671 ManifestHandler::OnTypeValue(const char *pCharacters)
673 __pPackageInfoImpl->SetAppType(pCharacters);
675 if (strcasecmp(pCharacters, "Contents") == 0)
677 __pPackageInfoImpl->SetAppApiVersion("3.0");
680 AppLogTag(OSP_INSTALLER, "<Type>%s</Type>", pCharacters);
686 ManifestHandler::OnUrlValue(const char *pCharacters)
688 __pPackageInfoImpl->SetAppUrl(pCharacters);
689 AppLogTag(OSP_INSTALLER, "<Url>%s</Url>", pCharacters);
695 ManifestHandler::OnSecretValue(const char *pCharacters)
697 __pPackageInfoImpl->SetAppSecret(pCharacters);
698 AppLogTag(OSP_INSTALLER, "<Secret>%s</Secret>", pCharacters);
704 ManifestHandler::OnApiVersionValue(const char *pCharacters)
706 __pPackageInfoImpl->SetAppApiVersion(pCharacters);
707 AppLogTag(OSP_INSTALLER, "<ApiVersion>%s</ApiVersion>", pCharacters);
713 ManifestHandler::OnIconValue(const char *pCharacters)
715 XmlAttribute *pAttr = 0;
716 char *pAttrValue1 = 0;
717 char *pTypeValue = 0;
719 pAttr = GetAttribute();
720 TryReturn(pAttr, true, "[osp-installer] pAttr is null");
722 pAttrValue1 = pAttr->Find("Section");
723 TryReturn(pAttrValue1, true, "[osp-installer] pAttrValue1 is null");
725 pTypeValue = pAttr->Find("Type");
726 TryReturn(pTypeValue, true, "[osp-installer] pTypeValue is null");
728 char icon[1024] = {0,};
730 if (strcasecmp(pTypeValue, "Xhigh") == 0)
732 snprintf(icon, sizeof(icon), "%s/%s", "screen-density-xhigh", pCharacters);
734 else if (strcasecmp(pTypeValue, "High") == 0)
736 snprintf(icon, sizeof(icon), "%s/%s", "screen-density-high", pCharacters);
740 AppLogTag(OSP_INSTALLER, "Invalid Type [%s]", __pDefaultIconType);
744 if (FindElement("Livebox") == true)
746 TryReturn(__pLiveboxInfo, false, "[osp-installer] __pLiveboxInfo is null");
747 __pLiveboxInfo->SetIcon(icon);
749 else if (FindElement("Content") == true)
751 TryReturn(__pContentInfo, false, "[osp-installer] __pContentInfo is null");
752 __pContentInfo->SetIcon(icon);
756 if (strcasecmp(pAttrValue1, "MainMenu") == 0)
758 if (__isDefaultMainmenu == false)
760 __pPackageAppInfoImpl->SetMainmenuIcon(icon);
763 if (strcasecmp(pTypeValue, __pDefaultIconType) == 0)
765 __isDefaultMainmenu = true;
768 else if (strcasecmp(pAttrValue1, "Setting") == 0)
770 if (__isDefaultSetting == false)
772 __pPackageAppInfoImpl->SetSettingIcon(icon);
775 if (strcasecmp(pTypeValue, __pDefaultIconType) == 0)
777 __isDefaultSetting = true;
780 else if (strcasecmp(pAttrValue1, "Notification") == 0)
782 if (__isDefaultQuickpanel == false)
784 __pPackageAppInfoImpl->SetQuickpanelIcon(icon);
787 if (strcasecmp(pTypeValue, __pDefaultIconType) == 0)
789 __isDefaultQuickpanel = true;
794 AppLogTag(OSP_INSTALLER, "<Icon Section=\"%s\" Type=\"%s\">%s</Icon>", pAttrValue1, pTypeValue, pCharacters);
800 ManifestHandler::OnPrivilegeValue(const char *pCharacters)
802 __pPrivilegeList->Add(*new String(pCharacters));
803 AppLogTag(OSP_INSTALLER, "<Privilege>%s</Privilege>", pCharacters);
809 ManifestHandler::OnNameValue(const char *pCharacters)
811 XmlAttribute* pAttr = 0;
812 char* pAttrValue = 0;
814 pAttr = GetAttribute();
815 TryReturn(pAttr, true, "[osp-installer] pAttr is null");
817 pAttrValue = pAttr->Find("Locale");
818 TryReturn(pAttrValue, true, "[osp-installer] pAttrValue is null");
820 if (FindElement("Livebox") == true)
822 TryReturn(__pLiveboxInfo, false, "[osp-installer] __pLiveboxInfo is null");
824 String* pValue = new String;
825 StringUtil::Utf8ToString(pCharacters, *pValue);
826 __pLiveboxInfo->AddName(*(new String(pAttrValue)), *pValue);
828 else if (FindElement("Content") == true)
830 TryReturn(__pContentInfo, false, "[osp-installer] __pContentInfo is null");
832 String* pValue = new String;
833 StringUtil::Utf8ToString(pCharacters, *pValue);
834 __pContentInfo->AddName(*(new String(pAttrValue)), *pValue);
838 if (strcasecmp(pAttrValue, "eng-GB") == 0 || strcasecmp(pAttrValue, "eng-US") == 0)
840 if (__isDefaultName == true)
842 __pPackageInfoImpl->SetAppName(pCharacters);
846 if (__pPackageAppInfoImpl)
848 String* pValue = new String;
849 StringUtil::Utf8ToString(pCharacters, *pValue);
850 __pPackageAppInfoImpl->AddName(*(new String(pAttrValue)), *pValue);
854 AppLogTag(OSP_INSTALLER, "<Name Locale=\"%s\">%s</Name>", pAttrValue, pCharacters);
860 ManifestHandler::OnVendorValue(const char *pCharacters)
862 XmlAttribute *pAttr = 0;
863 char *pAttrValue = 0;
865 pAttr = GetAttribute();
866 TryReturn(pAttr, true, "[osp-installer] pAttr is null");
868 pAttrValue = pAttr->Find("Locale");
869 TryReturn(pAttrValue, true, "[osp-installer] pAttrValue is null");
871 if (strcasecmp(pAttrValue, "eng-GB") == 0 || strcasecmp(pAttrValue, "eng-US") == 0)
874 __pPackageInfoImpl->SetAppVendor(pCharacters);
877 AppLogTag(OSP_INSTALLER, "<Vendor Locale=\"%s\">%s</Vendor>", pAttrValue, pCharacters);
883 ManifestHandler::OnDescriptionValue(const char *pCharacters)
885 XmlAttribute *pAttr = 0;
886 char *pAttrValue = 0;
888 pAttr = GetAttribute();
889 TryReturn(pAttr, true, "[osp-installer] pAttr is null");
891 pAttrValue = pAttr->Find("Locale");
892 TryReturn(pAttrValue, true, "[osp-installer] pAttrValue is null");
894 if (strcasecmp(pAttrValue, "eng-GB") == 0 || strcasecmp(pAttrValue, "eng-US") == 0)
897 __pPackageInfoImpl->SetAppDescription(pCharacters);
900 AppLogTag(OSP_INSTALLER, "<Description Locale=\"%s\">%s</Description>", pAttrValue, pCharacters);
906 ManifestHandler::OnDataControlTypeValue(const char *pCharacters)
908 XmlAttribute *pAttr = null;
909 char *pAccessValue = null;
911 pAttr = GetAttribute();
912 TryReturn(pAttr, true, "[osp-installer] pAttr is null");
914 pAccessValue = pAttr->Find("Access");
915 TryReturn(pAccessValue, true, "[osp-installer] pAccessValue is null");
917 __pDataControlTypeImpl = new _DataControlTypeImpl;
918 TryReturn(__pDataControlTypeImpl, false, "[osp-installer] __pDataControlTypeImpl is null");
920 __pDataControlTypeImpl->SetType(pCharacters);
921 __pDataControlTypeImpl->SetAccess(pAccessValue);
923 AppLogTag(OSP_INSTALLER, "<DataControlType Access=\"%s\", Type=\"%s\">", pAccessValue, pCharacters);
929 ManifestHandler::OnConditionValue(const char *pCharacters)
931 XmlAttribute *pAttr = null;
934 pAttr = GetAttribute();
935 TryReturn(pAttr, true, "[osp-installer] pAttr is null");
937 pName = pAttr->Find("Name");
938 TryReturn(pName, true, "[osp-installer] pName is null");
940 __pLaunchConditionImpl = new _LaunchConditionInfoImpl;
941 TryReturn(__pLaunchConditionImpl, false, "[osp-installer] __pLaunchConditionImpl is null");
943 __pLaunchConditionImpl->SetName(pName);
944 __pLaunchConditionImpl->SetValue(pCharacters);
946 AppLogTag(OSP_INSTALLER, "<LaunchCondition Name=\"%s\", Value=\"%s\">", pName, pCharacters);
952 ManifestHandler::OnNotificationValue(const char *pCharacters)
954 XmlAttribute *pAttr = null;
957 pAttr = GetAttribute();
958 TryReturn(pAttr, true, "[osp-installer] pAttr is null");
960 pName = pAttr->Find("Name");
961 TryReturn(pName, true, "[osp-installer] pName is null");
963 __pNotificationImpl = new _NotificationInfoImpl;
964 TryReturn(__pNotificationImpl, false, "[osp-installer] __pNotificationImpl is null");
966 __pNotificationImpl->SetName(pName);
967 __pNotificationImpl->SetValue(pCharacters);
969 AppLogTag(OSP_INSTALLER, "<Notification Name=\"%s\", Value=\"%s\">", pName, pCharacters);
975 ManifestHandler::OnSizeValue(const char *pCharacters)
977 TryReturn(__pLiveboxInfo, false, "[osp-installer] __pLiveboxInfo is null");
979 __pLiveboxInfo->AddSize(*(new String(pCharacters)));
980 AppLogTag(OSP_INSTALLER, "<Size>%s</Size>", pCharacters);
986 ManifestHandler::OnInstallationLocationValue(const char *pCharacters)
988 AppLogTag(OSP_INSTALLER, "<InstallationLocation>%s</InstallationLocation>", pCharacters);
990 if ((strcasecmp(pCharacters, "UserPreferred") == 0) &&
991 (File::IsFileExist(DIR_MEMORYCARD_INSTALLATION) == true))
993 AppLogTag(OSP_INSTALLER, "INSTALLATION_STORAGE = [EXTERNAL]");
994 __pContext->SetInstallationStorage(InstallationContext::INSTALLATION_STORAGE_EXTERNAL);
995 __pPackageInfoImpl->SetAppStorageType(PACKAGE_STORAGE_TYPE_EXTERNAL);
1002 ManifestHandler::OnAppControlElement(void)
1004 XmlAttribute *pAttr = null;
1005 char *pAttrValue1 = null;
1006 char *pAttrValue2 = null;
1008 pAttr = GetAttribute();
1009 TryReturn(pAttr, true, "[osp-installer] pAttr is null");
1011 pAttrValue1 = pAttr->Find("ProviderId");
1012 TryReturn(pAttrValue1, true, "[osp-installer] pAttrValue1 is null");
1014 pAttrValue2 = pAttr->Find("Category");
1015 TryReturn(pAttrValue2, true, "[osp-installer] pAttrValue2 is null");
1017 __pAppControlInfoImpl = new _AppControlInfoImpl;
1018 TryReturn(__pAppControlInfoImpl, false, "[osp-installer] __pAppControlInfoImpl is null");
1020 __pAppControlInfoImpl->SetProviderId(pAttrValue1);
1021 __pAppControlInfoImpl->SetCategory(pAttrValue2);
1023 AppLogTag(OSP_INSTALLER, "<AppControl ProviderId=\"%s\" Category=\"%s\">", pAttrValue1, pAttrValue2);
1029 ManifestHandler::OnCapabilityElement(void)
1031 XmlAttribute *pAttr = null;
1032 char *pAttrValue = null;
1034 pAttr = GetAttribute();
1035 TryReturn(pAttr, true, "[osp-installer] pAttr is null");
1037 pAttrValue = pAttr->Find("OperationId");
1038 TryReturn(pAttrValue, true, "[osp-installer] pAttrValue1 is null");
1040 __pAppControlCapabilityInfoImpl = new _AppControlCapabilityInfoImpl;
1041 TryReturn(__pAppControlCapabilityInfoImpl, false, "[osp-installer] __pAppControlCapabilityInfoImpl is null");
1043 __pAppControlCapabilityInfoImpl->SetOperationId(pAttrValue);
1045 AppLogTag(OSP_INSTALLER, "<Capability OperationId=\"%s\">", pAttrValue);
1051 ManifestHandler::OnResolutionElement(void)
1053 XmlAttribute *pAttr = null;
1054 char *pAttrValue1 = null;
1055 char *pAttrValue2 = null;
1057 pAttr = GetAttribute();
1058 TryReturn(pAttr, true, "[osp-installer] pAttr is null");
1060 pAttrValue1 = pAttr->Find("MimeType");
1061 pAttrValue2 = pAttr->Find("UriScheme");
1063 __pAppControlResolutionInfoImpl = new _AppControlResolutionInfoImpl;
1064 TryReturn(__pAppControlResolutionInfoImpl, false, "[osp-installer] __pAppControlResolutionInfoImpl is null");
1068 String* pMimeType = new String(pAttrValue1);
1069 __pAppControlResolutionInfoImpl->SetMimeType(pMimeType);
1074 String* pUriScheme = new String(pAttrValue2);
1075 __pAppControlResolutionInfoImpl->SetUriScheme(pUriScheme);
1078 AppLogTag(OSP_INSTALLER, "<Resolution MimeType=\"%s\" UriScheme=\"%s\">", pAttrValue1, pAttrValue2);
1084 ManifestHandler::OnDataControlElement(void)
1086 XmlAttribute *pAttr = null;
1087 char *pProviderId = null;
1089 pAttr = GetAttribute();
1090 TryReturn(pAttr, true, "[osp-installer] pAttr is null");
1092 pProviderId = pAttr->Find("ProviderId");
1093 TryReturn(pProviderId, true, "[osp-installer] pProviderId is null");
1095 __pDataControlInfoImpl = new _DataControlInfoImpl;
1096 TryReturn(__pDataControlInfoImpl, false, "[osp-installer] __pDataControlInfoImpl is null");
1098 __pDataControlInfoImpl->SetProviderId(pProviderId);
1100 AppLogTag(OSP_INSTALLER, "<DataControl ProviderId=\"%s\">", pProviderId);
1106 ManifestHandler::OnUiAppElement(void)
1108 XmlAttribute *pAttr = null;
1109 char *pExecutableName = null;
1110 char *pDefault = null;
1111 char *pMainmenuVisible = null;
1112 char *pCategory = null;
1114 __pPackageAppInfoImpl = new _PackageAppInfoImpl;
1115 TryReturn(__pPackageAppInfoImpl, false, "[osp-installer] __pPackageAppInfoImpl is null");
1117 pAttr = GetAttribute();
1118 TryReturn(pAttr, true, "[osp-installer] pAttr is null");
1120 pExecutableName = pAttr->Find("ExecutableName");
1121 if (pExecutableName == null)
1123 pExecutableName = pAttr->Find("Name");
1125 TryReturn(pExecutableName, true, "[osp-installer] pExecutableName is null");
1127 __pPackageAppInfoImpl->SetName(pExecutableName);
1129 pDefault = pAttr->Find("Default");
1132 __pPackageAppInfoImpl->SetDefault(pDefault);
1134 if (strcasecmp(pDefault, "True") == 0)
1136 __isDefaultName = true;
1137 __isDefaultAppDetected = true;
1142 __pPackageAppInfoImpl->SetDefault("False");
1145 __pPackageAppInfoImpl->SetType("UiApp");
1147 pMainmenuVisible = pAttr->Find("MainmenuVisible");
1148 if (pMainmenuVisible)
1150 if (strcasecmp(pMainmenuVisible, "True") == 0)
1152 __pPackageAppInfoImpl->SetMainmenuVisible(true);
1156 __pPackageAppInfoImpl->SetMainmenuVisible(false);
1159 _AppFeatureInfoImpl* pAppFeatureInfo = new _AppFeatureInfoImpl;
1160 TryReturn(pAppFeatureInfo, false, "[osp-installer] pAppFeatureInfo is null");
1162 pAppFeatureInfo->SetName("MainmenuVisible");
1163 pAppFeatureInfo->SetValue(pMainmenuVisible);
1164 __pPackageAppInfoImpl->AddAppFeature(*pAppFeatureInfo);
1166 AppLogTag(OSP_INSTALLER, "<MainmenuVisible=%s>", pMainmenuVisible);
1171 if (__pContext->GetPackageNameType() == INSTALLER_PREFIX_TYPE_ORG)
1173 app_id.Format(1024, PACKAGE_NAME_RULE_ORG, __pPackageInfoImpl->GetAppId().GetPointer(), pExecutableName);
1177 app_id.Format(1024, PACKAGE_NAME_RULE, __pPackageInfoImpl->GetAppId().GetPointer(), pExecutableName);
1180 __pPackageAppInfoImpl->SetPackageName(app_id);
1182 pCategory = pAttr->Find("Category");
1185 AppLogTag(OSP_INSTALLER, "<Category=%s>", pCategory);
1187 CategoryType categoryType = InstallerUtil::GetCategoryType(pCategory);
1188 __pPackageAppInfoImpl->SetAppFeature(categoryType);
1191 AppLogTag(OSP_INSTALLER, "app_id = %S", app_id.GetPointer());
1192 AppLogTag(OSP_INSTALLER, "<UiApp Name=\"%s\" Default=\"%s\">", pExecutableName, pDefault ? pDefault:"False");
1198 ManifestHandler::OnServiceAppElement(void)
1200 XmlAttribute *pAttr = null;
1201 char *pExecutableName = null;
1202 char *pDefault = null;
1203 char *pMainmenuVisible = null;
1204 char *pLaunchOnBoot = null;
1205 char *pAutoRestart = null;
1206 char *pRemoteUi = null;
1208 __pPackageAppInfoImpl = new _PackageAppInfoImpl;
1209 TryReturn(__pPackageAppInfoImpl, false, "[osp-installer] __pPackageAppInfoImpl is null");
1211 pAttr = GetAttribute();
1212 TryReturn(pAttr, true, "pAttr is null");
1214 pExecutableName = pAttr->Find("ExecutableName");
1215 if (pExecutableName == null)
1217 pExecutableName = pAttr->Find("Name");
1219 TryReturn(pExecutableName, true, "[osp-installer] pExecutableName is null");
1221 __pPackageAppInfoImpl->SetName(pExecutableName);
1223 pDefault = pAttr->Find("Default");
1226 __pPackageAppInfoImpl->SetDefault(pDefault);
1228 if (strcasecmp(pDefault, "True") == 0)
1230 __isDefaultName = true;
1231 __isDefaultAppDetected = true;
1236 __pPackageAppInfoImpl->SetDefault("False");
1239 __pPackageAppInfoImpl->SetType("ServiceApp");
1240 __pPackageAppInfoImpl->SetMainmenuVisible(false);
1242 pMainmenuVisible = pAttr->Find("MainmenuVisible");
1243 if (pMainmenuVisible)
1245 _AppFeatureInfoImpl* pAppFeatureInfo = new _AppFeatureInfoImpl;
1246 TryReturn(pAppFeatureInfo, false, "[osp-installer] pAppFeatureInfo is null");
1248 pAppFeatureInfo->SetName("MainmenuVisible");
1249 pAppFeatureInfo->SetValue(pMainmenuVisible);
1250 __pPackageAppInfoImpl->AddAppFeature(*pAppFeatureInfo);
1252 AppLogTag(OSP_INSTALLER, "<MainmenuVisible=%s>", pMainmenuVisible);
1255 pLaunchOnBoot = pAttr->Find("LaunchOnBoot");
1258 _AppFeatureInfoImpl* pAppFeatureInfo = new _AppFeatureInfoImpl;
1259 TryReturn(pAppFeatureInfo, false, "[osp-installer] pAppFeatureInfo is null");
1261 pAppFeatureInfo->SetName("LaunchOnBoot");
1262 pAppFeatureInfo->SetValue(pLaunchOnBoot);
1264 __pPackageAppInfoImpl->AddAppFeature(*pAppFeatureInfo);
1266 AppLogTag(OSP_INSTALLER, "<LaunchOnBoot=%s>", pLaunchOnBoot);
1269 pAutoRestart = pAttr->Find("AutoRestart");
1272 _AppFeatureInfoImpl* pAppFeatureInfo = new _AppFeatureInfoImpl;
1273 TryReturn(pAppFeatureInfo, false, "[osp-installer] pAppFeatureInfo is null");
1275 pAppFeatureInfo->SetName("AutoRestart");
1276 pAppFeatureInfo->SetValue(pAutoRestart);
1278 __pPackageAppInfoImpl->AddAppFeature(*pAppFeatureInfo);
1280 AppLogTag(OSP_INSTALLER, "<AutoRestart=%s>", pAutoRestart);
1283 pRemoteUi = pAttr->Find("RemoteUi");
1286 _AppFeatureInfoImpl* pAppFeatureInfo = new _AppFeatureInfoImpl;
1287 TryReturn(pAppFeatureInfo, false, "[osp-installer] pAppFeatureInfo is null");
1289 pAppFeatureInfo->SetName("RemoteUi");
1290 pAppFeatureInfo->SetValue(pRemoteUi);
1292 __pPackageAppInfoImpl->AddAppFeature(*pAppFeatureInfo);
1294 AppLogTag(OSP_INSTALLER, "<RemoteUi=%s>", pRemoteUi);
1299 if (__pContext->GetPackageNameType() == INSTALLER_PREFIX_TYPE_ORG)
1301 app_id.Format(1024, PACKAGE_NAME_RULE_ORG, __pPackageInfoImpl->GetAppId().GetPointer(), pExecutableName);
1305 app_id.Format(1024, PACKAGE_NAME_RULE, __pPackageInfoImpl->GetAppId().GetPointer(), pExecutableName);
1308 __pPackageAppInfoImpl->SetPackageName(app_id);
1310 AppLogTag(OSP_INSTALLER, "app_id = %S", app_id.GetPointer());
1311 AppLogTag(OSP_INSTALLER, "<ServiceApp Name=\"%s\" Default=\"%s\">", pExecutableName, pDefault ? pDefault:"False");
1317 ManifestHandler::FindElement(const char *pName)
1320 Osp::Base::Collection::IEnumerator* pEnum = GetElementEnumeratorN();
1324 while(pEnum->MoveNext() == E_SUCCESS)
1326 String* pStr = static_cast<String*>(pEnum->GetCurrent());
1329 if (pStr->Equals(pName, false) == true)
1331 AppLogTag(OSP_INSTALLER, "[%s] is matched.", pName);