statement.setString(14, c.getScheduleExpression().getDayOfMonth()); statement.setString(15, c.getScheduleExpression().getMonth()); statement.setString(16, c.getScheduleExpression().getYear());
public CalendarTimerEntity(CalendarTimer calendarTimer) { super(calendarTimer); this.scheduleExpression = calendarTimer.getScheduleExpression(); this.autoTimer = calendarTimer.isAutoTimer(); if (calendarTimer.isAutoTimer()) { Method method = calendarTimer.getTimeoutMethod(); Class<?>[] methodParams = method.getParameterTypes(); String[] params = new String[methodParams.length]; for (int i = 0; i < methodParams.length; i++) { params[i] = methodParams[i].getName(); } this.timeoutMethod = new TimeoutMethod(method.getDeclaringClass().getName(), method.getName(), params); } else { this.timeoutMethod = null; } this.scheduleExprSecond = this.scheduleExpression.getSecond(); this.scheduleExprMinute = this.scheduleExpression.getMinute(); this.scheduleExprHour = this.scheduleExpression.getHour(); this.scheduleExprDayOfMonth = this.scheduleExpression.getDayOfMonth(); this.scheduleExprMonth = this.scheduleExpression.getMonth(); this.scheduleExprDayOfWeek = this.scheduleExpression.getDayOfWeek(); this.scheduleExprYear = this.scheduleExpression.getYear(); this.scheduleExprStartDate = this.scheduleExpression.getStart(); this.scheduleExprEndDate = this.scheduleExpression.getEnd(); this.scheduleExprTimezone = this.scheduleExpression.getTimezone(); }
this.dayOfMonth = new DayOfMonth(schedule.getDayOfMonth()); this.month = new Month(schedule.getMonth()); this.year = new Year(schedule.getYear()); String timezoneId = schedule.getTimezone(); if (timezoneId != null && !(timezoneId = timezoneId.trim()).isEmpty()) {
private void nullCheckScheduleAttributes(ScheduleExpression schedule) { if (schedule.getSecond() == null) { throw EJB3_TIMER_LOGGER.invalidScheduleExpressionSecond(schedule); } if (schedule.getMinute() == null) { throw EJB3_TIMER_LOGGER.invalidScheduleExpressionMinute(schedule); } if (schedule.getHour() == null) { throw EJB3_TIMER_LOGGER.invalidScheduleExpressionHour(schedule); } if (schedule.getDayOfMonth() == null) { throw EJB3_TIMER_LOGGER.invalidScheduleExpressionDayOfMonth(schedule); } if (schedule.getDayOfWeek() == null) { throw EJB3_TIMER_LOGGER.invalidScheduleExpressionDayOfWeek(schedule); } if (schedule.getMonth() == null) { throw EJB3_TIMER_LOGGER.invalidScheduleExpressionMonth(schedule); } if (schedule.getYear() == null) { throw EJB3_TIMER_LOGGER.invalidScheduleExpressionYear(schedule); } }
writer.writeAttribute(SCHEDULE_EXPR_DAY_OF_MONTH, timer.getScheduleExpression().getDayOfMonth()); writer.writeAttribute(SCHEDULE_EXPR_MONTH, timer.getScheduleExpression().getMonth()); writer.writeAttribute(SCHEDULE_EXPR_YEAR, timer.getScheduleExpression().getYear()); if (timer.getScheduleExpression().getStart() != null) { writer.writeAttribute(SCHEDULE_EXPR_START_DATE, Long.toString(timer.getScheduleExpression().getStart().getTime()));
private static void addSchedule(Timer timer, ModelNode timerNode, final String componentName) { try { final ModelNode schedNode = timerNode.get(SCHEDULE); ScheduleExpression sched = timer.getSchedule(); addScheduleDetailString(schedNode, sched.getYear(), YEAR); addScheduleDetailString(schedNode, sched.getMonth(), MONTH); addScheduleDetailString(schedNode, sched.getDayOfMonth(), DAY_OF_MONTH); addScheduleDetailString(schedNode, sched.getDayOfWeek(), DAY_OF_WEEK); addScheduleDetailString(schedNode, sched.getHour(), HOUR); addScheduleDetailString(schedNode, sched.getMinute(), MINUTE); addScheduleDetailString(schedNode, sched.getSecond(), SECOND); addScheduleDetailString(schedNode, sched.getTimezone(), TIMEZONE); addScheduleDetailDate(schedNode, sched.getStart(), START); addScheduleDetailDate(schedNode, sched.getEnd(), END); } catch (IllegalStateException e) { // ignore } catch (NoSuchObjectLocalException e) { // ignore } catch (EJBException e) { logTimerFailure(componentName, e); } }
private ScheduleExpression clone(ScheduleExpression schedule) { // clone the schedule ScheduleExpression clonedSchedule = new ScheduleExpression(); clonedSchedule.second(schedule.getSecond()); clonedSchedule.minute(schedule.getMinute()); clonedSchedule.hour(schedule.getHour()); clonedSchedule.dayOfWeek(schedule.getDayOfWeek()); clonedSchedule.dayOfMonth(schedule.getDayOfMonth()); clonedSchedule.month(schedule.getMonth()); clonedSchedule.year(schedule.getYear()); clonedSchedule.timezone(schedule.getTimezone()); clonedSchedule.start(schedule.getStart()); clonedSchedule.end(schedule.getEnd()); return clonedSchedule; }
.setScheduleExprDayOfMonth(schedule.getDayOfMonth()) .setScheduleExprMonth(schedule.getMonth()) .setScheduleExprYear(schedule.getYear()) .setScheduleExprStartDate(schedule.getStart()) .setScheduleExprEndDate(schedule.getEnd())
@Override protected void readAttribute(TimerImpl timer, ModelNode toSet) { if (timer.isCanceled() || !timer.isCalendarTimer()) { return; } ScheduleExpression sched = timer.getSchedule(); addString(toSet, sched.getYear(), YEAR.getName()); addString(toSet, sched.getMonth(), MONTH.getName()); addString(toSet, sched.getDayOfMonth(), DAY_OF_MONTH.getName()); addString(toSet, sched.getDayOfWeek(), DAY_OF_WEEK.getName()); addString(toSet, sched.getHour(), HOUR.getName()); addString(toSet, sched.getMinute(), MINUTE.getName()); addString(toSet, sched.getSecond(), SECOND.getName()); addString(toSet, sched.getTimezone(), TIMEZONE.getName()); addDate(toSet, sched.getStart(), START.getName()); addDate(toSet, sched.getEnd(), END.getName()); }
private void nullCheckScheduleAttributes(ScheduleExpression schedule) { if (schedule.getSecond() == null) { throw new IllegalArgumentException("Second cannot be null in schedule expression " + schedule); } if (schedule.getMinute() == null) { throw new IllegalArgumentException("Minute cannot be null in schedule expression " + schedule); } if (schedule.getHour() == null) { throw new IllegalArgumentException("Hour cannot be null in schedule expression " + schedule); } if (schedule.getDayOfMonth() == null) { throw new IllegalArgumentException("day-of-month cannot be null in schedule expression " + schedule); } if (schedule.getDayOfWeek() == null) { throw new IllegalArgumentException("day-of-week cannot be null in schedule expression " + schedule); } if (schedule.getMonth() == null) { throw new IllegalArgumentException("Month cannot be null in schedule expression " + schedule); } if (schedule.getYear() == null) { throw new IllegalArgumentException("Year cannot be null in schedule expression " + schedule); } }
public CalendarTimerEntity(CalendarTimer calendarTimer) { super(calendarTimer); this.scheduleExpression = calendarTimer.getScheduleExpression(); this.autoTimer = calendarTimer.isAutoTimer(); if (calendarTimer.isAutoTimer()) { Method method = calendarTimer.getTimeoutMethod(); Class<?>[] methodParams = method.getParameterTypes(); String[] params = new String[methodParams.length]; for (int i = 0; i < methodParams.length; i++) { params[i] = methodParams[i].getName(); } this.timeoutMethod = new TimeoutMethod(method.getDeclaringClass().getName(), method.getName(), params); } else { this.timeoutMethod = null; } this.scheduleExprSecond = this.scheduleExpression.getSecond(); this.scheduleExprMinute = this.scheduleExpression.getMinute(); this.scheduleExprHour = this.scheduleExpression.getHour(); this.scheduleExprDayOfMonth = this.scheduleExpression.getDayOfMonth(); this.scheduleExprMonth = this.scheduleExpression.getMonth(); this.scheduleExprDayOfWeek = this.scheduleExpression.getDayOfWeek(); this.scheduleExprYear = this.scheduleExpression.getYear(); this.scheduleExprStartDate = this.scheduleExpression.getStart(); this.scheduleExprEndDate = this.scheduleExpression.getEnd(); this.scheduleExprTimezone = this.scheduleExpression.getTimezone(); }
private void nullCheckScheduleAttributes(ScheduleExpression schedule) { if (schedule.getSecond() == null) { throw MESSAGES.invalidScheduleExpressionSecond(schedule); } if (schedule.getMinute() == null) { throw MESSAGES.invalidScheduleExpressionMinute(schedule); } if (schedule.getHour() == null) { throw MESSAGES.invalidScheduleExpressionHour(schedule); } if (schedule.getDayOfMonth() == null) { throw MESSAGES.invalidScheduleExpressionDayOfMonth(schedule); } if (schedule.getDayOfWeek() == null) { throw MESSAGES.invalidScheduleExpressionDayOfWeek(schedule); } if (schedule.getMonth() == null) { throw MESSAGES.invalidScheduleExpressionMonth(schedule); } if (schedule.getYear() == null) { throw MESSAGES.invalidScheduleExpressionYear(schedule); } }
private static void addSchedule(Timer timer, ModelNode timerNode, final String componentName) { try { final ModelNode schedNode = timerNode.get(SCHEDULE); ScheduleExpression sched = timer.getSchedule(); addScheduleDetailString(schedNode, sched.getYear(), YEAR); addScheduleDetailString(schedNode, sched.getMonth(), MONTH); addScheduleDetailString(schedNode, sched.getDayOfMonth(), DAY_OF_MONTH); addScheduleDetailString(schedNode, sched.getDayOfWeek(), DAY_OF_WEEK); addScheduleDetailString(schedNode, sched.getHour(), HOUR); addScheduleDetailString(schedNode, sched.getMinute(), MINUTE); addScheduleDetailString(schedNode, sched.getSecond(), SECOND); addScheduleDetailString(schedNode, sched.getTimezone(), TIMEZONE); addScheduleDetailDate(schedNode, sched.getStart(), START); addScheduleDetailDate(schedNode, sched.getEnd(), END); } catch (IllegalStateException e) { // ignore } catch (NoSuchObjectLocalException e) { // ignore } catch (EJBException e) { logTimerFailure(componentName, e); } }
private ScheduleExpression copy(final ScheduleExpression scheduleExpression) { final ScheduleExpression scheduleExpressionCopy = new ScheduleExpression(); scheduleExpressionCopy.year(scheduleExpression.getYear()); scheduleExpressionCopy.month(scheduleExpression.getMonth()); scheduleExpressionCopy.dayOfMonth(scheduleExpression.getDayOfMonth()); scheduleExpressionCopy.dayOfWeek(scheduleExpression.getDayOfWeek()); scheduleExpressionCopy.hour(scheduleExpression.getHour()); scheduleExpressionCopy.minute(scheduleExpression.getMinute()); scheduleExpressionCopy.second(scheduleExpression.getSecond()); scheduleExpressionCopy.start(scheduleExpression.getStart()); scheduleExpressionCopy.end(scheduleExpression.getEnd()); scheduleExpressionCopy.timezone(scheduleExpression.getTimezone()); return scheduleExpressionCopy; }
private ScheduleExpression clone(ScheduleExpression schedule) { // clone the schedule ScheduleExpression clonedSchedule = new ScheduleExpression(); clonedSchedule.second(schedule.getSecond()); clonedSchedule.minute(schedule.getMinute()); clonedSchedule.hour(schedule.getHour()); clonedSchedule.dayOfWeek(schedule.getDayOfWeek()); clonedSchedule.dayOfMonth(schedule.getDayOfMonth()); clonedSchedule.month(schedule.getMonth()); clonedSchedule.year(schedule.getYear()); clonedSchedule.timezone(schedule.getTimezone()); clonedSchedule.start(schedule.getStart()); clonedSchedule.end(schedule.getEnd()); return clonedSchedule; }
private ScheduleExpression copy(final ScheduleExpression scheduleExpression) { final ScheduleExpression scheduleExpressionCopy = new ScheduleExpression(); scheduleExpressionCopy.year(scheduleExpression.getYear()); scheduleExpressionCopy.month(scheduleExpression.getMonth()); scheduleExpressionCopy.dayOfMonth(scheduleExpression.getDayOfMonth()); scheduleExpressionCopy.dayOfWeek(scheduleExpression.getDayOfWeek()); scheduleExpressionCopy.hour(scheduleExpression.getHour()); scheduleExpressionCopy.minute(scheduleExpression.getMinute()); scheduleExpressionCopy.second(scheduleExpression.getSecond()); scheduleExpressionCopy.start(scheduleExpression.getStart()); scheduleExpressionCopy.end(scheduleExpression.getEnd()); scheduleExpressionCopy.timezone(scheduleExpression.getTimezone()); return scheduleExpressionCopy; } }
private ScheduleExpression clone(ScheduleExpression schedule) { // clone the schedule ScheduleExpression clonedSchedule = new ScheduleExpression(); clonedSchedule.second(schedule.getSecond()); clonedSchedule.minute(schedule.getMinute()); clonedSchedule.hour(schedule.getHour()); clonedSchedule.dayOfWeek(schedule.getDayOfWeek()); clonedSchedule.dayOfMonth(schedule.getDayOfMonth()); clonedSchedule.month(schedule.getMonth()); clonedSchedule.year(schedule.getYear()); clonedSchedule.timezone(schedule.getTimezone()); clonedSchedule.start(schedule.getStart()); clonedSchedule.end(schedule.getEnd()); return clonedSchedule; }
/** Construct TimerSchedule instance from a given ScheduleExpression. * Need to copy all values because ScheduleExpression is mutable * and can be modified by the user. */ public TimerSchedule(ScheduleExpression se) { second(se.getSecond()); minute(se.getMinute()); hour(se.getHour()); dayOfMonth(se.getDayOfMonth()); month(se.getMonth()); dayOfWeek(se.getDayOfWeek()); year(se.getYear()); timezone(se.getTimezone()); // Create local copies start(se.getStart()); end(se.getEnd()); configure(); }
/** Construct EJBTimerSchedule instance from a given ScheduleExpression. * Need to copy all values because ScheduleExpression is mutable * and can be modified by the user. */ public EJBTimerSchedule(ScheduleExpression se) { second(se.getSecond()); minute(se.getMinute()); hour(se.getHour()); dayOfMonth(se.getDayOfMonth()); month(se.getMonth()); dayOfWeek(se.getDayOfWeek()); year(se.getYear()); timezone(se.getTimezone()); // Create local copies start(se.getStart()); end(se.getEnd()); configure(); }