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

import javax.ejb.DependsOn;
import javax.ejb.EJB;
import javax.ejb.Singleton;
import javax.ejb.Startup;
import javax.inject.Inject;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import de.ivu.elect.business.konfiguration.entity.ElectKonfigurationWerte;

@Startup
@Singleton
@DependsOn("StartupSingleton")
public class SystemInfoElectCronTimer extends AbstractElectCronTimer {

  private static final Logger LOG = LoggerFactory.getLogger(SystemInfoElectCronTimer.class);

  @EJB
  private transient SystemStatusCheckPostStartupAsync systemStatusCheckPostStartupAsync;

  @Inject
  private transient SystemInfoPostStartup systemInfoPostStartup;

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

  @Override
  protected void timeout() {
    LOG.info("******** Systeminformation ************");
    systemInfoPostStartup.postStartup();
    systemStatusCheckPostStartupAsync.postStartupAsync();
    LOG.info("******** Systeminformation ************");
  }

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