home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Thomson (Residential)
/
TGSTPv7203.iso
/
mac
/
HIW
/
xml
/
mod_upgrade_restorelangpack.xml
< prev
next >
Wrap
Extensible Markup Language
|
2008-02-11
|
7KB
|
152 lines
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE fsm SYSTEM "fsm.dtd">
<!--
Restores language packs to the device after upgrade.
Input properties:
- languageList: list of language ISO codes
- languagePackPath: path where language packs for the new build are stored
- restore [disable|backup|*highest|exact]: how to restore
- disable: do nothing
- backup: Restore the highest version that's available in the temporary directory.
- highest: Restore the highest version that's available in the languagepack directory,
or if no compatible builds can be found there, from the temporary directory.
- exact: Only restore the language packs with the same version as the new build.
Check the languagepack directory first, then the temporary directory.
Application properties:
- device: the device object to operate on.
Exit events:
- finished
-->
<fsm>
<property key="restore" required="yes"/>
<property key="languageList" required="yes"/>
<property key="languagePackPath" required="yes"/>
<states>
<state type="switch" name="checkRestore">
<property key="outputs" value="disable;backup;highest;exact"/>
</state>
<state type="fsm" name="uploadFiles" weight="40">
<property key="languageList" required="yes"/>
<property key="languagePackPath" required="yes"/>
<property key="boardName" required="yes"/>
<property key="buildVersion" required="yes"/>
<property key="digits" required="yes"/>
<states>
<!-- iteration state -->
<state type="listIterator" name="langIterator"/>
<state type="formatLanguagePackName" name="formatName"/>
<state type="countFiles" name="getFileNames"/>
<state type="compare" name="checkFail">
<property key="comparisonType" value="equal"/>
<property key="input1" value="%TEMP%"/>
</state>
<state type="readFile" name="readFile" weight="1"/>
<state type="actionUploadFile" name="uploadFile" weight="10"/>
</states>
<events>
<event name="finished"/>
</events>
<transitions>
<!-- iterate -->
<transition startstate="langIterator">
<propertymap target="list" function="$fsm.languageList"/>
<propertymap target="iterateCount" function="count($fsm.languageList)"/>
<propertymap target="currentItem" function=""/>
</transition>
<!-- next file -->
<transition fromstate="langIterator" tostate="formatName" event="nextItem">
<propertymap target="fsm.currentLanguage" function="$currentItem"/>
<propertymap target="boardName" function="$fsm.boardName"/>
<propertymap target="buildVersion" function="$fsm.buildVersion"/>
<propertymap target="language" function="$fsm.currentLanguage"/>
<propertymap target="digits" function="$fsm.digits"/>
</transition>
<!-- get entrylist with generated mask -->
<transition fromstate="formatName" tostate="getFileNames" event="finished">
<propertymap target="path" function="$fsm.languagePackPath"/>
<propertymap target="fileFilter" function="$langPackName"/>
</transition>
<!-- one or multiple files found, upload last from list -->
<transition fromstate="getFileNames" tostate="readFile" event="singleFileFound|multipleFilesFound">
<propertymap target="fsm.filePath" function="element($fileList, add(count($fileList), -1))"/>
<propertymap target="path" function="$fsm.filePath"/>
<propertymap target="type" function="bin"/>
</transition>
<!-- no files found -->
<transition fromstate="getFileNames" tostate="checkFail" event="noFilesFound">
<propertymap target="input2" function="$fsm.languagePackPath"/>
</transition>
<!-- try TEMP dir now -->
<transition fromstate="checkFail" tostate="formatName" event="false">
<propertymap target="fsm.languagePackPath" function="'%TEMP%'"/>
<propertymap target="boardName" function="$fsm.boardName"/>
<propertymap target="buildVersion" function="$fsm.buildVersion"/>
<propertymap target="language" function="$fsm.currentLanguage"/>
<propertymap target="digits" function="$fsm.digits"/>
</transition>
<!-- upload -->
<transition fromstate="readFile" tostate="uploadFile" event="finished">
<propertymap target="fsm.temp" function="split($fsm.filePath, '/')"/>
<propertymap target="fileName" function="element($fsm.temp, add(count($fsm.temp), -1))"/><!-- strip path -->
<propertymap target="content" function="$content"/>
<propertymap target="device" function="$app.device"/>
</transition>
<!-- next iteration -->
<transition fromstate="checkFail" tostate="langIterator" event="true">
<propertymap target="list" function="$fsm.languageList"/>
<propertymap target="currentItem" function="$fsm.currentLanguage"/>
</transition>
<transition fromstate="readFile" tostate="langIterator" event="fileNotFound|failed">
<propertymap target="list" function="$fsm.languageList"/>
<propertymap target="currentItem" function="$fsm.currentLanguage"/>
</transition>
<transition fromstate="uploadFile" tostate="langIterator" event="finished|failed">
<propertymap target="list" function="$fsm.languageList"/>
<propertymap target="currentItem" function="$fsm.currentLanguage"/>
</transition>
<!-- no more files, finish -->
<transition fromstate="langIterator" toexit="finished" event="lastItem"/>
</transitions>
</state> <!-- putConfigFiles -->
</states>
<events>
<event name="finished"/>
</events>
<transitions>
<transition startstate="checkRestore">
<propertymap target="input" function="$fsm.restore"/>
</transition>
<transition fromstate="checkRestore" tostate="uploadFiles" event="backup">
<propertymap target="languageList" function="$fsm.languageList"/>
<propertymap target="languagePackPath" function="'%TEMP%'"/><!-- only look in temp dir -->
<propertymap target="digits" function="0"/><!-- use highest version available -->
<propertymap target="boardName" function="property($app.device, '_BOARD_NAME')"/>
<propertymap target="buildVersion" function="property($app.device, '_BUILD')"/>
</transition>
<transition fromstate="checkRestore" tostate="uploadFiles" event="exact">
<propertymap target="languageList" function="$fsm.languageList"/>
<propertymap target="languagePackPath" function="$fsm.languagePackPath"/>
<propertymap target="digits" function="4"/><!-- use exact version -->
<propertymap target="boardName" function="property($app.device, '_BOARD_NAME')"/>
<propertymap target="buildVersion" function="property($app.device, '_BUILD')"/>
</transition>
<transition fromstate="checkRestore" tostate="uploadFiles" event="highest|default">
<propertymap target="languageList" function="$fsm.languageList"/>
<propertymap target="languagePackPath" function="$fsm.languagePackPath"/>
<propertymap target="digits" function="0"/><!-- use highest version available -->
<propertymap target="boardName" function="property($app.device, '_BOARD_NAME')"/>
<propertymap target="buildVersion" function="property($app.device, '_BUILD')"/>
</transition>
<!-- done -->
<transition fromstate="checkRestore" toexit="finished" event="disable"/>
<transition fromstate="uploadFiles" toexit="finished" event="finished"/>
</transitions>
</fsm>