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 the or
WebSphere Studio Application Developer:
com.ibm.websphere.scheduler.UserCalendarHome
com.ibm.websphere.scheduler.UserCalendar
The bean itself needs
to implement the applyDelta() and validate() methods defined in the remote
interface. For details, see the Interface UserCalendar
in the Javadoc.
User
calendars can be used to calculate time intervals, such as the time between
when a repeating task fires and the next time it fires. A user calendar takes
a java.util.Date object and applies the interval string. The resulting object
is a java.util.Date object that is an incremented date.
User calendars
are set by 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 Javadoc
for details on the default calendar.
- Calendar specifiers
- A single user calendar can contain logic for multiple calendars. Which
calendar is used is determined by a string that acts as the specifier. For
example, a bean might be implemented to recognize the interval "day", with
a specifier that determines whether to calculate "day" as a standard calendar
day, or as 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 Java 2
Platform Enterprise Edition (J2EE) programming model available to other session
beans is available to the user calendar as well.