Ejemplo n.º 1
0
        public SchedulerAppTask(string name, string executableName, string userId, int scheduledHour, int scheduledMinute, int executionTimeLimitInMinutes, Repetition repetition)
        {
            Guard.NotNullNorEmpty(name, "name");
              Guard.NotNullNorEmpty(executableName, "executableName");
              Guard.NotNullNorEmpty(userId, "userId");
              Guard.NotNull(repetition, "repetition");

              if (scheduledHour < 0 || scheduledHour > 23)
              {
            throw new ArgumentException("Hour must be between 0 and 23 (inclusive).", "scheduledHour");
              }

              if (scheduledMinute < 0 || scheduledMinute > 59)
              {
            throw new ArgumentException("Minute must be between 0 and 59 (inclusive).", "scheduledMinute");
              }

              if (executionTimeLimitInMinutes < 0)
              {
            throw new ArgumentException("Execution time limit must be a non-negative integer.", "executionTimeLimitInMinutes");
              }

              Name = name;
              ExecutableName = executableName;
              UserId = userId;
              ScheduledHour = scheduledHour;
              ScheduledMinute = scheduledMinute;
              ExecutionTimeLimitInMinutes = executionTimeLimitInMinutes;
              Repetition = repetition;
        }
Ejemplo n.º 2
0
        public static RepetitionSpecification CreateRepetitionSpecification(Repetition repetition)
        {
            Guard.NotNull(repetition, "repetition");

              if (!repetition.Enabled)
              {
            return RepetitionSpecification.CreatedDisabled();
              }

              return
            RepetitionSpecification.CreateEnabled(
              repetition.Interval,
              repetition.Duration,
              repetition.StopAtDurationEnd);
        }
        // TODO IMM HI: can we update scheduler app without user name and password?
        public UpdateSchedulerTaskDeploymentStep(
            string machineName,
            string schedulerTaskName,
            string executablePath,
            string userName,
            string password,
            int scheduledHour,
            int scheduledMinute,
            int executionTimeLimitInMinutes,
            Repetition repetition,
            ITaskScheduler taskScheduler)
        {
            Guard.NotNull(taskScheduler, "taskScheduler");
              Guard.NotNullNorEmpty(machineName, "machineName");
              Guard.NotNullNorEmpty(schedulerTaskName, "schedulerTaskName");
              Guard.NotNullNorEmpty(executablePath, "executablePath");
              Guard.NotNullNorEmpty(userName, "userName");
              Guard.NotNullNorEmpty(password, "password");
              Guard.NotNull(repetition, "repetition");

              if (!Path.IsPathRooted(executablePath))
              {
            throw new ArgumentException(string.Format("Executable path ('{0}') is not an absolute path.", executablePath), "executablePath");
              }

              _taskScheduler = taskScheduler;
              _machineName = machineName;
              _schedulerTaskName = schedulerTaskName;
              _executablePath = executablePath;
              _userName = userName;
              _password = password;
              _scheduledHour = scheduledHour;
              _scheduledMinute = scheduledMinute;
              _executionTimeLimitInMinutes = executionTimeLimitInMinutes;
              _repetition = repetition;
        }