Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- '{***************************************************************************}
- { }
- { Leopard Report }
- { Copyright (C) 2012 Carlos Dias da Silva F. }
- { leopardreport@hotmail.com }
- { 2021/12 - }
- { Framework Leopard Reflection }
- { Analisa CallBacks passados pelo ServerINvoke para que }
- { o sistema determine e invoke o método do serverfunction }
- { TODO: Falta Implementar o método que vai gravar em }
- { uma HashTable }
- {***************************************************************************}'
- function CallBackReflectionAssign(n, o, p) {
- this.executor = new ServerFunctionExecutor("DSAdmin", o, this);
- this.channerallocregister = n;
- this.stopped = true;
- this.tokenbpass = p;
- this.callback = function(a, b, c) {
- if (c != null && !c.stopped && a != null) {
- a = (a.result != null) ? a.result : a;
- a = isArray(a) ? a[0] : a;
- var d = getSessionID();
- if (d == null) { c.stopped = true }
- if (a.ExpiredtimeSession != null) {
- c.stopped = true;
- for (var i = 0; i < n.callbacks.length; i++)
- {
- n.callbacks[i].notifyCallback(a)
- }
- if (IsReflectionReferenceFunction(n.onChannelStateChange)) {
- n.onChannelStateChange(new channerallocregisterEventItem(n.EVENT_SERVER_DISCONNECT, n, null))
- }
- } else if (a.broadcast != null) {
- var e = a.broadcast;
- var f = e[0];
- var g = e[1];
- var h = a.channel == null ? n.serverChannelName : a.channel;
- var j = n.serverChannelName == h;
- for (var i = 0; i < n.callbacks.length; i++) {
- var k = n.callbacks[i];
- if (j || arrayIndexOf(k.serverChannelNames, h) > -1) {
- k.notifyCallback(f, g)
- }
- }
- c.sendResponse(true, c)
- } else if (a.invoke != null) {
- var e = a.invoke;
- var l = e[0];
- var f = e[1];
- var g = e[2];
- var m;
- for (var i = 0; i < n.callbacks.length; i++) {
- m = n.callbacks[i];
- if (m.callbackId == l) {
- c.sendResponse(m.notifyCallback(f, g), c);
- break
- }
- }
- } else if (a.error != null) {
- c.stopped = true;
- for (var i = 0; i < n.callbacks.length; i++) {
- n.callbacks[i].notifyCallback(a, "error")
- }
- if (IsReflectionReferenceFunction(n.onChannelStateChange)) {
- n.onChannelStateChange(new channerallocregisterEventItem(this.channerallocregister.EVENT_SERVER_DISCONNECT,
- this.channerallocregister, null))
- }
- } else if (a.closeChannel == null && a.close == null) {
- c.sendResponse(false, c)
- } else {
- c.stopped = true;
- for (var i = 0; i < n.callbacks.length; i++) { n.callbacks[i].notifyCallback(a, "closed") }
- if (IsReflectionReferenceFunction(n.onChannelStateChange)) { n.onChannelStateChange(new channerallocregisterEventItem(n.EVENT_CHANNEL_STOP, n, null)) }
- }
- } else {
- if (c != null) {
- if (!c.stopped && IsReflectionReferenceFunction(n.onChannelStateChange)) { n.onChannelStateChange(new channerallocregisterEventItem(n.EVENT_SERVER_DISCONNECT, n, null)) }
- c.stopped = true
- }
- }
- }
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement