/// <summary>
 /// Инициализирует экзепляр параметров конфигурации планировщика служб.
 /// </summary>
 /// <param name="scheduleInfo">Сведения о расписании выполняемого задания.</param>
 public ScheduleExecutionSchema(IScheduleAction scheduleInfo)
 {
     Name          = scheduleInfo.Name;
     DueTime       = scheduleInfo.DueTime;
     Period        = scheduleInfo.Period;
     LaunchesLimit = scheduleInfo.LaunchesLimit;
     Id            = new Guid();
 }
Beispiel #2
0
            /// <summary>
            /// Initializes a new instance of the <see cref="ActionMap"/> class.
            /// </summary>
            /// <param name="information">The information describing the action.</param>
            /// <param name="action">The action.</param>
            public ActionMap(ScheduleActionInformation information, IScheduleAction action)
            {
                {
                    Debug.Assert(information != null, "The action information should not be a null reference.");
                    Debug.Assert(action != null, "The action should not be a null reference.");
                }

                m_Info   = information;
                m_Action = action;
            }
Beispiel #3
0
        /// <summary>
        /// Adds the <see cref="IScheduleAction"/> object with the variables it affects and the dependencies for that action.
        /// </summary>
        /// <param name="action">The action that should be stored.</param>
        /// <param name="name">The name of the action that is being described by this information object.</param>
        /// <param name="description">The description of the action that is being described by this information object.</param>
        /// <returns>An object identifying and describing the action.</returns>
        /// <exception cref="ArgumentNullException">
        ///     Thrown if <paramref name="action"/> is <see langword="null" />.
        /// </exception>
        public ScheduleActionInformation Add(
            IScheduleAction action,
            string name,
            string description)
        {
            {
                Lokad.Enforce.Argument(() => action);
            }

            var id   = new ScheduleElementId();
            var info = new ScheduleActionInformation(id, name, description);

            m_Actions.Add(id, new ActionMap(info, action));

            return(info);
        }
Beispiel #4
0
        /// <summary>
        /// Replaces the action current stored against the given ID with a new one.
        /// </summary>
        /// <param name="actionToReplace">The ID of the action that should be replaced.</param>
        /// <param name="newAction">The new action.</param>
        /// <exception cref="ArgumentNullException">
        ///     Thrown if <paramref name="actionToReplace"/> is <see langword="null" />.
        /// </exception>
        /// <exception cref="ArgumentNullException">
        ///     Thrown if <paramref name="newAction"/> is <see langword="null" />.
        /// </exception>
        /// <exception cref="UnknownScheduleActionException">
        ///     Thrown if <paramref name="actionToReplace"/> is not linked to a known action.
        /// </exception>
        public void Update(
            ScheduleElementId actionToReplace,
            IScheduleAction newAction)
        {
            {
                Lokad.Enforce.Argument(() => actionToReplace);
                Lokad.Enforce.Argument(() => newAction);
                Lokad.Enforce.With <UnknownScheduleActionException>(
                    m_Actions.ContainsKey(actionToReplace),
                    Resources.Exceptions_Messages_UnknownScheduleAction);
            }

            var oldInfo = m_Actions[actionToReplace].Information;
            var info    = new ScheduleActionInformation(
                actionToReplace,
                oldInfo.Name,
                oldInfo.Description);

            m_Actions[actionToReplace] = new ActionMap(info, newAction);
        }
            /// <summary>
            /// Initializes a new instance of the <see cref="ActionMap"/> class.
            /// </summary>
            /// <param name="information">The information describing the action.</param>
            /// <param name="action">The action.</param>
            public ActionMap(ScheduleActionInformation information, IScheduleAction action)
            {
                {
                    Debug.Assert(information != null, "The action information should not be a null reference.");
                    Debug.Assert(action != null, "The action should not be a null reference.");
                }

                m_Info = information;
                m_Action = action;
            }
        /// <summary>
        /// Replaces the action current stored against the given ID with a new one.
        /// </summary>
        /// <param name="actionToReplace">The ID of the action that should be replaced.</param>
        /// <param name="newAction">The new action.</param>
        /// <exception cref="ArgumentNullException">
        ///     Thrown if <paramref name="actionToReplace"/> is <see langword="null" />.
        /// </exception>
        /// <exception cref="ArgumentNullException">
        ///     Thrown if <paramref name="newAction"/> is <see langword="null" />.
        /// </exception>
        /// <exception cref="UnknownScheduleActionException">
        ///     Thrown if <paramref name="actionToReplace"/> is not linked to a known action.
        /// </exception>
        public void Update(
            ScheduleElementId actionToReplace,
            IScheduleAction newAction)
        {
            {
                Lokad.Enforce.Argument(() => actionToReplace);
                Lokad.Enforce.Argument(() => newAction);
                Lokad.Enforce.With<UnknownScheduleActionException>(
                    m_Actions.ContainsKey(actionToReplace),
                    Resources.Exceptions_Messages_UnknownScheduleAction);
            }

            var oldInfo = m_Actions[actionToReplace].Information;
            var info = new ScheduleActionInformation(
                actionToReplace,
                oldInfo.Name,
                oldInfo.Description);
            m_Actions[actionToReplace] = new ActionMap(info, newAction);
        }
        /// <summary>
        /// Adds the <see cref="IScheduleAction"/> object with the variables it affects and the dependencies for that action.
        /// </summary>
        /// <param name="action">The action that should be stored.</param>
        /// <param name="name">The name of the action that is being described by this information object.</param>
        /// <param name="description">The description of the action that is being described by this information object.</param>
        /// <returns>An object identifying and describing the action.</returns>
        /// <exception cref="ArgumentNullException">
        ///     Thrown if <paramref name="action"/> is <see langword="null" />.
        /// </exception>
        public ScheduleActionInformation Add(
            IScheduleAction action,
            string name,
            string description)
        {
            {
                Lokad.Enforce.Argument(() => action);
            }

            var id = new ScheduleElementId();
            var info = new ScheduleActionInformation(id, name, description);
            m_Actions.Add(id, new ActionMap(info, action));

            return info;
        }