use of org.apache.openejb.quartz.TriggerBuilder in project tomee by apache.
the class JobSpec method validate.
// -- ActivationSpec methods
@SuppressWarnings("unchecked")
@Override
public void validate() throws InvalidPropertyException {
if (invalidProperty != null) {
throw invalidProperty;
}
final int i = hashCode();
detail = JobBuilder.newJob(QuartzResourceAdapter.JobEndpoint.class).withIdentity("Job" + i, Scheduler.DEFAULT_GROUP).withDescription(description).requestRecovery(recoverable).storeDurably(durable).build();
final TriggerBuilder tb = TriggerBuilder.newTrigger().forJob(detail).withIdentity("Trigger" + i, Scheduler.DEFAULT_GROUP).withDescription(description);
if (startTime != null) {
tb.startAt(parse(startTime));
}
if (endTime != null) {
tb.endAt(parse(endTime));
}
if (calendarName != null) {
tb.modifiedByCalendar(calendarName);
}
final CronScheduleBuilder csb = CronScheduleBuilder.cronSchedule(getCronExpression());
if (timeZone != null) {
csb.inTimeZone(TimeZone.getTimeZone(timeZone));
}
trigger = tb.withSchedule(csb).build();
try {
((CronTriggerImpl) trigger).validate();
} catch (final SchedulerException e) {
throw new InvalidPropertyException(e);
}
}
Aggregations