Class BasicScheduleUtils


  • public abstract class BasicScheduleUtils
    extends java.lang.Object

    BasicScheduleUtils class.

    • Field Detail

      • m_dayOfWeekMap

        protected static final java.lang.ThreadLocal<java.util.Map<java.lang.String,​java.lang.Integer>> m_dayOfWeekMap
        The day of the week values to name mapping
      • FORMAT1

        public static final java.lang.String FORMAT1
        Constant FORMAT1="dd-MMM-yyyy HH:mm:ss"
        See Also:
        Constant Field Values
      • FORMAT2

        public static final java.lang.String FORMAT2
        Constant FORMAT2="HH:mm:ss"
        See Also:
        Constant Field Values
    • Constructor Detail

      • BasicScheduleUtils

        public BasicScheduleUtils()
    • Method Detail

      • isTimeInSchedule

        public static boolean isTimeInSchedule​(java.util.Calendar cal,
                                               BasicSchedule sched)

        isTimeInSchedule

        Parameters:
        cal - a Calendar object.
        sched - a org.opennms.netmgt.config.poller.outages.common.BasicSchedule object.
        Returns:
        a boolean.
      • setOutCalTime

        public static void setOutCalTime​(java.util.Calendar outCal,
                                         java.lang.String timeStr)
        Set the time in outCal from timeStr. 'timeStr'is in either the 'dd-MMM-yyyy HH:mm:ss' or the 'HH:mm:ss' formats
        Parameters:
        outCal - the calendar in which time is to be set
        timeStr - the time string
      • getDayOfWeekIndex

        public static java.lang.Integer getDayOfWeekIndex​(java.lang.String dayName)

        getDayOfWeekIndex

        Parameters:
        dayName - a String object.
        Returns:
        a Integer object.
      • getEndOfSchedule

        public static java.util.Calendar getEndOfSchedule​(BasicSchedule out)

        getEndOfSchedule

        Parameters:
        out - a org.opennms.netmgt.config.poller.outages.common.BasicSchedule object.
        Returns:
        a Calendar object.
      • isTimeInSchedule

        public static boolean isTimeInSchedule​(java.util.Date time,
                                               BasicSchedule sched)

        isTimeInSchedule

        Parameters:
        time - a Date object.
        sched - a org.opennms.netmgt.config.poller.outages.common.BasicSchedule object.
        Returns:
        a boolean.
      • isDaily

        public static boolean isDaily​(Time time)

        isDaily

        Parameters:
        time - a org.opennms.netmgt.config.poller.outages.common.Time object.
        Returns:
        a boolean.
      • isWeekly

        public static boolean isWeekly​(Time time)

        isWeekly

        Parameters:
        time - a org.opennms.netmgt.config.poller.outages.common.Time object.
        Returns:
        a boolean.
      • isMonthly

        public static boolean isMonthly​(Time time)

        isMonthly

        Parameters:
        time - a org.opennms.netmgt.config.poller.outages.common.Time object.
        Returns:
        a boolean.
      • isSpecific

        public static boolean isSpecific​(Time time)

        isSpecific

        Parameters:
        time - a org.opennms.netmgt.config.poller.outages.common.Time object.
        Returns:
        a boolean.
      • getSpecificTime

        public static java.util.Date getSpecificTime​(java.lang.String specificString)

        getSpecificTime

        Parameters:
        specificString - a String object.
        Returns:
        a Date object.
      • getMonthlyTime

        public static java.util.Date getMonthlyTime​(java.util.Date referenceTime,
                                                    java.lang.String day,
                                                    java.lang.String timeString)

        getMonthlyTime

        Parameters:
        referenceTime - a Date object.
        day - a String object.
        timeString - a String object.
        Returns:
        a Date object.
      • getWeeklyTime

        public static java.util.Date getWeeklyTime​(java.util.Date referenceTime,
                                                   java.lang.String day,
                                                   java.lang.String timeString)

        getWeeklyTime

        Parameters:
        referenceTime - a Date object.
        day - a String object.
        timeString - a String object.
        Returns:
        a Date object.
      • getDailyTime

        public static java.util.Date getDailyTime​(java.util.Date referenceTime,
                                                  java.lang.String timeString)

        getDailyTime

        Parameters:
        referenceTime - a Date object.
        timeString - a String object.
        Returns:
        a Date object.
      • getInterval

        public static OwnedInterval getInterval​(java.util.Date ref,
                                                Time time,
                                                Owner owner)

        getInterval

        Parameters:
        ref - a Date object.
        time - a org.opennms.netmgt.config.poller.outages.common.Time object.
        owner - a Owner object.
        Returns:
        a OwnedInterval object.
      • nextDay

        public static java.util.Date nextDay​(java.util.Date date)

        nextDay

        Parameters:
        date - a Date object.
        Returns:
        a Date object.
      • nextWeek

        public static java.util.Date nextWeek​(java.util.Date date)

        nextWeek

        Parameters:
        date - a Date object.
        Returns:
        a Date object.
      • nextMonth

        public static java.util.Date nextMonth​(java.util.Date date)

        nextMonth

        Parameters:
        date - a Date object.
        Returns:
        a Date object.
      • getIntervals

        public static OwnedIntervalSequence getIntervals​(java.util.Date start,
                                                         java.util.Date end,
                                                         Time time,
                                                         Owner owner)

        getIntervals

        Parameters:
        start - a Date object.
        end - a Date object.
        time - a org.opennms.netmgt.config.poller.outages.common.Time object.
        owner - a Owner object.
        Returns:
        a OwnedIntervalSequence object.
      • getIntervalsCovering

        public static OwnedIntervalSequence getIntervalsCovering​(java.util.Date start,
                                                                 java.util.Date end,
                                                                 BasicSchedule sched,
                                                                 Owner owner)

        getIntervalsCovering

        Parameters:
        start - a Date object.
        end - a Date object.
        sched - a org.opennms.netmgt.config.poller.outages.common.BasicSchedule object.
        owner - a Owner object.
        Returns:
        a OwnedIntervalSequence object.