home *** CD-ROM | disk | FTP | other *** search
/ Thomson (Residential) / TGSTPv7203.iso / mac / HIW / xml / mod_upgrade_restorelangpack.xml < prev    next >
Extensible Markup Language  |  2008-02-11  |  7KB  |  152 lines

  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!DOCTYPE fsm SYSTEM "fsm.dtd">
  3. <!-- 
  4.     Restores language packs to the device after upgrade.
  5.  
  6.     Input properties:
  7.   - languageList: list of language ISO codes
  8.   - languagePackPath: path where language packs for the new build are stored
  9.   - restore [disable|backup|*highest|exact]: how to restore
  10.       - disable: do nothing
  11.       - backup: Restore the highest version that's available in the temporary directory.
  12.       - highest: Restore the highest version that's available in the languagepack directory, 
  13.         or if no compatible builds can be found there, from the temporary directory.
  14.       - exact: Only restore the language packs with the same version as the new build. 
  15.         Check the languagepack directory first, then the temporary directory.
  16.  
  17.     Application properties:
  18.     - device: the device object to operate on.
  19.  
  20.   Exit events:
  21.   - finished
  22.  
  23. -->
  24.  
  25. <fsm>
  26.     <property key="restore" required="yes"/>
  27.     <property key="languageList" required="yes"/>
  28.     <property key="languagePackPath" required="yes"/>
  29.     <states>
  30.         <state type="switch" name="checkRestore">
  31.             <property key="outputs" value="disable;backup;highest;exact"/>
  32.         </state>
  33.         <state type="fsm" name="uploadFiles" weight="40">
  34.             <property key="languageList" required="yes"/>
  35.             <property key="languagePackPath" required="yes"/>
  36.             <property key="boardName" required="yes"/>
  37.             <property key="buildVersion" required="yes"/>
  38.             <property key="digits" required="yes"/>
  39.             <states>
  40.                 <!-- iteration state -->
  41.                 <state type="listIterator" name="langIterator"/>
  42.                 <state type="formatLanguagePackName" name="formatName"/>
  43.                 <state type="countFiles" name="getFileNames"/>
  44.                 <state type="compare" name="checkFail">
  45.                     <property key="comparisonType" value="equal"/>
  46.                     <property key="input1" value="%TEMP%"/>
  47.                 </state>
  48.                 <state type="readFile" name="readFile" weight="1"/>
  49.                 <state type="actionUploadFile" name="uploadFile" weight="10"/>
  50.             </states>
  51.             <events>
  52.                 <event name="finished"/>
  53.             </events>
  54.             <transitions>
  55.                 <!-- iterate -->
  56.                 <transition startstate="langIterator">
  57.                     <propertymap target="list" function="$fsm.languageList"/>
  58.                     <propertymap target="iterateCount" function="count($fsm.languageList)"/>
  59.                     <propertymap target="currentItem" function=""/>
  60.                 </transition>
  61.  
  62.                 <!-- next file -->
  63.                 <transition fromstate="langIterator" tostate="formatName" event="nextItem">
  64.                     <propertymap target="fsm.currentLanguage" function="$currentItem"/>
  65.                     <propertymap target="boardName" function="$fsm.boardName"/>
  66.                     <propertymap target="buildVersion" function="$fsm.buildVersion"/>
  67.                     <propertymap target="language" function="$fsm.currentLanguage"/>
  68.                     <propertymap target="digits" function="$fsm.digits"/>
  69.                 </transition>
  70.                 <!-- get entrylist with generated mask -->
  71.                 <transition fromstate="formatName" tostate="getFileNames" event="finished">
  72.                     <propertymap target="path" function="$fsm.languagePackPath"/>
  73.                     <propertymap target="fileFilter" function="$langPackName"/>
  74.                 </transition>
  75.                 <!-- one or multiple files found, upload last from list -->
  76.                 <transition fromstate="getFileNames" tostate="readFile" event="singleFileFound|multipleFilesFound">
  77.                     <propertymap target="fsm.filePath" function="element($fileList, add(count($fileList), -1))"/>
  78.                     <propertymap target="path" function="$fsm.filePath"/>
  79.                     <propertymap target="type" function="bin"/>
  80.                 </transition>
  81.                 <!-- no files found -->
  82.                 <transition fromstate="getFileNames" tostate="checkFail" event="noFilesFound">
  83.                     <propertymap target="input2" function="$fsm.languagePackPath"/>
  84.                 </transition>
  85.                 <!-- try TEMP dir now -->
  86.                 <transition fromstate="checkFail" tostate="formatName" event="false">
  87.                     <propertymap target="fsm.languagePackPath" function="'%TEMP%'"/>
  88.                     <propertymap target="boardName" function="$fsm.boardName"/>
  89.                     <propertymap target="buildVersion" function="$fsm.buildVersion"/>
  90.                     <propertymap target="language" function="$fsm.currentLanguage"/>
  91.                     <propertymap target="digits" function="$fsm.digits"/>
  92.                 </transition>
  93.                 <!-- upload -->
  94.                 <transition fromstate="readFile" tostate="uploadFile" event="finished">
  95.                     <propertymap target="fsm.temp" function="split($fsm.filePath, '/')"/>
  96.                     <propertymap target="fileName" function="element($fsm.temp, add(count($fsm.temp), -1))"/><!-- strip path -->
  97.                     <propertymap target="content" function="$content"/>
  98.                     <propertymap target="device" function="$app.device"/>
  99.                 </transition>
  100.  
  101.                 <!-- next iteration -->
  102.                 <transition fromstate="checkFail" tostate="langIterator" event="true">
  103.                     <propertymap target="list" function="$fsm.languageList"/>
  104.                     <propertymap target="currentItem" function="$fsm.currentLanguage"/>
  105.                 </transition>
  106.                 <transition fromstate="readFile" tostate="langIterator" event="fileNotFound|failed">
  107.                     <propertymap target="list" function="$fsm.languageList"/>
  108.                     <propertymap target="currentItem" function="$fsm.currentLanguage"/>
  109.                 </transition>
  110.                 <transition fromstate="uploadFile" tostate="langIterator" event="finished|failed">
  111.                     <propertymap target="list" function="$fsm.languageList"/>
  112.                     <propertymap target="currentItem" function="$fsm.currentLanguage"/>
  113.                 </transition>
  114.                 <!-- no more files, finish -->
  115.                 <transition fromstate="langIterator" toexit="finished" event="lastItem"/>
  116.             </transitions>
  117.         </state> <!-- putConfigFiles -->
  118.     </states>
  119.     <events>
  120.         <event name="finished"/>
  121.     </events>
  122.     <transitions>
  123.         <transition startstate="checkRestore">
  124.           <propertymap target="input" function="$fsm.restore"/>
  125.         </transition>
  126.         <transition fromstate="checkRestore" tostate="uploadFiles" event="backup">
  127.             <propertymap target="languageList" function="$fsm.languageList"/>
  128.             <propertymap target="languagePackPath" function="'%TEMP%'"/><!-- only look in temp dir -->
  129.             <propertymap target="digits" function="0"/><!-- use highest version available -->
  130.             <propertymap target="boardName" function="property($app.device, '_BOARD_NAME')"/>
  131.             <propertymap target="buildVersion" function="property($app.device, '_BUILD')"/>
  132.         </transition>
  133.         <transition fromstate="checkRestore" tostate="uploadFiles" event="exact">
  134.             <propertymap target="languageList" function="$fsm.languageList"/>
  135.             <propertymap target="languagePackPath" function="$fsm.languagePackPath"/>
  136.             <propertymap target="digits" function="4"/><!-- use exact version -->
  137.             <propertymap target="boardName" function="property($app.device, '_BOARD_NAME')"/>
  138.             <propertymap target="buildVersion" function="property($app.device, '_BUILD')"/>
  139.         </transition>
  140.         <transition fromstate="checkRestore" tostate="uploadFiles" event="highest|default">
  141.             <propertymap target="languageList" function="$fsm.languageList"/>
  142.             <propertymap target="languagePackPath" function="$fsm.languagePackPath"/>
  143.             <propertymap target="digits" function="0"/><!-- use highest version available -->
  144.             <propertymap target="boardName" function="property($app.device, '_BOARD_NAME')"/>
  145.             <propertymap target="buildVersion" function="property($app.device, '_BUILD')"/>
  146.         </transition>
  147.         <!-- done -->
  148.         <transition fromstate="checkRestore" toexit="finished" event="disable"/>
  149.         <transition fromstate="uploadFiles" toexit="finished" event="finished"/>
  150.     </transitions>
  151. </fsm>
  152.