use of com.liferay.portal.kernel.scheduler.SchedulerEntryImpl in project liferay-imex by jpdacunha.
the class FilesystemTriggerListener method activate.
@Modified
@Activate
protected void activate(Map<String, Object> properties) {
_log.info("Registering scheduler entry for [" + this.getClass().getSimpleName() + "] ...");
Class<?> clazz = getClass();
String className = clazz.getName();
ImexProperties imexProperties = new ImexProperties();
configurationService.loadTriggerAndCoreConfiguration(this.getClass(), imexProperties);
Properties rawProps = imexProperties.getProperties();
String cronExpression = GetterUtil.getString(rawProps.get(ImExFileSystemTriggerPropsKeys.TRIGGER_CHECK_PERIOD_CONR));
if (Validator.isNotNull(cronExpression)) {
Trigger trigger = _triggerFactory.createTrigger(className, className, new Date(), null, cronExpression);
SchedulerEntry schedulerEntry = new SchedulerEntryImpl(className, trigger);
_schedulerEngineHelper.register(this, schedulerEntry, DestinationNames.SCHEDULER_DISPATCH);
} else {
_log.error("Unable to start job : no cron expression is properly configured");
}
_log.info("Done.");
}
Aggregations