All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.camunda.operate.webapp.backup.BackupComponent Maven / Gradle / Ivy

There is a newer version: 8.7.0-alpha2-rc1
Show newest version
/*
 * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH under
 * one or more contributor license agreements. See the NOTICE file distributed
 * with this work for additional information regarding copyright ownership.
 * Licensed under the Camunda License 1.0. You may not use this file
 * except in compliance with the Camunda License 1.0.
 */
package io.camunda.operate.webapp.backup;

import io.camunda.webapps.backup.BackupRepository;
import io.camunda.webapps.backup.BackupService;
import io.camunda.webapps.backup.BackupServiceImpl;
import io.camunda.webapps.backup.repository.BackupRepositoryProps;
import io.camunda.webapps.schema.descriptors.backup.Prio1Backup;
import io.camunda.webapps.schema.descriptors.backup.Prio2Backup;
import io.camunda.webapps.schema.descriptors.backup.Prio3Backup;
import io.camunda.webapps.schema.descriptors.backup.Prio4Backup;
import java.util.List;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
import org.springframework.stereotype.Component;

@Component
@Configuration
public class BackupComponent {

  private final ThreadPoolTaskExecutor threadPoolTaskExecutor;
  private final List prio1BackupIndices;
  private final List prio2BackupTemplates;
  private final List prio3BackupTemplates;
  private final List prio4BackupIndices;
  private final BackupRepositoryProps backupRepositoryProps;
  private final BackupRepository backupRepository;

  public BackupComponent(
      @Qualifier("backupThreadPoolExecutor") final ThreadPoolTaskExecutor threadPoolTaskExecutor,
      final List prio1BackupIndices,
      final List prio2BackupTemplates,
      final List prio3BackupTemplates,
      final List prio4BackupIndices,
      final BackupRepositoryProps backupRepositoryProps,
      final BackupRepository backupRepository) {
    this.threadPoolTaskExecutor = threadPoolTaskExecutor;
    this.prio1BackupIndices = prio1BackupIndices;
    this.prio2BackupTemplates = prio2BackupTemplates;
    this.prio3BackupTemplates = prio3BackupTemplates;
    this.prio4BackupIndices = prio4BackupIndices;
    this.backupRepositoryProps = backupRepositoryProps;
    if ((backupRepository instanceof BackupRepositoryWrapper)) {
      this.backupRepository = backupRepository;
    } else {
      this.backupRepository = new BackupRepositoryWrapper(backupRepository);
    }
  }

  @Bean
  public BackupService backupService() {
    return new BackupServiceImpl(
        threadPoolTaskExecutor,
        prio1BackupIndices,
        prio2BackupTemplates,
        prio3BackupTemplates,
        prio4BackupIndices,
        backupRepositoryProps,
        backupRepository);
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy