Mini Kabibi Habibi

Current Path : C:/Program Files/McAfee/WebAdvisor/Analytics/Scripts/
Upload File :
Current File : C:/Program Files/McAfee/WebAdvisor/Analytics/Scripts/transport.js

/*! $FileVersion=1.2.229 */ var transport_fileVersion = "1.2.229"; 
function CreateAnalyticsTransport(){function a(){this.retrieveStoredQueue()}a.prototype=ModuleManager.create("transmitter_template");a.prototype.transmit=function(m,s,t,c){logDebug("analyticstransport.transmit message="+JSON.stringify(s)+", profileNames="+JSON.stringify(t)+", datasetNames="+JSON.stringify(c));if(this._isEventThrottled(m)){logDebug("Event "+m+" was event-level throttled");logAutomationError(m,JSON.stringify(s),JSON.stringify({level:"info",type:{eventThrottled:m+" is event throttled"}}));return}for(var l in t){try{var o=t[l];if(this._isProfileThrottled(m,o)){logDebug("Event "+m+" was profile-level throttled by '"+o+"'");logAutomationError(m,JSON.stringify(s),JSON.stringify({level:"info",type:{profileThrottled:m+" is profile throttled for "+o}}));continue}if(engine.isStopRequestReceived()){logWarning("transmitter.prototype.transmit: Stop request received, so stopping all data transmissions..");return}var f=this.retrieveEmitter(o);if(!f){logError("Failed to locate an emitter for '"+o+"'; aborting send");continue}var i={};if(false===f.transportConfiguration.forceLowerCaseKeys){dataManipulator.mergeDictionary(i,s)}else{dataManipulator.mergeAndLowerDictionary(i,s)}var h=ModuleManager.getSingleton("mappings");i=h.eventMap(i,m);i=h.globalMap(i);i=h.toLowerCase(i,true,false);var j=this._applyAttributeRules(i,m,o);i=j.message;var u=ModuleManager.getSingleton("data_collector");var y=u.get("product_analytics_automation_logs_enabled");if(j.error&&y){logAutomationError(m,JSON.stringify(s),JSON.stringify(j.error))}var p=ModuleManager.getSingleton("rules");var d=p.getDailyMaxTableCounter(o);i["__event.day.index"]=d;i.__throttle_user_multiplier=f.throttleMultiplier?f.throttleMultiplier:1;i["Hit.UniqueID"]=m;this.addDataSetNames(i,f,c);var x=new Date();var n=unescape(i["__record.created"]);n=n.split(" ").join("T");var g=isoDateToDate(n);if(x&&g){var r=(x-g);i["__queue.time.milliseconds"]=(r>0)?String(r):"0"}logDebug("ready to send "+JSON.stringify(i));var q=f.send(i);logDebug("ProfileName:"+o+". Result: "+q);logDebug("******************************* done");if("csp"==f.transportName){continue}if("msgbus"==f.transportName){continue}if("transport_eng_observability"==f.transportName){continue}if(!f._isEnabled()){continue}if(!q){var k=ModuleManager.getSingleton("config_manager");var v=k.getPriority(m);this._addToQueue(o,i,v)}else{this.processQueues()}}catch(w){logError("Failed to send mesage to '"+o+"': exception is '"+w.message+"'")}}};a.prototype.notifyHostTeardown=function(){try{if(!this._transportsQueue){return}var c=this._transportsQueue.critical;if(!c){logInformation("transport::notifyHostTeardown: Critical queue is null");return}var f=JSON.stringify(c);if(f==="{}"){logInformation("transport::notifyHostTeardown: Nothing critical to store");return}StorageManager.set("analytics_transports_transportsQueue",f,false)}catch(d){logError("transport::notifyHostTeardown: "+d.message)}};a.prototype.retrieveStoredQueue=function(){try{var c=StorageManager.get("analytics_transports_transportsQueue");var f=JSON.parse(c);this._transportsQueue.critical=f?f:{};StorageManager.remove("analytics_transports_transportsQueue");this._queueEmpty=(JSON.stringify(this._transportsQueue.critical)==="{}")?true:false}catch(d){logError("transport::retrieveStoredQueue: "+d.message)}};a.prototype.processQueues=function(){try{if(this._queueEmpty){return}var d=false;logInformation("transport:processQueues Start");this._queueProcessingTimeoutId=null;for(var f in this._transportsQueue){for(var g in this._transportsQueue[f]){logInformation("transport.processQueues Processing queue ["+g+"]["+f+"]");var c=this._transportsQueue[f][g];if(!c){continue}var h=this.retrieveEmitter(g);if(!h._isEnabled()){delete this._transportsQueue[f][g];continue}if(engine.isStopRequestReceived()){logWarning("Transmitter.prototype.processQueues: Stop request received, so stopping all data transmissions..");return}c=this._processSingleQueue(h,c);if(c.length===0){delete this._transportsQueue[f][g];logInformation("transport.processQueues Queue ["+g+"]["+f+"] is now empty")}else{this._transportsQueue[f][g]=c;d=true}}}if(d){this._timeoutInterval+=30*1000;this._setQueueProcessingTimeout()}else{this._queueEmpty=true;this._timeoutInterval=30*1000}}catch(i){logError("transport:processQueues: "+i.message)}};a.prototype._processSingleQueue=function(e,c){while(c.length){var d=c.shift();if(!e.send(d)){c.unshift(d);break}}logInformation("_processSingleQueue: End ["+e.profileName+"]queue.length: "+c.length);return c};a.prototype._addToQueue=function(e,d,c){if(!this._transportsQueue[c]){return}logInformation("transport::_addToQueue: Adding to "+e+" queue.");if(!this._transportsQueue[c][e]){this._transportsQueue[c][e]=[]}if(this._transportsQueue[c][e].length>=10){logInformation("transport::_addToQueue: reached maximum queue size. Not going to add to queue for "+e+". With priority: "+c);return}this._transportsQueue[c][e].push(d);this._queueEmpty=false;this._setQueueProcessingTimeout()};a.prototype._setQueueProcessingTimeout=function(){if(this._queueProcessingTimeoutId){return}this._queueProcessingTimeoutId=setTimeout(this._timeoutInterval,function(){var c=ModuleManager.getSingleton("transport");c.processQueues.apply(c)})};a.prototype._applyAttributeRules=function(p,j,m){try{var k=ModuleManager.getSingleton("config_manager");var c=k.getAttributeRules(j);if(!c){return p}var h={};dataManipulator.mergeDictionary(h,c);var f=ModuleManager.getSingleton("mappings");h=f.eventMap(h,j);h=f.globalMap(h);h=f.toLowerCase(h,true,false);var n=ModuleManager.getSingleton("rules");var o=["uniqueid","hit_event_id","hit_category_0","hit_action","tracker.type","__transport.name","__record.created","__caller.name"];o=o.concat(this._getProfileDefaultAttributes(m));var u={};var l=[];var d=[];if(this._getProfile(m)["ignoreAttributeRules"]==true){u=JSON.parse(JSON.stringify(p))}else{for(var t in p){var v=false;for(var q in o){if(t==o[q]){v=true;break}}if(v||h.hasOwnProperty(t)){u[t]=p[t]}else{if(t.substring(0,2)!="__"){u[t]="[ruleMismatch]";l.push({attribute:t,value:p[t],rule:"attribute not configured"})}}}}logInformation("cleanMessage: "+JSON.stringify(u));for(var t in h){var i=h[t];if(i.optional&&(u[t]==null)){logInformation("_applyAttributeRules: optional field "+t+" was skipped");continue}profileDetails=this._getProfile(m);if(profileDetails&&profileDetails.appid){i.appId=profileDetails.appid}var s=n.apply(u[t],i);u[t]=s;var r=(p[t]==undefined)?"attribute not sent":p[t];if(s=="[ruleMismatch]"){l.push({attribute:t,value:r,rule:i})}else{if(s=="[ruleError]"){d.push({attribute:t,value:r,rule:i})}}}var g=null;if((l.length>0)||(d.length>0)){g={level:"error",type:{ruleMismatch:l,ruleError:d}}}return{error:g,message:u}}catch(w){logError("Exception thrown while calling _applyAttributeRules: "+w.message)}return{message:{}}};a.prototype._transportsQueue={normal:{},critical:{}};a.prototype._queueProcessingTimeoutId=null;a.prototype._queueEmpty=true;a.prototype._timeoutInterval=30000;var b=new a();return b}ModuleManager.registerFactory("transport",CreateAnalyticsTransport);
//66485CB2F16BF162212A71B96F31F34DC855E545207F5379D31B2CC99CDDF2FD8B50479B2C925AD04DD0EBD6EDB2EE1EB8297292F5C1DEF0F024F11600B3F4D5++