Ejemplo n.º 1
0
        public INotifyClient RegisterClient(INotifySource source)
        {
            var client = new NotifyClientImpl(context, source);

            context.Invoke_NotifyClientRegistration(client);
            return(client);
        }
Ejemplo n.º 2
0
        public NotifyRequest(INotifySource notifySource, INotifyAction action, string objectID, IRecipient recipient)
        {
            if (notifySource == null)
            {
                throw new ArgumentNullException("notifySource");
            }
            if (action == null)
            {
                throw new ArgumentNullException("action");
            }
            if (recipient == null)
            {
                throw new ArgumentNullException("recipient");
            }

            Properties   = new Hashtable();
            Arguments    = new List <ITagValue>();
            RequaredTags = new List <string>();
            Interceptors = new List <ISendInterceptor>();

            NotifySource = notifySource;
            Recipient    = recipient;
            NotifyAction = action;
            ObjectID     = objectID;

            IsNeedCheckSubscriptions = true;
        }
Ejemplo n.º 3
0
 private void ValidateNotifySource(INotifySource source)
 {
     foreach (var a in source.GetActionProvider().GetActions())
     {
         IEnumerable <string> senderNames;
         lock (channels)
         {
             senderNames = channels.Values.Select(s => s.SenderName);
         }
         foreach (var s in senderNames)
         {
             try
             {
                 var pattern = source.GetPatternProvider().GetPattern(a, s);
                 if (pattern == null)
                 {
                     throw new NotifyException(string.Format("In notify source {0} pattern not found for action {1} and sender {2}", source.ID, a.ID, s));
                 }
             }
             catch (Exception error)
             {
                 LogManager.GetLogger("ASC.Notify").ErrorFormat("Source: {0}, action: {1}, sender: {2}, error: {3}", source.ID, a.ID, s, error);
             }
         }
     }
 }
Ejemplo n.º 4
0
        public ImageStorage2(string dbId, int tenant)
        {
            this.dbId = dbId;
            this.tenant = tenant;

            NotifySource = new PhotoManagerNotifySource();
            NotifyClient = WorkContext.NotifyContext.NotifyService.RegisterClient(NotifySource);
        }
Ejemplo n.º 5
0
        public ImageStorage2(string dbId, int tenant)
        {
            this.dbId   = dbId;
            this.tenant = tenant;

            NotifySource = new PhotoManagerNotifySource();
            NotifyClient = WorkContext.NotifyContext.NotifyService.RegisterClient(NotifySource);
        }
Ejemplo n.º 6
0
        public NotifyClientImpl(Context context, INotifySource notifySource)
        {
            if (notifySource == null) throw new ArgumentNullException("notifySource");
            if (context == null) throw new ArgumentNullException("context");

            this.notifySource = notifySource;
            ctx = context;
        }
Ejemplo n.º 7
0
        INotifyClient INotifyRegistry.RegisterClient(INotifySource source, IServiceScope serviceScope)
        {
            //ValidateNotifySource(source);
            var client = new NotifyClientImpl(this, source, serviceScope);

            NotifyClientRegistration?.Invoke(this, client);
            return(client);
        }
Ejemplo n.º 8
0
        public static T GetEnsure <T>(INotifySource source) where T : class
        {
            var result = GetInternal <T>(source);

            if (result == null)
            {
                throw new NotifyException(String.Format("\"{0}\" not instanced from notify source.", typeof(T).Name));
            }
            return(result);
        }
Ejemplo n.º 9
0
        INotifyClient INotifyRegistry.RegisterClient(INotifySource source)
        {
            //ValidateNotifySource(source);
            var client = new NotifyClientImpl(this, source);

            if (NotifyClientRegistration != null)
            {
                NotifyClientRegistration(this, client);
            }
            return(client);
        }
Ejemplo n.º 10
0
        public NotifyClientImpl(Context context, INotifySource notifySource)
        {
            if (notifySource == null)
            {
                throw new ArgumentNullException("notifySource");
            }
            if (context == null)
            {
                throw new ArgumentNullException("context");
            }

            this.notifySource = notifySource;
            ctx = context;
        }
Ejemplo n.º 11
0
        public NotifyRequest(INotifySource notifySource, INotifyAction action, string objectID, IRecipient recipient)
        {
            if (notifySource == null) throw new ArgumentNullException("notifySource");
            if (action == null) throw new ArgumentNullException("action");
            if (recipient == null) throw new ArgumentNullException("recipient");

            Properties = new Hashtable();
            Arguments = new List<ITagValue>();
            RequaredTags = new List<string>();
            Interceptors = new List<ISendInterceptor>();

            NotifySource = notifySource;
            Recipient = recipient;
            NotifyAction = action;
            ObjectID = objectID;

            IsNeedCheckSubscriptions = true;
        }
