update_manager

/*! $FileVersion=1.0.127 */ var update_manager_fileVersion = “1.0.127”;
function dad_setup(){}function dad_teardown(){}function CreateUpdateManager(){var a={updateAllProducts:function(){var c=this._getMasterList();if(!c){logError(“Master List is missing; aborting this update”);return}for(var b in c){this.updateOneProduct(b)}},updateOneProduct:function(e){var d=this._getConfig(e);if(!d){throw Error(“No configuration for ‘”+e+”‘”)}logDebug(“got config for “+e+”: ‘”+JSON.stringify(d)+”‘”);var c=d.update_url;var b=d.dest_folder;if(!c||!b){throw Error(“Invalid configuration for ‘”+e+”‘: update_url='”+c+”‘, dest_folder='”+b+”‘”)}b=this._resolveDestFolder(b);var g={name:e,update_url:c,dest_folder:b};var f=d.update_script;if(f){g.update_script=f}this._notify(“DynamicUpdate.ExecutingScript”,g);this._loadCustomScript(f);logDebug(“Launch update from ‘”+c+”‘ into ‘”+b+”‘”);g.result=this._launchUpdate(b,c);Track.Event(“dad_updatescript_complete”).Label(e).Result(g.result.status).Finish();this._notify(“DynamicUpdate.ScriptProcessCompleted”,g);return g.result},_getMasterList:function(){return JSONManager.getSingleton(“master_list”)},_getConfig:function(c){try{var d=this._getMasterList();var b=d[c];if(!b){logInformation(“No configuration for “+c+” in master list; nothing to update”);return null}return b}catch(f){logError(“failed to locate configuration for ‘”+c+”‘: exception is ‘”+f.message+”‘”);return null}},_resolveDestFolder:function(b){try{b=getPluginFactory().Create(“system”).GetKnownFolder(b)}catch(c){logInformation(“DAD resolveDestFolder: nothing to resolve; will use the value provided: ‘”+b+”‘: exception is ‘”+c.message+”‘”)}return b},_loadCustomScript:function(b){if(b){ModuleManager.create(“custom\”+script)}},_launchUpdate:function(c,b){try{var f=getPluginFactoryEx().Create(“xmlUpdate”);if(f){logDebug(“Initializing xmlUpdate plugin with dest: “+c);f.Initialize(c,b,false);this._configureStaticProperties(f);this._configureDADSettings(f);this._configureInstallParams(f);dad_setup(f);f.Update();dad_teardown(f);return{status:”succeeded”}}return{status:”failed”,reason:”Missing Updater Plugin”}}catch(d){logError(“Failed to launch updater process for url: ‘”+b+”‘: exception is ‘”+d.message+”‘”);return{status:”excepted”,message:d.message}}},_configureStaticProperties:function(d){var c={};try{var i=ModuleManager.create(“dataset”);var h=i.get(“static”);c=h.getDictionary()}catch(g){throw Error(“Failed to collect updater properties from the dataset: exception is ‘”+g.message+”‘”)}for(var b in c){try{var f=String(c[b]);if(f){d.Set(b,f)}}catch(g){throw Error(“Failed to set updater property ‘”+b+”‘ to value ‘”+f+”‘: exception is ‘”+g.message+”‘”)}}},_configureDADSettings:function(b){b.Set(“DAD.Updater.Version”,dad_bootstrapFileVersion);b.Set(“DAD.Content.Version”,GetScriptVersion(“update_manager.js”))},_configureInstallParams:function(b){SetInstallParams(b)},_notify:function(c,b){try{getMessageBus().Publish(c,JSON.stringify(b))}catch(d){logError(“Unable to publish ‘”+c+”‘ notification ‘”+JSON.stringify(b)+”‘: exception is ‘”+d.message+”‘”)}}};return a}ModuleManager.registerFactory(“update_manager”,CreateUpdateManager);