Search in sources :

Example 1 with IScheduleTarget

use of org.jboss.metadata.common.ejb.IScheduleTarget in project wildfly by wildfly.

the class TimerMethodMergingProcessor method parseScheduleMethods.

private void parseScheduleMethods(final EnterpriseBeanMetaData beanMetaData, final EJBComponentDescription sessionBean, final Class<?> componentClass, final DeploymentReflectionIndex deploymentReflectionIndex) throws DeploymentUnitProcessingException {
    if (beanMetaData instanceof IScheduleTarget) {
        IScheduleTarget md = (IScheduleTarget) beanMetaData;
        if (md.getTimers() != null) {
            for (final TimerMetaData timer : md.getTimers()) {
                AutoTimer autoTimer = new AutoTimer();
                autoTimer.getTimerConfig().setInfo(timer.getInfo());
                autoTimer.getTimerConfig().setPersistent(timer.isPersistent());
                final ScheduleExpression scheduleExpression = autoTimer.getScheduleExpression();
                final ScheduleMetaData schedule = timer.getSchedule();
                if (schedule != null) {
                    scheduleExpression.dayOfMonth(schedule.getDayOfMonth());
                    scheduleExpression.dayOfWeek(schedule.getDayOfWeek());
                    scheduleExpression.hour(schedule.getHour());
                    scheduleExpression.minute(schedule.getMinute());
                    scheduleExpression.month(schedule.getMonth());
                    scheduleExpression.second(schedule.getSecond());
                    scheduleExpression.year(schedule.getYear());
                }
                if (timer.getEnd() != null) {
                    scheduleExpression.end(timer.getEnd().getTime());
                }
                if (timer.getStart() != null) {
                    scheduleExpression.start(timer.getStart().getTime());
                }
                scheduleExpression.timezone(timer.getTimezone());
                sessionBean.addScheduleMethod(MethodResolutionUtils.resolveMethod(timer.getTimeoutMethod(), componentClass, deploymentReflectionIndex), autoTimer);
            }
        }
    }
}
Also used : AutoTimer(org.jboss.as.ejb3.timerservice.AutoTimer) ScheduleExpression(javax.ejb.ScheduleExpression) TimerMetaData(org.jboss.metadata.ejb.spec.TimerMetaData) IScheduleTarget(org.jboss.metadata.common.ejb.IScheduleTarget) ScheduleMetaData(org.jboss.metadata.ejb.spec.ScheduleMetaData)

Aggregations

ScheduleExpression (javax.ejb.ScheduleExpression)1 AutoTimer (org.jboss.as.ejb3.timerservice.AutoTimer)1 IScheduleTarget (org.jboss.metadata.common.ejb.IScheduleTarget)1 ScheduleMetaData (org.jboss.metadata.ejb.spec.ScheduleMetaData)1 TimerMetaData (org.jboss.metadata.ejb.spec.TimerMetaData)1