Ejemplo n.º 12
0
        private static T GetInternal <T>(INotifySource source) where T : class
        {
            T result = null;

            if (source == null)
            {
                return(null);
            }
            if (typeof(T) == typeof(IActionPatternProvider))
            {
                result = (T)WrappedGet(() => source.GetActionPatternProvider());
            }
            if (typeof(T) == typeof(IActionProvider))
            {
                result = (T)WrappedGet(() => source.GetActionProvider());
            }
            if (typeof(T) == typeof(IPatternProvider))
            {
                result = (T)WrappedGet(() => source.GetPatternProvider());
            }
            if (typeof(T) == typeof(IDependencyProvider))
            {
                result = (T)WrappedGet(() => source.GetDependencyProvider());
            }
            if (typeof(T) == typeof(ISubscriptionProvider))
            {
                result = (T)WrappedGet(() => source.GetSubscriptionProvider());
            }
            if (typeof(T) == typeof(IRecipientProvider))
            {
                result = (T)WrappedGet(() => source.GetRecipientsProvider());
            }
            if (typeof(T) == typeof(ISubscriptionSource))
            {
                result = (T)WrappedGet(() => source.GetSubscriptionSource());
            }
            return(result);
        }
Ejemplo n.º 13
0
 private NotifyClient(INotifyClient client, INotifySource source)
 {
     this.client = client;
     this.source = source;
 }
Ejemplo n.º 14
0
 public INotifyClient RegisterClient(INotifySource source)
 {
     var client = new NotifyClientImpl(context, source);
     context.Invoke_NotifyClientRegistration(client);
     return client;
 }
Ejemplo n.º 15
0
 public NotifyClientImpl(Context context, INotifySource notifySource)
 {
     this.notifySource = notifySource ?? throw new ArgumentNullException("notifySource");
     ctx = context ?? throw new ArgumentNullException("context");
 }
Ejemplo n.º 16
0
 INotifyClient INotifyRegistry.RegisterClient(INotifySource source)
 {
     //ValidateNotifySource(source);
     var client = new NotifyClientImpl(this, source);
     if (NotifyClientRegistration != null)
     {
         NotifyClientRegistration(this, client);
     }
     return client;
 }
Ejemplo n.º 17
0
 static BirthdaysNotifyClient()
 {
     NotifySource = new BirthdaysNotifySource();
     Instance     = new BirthdaysNotifyClient(WorkContext.NotifyContext.NotifyService.RegisterClient(NotifySource));
 }
Ejemplo n.º 18
0
 private void ValidateNotifySource(INotifySource source)
 {
     foreach (var a in source.GetActionProvider().GetActions())
     {
         var senderNames = Enumerable.Empty<string>();
         lock (channels)
         {
             senderNames = channels.Values.Select(s => s.SenderName);
         }
         foreach (var s in senderNames)
         {
             try
             {
                 var pattern = source.GetPatternProvider().GetPattern(a, s);
                 if (pattern == null)
                 {
                     throw new NotifyException(string.Format("In notify source {0} pattern not found for action {1} and sender {2}", source.ID, a.ID, s));
                 }
             }
             catch (Exception error)
             {
                 log4net.LogManager.GetLogger("ASC.Notify").ErrorFormat("Source: {0}, action: {1}, sender: {2}, error: {3}", source.ID, a.ID, s, error);
             }
         }
     }
 }
 static BirthdaysNotifyClient()
 {
     NotifySource = new BirthdaysNotifySource();
     Instance = new BirthdaysNotifyClient(WorkContext.NotifyContext.NotifyService.RegisterClient(NotifySource));
 }
Ejemplo n.º 20
0
 public NotifyClientImpl(Context context, INotifySource notifySource, IServiceScope serviceScope)
 {
     this.notifySource = notifySource ?? throw new ArgumentNullException("notifySource");
     ServiceScope      = serviceScope;
     ctx = context ?? throw new ArgumentNullException("context");
 }
Ejemplo n.º 21
0
 private NotifyClient(INotifyClient client, INotifySource source)
 {
     this.client = client;
     this.source = source;
 }
Ejemplo n.º 22
0
 public static T Get <T>(INotifySource source) where T : class
 {
     return(GetInternal <T>(source));
 }