Search in sources :

Example 16 with TimerConfig

use of javax.ejb.TimerConfig in project tomee by apache.

the class MethodScheduleBuilder method addSchedulesToMethod.

private void addSchedulesToMethod(final MethodContext methodContext, final MethodScheduleInfo info) {
    if (methodContext == null) {
        return;
    }
    for (final ScheduleInfo scheduleInfo : info.schedules) {
        final ScheduleExpression expr = new ScheduleExpression();
        expr.second(scheduleInfo.second == null ? "0" : scheduleInfo.second);
        expr.minute(scheduleInfo.minute == null ? "0" : scheduleInfo.minute);
        expr.hour(scheduleInfo.hour == null ? "0" : scheduleInfo.hour);
        expr.dayOfWeek(scheduleInfo.dayOfWeek == null ? "*" : scheduleInfo.dayOfWeek);
        expr.dayOfMonth(scheduleInfo.dayOfMonth == null ? "*" : scheduleInfo.dayOfMonth);
        expr.month(scheduleInfo.month == null ? "*" : scheduleInfo.month);
        expr.year(scheduleInfo.year == null ? "*" : scheduleInfo.year);
        expr.timezone(scheduleInfo.timezone);
        expr.start(scheduleInfo.start);
        expr.end(scheduleInfo.end);
        final TimerConfig config = new TimerConfig();
        config.setInfo(scheduleInfo.info);
        config.setPersistent(scheduleInfo.persistent);
        methodContext.getSchedules().add(new ScheduleData(config, expr));
    }
}
Also used : ScheduleExpression(javax.ejb.ScheduleExpression) ScheduleData(org.apache.openejb.core.timer.ScheduleData) TimerConfig(javax.ejb.TimerConfig)

Aggregations

TimerConfig (javax.ejb.TimerConfig)16 Test (org.junit.Test)7 Date (java.util.Date)6 InitialContext (javax.naming.InitialContext)6 ScheduleExpression (javax.ejb.ScheduleExpression)4 Timer (javax.ejb.Timer)4 ModelNode (org.jboss.dmr.ModelNode)3 InSequence (org.jboss.arquillian.junit.InSequence)2 IOException (java.io.IOException)1 CountDownLatch (java.util.concurrent.CountDownLatch)1 PostConstruct (javax.annotation.PostConstruct)1 NoMoreTimeoutsException (javax.ejb.NoMoreTimeoutsException)1 NoSuchObjectLocalException (javax.ejb.NoSuchObjectLocalException)1 NamingException (javax.naming.NamingException)1 ScheduleData (org.apache.openejb.core.timer.ScheduleData)1