org.bidib.wizard.firmwarerepo.config.FirmwareRepoConfig Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of bidibwizard-firmware-repo Show documentation
Show all versions of bidibwizard-firmware-repo Show documentation
jBiDiB BiDiB Wizard Firmware Repo POM
package org.bidib.wizard.firmwarerepo.config;
import org.bidib.wizard.common.model.settings.FirmwareRepoSettingsInterface;
import org.bidib.wizard.common.model.settings.MiscSettingsInterface;
import org.bidib.wizard.common.model.settings.WizardSettingsInterface;
import org.bidib.wizard.firmwarerepo.core.NodeFirmwareRepoService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.ApplicationEventPublisher;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.TaskScheduler;
import org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler;
@Configuration
@EnableConfigurationProperties({ FirmwareRepoSettings.class })
public class FirmwareRepoConfig {
private static final Logger LOGGER = LoggerFactory.getLogger(FirmwareRepoConfig.class);
public static final String BIDIB_DEFAULT_FIRMWARE_REPO_SUBDIR = "data/firmware-repo";
@Autowired
private FirmwareRepoSettingsInterface firmwareRepoSettings;
@Bean
NodeFirmwareRepoService nodeFirmwareRepoService(
final TaskScheduler taskScheduler, final MiscSettingsInterface miscSettings,
final WizardSettingsInterface wizardSettings, final ApplicationEventPublisher applicationEventPublisher) {
LOGGER.info("Create the NodeFirmwareRepoService.");
NodeFirmwareRepoService nodeFirmwareRepoService =
new NodeFirmwareRepoService(firmwareRepoSettings, miscSettings, wizardSettings, applicationEventPublisher,
taskScheduler);
return nodeFirmwareRepoService;
}
@Bean
@ConditionalOnMissingBean(TaskScheduler.class)
TaskScheduler threadPoolTaskScheduler() {
ThreadPoolTaskScheduler threadPoolTaskScheduler = new ThreadPoolTaskScheduler();
threadPoolTaskScheduler.setPoolSize(5);
threadPoolTaskScheduler.setThreadNamePrefix("ThreadPoolTaskScheduler");
return threadPoolTaskScheduler;
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy