예제 #1
0
 public ProjectController(IProjectDataContext projectDataContext, ITaskDataContext taskDataContext, [FromServices] IMapper mapper, IFileService fileService, IHostingEnvironment env)
 {
     _projectDataContext = projectDataContext;
     _taskDataContext    = taskDataContext;
     _mapper             = mapper;
     _fileService        = fileService;
     RootHelper.RootPath = env.ContentRootPath;
 }
예제 #2
0
        /// <summary>
        /// Constructor.
        /// </summary>
        /// <param name="expressionConverter">The <see cref="IExpressionConverter"/> instance.</param>
        /// <param name="taskDataContext">The <see cref="ITaskDataContext"/> instance.</param>
        /// <param name="serverManager">The <see cref="IQueueManager"/> instance.</param>
        /// <param name="queueManager">The <see cref="IServerManager"/> instance.</param>
        /// <param name="loggerFactory">The <see cref="ICommonLoggerFactory"/> instance.</param>
        /// <exception cref="ArgumentNullException"><paramref name="expressionConverter"/> is <see langword="null" />.</exception>
        /// <exception cref="ArgumentNullException"><paramref name="taskDataContext"/> is <see langword="null" />.</exception>
        /// <exception cref="ArgumentNullException"><paramref name="serverManager"/> is <see langword="null" />.</exception>
        /// <exception cref="ArgumentNullException"><paramref name="queueManager"/> is <see langword="null" />.</exception>
        public TaskManager(TaskManagerConfiguration taskManagerConfiguration, ITaskBuilder taskBuilder, IExpressionConverter expressionConverter, ITaskDataContext taskDataContext, IServerManager serverManager, IQueueManager queueManager, ICommonLoggerFactory loggerFactory)
            : base("Task Manager", loggerFactory)
        {
            if (taskManagerConfiguration == null)
            {
                throw new ArgumentNullException(nameof(taskManagerConfiguration));
            }
            if (taskBuilder == null)
            {
                throw new ArgumentNullException(nameof(taskBuilder));
            }
            if (expressionConverter == null)
            {
                throw new ArgumentNullException("expressionConverter");
            }
            if (taskDataContext == null)
            {
                throw new ArgumentNullException("taskDataContext");
            }
            if (serverManager == null)
            {
                throw new ArgumentNullException("serverManager");
            }
            if (queueManager == null)
            {
                throw new ArgumentNullException("queueManager");
            }

            this.taskBuilder         = taskBuilder;
            this.expressionConverter = expressionConverter;
            this.taskDataContext     = taskDataContext;
            this.serverManager       = serverManager;
            this.queueManager        = queueManager;

            activeTasks = new Dictionary <Int64, IRunningTask>();

            maxRerunCount       = taskManagerConfiguration.MaxRerunAttempts;
            maxTasksPerQueue    = taskManagerConfiguration.MaxTaskPerQueue;
            timeShiftAfterCrash = taskManagerConfiguration.TimeShiftAfterCrash;
            taskManagerState    = taskManagerConfiguration.State;
        }