<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
</dependency>
+ <dependency>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-starter-validation</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-configuration-processor</artifactId>
+ <optional>true</optional>
+ </dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
import org.springframework.boot.autoconfigure.data.cassandra.CassandraDataAutoConfiguration;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
import org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration;
+import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.EnableAspectJAutoProxy;
import org.springframework.core.env.Environment;
@EnableAsync
@EnableScheduling
@EnableAspectJAutoProxy
+@EnableConfigurationProperties
@EnableAutoConfiguration(exclude = {
DataSourceAutoConfiguration.class,
HibernateJpaAutoConfiguration.class,
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
+import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
import org.springframework.security.core.userdetails.User;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.provisioning.InMemoryUserDetailsManager;
import org.springframework.security.web.SecurityFilterChain;
-import org.springframework.util.AntPathMatcher;
@Configuration
+@EnableWebSecurity
@ConditionalOnProperty(name = "aai.basic-auth.enabled", havingValue = "true", matchIfMissing = true)
public class SecurityConfig {
try {
ctx.scan(
- "org.onap.aai.config",
- "org.onap.aai.setup",
- "org.onap.aai.introspection"
+ "org.onap.aai"
);
ctx.refresh();
AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext();
try {
ctx.scan(
- "org.onap.aai.config",
- "org.onap.aai.setup",
- "org.onap.aai.introspection"
+ "org.onap.aai"
);
ctx.refresh();
} catch (Exception e) {
AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext();
try {
ctx.scan(
- "org.onap.aai.config",
- "org.onap.aai.introspection"
+ "org.onap.aai"
);
ctx.refresh();
AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext();
try {
ctx.scan(
- "org.onap.aai.config",
- "org.onap.aai.setup",
- "org.onap.aai.introspection"
+ "org.onap.aai"
);
ctx.refresh();
} catch (Exception e) {
AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext();
try {
ctx.scan(
- "org.onap.aai.config",
- "org.onap.aai.setup",
- "org.onap.aai.introspection"
+ "org.onap.aai"
);
ctx.refresh();
} catch (Exception e) {
AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext();
try {
ctx.scan(
- "org.onap.aai.config",
- "org.onap.aai.setup",
- "org.onap.aai.introspection"
+ "org.onap.aai"
);
ctx.refresh();
} catch (Exception e) {
AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext();
try {
ctx.scan(
- "org.onap.aai.config",
- "org.onap.aai.setup",
- "org.onap.aai.introspection"
+ "org.onap.aai"
);
ctx.refresh();
} catch (Exception e) {
import org.onap.aai.util.AAIConfig;
import org.onap.logging.filter.base.ONAPComponents;
import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.PropertySource;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
+
+import lombok.extern.slf4j.Slf4j;
+
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+@Slf4j
@Component
@PropertySource("file:${server.local.startpath}/etc/appprops/datatoolscrons.properties")
public class HistoryTruncateTasks {
- @Autowired
- private AaiScheduledTaskAuditLog auditLog;
-
private static final Logger LOGGER = LoggerFactory.getLogger(HistoryTruncateTasks.class);
private final SimpleDateFormat dateFormat = new SimpleDateFormat("HH:mm:ss");
+ @Autowired
+ private AaiScheduledTaskAuditLog auditLog;
+
+ @Value("#{new Boolean('${historytruncatetasks.enabled:true}')}")
+ private Boolean historyTruncateTaskEnabled;
+
@Scheduled(cron = "${historytruncatetasks.cron}" )
public void historyTruncateScheduleTask() throws AAIException, Exception {
+ if(historyTruncateTaskEnabled != null && !historyTruncateTaskEnabled) {
+ log.info("Skipping the scheduled history truncate task since historytruncatetasks.enabled=false");
+ return;
+ }
+
if(!"true".equals(AAIConfig.get("aai.disable.check.historytruncate.running", "false"))){
if(checkIfHistoryTruncateIsRunning()){
LOGGER.debug("History Truncate is already running on the system");
AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext();
try {
ctx.scan(
- "org.onap.aai.config",
- "org.onap.aai.setup",
- "org.onap.aai.introspection"
+ "org.onap.aai"
);
ctx.refresh();
} catch (Exception e) {
AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext();
try {
ctx.scan(
- "org.onap.aai.config",
- "org.onap.aai.setup",
- "org.onap.aai.introspection");
+ "org.onap.aai");
ctx.refresh();
} catch (Exception e) {
AAIException aai = ExceptionTranslator.schemaServiceExceptionTranslator(e);
AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext();
try {
ctx.scan(
- "org.onap.aai.config",
- "org.onap.aai.setup",
- "org.onap.aai.introspection"
+ "org.onap.aai"
);
ctx.refresh();
} catch (Exception e) {
AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext();
try {
ctx.scan(
- "org.onap.aai.config",
- "org.onap.aai.setup",
- "org.onap.aai.introspection"
+ "org.onap.aai"
);
ctx.refresh();
} catch (Exception e) {
AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext();
try {
ctx.scan(
- "org.onap.aai.config",
- "org.onap.aai.setup",
- "org.onap.aai.introspection"
+ "org.onap.aai"
);
ctx.refresh();
} catch (Exception e) {
datasnapshotcleanup.cron=0 17 0 * * ?
datasnapshottasks.enabled=${DATA_SNAPSHOT_TASKS_ENABLED:true}
datasnapshottasks.cron=0 45 * * * ?
+
+historytruncatetasks.enabled=${HISTORY_TRUNCATE_TASK_ENABLED:true}
+historytruncatetasks.cron=0 45 * * * ?