Пример #1
0
        public virtual void AddCallback(Net.Vpc.Upa.Callback callback)
        {
            Net.Vpc.Upa.Impl.Config.Callback.DefaultCallback        dcallback = (Net.Vpc.Upa.Impl.Config.Callback.DefaultCallback)callback;
            System.Collections.Generic.IDictionary <string, object> conf      = dcallback.GetConfiguration();
            //        if (conf == null) {
            //            conf = new HashMap<String, Object>();
            //        }
            bool   fireBefore         = callback.GetPhase() == Net.Vpc.Upa.EventPhase.BEFORE;
            string nameFilter         = null;
            bool   trackSystemObjects = true;

            if (conf != null && conf.ContainsKey("trackSystemObjects"))
            {
                trackSystemObjects = ((bool?)Net.Vpc.Upa.Impl.FwkConvertUtils.GetMapValue <string, object>(conf, "trackSystemObjects")).Value;
            }
            nameFilter = conf == null ? null : (string)Net.Vpc.Upa.Impl.FwkConvertUtils.GetMapValue <string, object>(conf, "nameFilter");
            if (Net.Vpc.Upa.Impl.Util.StringUtils.IsNullOrEmpty(nameFilter))
            {
                nameFilter = null;
            }
            if (fireBefore)
            {
                Net.Vpc.Upa.Impl.Util.CallbackInvokerKey k = new Net.Vpc.Upa.Impl.Util.CallbackInvokerKey(callback.GetCallbackType(), callback.GetObjectType(), nameFilter, trackSystemObjects);
                System.Collections.Generic.IList <Net.Vpc.Upa.Callback> ss = Net.Vpc.Upa.Impl.FwkConvertUtils.GetMapValue <Net.Vpc.Upa.Impl.Util.CallbackInvokerKey, System.Collections.Generic.IList <Net.Vpc.Upa.Callback> >(this.before, k);
                if (ss == null)
                {
                    ss             = new System.Collections.Generic.List <Net.Vpc.Upa.Callback>();
                    this.before[k] = ss;
                }
                ss.Add(callback);
            }
            else
            {
                Net.Vpc.Upa.Impl.Util.CallbackInvokerKey k = new Net.Vpc.Upa.Impl.Util.CallbackInvokerKey(callback.GetCallbackType(), callback.GetObjectType(), nameFilter, trackSystemObjects);
                System.Collections.Generic.IList <Net.Vpc.Upa.Callback> ss = Net.Vpc.Upa.Impl.FwkConvertUtils.GetMapValue <Net.Vpc.Upa.Impl.Util.CallbackInvokerKey, System.Collections.Generic.IList <Net.Vpc.Upa.Callback> >(this.after, k);
                if (ss == null)
                {
                    ss            = new System.Collections.Generic.List <Net.Vpc.Upa.Callback>();
                    this.after[k] = ss;
                }
                ss.Add(callback);
                if (callback is Net.Vpc.Upa.PreparedCallback)
                {
                    System.Collections.Generic.IList <Net.Vpc.Upa.PreparedCallback> sss = Net.Vpc.Upa.Impl.FwkConvertUtils.GetMapValue <Net.Vpc.Upa.Impl.Util.CallbackInvokerKey, System.Collections.Generic.IList <Net.Vpc.Upa.PreparedCallback> >(this.preparedAfter, k);
                    if (sss == null)
                    {
                        sss = new System.Collections.Generic.List <Net.Vpc.Upa.PreparedCallback>();
                        this.preparedAfter[k] = sss;
                    }
                    sss.Add((Net.Vpc.Upa.PreparedCallback)callback);
                }
            }
        }
Пример #2
0
        public virtual void RemoveCallback(Net.Vpc.Upa.Callback callback)
        {
            Net.Vpc.Upa.Impl.Config.Callback.DefaultCallback        dcallback = (Net.Vpc.Upa.Impl.Config.Callback.DefaultCallback)callback;
            System.Collections.Generic.IDictionary <string, object> conf      = dcallback.GetConfiguration();
            //        if (conf == null) {
            //            conf = new HashMap<String, Object>();
            //        }
            bool   fireBefore         = true;
            bool   fireAfter          = true;
            bool   trackSystemObjects = true;
            string nameFilter         = null;

            if (conf != null)
            {
                if (conf.ContainsKey("before"))
                {
                    fireBefore = ((bool?)Net.Vpc.Upa.Impl.FwkConvertUtils.GetMapValue <string, object>(conf, "before")).Value;
                }
                if (conf.ContainsKey("after"))
                {
                    fireBefore = ((bool?)Net.Vpc.Upa.Impl.FwkConvertUtils.GetMapValue <string, object>(conf, "after")).Value;
                }
                if (conf.ContainsKey("trackSystemObjects"))
                {
                    trackSystemObjects = ((bool?)Net.Vpc.Upa.Impl.FwkConvertUtils.GetMapValue <string, object>(conf, "trackSystemObjects")).Value;
                }
                nameFilter = (string)Net.Vpc.Upa.Impl.FwkConvertUtils.GetMapValue <string, object>(conf, "nameFilter");
            }
            if (Net.Vpc.Upa.Impl.Util.StringUtils.IsNullOrEmpty(nameFilter))
            {
                nameFilter = null;
            }
            Net.Vpc.Upa.Impl.Util.CallbackInvokerKey k = new Net.Vpc.Upa.Impl.Util.CallbackInvokerKey(callback.GetCallbackType(), callback.GetObjectType(), nameFilter, trackSystemObjects);
            System.Collections.Generic.IList <Net.Vpc.Upa.Callback> ss = Net.Vpc.Upa.Impl.FwkConvertUtils.GetMapValue <Net.Vpc.Upa.Impl.Util.CallbackInvokerKey, System.Collections.Generic.IList <Net.Vpc.Upa.Callback> >(before, k);
            if (ss != null)
            {
                ss.Remove(callback);
            }
            ss = Net.Vpc.Upa.Impl.FwkConvertUtils.GetMapValue <Net.Vpc.Upa.Impl.Util.CallbackInvokerKey, System.Collections.Generic.IList <Net.Vpc.Upa.Callback> >(after, k);
            if (ss != null)
            {
                ss.Remove(callback);
            }
            if (callback is Net.Vpc.Upa.PreparedCallback)
            {
                System.Collections.Generic.IList <Net.Vpc.Upa.PreparedCallback> sss = Net.Vpc.Upa.Impl.FwkConvertUtils.GetMapValue <Net.Vpc.Upa.Impl.Util.CallbackInvokerKey, System.Collections.Generic.IList <Net.Vpc.Upa.PreparedCallback> >(preparedAfter, k);
                if (sss != null)
                {
                    sss.Remove((Net.Vpc.Upa.PreparedCallback)callback);
                }
            }
        }
Пример #3
0
 public override bool Equals(object o1)
 {
     if (this == o1)
     {
         return(true);
     }
     if (o1 == null || GetType() != o1.GetType())
     {
         return(false);
     }
     Net.Vpc.Upa.Impl.Config.Callback.DefaultCallback that = (Net.Vpc.Upa.Impl.Config.Callback.DefaultCallback)o1;
     if (converter != null ? !converter.Equals(that.converter) : that.converter != null)
     {
         return(false);
     }
     if (instance != null ? !instance.Equals(that.instance) : that.instance != null)
     {
         return(false);
     }
     return(!(method != null ? !method.Equals(that.method) : that.method != null));
 }
Пример #4
0
 public FunctionCallback(Net.Vpc.Upa.Impl.Config.Callback.DefaultCallback b)
 {
     this.callback = b;
 }