コード例 #1
0
        internal TaskManifest(IRevaleeRegistrar revalee, HttpContext context, IOptions <RevaleeOptions> option, IRevaleeClientRecurringSettings configuredTasks)
        {
            if (configuredTasks == null)
            {
                throw new ArgumentNullException(nameof(configuredTasks));
            }

            _option          = option.Value;
            _revalee         = revalee;
            _context         = context;
            _callbackBaseUri = configuredTasks.CallbackBaseUri;

            InitVariables();

            var taskList = new List <ConfiguredTask>();

            using (var taskBuilder = new TaskBuilder(_callbackBaseUri))
            {
                foreach (var task in configuredTasks.TaskModel)
                {
                    taskList.Add(taskBuilder.Create(_clockSource, task.Periodicity, task.Day.GetValueOrDefault(), task.Hour.GetValueOrDefault(), task.Minute, task.Url));

                    if (CallbackBaseUri == null)
                    {
                        ScavengeForCallbackBaseUri(task.Url);
                    }
                }
            }

            _taskCollection = new ImmutableTaskCollection(taskList);
        }
コード例 #2
0
 public RecurringTaskModuleMiddleware(RequestDelegate next, IRevaleeClientRecurringSettings recurringConfig, IRevaleeRegistrar revalee, IOptions <RevaleeOptions> option)
 {
     _next            = next;
     _recurringConfig = recurringConfig;
     _revalee         = revalee;
     _option          = option;
 }
コード例 #3
0
        internal TaskManifest(IRevaleeRegistrar revalee, HttpContext context, IOptions <RevaleeOptions> option)
        {
            InitVariables();

            _option         = option.Value;
            _revalee        = revalee;
            _context        = context;
            _taskCollection = new ImmutableTaskCollection();
        }
コード例 #4
0
        /// <summary>
        /// Called when a process requests authorization for the marked callback action.
        /// </summary>
        /// <param name="filterContext">The filter context, which encapsulates information for using <see cref="T:Revalee.Client.Mvc.CallbackActionAttribute" />.</param>
        /// <exception cref="T:System.ArgumentNullException">The <paramref name="filterContext" /> parameter is null.</exception>
        public void OnAuthorization(AuthorizationFilterContext filterContext)
        {
            if (filterContext == null)
            {
                Debug.Fail("Revalee Error", $"Revalee::{nameof(AuthorizationFilterContext)} parameter of {nameof(OnAuthorization)} method of {nameof(CallbackActionAttribute)} is null");

                throw new ArgumentNullException(nameof(filterContext));
            }

            _revalee       = (IRevaleeRegistrar)filterContext.HttpContext.RequestServices.GetService(typeof(IRevaleeRegistrar));
            _callBackState = (ICallbackStateCache)filterContext.HttpContext.RequestServices.GetService(typeof(ICallbackStateCache));

            if (filterContext.HttpContext == null ||
                filterContext.HttpContext.Request == null ||
                !_revalee.ValidateCallback(filterContext.HttpContext))   // (filterContext.HttpContext.Request))
            {
                filterContext.Result = new UnauthorizedResult();
            }
        }
コード例 #5
0
 public HomeController(IRevaleeRegistrar revalee, IRecurringTaskModule recurringTask)
 {
     _revalee       = revalee;
     _recurringTask = recurringTask;
 }
コード例 #6
0
        static async Task <TaskManifest> LoadManifest(HttpContext context, IRevaleeClientRecurringSettings recurringConfig, IRevaleeRegistrar revalee, IOptions <RevaleeOptions> option)
        {
            TaskManifest manifest = null;

            if (recurringConfig == null || !recurringConfig.TaskModel.Any())
            {
                manifest = new TaskManifest(revalee, context, option);
            }
            else
            {
                manifest = new TaskManifest(revalee, context, option, recurringConfig);

                if (!manifest.IsEmpty)
                {
                    await manifest.Start();
                }
            }

            return(manifest);
        }
コード例 #7
0
 internal static async Task PrepareManifest(HttpContext context, IRevaleeClientRecurringSettings recurringConfig, IRevaleeRegistrar revalee, IOptions <RevaleeOptions> option)
 {
     _manifest = await LoadManifest(context, recurringConfig, revalee, option);
 }