updater.js

/*! $FileVersion=1.0.127 */ var updater_fileVersion = “1.0.127”;
if(typeof JSON!==”object”){LoadScript(“json2.js”)}var MakeFullISODateString=function(a){try{return a.getUTCFullYear()+”-“+customPad(a.getUTCMonth()+1,2)+”-“+customPad(a.getUTCDate(),2);+”T”+pad(a.getUTCHours())+”:”+pad(a.getUTCMinutes())+”:”+pad(a.getUTCSeconds())+”.”+String((a.getUTCMilliseconds()/1000).toFixed(3)).slice(2,5)+”Z”}catch(b){logError(“MakeISOString: “+b.message);return”[null]”}};function CreateModuleManager(a){var b={getSingleton:function(d){var c=this._objects[d];if(c){return c}c=this.create(d);this._objects[d]=c;return c},create:function(d){var c=this._factoryManager.get(d);if(!c){logError(“ModuleManager.create failed: “+d);return null}return c()},set:function(d,c){this._objects[d]=c},_objects:{},registerFactory:function(d,c){this._factoryManager.register(d,c)},setScriptFileMapping:function(c,d){this._factoryManager.setScriptFileMapping(c,d)},_factoryManager:a};return b}function CreateJSONManager(){var a={getSingleton:function(c){var b=this._objects[c];if(b){return b}b=this.create(c);this.set(c,b);return b},create:function(b){var f=this._getFileName(b);var c=scriptHelper._readRawText(f);if(!c){return null}try{return JSON.parse(c)}catch(d){logError(“Failed to load JSON object ‘”+b+”‘ from file ‘”+f+”‘: exception is “+d.message)}return null},set:function(c,b){this._objects[c]=b},_objects:{},setJSONFileMapping:function(b,c){this._fileNameOverrides[b]=c},_getFileName:function(b){var c=this._fileNameOverrides[b];if(c){return c}return this._getFileNameDefault(b)},_getFileNameDefault:function(b){return b+”.json”},_fileNameOverrides:{}};return a}function CreateFactoryManager(){var a={get:function(c){var b=this._factoryFunctions[c];if(b){return b}LoadScript(this._getScriptName(c));b=this._factoryFunctions[c];if(!b){logError(“attempted to load “+c+” from file: “+this._getScriptName(c)+”, however, it didn’t register properly with ModuleManager”)}return b},register:function(c,b){this._factoryFunctions[c]=b},setScriptFileMapping:function(b,c){this._scriptNameOverrides[b]=c},_getScriptName:function(b){var c=this._scriptNameOverrides[b];if(c){return c}return this._getScriptNameDefault(b)},_getScriptNameDefault:function(b){return b+”.js”},_factoryFunctions:{},_scriptNameOverrides:{}};return a}var _factoryManager=CreateFactoryManager();var ModuleManager=CreateModuleManager(_factoryManager);var JSONManager=CreateJSONManager();var Track=ModuleManager.getSingleton(“track”);ModuleManager.getSingleton(“event_handler”);function update_all_products(){var f={operation:{name:”update_all_products”,products:{}}};var g=f.operation;var b=JSONManager.getSingleton(“master_list”);if(!b){logError(“Unable to load master list”);g.result={status:”failed”,reason:”null_master_list”};return f}var k=g.products;for(var a in b){var n={};try{var l=GetSetting(“DAD.CommandLine.Exe”,””);if(!l){throw Error(“Failed to get setting DAD.CommandLine.Exe”)}var j=”/config:”+a+” “+GetSetting(“DAD.CommandLine.Args”,””);logDebug(“launching ‘\””+l+'” ‘+j+”‘”);var d=getPluginFactory().Create(“dadLauncher”);d.LaunchCmdLine(l,j);n.result={status:”succeeded”}}catch(i){n.result={status:”failed”,exception:i.message};logError(“Failed to update product ‘”+a+”‘: exception is ‘”+i.message+”‘”)}k[a]=n}var c=”succeeded”;for(var a in k){var n=k[a];var h=n.result;var m=h.status;if(!m||((“succeeded”!=m)&&(“not running”!=m))){c=”failed”;break}}g.result=c;return f}function update_one_product(c){var b={source:{name:”updater.js::update_one_product(“+c+”)”,version:GetScriptVersion(“updater.js”)},event:{name:”DynamicUpdate.ProcessConfiguration”,params:{config:c}}};logDebug(“passing event ‘”+JSON.stringify(b)+”‘ to event handler”);var a={operation:{name:”update_one_product”,product:c}};a.result=ModuleManager.getSingleton(“event_handler”).handleEvent(b);return a}function list_updater_variables(){var a={operation:{name:”list_updater_variables”,variables:{}}};var b=a.operation;try{var f=ModuleManager.create(“dataset”);var d=f.get(“static”);b.variables=d.getDictionary();b.result={status:”succeeded”}}catch(c){logError(“Failed to collect updater properties from the static dataset: exception is ‘”+c.message+”‘”);b.result={status:”failed”,exception:c.message}}return a};
//0EC0AA5F3E8BE09B27B887614EB590A41D842114327D553FEAA0B583CB013A0F3AAAE813C860E858823FBBCE5BF35D51E4B1FF18AF5697CEA69B08FF281CCBB8++