use of org.apache.openejb.quartz.Job in project tomee by apache.
the class QuartzResourceAdapter method endpointActivation.
@Override
public void endpointActivation(final MessageEndpointFactory messageEndpointFactory, final ActivationSpec activationSpec) throws ResourceException {
final Scheduler s = scheduler.get();
if (null == s) {
throw new ResourceException("Quartz Scheduler is not available");
}
try {
final JobSpec spec = (JobSpec) activationSpec;
final MessageEndpoint endpoint = messageEndpointFactory.createEndpoint(null);
spec.setEndpoint(endpoint);
final Job job = (Job) endpoint;
final JobDataMap jobDataMap = spec.getDetail().getJobDataMap();
jobDataMap.put(Data.class.getName(), new Data(job));
s.scheduleJob(spec.getDetail(), spec.getTrigger());
} catch (final SchedulerException e) {
throw new ResourceException("Failed to schedule job", e);
}
}
Aggregations