Package com.adobe.granite.maintenance
Class MaintenanceUtil
- java.lang.Object
-
- com.adobe.granite.maintenance.MaintenanceUtil
-
public abstract class MaintenanceUtil extends java.lang.Object
Utility class for maintenance related stuff.
-
-
Constructor Summary
Constructors Constructor Description MaintenanceUtil()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.lang.String
getCronExpression(int[] timeDef)
static java.lang.String
getCronExpression(java.lang.String time)
static java.util.Calendar
getNextExecutionTime(MaintenanceTaskInfo.TaskSchedule schedule, java.lang.String startTime)
Return the next execution time for this maintenance task If the time definitions are invalid, null is returned.static java.util.Calendar
getNextExecutionTime(java.lang.String startTime, java.lang.String endTime)
Return the next execution time for this window.static java.util.Calendar
getNextWindowExecutionTime(Resource windowResource)
Return the next execution time for this window.static boolean
isValidTimeInterval(java.lang.String startTime, java.lang.String endTime)
Check if the start and the end time are valid time definitions ([hour]:[minute]).static int[]
parseTime(java.lang.String value)
Check if the given time string is valid ([hour]:[minute])
-
-
-
Method Detail
-
isValidTimeInterval
public static boolean isValidTimeInterval(java.lang.String startTime, java.lang.String endTime)
Check if the start and the end time are valid time definitions ([hour]:[minute]). This method does not check whether startTime is lower than endTime.
-
parseTime
public static int[] parseTime(java.lang.String value) throws java.lang.IllegalArgumentException
Check if the given time string is valid ([hour]:[minute])- Returns:
- a two value array with hour and minute if its valid,
null
otherwise. - Throws:
java.lang.IllegalArgumentException
-
getCronExpression
public static java.lang.String getCronExpression(int[] timeDef)
-
getCronExpression
public static java.lang.String getCronExpression(java.lang.String time)
-
getNextExecutionTime
public static java.util.Calendar getNextExecutionTime(java.lang.String startTime, java.lang.String endTime)
Return the next execution time for this window. If the current time is currently within the window, null will be returned. If the time definitions are invalid, null is returned as well.- Parameters:
startTime
-endTime
-- Returns:
- The next execution time, if the window is currently open
-
getNextExecutionTime
public static java.util.Calendar getNextExecutionTime(MaintenanceTaskInfo.TaskSchedule schedule, java.lang.String startTime)
Return the next execution time for this maintenance task If the time definitions are invalid, null is returned.- Returns:
- The next execution time, if the window is valid
-
getNextWindowExecutionTime
public static java.util.Calendar getNextWindowExecutionTime(Resource windowResource)
Return the next execution time for this window. If the current time is currently within the window, null will be returned. If the time definitions are invalid, null is returned as well.- Parameters:
windowResource
- The window resource.- Returns:
- The next execution time, if the window is currently open
- Since:
- 1.1
-
-