
package de.ivu.elect.business.system.control.files;

import javax.annotation.PostConstruct;
import javax.ejb.DependsOn;
import javax.ejb.Singleton;
import javax.ejb.Startup;
import javax.inject.Inject;

import de.ivu.elect.business.konfiguration.entity.ElectKonfigurationWerte;
import de.ivu.elect.business.system.control.AbstractElectCronTimer;

/**
 *  on 17.11.2015.
 */
@Startup
@DependsOn("StartupSingleton")
@Singleton
public class FileCleanupCronTimer extends AbstractElectCronTimer {

  @Inject
  private transient FileCleanupEvent event;

  @Inject
  private transient FileCleanupBackgroundService  fileCleanupBackgroundService;

  public FileCleanupCronTimer() {
    super();
  }

  @PostConstruct
  public void init(){
    fileCleanupBackgroundService.getSystemLogQuelle(); // ELECTMUC-2701
  }

  @Override
  protected ElectKonfigurationWerte getElectKonfigurationWerte() {
    return ElectKonfigurationWerte.ELECT_COMMON_DATEI_CLEANUP_CRON_TIMER;
  }

  @Override
  public String getJobName() {
    return "FileCleanupCronTimer";
  }

  @Override
  protected void timeout() {
    event.sendChangeEvent();
  }
}
