2014-08-08 16:49:02 +02:00
|
|
|
package com.commafeed;
|
|
|
|
|
|
2023-05-01 11:20:44 +02:00
|
|
|
import com.commafeed.backend.feed.FeedRefreshEngine;
|
2024-02-04 08:38:11 +01:00
|
|
|
import com.commafeed.backend.service.db.DatabaseStartupService;
|
2024-08-07 08:10:14 +02:00
|
|
|
import com.commafeed.backend.task.TaskScheduler;
|
|
|
|
|
import com.commafeed.security.password.PasswordConstraintValidator;
|
2015-07-09 16:03:38 +02:00
|
|
|
|
2024-08-07 08:10:14 +02:00
|
|
|
import io.quarkus.runtime.ShutdownEvent;
|
|
|
|
|
import io.quarkus.runtime.StartupEvent;
|
|
|
|
|
import jakarta.enterprise.event.Observes;
|
|
|
|
|
import jakarta.inject.Singleton;
|
|
|
|
|
import lombok.RequiredArgsConstructor;
|
2014-08-08 16:49:02 +02:00
|
|
|
|
2024-08-07 08:10:14 +02:00
|
|
|
@Singleton
|
|
|
|
|
@RequiredArgsConstructor
|
|
|
|
|
public class CommaFeedApplication {
|
2014-08-08 16:49:02 +02:00
|
|
|
|
|
|
|
|
public static final String USERNAME_ADMIN = "admin";
|
|
|
|
|
public static final String USERNAME_DEMO = "demo";
|
|
|
|
|
|
2024-08-07 08:10:14 +02:00
|
|
|
private final DatabaseStartupService databaseStartupService;
|
|
|
|
|
private final FeedRefreshEngine feedRefreshEngine;
|
|
|
|
|
private final TaskScheduler taskScheduler;
|
|
|
|
|
private final CommaFeedConfiguration config;
|
2015-03-19 11:13:34 +01:00
|
|
|
|
2024-08-07 08:10:14 +02:00
|
|
|
public void start(@Observes StartupEvent ev) {
|
|
|
|
|
PasswordConstraintValidator.setStrict(config.users().strictPasswordPolicy());
|
2014-08-08 16:49:02 +02:00
|
|
|
|
2024-08-07 08:10:14 +02:00
|
|
|
databaseStartupService.populateInitialData();
|
2022-11-15 10:48:51 +01:00
|
|
|
|
2024-08-07 08:10:14 +02:00
|
|
|
feedRefreshEngine.start();
|
|
|
|
|
taskScheduler.start();
|
2014-08-08 16:49:02 +02:00
|
|
|
}
|
|
|
|
|
|
2024-08-07 08:10:14 +02:00
|
|
|
public void stop(@Observes ShutdownEvent ev) {
|
|
|
|
|
feedRefreshEngine.stop();
|
|
|
|
|
taskScheduler.stop();
|
2024-01-08 20:42:45 +01:00
|
|
|
}
|
|
|
|
|
|
2014-08-08 16:49:02 +02:00
|
|
|
}
|