1 package org.apache.archiva.repository;
4 * Licensed to the Apache Software Foundation (ASF) under one
5 * or more contributor license agreements. See the NOTICE file
6 * distributed with this work for additional information
7 * regarding copyright ownership. The ASF licenses this file
8 * to you under the Apache License, Version 2.0 (the
9 * "License"); you may not use this file except in compliance
10 * with the License. You may obtain a copy of the License at
12 * http://www.apache.org/licenses/LICENSE-2.0
14 * Unless required by applicable law or agreed to in writing,
15 * software distributed under the License is distributed on an
16 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17 * KIND, either express or implied. See the License for the
18 * specific language governing permissions and limitations
24 import java.util.Collection;
25 import java.util.SortedSet;
26 import java.util.TreeSet;
29 * A definition of schedule times.
31 public class ScheduleDefinition {
34 final SortedSet<DayOfWeek> daysOfWeek = new TreeSet<>();
36 final SortedSet<MonthDay> daysOfMonth = new TreeSet<>();
38 final SortedSet<LocalTime> scheduleTimes = new TreeSet<>();
40 final LocalTime startTime;
42 final Duration timeInterval;
44 boolean fixedTimes = false;
47 public ScheduleDefinition(Collection<DayOfWeek> daysOfWeek,
48 Collection<MonthDay> daysOfMonth,
49 Collection<LocalTime> scheduleTimes,
50 LocalTime startTime, Duration timeInterval) {
52 this.daysOfWeek.addAll(daysOfWeek);
53 if (daysOfMonth!=null)
54 this.daysOfMonth.addAll(daysOfMonth);
55 if (scheduleTimes!=null)
56 this.scheduleTimes.addAll(scheduleTimes);
57 this.startTime = startTime;
58 this.timeInterval = timeInterval;
62 * Returns the days of the week on which the action should be run.
63 * @return The set of week days.
65 public SortedSet<DayOfWeek> getDaysOfWeek() {
70 * Returns the days in the month on which the action should be run.
71 * @return The set of days.
73 public SortedSet<MonthDay> getDaysOfMonth() {
78 * Returns the time on each day on which the action should be run.
79 * @return a set of times on which the action should be run.
81 public SortedSet<LocalTime> getScheduleTimes() {
86 * Returns the start time each day on which the action should be run.
87 * @return the start time.
89 public LocalTime getStartTime() {
94 * The interval after that the next run should be scheduled.
95 * @return The interval between runs.
97 public Duration getTimeInterval() {
102 * Returns true, if the task should be run on fixed times. Otherwise
103 * the tasks are scheduled repeatedly with the time interval.
104 * @return true, if the schedule times are fixed.
106 public boolean isFixedTimes() {