コード例 #1
0
        public INotifyClient RegisterClient(INotifySource source)
        {
            var client = new NotifyClientImpl(context, source);

            context.Invoke_NotifyClientRegistration(client);
            return(client);
        }
コード例 #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;
        }
コード例 #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);
             }
         }
     }
 }
コード例 #4
0
        public ImageStorage2(string dbId, int tenant)
        {
            this.dbId = dbId;
            this.tenant = tenant;

            NotifySource = new PhotoManagerNotifySource();
            NotifyClient = WorkContext.NotifyContext.NotifyService.RegisterClient(NotifySource);
        }
コード例 #5
0
        public ImageStorage2(string dbId, int tenant)
        {
            this.dbId   = dbId;
            this.tenant = tenant;

            NotifySource = new PhotoManagerNotifySource();
            NotifyClient = WorkContext.NotifyContext.NotifyService.RegisterClient(NotifySource);
        }
コード例 #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;
        }
コード例 #7
0
        INotifyClient INotifyRegistry.RegisterClient(INotifySource source, IServiceScope serviceScope)
        {
            //ValidateNotifySource(source);
            var client = new NotifyClientImpl(this, source, serviceScope);

            NotifyClientRegistration?.Invoke(this, client);
            return(client);
        }
コード例 #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);
        }
コード例 #9
0
        INotifyClient INotifyRegistry.RegisterClient(INotifySource source)
        {
            //ValidateNotifySource(source);
            var client = new NotifyClientImpl(this, source);

            if (NotifyClientRegistration != null)
            {
                NotifyClientRegistration(this, client);
            }
            return(client);
        }
コード例 #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;
        }
コード例 #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;
        }
コード例 #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);
        }
コード例 #13
0
ファイル: NotifyClient.cs プロジェクト: ridhouan/teamlab.v6.5
 private NotifyClient(INotifyClient client, INotifySource source)
 {
     this.client = client;
     this.source = source;
 }
コード例 #14
0
 public INotifyClient RegisterClient(INotifySource source)
 {
     var client = new NotifyClientImpl(context, source);
     context.Invoke_NotifyClientRegistration(client);
     return client;
 }
コード例 #15
0
 public NotifyClientImpl(Context context, INotifySource notifySource)
 {
     this.notifySource = notifySource ?? throw new ArgumentNullException("notifySource");
     ctx = context ?? throw new ArgumentNullException("context");
 }
コード例 #16
0
ファイル: Context.cs プロジェクト: Inzaghi2012/teamlab.v7.5
 INotifyClient INotifyRegistry.RegisterClient(INotifySource source)
 {
     //ValidateNotifySource(source);
     var client = new NotifyClientImpl(this, source);
     if (NotifyClientRegistration != null)
     {
         NotifyClientRegistration(this, client);
     }
     return client;
 }
コード例 #17
0
 static BirthdaysNotifyClient()
 {
     NotifySource = new BirthdaysNotifySource();
     Instance     = new BirthdaysNotifyClient(WorkContext.NotifyContext.NotifyService.RegisterClient(NotifySource));
 }
コード例 #18
0
ファイル: Context.cs プロジェクト: Inzaghi2012/teamlab.v7.5
 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);
             }
         }
     }
 }
コード例 #19
0
 static BirthdaysNotifyClient()
 {
     NotifySource = new BirthdaysNotifySource();
     Instance = new BirthdaysNotifyClient(WorkContext.NotifyContext.NotifyService.RegisterClient(NotifySource));
 }
コード例 #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");
 }
コード例 #21
0
 private NotifyClient(INotifyClient client, INotifySource source)
 {
     this.client = client;
     this.source = source;
 }
コード例 #22
0
 public static T Get <T>(INotifySource source) where T : class
 {
     return(GetInternal <T>(source));
 }