Package com.adobe.granite.maintenance
Class MaintenanceUtil
- java.lang.Object
-
- com.adobe.granite.maintenance.MaintenanceUtil
-
public abstract class MaintenanceUtil extends 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 String
getCronExpression(int[] timeDef)
static String
getCronExpression(String time)
static Calendar
getNextExecutionTime(MaintenanceTaskInfo.TaskSchedule schedule, String startTime)
Return the next execution time for this maintenance task If the time definitions are invalid, null is returned.static Calendar
getNextExecutionTime(String startTime, String endTime)
Return the next execution time for this window.static Calendar
getNextWindowExecutionTime(Resource windowResource)
Return the next execution time for this window.static boolean
isValidTimeInterval(String startTime, String endTime)
Check if the start and the end time are valid time definitions ([hour]:[minute]).static int[]
parseTime(String value)
Check if the given time string is valid ([hour]:[minute])
-
-
-
Method Detail
-
isValidTimeInterval
public static boolean isValidTimeInterval(String startTime, 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(String value) throws 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:
IllegalArgumentException
-
getCronExpression
public static String getCronExpression(int[] timeDef)
-
getNextExecutionTime
public static Calendar getNextExecutionTime(String startTime, 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 Calendar getNextExecutionTime(MaintenanceTaskInfo.TaskSchedule schedule, 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 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
-
-