UserCalendar interface
A user calendar is a user-defined stateless session bean that is called by tasks when they need to calculate date-related values.
A user calendar bean uses the following home and remote interfaces, which are defined in the deployment descriptor using an assembly tool, such as Rational Application Developer:
com.ibm.websphere.scheduler.UserCalendarHome com.ibm.websphere.scheduler.UserCalendarThe bean itself needs to implement the applyDelta(), validate(), and getCalendarNames() methods defined in the remote interface. For details, see the Interface UserCalendar in the API documentation.
User calendars are used to calculate time intervals, such as the time between task runs. A user calendar takes a java.util.Date object, applies the interval string and returns the resulting java.util.Date.
User calendars are set with the setUserCalendar() method on the TaskInfo interface and called by the scheduler run-time code when a delta calculation is necessary.
The following methods on the TaskInfo interface specify delta strings that use the user calendar for calculation:
- setStartTimeInterval
- setStartByInterval
- setRepeatInterval
- Default user calendar
- If a user calendar has not been specified using the TaskInfo.setUserCalendar() method, a default user calendar is used. The default calendar allows for simple delta specifications, such as seconds, minutes, hours, days, and months. See the API documentation for details on the default calendar. The default user calendar also provides a CRON-like syntax for calculating absolute times versus time deltas.
- Calendar identifiers
- A single user calendar can contain logic for multiple calendars. A calendar specifier string determines which calendar is used. For example, a calendar bean might be implemented to recognize the interval day. However, the identifier also recognizes two calendar implementations: standard (for a standard calendar day) and business (for a business day).
- Internationalization and time zones
- Scheduler makes use of the java.util.Date class when storing and processing dates. Internally, this class saves the time as milliseconds since the Epoch, Greenwich Mean Time. Since the Date is not converted to local time until converted to a string, the scheduler respects the time zone where the date was created.
- Writing user calendars
- Because the user calendar is a stateless session bean, the same JEE programming model available to other session beans is available to the user calendar as well.
Related tasks
Develop and scheduling tasks
TaskInfo interface API documentation Reference topic