From 355e3056b48886dff345274d58b4069d65ab32f6 Mon Sep 17 00:00:00 2001 From: Zhiguo Wu Date: Fri, 14 Jun 2024 18:14:27 +0800 Subject: [PATCH] BIGTOP-4127: Introduce spotless for code style check (#11) --- .github/workflows/ci.yml | 13 ++ .licenserc.yaml | 1 - bigtop-manager-agent/pom.xml | 5 +- .../manager/agent/AgentApplication.java | 18 ++- .../agent/enums/AgentExceptionStatus.java | 1 - .../CacheDistributeCommandExecutor.java | 30 ++-- .../agent/executor/CommandExecutors.java | 11 +- .../executor/ComponentCommandExecutor.java | 4 +- .../executor/HostCheckCommandExecutor.java | 6 +- .../agent/holder/SpringContextHolder.java | 7 +- .../agent/metrics/MetricsCollector.java | 25 ++-- .../agent/monitoring/AgentHostMonitoring.java | 132 +++++++++++------- .../ZookeeperHealthyMonitoring.java | 23 +-- .../scheduler/DefaultCommandScheduler.java | 6 +- .../agent/ws/AgentWebSocketHandler.java | 68 +++++---- .../manager/agent/AgentApplicationTests.java | 8 +- bigtop-manager-bom/pom.xml | 4 +- bigtop-manager-common/pom.xml | 4 +- .../manager/common/config/MessageConfig.java | 10 +- .../manager/common/constants/Constants.java | 8 +- .../common/constants/MessageConstants.java | 1 - .../bigtop/manager/common/enums/Command.java | 1 - .../bigtop/manager/common/enums/JobState.java | 1 - .../manager/common/enums/MaintainState.java | 2 - .../manager/common/enums/OSArchType.java | 2 - .../bigtop/manager/common/enums/OSType.java | 2 - .../common/message/entity/BaseMessage.java | 6 +- .../message/entity/BaseRequestMessage.java | 3 +- .../message/entity/BaseResponseMessage.java | 3 +- .../entity/command/CommandLogMessage.java | 7 +- .../entity/command/CommandMessageType.java | 1 - .../entity/payload/CacheMessagePayload.java | 9 +- .../entity/payload/CommandPayload.java | 4 +- .../entity/payload/HostCheckPayload.java | 4 +- .../message/entity/pojo/ClusterInfo.java | 4 +- .../message/entity/pojo/ComponentInfo.java | 1 - .../common/message/entity/pojo/HostInfo.java | 4 +- .../message/entity/pojo/OSSpecificInfo.java | 4 +- .../common/message/entity/pojo/RepoInfo.java | 1 - .../serializer/KryoMessageSerializer.java | 8 +- .../message/serializer/KryoPoolHolder.java | 14 +- .../common/shell/ProcessContainer.java | 4 +- .../manager/common/shell/ShellExecutor.java | 68 ++++----- .../manager/common/shell/ShellResult.java | 4 +- .../manager/common/utils/CaseUtils.java | 3 +- .../manager/common/utils/DateUtils.java | 1 - .../manager/common/utils/FileUtils.java | 9 +- .../manager/common/utils/JsonUtils.java | 15 +- .../bigtop/manager/common/utils/NetUtils.java | 1 - .../manager/common/utils/YamlUtils.java | 12 +- .../manager/common/utils/os/OSDetection.java | 5 +- .../ws/AbstractBinaryWebSocketHandler.java | 9 +- bigtop-manager-dao/pom.xml | 4 +- .../bigtop/manager/dao/entity/AuditLog.java | 13 +- .../bigtop/manager/dao/entity/BaseEntity.java | 12 +- .../bigtop/manager/dao/entity/Cluster.java | 23 ++- .../bigtop/manager/dao/entity/CommandLog.java | 23 +-- .../bigtop/manager/dao/entity/Component.java | 27 ++-- .../bigtop/manager/dao/entity/Host.java | 18 ++- .../manager/dao/entity/HostComponent.java | 21 ++- .../apache/bigtop/manager/dao/entity/Job.java | 13 +- .../bigtop/manager/dao/entity/Repo.java | 17 ++- .../bigtop/manager/dao/entity/Service.java | 23 ++- .../manager/dao/entity/ServiceConfig.java | 24 ++-- .../bigtop/manager/dao/entity/Setting.java | 12 +- .../bigtop/manager/dao/entity/Stack.java | 16 ++- .../bigtop/manager/dao/entity/Stage.java | 17 ++- .../bigtop/manager/dao/entity/Task.java | 17 ++- .../bigtop/manager/dao/entity/TypeConfig.java | 12 +- .../bigtop/manager/dao/entity/User.java | 7 +- .../dao/repository/AuditLogRepository.java | 3 +- .../dao/repository/ClusterRepository.java | 5 +- .../dao/repository/ComponentRepository.java | 4 +- .../repository/HostComponentRepository.java | 13 +- .../dao/repository/HostRepository.java | 7 +- .../manager/dao/repository/JobRepository.java | 4 +- .../dao/repository/RepoRepository.java | 4 +- .../repository/ServiceConfigRepository.java | 4 +- .../dao/repository/ServiceRepository.java | 5 +- .../dao/repository/SettingRepository.java | 4 +- .../dao/repository/StageRepository.java | 4 +- .../dao/repository/TaskRepository.java | 5 +- .../dao/repository/TypeConfigRepository.java | 4 +- bigtop-manager-server/pom.xml | 4 +- .../manager/server/ServerApplication.java | 1 - .../manager/server/annotations/Audit.java | 3 +- .../manager/server/aop/AuditAspect.java | 7 +- .../job/factory/AbstractJobFactory.java | 3 +- .../command/job/factory/JobFactories.java | 15 +- .../cluster/AbstractClusterJobFactory.java | 4 +- .../AbstractComponentJobFactory.java | 4 +- .../component/ComponentInstallJobFactory.java | 4 +- .../component/ComponentRestartJobFactory.java | 4 +- .../component/ComponentStartJobFactory.java | 4 +- .../component/ComponentStopJobFactory.java | 4 +- .../factory/host/AbstractHostJobFactory.java | 4 +- .../service/AbstractServiceJobFactory.java | 25 ++-- .../service/ServiceInstallJobFactory.java | 10 +- .../command/job/runner/AbstractJobRunner.java | 3 +- .../server/command/job/runner/JobRunners.java | 15 +- .../cluster/ClusterCreateJobRunner.java | 7 +- .../job/runner/host/HostAddJobRunner.java | 10 +- .../service/ServiceInstallJobRunner.java | 19 +-- .../job/validator/ClusterCreateValidator.java | 7 +- .../job/validator/ClusterHostValidator.java | 11 +- .../job/validator/HostAddValidator.java | 11 +- .../validator/RequiredServicesValidator.java | 12 +- .../job/validator/ServiceHostValidator.java | 8 +- .../command/job/validator/StackValidator.java | 6 +- .../scheduler/DefaultJobScheduler.java | 11 +- .../command/stage/factory/StageContext.java | 7 +- .../command/stage/factory/StageFactories.java | 11 +- .../command/stage/factory/StageType.java | 1 - .../AbstractComponentStageFactory.java | 19 +-- .../config/CacheDistributeStageFactory.java | 14 +- .../factory/host/HostCheckStageFactory.java | 9 +- .../service/ServiceConfigureStageFactory.java | 3 +- .../stage/runner/AbstractStageRunner.java | 26 ++-- .../command/stage/runner/StageRunners.java | 11 +- .../ComponentInstallStageRunner.java | 9 +- .../component/ComponentStartStageRunner.java | 9 +- .../component/ComponentStopStageRunner.java | 9 +- .../config/CacheDistributeStageRunner.java | 40 +++--- .../server/config/AsyncThreadPoolConfig.java | 9 +- .../config/CommandGroupSequenceProvider.java | 20 +-- .../server/config/EclipseLinkConfig.java | 11 +- .../server/config/FrontendRedirector.java | 6 +- .../manager/server/config/JpaAuditConfig.java | 8 +- .../manager/server/config/LocaleConfig.java | 4 +- .../manager/server/config/OpenAPIConfig.java | 1 - .../server/config/ValidatorConfig.java | 6 +- .../manager/server/config/WebConfig.java | 4 +- .../server/config/WebSocketConfig.java | 8 +- .../server/controller/ClusterController.java | 11 +- .../server/controller/CommandController.java | 5 +- .../controller/ComponentController.java | 8 +- .../server/controller/ConfigController.java | 7 +- .../controller/HostComponentController.java | 12 +- .../server/controller/HostController.java | 11 +- .../server/controller/JobController.java | 29 ++-- .../server/controller/LoginController.java | 4 +- .../controller/MonitoringController.java | 6 +- .../server/controller/ServiceController.java | 8 +- .../server/controller/SseController.java | 30 ++-- .../server/controller/StackController.java | 15 +- .../server/controller/UserController.java | 4 +- .../server/enums/ApiExceptionEnum.java | 1 - .../manager/server/enums/JobStrategyType.java | 1 - .../manager/server/enums/LocaleKeys.java | 1 - .../manager/server/enums/ResponseStatus.java | 2 - .../server/enums/heartbeat/HostState.java | 1 - .../exception/GlobalExceptionHandler.java | 4 +- .../server/exception/ServerException.java | 1 - .../server/holder/SpringContextHolder.java | 7 +- .../server/interceptor/AuthInterceptor.java | 19 +-- .../manager/server/model/dto/ClusterDTO.java | 5 +- .../manager/server/model/dto/CommandDTO.java | 9 +- .../server/model/dto/ComponentDTO.java | 4 +- .../server/model/dto/ComponentHostDTO.java | 7 +- .../server/model/dto/OSSpecificDTO.java | 4 +- .../manager/server/model/dto/PropertyDTO.java | 5 +- .../manager/server/model/dto/RepoDTO.java | 1 - .../server/model/dto/ServiceConfigDTO.java | 4 +- .../manager/server/model/dto/ServiceDTO.java | 4 +- .../manager/server/model/dto/StackDTO.java | 4 +- .../server/model/dto/TypeConfigDTO.java | 5 +- .../model/dto/command/ClusterCommandDTO.java | 5 +- .../dto/command/ComponentCommandDTO.java | 5 +- .../model/dto/command/HostCommandDTO.java | 4 +- .../model/dto/command/ServiceCommandDTO.java | 4 +- .../server/model/mapper/CommandMapper.java | 5 +- .../server/model/mapper/ComponentMapper.java | 5 +- .../model/mapper/HostComponentMapper.java | 3 +- .../server/model/mapper/HostMapper.java | 5 +- .../server/model/mapper/JobMapper.java | 4 +- .../server/model/mapper/PropertyMapper.java | 4 +- .../server/model/mapper/RepoMapper.java | 5 +- .../model/mapper/ServiceConfigMapper.java | 4 +- .../server/model/mapper/ServiceMapper.java | 5 +- .../server/model/mapper/StackMapper.java | 1 - .../server/model/mapper/TypeConfigMapper.java | 4 +- .../server/model/mapper/TypeConvert.java | 13 +- .../manager/server/model/req/ClusterReq.java | 10 +- .../manager/server/model/req/CommandReq.java | 27 ++-- .../server/model/req/ComponentHostReq.java | 10 +- .../manager/server/model/req/HostReq.java | 9 +- .../manager/server/model/req/PropertyReq.java | 5 +- .../manager/server/model/req/RepoReq.java | 1 - .../server/model/req/ServiceConfigReq.java | 7 +- .../server/model/req/TypeConfigReq.java | 8 +- .../manager/server/model/req/UserReq.java | 1 - .../model/req/command/ClusterCommandReq.java | 10 +- .../req/command/ComponentCommandReq.java | 7 +- .../model/req/command/HostCommandReq.java | 4 +- .../model/req/command/ServiceCommandReq.java | 10 +- .../manager/server/model/vo/ComponentVO.java | 1 - .../bigtop/manager/server/model/vo/JobVO.java | 5 +- .../manager/server/model/vo/PageVO.java | 8 +- .../manager/server/model/vo/PropertyVO.java | 1 - .../manager/server/model/vo/RepoVO.java | 1 - .../server/model/vo/ServiceComponentVO.java | 4 +- .../server/model/vo/ServiceConfigVO.java | 5 +- .../manager/server/model/vo/ServiceVO.java | 4 +- .../server/model/vo/StackConfigVO.java | 4 +- .../manager/server/model/vo/StackVO.java | 4 +- .../manager/server/model/vo/StageVO.java | 4 +- .../manager/server/model/vo/TaskVO.java | 1 - .../manager/server/model/vo/TypeConfigVO.java | 5 +- .../manager/server/proxy/PrometheusProxy.java | 33 +++-- .../scheduled/HostHeartbeatScheduled.java | 13 +- .../server/service/ClusterService.java | 1 - .../server/service/ComponentService.java | 1 - .../service/impl/ClusterServiceImpl.java | 12 +- .../service/impl/CommandLogServiceImpl.java | 5 +- .../service/impl/CommandServiceImpl.java | 4 +- .../service/impl/ComponentServiceImpl.java | 13 +- .../service/impl/ConfigServiceImpl.java | 24 ++-- .../impl/HostComponentServiceImpl.java | 7 +- .../server/service/impl/HostServiceImpl.java | 12 +- .../server/service/impl/JobServiceImpl.java | 4 +- .../server/service/impl/LoginServiceImpl.java | 4 +- .../service/impl/MonitoringServiceImpl.java | 5 +- .../service/impl/ServiceServiceImpl.java | 19 ++- .../server/service/impl/StackServiceImpl.java | 8 +- .../server/service/impl/UserServiceImpl.java | 4 +- .../server/stack/StackInitializer.java | 11 +- .../stack/dag/ComponentCommandWrapper.java | 10 +- .../bigtop/manager/server/stack/dag/DAG.java | 9 +- .../server/stack/pojo/ComponentModel.java | 5 +- .../server/stack/pojo/CustomCommandModel.java | 4 +- .../server/stack/pojo/OSSpecificModel.java | 5 +- .../server/stack/pojo/PropertyModel.java | 5 +- .../server/stack/pojo/QuickLinkModel.java | 3 +- .../manager/server/stack/pojo/RepoModel.java | 9 +- .../server/stack/pojo/ScriptModel.java | 4 +- .../server/stack/pojo/ServiceModel.java | 5 +- .../manager/server/stack/pojo/StackModel.java | 5 +- .../server/stack/xml/ConfigurationXml.java | 5 +- .../server/stack/xml/ServiceMetainfoXml.java | 4 +- .../server/stack/xml/StackMetainfoXml.java | 4 +- .../bigtop/manager/server/utils/JWTUtils.java | 6 +- .../manager/server/utils/JaxbUtils.java | 3 +- .../manager/server/utils/ResponseEntity.java | 3 +- .../manager/server/utils/ServletUtils.java | 4 +- .../manager/server/utils/StackUtils.java | 88 +++++------- .../server/ws/ServerWebSocketHandler.java | 11 +- .../server/ServerApplicationTests.java | 12 +- bigtop-manager-spi/pom.xml | 4 +- .../manager/spi/plugin/PrioritySPI.java | 1 - .../spi/plugin/PrioritySPIFactory.java | 9 +- .../manager/spi/stack/PackageManager.java | 1 - .../bigtop/manager/spi/stack/Script.java | 3 +- .../bigtop-manager-stack-bigtop/pom.xml | 4 +- .../bigtop/v3_3_0/hdfs/DataNodeScript.java | 6 +- .../bigtop/v3_3_0/hdfs/HdfsClientScript.java | 2 - .../stack/bigtop/v3_3_0/hdfs/HdfsParams.java | 11 +- .../stack/bigtop/v3_3_0/hdfs/HdfsSetup.java | 119 ++++++++++------ .../bigtop/v3_3_0/hdfs/NameNodeScript.java | 6 +- .../bigtop/v3_3_0/hdfs/SNameNodeScript.java | 6 +- .../v3_3_0/kafka/KafkaBrokerScript.java | 38 +++-- .../bigtop/v3_3_0/kafka/KafkaParams.java | 5 +- .../zookeeper/ZookeeperClientScript.java | 2 - .../v3_3_0/zookeeper/ZookeeperParams.java | 4 +- .../zookeeper/ZookeeperServerScript.java | 8 +- .../v3_3_0/zookeeper/ZookeeperSetup.java | 56 +++++--- .../bigtop-manager-stack-common/pom.xml | 4 +- .../common/annotations/GlobalParams.java | 4 +- .../stack/common/enums/ConfigType.java | 8 +- .../common/enums/PackageManagerType.java | 15 +- .../common/exception/StackException.java | 1 - .../stack/common/repo/AptPackageManager.java | 5 +- .../stack/common/repo/DnfPackageManager.java | 5 +- .../stack/common/repo/YumPackageManager.java | 5 +- .../stack/common/utils/BaseParams.java | 13 +- .../stack/common/utils/LocalSettings.java | 64 ++++----- .../stack/common/utils/PackageUtils.java | 1 - .../stack/common/utils/PropertiesUtils.java | 14 +- .../manager/stack/common/utils/XmlUtils.java | 5 +- .../common/utils/linux/LinuxAccountUtils.java | 29 ++-- .../common/utils/linux/LinuxFileUtils.java | 53 ++++--- .../common/utils/linux/LinuxOSUtils.java | 15 +- .../common/utils/template/BaseTemplate.java | 5 +- .../common/utils/template/TemplateUtils.java | 4 +- .../bigtop-manager-stack-core/pom.xml | 4 +- .../stack/core/executor/StackExecutor.java | 7 +- .../manager/stack/core/hook/AbstractHook.java | 3 +- .../manager/stack/core/hook/InstallHook.java | 15 +- .../manager/stack/core/hook/RestartHook.java | 7 +- .../manager/stack/core/hook/StartHook.java | 7 +- .../manager/stack/core/hook/StopHook.java | 7 +- .../bigtop-manager-stack-nop/pom.xml | 4 +- .../nop/v1_0_0/kafka/KafkaBrokerScript.java | 4 +- .../zookeeper/ZookeeperClientScript.java | 4 +- .../zookeeper/ZookeeperServerScript.java | 4 +- bigtop-manager-stack/pom.xml | 4 +- bigtop-manager-ui/pom.xml | 6 +- pom.xml | 43 +++++- style/license-header | 16 --- 298 files changed, 1488 insertions(+), 1460 deletions(-) delete mode 100644 style/license-header diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 09d3a7a2..4f6357b9 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -10,6 +10,19 @@ jobs: - name: Check license header uses: apache/skywalking-eyes@v0.6.0 + code-style: + name: "Check code style" + runs-on: ubuntu-latest + timeout-minutes: 10 + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-java@v4 + with: + distribution: 'temurin' + java-version: '17' + cache: 'maven' + - run: ./mvnw clean spotless:check + build: runs-on: ubuntu-latest strategy: diff --git a/.licenserc.yaml b/.licenserc.yaml index 0aeb0fbc..8d13be57 100644 --- a/.licenserc.yaml +++ b/.licenserc.yaml @@ -26,7 +26,6 @@ header: - '**/target/**' - '**/*.ftl' - '**/*.log' - - '**/codestyle/*' - '.git/' - '.github/**' - '**/.gitignore' diff --git a/bigtop-manager-agent/pom.xml b/bigtop-manager-agent/pom.xml index 1e9735ae..eb1bae1a 100644 --- a/bigtop-manager-agent/pom.xml +++ b/bigtop-manager-agent/pom.xml @@ -17,9 +17,7 @@ ~ specific language governing permissions and limitations ~ under the License. --> - - + 4.0.0 org.apache.bigtop @@ -48,6 +46,7 @@ org.apache.bigtop bigtop-manager-common + ${revision} diff --git a/bigtop-manager-agent/src/main/java/org/apache/bigtop/manager/agent/AgentApplication.java b/bigtop-manager-agent/src/main/java/org/apache/bigtop/manager/agent/AgentApplication.java index b20e3840..cf3c29f1 100644 --- a/bigtop-manager-agent/src/main/java/org/apache/bigtop/manager/agent/AgentApplication.java +++ b/bigtop-manager-agent/src/main/java/org/apache/bigtop/manager/agent/AgentApplication.java @@ -18,15 +18,17 @@ */ package org.apache.bigtop.manager.agent; -import io.micrometer.core.instrument.MeterRegistry; -import io.micrometer.core.instrument.MultiGauge; import org.apache.bigtop.manager.agent.monitoring.AgentHostMonitoring; import org.apache.bigtop.manager.agent.monitoring.ZookeeperHealthyMonitoring; + import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.context.annotation.Bean; +import io.micrometer.core.instrument.MeterRegistry; +import io.micrometer.core.instrument.MultiGauge; + @SpringBootApplication(scanBasePackages = {"org.apache.bigtop.manager.agent", "org.apache.bigtop.manager.common"}) public class AgentApplication { @@ -34,27 +36,23 @@ public static void main(String[] args) { SpringApplication.run(AgentApplication.class, args); } - @Qualifier("diskMultiGauge") @Bean - public MultiGauge diskMultiGauge(MeterRegistry meterRegistry) { + @Qualifier("diskMultiGauge") public MultiGauge diskMultiGauge(MeterRegistry meterRegistry) { return AgentHostMonitoring.newDiskMultiGauge(meterRegistry); } - @Qualifier("cpuMultiGauge") @Bean - public MultiGauge cpuMultiGauge(MeterRegistry meterRegistry) { + @Qualifier("cpuMultiGauge") public MultiGauge cpuMultiGauge(MeterRegistry meterRegistry) { return AgentHostMonitoring.newCPUMultiGauge(meterRegistry); } - @Qualifier("memMultiGauge") @Bean - public MultiGauge memMultiGauge(MeterRegistry meterRegistry) { + @Qualifier("memMultiGauge") public MultiGauge memMultiGauge(MeterRegistry meterRegistry) { return AgentHostMonitoring.newMemMultiGauge(meterRegistry); } - @Qualifier("zookeeperMultiGauge") @Bean - public MultiGauge zookeeperMultiGauge(MeterRegistry meterRegistry) { + @Qualifier("zookeeperMultiGauge") public MultiGauge zookeeperMultiGauge(MeterRegistry meterRegistry) { return ZookeeperHealthyMonitoring.registerZookeeperHealthyGauge(meterRegistry); } } diff --git a/bigtop-manager-agent/src/main/java/org/apache/bigtop/manager/agent/enums/AgentExceptionStatus.java b/bigtop-manager-agent/src/main/java/org/apache/bigtop/manager/agent/enums/AgentExceptionStatus.java index 030cbee0..98727481 100644 --- a/bigtop-manager-agent/src/main/java/org/apache/bigtop/manager/agent/enums/AgentExceptionStatus.java +++ b/bigtop-manager-agent/src/main/java/org/apache/bigtop/manager/agent/enums/AgentExceptionStatus.java @@ -22,7 +22,6 @@ @Getter public enum AgentExceptionStatus { - AGENT_MONITORING_ERROR(10001, "Get agent host monitoring info failed"), COMMAND_FAILED(10002, "Run command failed"), diff --git a/bigtop-manager-agent/src/main/java/org/apache/bigtop/manager/agent/executor/CacheDistributeCommandExecutor.java b/bigtop-manager-agent/src/main/java/org/apache/bigtop/manager/agent/executor/CacheDistributeCommandExecutor.java index 3892724b..44018298 100644 --- a/bigtop-manager-agent/src/main/java/org/apache/bigtop/manager/agent/executor/CacheDistributeCommandExecutor.java +++ b/bigtop-manager-agent/src/main/java/org/apache/bigtop/manager/agent/executor/CacheDistributeCommandExecutor.java @@ -18,14 +18,6 @@ */ package org.apache.bigtop.manager.agent.executor; -import static org.apache.bigtop.manager.common.constants.CacheFiles.CLUSTER_INFO; -import static org.apache.bigtop.manager.common.constants.CacheFiles.COMPONENTS_INFO; -import static org.apache.bigtop.manager.common.constants.CacheFiles.CONFIGURATIONS_INFO; -import static org.apache.bigtop.manager.common.constants.CacheFiles.HOSTS_INFO; -import static org.apache.bigtop.manager.common.constants.CacheFiles.REPOS_INFO; -import static org.apache.bigtop.manager.common.constants.CacheFiles.SETTINGS_INFO; -import static org.apache.bigtop.manager.common.constants.CacheFiles.USERS_INFO; - import org.apache.bigtop.manager.common.constants.Constants; import org.apache.bigtop.manager.common.constants.MessageConstants; import org.apache.bigtop.manager.common.message.entity.command.CommandMessageType; @@ -33,13 +25,21 @@ import org.apache.bigtop.manager.common.utils.JsonUtils; import org.apache.bigtop.manager.stack.common.utils.linux.LinuxFileUtils; -import java.text.MessageFormat; - import org.springframework.beans.factory.config.ConfigurableBeanFactory; import org.springframework.context.annotation.Scope; import lombok.extern.slf4j.Slf4j; +import java.text.MessageFormat; + +import static org.apache.bigtop.manager.common.constants.CacheFiles.CLUSTER_INFO; +import static org.apache.bigtop.manager.common.constants.CacheFiles.COMPONENTS_INFO; +import static org.apache.bigtop.manager.common.constants.CacheFiles.CONFIGURATIONS_INFO; +import static org.apache.bigtop.manager.common.constants.CacheFiles.HOSTS_INFO; +import static org.apache.bigtop.manager.common.constants.CacheFiles.REPOS_INFO; +import static org.apache.bigtop.manager.common.constants.CacheFiles.SETTINGS_INFO; +import static org.apache.bigtop.manager.common.constants.CacheFiles.USERS_INFO; + @Slf4j @org.springframework.stereotype.Component @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE) @@ -53,16 +53,14 @@ public CommandMessageType getCommandMessageType() { @Override public void doExecute() { CacheMessagePayload cacheMessagePayload = - JsonUtils.readFromString(commandRequestMessage.getMessagePayload(), - CacheMessagePayload.class); + JsonUtils.readFromString(commandRequestMessage.getMessagePayload(), CacheMessagePayload.class); log.info("[agent executeTask] taskEvent is: {}", commandRequestMessage); String cacheDir = Constants.STACK_CACHE_DIR; LinuxFileUtils.createDirectories(cacheDir, "root", "root", "rwxr-xr-x", false); JsonUtils.writeToFile(cacheDir + SETTINGS_INFO, cacheMessagePayload.getSettings()); - JsonUtils.writeToFile(cacheDir + CONFIGURATIONS_INFO, - cacheMessagePayload.getConfigurations()); + JsonUtils.writeToFile(cacheDir + CONFIGURATIONS_INFO, cacheMessagePayload.getConfigurations()); JsonUtils.writeToFile(cacheDir + HOSTS_INFO, cacheMessagePayload.getClusterHostInfo()); JsonUtils.writeToFile(cacheDir + USERS_INFO, cacheMessagePayload.getUserInfo()); JsonUtils.writeToFile(cacheDir + COMPONENTS_INFO, cacheMessagePayload.getComponentInfo()); @@ -70,7 +68,7 @@ public void doExecute() { JsonUtils.writeToFile(cacheDir + CLUSTER_INFO, cacheMessagePayload.getClusterInfo()); commandResponseMessage.setCode(MessageConstants.SUCCESS_CODE); - commandResponseMessage.setResult(MessageFormat.format("Host [{0}] cached successful!!!", - commandRequestMessage.getHostname())); + commandResponseMessage.setResult( + MessageFormat.format("Host [{0}] cached successful!!!", commandRequestMessage.getHostname())); } } diff --git a/bigtop-manager-agent/src/main/java/org/apache/bigtop/manager/agent/executor/CommandExecutors.java b/bigtop-manager-agent/src/main/java/org/apache/bigtop/manager/agent/executor/CommandExecutors.java index eb81d3f6..e1a8ed12 100644 --- a/bigtop-manager-agent/src/main/java/org/apache/bigtop/manager/agent/executor/CommandExecutors.java +++ b/bigtop-manager-agent/src/main/java/org/apache/bigtop/manager/agent/executor/CommandExecutors.java @@ -21,12 +21,12 @@ import org.apache.bigtop.manager.agent.holder.SpringContextHolder; import org.apache.bigtop.manager.common.message.entity.command.CommandMessageType; +import lombok.extern.slf4j.Slf4j; + import java.util.HashMap; import java.util.Map; import java.util.concurrent.atomic.AtomicBoolean; -import lombok.extern.slf4j.Slf4j; - @Slf4j public class CommandExecutors { @@ -48,7 +48,8 @@ private static synchronized void load() { return; } - for (Map.Entry entry : SpringContextHolder.getCommandExecutors().entrySet()) { + for (Map.Entry entry : + SpringContextHolder.getCommandExecutors().entrySet()) { String beanName = entry.getKey(); CommandExecutor commandExecutor = entry.getValue(); if (COMMAND_EXECUTORS.containsKey(commandExecutor.getCommandMessageType())) { @@ -57,7 +58,9 @@ private static synchronized void load() { } COMMAND_EXECUTORS.put(commandExecutor.getCommandMessageType(), beanName); - log.info("Load JobRunner: {} with identifier: {}", commandExecutor.getClass().getName(), + log.info( + "Load JobRunner: {} with identifier: {}", + commandExecutor.getClass().getName(), commandExecutor.getCommandMessageType()); } diff --git a/bigtop-manager-agent/src/main/java/org/apache/bigtop/manager/agent/executor/ComponentCommandExecutor.java b/bigtop-manager-agent/src/main/java/org/apache/bigtop/manager/agent/executor/ComponentCommandExecutor.java index 6ca01df7..6d4fb043 100644 --- a/bigtop-manager-agent/src/main/java/org/apache/bigtop/manager/agent/executor/ComponentCommandExecutor.java +++ b/bigtop-manager-agent/src/main/java/org/apache/bigtop/manager/agent/executor/ComponentCommandExecutor.java @@ -18,15 +18,17 @@ */ package org.apache.bigtop.manager.agent.executor; -import lombok.extern.slf4j.Slf4j; import org.apache.bigtop.manager.common.message.entity.command.CommandMessageType; import org.apache.bigtop.manager.common.message.entity.payload.CommandPayload; import org.apache.bigtop.manager.common.shell.ShellResult; import org.apache.bigtop.manager.common.utils.JsonUtils; import org.apache.bigtop.manager.stack.core.executor.StackExecutor; + import org.springframework.beans.factory.config.ConfigurableBeanFactory; import org.springframework.context.annotation.Scope; +import lombok.extern.slf4j.Slf4j; + @Slf4j @org.springframework.stereotype.Component @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE) diff --git a/bigtop-manager-agent/src/main/java/org/apache/bigtop/manager/agent/executor/HostCheckCommandExecutor.java b/bigtop-manager-agent/src/main/java/org/apache/bigtop/manager/agent/executor/HostCheckCommandExecutor.java index 44fbeb0a..fa85b099 100644 --- a/bigtop-manager-agent/src/main/java/org/apache/bigtop/manager/agent/executor/HostCheckCommandExecutor.java +++ b/bigtop-manager-agent/src/main/java/org/apache/bigtop/manager/agent/executor/HostCheckCommandExecutor.java @@ -23,15 +23,15 @@ import org.apache.bigtop.manager.common.shell.ShellResult; import org.apache.bigtop.manager.common.utils.os.TimeSyncDetection; -import java.util.List; -import java.util.function.Supplier; - import org.springframework.beans.factory.config.ConfigurableBeanFactory; import org.springframework.context.annotation.Scope; import org.springframework.stereotype.Component; import lombok.extern.slf4j.Slf4j; +import java.util.List; +import java.util.function.Supplier; + @Slf4j @Component @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE) diff --git a/bigtop-manager-agent/src/main/java/org/apache/bigtop/manager/agent/holder/SpringContextHolder.java b/bigtop-manager-agent/src/main/java/org/apache/bigtop/manager/agent/holder/SpringContextHolder.java index 74f782cf..c062a8eb 100644 --- a/bigtop-manager-agent/src/main/java/org/apache/bigtop/manager/agent/holder/SpringContextHolder.java +++ b/bigtop-manager-agent/src/main/java/org/apache/bigtop/manager/agent/holder/SpringContextHolder.java @@ -21,16 +21,15 @@ import org.apache.bigtop.manager.agent.executor.CommandExecutor; import org.apache.bigtop.manager.agent.ws.AgentWebSocketHandler; -import java.util.Map; - -import jakarta.annotation.Nonnull; - import org.springframework.context.ApplicationContext; import org.springframework.context.ApplicationContextAware; import org.springframework.stereotype.Component; import lombok.Getter; +import jakarta.annotation.Nonnull; +import java.util.Map; + @Component public class SpringContextHolder implements ApplicationContextAware { diff --git a/bigtop-manager-agent/src/main/java/org/apache/bigtop/manager/agent/metrics/MetricsCollector.java b/bigtop-manager-agent/src/main/java/org/apache/bigtop/manager/agent/metrics/MetricsCollector.java index c3dce0bc..7238f042 100644 --- a/bigtop-manager-agent/src/main/java/org/apache/bigtop/manager/agent/metrics/MetricsCollector.java +++ b/bigtop-manager-agent/src/main/java/org/apache/bigtop/manager/agent/metrics/MetricsCollector.java @@ -18,11 +18,9 @@ */ package org.apache.bigtop.manager.agent.metrics; -import io.micrometer.core.instrument.MultiGauge; -import jakarta.annotation.Resource; -import lombok.extern.slf4j.Slf4j; import org.apache.bigtop.manager.agent.monitoring.AgentHostMonitoring; import org.apache.bigtop.manager.agent.monitoring.ZookeeperHealthyMonitoring; + import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.scheduling.annotation.Async; import org.springframework.scheduling.annotation.EnableAsync; @@ -30,23 +28,27 @@ import org.springframework.scheduling.annotation.Scheduled; import org.springframework.stereotype.Component; +import io.micrometer.core.instrument.MultiGauge; +import lombok.extern.slf4j.Slf4j; + +import jakarta.annotation.Resource; + @Slf4j @Component @EnableScheduling @EnableAsync public class MetricsCollector { - @Qualifier("diskMultiGauge") - @Resource + @Qualifier("diskMultiGauge") @Resource private MultiGauge diskMultiGauge; - @Qualifier("memMultiGauge") - @Resource + + @Qualifier("memMultiGauge") @Resource private MultiGauge memMultiGauge; - @Qualifier("cpuMultiGauge") - @Resource + + @Qualifier("cpuMultiGauge") @Resource private MultiGauge cpuMultiGauge; - @Qualifier("zookeeperMultiGauge") - @Resource + + @Qualifier("zookeeperMultiGauge") @Resource private MultiGauge zookeeperMultiGauge; @Async @@ -62,5 +64,4 @@ private void scrape() { AgentHostMonitoring.cpuMultiGaugeUpdateData(cpuMultiGauge); ZookeeperHealthyMonitoring.zookeeperUpdateStatus(zookeeperMultiGauge); } - } diff --git a/bigtop-manager-agent/src/main/java/org/apache/bigtop/manager/agent/monitoring/AgentHostMonitoring.java b/bigtop-manager-agent/src/main/java/org/apache/bigtop/manager/agent/monitoring/AgentHostMonitoring.java index 429dd0f8..f3a3cde0 100644 --- a/bigtop-manager-agent/src/main/java/org/apache/bigtop/manager/agent/monitoring/AgentHostMonitoring.java +++ b/bigtop-manager-agent/src/main/java/org/apache/bigtop/manager/agent/monitoring/AgentHostMonitoring.java @@ -18,6 +18,9 @@ */ package org.apache.bigtop.manager.agent.monitoring; +import org.apache.bigtop.manager.agent.enums.AgentExceptionStatus; +import org.apache.bigtop.manager.agent.exception.AgentException; + import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.node.ArrayNode; @@ -28,8 +31,6 @@ import io.micrometer.core.instrument.Tags; import lombok.Getter; import lombok.extern.slf4j.Slf4j; -import org.apache.bigtop.manager.agent.enums.AgentExceptionStatus; -import org.apache.bigtop.manager.agent.exception.AgentException; import oshi.SystemInfo; import oshi.hardware.CentralProcessor; import oshi.hardware.GlobalMemory; @@ -43,24 +44,28 @@ import java.net.InetAddress; import java.net.InterfaceAddress; import java.net.UnknownHostException; -import java.util.*; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; import java.util.stream.Collectors; @Slf4j public class AgentHostMonitoring { - public final static String AGENT_BASE_INFO = "agentBaseInfo"; - public final static String BOOT_TIME = "bootTime"; - public final static String MEM_IDLE = "memIdle"; - public final static String MEM_TOTAL = "memTotal"; - public final static String DISKS_BASE_INFO = "disksBaseInfo"; - public final static String DISK_NAME = "diskName"; - public final static String DISK_IDLE = "diskFreeSpace"; - public final static String DISK_TOTAL = "diskTotalSpace"; - public final static String CPU_LOAD_AVG_MIN_1 = "cpuLoadAvgMin_1"; - public final static String CPU_LOAD_AVG_MIN_5 = "cpuLoadAvgMin_5"; - public final static String CPU_LOAD_AVG_MIN_15 = "cpuLoadAvgMin_15"; - public final static String CPU_USAGE = "cpuUsage"; + public static final String AGENT_BASE_INFO = "agentBaseInfo"; + public static final String BOOT_TIME = "bootTime"; + public static final String MEM_IDLE = "memIdle"; + public static final String MEM_TOTAL = "memTotal"; + public static final String DISKS_BASE_INFO = "disksBaseInfo"; + public static final String DISK_NAME = "diskName"; + public static final String DISK_IDLE = "diskFreeSpace"; + public static final String DISK_TOTAL = "diskTotalSpace"; + public static final String CPU_LOAD_AVG_MIN_1 = "cpuLoadAvgMin_1"; + public static final String CPU_LOAD_AVG_MIN_5 = "cpuLoadAvgMin_5"; + public static final String CPU_LOAD_AVG_MIN_15 = "cpuLoadAvgMin_15"; + public static final String CPU_USAGE = "cpuUsage"; private static boolean sameSubnet(String ipAddress, String subnetMask, String gateway) throws UnknownHostException { InetAddress inetAddress = InetAddress.getByName(ipAddress); @@ -96,7 +101,8 @@ public static JsonNode getHostInfo() throws UnknownHostException { // Agent Host Base Info ObjectNode hostInfoNode = json.createObjectNode(); - hostInfoNode.put("hostname", hostName) + hostInfoNode + .put("hostname", hostName) .put("os", operatingSystem.toString()) .put("ipv4Gateway", ipv4DefaultGateway) .put("cpu_info", hal.getProcessor().getProcessorIdentifier().getMicroarchitecture()) @@ -106,12 +112,11 @@ public static JsonNode getHostInfo() throws UnknownHostException { objectNode.set(AGENT_BASE_INFO, hostInfoNode); objectNode.put(BOOT_TIME, operatingSystem.getSystemBootTime()); - //.put("upTimeSeconds", operatingSystem.getSystemUptime()) + // .put("upTimeSeconds", operatingSystem.getSystemUptime()) // MEM GlobalMemory memory = hal.getMemory(); - objectNode.put(MEM_IDLE, memory.getAvailable()) - .put(MEM_TOTAL, memory.getTotal()); + objectNode.put(MEM_IDLE, memory.getAvailable()).put(MEM_TOTAL, memory.getTotal()); // DISK List fileStores = operatingSystem.getFileSystem().getFileStores(true); ArrayNode diskArrayNode = json.createArrayNode(); @@ -129,7 +134,8 @@ public static JsonNode getHostInfo() throws UnknownHostException { return objectNode; } - private static String getAgentHostIPv4addr(HardwareAbstractionLayer hal, String ipv4DefaultGateway) throws UnknownHostException { + private static String getAgentHostIPv4addr(HardwareAbstractionLayer hal, String ipv4DefaultGateway) + throws UnknownHostException { for (NetworkIF networkIF : hal.getNetworkIFs()) { String[] iPv4addr = networkIF.getIPv4addr(); if (null == iPv4addr || iPv4addr.length == 0) { @@ -142,7 +148,8 @@ private static String getAgentHostIPv4addr(HardwareAbstractionLayer hal, String } else if (subnetMaskLen == 16) { subnetMask = "255.255.0.0"; } - List interfaceAddresses = networkIF.queryNetworkInterface().getInterfaceAddresses(); + List interfaceAddresses = + networkIF.queryNetworkInterface().getInterfaceAddresses(); for (InterfaceAddress ifaddr : interfaceAddresses) { if (null != ifaddr.getBroadcast() && sameSubnet(iPv4addr[0], subnetMask, ipv4DefaultGateway)) { return iPv4addr[0]; @@ -182,15 +189,21 @@ public static Map, Map, Double>> getDiskGaug disksInfo.forEach(diskJsonNode -> { // Disk Idle ArrayList diskIdleLabelValues = new ArrayList<>(diskGaugeLabelsValues); - diskIdleLabelValues.add(diskJsonNode.get(AgentHostMonitoring.DISK_NAME).asText()); + diskIdleLabelValues.add( + diskJsonNode.get(AgentHostMonitoring.DISK_NAME).asText()); diskIdleLabelValues.add(AgentHostMonitoring.DISK_IDLE); - labelValues.put(diskIdleLabelValues, diskJsonNode.get(AgentHostMonitoring.DISK_IDLE).asDouble()); + labelValues.put( + diskIdleLabelValues, + diskJsonNode.get(AgentHostMonitoring.DISK_IDLE).asDouble()); // Disk Total ArrayList diskTotalLabelValues = new ArrayList<>(diskGaugeLabelsValues); - diskTotalLabelValues.add(diskJsonNode.get(AgentHostMonitoring.DISK_NAME).asText()); + diskTotalLabelValues.add( + diskJsonNode.get(AgentHostMonitoring.DISK_NAME).asText()); diskTotalLabelValues.add(AgentHostMonitoring.DISK_TOTAL); - labelValues.put(diskTotalLabelValues, diskJsonNode.get(AgentHostMonitoring.DISK_TOTAL).asDouble()); + labelValues.put( + diskTotalLabelValues, + diskJsonNode.get(AgentHostMonitoring.DISK_TOTAL).asDouble()); }); Map, Map, Double>> diskGauge = new HashMap<>(); diskGauge.put(diskGaugeLabels, labelValues); @@ -206,7 +219,8 @@ public static Map, Map, Double>> getCPUGauge double[] systemLoadAverage = cpu.getSystemLoadAverage(3); long[] systemCpuLoadTicks1 = cpu.getSystemCpuLoadTicks(); Util.sleep(3000); - ((ObjectNode) agentMonitoring).put(CPU_LOAD_AVG_MIN_1, systemLoadAverage[0]) + ((ObjectNode) agentMonitoring) + .put(CPU_LOAD_AVG_MIN_1, systemLoadAverage[0]) .put(CPU_LOAD_AVG_MIN_5, systemLoadAverage[1]) .put(CPU_LOAD_AVG_MIN_15, systemLoadAverage[2]) .put(CPU_USAGE, cpu.getSystemCpuLoadBetweenTicks(systemCpuLoadTicks1)); @@ -226,10 +240,18 @@ public static Map, Map, Double>> getCPUGauge ArrayList cpuLoadAvgMin_15_LabelValues = new ArrayList<>(cpuGaugeLabelsValues); cpuLoadAvgMin_15_LabelValues.add(AgentHostMonitoring.CPU_LOAD_AVG_MIN_15); - labelValues.put(cpuUsageLabelValues, agentMonitoring.get(AgentHostMonitoring.CPU_USAGE).asDouble()); - labelValues.put(cpuLoadAvgMin_1_LabelValues, agentMonitoring.get(AgentHostMonitoring.CPU_LOAD_AVG_MIN_1).asDouble()); - labelValues.put(cpuLoadAvgMin_5_LabelValues, agentMonitoring.get(AgentHostMonitoring.CPU_LOAD_AVG_MIN_5).asDouble()); - labelValues.put(cpuLoadAvgMin_15_LabelValues, agentMonitoring.get(AgentHostMonitoring.CPU_LOAD_AVG_MIN_15).asDouble()); + labelValues.put( + cpuUsageLabelValues, + agentMonitoring.get(AgentHostMonitoring.CPU_USAGE).asDouble()); + labelValues.put( + cpuLoadAvgMin_1_LabelValues, + agentMonitoring.get(AgentHostMonitoring.CPU_LOAD_AVG_MIN_1).asDouble()); + labelValues.put( + cpuLoadAvgMin_5_LabelValues, + agentMonitoring.get(AgentHostMonitoring.CPU_LOAD_AVG_MIN_5).asDouble()); + labelValues.put( + cpuLoadAvgMin_15_LabelValues, + agentMonitoring.get(AgentHostMonitoring.CPU_LOAD_AVG_MIN_15).asDouble()); Map, Map, Double>> cpuGauge = new HashMap<>(); cpuGauge.put(cpuGaugeLabels, labelValues); return cpuGauge; @@ -248,35 +270,40 @@ public static Map, Map, Double>> getMEMGauge ArrayList memTotalLabelValues = new ArrayList<>(memGaugeLabelsValues); memTotalLabelValues.add(AgentHostMonitoring.MEM_TOTAL); - labelValues.put(memIdleLabelValues, agentMonitoring.get(AgentHostMonitoring.MEM_IDLE).asDouble()); - labelValues.put(memTotalLabelValues, agentMonitoring.get(AgentHostMonitoring.MEM_TOTAL).asDouble()); + labelValues.put( + memIdleLabelValues, + agentMonitoring.get(AgentHostMonitoring.MEM_IDLE).asDouble()); + labelValues.put( + memTotalLabelValues, + agentMonitoring.get(AgentHostMonitoring.MEM_TOTAL).asDouble()); Map, Map, Double>> memGauge = new HashMap<>(); memGauge.put(memGaugeLabels, labelValues); return memGauge; } public static MultiGauge newDiskMultiGauge(MeterRegistry registry) { - return MultiGauge - .builder("agent_host_monitoring") + return MultiGauge.builder("agent_host_monitoring") .description("BigTop Manager Agent Host Monitoring, Disk Monitoring") - .baseUnit("disk").register(registry); + .baseUnit("disk") + .register(registry); } public static MultiGauge newMemMultiGauge(MeterRegistry registry) { - return MultiGauge - .builder("agent_host_monitoring") + return MultiGauge.builder("agent_host_monitoring") .description("BigTop Manager Agent Host Monitoring, Memory Monitoring") - .baseUnit("mem").register(registry); + .baseUnit("mem") + .register(registry); } public static MultiGauge newCPUMultiGauge(MeterRegistry registry) { - return MultiGauge - .builder("agent_host_monitoring") + return MultiGauge.builder("agent_host_monitoring") .description("BigTop Manager Agent Host Monitoring, CPU Monitoring") - .baseUnit("cpu").register(registry); + .baseUnit("cpu") + .register(registry); } - public static void multiGaugeUpdateData(MultiGauge multiGauge, Map, Map, Double>> gaugeData) { + public static void multiGaugeUpdateData( + MultiGauge multiGauge, Map, Map, Double>> gaugeData) { ArrayList tagKeys = null; Map, Double> tagValues = null; for (Map.Entry, Map, Double>> entry : gaugeData.entrySet()) { @@ -287,14 +314,18 @@ public static void multiGaugeUpdateData(MultiGauge multiGauge, Map finalTagKeys = tagKeys; - multiGauge.register(tagValues.entrySet().stream().map(item -> { - List tags = new ArrayList<>(); - ArrayList labelKeyValues = item.getKey(); - for (int i = 0; i < labelKeyValues.size(); i++) { - tags.add(Tag.of(finalTagKeys.get(i), labelKeyValues.get(i))); - } - return MultiGauge.Row.of(Tags.of(tags), item.getValue()); - }).collect(Collectors.toList()), true); + multiGauge.register( + tagValues.entrySet().stream() + .map(item -> { + List tags = new ArrayList<>(); + ArrayList labelKeyValues = item.getKey(); + for (int i = 0; i < labelKeyValues.size(); i++) { + tags.add(Tag.of(finalTagKeys.get(i), labelKeyValues.get(i))); + } + return MultiGauge.Row.of(Tags.of(tags), item.getValue()); + }) + .collect(Collectors.toList()), + true); } public static void diskMultiGaugeUpdateData(MultiGauge diskMultiGauge) { @@ -323,5 +354,4 @@ public static void cpuMultiGaugeUpdateData(MultiGauge cpuMultiGauge) { throw new AgentException(AgentExceptionStatus.AGENT_MONITORING_ERROR); } } - } diff --git a/bigtop-manager-agent/src/main/java/org/apache/bigtop/manager/agent/monitoring/ZookeeperHealthyMonitoring.java b/bigtop-manager-agent/src/main/java/org/apache/bigtop/manager/agent/monitoring/ZookeeperHealthyMonitoring.java index e1a44ca9..a8d87c20 100644 --- a/bigtop-manager-agent/src/main/java/org/apache/bigtop/manager/agent/monitoring/ZookeeperHealthyMonitoring.java +++ b/bigtop-manager-agent/src/main/java/org/apache/bigtop/manager/agent/monitoring/ZookeeperHealthyMonitoring.java @@ -18,6 +18,9 @@ */ package org.apache.bigtop.manager.agent.monitoring; +import org.apache.bigtop.manager.common.constants.CacheFiles; +import org.apache.bigtop.manager.common.constants.Constants; + import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.node.ObjectNode; @@ -26,10 +29,13 @@ import io.micrometer.core.instrument.Tag; import io.micrometer.core.instrument.Tags; import lombok.extern.slf4j.Slf4j; -import org.apache.bigtop.manager.common.constants.CacheFiles; -import org.apache.bigtop.manager.common.constants.Constants; -import java.io.*; +import java.io.BufferedReader; +import java.io.File; +import java.io.FileInputStream; +import java.io.IOException; +import java.io.InputStreamReader; +import java.io.OutputStream; import java.net.InetSocketAddress; import java.net.Socket; import java.util.ArrayList; @@ -41,11 +47,11 @@ @Slf4j public class ZookeeperHealthyMonitoring { - private final static int STATUS_FOLLOWER = 2; - private final static int STATUS_LEADER = 1; - private final static int ZOOKEEPER_UNHEALTHY = 0; + private static final int STATUS_FOLLOWER = 2; + private static final int STATUS_LEADER = 1; + private static final int ZOOKEEPER_UNHEALTHY = 0; - private final static String ZOOKEEPER_HEALTHY_MONITORING_NAME = "zookeeper_monitoring"; + private static final String ZOOKEEPER_HEALTHY_MONITORING_NAME = "zookeeper_monitoring"; public static void zookeeperUpdateStatus(MultiGauge multiGauge) { Socket sock = null; @@ -104,7 +110,8 @@ public static void zookeeperUpdateStatus(MultiGauge multiGauge) { public static MultiGauge registerZookeeperHealthyGauge(MeterRegistry registry) { return MultiGauge.builder(ZOOKEEPER_HEALTHY_MONITORING_NAME) .description("BigTop Manager Zookeeper Healthy Monitoring, 0:unhealthy, 1:leader, 2:follower") - .baseUnit("healthy").register(registry); + .baseUnit("healthy") + .register(registry); } private static Properties getZooCFG(JsonNode hostComponent) { diff --git a/bigtop-manager-agent/src/main/java/org/apache/bigtop/manager/agent/scheduler/DefaultCommandScheduler.java b/bigtop-manager-agent/src/main/java/org/apache/bigtop/manager/agent/scheduler/DefaultCommandScheduler.java index 546847bc..230a62e4 100644 --- a/bigtop-manager-agent/src/main/java/org/apache/bigtop/manager/agent/scheduler/DefaultCommandScheduler.java +++ b/bigtop-manager-agent/src/main/java/org/apache/bigtop/manager/agent/scheduler/DefaultCommandScheduler.java @@ -18,13 +18,15 @@ */ package org.apache.bigtop.manager.agent.scheduler; -import jakarta.annotation.PostConstruct; -import lombok.extern.slf4j.Slf4j; import org.apache.bigtop.manager.agent.executor.CommandExecutor; import org.apache.bigtop.manager.agent.executor.CommandExecutors; import org.apache.bigtop.manager.common.message.entity.command.CommandRequestMessage; + import org.springframework.stereotype.Component; +import lombok.extern.slf4j.Slf4j; + +import jakarta.annotation.PostConstruct; import java.util.concurrent.Executor; import java.util.concurrent.Executors; import java.util.concurrent.LinkedBlockingQueue; diff --git a/bigtop-manager-agent/src/main/java/org/apache/bigtop/manager/agent/ws/AgentWebSocketHandler.java b/bigtop-manager-agent/src/main/java/org/apache/bigtop/manager/agent/ws/AgentWebSocketHandler.java index a73320b5..fba40103 100644 --- a/bigtop-manager-agent/src/main/java/org/apache/bigtop/manager/agent/ws/AgentWebSocketHandler.java +++ b/bigtop-manager-agent/src/main/java/org/apache/bigtop/manager/agent/ws/AgentWebSocketHandler.java @@ -18,12 +18,6 @@ */ package org.apache.bigtop.manager.agent.ws; -import com.sun.management.OperatingSystemMXBean; -import jakarta.annotation.Nonnull; -import jakarta.annotation.Resource; -import lombok.Getter; -import lombok.Setter; -import lombok.extern.slf4j.Slf4j; import org.apache.bigtop.manager.agent.holder.SpringContextHolder; import org.apache.bigtop.manager.agent.scheduler.CommandScheduler; import org.apache.bigtop.manager.common.config.ApplicationConfig; @@ -35,6 +29,7 @@ import org.apache.bigtop.manager.common.message.serializer.MessageDeserializer; import org.apache.bigtop.manager.common.utils.os.OSDetection; import org.apache.bigtop.manager.common.ws.AbstractBinaryWebSocketHandler; + import org.springframework.boot.context.event.ApplicationStartedEvent; import org.springframework.context.ApplicationListener; import org.springframework.stereotype.Component; @@ -43,6 +38,13 @@ import org.springframework.web.socket.WebSocketSession; import org.springframework.web.socket.client.standard.StandardWebSocketClient; +import com.sun.management.OperatingSystemMXBean; +import lombok.Getter; +import lombok.Setter; +import lombok.extern.slf4j.Slf4j; + +import jakarta.annotation.Nonnull; +import jakarta.annotation.Resource; import java.lang.management.ManagementFactory; import java.math.BigDecimal; import java.net.InetAddress; @@ -55,7 +57,8 @@ @Slf4j @Component -public class AgentWebSocketHandler extends AbstractBinaryWebSocketHandler implements ApplicationListener { +public class AgentWebSocketHandler extends AbstractBinaryWebSocketHandler + implements ApplicationListener { @Resource private ApplicationConfig applicationConfig; @@ -96,7 +99,8 @@ protected void handleBinaryMessage(@Nonnull WebSocketSession session, BinaryMess } private void handleMessage(WebSocketSession session, BaseMessage baseMessage) { - log.info("Received message type: {}, session: {}", baseMessage.getClass().getSimpleName(), session); + log.info( + "Received message type: {}, session: {}", baseMessage.getClass().getSimpleName(), session); if (baseMessage instanceof CommandRequestMessage commandRequestMessage) { commandScheduler.submit(commandRequestMessage); @@ -108,22 +112,27 @@ private void handleMessage(WebSocketSession session, BaseMessage baseMessage) { @Override public void afterConnectionEstablished(@Nonnull WebSocketSession session) { this.setSession(session); - executor.scheduleAtFixedRate(() -> { - try { - HeartbeatMessage heartbeatMessage = new HeartbeatMessage(); - heartbeatMessage.setHostInfo(hostInfo); - WebSocketSession innerSession = SpringContextHolder.getAgentWebSocket().getSession(); - if (null == innerSession || !innerSession.isOpen()) { - connectToServer(); - } - innerSession = SpringContextHolder.getAgentWebSocket().getSession(); - if (null != innerSession && innerSession.isOpen()) { - super.sendMessage(innerSession, heartbeatMessage); - } - } catch (Exception e) { - log.error(MessageFormat.format("Error sending heartbeat to server: {0}", e.getMessage())); - } - }, 3, 10, TimeUnit.SECONDS); + executor.scheduleAtFixedRate( + () -> { + try { + HeartbeatMessage heartbeatMessage = new HeartbeatMessage(); + heartbeatMessage.setHostInfo(hostInfo); + WebSocketSession innerSession = + SpringContextHolder.getAgentWebSocket().getSession(); + if (null == innerSession || !innerSession.isOpen()) { + connectToServer(); + } + innerSession = SpringContextHolder.getAgentWebSocket().getSession(); + if (null != innerSession && innerSession.isOpen()) { + super.sendMessage(innerSession, heartbeatMessage); + } + } catch (Exception e) { + log.error(MessageFormat.format("Error sending heartbeat to server: {0}", e.getMessage())); + } + }, + 3, + 10, + TimeUnit.SECONDS); } @Override @@ -181,13 +190,12 @@ private void connectToServer() { int retryTime = 0; while (true) { try { - if (retryTime >= 3) - break; + if (retryTime >= 3) break; AgentWebSocketHandler agentWebSocket = SpringContextHolder.getAgentWebSocket(); WebSocketSession contextSession = agentWebSocket.getSession(); if (null == contextSession || !contextSession.isOpen()) { - WebSocketSession webSocketSession = webSocketClient - .execute(this, uri).get(5, TimeUnit.SECONDS); + WebSocketSession webSocketSession = + webSocketClient.execute(this, uri).get(5, TimeUnit.SECONDS); webSocketSession.setBinaryMessageSizeLimit(WS_BINARY_MESSAGE_SIZE_LIMIT); agentWebSocket.setSession(webSocketSession); log.info(MessageFormat.format("Connect to server: {0} successfully", uri)); @@ -195,8 +203,8 @@ private void connectToServer() { ++retryTime; break; } catch (Exception e) { - log.error(MessageFormat.format("Error connecting to server: {0}, retry time: {1}", e.getMessage(), - ++retryTime)); + log.error(MessageFormat.format( + "Error connecting to server: {0}, retry time: {1}", e.getMessage(), ++retryTime)); // retry after 5 seconds try { TimeUnit.MILLISECONDS.sleep(Constants.REGISTRY_SESSION_TIMEOUT); diff --git a/bigtop-manager-agent/src/test/java/org/apache/bigtop/manager/agent/AgentApplicationTests.java b/bigtop-manager-agent/src/test/java/org/apache/bigtop/manager/agent/AgentApplicationTests.java index a5bc3961..7d93c6b1 100644 --- a/bigtop-manager-agent/src/test/java/org/apache/bigtop/manager/agent/AgentApplicationTests.java +++ b/bigtop-manager-agent/src/test/java/org/apache/bigtop/manager/agent/AgentApplicationTests.java @@ -18,11 +18,13 @@ */ package org.apache.bigtop.manager.agent; -import com.fasterxml.jackson.databind.JsonNode; import org.apache.bigtop.manager.agent.monitoring.AgentHostMonitoring; + import org.junit.jupiter.api.Test; import org.springframework.boot.test.context.SpringBootTest; +import com.fasterxml.jackson.databind.JsonNode; + import java.net.UnknownHostException; import java.text.DecimalFormat; @@ -30,8 +32,7 @@ public class AgentApplicationTests { @Test - void contextLoads() { - } + void contextLoads() {} @Test void getHostAgentInfo() throws UnknownHostException { @@ -43,5 +44,4 @@ void getHostAgentInfo() throws UnknownHostException { void testNum() { System.out.println(new DecimalFormat("#.00").format(123.2344)); } - } diff --git a/bigtop-manager-bom/pom.xml b/bigtop-manager-bom/pom.xml index 0ce1434d..de710374 100644 --- a/bigtop-manager-bom/pom.xml +++ b/bigtop-manager-bom/pom.xml @@ -17,9 +17,7 @@ ~ specific language governing permissions and limitations ~ under the License. --> - - + 4.0.0 org.apache.bigtop diff --git a/bigtop-manager-common/pom.xml b/bigtop-manager-common/pom.xml index 8ccd3444..e759a656 100644 --- a/bigtop-manager-common/pom.xml +++ b/bigtop-manager-common/pom.xml @@ -17,9 +17,7 @@ ~ specific language governing permissions and limitations ~ under the License. --> - - + 4.0.0 org.apache.bigtop diff --git a/bigtop-manager-common/src/main/java/org/apache/bigtop/manager/common/config/MessageConfig.java b/bigtop-manager-common/src/main/java/org/apache/bigtop/manager/common/config/MessageConfig.java index 0560b9b7..f365e1e0 100644 --- a/bigtop-manager-common/src/main/java/org/apache/bigtop/manager/common/config/MessageConfig.java +++ b/bigtop-manager-common/src/main/java/org/apache/bigtop/manager/common/config/MessageConfig.java @@ -23,11 +23,11 @@ import org.apache.commons.lang3.StringUtils; -import jakarta.annotation.Resource; - import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; +import jakarta.annotation.Resource; + @Configuration public class MessageConfig { @@ -39,7 +39,8 @@ public MessageSerializer messageSerializer() throws Exception { String serializerType = applicationConfig.getSerializer().getType(); String packageName = "org.apache.bigtop.manager.common.message.serializer"; String className = packageName + "." + StringUtils.capitalize(serializerType) + "MessageSerializer"; - return (MessageSerializer) Class.forName(className).getDeclaredConstructor().newInstance(); + return (MessageSerializer) + Class.forName(className).getDeclaredConstructor().newInstance(); } @Bean @@ -47,6 +48,7 @@ public MessageDeserializer messageDeserializer() throws Exception { String deserializerType = applicationConfig.getSerializer().getType(); String packageName = "org.apache.bigtop.manager.common.message.serializer"; String className = packageName + "." + StringUtils.capitalize(deserializerType) + "MessageDeserializer"; - return (MessageDeserializer) Class.forName(className).getDeclaredConstructor().newInstance(); + return (MessageDeserializer) + Class.forName(className).getDeclaredConstructor().newInstance(); } } diff --git a/bigtop-manager-common/src/main/java/org/apache/bigtop/manager/common/constants/Constants.java b/bigtop-manager-common/src/main/java/org/apache/bigtop/manager/common/constants/Constants.java index 49f0de39..556f2c81 100644 --- a/bigtop-manager-common/src/main/java/org/apache/bigtop/manager/common/constants/Constants.java +++ b/bigtop-manager-common/src/main/java/org/apache/bigtop/manager/common/constants/Constants.java @@ -30,8 +30,12 @@ private Constants() { * stack cache dir */ public static final String STACK_CACHE_DIR = - new File(Constants.class.getProtectionDomain().getCodeSource().getLocation().getPath()).getParent() - + "/../cache"; + new File(Constants.class + .getProtectionDomain() + .getCodeSource() + .getLocation() + .getPath()) + .getParent() + "/../cache"; /** * host key for all hosts diff --git a/bigtop-manager-common/src/main/java/org/apache/bigtop/manager/common/constants/MessageConstants.java b/bigtop-manager-common/src/main/java/org/apache/bigtop/manager/common/constants/MessageConstants.java index 8defdbcc..8cf336e7 100644 --- a/bigtop-manager-common/src/main/java/org/apache/bigtop/manager/common/constants/MessageConstants.java +++ b/bigtop-manager-common/src/main/java/org/apache/bigtop/manager/common/constants/MessageConstants.java @@ -33,5 +33,4 @@ private MessageConstants() { * default fail code */ public static final int FAIL_CODE = -1; - } diff --git a/bigtop-manager-common/src/main/java/org/apache/bigtop/manager/common/enums/Command.java b/bigtop-manager-common/src/main/java/org/apache/bigtop/manager/common/enums/Command.java index bd82f362..c6d37864 100644 --- a/bigtop-manager-common/src/main/java/org/apache/bigtop/manager/common/enums/Command.java +++ b/bigtop-manager-common/src/main/java/org/apache/bigtop/manager/common/enums/Command.java @@ -24,7 +24,6 @@ import com.fasterxml.jackson.annotation.JsonValue; public enum Command { - CREATE, INSTALL, diff --git a/bigtop-manager-common/src/main/java/org/apache/bigtop/manager/common/enums/JobState.java b/bigtop-manager-common/src/main/java/org/apache/bigtop/manager/common/enums/JobState.java index 9c44b315..1789bead 100644 --- a/bigtop-manager-common/src/main/java/org/apache/bigtop/manager/common/enums/JobState.java +++ b/bigtop-manager-common/src/main/java/org/apache/bigtop/manager/common/enums/JobState.java @@ -24,7 +24,6 @@ import com.fasterxml.jackson.annotation.JsonValue; public enum JobState { - PENDING, PROCESSING, diff --git a/bigtop-manager-common/src/main/java/org/apache/bigtop/manager/common/enums/MaintainState.java b/bigtop-manager-common/src/main/java/org/apache/bigtop/manager/common/enums/MaintainState.java index c2def542..81617b76 100644 --- a/bigtop-manager-common/src/main/java/org/apache/bigtop/manager/common/enums/MaintainState.java +++ b/bigtop-manager-common/src/main/java/org/apache/bigtop/manager/common/enums/MaintainState.java @@ -22,12 +22,10 @@ import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonValue; - import lombok.Getter; @Getter public enum MaintainState { - UNINSTALLED, INSTALLED, diff --git a/bigtop-manager-common/src/main/java/org/apache/bigtop/manager/common/enums/OSArchType.java b/bigtop-manager-common/src/main/java/org/apache/bigtop/manager/common/enums/OSArchType.java index 285f17a7..382de48b 100644 --- a/bigtop-manager-common/src/main/java/org/apache/bigtop/manager/common/enums/OSArchType.java +++ b/bigtop-manager-common/src/main/java/org/apache/bigtop/manager/common/enums/OSArchType.java @@ -22,12 +22,10 @@ * Contains the list of supported architectures. */ public enum OSArchType { - X86_64, AARCH64, PPC64LE, - ; } diff --git a/bigtop-manager-common/src/main/java/org/apache/bigtop/manager/common/enums/OSType.java b/bigtop-manager-common/src/main/java/org/apache/bigtop/manager/common/enums/OSType.java index ee5ed2ee..4ac4b8ee 100644 --- a/bigtop-manager-common/src/main/java/org/apache/bigtop/manager/common/enums/OSType.java +++ b/bigtop-manager-common/src/main/java/org/apache/bigtop/manager/common/enums/OSType.java @@ -22,7 +22,6 @@ * Contains the list of supported OS types. */ public enum OSType { - CENTOS7, ROCKY8, @@ -36,6 +35,5 @@ public enum OSType { DEBIAN11, FEDORA36, - ; } diff --git a/bigtop-manager-common/src/main/java/org/apache/bigtop/manager/common/message/entity/BaseMessage.java b/bigtop-manager-common/src/main/java/org/apache/bigtop/manager/common/message/entity/BaseMessage.java index 4f72f54d..b32defad 100644 --- a/bigtop-manager-common/src/main/java/org/apache/bigtop/manager/common/message/entity/BaseMessage.java +++ b/bigtop-manager-common/src/main/java/org/apache/bigtop/manager/common/message/entity/BaseMessage.java @@ -18,12 +18,12 @@ */ package org.apache.bigtop.manager.common.message.entity; -import java.sql.Timestamp; -import java.util.UUID; - import lombok.Data; import lombok.NoArgsConstructor; +import java.sql.Timestamp; +import java.util.UUID; + @Data @NoArgsConstructor public class BaseMessage { diff --git a/bigtop-manager-common/src/main/java/org/apache/bigtop/manager/common/message/entity/BaseRequestMessage.java b/bigtop-manager-common/src/main/java/org/apache/bigtop/manager/common/message/entity/BaseRequestMessage.java index 6f06c5b8..7d67e5b0 100644 --- a/bigtop-manager-common/src/main/java/org/apache/bigtop/manager/common/message/entity/BaseRequestMessage.java +++ b/bigtop-manager-common/src/main/java/org/apache/bigtop/manager/common/message/entity/BaseRequestMessage.java @@ -18,5 +18,4 @@ */ package org.apache.bigtop.manager.common.message.entity; -public class BaseRequestMessage extends BaseMessage { -} +public class BaseRequestMessage extends BaseMessage {} diff --git a/bigtop-manager-common/src/main/java/org/apache/bigtop/manager/common/message/entity/BaseResponseMessage.java b/bigtop-manager-common/src/main/java/org/apache/bigtop/manager/common/message/entity/BaseResponseMessage.java index a4fed23c..805525eb 100644 --- a/bigtop-manager-common/src/main/java/org/apache/bigtop/manager/common/message/entity/BaseResponseMessage.java +++ b/bigtop-manager-common/src/main/java/org/apache/bigtop/manager/common/message/entity/BaseResponseMessage.java @@ -18,5 +18,4 @@ */ package org.apache.bigtop.manager.common.message.entity; -public class BaseResponseMessage extends BaseMessage { -} +public class BaseResponseMessage extends BaseMessage {} diff --git a/bigtop-manager-common/src/main/java/org/apache/bigtop/manager/common/message/entity/command/CommandLogMessage.java b/bigtop-manager-common/src/main/java/org/apache/bigtop/manager/common/message/entity/command/CommandLogMessage.java index be32f02b..a092d964 100644 --- a/bigtop-manager-common/src/main/java/org/apache/bigtop/manager/common/message/entity/command/CommandLogMessage.java +++ b/bigtop-manager-common/src/main/java/org/apache/bigtop/manager/common/message/entity/command/CommandLogMessage.java @@ -18,9 +18,14 @@ */ package org.apache.bigtop.manager.common.message.entity.command; -import lombok.*; import org.apache.bigtop.manager.common.message.entity.BaseMessage; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.NoArgsConstructor; +import lombok.ToString; + @Data @EqualsAndHashCode(callSuper = true) @ToString(callSuper = true) diff --git a/bigtop-manager-common/src/main/java/org/apache/bigtop/manager/common/message/entity/command/CommandMessageType.java b/bigtop-manager-common/src/main/java/org/apache/bigtop/manager/common/message/entity/command/CommandMessageType.java index 54cbb72a..cdabdad5 100644 --- a/bigtop-manager-common/src/main/java/org/apache/bigtop/manager/common/message/entity/command/CommandMessageType.java +++ b/bigtop-manager-common/src/main/java/org/apache/bigtop/manager/common/message/entity/command/CommandMessageType.java @@ -19,7 +19,6 @@ package org.apache.bigtop.manager.common.message.entity.command; public enum CommandMessageType { - COMPONENT, HOST_CHECK, diff --git a/bigtop-manager-common/src/main/java/org/apache/bigtop/manager/common/message/entity/payload/CacheMessagePayload.java b/bigtop-manager-common/src/main/java/org/apache/bigtop/manager/common/message/entity/payload/CacheMessagePayload.java index 3decbfdc..05f96cf5 100644 --- a/bigtop-manager-common/src/main/java/org/apache/bigtop/manager/common/message/entity/payload/CacheMessagePayload.java +++ b/bigtop-manager-common/src/main/java/org/apache/bigtop/manager/common/message/entity/payload/CacheMessagePayload.java @@ -22,15 +22,15 @@ import org.apache.bigtop.manager.common.message.entity.pojo.ComponentInfo; import org.apache.bigtop.manager.common.message.entity.pojo.RepoInfo; -import java.util.List; -import java.util.Map; -import java.util.Set; - import lombok.Data; import lombok.EqualsAndHashCode; import lombok.NoArgsConstructor; import lombok.ToString; +import java.util.List; +import java.util.Map; +import java.util.Set; + @Data @ToString(callSuper = true) @EqualsAndHashCode(callSuper = true) @@ -50,5 +50,4 @@ public class CacheMessagePayload extends BasePayload { private Map> clusterHostInfo; private Map componentInfo; - } diff --git a/bigtop-manager-common/src/main/java/org/apache/bigtop/manager/common/message/entity/payload/CommandPayload.java b/bigtop-manager-common/src/main/java/org/apache/bigtop/manager/common/message/entity/payload/CommandPayload.java index c542b47f..a279e2b6 100644 --- a/bigtop-manager-common/src/main/java/org/apache/bigtop/manager/common/message/entity/payload/CommandPayload.java +++ b/bigtop-manager-common/src/main/java/org/apache/bigtop/manager/common/message/entity/payload/CommandPayload.java @@ -23,13 +23,13 @@ import org.apache.bigtop.manager.common.message.entity.pojo.OSSpecificInfo; import org.apache.bigtop.manager.common.message.entity.pojo.ScriptInfo; -import java.util.List; - import lombok.Data; import lombok.EqualsAndHashCode; import lombok.NoArgsConstructor; import lombok.ToString; +import java.util.List; + @Data @ToString(callSuper = true) @EqualsAndHashCode(callSuper = true) diff --git a/bigtop-manager-common/src/main/java/org/apache/bigtop/manager/common/message/entity/payload/HostCheckPayload.java b/bigtop-manager-common/src/main/java/org/apache/bigtop/manager/common/message/entity/payload/HostCheckPayload.java index 0a577cb1..19ae2da4 100644 --- a/bigtop-manager-common/src/main/java/org/apache/bigtop/manager/common/message/entity/payload/HostCheckPayload.java +++ b/bigtop-manager-common/src/main/java/org/apache/bigtop/manager/common/message/entity/payload/HostCheckPayload.java @@ -27,6 +27,4 @@ @ToString(callSuper = true) @EqualsAndHashCode(callSuper = true) @NoArgsConstructor -public class HostCheckPayload extends BasePayload { - -} +public class HostCheckPayload extends BasePayload {} diff --git a/bigtop-manager-common/src/main/java/org/apache/bigtop/manager/common/message/entity/pojo/ClusterInfo.java b/bigtop-manager-common/src/main/java/org/apache/bigtop/manager/common/message/entity/pojo/ClusterInfo.java index 35a79fb0..94ea3ae8 100644 --- a/bigtop-manager-common/src/main/java/org/apache/bigtop/manager/common/message/entity/pojo/ClusterInfo.java +++ b/bigtop-manager-common/src/main/java/org/apache/bigtop/manager/common/message/entity/pojo/ClusterInfo.java @@ -18,10 +18,10 @@ */ package org.apache.bigtop.manager.common.message.entity.pojo; -import java.util.List; - import lombok.Data; +import java.util.List; + @Data public class ClusterInfo { diff --git a/bigtop-manager-common/src/main/java/org/apache/bigtop/manager/common/message/entity/pojo/ComponentInfo.java b/bigtop-manager-common/src/main/java/org/apache/bigtop/manager/common/message/entity/pojo/ComponentInfo.java index ea2231b9..b573228d 100644 --- a/bigtop-manager-common/src/main/java/org/apache/bigtop/manager/common/message/entity/pojo/ComponentInfo.java +++ b/bigtop-manager-common/src/main/java/org/apache/bigtop/manager/common/message/entity/pojo/ComponentInfo.java @@ -34,5 +34,4 @@ public class ComponentInfo { private String category; private String serviceName; - } diff --git a/bigtop-manager-common/src/main/java/org/apache/bigtop/manager/common/message/entity/pojo/HostInfo.java b/bigtop-manager-common/src/main/java/org/apache/bigtop/manager/common/message/entity/pojo/HostInfo.java index 467faaad..953092b9 100644 --- a/bigtop-manager-common/src/main/java/org/apache/bigtop/manager/common/message/entity/pojo/HostInfo.java +++ b/bigtop-manager-common/src/main/java/org/apache/bigtop/manager/common/message/entity/pojo/HostInfo.java @@ -18,11 +18,11 @@ */ package org.apache.bigtop.manager.common.message.entity.pojo; +import lombok.Data; + import java.io.Serializable; import java.math.BigDecimal; -import lombok.Data; - @Data public class HostInfo implements Serializable { diff --git a/bigtop-manager-common/src/main/java/org/apache/bigtop/manager/common/message/entity/pojo/OSSpecificInfo.java b/bigtop-manager-common/src/main/java/org/apache/bigtop/manager/common/message/entity/pojo/OSSpecificInfo.java index 08019762..9c061e85 100644 --- a/bigtop-manager-common/src/main/java/org/apache/bigtop/manager/common/message/entity/pojo/OSSpecificInfo.java +++ b/bigtop-manager-common/src/main/java/org/apache/bigtop/manager/common/message/entity/pojo/OSSpecificInfo.java @@ -18,10 +18,10 @@ */ package org.apache.bigtop.manager.common.message.entity.pojo; -import java.util.List; - import lombok.Data; +import java.util.List; + @Data public class OSSpecificInfo { diff --git a/bigtop-manager-common/src/main/java/org/apache/bigtop/manager/common/message/entity/pojo/RepoInfo.java b/bigtop-manager-common/src/main/java/org/apache/bigtop/manager/common/message/entity/pojo/RepoInfo.java index 41307ca9..c48c8b1d 100644 --- a/bigtop-manager-common/src/main/java/org/apache/bigtop/manager/common/message/entity/pojo/RepoInfo.java +++ b/bigtop-manager-common/src/main/java/org/apache/bigtop/manager/common/message/entity/pojo/RepoInfo.java @@ -38,5 +38,4 @@ public class RepoInfo { private String arch; private String mirrorList; - } diff --git a/bigtop-manager-common/src/main/java/org/apache/bigtop/manager/common/message/serializer/KryoMessageSerializer.java b/bigtop-manager-common/src/main/java/org/apache/bigtop/manager/common/message/serializer/KryoMessageSerializer.java index d1c8848c..7bd8174b 100644 --- a/bigtop-manager-common/src/main/java/org/apache/bigtop/manager/common/message/serializer/KryoMessageSerializer.java +++ b/bigtop-manager-common/src/main/java/org/apache/bigtop/manager/common/message/serializer/KryoMessageSerializer.java @@ -18,15 +18,15 @@ */ package org.apache.bigtop.manager.common.message.serializer; -import static org.apache.bigtop.manager.common.constants.Constants.KRYO_BUFFER_SIZE; - import org.apache.bigtop.manager.common.message.entity.BaseMessage; -import java.io.ByteArrayOutputStream; - import com.esotericsoftware.kryo.Kryo; import com.esotericsoftware.kryo.io.Output; +import java.io.ByteArrayOutputStream; + +import static org.apache.bigtop.manager.common.constants.Constants.KRYO_BUFFER_SIZE; + public class KryoMessageSerializer implements MessageSerializer { @Override diff --git a/bigtop-manager-common/src/main/java/org/apache/bigtop/manager/common/message/serializer/KryoPoolHolder.java b/bigtop-manager-common/src/main/java/org/apache/bigtop/manager/common/message/serializer/KryoPoolHolder.java index 6092f176..e036967b 100644 --- a/bigtop-manager-common/src/main/java/org/apache/bigtop/manager/common/message/serializer/KryoPoolHolder.java +++ b/bigtop-manager-common/src/main/java/org/apache/bigtop/manager/common/message/serializer/KryoPoolHolder.java @@ -18,8 +18,6 @@ */ package org.apache.bigtop.manager.common.message.serializer; -import com.esotericsoftware.kryo.Kryo; -import com.esotericsoftware.kryo.util.Pool; import org.apache.bigtop.manager.common.enums.Command; import org.apache.bigtop.manager.common.message.entity.BaseMessage; import org.apache.bigtop.manager.common.message.entity.BaseRequestMessage; @@ -29,7 +27,17 @@ import org.apache.bigtop.manager.common.message.entity.command.CommandMessageType; import org.apache.bigtop.manager.common.message.entity.command.CommandRequestMessage; import org.apache.bigtop.manager.common.message.entity.command.CommandResponseMessage; -import org.apache.bigtop.manager.common.message.entity.pojo.*; +import org.apache.bigtop.manager.common.message.entity.pojo.ClusterInfo; +import org.apache.bigtop.manager.common.message.entity.pojo.ComponentInfo; +import org.apache.bigtop.manager.common.message.entity.pojo.CustomCommandInfo; +import org.apache.bigtop.manager.common.message.entity.pojo.HostCheckType; +import org.apache.bigtop.manager.common.message.entity.pojo.HostInfo; +import org.apache.bigtop.manager.common.message.entity.pojo.OSSpecificInfo; +import org.apache.bigtop.manager.common.message.entity.pojo.RepoInfo; +import org.apache.bigtop.manager.common.message.entity.pojo.ScriptInfo; + +import com.esotericsoftware.kryo.Kryo; +import com.esotericsoftware.kryo.util.Pool; import java.math.BigDecimal; import java.sql.Timestamp; diff --git a/bigtop-manager-common/src/main/java/org/apache/bigtop/manager/common/shell/ProcessContainer.java b/bigtop-manager-common/src/main/java/org/apache/bigtop/manager/common/shell/ProcessContainer.java index 1ddcfeed..072385c9 100644 --- a/bigtop-manager-common/src/main/java/org/apache/bigtop/manager/common/shell/ProcessContainer.java +++ b/bigtop-manager-common/src/main/java/org/apache/bigtop/manager/common/shell/ProcessContainer.java @@ -18,11 +18,11 @@ */ package org.apache.bigtop.manager.common.shell; +import lombok.extern.slf4j.Slf4j; + import java.util.Set; import java.util.concurrent.ConcurrentHashMap; -import lombok.extern.slf4j.Slf4j; - /** * process manage container */ diff --git a/bigtop-manager-common/src/main/java/org/apache/bigtop/manager/common/shell/ShellExecutor.java b/bigtop-manager-common/src/main/java/org/apache/bigtop/manager/common/shell/ShellExecutor.java index 4fb0c107..0da7938f 100644 --- a/bigtop-manager-common/src/main/java/org/apache/bigtop/manager/common/shell/ShellExecutor.java +++ b/bigtop-manager-common/src/main/java/org/apache/bigtop/manager/common/shell/ShellExecutor.java @@ -18,6 +18,8 @@ */ package org.apache.bigtop.manager.common.shell; +import lombok.extern.slf4j.Slf4j; + import java.io.BufferedReader; import java.io.File; import java.io.IOException; @@ -30,8 +32,6 @@ import java.util.concurrent.atomic.AtomicBoolean; import java.util.function.Consumer; -import lombok.extern.slf4j.Slf4j; - /** * shell command executor. * @@ -91,8 +91,8 @@ public class ShellExecutor { * If 0, the command will not be timed out. * @param consumer the consumer to consume the output of the executed command. */ - private ShellExecutor(String[] execString, File dir, Map env, long timeout, - Consumer consumer) { + private ShellExecutor( + String[] execString, File dir, Map env, long timeout, Consumer consumer) { this.command = execString.clone(); this.dir = dir; this.environment = env; @@ -109,8 +109,7 @@ private ShellExecutor(String[] execString, File dir, Map env, lo * @throws IOException errors */ public static ShellResult execCommand(List builderParameters) throws IOException { - return execCommand(builderParameters, s -> { - }); + return execCommand(builderParameters, s -> {}); } /** @@ -122,8 +121,8 @@ public static ShellResult execCommand(List builderParameters) throws IOE * @return the output of the executed command. * @throws IOException errors */ - public static ShellResult execCommand(List builderParameters, - Consumer consumer) throws IOException { + public static ShellResult execCommand(List builderParameters, Consumer consumer) + throws IOException { return execCommand(null, builderParameters, 0L, consumer); } @@ -138,8 +137,7 @@ public static ShellResult execCommand(List builderParameters, * @throws IOException errors */ public static ShellResult execCommand(Map env, List builderParameters) throws IOException { - return execCommand(env, builderParameters, s -> { - }); + return execCommand(env, builderParameters, s -> {}); } /** @@ -153,8 +151,8 @@ public static ShellResult execCommand(Map env, List buil * @return the output of the executed command. * @throws IOException errors */ - public static ShellResult execCommand(Map env, List builderParameters, - Consumer consumer) throws IOException { + public static ShellResult execCommand( + Map env, List builderParameters, Consumer consumer) throws IOException { return execCommand(env, builderParameters, 0L, consumer); } @@ -169,10 +167,9 @@ public static ShellResult execCommand(Map env, List buil * @return the output of the executed command. * @throws IOException errors */ - public static ShellResult execCommand(Map env, List builderParameters, - long timeout) throws IOException { - return execCommand(env, builderParameters, timeout, s -> { - }); + public static ShellResult execCommand(Map env, List builderParameters, long timeout) + throws IOException { + return execCommand(env, builderParameters, timeout, s -> {}); } /** @@ -187,8 +184,9 @@ public static ShellResult execCommand(Map env, List buil * @return the output of the executed command. * @throws IOException errors */ - public static ShellResult execCommand(Map env, List builderParameters, long timeout, - Consumer consumer) throws IOException { + public static ShellResult execCommand( + Map env, List builderParameters, long timeout, Consumer consumer) + throws IOException { String[] cmd = builderParameters.toArray(new String[0]); ShellExecutor shellExecutor = new ShellExecutor(cmd, null, env, timeout, consumer); @@ -328,22 +326,24 @@ public void run() { private void scheduleTimeoutTimer() { this.timeoutTimer = new Timer(); - timeoutTimer.schedule(new TimerTask() { - - @Override - public void run() { - try { - process.exitValue(); - } catch (Exception e) { - // Process has not terminated. - // So check if it has completed - // if not just destroy it. - if (process != null && !completed.get()) { - isTimeout.set(true); - process.destroy(); + timeoutTimer.schedule( + new TimerTask() { + + @Override + public void run() { + try { + process.exitValue(); + } catch (Exception e) { + // Process has not terminated. + // So check if it has completed + // if not just destroy it. + if (process != null && !completed.get()) { + isTimeout.set(true); + process.destroy(); + } + } } - } - } - }, timeoutInterval); + }, + timeoutInterval); } } diff --git a/bigtop-manager-common/src/main/java/org/apache/bigtop/manager/common/shell/ShellResult.java b/bigtop-manager-common/src/main/java/org/apache/bigtop/manager/common/shell/ShellResult.java index 5ef1ea48..eb998e1b 100644 --- a/bigtop-manager-common/src/main/java/org/apache/bigtop/manager/common/shell/ShellResult.java +++ b/bigtop-manager-common/src/main/java/org/apache/bigtop/manager/common/shell/ShellResult.java @@ -20,12 +20,12 @@ import org.apache.bigtop.manager.common.constants.MessageConstants; -import java.text.MessageFormat; - import lombok.Data; import lombok.NoArgsConstructor; import lombok.ToString; +import java.text.MessageFormat; + @Data @ToString @NoArgsConstructor diff --git a/bigtop-manager-common/src/main/java/org/apache/bigtop/manager/common/utils/CaseUtils.java b/bigtop-manager-common/src/main/java/org/apache/bigtop/manager/common/utils/CaseUtils.java index dbf0300d..d545c189 100644 --- a/bigtop-manager-common/src/main/java/org/apache/bigtop/manager/common/utils/CaseUtils.java +++ b/bigtop-manager-common/src/main/java/org/apache/bigtop/manager/common/utils/CaseUtils.java @@ -50,7 +50,8 @@ public static String toCamelCase(String input, String separator, Boolean capital if (i == 0 && !capitalizeFirstLetter) { parts[i] = parts[i].toLowerCase(); } else { - parts[i] = parts[i].substring(0, 1).toUpperCase() + parts[i].substring(1).toLowerCase(); + parts[i] = parts[i].substring(0, 1).toUpperCase() + + parts[i].substring(1).toLowerCase(); } } diff --git a/bigtop-manager-common/src/main/java/org/apache/bigtop/manager/common/utils/DateUtils.java b/bigtop-manager-common/src/main/java/org/apache/bigtop/manager/common/utils/DateUtils.java index 03c0e4dc..6dda41d5 100644 --- a/bigtop-manager-common/src/main/java/org/apache/bigtop/manager/common/utils/DateUtils.java +++ b/bigtop-manager-common/src/main/java/org/apache/bigtop/manager/common/utils/DateUtils.java @@ -65,5 +65,4 @@ public static String format(Date date, String pattern) { private static LocalDateTime date2LocalDateTime(Date date, ZoneId zoneId) { return LocalDateTime.ofInstant(Instant.ofEpochMilli(date.getTime()), zoneId); } - } diff --git a/bigtop-manager-common/src/main/java/org/apache/bigtop/manager/common/utils/FileUtils.java b/bigtop-manager-common/src/main/java/org/apache/bigtop/manager/common/utils/FileUtils.java index 71d3c3b4..583da4dd 100644 --- a/bigtop-manager-common/src/main/java/org/apache/bigtop/manager/common/utils/FileUtils.java +++ b/bigtop-manager-common/src/main/java/org/apache/bigtop/manager/common/utils/FileUtils.java @@ -18,15 +18,15 @@ */ package org.apache.bigtop.manager.common.utils; +import lombok.AccessLevel; +import lombok.NoArgsConstructor; +import lombok.extern.slf4j.Slf4j; + import java.io.ByteArrayOutputStream; import java.io.File; import java.io.FileInputStream; import java.nio.charset.StandardCharsets; -import lombok.AccessLevel; -import lombok.NoArgsConstructor; -import lombok.extern.slf4j.Slf4j; - @Slf4j @NoArgsConstructor(access = AccessLevel.PRIVATE) public class FileUtils { @@ -51,5 +51,4 @@ public static String readFile2Str(File file) { throw new RuntimeException(e); } } - } diff --git a/bigtop-manager-common/src/main/java/org/apache/bigtop/manager/common/utils/JsonUtils.java b/bigtop-manager-common/src/main/java/org/apache/bigtop/manager/common/utils/JsonUtils.java index b76a39b0..787d369c 100644 --- a/bigtop-manager-common/src/main/java/org/apache/bigtop/manager/common/utils/JsonUtils.java +++ b/bigtop-manager-common/src/main/java/org/apache/bigtop/manager/common/utils/JsonUtils.java @@ -18,15 +18,14 @@ */ package org.apache.bigtop.manager.common.utils; -import java.io.File; - import com.fasterxml.jackson.core.type.TypeReference; import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.ObjectMapper; - import lombok.extern.slf4j.Slf4j; +import java.io.File; + @Slf4j public class JsonUtils { @@ -50,8 +49,7 @@ public static void writeToFile(File file, T obj) { } public static T readFromFile(String fileName) { - return readFromFile(new File(fileName), new TypeReference<>() { - }); + return readFromFile(new File(fileName), new TypeReference<>() {}); } public static T readFromFile(String fileName, TypeReference typeReference) { @@ -60,8 +58,7 @@ public static T readFromFile(String fileName, TypeReference typeReference public static T readFromFile(File file) { try { - return OBJECTMAPPER.readValue(file, new TypeReference<>() { - }); + return OBJECTMAPPER.readValue(file, new TypeReference<>() {}); } catch (Exception e) { throw new RuntimeException(e); } @@ -77,8 +74,7 @@ public static T readFromFile(File file, TypeReference typeReference) { public static T readFromString(String json) { try { - return OBJECTMAPPER.readValue(json, new TypeReference<>() { - }); + return OBJECTMAPPER.readValue(json, new TypeReference<>() {}); } catch (Exception e) { throw new RuntimeException(e); } @@ -115,5 +111,4 @@ public static String writeAsString(T obj) { throw new RuntimeException(e); } } - } diff --git a/bigtop-manager-common/src/main/java/org/apache/bigtop/manager/common/utils/NetUtils.java b/bigtop-manager-common/src/main/java/org/apache/bigtop/manager/common/utils/NetUtils.java index 92e985f7..2ef4cf93 100644 --- a/bigtop-manager-common/src/main/java/org/apache/bigtop/manager/common/utils/NetUtils.java +++ b/bigtop-manager-common/src/main/java/org/apache/bigtop/manager/common/utils/NetUtils.java @@ -60,5 +60,4 @@ private static InetAddress getLocalAddress() throws UnknownHostException { LOCAL_ADDRESS = InetAddress.getLocalHost(); return LOCAL_ADDRESS; } - } diff --git a/bigtop-manager-common/src/main/java/org/apache/bigtop/manager/common/utils/YamlUtils.java b/bigtop-manager-common/src/main/java/org/apache/bigtop/manager/common/utils/YamlUtils.java index 0f461d92..347cfd78 100644 --- a/bigtop-manager-common/src/main/java/org/apache/bigtop/manager/common/utils/YamlUtils.java +++ b/bigtop-manager-common/src/main/java/org/apache/bigtop/manager/common/utils/YamlUtils.java @@ -18,18 +18,18 @@ */ package org.apache.bigtop.manager.common.utils; -import java.io.BufferedReader; -import java.io.FileNotFoundException; -import java.io.FileReader; -import java.io.FileWriter; -import java.io.IOException; - import org.yaml.snakeyaml.DumperOptions; import org.yaml.snakeyaml.Yaml; import org.yaml.snakeyaml.representer.Representer; import lombok.extern.slf4j.Slf4j; +import java.io.BufferedReader; +import java.io.FileNotFoundException; +import java.io.FileReader; +import java.io.FileWriter; +import java.io.IOException; + @Slf4j public class YamlUtils { diff --git a/bigtop-manager-common/src/main/java/org/apache/bigtop/manager/common/utils/os/OSDetection.java b/bigtop-manager-common/src/main/java/org/apache/bigtop/manager/common/utils/os/OSDetection.java index be3de902..df29c860 100644 --- a/bigtop-manager-common/src/main/java/org/apache/bigtop/manager/common/utils/os/OSDetection.java +++ b/bigtop-manager-common/src/main/java/org/apache/bigtop/manager/common/utils/os/OSDetection.java @@ -26,6 +26,8 @@ import org.apache.commons.lang3.EnumUtils; import org.apache.commons.lang3.SystemUtils; +import lombok.extern.slf4j.Slf4j; + import java.io.File; import java.io.IOException; import java.util.ArrayList; @@ -33,8 +35,6 @@ import java.util.regex.Matcher; import java.util.regex.Pattern; -import lombok.extern.slf4j.Slf4j; - /** * This class is used for detecting the type and architecture of the operating system. *

@@ -131,7 +131,6 @@ private static String getOSRelease() { } catch (IOException e) { throw new RuntimeException(e); } - } private static String regexOS(Pattern pattern, String content) { diff --git a/bigtop-manager-common/src/main/java/org/apache/bigtop/manager/common/ws/AbstractBinaryWebSocketHandler.java b/bigtop-manager-common/src/main/java/org/apache/bigtop/manager/common/ws/AbstractBinaryWebSocketHandler.java index 3d44a1d3..0d4b8053 100644 --- a/bigtop-manager-common/src/main/java/org/apache/bigtop/manager/common/ws/AbstractBinaryWebSocketHandler.java +++ b/bigtop-manager-common/src/main/java/org/apache/bigtop/manager/common/ws/AbstractBinaryWebSocketHandler.java @@ -18,17 +18,19 @@ */ package org.apache.bigtop.manager.common.ws; -import jakarta.annotation.Resource; -import lombok.extern.slf4j.Slf4j; +import org.apache.bigtop.manager.common.message.entity.BaseMessage; import org.apache.bigtop.manager.common.message.entity.BaseRequestMessage; import org.apache.bigtop.manager.common.message.entity.BaseResponseMessage; import org.apache.bigtop.manager.common.message.serializer.MessageDeserializer; import org.apache.bigtop.manager.common.message.serializer.MessageSerializer; -import org.apache.bigtop.manager.common.message.entity.BaseMessage; + import org.springframework.web.socket.BinaryMessage; import org.springframework.web.socket.WebSocketSession; import org.springframework.web.socket.handler.BinaryWebSocketHandler; +import lombok.extern.slf4j.Slf4j; + +import jakarta.annotation.Resource; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.TimeUnit; @@ -45,7 +47,6 @@ public class AbstractBinaryWebSocketHandler extends BinaryWebSocketHandler { private final ConcurrentHashMap responses = new ConcurrentHashMap<>(); - protected void sendMessage(WebSocketSession session, BaseMessage message) { try { sendMessageWithRetry(session, message); diff --git a/bigtop-manager-dao/pom.xml b/bigtop-manager-dao/pom.xml index c324703a..f26dc14c 100644 --- a/bigtop-manager-dao/pom.xml +++ b/bigtop-manager-dao/pom.xml @@ -17,9 +17,7 @@ ~ specific language governing permissions and limitations ~ under the License. --> - - + 4.0.0 org.apache.bigtop diff --git a/bigtop-manager-dao/src/main/java/org/apache/bigtop/manager/dao/entity/AuditLog.java b/bigtop-manager-dao/src/main/java/org/apache/bigtop/manager/dao/entity/AuditLog.java index 7dacb7d4..c597fce6 100644 --- a/bigtop-manager-dao/src/main/java/org/apache/bigtop/manager/dao/entity/AuditLog.java +++ b/bigtop-manager-dao/src/main/java/org/apache/bigtop/manager/dao/entity/AuditLog.java @@ -18,6 +18,9 @@ */ package org.apache.bigtop.manager.dao.entity; +import lombok.Data; +import lombok.EqualsAndHashCode; + import jakarta.persistence.Basic; import jakarta.persistence.Column; import jakarta.persistence.Entity; @@ -29,14 +32,15 @@ import jakarta.persistence.Table; import jakarta.persistence.TableGenerator; -import lombok.Data; -import lombok.EqualsAndHashCode; - @Data @EqualsAndHashCode(callSuper = true) @Entity @Table(name = "audit_log") -@TableGenerator(name = "audit_log_generator", table = "sequence", pkColumnName = "seq_name", valueColumnName = "seq_count") +@TableGenerator( + name = "audit_log_generator", + table = "sequence", + pkColumnName = "seq_name", + valueColumnName = "seq_count") public class AuditLog extends BaseEntity { @Id @@ -66,5 +70,4 @@ public class AuditLog extends BaseEntity { @Column(name = "user_id") private Long userId; - } diff --git a/bigtop-manager-dao/src/main/java/org/apache/bigtop/manager/dao/entity/BaseEntity.java b/bigtop-manager-dao/src/main/java/org/apache/bigtop/manager/dao/entity/BaseEntity.java index 7f2dd03a..cbd3e026 100644 --- a/bigtop-manager-dao/src/main/java/org/apache/bigtop/manager/dao/entity/BaseEntity.java +++ b/bigtop-manager-dao/src/main/java/org/apache/bigtop/manager/dao/entity/BaseEntity.java @@ -18,12 +18,6 @@ */ package org.apache.bigtop.manager.dao.entity; -import java.sql.Timestamp; - -import jakarta.persistence.Column; -import jakarta.persistence.EntityListeners; -import jakarta.persistence.MappedSuperclass; - import org.springframework.data.annotation.CreatedBy; import org.springframework.data.annotation.CreatedDate; import org.springframework.data.annotation.LastModifiedBy; @@ -32,6 +26,11 @@ import lombok.Data; +import jakarta.persistence.Column; +import jakarta.persistence.EntityListeners; +import jakarta.persistence.MappedSuperclass; +import java.sql.Timestamp; + @Data @MappedSuperclass @EntityListeners(AuditingEntityListener.class) @@ -52,5 +51,4 @@ public abstract class BaseEntity { @LastModifiedBy @Column(name = "update_by") private Long updateBy; - } diff --git a/bigtop-manager-dao/src/main/java/org/apache/bigtop/manager/dao/entity/Cluster.java b/bigtop-manager-dao/src/main/java/org/apache/bigtop/manager/dao/entity/Cluster.java index f3adce01..e24348c5 100644 --- a/bigtop-manager-dao/src/main/java/org/apache/bigtop/manager/dao/entity/Cluster.java +++ b/bigtop-manager-dao/src/main/java/org/apache/bigtop/manager/dao/entity/Cluster.java @@ -20,6 +20,9 @@ import org.apache.bigtop.manager.common.enums.MaintainState; +import lombok.Data; +import lombok.EqualsAndHashCode; + import jakarta.persistence.Column; import jakarta.persistence.ConstraintMode; import jakarta.persistence.Entity; @@ -34,16 +37,22 @@ import jakarta.persistence.TableGenerator; import jakarta.persistence.UniqueConstraint; -import lombok.Data; -import lombok.EqualsAndHashCode; - @Data @EqualsAndHashCode(callSuper = true) @Entity -@Table(name = "\"cluster\"", uniqueConstraints = { - @UniqueConstraint(name = "uk_cluster_name", columnNames = {"cluster_name"})}, indexes = { - @Index(name = "idx_cluster_stack_id", columnList = "stack_id")}) -@TableGenerator(name = "cluster_generator", table = "sequence", pkColumnName = "seq_name", valueColumnName = "seq_count") +@Table( + name = "\"cluster\"", + uniqueConstraints = { + @UniqueConstraint( + name = "uk_cluster_name", + columnNames = {"cluster_name"}) + }, + indexes = {@Index(name = "idx_cluster_stack_id", columnList = "stack_id")}) +@TableGenerator( + name = "cluster_generator", + table = "sequence", + pkColumnName = "seq_name", + valueColumnName = "seq_count") public class Cluster extends BaseEntity { @Id diff --git a/bigtop-manager-dao/src/main/java/org/apache/bigtop/manager/dao/entity/CommandLog.java b/bigtop-manager-dao/src/main/java/org/apache/bigtop/manager/dao/entity/CommandLog.java index 224d5f05..728bbff8 100644 --- a/bigtop-manager-dao/src/main/java/org/apache/bigtop/manager/dao/entity/CommandLog.java +++ b/bigtop-manager-dao/src/main/java/org/apache/bigtop/manager/dao/entity/CommandLog.java @@ -18,6 +18,9 @@ */ package org.apache.bigtop.manager.dao.entity; +import lombok.Data; +import lombok.EqualsAndHashCode; + import jakarta.persistence.Basic; import jakarta.persistence.Column; import jakarta.persistence.ConstraintMode; @@ -34,16 +37,21 @@ import jakarta.persistence.Table; import jakarta.persistence.TableGenerator; -import lombok.Data; -import lombok.EqualsAndHashCode; - @Data @EqualsAndHashCode(callSuper = true) @Entity -@Table(name = "command_log", indexes = {@Index(name = "idx_cl_job_id", columnList = "job_id"), - @Index(name = "idx_cl_stage_id", columnList = "stage_id"), - @Index(name = "idx_cl_task_id", columnList = "task_id")}) -@TableGenerator(name = "command_log_generator", table = "sequence", pkColumnName = "seq_name", valueColumnName = "seq_count") +@Table( + name = "command_log", + indexes = { + @Index(name = "idx_cl_job_id", columnList = "job_id"), + @Index(name = "idx_cl_stage_id", columnList = "stage_id"), + @Index(name = "idx_cl_task_id", columnList = "task_id") + }) +@TableGenerator( + name = "command_log_generator", + table = "sequence", + pkColumnName = "seq_name", + valueColumnName = "seq_count") public class CommandLog extends BaseEntity { @Id @@ -70,5 +78,4 @@ public class CommandLog extends BaseEntity { @ManyToOne @JoinColumn(name = "task_id", foreignKey = @ForeignKey(ConstraintMode.NO_CONSTRAINT)) private Task task; - } diff --git a/bigtop-manager-dao/src/main/java/org/apache/bigtop/manager/dao/entity/Component.java b/bigtop-manager-dao/src/main/java/org/apache/bigtop/manager/dao/entity/Component.java index 4c19bf88..e7597e5f 100644 --- a/bigtop-manager-dao/src/main/java/org/apache/bigtop/manager/dao/entity/Component.java +++ b/bigtop-manager-dao/src/main/java/org/apache/bigtop/manager/dao/entity/Component.java @@ -18,6 +18,9 @@ */ package org.apache.bigtop.manager.dao.entity; +import lombok.Data; +import lombok.EqualsAndHashCode; + import jakarta.persistence.Basic; import jakarta.persistence.Column; import jakarta.persistence.ConstraintMode; @@ -35,17 +38,25 @@ import jakarta.persistence.TableGenerator; import jakarta.persistence.UniqueConstraint; -import lombok.Data; -import lombok.EqualsAndHashCode; - @Data @EqualsAndHashCode(callSuper = true) @Entity -@Table(name = "component", uniqueConstraints = { - @UniqueConstraint(name = "uk_component_name", columnNames = {"component_name", "cluster_id"})}, indexes = { - @Index(name = "idx_component_cluster_id", columnList = "cluster_id"), - @Index(name = "idx_component_service_id", columnList = "service_id")}) -@TableGenerator(name = "component_generator", table = "sequence", pkColumnName = "seq_name", valueColumnName = "seq_count") +@Table( + name = "component", + uniqueConstraints = { + @UniqueConstraint( + name = "uk_component_name", + columnNames = {"component_name", "cluster_id"}) + }, + indexes = { + @Index(name = "idx_component_cluster_id", columnList = "cluster_id"), + @Index(name = "idx_component_service_id", columnList = "service_id") + }) +@TableGenerator( + name = "component_generator", + table = "sequence", + pkColumnName = "seq_name", + valueColumnName = "seq_count") public class Component extends BaseEntity { @Id diff --git a/bigtop-manager-dao/src/main/java/org/apache/bigtop/manager/dao/entity/Host.java b/bigtop-manager-dao/src/main/java/org/apache/bigtop/manager/dao/entity/Host.java index 2cf5ad2f..3ef8a012 100644 --- a/bigtop-manager-dao/src/main/java/org/apache/bigtop/manager/dao/entity/Host.java +++ b/bigtop-manager-dao/src/main/java/org/apache/bigtop/manager/dao/entity/Host.java @@ -20,6 +20,9 @@ import org.apache.bigtop.manager.common.enums.MaintainState; +import lombok.Data; +import lombok.EqualsAndHashCode; + import jakarta.persistence.Column; import jakarta.persistence.ConstraintMode; import jakarta.persistence.Entity; @@ -34,15 +37,17 @@ import jakarta.persistence.TableGenerator; import jakarta.persistence.UniqueConstraint; -import lombok.Data; -import lombok.EqualsAndHashCode; - @Data @EqualsAndHashCode(callSuper = true) @Entity -@Table(name = "host", uniqueConstraints = { - @UniqueConstraint(name = "uk_hostname", columnNames = {"hostname", "cluster_id"})}, indexes = { - @Index(name = "idx_host_cluster_id", columnList = "cluster_id")}) +@Table( + name = "host", + uniqueConstraints = { + @UniqueConstraint( + name = "uk_hostname", + columnNames = {"hostname", "cluster_id"}) + }, + indexes = {@Index(name = "idx_host_cluster_id", columnList = "cluster_id")}) @TableGenerator(name = "host_generator", table = "sequence", pkColumnName = "seq_name", valueColumnName = "seq_count") public class Host extends BaseEntity { @@ -87,5 +92,4 @@ public class Host extends BaseEntity { @ManyToOne @JoinColumn(name = "cluster_id", foreignKey = @ForeignKey(ConstraintMode.NO_CONSTRAINT)) private Cluster cluster; - } diff --git a/bigtop-manager-dao/src/main/java/org/apache/bigtop/manager/dao/entity/HostComponent.java b/bigtop-manager-dao/src/main/java/org/apache/bigtop/manager/dao/entity/HostComponent.java index 5a2de6cb..95841850 100644 --- a/bigtop-manager-dao/src/main/java/org/apache/bigtop/manager/dao/entity/HostComponent.java +++ b/bigtop-manager-dao/src/main/java/org/apache/bigtop/manager/dao/entity/HostComponent.java @@ -20,6 +20,9 @@ import org.apache.bigtop.manager.common.enums.MaintainState; +import lombok.Data; +import lombok.EqualsAndHashCode; + import jakarta.persistence.Column; import jakarta.persistence.ConstraintMode; import jakarta.persistence.Entity; @@ -33,16 +36,20 @@ import jakarta.persistence.Table; import jakarta.persistence.TableGenerator; -import lombok.Data; -import lombok.EqualsAndHashCode; - @Data @EqualsAndHashCode(callSuper = true) @Entity -@Table(name = "host_component", indexes = { - @Index(name = "idx_hc_component_id", columnList = "component_id"), - @Index(name = "idx_hc_host_id", columnList = "host_id")}) -@TableGenerator(name = "host_component_generator", table = "sequence", pkColumnName = "seq_name", valueColumnName = "seq_count") +@Table( + name = "host_component", + indexes = { + @Index(name = "idx_hc_component_id", columnList = "component_id"), + @Index(name = "idx_hc_host_id", columnList = "host_id") + }) +@TableGenerator( + name = "host_component_generator", + table = "sequence", + pkColumnName = "seq_name", + valueColumnName = "seq_count") public class HostComponent extends BaseEntity { @Id diff --git a/bigtop-manager-dao/src/main/java/org/apache/bigtop/manager/dao/entity/Job.java b/bigtop-manager-dao/src/main/java/org/apache/bigtop/manager/dao/entity/Job.java index 30e1d039..e161f891 100644 --- a/bigtop-manager-dao/src/main/java/org/apache/bigtop/manager/dao/entity/Job.java +++ b/bigtop-manager-dao/src/main/java/org/apache/bigtop/manager/dao/entity/Job.java @@ -20,7 +20,9 @@ import org.apache.bigtop.manager.common.enums.JobState; -import java.util.List; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.ToString; import jakarta.persistence.Basic; import jakarta.persistence.Column; @@ -38,15 +40,14 @@ import jakarta.persistence.OneToMany; import jakarta.persistence.Table; import jakarta.persistence.TableGenerator; - -import lombok.Data; -import lombok.EqualsAndHashCode; -import lombok.ToString; +import java.util.List; @Data @EqualsAndHashCode(callSuper = true) @Entity -@Table(name = "\"job\"", indexes = {@Index(name = "idx_job_cluster_id", columnList = "cluster_id")}) +@Table( + name = "\"job\"", + indexes = {@Index(name = "idx_job_cluster_id", columnList = "cluster_id")}) @TableGenerator(name = "job_generator", table = "sequence", pkColumnName = "seq_name", valueColumnName = "seq_count") public class Job extends BaseEntity { diff --git a/bigtop-manager-dao/src/main/java/org/apache/bigtop/manager/dao/entity/Repo.java b/bigtop-manager-dao/src/main/java/org/apache/bigtop/manager/dao/entity/Repo.java index 560590cb..e1cf8097 100644 --- a/bigtop-manager-dao/src/main/java/org/apache/bigtop/manager/dao/entity/Repo.java +++ b/bigtop-manager-dao/src/main/java/org/apache/bigtop/manager/dao/entity/Repo.java @@ -18,6 +18,9 @@ */ package org.apache.bigtop.manager.dao.entity; +import lombok.Data; +import lombok.EqualsAndHashCode; + import jakarta.persistence.Column; import jakarta.persistence.ConstraintMode; import jakarta.persistence.Entity; @@ -32,15 +35,17 @@ import jakarta.persistence.TableGenerator; import jakarta.persistence.UniqueConstraint; -import lombok.Data; -import lombok.EqualsAndHashCode; - @Data @EqualsAndHashCode(callSuper = true) @Entity -@Table(name = "repo", uniqueConstraints = { - @UniqueConstraint(name = "uk_repo_id", columnNames = {"repo_id", "os", "arch", "cluster_id"})}, indexes = { - @Index(name = "idx_repo_cluster_id", columnList = "cluster_id")}) +@Table( + name = "repo", + uniqueConstraints = { + @UniqueConstraint( + name = "uk_repo_id", + columnNames = {"repo_id", "os", "arch", "cluster_id"}) + }, + indexes = {@Index(name = "idx_repo_cluster_id", columnList = "cluster_id")}) @TableGenerator(name = "repo_generator", table = "sequence", pkColumnName = "seq_name", valueColumnName = "seq_count") public class Repo extends BaseEntity { diff --git a/bigtop-manager-dao/src/main/java/org/apache/bigtop/manager/dao/entity/Service.java b/bigtop-manager-dao/src/main/java/org/apache/bigtop/manager/dao/entity/Service.java index bb31a6cc..af9bcd83 100644 --- a/bigtop-manager-dao/src/main/java/org/apache/bigtop/manager/dao/entity/Service.java +++ b/bigtop-manager-dao/src/main/java/org/apache/bigtop/manager/dao/entity/Service.java @@ -18,6 +18,9 @@ */ package org.apache.bigtop.manager.dao.entity; +import lombok.Data; +import lombok.EqualsAndHashCode; + import jakarta.persistence.Column; import jakarta.persistence.ConstraintMode; import jakarta.persistence.Entity; @@ -32,16 +35,22 @@ import jakarta.persistence.TableGenerator; import jakarta.persistence.UniqueConstraint; -import lombok.Data; -import lombok.EqualsAndHashCode; - @Data @EqualsAndHashCode(callSuper = true) @Entity -@Table(name = "service", uniqueConstraints = { - @UniqueConstraint(name = "uk_service_name", columnNames = {"service_name", "cluster_id"})}, indexes = { - @Index(name = "idx_service_cluster_id", columnList = "cluster_id")}) -@TableGenerator(name = "service_generator", table = "sequence", pkColumnName = "seq_name", valueColumnName = "seq_count") +@Table( + name = "service", + uniqueConstraints = { + @UniqueConstraint( + name = "uk_service_name", + columnNames = {"service_name", "cluster_id"}) + }, + indexes = {@Index(name = "idx_service_cluster_id", columnList = "cluster_id")}) +@TableGenerator( + name = "service_generator", + table = "sequence", + pkColumnName = "seq_name", + valueColumnName = "seq_count") public class Service extends BaseEntity { @Id diff --git a/bigtop-manager-dao/src/main/java/org/apache/bigtop/manager/dao/entity/ServiceConfig.java b/bigtop-manager-dao/src/main/java/org/apache/bigtop/manager/dao/entity/ServiceConfig.java index 671d686e..7048fd19 100644 --- a/bigtop-manager-dao/src/main/java/org/apache/bigtop/manager/dao/entity/ServiceConfig.java +++ b/bigtop-manager-dao/src/main/java/org/apache/bigtop/manager/dao/entity/ServiceConfig.java @@ -18,7 +18,9 @@ */ package org.apache.bigtop.manager.dao.entity; -import java.util.List; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.ToString; import jakarta.persistence.Column; import jakarta.persistence.ConstraintMode; @@ -33,17 +35,22 @@ import jakarta.persistence.OneToMany; import jakarta.persistence.Table; import jakarta.persistence.TableGenerator; - -import lombok.Data; -import lombok.EqualsAndHashCode; -import lombok.ToString; +import java.util.List; @Data @EqualsAndHashCode(callSuper = true) @Entity -@Table(name = "service_config", indexes = {@Index(name = "idx_sc_cluster_id", columnList = "cluster_id"), - @Index(name = "idx_sc_service_id", columnList = "service_id")}) -@TableGenerator(name = "service_config_generator", table = "sequence", pkColumnName = "seq_name", valueColumnName = "seq_count") +@Table( + name = "service_config", + indexes = { + @Index(name = "idx_sc_cluster_id", columnList = "cluster_id"), + @Index(name = "idx_sc_service_id", columnList = "service_id") + }) +@TableGenerator( + name = "service_config_generator", + table = "sequence", + pkColumnName = "seq_name", + valueColumnName = "seq_count") public class ServiceConfig extends BaseEntity { @Id @@ -71,5 +78,4 @@ public class ServiceConfig extends BaseEntity { @ManyToOne @JoinColumn(name = "cluster_id", foreignKey = @ForeignKey(ConstraintMode.NO_CONSTRAINT)) private Cluster cluster; - } diff --git a/bigtop-manager-dao/src/main/java/org/apache/bigtop/manager/dao/entity/Setting.java b/bigtop-manager-dao/src/main/java/org/apache/bigtop/manager/dao/entity/Setting.java index 2f565946..609f3bce 100644 --- a/bigtop-manager-dao/src/main/java/org/apache/bigtop/manager/dao/entity/Setting.java +++ b/bigtop-manager-dao/src/main/java/org/apache/bigtop/manager/dao/entity/Setting.java @@ -18,6 +18,9 @@ */ package org.apache.bigtop.manager.dao.entity; +import lombok.Data; +import lombok.EqualsAndHashCode; + import jakarta.persistence.Basic; import jakarta.persistence.Column; import jakarta.persistence.Entity; @@ -29,14 +32,15 @@ import jakarta.persistence.Table; import jakarta.persistence.TableGenerator; -import lombok.Data; -import lombok.EqualsAndHashCode; - @Data @EqualsAndHashCode(callSuper = true) @Entity @Table(name = "setting") -@TableGenerator(name = "settings_generator", table = "sequence", pkColumnName = "seq_name", valueColumnName = "seq_count") +@TableGenerator( + name = "settings_generator", + table = "sequence", + pkColumnName = "seq_name", + valueColumnName = "seq_count") public class Setting extends BaseEntity { @Id diff --git a/bigtop-manager-dao/src/main/java/org/apache/bigtop/manager/dao/entity/Stack.java b/bigtop-manager-dao/src/main/java/org/apache/bigtop/manager/dao/entity/Stack.java index 54df47f0..fad9c22e 100644 --- a/bigtop-manager-dao/src/main/java/org/apache/bigtop/manager/dao/entity/Stack.java +++ b/bigtop-manager-dao/src/main/java/org/apache/bigtop/manager/dao/entity/Stack.java @@ -18,6 +18,9 @@ */ package org.apache.bigtop.manager.dao.entity; +import lombok.Data; +import lombok.EqualsAndHashCode; + import jakarta.persistence.Column; import jakarta.persistence.Entity; import jakarta.persistence.GeneratedValue; @@ -27,14 +30,16 @@ import jakarta.persistence.TableGenerator; import jakarta.persistence.UniqueConstraint; -import lombok.Data; -import lombok.EqualsAndHashCode; - @Data @EqualsAndHashCode(callSuper = true) @Entity -@Table(name = "stack", uniqueConstraints = { - @UniqueConstraint(name = "uk_stack", columnNames = {"stack_name", "stack_version"})}) +@Table( + name = "stack", + uniqueConstraints = { + @UniqueConstraint( + name = "uk_stack", + columnNames = {"stack_name", "stack_version"}) + }) @TableGenerator(name = "stack_generator", table = "sequence", pkColumnName = "seq_name", valueColumnName = "seq_count") public class Stack extends BaseEntity { @@ -48,5 +53,4 @@ public class Stack extends BaseEntity { @Column(name = "stack_version") private String stackVersion; - } diff --git a/bigtop-manager-dao/src/main/java/org/apache/bigtop/manager/dao/entity/Stage.java b/bigtop-manager-dao/src/main/java/org/apache/bigtop/manager/dao/entity/Stage.java index bdeb6c12..9f9a4478 100644 --- a/bigtop-manager-dao/src/main/java/org/apache/bigtop/manager/dao/entity/Stage.java +++ b/bigtop-manager-dao/src/main/java/org/apache/bigtop/manager/dao/entity/Stage.java @@ -20,7 +20,9 @@ import org.apache.bigtop.manager.common.enums.JobState; -import java.util.List; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.ToString; import jakarta.persistence.Basic; import jakarta.persistence.Column; @@ -38,16 +40,17 @@ import jakarta.persistence.OneToMany; import jakarta.persistence.Table; import jakarta.persistence.TableGenerator; - -import lombok.Data; -import lombok.EqualsAndHashCode; -import lombok.ToString; +import java.util.List; @Data @EqualsAndHashCode(callSuper = true) @Entity -@Table(name = "stage", indexes = {@Index(name = "idx_stage_cluster_id", columnList = "cluster_id"), - @Index(name = "idx_stage_job_id", columnList = "job_id")}) +@Table( + name = "stage", + indexes = { + @Index(name = "idx_stage_cluster_id", columnList = "cluster_id"), + @Index(name = "idx_stage_job_id", columnList = "job_id") + }) @TableGenerator(name = "stage_generator", table = "sequence", pkColumnName = "seq_name", valueColumnName = "seq_count") public class Stage extends BaseEntity { diff --git a/bigtop-manager-dao/src/main/java/org/apache/bigtop/manager/dao/entity/Task.java b/bigtop-manager-dao/src/main/java/org/apache/bigtop/manager/dao/entity/Task.java index c62109da..fb505d12 100644 --- a/bigtop-manager-dao/src/main/java/org/apache/bigtop/manager/dao/entity/Task.java +++ b/bigtop-manager-dao/src/main/java/org/apache/bigtop/manager/dao/entity/Task.java @@ -21,6 +21,9 @@ import org.apache.bigtop.manager.common.enums.Command; import org.apache.bigtop.manager.common.enums.JobState; +import lombok.Data; +import lombok.EqualsAndHashCode; + import jakarta.persistence.Basic; import jakarta.persistence.Column; import jakarta.persistence.ConstraintMode; @@ -37,16 +40,16 @@ import jakarta.persistence.Table; import jakarta.persistence.TableGenerator; -import lombok.Data; -import lombok.EqualsAndHashCode; - @Data @EqualsAndHashCode(callSuper = true) @Entity -@Table(name = "\"task\"", indexes = { - @Index(name = "idx_task_cluster_id", columnList = "cluster_id"), - @Index(name = "idx_task_job_id", columnList = "job_id"), - @Index(name = "idx_task_stage_id", columnList = "stage_id")}) +@Table( + name = "\"task\"", + indexes = { + @Index(name = "idx_task_cluster_id", columnList = "cluster_id"), + @Index(name = "idx_task_job_id", columnList = "job_id"), + @Index(name = "idx_task_stage_id", columnList = "stage_id") + }) @TableGenerator(name = "task_generator", table = "sequence", pkColumnName = "seq_name", valueColumnName = "seq_count") public class Task extends BaseEntity { diff --git a/bigtop-manager-dao/src/main/java/org/apache/bigtop/manager/dao/entity/TypeConfig.java b/bigtop-manager-dao/src/main/java/org/apache/bigtop/manager/dao/entity/TypeConfig.java index e6502211..a1cd5478 100644 --- a/bigtop-manager-dao/src/main/java/org/apache/bigtop/manager/dao/entity/TypeConfig.java +++ b/bigtop-manager-dao/src/main/java/org/apache/bigtop/manager/dao/entity/TypeConfig.java @@ -18,6 +18,9 @@ */ package org.apache.bigtop.manager.dao.entity; +import lombok.Data; +import lombok.EqualsAndHashCode; + import jakarta.persistence.Basic; import jakarta.persistence.Column; import jakarta.persistence.ConstraintMode; @@ -33,14 +36,15 @@ import jakarta.persistence.Table; import jakarta.persistence.TableGenerator; -import lombok.Data; -import lombok.EqualsAndHashCode; - @Data @EqualsAndHashCode(callSuper = true) @Entity @Table(name = "type_config") -@TableGenerator(name = "type_config_generator", table = "sequence", pkColumnName = "seq_name", valueColumnName = "seq_count") +@TableGenerator( + name = "type_config_generator", + table = "sequence", + pkColumnName = "seq_name", + valueColumnName = "seq_count") public class TypeConfig extends BaseEntity { @Id diff --git a/bigtop-manager-dao/src/main/java/org/apache/bigtop/manager/dao/entity/User.java b/bigtop-manager-dao/src/main/java/org/apache/bigtop/manager/dao/entity/User.java index 2c4fc244..6ea1c6ea 100644 --- a/bigtop-manager-dao/src/main/java/org/apache/bigtop/manager/dao/entity/User.java +++ b/bigtop-manager-dao/src/main/java/org/apache/bigtop/manager/dao/entity/User.java @@ -18,6 +18,9 @@ */ package org.apache.bigtop.manager.dao.entity; +import lombok.Data; +import lombok.EqualsAndHashCode; + import jakarta.persistence.Column; import jakarta.persistence.Entity; import jakarta.persistence.GeneratedValue; @@ -26,9 +29,6 @@ import jakarta.persistence.Table; import jakarta.persistence.TableGenerator; -import lombok.Data; -import lombok.EqualsAndHashCode; - @Data @EqualsAndHashCode(callSuper = true) @Entity @@ -52,5 +52,4 @@ public class User extends BaseEntity { @Column(name = "status") private Boolean status; - } diff --git a/bigtop-manager-dao/src/main/java/org/apache/bigtop/manager/dao/repository/AuditLogRepository.java b/bigtop-manager-dao/src/main/java/org/apache/bigtop/manager/dao/repository/AuditLogRepository.java index a807731c..5b3f8482 100644 --- a/bigtop-manager-dao/src/main/java/org/apache/bigtop/manager/dao/repository/AuditLogRepository.java +++ b/bigtop-manager-dao/src/main/java/org/apache/bigtop/manager/dao/repository/AuditLogRepository.java @@ -22,5 +22,4 @@ import org.springframework.data.jpa.repository.JpaRepository; -public interface AuditLogRepository extends JpaRepository { -} +public interface AuditLogRepository extends JpaRepository {} diff --git a/bigtop-manager-dao/src/main/java/org/apache/bigtop/manager/dao/repository/ClusterRepository.java b/bigtop-manager-dao/src/main/java/org/apache/bigtop/manager/dao/repository/ClusterRepository.java index cc374d82..922b8362 100644 --- a/bigtop-manager-dao/src/main/java/org/apache/bigtop/manager/dao/repository/ClusterRepository.java +++ b/bigtop-manager-dao/src/main/java/org/apache/bigtop/manager/dao/repository/ClusterRepository.java @@ -20,12 +20,11 @@ import org.apache.bigtop.manager.dao.entity.Cluster; -import java.util.Optional; - import org.springframework.data.jpa.repository.JpaRepository; +import java.util.Optional; + public interface ClusterRepository extends JpaRepository { Optional findByClusterName(String clusterName); - } diff --git a/bigtop-manager-dao/src/main/java/org/apache/bigtop/manager/dao/repository/ComponentRepository.java b/bigtop-manager-dao/src/main/java/org/apache/bigtop/manager/dao/repository/ComponentRepository.java index 98053741..9566c2b7 100644 --- a/bigtop-manager-dao/src/main/java/org/apache/bigtop/manager/dao/repository/ComponentRepository.java +++ b/bigtop-manager-dao/src/main/java/org/apache/bigtop/manager/dao/repository/ComponentRepository.java @@ -20,10 +20,10 @@ import org.apache.bigtop.manager.dao.entity.Component; -import java.util.List; - import org.springframework.data.jpa.repository.JpaRepository; +import java.util.List; + public interface ComponentRepository extends JpaRepository { Component findByClusterIdAndComponentName(Long clusterId, String componentName); diff --git a/bigtop-manager-dao/src/main/java/org/apache/bigtop/manager/dao/repository/HostComponentRepository.java b/bigtop-manager-dao/src/main/java/org/apache/bigtop/manager/dao/repository/HostComponentRepository.java index ab537a0d..1e7bd49f 100644 --- a/bigtop-manager-dao/src/main/java/org/apache/bigtop/manager/dao/repository/HostComponentRepository.java +++ b/bigtop-manager-dao/src/main/java/org/apache/bigtop/manager/dao/repository/HostComponentRepository.java @@ -20,20 +20,19 @@ import org.apache.bigtop.manager.dao.entity.HostComponent; -import java.util.List; - import org.springframework.data.jpa.repository.JpaRepository; +import java.util.List; + public interface HostComponentRepository extends JpaRepository { List findAllByComponentClusterIdAndComponentComponentName(Long clusterId, String componentName); - HostComponent findByComponentClusterIdAndComponentComponentNameAndHostHostname(Long clusterId, String componentName, - String hostnames); + HostComponent findByComponentClusterIdAndComponentComponentNameAndHostHostname( + Long clusterId, String componentName, String hostnames); - List findAllByComponentClusterIdAndComponentComponentNameAndHostHostnameIn(Long clusterId, - String componentName, - List hostnames); + List findAllByComponentClusterIdAndComponentComponentNameAndHostHostnameIn( + Long clusterId, String componentName, List hostnames); List findAllByComponentClusterId(Long clusterId); diff --git a/bigtop-manager-dao/src/main/java/org/apache/bigtop/manager/dao/repository/HostRepository.java b/bigtop-manager-dao/src/main/java/org/apache/bigtop/manager/dao/repository/HostRepository.java index 2714df11..6ce99ae4 100644 --- a/bigtop-manager-dao/src/main/java/org/apache/bigtop/manager/dao/repository/HostRepository.java +++ b/bigtop-manager-dao/src/main/java/org/apache/bigtop/manager/dao/repository/HostRepository.java @@ -20,13 +20,13 @@ import org.apache.bigtop.manager.dao.entity.Host; -import java.util.Collection; -import java.util.List; - import org.springframework.data.domain.Page; import org.springframework.data.domain.Pageable; import org.springframework.data.jpa.repository.JpaRepository; +import java.util.Collection; +import java.util.List; + public interface HostRepository extends JpaRepository { Host findByHostname(String hostname); @@ -40,5 +40,4 @@ public interface HostRepository extends JpaRepository { Page findAllByClusterId(Long clusterId, Pageable pageable); List findAllByClusterClusterName(String clusterName); - } diff --git a/bigtop-manager-dao/src/main/java/org/apache/bigtop/manager/dao/repository/JobRepository.java b/bigtop-manager-dao/src/main/java/org/apache/bigtop/manager/dao/repository/JobRepository.java index f54f4416..44d4f1fc 100644 --- a/bigtop-manager-dao/src/main/java/org/apache/bigtop/manager/dao/repository/JobRepository.java +++ b/bigtop-manager-dao/src/main/java/org/apache/bigtop/manager/dao/repository/JobRepository.java @@ -20,12 +20,12 @@ import org.apache.bigtop.manager.dao.entity.Job; -import java.util.List; - import org.springframework.data.domain.Page; import org.springframework.data.domain.Pageable; import org.springframework.data.jpa.repository.JpaRepository; +import java.util.List; + public interface JobRepository extends JpaRepository { Page findAllByClusterIsNull(Pageable pageable); diff --git a/bigtop-manager-dao/src/main/java/org/apache/bigtop/manager/dao/repository/RepoRepository.java b/bigtop-manager-dao/src/main/java/org/apache/bigtop/manager/dao/repository/RepoRepository.java index 6898569e..ef8f0911 100644 --- a/bigtop-manager-dao/src/main/java/org/apache/bigtop/manager/dao/repository/RepoRepository.java +++ b/bigtop-manager-dao/src/main/java/org/apache/bigtop/manager/dao/repository/RepoRepository.java @@ -21,10 +21,10 @@ import org.apache.bigtop.manager.dao.entity.Cluster; import org.apache.bigtop.manager.dao.entity.Repo; -import java.util.List; - import org.springframework.data.jpa.repository.JpaRepository; +import java.util.List; + public interface RepoRepository extends JpaRepository { List findAllByCluster(Cluster cluster); diff --git a/bigtop-manager-dao/src/main/java/org/apache/bigtop/manager/dao/repository/ServiceConfigRepository.java b/bigtop-manager-dao/src/main/java/org/apache/bigtop/manager/dao/repository/ServiceConfigRepository.java index 909568ea..663e6bcb 100644 --- a/bigtop-manager-dao/src/main/java/org/apache/bigtop/manager/dao/repository/ServiceConfigRepository.java +++ b/bigtop-manager-dao/src/main/java/org/apache/bigtop/manager/dao/repository/ServiceConfigRepository.java @@ -22,14 +22,14 @@ import org.apache.bigtop.manager.dao.entity.Service; import org.apache.bigtop.manager.dao.entity.ServiceConfig; -import java.util.List; - import org.springframework.data.domain.Sort; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.Modifying; import org.springframework.data.jpa.repository.Query; import org.springframework.transaction.annotation.Transactional; +import java.util.List; + public interface ServiceConfigRepository extends JpaRepository { List findAllByCluster(Cluster cluster); diff --git a/bigtop-manager-dao/src/main/java/org/apache/bigtop/manager/dao/repository/ServiceRepository.java b/bigtop-manager-dao/src/main/java/org/apache/bigtop/manager/dao/repository/ServiceRepository.java index d68394a9..fb84d831 100644 --- a/bigtop-manager-dao/src/main/java/org/apache/bigtop/manager/dao/repository/ServiceRepository.java +++ b/bigtop-manager-dao/src/main/java/org/apache/bigtop/manager/dao/repository/ServiceRepository.java @@ -20,12 +20,12 @@ import org.apache.bigtop.manager.dao.entity.Service; -import java.util.List; - import org.springframework.data.domain.Page; import org.springframework.data.domain.Pageable; import org.springframework.data.jpa.repository.JpaRepository; +import java.util.List; + public interface ServiceRepository extends JpaRepository { List findAllByClusterId(Long clusterId); @@ -35,5 +35,4 @@ public interface ServiceRepository extends JpaRepository { Service findByClusterIdAndServiceName(Long clusterId, String serviceName); List findByClusterIdAndServiceNameIn(Long clusterId, List serviceNames); - } diff --git a/bigtop-manager-dao/src/main/java/org/apache/bigtop/manager/dao/repository/SettingRepository.java b/bigtop-manager-dao/src/main/java/org/apache/bigtop/manager/dao/repository/SettingRepository.java index 96b1049a..ac1671e9 100644 --- a/bigtop-manager-dao/src/main/java/org/apache/bigtop/manager/dao/repository/SettingRepository.java +++ b/bigtop-manager-dao/src/main/java/org/apache/bigtop/manager/dao/repository/SettingRepository.java @@ -22,6 +22,4 @@ import org.springframework.data.jpa.repository.JpaRepository; -public interface SettingRepository extends JpaRepository { - -} +public interface SettingRepository extends JpaRepository {} diff --git a/bigtop-manager-dao/src/main/java/org/apache/bigtop/manager/dao/repository/StageRepository.java b/bigtop-manager-dao/src/main/java/org/apache/bigtop/manager/dao/repository/StageRepository.java index 07ff6405..c11ffd6e 100644 --- a/bigtop-manager-dao/src/main/java/org/apache/bigtop/manager/dao/repository/StageRepository.java +++ b/bigtop-manager-dao/src/main/java/org/apache/bigtop/manager/dao/repository/StageRepository.java @@ -21,10 +21,10 @@ import org.apache.bigtop.manager.dao.entity.Job; import org.apache.bigtop.manager.dao.entity.Stage; -import java.util.List; - import org.springframework.data.jpa.repository.JpaRepository; +import java.util.List; + public interface StageRepository extends JpaRepository { List findByJob(Job job); diff --git a/bigtop-manager-dao/src/main/java/org/apache/bigtop/manager/dao/repository/TaskRepository.java b/bigtop-manager-dao/src/main/java/org/apache/bigtop/manager/dao/repository/TaskRepository.java index 16107540..b8f0bb8d 100644 --- a/bigtop-manager-dao/src/main/java/org/apache/bigtop/manager/dao/repository/TaskRepository.java +++ b/bigtop-manager-dao/src/main/java/org/apache/bigtop/manager/dao/repository/TaskRepository.java @@ -22,10 +22,10 @@ import org.apache.bigtop.manager.dao.entity.Stage; import org.apache.bigtop.manager.dao.entity.Task; -import java.util.List; - import org.springframework.data.jpa.repository.JpaRepository; +import java.util.List; + public interface TaskRepository extends JpaRepository { List findByStage(Stage stage); @@ -35,5 +35,4 @@ public interface TaskRepository extends JpaRepository { List findAllByJobIdAndState(Long jobId, JobState state); List findAllByJobIdAndHostnameAndState(Long jobId, String hostname, JobState state); - } diff --git a/bigtop-manager-dao/src/main/java/org/apache/bigtop/manager/dao/repository/TypeConfigRepository.java b/bigtop-manager-dao/src/main/java/org/apache/bigtop/manager/dao/repository/TypeConfigRepository.java index 91b61c71..90145cfa 100644 --- a/bigtop-manager-dao/src/main/java/org/apache/bigtop/manager/dao/repository/TypeConfigRepository.java +++ b/bigtop-manager-dao/src/main/java/org/apache/bigtop/manager/dao/repository/TypeConfigRepository.java @@ -22,6 +22,4 @@ import org.springframework.data.jpa.repository.JpaRepository; -public interface TypeConfigRepository extends JpaRepository { - -} +public interface TypeConfigRepository extends JpaRepository {} diff --git a/bigtop-manager-server/pom.xml b/bigtop-manager-server/pom.xml index 80e5d012..0a16c6de 100644 --- a/bigtop-manager-server/pom.xml +++ b/bigtop-manager-server/pom.xml @@ -17,9 +17,7 @@ ~ specific language governing permissions and limitations ~ under the License. --> - - + 4.0.0 org.apache.bigtop diff --git a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/ServerApplication.java b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/ServerApplication.java index 4cc8f8f8..44ed5b71 100644 --- a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/ServerApplication.java +++ b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/ServerApplication.java @@ -37,5 +37,4 @@ public class ServerApplication { public static void main(String[] args) { SpringApplication.run(ServerApplication.class, args); } - } diff --git a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/annotations/Audit.java b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/annotations/Audit.java index 6aa6fdd4..3facb1e4 100644 --- a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/annotations/Audit.java +++ b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/annotations/Audit.java @@ -25,5 +25,4 @@ @Retention(RetentionPolicy.RUNTIME) @Target(value = {ElementType.METHOD}) -public @interface Audit { -} +public @interface Audit {} diff --git a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/aop/AuditAspect.java b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/aop/AuditAspect.java index 168121b7..55473219 100644 --- a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/aop/AuditAspect.java +++ b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/aop/AuditAspect.java @@ -23,9 +23,6 @@ import org.apache.bigtop.manager.dao.repository.AuditLogRepository; import org.apache.bigtop.manager.server.holder.SessionUserHolder; -import jakarta.annotation.Resource; -import jakarta.servlet.http.HttpServletRequest; - import org.aspectj.lang.JoinPoint; import org.aspectj.lang.annotation.Aspect; import org.aspectj.lang.annotation.Before; @@ -38,6 +35,9 @@ import io.swagger.v3.oas.annotations.tags.Tag; import lombok.extern.slf4j.Slf4j; +import jakarta.annotation.Resource; +import jakarta.servlet.http.HttpServletRequest; + @Slf4j @Aspect @Configuration @@ -92,5 +92,4 @@ public void before(JoinPoint joinPoint) { auditLogRepository.save(auditLog); } } - } diff --git a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/command/job/factory/AbstractJobFactory.java b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/command/job/factory/AbstractJobFactory.java index c10368bb..1d6203a3 100644 --- a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/command/job/factory/AbstractJobFactory.java +++ b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/command/job/factory/AbstractJobFactory.java @@ -29,11 +29,10 @@ import org.apache.bigtop.manager.dao.repository.StageRepository; import org.apache.bigtop.manager.dao.repository.TaskRepository; +import jakarta.annotation.Resource; import java.util.ArrayList; import java.util.List; -import jakarta.annotation.Resource; - public abstract class AbstractJobFactory implements JobFactory { @Resource diff --git a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/command/job/factory/JobFactories.java b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/command/job/factory/JobFactories.java index cdb9e755..9fb1230e 100644 --- a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/command/job/factory/JobFactories.java +++ b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/command/job/factory/JobFactories.java @@ -23,12 +23,12 @@ import org.apache.bigtop.manager.server.exception.ApiException; import org.apache.bigtop.manager.server.holder.SpringContextHolder; +import lombok.extern.slf4j.Slf4j; + import java.util.HashMap; import java.util.Map; import java.util.concurrent.atomic.AtomicBoolean; -import lombok.extern.slf4j.Slf4j; - @Slf4j public class JobFactories { @@ -42,7 +42,9 @@ public static JobFactory getJobFactory(CommandIdentifier identifier) { } if (!JOB_FACTORIES.containsKey(identifier)) { - throw new ApiException(ApiExceptionEnum.COMMAND_NOT_SUPPORTED, identifier.getCommand().name().toLowerCase(), + throw new ApiException( + ApiExceptionEnum.COMMAND_NOT_SUPPORTED, + identifier.getCommand().name().toLowerCase(), identifier.getCommandLevel().toLowerCase()); } @@ -55,7 +57,8 @@ private static synchronized void load() { return; } - for (Map.Entry entry : SpringContextHolder.getJobFactories().entrySet()) { + for (Map.Entry entry : + SpringContextHolder.getJobFactories().entrySet()) { String beanName = entry.getKey(); JobFactory jobFactory = entry.getValue(); if (JOB_FACTORIES.containsKey(jobFactory.getCommandIdentifier())) { @@ -64,7 +67,9 @@ private static synchronized void load() { } JOB_FACTORIES.put(jobFactory.getCommandIdentifier(), beanName); - log.info("Load JobFactory: {} with identifier: {}", jobFactory.getClass().getName(), + log.info( + "Load JobFactory: {} with identifier: {}", + jobFactory.getClass().getName(), jobFactory.getCommandIdentifier()); } diff --git a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/command/job/factory/cluster/AbstractClusterJobFactory.java b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/command/job/factory/cluster/AbstractClusterJobFactory.java index ea72437b..da8709cd 100644 --- a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/command/job/factory/cluster/AbstractClusterJobFactory.java +++ b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/command/job/factory/cluster/AbstractClusterJobFactory.java @@ -20,6 +20,4 @@ import org.apache.bigtop.manager.server.command.job.factory.AbstractJobFactory; -public abstract class AbstractClusterJobFactory extends AbstractJobFactory { - -} +public abstract class AbstractClusterJobFactory extends AbstractJobFactory {} diff --git a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/command/job/factory/component/AbstractComponentJobFactory.java b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/command/job/factory/component/AbstractComponentJobFactory.java index 2cfdd195..6666ecff 100644 --- a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/command/job/factory/component/AbstractComponentJobFactory.java +++ b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/command/job/factory/component/AbstractComponentJobFactory.java @@ -20,6 +20,4 @@ import org.apache.bigtop.manager.server.command.job.factory.AbstractJobFactory; -public abstract class AbstractComponentJobFactory extends AbstractJobFactory { - -} +public abstract class AbstractComponentJobFactory extends AbstractJobFactory {} diff --git a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/command/job/factory/component/ComponentInstallJobFactory.java b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/command/job/factory/component/ComponentInstallJobFactory.java index 3bf08984..d1ad8bed 100644 --- a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/command/job/factory/component/ComponentInstallJobFactory.java +++ b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/command/job/factory/component/ComponentInstallJobFactory.java @@ -38,7 +38,5 @@ public CommandIdentifier getCommandIdentifier() { } @Override - public void createStagesAndTasks() { - - } + public void createStagesAndTasks() {} } diff --git a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/command/job/factory/component/ComponentRestartJobFactory.java b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/command/job/factory/component/ComponentRestartJobFactory.java index 85ed4321..f6352b22 100644 --- a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/command/job/factory/component/ComponentRestartJobFactory.java +++ b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/command/job/factory/component/ComponentRestartJobFactory.java @@ -38,7 +38,5 @@ public CommandIdentifier getCommandIdentifier() { } @Override - public void createStagesAndTasks() { - - } + public void createStagesAndTasks() {} } diff --git a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/command/job/factory/component/ComponentStartJobFactory.java b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/command/job/factory/component/ComponentStartJobFactory.java index 87af9a27..16ac6bf5 100644 --- a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/command/job/factory/component/ComponentStartJobFactory.java +++ b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/command/job/factory/component/ComponentStartJobFactory.java @@ -38,7 +38,5 @@ public CommandIdentifier getCommandIdentifier() { } @Override - public void createStagesAndTasks() { - - } + public void createStagesAndTasks() {} } diff --git a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/command/job/factory/component/ComponentStopJobFactory.java b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/command/job/factory/component/ComponentStopJobFactory.java index 28feadfe..739a9e07 100644 --- a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/command/job/factory/component/ComponentStopJobFactory.java +++ b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/command/job/factory/component/ComponentStopJobFactory.java @@ -38,7 +38,5 @@ public CommandIdentifier getCommandIdentifier() { } @Override - public void createStagesAndTasks() { - - } + public void createStagesAndTasks() {} } diff --git a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/command/job/factory/host/AbstractHostJobFactory.java b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/command/job/factory/host/AbstractHostJobFactory.java index 65c2b75b..4b2e2d0a 100644 --- a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/command/job/factory/host/AbstractHostJobFactory.java +++ b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/command/job/factory/host/AbstractHostJobFactory.java @@ -20,6 +20,4 @@ import org.apache.bigtop.manager.server.command.job.factory.AbstractJobFactory; -public abstract class AbstractHostJobFactory extends AbstractJobFactory { - -} +public abstract class AbstractHostJobFactory extends AbstractJobFactory {} diff --git a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/command/job/factory/service/AbstractServiceJobFactory.java b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/command/job/factory/service/AbstractServiceJobFactory.java index 11166815..a31538c4 100644 --- a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/command/job/factory/service/AbstractServiceJobFactory.java +++ b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/command/job/factory/service/AbstractServiceJobFactory.java @@ -41,11 +41,10 @@ import org.apache.commons.collections4.CollectionUtils; +import jakarta.annotation.Resource; import java.util.ArrayList; import java.util.List; -import jakarta.annotation.Resource; - /** * A Service Job can be seen as a collection of multiple Components and Hosts, * so it can directly inherit from AbstractComponentJobFactory. @@ -88,8 +87,9 @@ protected List getTodoListForCommand(Command command) { try { List orderedList = dag.topologicalSort(); List componentNames = getComponentNames(); - List componentCommandNames = - new ArrayList<>(componentNames.stream().map(x -> x + "-" + command.name().toUpperCase()).toList()); + List componentCommandNames = new ArrayList<>(componentNames.stream() + .map(x -> x + "-" + command.name().toUpperCase()) + .toList()); orderedList.retainAll(componentCommandNames); componentCommandNames.removeAll(orderedList); @@ -132,12 +132,16 @@ protected Boolean isSlaveComponent(String componentName) { } protected List findHostnamesByComponentName(String componentName) { - List hostComponents = hostComponentRepository - .findAllByComponentClusterIdAndComponentComponentName(cluster.getId(), componentName); + List hostComponents = + hostComponentRepository.findAllByComponentClusterIdAndComponentComponentName( + cluster.getId(), componentName); if (hostComponents == null) { return new ArrayList<>(); } else { - return hostComponents.stream().map(HostComponent::getHost).map(Host::getHostname).toList(); + return hostComponents.stream() + .map(HostComponent::getHost) + .map(Host::getHostname) + .toList(); } } @@ -161,7 +165,8 @@ protected void createInstallStages() { } StageContext stageContext = createStageContext(serviceName, componentName, hostnames); - stages.add(StageFactories.getStageFactory(StageType.COMPONENT_INSTALL).createStage(stageContext)); + stages.add( + StageFactories.getStageFactory(StageType.COMPONENT_INSTALL).createStage(stageContext)); } } @@ -232,6 +237,8 @@ protected void createCheckStages() { } private List getServiceNames() { - return jobContext.getCommandDTO().getServiceCommands().stream().map(ServiceCommandDTO::getServiceName).toList(); + return jobContext.getCommandDTO().getServiceCommands().stream() + .map(ServiceCommandDTO::getServiceName) + .toList(); } } diff --git a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/command/job/factory/service/ServiceInstallJobFactory.java b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/command/job/factory/service/ServiceInstallJobFactory.java index 781908ba..916436e2 100644 --- a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/command/job/factory/service/ServiceInstallJobFactory.java +++ b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/command/job/factory/service/ServiceInstallJobFactory.java @@ -24,14 +24,14 @@ import org.apache.bigtop.manager.server.model.dto.ComponentHostDTO; import org.apache.bigtop.manager.server.model.dto.command.ServiceCommandDTO; -import java.util.ArrayList; -import java.util.List; - import org.springframework.beans.factory.config.ConfigurableBeanFactory; import org.springframework.context.annotation.Scope; import lombok.extern.slf4j.Slf4j; +import java.util.ArrayList; +import java.util.List; + @Slf4j @org.springframework.stereotype.Component @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE) @@ -84,8 +84,8 @@ protected List findHostnamesByComponentName(String componentName) { if (componentHost.getComponentName().equals(componentName)) { List hostnames = new ArrayList<>(componentHost.getHostnames()); List existHostnames = hostComponentRepository - .findAllByComponentClusterIdAndComponentComponentNameAndHostHostnameIn(cluster.getId(), - componentName, hostnames) + .findAllByComponentClusterIdAndComponentComponentNameAndHostHostnameIn( + cluster.getId(), componentName, hostnames) .stream() .map(hostComponent -> hostComponent.getHost().getHostname()) .toList(); diff --git a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/command/job/runner/AbstractJobRunner.java b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/command/job/runner/AbstractJobRunner.java index 2ac7b923..86188f93 100644 --- a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/command/job/runner/AbstractJobRunner.java +++ b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/command/job/runner/AbstractJobRunner.java @@ -30,12 +30,11 @@ import org.apache.bigtop.manager.server.command.stage.runner.StageRunners; import org.apache.bigtop.manager.server.model.dto.CommandDTO; +import jakarta.annotation.Resource; import java.util.Comparator; import java.util.List; import java.util.concurrent.LinkedBlockingQueue; -import jakarta.annotation.Resource; - public abstract class AbstractJobRunner implements JobRunner { @Resource diff --git a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/command/job/runner/JobRunners.java b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/command/job/runner/JobRunners.java index 6bdf17e4..2a94427f 100644 --- a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/command/job/runner/JobRunners.java +++ b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/command/job/runner/JobRunners.java @@ -27,12 +27,12 @@ import org.apache.bigtop.manager.server.holder.SpringContextHolder; import org.apache.bigtop.manager.server.model.dto.CommandDTO; +import lombok.extern.slf4j.Slf4j; + import java.util.HashMap; import java.util.Map; import java.util.concurrent.atomic.AtomicBoolean; -import lombok.extern.slf4j.Slf4j; - @Slf4j public class JobRunners { @@ -49,7 +49,9 @@ public static JobRunner getJobRunner(Job job) { CommandDTO commandDTO = jobContext.getCommandDTO(); CommandIdentifier identifier = new CommandIdentifier(commandDTO.getCommandLevel(), commandDTO.getCommand()); if (!JOB_RUNNERS.containsKey(identifier)) { - throw new ApiException(ApiExceptionEnum.COMMAND_NOT_SUPPORTED, identifier.getCommand().name().toLowerCase(), + throw new ApiException( + ApiExceptionEnum.COMMAND_NOT_SUPPORTED, + identifier.getCommand().name().toLowerCase(), identifier.getCommandLevel().toLowerCase()); } @@ -66,7 +68,8 @@ private static synchronized void load() { return; } - for (Map.Entry entry : SpringContextHolder.getJobRunners().entrySet()) { + for (Map.Entry entry : + SpringContextHolder.getJobRunners().entrySet()) { String beanName = entry.getKey(); JobRunner jobRunner = entry.getValue(); if (JOB_RUNNERS.containsKey(jobRunner.getCommandIdentifier())) { @@ -75,7 +78,9 @@ private static synchronized void load() { } JOB_RUNNERS.put(jobRunner.getCommandIdentifier(), beanName); - log.info("Load JobRunner: {} with identifier: {}", jobRunner.getClass().getName(), + log.info( + "Load JobRunner: {} with identifier: {}", + jobRunner.getClass().getName(), jobRunner.getCommandIdentifier()); } diff --git a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/command/job/runner/cluster/ClusterCreateJobRunner.java b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/command/job/runner/cluster/ClusterCreateJobRunner.java index 48b4596d..230f1580 100644 --- a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/command/job/runner/cluster/ClusterCreateJobRunner.java +++ b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/command/job/runner/cluster/ClusterCreateJobRunner.java @@ -35,13 +35,13 @@ import org.apache.bigtop.manager.server.model.mapper.ClusterMapper; import org.apache.bigtop.manager.server.service.ClusterService; -import jakarta.annotation.Resource; - import org.springframework.beans.factory.config.ConfigurableBeanFactory; import org.springframework.context.annotation.Scope; import lombok.extern.slf4j.Slf4j; +import jakarta.annotation.Resource; + @Slf4j @org.springframework.stereotype.Component @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE) @@ -82,7 +82,8 @@ public void onSuccess() { super.onSuccess(); CommandDTO commandDTO = getCommandDTO(); - Cluster cluster = clusterRepository.findByClusterName(commandDTO.getClusterCommand().getClusterName()) + Cluster cluster = clusterRepository + .findByClusterName(commandDTO.getClusterCommand().getClusterName()) .orElse(new Cluster()); // Update cluster state to installed diff --git a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/command/job/runner/host/HostAddJobRunner.java b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/command/job/runner/host/HostAddJobRunner.java index ada4f586..c108ebf5 100644 --- a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/command/job/runner/host/HostAddJobRunner.java +++ b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/command/job/runner/host/HostAddJobRunner.java @@ -26,15 +26,14 @@ import org.apache.bigtop.manager.server.model.dto.command.HostCommandDTO; import org.apache.bigtop.manager.server.service.HostService; -import java.util.List; - -import jakarta.annotation.Resource; - import org.springframework.beans.factory.config.ConfigurableBeanFactory; import org.springframework.context.annotation.Scope; import lombok.extern.slf4j.Slf4j; +import jakarta.annotation.Resource; +import java.util.List; + @Slf4j @org.springframework.stereotype.Component @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE) @@ -55,7 +54,8 @@ public void onSuccess() { CommandDTO commandDTO = getCommandDTO(); List hostCommands = commandDTO.getHostCommands(); - List hostnames = hostCommands.stream().map(HostCommandDTO::getHostname).toList(); + List hostnames = + hostCommands.stream().map(HostCommandDTO::getHostname).toList(); hostService.batchSave(job.getCluster().getId(), hostnames); } } diff --git a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/command/job/runner/service/ServiceInstallJobRunner.java b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/command/job/runner/service/ServiceInstallJobRunner.java index 9ac2ff25..cce244a0 100644 --- a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/command/job/runner/service/ServiceInstallJobRunner.java +++ b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/command/job/runner/service/ServiceInstallJobRunner.java @@ -43,15 +43,14 @@ import org.apache.bigtop.manager.server.service.ConfigService; import org.apache.bigtop.manager.server.utils.StackUtils; -import java.util.List; - -import jakarta.annotation.Resource; - import org.springframework.beans.factory.config.ConfigurableBeanFactory; import org.springframework.context.annotation.Scope; import lombok.extern.slf4j.Slf4j; +import jakarta.annotation.Resource; +import java.util.List; + @Slf4j @org.springframework.stereotype.Component @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE) @@ -91,8 +90,7 @@ public void beforeRun() { // Persist service, component and hostComponent metadata to database for (ServiceCommandDTO serviceCommand : serviceCommands) { String serviceName = serviceCommand.getServiceName(); - Service service = - serviceRepository.findByClusterIdAndServiceName(clusterId, serviceName); + Service service = serviceRepository.findByClusterIdAndServiceName(clusterId, serviceName); upsertService(service, serviceCommand); } } @@ -120,11 +118,9 @@ private void upsertService(Service service, ServiceCommandDTO serviceCommand) { String componentName = componentHostDTO.getComponentName(); // 3. Persist component - Component component = - componentRepository.findByClusterIdAndComponentName(clusterId, componentName); + Component component = componentRepository.findByClusterIdAndComponentName(clusterId, componentName); if (component == null) { - ComponentDTO componentDTO = - StackUtils.getComponentDTO(stackName, stackVersion, componentName); + ComponentDTO componentDTO = StackUtils.getComponentDTO(stackName, stackVersion, componentName); component = ComponentMapper.INSTANCE.fromDTO2Entity(componentDTO, service, cluster); component = componentRepository.save(component); } @@ -132,8 +128,7 @@ private void upsertService(Service service, ServiceCommandDTO serviceCommand) { // 4. Persist hostComponent for (String hostname : componentHostDTO.getHostnames()) { HostComponent hostComponent = - hostComponentRepository.findByComponentComponentNameAndHostHostname( - componentName, hostname); + hostComponentRepository.findByComponentComponentNameAndHostHostname(componentName, hostname); if (hostComponent == null) { Host host = hostRepository.findByHostname(hostname); diff --git a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/command/job/validator/ClusterCreateValidator.java b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/command/job/validator/ClusterCreateValidator.java index 21e24d41..9787c5bd 100644 --- a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/command/job/validator/ClusterCreateValidator.java +++ b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/command/job/validator/ClusterCreateValidator.java @@ -27,12 +27,11 @@ import org.apache.bigtop.manager.server.exception.ApiException; import org.apache.bigtop.manager.server.model.dto.command.ClusterCommandDTO; -import java.util.List; -import java.util.Optional; +import org.springframework.stereotype.Component; import jakarta.annotation.Resource; - -import org.springframework.stereotype.Component; +import java.util.List; +import java.util.Optional; @Component public class ClusterCreateValidator implements CommandValidator { diff --git a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/command/job/validator/ClusterHostValidator.java b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/command/job/validator/ClusterHostValidator.java index 3164436f..de434ea2 100644 --- a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/command/job/validator/ClusterHostValidator.java +++ b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/command/job/validator/ClusterHostValidator.java @@ -30,11 +30,10 @@ import org.apache.commons.collections4.CollectionUtils; -import java.util.List; +import org.springframework.stereotype.Component; import jakarta.annotation.Resource; - -import org.springframework.stereotype.Component; +import java.util.List; @Component public class ClusterHostValidator implements CommandValidator { @@ -54,8 +53,9 @@ public void validate(ValidatorContext context) { List connectedHosts = SpringContextHolder.getServerWebSocket().getConnectedHosts(); if (CollectionUtils.isNotEmpty(connectedHosts)) { - List notConnectedHostnames = - hostnames.stream().filter(hostname -> !connectedHosts.contains(hostname)).toList(); + List notConnectedHostnames = hostnames.stream() + .filter(hostname -> !connectedHosts.contains(hostname)) + .toList(); if (CollectionUtils.isNotEmpty(notConnectedHostnames)) { throw new ApiException(ApiExceptionEnum.HOST_NOT_CONNECTED, String.join(",", notConnectedHostnames)); } @@ -67,5 +67,4 @@ public void validate(ValidatorContext context) { throw new ApiException(ApiExceptionEnum.HOST_ASSIGNED, String.join(",", existsHostnames)); } } - } diff --git a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/command/job/validator/HostAddValidator.java b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/command/job/validator/HostAddValidator.java index 45084ad0..c731622b 100644 --- a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/command/job/validator/HostAddValidator.java +++ b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/command/job/validator/HostAddValidator.java @@ -29,11 +29,10 @@ import org.apache.commons.collections4.CollectionUtils; -import java.util.List; +import org.springframework.stereotype.Component; import jakarta.annotation.Resource; - -import org.springframework.stereotype.Component; +import java.util.List; @Component public class HostAddValidator implements CommandValidator { @@ -48,8 +47,9 @@ public List getCommandIdentifiers() { @Override public void validate(ValidatorContext context) { - List hostnames = - context.getCommandDTO().getHostCommands().stream().map(HostCommandDTO::getHostname).toList(); + List hostnames = context.getCommandDTO().getHostCommands().stream() + .map(HostCommandDTO::getHostname) + .toList(); List hosts = hostRepository.findAllByHostnameIn(hostnames); if (CollectionUtils.isNotEmpty(hosts)) { @@ -57,5 +57,4 @@ public void validate(ValidatorContext context) { throw new ApiException(ApiExceptionEnum.HOST_ASSIGNED, String.join(",", existsHostnames)); } } - } diff --git a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/command/job/validator/RequiredServicesValidator.java b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/command/job/validator/RequiredServicesValidator.java index 76564818..2f96c5fc 100644 --- a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/command/job/validator/RequiredServicesValidator.java +++ b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/command/job/validator/RequiredServicesValidator.java @@ -34,11 +34,10 @@ import org.apache.commons.collections4.CollectionUtils; -import java.util.List; +import org.springframework.stereotype.Component; import jakarta.annotation.Resource; - -import org.springframework.stereotype.Component; +import java.util.List; @Component public class RequiredServicesValidator implements CommandValidator { @@ -64,7 +63,8 @@ public void validate(ValidatorContext context) { String stackName = cluster.getStack().getStackName(); String stackVersion = cluster.getStack().getStackVersion(); - List serviceNames = serviceCommands.stream().map(ServiceCommandDTO::getServiceName).toList(); + List serviceNames = + serviceCommands.stream().map(ServiceCommandDTO::getServiceName).toList(); for (ServiceCommandDTO serviceCommand : serviceCommands) { String serviceName = serviceCommand.getServiceName(); ServiceDTO serviceDTO = StackUtils.getServiceDTO(stackName, stackVersion, serviceName); @@ -74,7 +74,8 @@ public void validate(ValidatorContext context) { } List serviceList = serviceRepository.findByClusterIdAndServiceNameIn(clusterId, requiredServices); - List list = serviceList.stream().map(Service::getServiceName).toList(); + List list = + serviceList.stream().map(Service::getServiceName).toList(); requiredServices.removeAll(list); @@ -82,6 +83,5 @@ public void validate(ValidatorContext context) { throw new ApiException(ApiExceptionEnum.SERVICE_REQUIRED_NOT_FOUND, String.join(",", requiredServices)); } } - } } diff --git a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/command/job/validator/ServiceHostValidator.java b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/command/job/validator/ServiceHostValidator.java index f9318afa..cc2aadd6 100644 --- a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/command/job/validator/ServiceHostValidator.java +++ b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/command/job/validator/ServiceHostValidator.java @@ -28,14 +28,13 @@ import org.apache.bigtop.manager.server.model.dto.CommandDTO; import org.apache.bigtop.manager.server.model.dto.command.ServiceCommandDTO; +import org.springframework.stereotype.Component; + +import jakarta.annotation.Resource; import java.util.List; import java.util.Set; import java.util.stream.Collectors; -import jakarta.annotation.Resource; - -import org.springframework.stereotype.Component; - @Component public class ServiceHostValidator implements CommandValidator { @@ -63,5 +62,4 @@ public void validate(ValidatorContext context) { throw new ApiException(ApiExceptionEnum.HOST_NOT_FOUND); } } - } diff --git a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/command/job/validator/StackValidator.java b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/command/job/validator/StackValidator.java index 53e6eb1a..80d23af5 100644 --- a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/command/job/validator/StackValidator.java +++ b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/command/job/validator/StackValidator.java @@ -27,11 +27,10 @@ import org.apache.bigtop.manager.server.exception.ApiException; import org.apache.bigtop.manager.server.model.dto.command.ClusterCommandDTO; -import java.util.List; +import org.springframework.stereotype.Component; import jakarta.annotation.Resource; - -import org.springframework.stereotype.Component; +import java.util.List; @Component public class StackValidator implements CommandValidator { @@ -55,5 +54,4 @@ public void validate(ValidatorContext context) { throw new ApiException(ApiExceptionEnum.STACK_NOT_FOUND); } } - } diff --git a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/command/scheduler/DefaultJobScheduler.java b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/command/scheduler/DefaultJobScheduler.java index cf2545b0..241dceaa 100644 --- a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/command/scheduler/DefaultJobScheduler.java +++ b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/command/scheduler/DefaultJobScheduler.java @@ -23,16 +23,15 @@ import org.apache.bigtop.manager.server.command.job.runner.JobRunners; import org.apache.bigtop.manager.server.holder.SessionUserHolder; -import java.util.concurrent.Executor; -import java.util.concurrent.Executors; -import java.util.concurrent.LinkedBlockingQueue; - -import jakarta.annotation.PostConstruct; - import org.springframework.stereotype.Component; import lombok.extern.slf4j.Slf4j; +import jakarta.annotation.PostConstruct; +import java.util.concurrent.Executor; +import java.util.concurrent.Executors; +import java.util.concurrent.LinkedBlockingQueue; + @Slf4j @Component public class DefaultJobScheduler implements JobScheduler { diff --git a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/command/stage/factory/StageContext.java b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/command/stage/factory/StageContext.java index 7ad79d51..86240e21 100644 --- a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/command/stage/factory/StageContext.java +++ b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/command/stage/factory/StageContext.java @@ -26,10 +26,10 @@ import org.apache.bigtop.manager.server.model.dto.command.ClusterCommandDTO; import org.apache.bigtop.manager.server.model.dto.command.HostCommandDTO; -import java.util.List; - import lombok.Data; +import java.util.List; + @Data public class StageContext { @@ -80,7 +80,8 @@ private static void fromClusterCommandPayload(StageContext context, CommandDTO c private static void fromHostCommandPayload(StageContext context, CommandDTO commandDTO) { List hostCommands = commandDTO.getHostCommands(); - List hostnames = hostCommands.stream().map(HostCommandDTO::getHostname).toList(); + List hostnames = + hostCommands.stream().map(HostCommandDTO::getHostname).toList(); context.setHostnames(hostnames); } diff --git a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/command/stage/factory/StageFactories.java b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/command/stage/factory/StageFactories.java index 4cf4ddc2..14603165 100644 --- a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/command/stage/factory/StageFactories.java +++ b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/command/stage/factory/StageFactories.java @@ -20,12 +20,12 @@ import org.apache.bigtop.manager.server.holder.SpringContextHolder; +import lombok.extern.slf4j.Slf4j; + import java.util.HashMap; import java.util.Map; import java.util.concurrent.atomic.AtomicBoolean; -import lombok.extern.slf4j.Slf4j; - @Slf4j public class StageFactories { @@ -47,7 +47,8 @@ private static synchronized void load() { return; } - for (Map.Entry entry : SpringContextHolder.getStageFactories().entrySet()) { + for (Map.Entry entry : + SpringContextHolder.getStageFactories().entrySet()) { String beanName = entry.getKey(); StageFactory stageFactory = entry.getValue(); if (STAGE_FACTORIES.containsKey(stageFactory.getStageType())) { @@ -56,7 +57,9 @@ private static synchronized void load() { } STAGE_FACTORIES.put(stageFactory.getStageType(), beanName); - log.info("Load StageLifecycle: {} with type: {}", stageFactory.getClass().getName(), + log.info( + "Load StageLifecycle: {} with type: {}", + stageFactory.getClass().getName(), stageFactory.getStageType()); } diff --git a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/command/stage/factory/StageType.java b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/command/stage/factory/StageType.java index 935f8ef0..dc12b711 100644 --- a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/command/stage/factory/StageType.java +++ b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/command/stage/factory/StageType.java @@ -19,7 +19,6 @@ package org.apache.bigtop.manager.server.command.stage.factory; public enum StageType { - HOST_CHECK, CACHE_DISTRIBUTE, diff --git a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/command/stage/factory/component/AbstractComponentStageFactory.java b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/command/stage/factory/component/AbstractComponentStageFactory.java index 191bc2d9..d685be8a 100644 --- a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/command/stage/factory/component/AbstractComponentStageFactory.java +++ b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/command/stage/factory/component/AbstractComponentStageFactory.java @@ -36,11 +36,10 @@ import org.apache.bigtop.manager.server.model.dto.ScriptDTO; import org.apache.bigtop.manager.server.model.dto.ServiceDTO; +import jakarta.annotation.Resource; import java.util.ArrayList; import java.util.List; -import jakarta.annotation.Resource; - public abstract class AbstractComponentStageFactory extends AbstractStageFactory { @Resource @@ -79,8 +78,7 @@ public void doCreateStage() { task.setCustomCommands(JsonUtils.writeAsString(componentDTO.getCustomCommands())); task.setCommandScript(JsonUtils.writeAsString(componentDTO.getCommandScript())); - CommandRequestMessage commandRequestMessage = - getMessage(serviceDTO, componentDTO, hostname, command); + CommandRequestMessage commandRequestMessage = getMessage(serviceDTO, componentDTO, hostname, command); task.setContent(JsonUtils.writeAsString(commandRequestMessage)); task.setMessageId(commandRequestMessage.getMessageId()); @@ -92,8 +90,8 @@ public void doCreateStage() { protected abstract Command getCommand(); - private CommandRequestMessage getMessage(ServiceDTO serviceDTO, ComponentDTO componentDTO, - String hostname, Command command) { + private CommandRequestMessage getMessage( + ServiceDTO serviceDTO, ComponentDTO componentDTO, String hostname, Command command) { CommandPayload commandPayload = new CommandPayload(); commandPayload.setServiceName(serviceDTO.getServiceName()); commandPayload.setCommand(command); @@ -105,8 +103,7 @@ private CommandRequestMessage getMessage(ServiceDTO serviceDTO, ComponentDTO com commandPayload.setRoot(cluster.getRoot()); commandPayload.setHostname(hostname); - commandPayload.setCustomCommands( - convertCustomCommandInfo(componentDTO.getCustomCommands())); + commandPayload.setCustomCommands(convertCustomCommandInfo(componentDTO.getCustomCommands())); commandPayload.setOsSpecifics(convertOSSpecificInfo(serviceDTO.getOsSpecifics())); commandPayload.setCommandScript(convertScriptInfo(componentDTO.getCommandScript())); @@ -147,8 +144,7 @@ private List convertOSSpecificInfo(List osSpecifi return osSpecificInfos; } - private List convertCustomCommandInfo( - List customCommandDTOs) { + private List convertCustomCommandInfo(List customCommandDTOs) { if (customCommandDTOs == null) { return new ArrayList<>(); } @@ -157,8 +153,7 @@ private List convertCustomCommandInfo( for (CustomCommandDTO customCommandDTO : customCommandDTOs) { CustomCommandInfo customCommandInfo = new CustomCommandInfo(); customCommandInfo.setName(customCommandDTO.getName()); - customCommandInfo.setCommandScript( - convertScriptInfo(customCommandDTO.getCommandScript())); + customCommandInfo.setCommandScript(convertScriptInfo(customCommandDTO.getCommandScript())); customCommandInfos.add(customCommandInfo); } diff --git a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/command/stage/factory/config/CacheDistributeStageFactory.java b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/command/stage/factory/config/CacheDistributeStageFactory.java index 1e8b36d7..e0bbb4ba 100644 --- a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/command/stage/factory/config/CacheDistributeStageFactory.java +++ b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/command/stage/factory/config/CacheDistributeStageFactory.java @@ -25,16 +25,15 @@ import org.apache.bigtop.manager.server.command.stage.factory.AbstractStageFactory; import org.apache.bigtop.manager.server.command.stage.factory.StageType; -import java.util.ArrayList; -import java.util.List; - -import jakarta.annotation.Resource; - import org.springframework.beans.factory.config.ConfigurableBeanFactory; import org.springframework.context.annotation.Scope; import lombok.extern.slf4j.Slf4j; +import jakarta.annotation.Resource; +import java.util.ArrayList; +import java.util.List; + @Slf4j @org.springframework.stereotype.Component @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE) @@ -55,8 +54,9 @@ public void doCreateStage() { hostnames.addAll(context.getHostnames()); } else { hostnames.addAll(context.getHostnames() == null ? List.of() : context.getHostnames()); - hostnames.addAll( - hostRepository.findAllByClusterId(context.getClusterId()).stream().map(Host::getHostname).toList()); + hostnames.addAll(hostRepository.findAllByClusterId(context.getClusterId()).stream() + .map(Host::getHostname) + .toList()); } stage.setName("Distribute Caches"); diff --git a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/command/stage/factory/host/HostCheckStageFactory.java b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/command/stage/factory/host/HostCheckStageFactory.java index a35b6acb..c4238d23 100644 --- a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/command/stage/factory/host/HostCheckStageFactory.java +++ b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/command/stage/factory/host/HostCheckStageFactory.java @@ -29,16 +29,15 @@ import org.apache.bigtop.manager.server.command.stage.factory.AbstractStageFactory; import org.apache.bigtop.manager.server.command.stage.factory.StageType; -import java.util.ArrayList; -import java.util.List; - -import jakarta.annotation.Resource; - import org.springframework.beans.factory.config.ConfigurableBeanFactory; import org.springframework.context.annotation.Scope; import lombok.extern.slf4j.Slf4j; +import jakarta.annotation.Resource; +import java.util.ArrayList; +import java.util.List; + @Slf4j @org.springframework.stereotype.Component @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE) diff --git a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/command/stage/factory/service/ServiceConfigureStageFactory.java b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/command/stage/factory/service/ServiceConfigureStageFactory.java index f7070db8..1da995c1 100644 --- a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/command/stage/factory/service/ServiceConfigureStageFactory.java +++ b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/command/stage/factory/service/ServiceConfigureStageFactory.java @@ -37,6 +37,5 @@ public StageType getStageType() { } @Override - public void doCreateStage() { - } + public void doCreateStage() {} } diff --git a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/command/stage/runner/AbstractStageRunner.java b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/command/stage/runner/AbstractStageRunner.java index 519b5940..57f1563f 100644 --- a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/command/stage/runner/AbstractStageRunner.java +++ b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/command/stage/runner/AbstractStageRunner.java @@ -18,8 +18,6 @@ */ package org.apache.bigtop.manager.server.command.stage.runner; -import jakarta.annotation.Resource; -import lombok.extern.slf4j.Slf4j; import org.apache.bigtop.manager.common.constants.MessageConstants; import org.apache.bigtop.manager.common.enums.JobState; import org.apache.bigtop.manager.common.message.entity.command.CommandRequestMessage; @@ -33,6 +31,9 @@ import org.apache.bigtop.manager.server.holder.SpringContextHolder; import org.apache.bigtop.manager.server.service.CommandLogService; +import lombok.extern.slf4j.Slf4j; + +import jakarta.annotation.Resource; import java.util.ArrayList; import java.util.List; import java.util.concurrent.CompletableFuture; @@ -81,7 +82,8 @@ public void run() { futures.add(CompletableFuture.supplyAsync(() -> { commandLogService.onLogStarted(task.getId(), task.getHostname()); - CommandResponseMessage res = SpringContextHolder.getServerWebSocket().sendRequestMessage(task.getHostname(), message); + CommandResponseMessage res = + SpringContextHolder.getServerWebSocket().sendRequestMessage(task.getHostname(), message); log.info("Execute task {} completed: {}", task.getId(), res); boolean taskSuccess = res != null && res.getCode() == MessageConstants.SUCCESS_CODE; @@ -97,14 +99,16 @@ public void run() { })); } - List taskResults = futures.stream().map((future) -> { - try { - return future.get(COMMAND_MESSAGE_RESPONSE_TIMEOUT, TimeUnit.MILLISECONDS); - } catch (Exception e) { - log.error("Error running task", e); - return false; - } - }).toList(); + List taskResults = futures.stream() + .map((future) -> { + try { + return future.get(COMMAND_MESSAGE_RESPONSE_TIMEOUT, TimeUnit.MILLISECONDS); + } catch (Exception e) { + log.error("Error running task", e); + return false; + } + }) + .toList(); boolean allTaskSuccess = taskResults.stream().allMatch(Boolean::booleanValue); if (allTaskSuccess) { diff --git a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/command/stage/runner/StageRunners.java b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/command/stage/runner/StageRunners.java index f907eb9b..1d03cbee 100644 --- a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/command/stage/runner/StageRunners.java +++ b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/command/stage/runner/StageRunners.java @@ -24,12 +24,12 @@ import org.apache.bigtop.manager.server.command.stage.factory.StageType; import org.apache.bigtop.manager.server.holder.SpringContextHolder; +import lombok.extern.slf4j.Slf4j; + import java.util.HashMap; import java.util.Map; import java.util.concurrent.atomic.AtomicBoolean; -import lombok.extern.slf4j.Slf4j; - @Slf4j public class StageRunners { @@ -58,7 +58,8 @@ private static synchronized void load() { return; } - for (Map.Entry entry : SpringContextHolder.getStageRunners().entrySet()) { + for (Map.Entry entry : + SpringContextHolder.getStageRunners().entrySet()) { String beanName = entry.getKey(); StageRunner stageRunner = entry.getValue(); if (STAGE_RUNNERS.containsKey(stageRunner.getStageType())) { @@ -67,7 +68,9 @@ private static synchronized void load() { } STAGE_RUNNERS.put(stageRunner.getStageType(), beanName); - log.info("Load StageLifecycle: {} with type: {}", stageRunner.getClass().getName(), + log.info( + "Load StageLifecycle: {} with type: {}", + stageRunner.getClass().getName(), stageRunner.getStageType()); } diff --git a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/command/stage/runner/component/ComponentInstallStageRunner.java b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/command/stage/runner/component/ComponentInstallStageRunner.java index 12f9dd3a..5a4d5fce 100644 --- a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/command/stage/runner/component/ComponentInstallStageRunner.java +++ b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/command/stage/runner/component/ComponentInstallStageRunner.java @@ -25,13 +25,13 @@ import org.apache.bigtop.manager.server.command.stage.factory.StageType; import org.apache.bigtop.manager.server.command.stage.runner.AbstractStageRunner; -import jakarta.annotation.Resource; - import org.springframework.beans.factory.config.ConfigurableBeanFactory; import org.springframework.context.annotation.Scope; import lombok.extern.slf4j.Slf4j; +import jakarta.annotation.Resource; + @Slf4j @org.springframework.stereotype.Component @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE) @@ -52,8 +52,9 @@ public void onTaskSuccess(Task task) { Long clusterId = task.getCluster().getId(); String componentName = task.getComponentName(); String hostname = task.getHostname(); - HostComponent hostComponent = hostComponentRepository - .findByComponentClusterIdAndComponentComponentNameAndHostHostname(clusterId, componentName, hostname); + HostComponent hostComponent = + hostComponentRepository.findByComponentClusterIdAndComponentComponentNameAndHostHostname( + clusterId, componentName, hostname); hostComponent.setState(MaintainState.INSTALLED); hostComponentRepository.save(hostComponent); } diff --git a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/command/stage/runner/component/ComponentStartStageRunner.java b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/command/stage/runner/component/ComponentStartStageRunner.java index 6159c2e9..744de774 100644 --- a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/command/stage/runner/component/ComponentStartStageRunner.java +++ b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/command/stage/runner/component/ComponentStartStageRunner.java @@ -25,13 +25,13 @@ import org.apache.bigtop.manager.server.command.stage.factory.StageType; import org.apache.bigtop.manager.server.command.stage.runner.AbstractStageRunner; -import jakarta.annotation.Resource; - import org.springframework.beans.factory.config.ConfigurableBeanFactory; import org.springframework.context.annotation.Scope; import lombok.extern.slf4j.Slf4j; +import jakarta.annotation.Resource; + @Slf4j @org.springframework.stereotype.Component @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE) @@ -52,8 +52,9 @@ public void onTaskSuccess(Task task) { Long clusterId = task.getCluster().getId(); String componentName = task.getComponentName(); String hostname = task.getHostname(); - HostComponent hostComponent = hostComponentRepository - .findByComponentClusterIdAndComponentComponentNameAndHostHostname(clusterId, componentName, hostname); + HostComponent hostComponent = + hostComponentRepository.findByComponentClusterIdAndComponentComponentNameAndHostHostname( + clusterId, componentName, hostname); hostComponent.setState(MaintainState.STARTED); hostComponentRepository.save(hostComponent); } diff --git a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/command/stage/runner/component/ComponentStopStageRunner.java b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/command/stage/runner/component/ComponentStopStageRunner.java index 4ef0a713..1d9c2791 100644 --- a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/command/stage/runner/component/ComponentStopStageRunner.java +++ b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/command/stage/runner/component/ComponentStopStageRunner.java @@ -25,13 +25,13 @@ import org.apache.bigtop.manager.server.command.stage.factory.StageType; import org.apache.bigtop.manager.server.command.stage.runner.AbstractStageRunner; -import jakarta.annotation.Resource; - import org.springframework.beans.factory.config.ConfigurableBeanFactory; import org.springframework.context.annotation.Scope; import lombok.extern.slf4j.Slf4j; +import jakarta.annotation.Resource; + @Slf4j @org.springframework.stereotype.Component @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE) @@ -52,8 +52,9 @@ public void onTaskSuccess(Task task) { Long clusterId = task.getCluster().getId(); String componentName = task.getComponentName(); String hostname = task.getHostname(); - HostComponent hostComponent = hostComponentRepository - .findByComponentClusterIdAndComponentComponentNameAndHostHostname(clusterId, componentName, hostname); + HostComponent hostComponent = + hostComponentRepository.findByComponentClusterIdAndComponentComponentNameAndHostHostname( + clusterId, componentName, hostname); hostComponent.setState(MaintainState.STOPPED); hostComponentRepository.save(hostComponent); } diff --git a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/command/stage/runner/config/CacheDistributeStageRunner.java b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/command/stage/runner/config/CacheDistributeStageRunner.java index 062433b0..6ccae8c2 100644 --- a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/command/stage/runner/config/CacheDistributeStageRunner.java +++ b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/command/stage/runner/config/CacheDistributeStageRunner.java @@ -18,8 +18,6 @@ */ package org.apache.bigtop.manager.server.command.stage.runner.config; -import static org.apache.bigtop.manager.common.constants.Constants.ALL_HOST_KEY; - import org.apache.bigtop.manager.common.constants.Constants; import org.apache.bigtop.manager.common.message.entity.command.CommandMessageType; import org.apache.bigtop.manager.common.message.entity.command.CommandRequestMessage; @@ -57,6 +55,13 @@ import org.apache.commons.lang3.tuple.ImmutablePair; +import org.springframework.beans.factory.config.ConfigurableBeanFactory; +import org.springframework.context.annotation.Scope; + +import com.fasterxml.jackson.core.type.TypeReference; +import lombok.extern.slf4j.Slf4j; + +import jakarta.annotation.Resource; import java.util.ArrayList; import java.util.HashMap; import java.util.HashSet; @@ -65,14 +70,7 @@ import java.util.Set; import java.util.stream.Collectors; -import jakarta.annotation.Resource; - -import org.springframework.beans.factory.config.ConfigurableBeanFactory; -import org.springframework.context.annotation.Scope; - -import com.fasterxml.jackson.core.type.TypeReference; - -import lombok.extern.slf4j.Slf4j; +import static org.apache.bigtop.manager.common.constants.Constants.ALL_HOST_KEY; @Slf4j @org.springframework.stereotype.Component @@ -153,10 +151,8 @@ private void genCaches() { String stackVersion = cluster.getStack().getStackVersion(); List services = serviceRepository.findAllByClusterId(clusterId); - List serviceConfigList = - serviceConfigRepository.findAllByClusterAndSelectedIsTrue(cluster); - List hostComponents = - hostComponentRepository.findAllByComponentClusterId(clusterId); + List serviceConfigList = serviceConfigRepository.findAllByClusterAndSelectedIsTrue(cluster); + List hostComponents = hostComponentRepository.findAllByComponentClusterId(clusterId); List repos = repoRepository.findAllByCluster(cluster); Iterable settings = settingRepository.findAll(); List hostList = hostRepository.findAllByClusterId(clusterId); @@ -174,20 +170,18 @@ private void genCaches() { for (ServiceConfig serviceConfig : serviceConfigList) { for (TypeConfig typeConfig : serviceConfig.getConfigs()) { List properties = - JsonUtils.readFromString(typeConfig.getPropertiesJson(), new TypeReference<>() { - }); - String configMapStr = - JsonUtils.writeAsString(StackConfigUtils.extractConfigMap(properties)); + JsonUtils.readFromString(typeConfig.getPropertiesJson(), new TypeReference<>() {}); + String configMapStr = JsonUtils.writeAsString(StackConfigUtils.extractConfigMap(properties)); if (serviceConfigMap.containsKey(serviceConfig.getService().getServiceName())) { - serviceConfigMap.get(serviceConfig.getService().getServiceName()) + serviceConfigMap + .get(serviceConfig.getService().getServiceName()) .put(typeConfig.getTypeName(), configMapStr); } else { Map hashMap = new HashMap<>(); hashMap.put(typeConfig.getTypeName(), configMapStr); serviceConfigMap.put(serviceConfig.getService().getServiceName(), hashMap); } - } } @@ -203,8 +197,7 @@ private void genCaches() { hostMap.get(x.getComponent().getComponentName()).add(x.getHost().getHostname()); }); - Set hostNameSet = - hostList.stream().map(Host::getHostname).collect(Collectors.toSet()); + Set hostNameSet = hostList.stream().map(Host::getHostname).collect(Collectors.toSet()); hostMap.put(ALL_HOST_KEY, hostNameSet); repoList = new ArrayList<>(); @@ -240,8 +233,7 @@ private void genEmptyCaches() { userMap = new HashMap<>(); settingsMap = new HashMap<>(); - String fullStackName = - StackUtils.fullStackName(stageContext.getStackName(), stageContext.getStackVersion()); + String fullStackName = StackUtils.fullStackName(stageContext.getStackName(), stageContext.getStackVersion()); ImmutablePair> immutablePair = StackUtils.getStackKeyMap().get(fullStackName); StackDTO stackDTO = immutablePair.getLeft(); diff --git a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/config/AsyncThreadPoolConfig.java b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/config/AsyncThreadPoolConfig.java index 9ad8e577..76bed84f 100644 --- a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/config/AsyncThreadPoolConfig.java +++ b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/config/AsyncThreadPoolConfig.java @@ -20,11 +20,6 @@ import org.apache.bigtop.manager.server.holder.SessionUserHolder; -import java.util.concurrent.Executor; -import java.util.concurrent.ThreadPoolExecutor; - -import jakarta.annotation.Nonnull; - import org.springframework.aop.interceptor.AsyncUncaughtExceptionHandler; import org.springframework.aop.interceptor.SimpleAsyncUncaughtExceptionHandler; import org.springframework.context.annotation.Configuration; @@ -34,6 +29,10 @@ import lombok.extern.slf4j.Slf4j; +import jakarta.annotation.Nonnull; +import java.util.concurrent.Executor; +import java.util.concurrent.ThreadPoolExecutor; + @Configuration public class AsyncThreadPoolConfig implements AsyncConfigurer { diff --git a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/config/CommandGroupSequenceProvider.java b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/config/CommandGroupSequenceProvider.java index 29d2bb9b..f7911ade 100644 --- a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/config/CommandGroupSequenceProvider.java +++ b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/config/CommandGroupSequenceProvider.java @@ -22,11 +22,11 @@ import org.apache.bigtop.manager.server.enums.CommandLevel; import org.apache.bigtop.manager.server.model.req.CommandReq; +import org.hibernate.validator.spi.group.DefaultGroupSequenceProvider; + import java.util.ArrayList; import java.util.List; -import org.hibernate.validator.spi.group.DefaultGroupSequenceProvider; - public class CommandGroupSequenceProvider implements DefaultGroupSequenceProvider { @Override @@ -55,23 +55,17 @@ public List> getValidationGroups(CommandReq bean) { defaultGroupSequence.add(ClusterCommandGroup.class); break; } - } return defaultGroupSequence; } - public interface ServiceCommandGroup { - } + public interface ServiceCommandGroup {} - public interface HostCommandGroup { - } + public interface HostCommandGroup {} - public interface ComponentCommandGroup { - } + public interface ComponentCommandGroup {} - public interface ServiceInstallCommandGroup { - } + public interface ServiceInstallCommandGroup {} - public interface ClusterCommandGroup { - } + public interface ClusterCommandGroup {} } diff --git a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/config/EclipseLinkConfig.java b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/config/EclipseLinkConfig.java index 894539a4..96e612e8 100644 --- a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/config/EclipseLinkConfig.java +++ b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/config/EclipseLinkConfig.java @@ -18,12 +18,6 @@ */ package org.apache.bigtop.manager.server.config; -import java.util.HashMap; -import java.util.Map; -import javax.sql.DataSource; - -import jakarta.annotation.Resource; - import org.springframework.beans.factory.ObjectProvider; import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; import org.springframework.boot.autoconfigure.orm.jpa.JpaBaseConfiguration; @@ -33,6 +27,11 @@ import org.springframework.orm.jpa.vendor.EclipseLinkJpaVendorAdapter; import org.springframework.transaction.jta.JtaTransactionManager; +import jakarta.annotation.Resource; +import javax.sql.DataSource; +import java.util.HashMap; +import java.util.Map; + @Configuration @ConditionalOnProperty(value = "bigtop.manager.orm.type", havingValue = "eclipselink", matchIfMissing = true) public class EclipseLinkConfig extends JpaBaseConfiguration { diff --git a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/config/FrontendRedirector.java b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/config/FrontendRedirector.java index 2bb2b1be..1895b2fe 100644 --- a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/config/FrontendRedirector.java +++ b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/config/FrontendRedirector.java @@ -18,15 +18,15 @@ */ package org.apache.bigtop.manager.server.config; -import jakarta.servlet.RequestDispatcher; -import jakarta.servlet.http.HttpServletRequest; - import org.springframework.boot.web.servlet.error.ErrorController; import org.springframework.http.HttpStatus; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.servlet.ModelAndView; +import jakarta.servlet.RequestDispatcher; +import jakarta.servlet.http.HttpServletRequest; + @Controller public class FrontendRedirector implements ErrorController { diff --git a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/config/JpaAuditConfig.java b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/config/JpaAuditConfig.java index 19565999..6bba2ada 100644 --- a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/config/JpaAuditConfig.java +++ b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/config/JpaAuditConfig.java @@ -20,13 +20,12 @@ import org.apache.bigtop.manager.server.holder.SessionUserHolder; -import java.util.Optional; - -import jakarta.annotation.Nonnull; - import org.springframework.context.annotation.Configuration; import org.springframework.data.domain.AuditorAware; +import jakarta.annotation.Nonnull; +import java.util.Optional; + @Configuration public class JpaAuditConfig implements AuditorAware { @@ -39,5 +38,4 @@ public Optional getCurrentAuditor() { return Optional.empty(); } } - } diff --git a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/config/LocaleConfig.java b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/config/LocaleConfig.java index 177da82e..2531cb00 100644 --- a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/config/LocaleConfig.java +++ b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/config/LocaleConfig.java @@ -18,13 +18,13 @@ */ package org.apache.bigtop.manager.server.config; -import java.util.Locale; - import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.web.servlet.LocaleResolver; import org.springframework.web.servlet.i18n.AcceptHeaderLocaleResolver; +import java.util.Locale; + @Configuration public class LocaleConfig { diff --git a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/config/OpenAPIConfig.java b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/config/OpenAPIConfig.java index 406677fc..b5c0c52b 100644 --- a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/config/OpenAPIConfig.java +++ b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/config/OpenAPIConfig.java @@ -35,5 +35,4 @@ public OpenAPI apiV1Info1() { .description("Bigtop Manager Api Docs") .version("V1")); } - } diff --git a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/config/ValidatorConfig.java b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/config/ValidatorConfig.java index b55479b9..ca987426 100644 --- a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/config/ValidatorConfig.java +++ b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/config/ValidatorConfig.java @@ -18,13 +18,13 @@ */ package org.apache.bigtop.manager.server.config; -import jakarta.validation.Validation; -import jakarta.validation.ValidatorFactory; - import org.hibernate.validator.HibernateValidator; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; +import jakarta.validation.Validation; +import jakarta.validation.ValidatorFactory; + @Configuration public class ValidatorConfig { diff --git a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/config/WebConfig.java b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/config/WebConfig.java index 9a362e86..742c9814 100644 --- a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/config/WebConfig.java +++ b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/config/WebConfig.java @@ -20,8 +20,6 @@ import org.apache.bigtop.manager.server.interceptor.AuthInterceptor; -import jakarta.annotation.Resource; - import org.springframework.context.annotation.Configuration; import org.springframework.web.servlet.config.annotation.InterceptorRegistry; import org.springframework.web.servlet.config.annotation.PathMatchConfigurer; @@ -29,6 +27,8 @@ import org.springframework.web.servlet.config.annotation.ViewControllerRegistry; import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; +import jakarta.annotation.Resource; + @Configuration public class WebConfig implements WebMvcConfigurer { diff --git a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/config/WebSocketConfig.java b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/config/WebSocketConfig.java index 2b39517e..d69839e1 100644 --- a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/config/WebSocketConfig.java +++ b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/config/WebSocketConfig.java @@ -18,13 +18,9 @@ */ package org.apache.bigtop.manager.server.config; -import static org.apache.bigtop.manager.common.constants.Constants.WS_BINARY_MESSAGE_SIZE_LIMIT; - import org.apache.bigtop.manager.server.ws.DefaultWebSocketHandler; import org.apache.bigtop.manager.server.ws.ServerWebSocketHandler; -import jakarta.annotation.Resource; - import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.web.socket.config.annotation.EnableWebSocket; @@ -32,6 +28,10 @@ import org.springframework.web.socket.config.annotation.WebSocketHandlerRegistry; import org.springframework.web.socket.server.standard.ServletServerContainerFactoryBean; +import jakarta.annotation.Resource; + +import static org.apache.bigtop.manager.common.constants.Constants.WS_BINARY_MESSAGE_SIZE_LIMIT; + @Configuration @EnableWebSocket public class WebSocketConfig implements WebSocketConfigurer { diff --git a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/controller/ClusterController.java b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/controller/ClusterController.java index 13d0cdda..4ce73856 100644 --- a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/controller/ClusterController.java +++ b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/controller/ClusterController.java @@ -25,10 +25,6 @@ import org.apache.bigtop.manager.server.service.ClusterService; import org.apache.bigtop.manager.server.utils.ResponseEntity; -import java.util.List; - -import jakarta.annotation.Resource; - import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; @@ -40,6 +36,9 @@ import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.tags.Tag; +import jakarta.annotation.Resource; +import java.util.List; + @Tag(name = "Cluster Controller") @RestController @RequestMapping("/clusters") @@ -62,10 +61,8 @@ public ResponseEntity get(@PathVariable Long id) { @Operation(summary = "update", description = "Update a cluster") @PutMapping("/{id}") - public ResponseEntity update(@PathVariable Long id, - @RequestBody @Validated ClusterReq clusterReq) { + public ResponseEntity update(@PathVariable Long id, @RequestBody @Validated ClusterReq clusterReq) { ClusterDTO clusterDTO = ClusterMapper.INSTANCE.fromReq2DTO(clusterReq); return ResponseEntity.success(clusterService.update(id, clusterDTO)); } - } diff --git a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/controller/CommandController.java b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/controller/CommandController.java index 3691723a..541aaf6e 100644 --- a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/controller/CommandController.java +++ b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/controller/CommandController.java @@ -26,8 +26,6 @@ import org.apache.bigtop.manager.server.service.CommandService; import org.apache.bigtop.manager.server.utils.ResponseEntity; -import jakarta.annotation.Resource; - import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; @@ -37,6 +35,8 @@ import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.tags.Tag; +import jakarta.annotation.Resource; + @Tag(name = "Command Controller") @RestController @RequestMapping("/command") @@ -53,5 +53,4 @@ public ResponseEntity command(@RequestBody @Validated CommandReq comm CommandVO commandVO = commandService.command(commandDTO); return ResponseEntity.success(commandVO); } - } diff --git a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/controller/ComponentController.java b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/controller/ComponentController.java index 706a7cee..94b949f0 100644 --- a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/controller/ComponentController.java +++ b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/controller/ComponentController.java @@ -22,10 +22,6 @@ import org.apache.bigtop.manager.server.service.ComponentService; import org.apache.bigtop.manager.server.utils.ResponseEntity; -import java.util.List; - -import jakarta.annotation.Resource; - import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; @@ -35,6 +31,9 @@ import io.swagger.v3.oas.annotations.tags.Tag; import lombok.extern.slf4j.Slf4j; +import jakarta.annotation.Resource; +import java.util.List; + @Slf4j @Tag(name = "Cluster Component Controller") @RestController @@ -55,5 +54,4 @@ public ResponseEntity> list(@PathVariable Long clusterId) { public ResponseEntity get(@PathVariable Long id) { return ResponseEntity.success(componentService.get(id)); } - } diff --git a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/controller/ConfigController.java b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/controller/ConfigController.java index 66deda69..e82cc573 100644 --- a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/controller/ConfigController.java +++ b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/controller/ConfigController.java @@ -22,10 +22,6 @@ import org.apache.bigtop.manager.server.service.ConfigService; import org.apache.bigtop.manager.server.utils.ResponseEntity; -import java.util.List; - -import jakarta.annotation.Resource; - import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; @@ -36,6 +32,9 @@ import io.swagger.v3.oas.annotations.tags.Tag; import lombok.extern.slf4j.Slf4j; +import jakarta.annotation.Resource; +import java.util.List; + @Slf4j @Tag(name = "Cluster Configuration Controller") @Validated diff --git a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/controller/HostComponentController.java b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/controller/HostComponentController.java index bbaed58d..8dadac25 100644 --- a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/controller/HostComponentController.java +++ b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/controller/HostComponentController.java @@ -22,10 +22,6 @@ import org.apache.bigtop.manager.server.service.HostComponentService; import org.apache.bigtop.manager.server.utils.ResponseEntity; -import java.util.List; - -import jakarta.annotation.Resource; - import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; @@ -34,6 +30,9 @@ import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.tags.Tag; +import jakarta.annotation.Resource; +import java.util.List; + @Tag(name = "Cluster Host-Component Controller") @RestController @RequestMapping("/clusters/{clusterId}/host-components") @@ -56,9 +55,8 @@ public ResponseEntity> listByHost(@PathVariable Long clust @Operation(summary = "list", description = "List host-components") @GetMapping("/services/{serviceId}") - public ResponseEntity> listByService(@PathVariable Long clusterId, - @PathVariable Long serviceId) { + public ResponseEntity> listByService( + @PathVariable Long clusterId, @PathVariable Long serviceId) { return ResponseEntity.success(hostComponentService.listByService(clusterId, serviceId)); } - } diff --git a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/controller/HostController.java b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/controller/HostController.java index 7bda5597..c2eb2ad8 100644 --- a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/controller/HostController.java +++ b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/controller/HostController.java @@ -25,10 +25,6 @@ import org.apache.bigtop.manager.server.service.HostService; import org.apache.bigtop.manager.server.utils.ResponseEntity; -import java.util.List; - -import jakarta.annotation.Resource; - import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; @@ -39,6 +35,9 @@ import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.tags.Tag; +import jakarta.annotation.Resource; +import java.util.List; + @Tag(name = "Cluster Host Controller") @RestController @RequestMapping("/clusters/{clusterId}/hosts") @@ -61,8 +60,7 @@ public ResponseEntity get(@PathVariable Long id) { @Operation(summary = "update", description = "Update a host") // @PutMapping("/{id}") - public ResponseEntity update(@PathVariable Long id, - @RequestBody @Validated HostReq hostReq) { + public ResponseEntity update(@PathVariable Long id, @RequestBody @Validated HostReq hostReq) { HostDTO hostDTO = HostMapper.INSTANCE.fromReq2DTO(hostReq); return ResponseEntity.success(hostService.update(id, hostDTO)); } @@ -72,5 +70,4 @@ public ResponseEntity update(@PathVariable Long id, public ResponseEntity delete(@PathVariable Long id) { return ResponseEntity.success(hostService.delete(id)); } - } diff --git a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/controller/JobController.java b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/controller/JobController.java index c4bd8430..940afd31 100644 --- a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/controller/JobController.java +++ b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/controller/JobController.java @@ -18,22 +18,25 @@ */ package org.apache.bigtop.manager.server.controller; -import io.swagger.v3.oas.annotations.Operation; -import io.swagger.v3.oas.annotations.Parameter; -import io.swagger.v3.oas.annotations.Parameters; -import io.swagger.v3.oas.annotations.enums.ParameterIn; -import io.swagger.v3.oas.annotations.media.Schema; -import io.swagger.v3.oas.annotations.tags.Tag; -import jakarta.annotation.Resource; import org.apache.bigtop.manager.server.model.vo.JobVO; import org.apache.bigtop.manager.server.model.vo.PageVO; import org.apache.bigtop.manager.server.service.JobService; import org.apache.bigtop.manager.server.utils.ResponseEntity; + import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.Parameters; +import io.swagger.v3.oas.annotations.enums.ParameterIn; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.tags.Tag; + +import jakarta.annotation.Resource; + @Tag(name = "Job Controller") @RestController @RequestMapping("/clusters/{clusterId}/jobs") @@ -44,10 +47,14 @@ public class JobController { @Operation(summary = "list", description = "List jobs") @Parameters({ - @Parameter(in = ParameterIn.QUERY, name = "pageNum", schema = @Schema(type = "integer", defaultValue = "1")), - @Parameter(in = ParameterIn.QUERY, name = "pageSize", schema = @Schema(type = "integer", defaultValue = "10")), - @Parameter(in = ParameterIn.QUERY, name = "orderBy", schema = @Schema(type = "string", defaultValue = "id")), - @Parameter(in = ParameterIn.QUERY, name = "sort", description = "asc/desc", schema = @Schema(type = "string", defaultValue = "asc")) + @Parameter(in = ParameterIn.QUERY, name = "pageNum", schema = @Schema(type = "integer", defaultValue = "1")), + @Parameter(in = ParameterIn.QUERY, name = "pageSize", schema = @Schema(type = "integer", defaultValue = "10")), + @Parameter(in = ParameterIn.QUERY, name = "orderBy", schema = @Schema(type = "string", defaultValue = "id")), + @Parameter( + in = ParameterIn.QUERY, + name = "sort", + description = "asc/desc", + schema = @Schema(type = "string", defaultValue = "asc")) }) @GetMapping public ResponseEntity> list(@PathVariable Long clusterId) { diff --git a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/controller/LoginController.java b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/controller/LoginController.java index e3174a32..98f08776 100644 --- a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/controller/LoginController.java +++ b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/controller/LoginController.java @@ -29,8 +29,6 @@ import org.apache.bigtop.manager.server.service.LoginService; import org.apache.bigtop.manager.server.utils.ResponseEntity; -import jakarta.annotation.Resource; - import org.springframework.util.StringUtils; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PostMapping; @@ -40,6 +38,8 @@ import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.tags.Tag; +import jakarta.annotation.Resource; + @Tag(name = "Login Controller") @RestController public class LoginController { diff --git a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/controller/MonitoringController.java b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/controller/MonitoringController.java index 4d834570..de19f5c6 100644 --- a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/controller/MonitoringController.java +++ b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/controller/MonitoringController.java @@ -21,17 +21,16 @@ import org.apache.bigtop.manager.server.service.MonitoringService; import org.apache.bigtop.manager.server.utils.ResponseEntity; -import jakarta.annotation.Resource; - import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import com.fasterxml.jackson.databind.JsonNode; - import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.tags.Tag; +import jakarta.annotation.Resource; + @Tag(name = "Monitoring Controller") @RestController @RequestMapping("monitoring") @@ -45,5 +44,4 @@ public class MonitoringController { public ResponseEntity agentHostsHealthyStatus() { return ResponseEntity.success(monitoringService.queryAgentsHealthyStatus()); } - } diff --git a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/controller/ServiceController.java b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/controller/ServiceController.java index 8a8393a6..24ba7da6 100644 --- a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/controller/ServiceController.java +++ b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/controller/ServiceController.java @@ -22,10 +22,6 @@ import org.apache.bigtop.manager.server.service.ServiceService; import org.apache.bigtop.manager.server.utils.ResponseEntity; -import java.util.List; - -import jakarta.annotation.Resource; - import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; @@ -35,6 +31,9 @@ import io.swagger.v3.oas.annotations.tags.Tag; import lombok.extern.slf4j.Slf4j; +import jakarta.annotation.Resource; +import java.util.List; + @Slf4j @Tag(name = "Cluster Service Controller") @RestController @@ -55,5 +54,4 @@ public ResponseEntity> list(@PathVariable Long clusterId) { public ResponseEntity get(@PathVariable Long id) { return ResponseEntity.success(serviceService.get(id)); } - } diff --git a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/controller/SseController.java b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/controller/SseController.java index 38a79d2c..9ffccefd 100644 --- a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/controller/SseController.java +++ b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/controller/SseController.java @@ -18,18 +18,20 @@ */ package org.apache.bigtop.manager.server.controller; -import io.swagger.v3.oas.annotations.Operation; -import io.swagger.v3.oas.annotations.tags.Tag; -import jakarta.annotation.Resource; import org.apache.bigtop.manager.server.service.CommandLogService; + import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import org.springframework.web.servlet.mvc.method.annotation.SseEmitter; + +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.tags.Tag; import reactor.core.publisher.Flux; import reactor.core.publisher.FluxSink; +import jakarta.annotation.Resource; import java.io.IOException; @Tag(name = "Sse Controller") @@ -45,15 +47,19 @@ public class SseController { public SseEmitter log(@PathVariable Long id, @PathVariable Long clusterId) { SseEmitter emitter = new SseEmitter(); - Flux flux = Flux.create(sink -> commandLogService.registerSink(id, sink), FluxSink.OverflowStrategy.BUFFER); - flux.subscribe(s -> { - try { - emitter.send(s); - } catch (IOException e) { - commandLogService.unregisterSink(id); - emitter.completeWithError(e); - } - }, Throwable::printStackTrace, emitter::complete); + Flux flux = + Flux.create(sink -> commandLogService.registerSink(id, sink), FluxSink.OverflowStrategy.BUFFER); + flux.subscribe( + s -> { + try { + emitter.send(s); + } catch (IOException e) { + commandLogService.unregisterSink(id); + emitter.completeWithError(e); + } + }, + Throwable::printStackTrace, + emitter::complete); emitter.onTimeout(emitter::complete); emitter.onCompletion(() -> commandLogService.unregisterSink(id)); diff --git a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/controller/StackController.java b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/controller/StackController.java index 10129e53..ef30f320 100644 --- a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/controller/StackController.java +++ b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/controller/StackController.java @@ -24,10 +24,6 @@ import org.apache.bigtop.manager.server.service.StackService; import org.apache.bigtop.manager.server.utils.ResponseEntity; -import java.util.List; - -import jakarta.annotation.Resource; - import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; @@ -36,6 +32,9 @@ import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.tags.Tag; +import jakarta.annotation.Resource; +import java.util.List; + @Tag(name = "Stack Controller") @RestController @RequestMapping("/stacks") @@ -52,15 +51,15 @@ public ResponseEntity> list() { @Operation(summary = "list", description = "List stacks components") @GetMapping("/{stackName}/{stackVersion}/components") - public ResponseEntity> components(@PathVariable String stackName, - @PathVariable String stackVersion) { + public ResponseEntity> components( + @PathVariable String stackName, @PathVariable String stackVersion) { return ResponseEntity.success(stackService.components(stackName, stackVersion)); } @Operation(summary = "list", description = "List stacks configurations") @GetMapping("/{stackName}/{stackVersion}/configurations") - public ResponseEntity> configurations(@PathVariable String stackName, - @PathVariable String stackVersion) { + public ResponseEntity> configurations( + @PathVariable String stackName, @PathVariable String stackVersion) { return ResponseEntity.success(stackService.configurations(stackName, stackVersion)); } } diff --git a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/controller/UserController.java b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/controller/UserController.java index f5462dc1..b2f9d92c 100644 --- a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/controller/UserController.java +++ b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/controller/UserController.java @@ -26,8 +26,6 @@ import org.apache.bigtop.manager.server.service.UserService; import org.apache.bigtop.manager.server.utils.ResponseEntity; -import jakarta.annotation.Resource; - import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PutMapping; @@ -38,6 +36,8 @@ import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.tags.Tag; +import jakarta.annotation.Resource; + @Tag(name = "User Controller") @RestController @RequestMapping("/users") diff --git a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/enums/ApiExceptionEnum.java b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/enums/ApiExceptionEnum.java index 5dec24d2..e52e1ec1 100644 --- a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/enums/ApiExceptionEnum.java +++ b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/enums/ApiExceptionEnum.java @@ -25,7 +25,6 @@ @Getter public enum ApiExceptionEnum { - NEED_LOGIN(10000, LocaleKeys.LOGIN_REQUIRED), USERNAME_OR_PASSWORD_REQUIRED(10001, LocaleKeys.LOGIN_ACCOUNT_REQUIRED), INCORRECT_USERNAME_OR_PASSWORD(10002, LocaleKeys.LOGIN_ACCOUNT_INCORRECT), diff --git a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/enums/JobStrategyType.java b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/enums/JobStrategyType.java index 4afbd83b..8c586d2f 100644 --- a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/enums/JobStrategyType.java +++ b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/enums/JobStrategyType.java @@ -19,7 +19,6 @@ package org.apache.bigtop.manager.server.enums; public enum JobStrategyType { - OVER_ON_FAIL, CONTINUE_ON_FAIL, diff --git a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/enums/LocaleKeys.java b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/enums/LocaleKeys.java index 3c4c905e..0a24e608 100644 --- a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/enums/LocaleKeys.java +++ b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/enums/LocaleKeys.java @@ -22,7 +22,6 @@ @Getter public enum LocaleKeys { - REQUEST_SUCCESS("request.success"), REQUEST_FAILED("request.failed"), PARAMETER_ERROR("request.parameter.incorrect"), diff --git a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/enums/ResponseStatus.java b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/enums/ResponseStatus.java index 41587087..b0db1844 100644 --- a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/enums/ResponseStatus.java +++ b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/enums/ResponseStatus.java @@ -24,13 +24,11 @@ @Getter public enum ResponseStatus { - SUCCESS(0, LocaleKeys.REQUEST_SUCCESS), INTERNAL_SERVER_ERROR(-1, LocaleKeys.REQUEST_FAILED), PARAMETER_ERROR(1, LocaleKeys.PARAMETER_ERROR), - ; private final Integer code; diff --git a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/enums/heartbeat/HostState.java b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/enums/heartbeat/HostState.java index 4275a6fa..cb6386b5 100644 --- a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/enums/heartbeat/HostState.java +++ b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/enums/heartbeat/HostState.java @@ -19,7 +19,6 @@ package org.apache.bigtop.manager.server.enums.heartbeat; public enum HostState { - INITIALIZING, HEALTHY, diff --git a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/exception/GlobalExceptionHandler.java b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/exception/GlobalExceptionHandler.java index 7757278e..73496ab3 100644 --- a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/exception/GlobalExceptionHandler.java +++ b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/exception/GlobalExceptionHandler.java @@ -25,8 +25,6 @@ import org.apache.commons.lang3.EnumUtils; -import jakarta.validation.ConstraintViolationException; - import org.springframework.validation.FieldError; import org.springframework.web.bind.MethodArgumentNotValidException; import org.springframework.web.bind.annotation.ExceptionHandler; @@ -34,6 +32,8 @@ import lombok.extern.slf4j.Slf4j; +import jakarta.validation.ConstraintViolationException; + @Slf4j @RestControllerAdvice public class GlobalExceptionHandler { diff --git a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/exception/ServerException.java b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/exception/ServerException.java index 0ee16aea..6a783519 100644 --- a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/exception/ServerException.java +++ b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/exception/ServerException.java @@ -33,5 +33,4 @@ public ServerException(String msgFormat, Object... args) { public ServerException(Throwable cause) { super(cause); } - } diff --git a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/holder/SpringContextHolder.java b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/holder/SpringContextHolder.java index 9a16bc82..c3c6e216 100644 --- a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/holder/SpringContextHolder.java +++ b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/holder/SpringContextHolder.java @@ -25,16 +25,15 @@ import org.apache.bigtop.manager.server.command.stage.runner.StageRunner; import org.apache.bigtop.manager.server.ws.ServerWebSocketHandler; -import java.util.Map; - -import jakarta.annotation.Nonnull; - import org.springframework.context.ApplicationContext; import org.springframework.context.ApplicationContextAware; import org.springframework.stereotype.Component; import lombok.Getter; +import jakarta.annotation.Nonnull; +import java.util.Map; + @Component public class SpringContextHolder implements ApplicationContextAware { diff --git a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/interceptor/AuthInterceptor.java b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/interceptor/AuthInterceptor.java index 52b63fca..1bbb2a83 100644 --- a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/interceptor/AuthInterceptor.java +++ b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/interceptor/AuthInterceptor.java @@ -26,23 +26,23 @@ import org.apache.commons.lang3.StringUtils; -import jakarta.servlet.http.HttpServletRequest; -import jakarta.servlet.http.HttpServletResponse; - import org.springframework.stereotype.Component; import org.springframework.web.servlet.HandlerInterceptor; import org.springframework.web.servlet.ModelAndView; import com.auth0.jwt.interfaces.DecodedJWT; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; + @Component public class AuthInterceptor implements HandlerInterceptor { private ResponseEntity responseEntity; @Override - public boolean preHandle(HttpServletRequest request, HttpServletResponse response, - Object handler) throws Exception { + public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) + throws Exception { if (checkLogin(request) && checkPermission()) { return HandlerInterceptor.super.preHandle(request, response, handler); } else { @@ -53,14 +53,15 @@ public boolean preHandle(HttpServletRequest request, HttpServletResponse respons } @Override - public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler, - ModelAndView modelAndView) throws Exception { + public void postHandle( + HttpServletRequest request, HttpServletResponse response, Object handler, ModelAndView modelAndView) + throws Exception { HandlerInterceptor.super.postHandle(request, response, handler, modelAndView); } @Override - public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler, - Exception ex) throws Exception { + public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) + throws Exception { clearStatus(); HandlerInterceptor.super.afterCompletion(request, response, handler, ex); diff --git a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/model/dto/ClusterDTO.java b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/model/dto/ClusterDTO.java index f7ffcc8a..4d335eab 100644 --- a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/model/dto/ClusterDTO.java +++ b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/model/dto/ClusterDTO.java @@ -18,10 +18,10 @@ */ package org.apache.bigtop.manager.server.model.dto; -import java.util.List; - import lombok.Data; +import java.util.List; + @Data public class ClusterDTO { @@ -36,5 +36,4 @@ public class ClusterDTO { private List repoInfoList; private List hostnames; - } diff --git a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/model/dto/CommandDTO.java b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/model/dto/CommandDTO.java index fd4da03e..5ea67aa0 100644 --- a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/model/dto/CommandDTO.java +++ b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/model/dto/CommandDTO.java @@ -27,12 +27,12 @@ import org.apache.commons.text.CaseUtils; +import lombok.Data; + import java.io.Serializable; import java.text.MessageFormat; import java.util.List; -import lombok.Data; - @Data public class CommandDTO implements Serializable { @@ -60,9 +60,8 @@ public String getContext() { if (command == null) { return MessageFormat.format("{0} for {1}", customCommand, commandLevel.toLowerCase()); } else { - return MessageFormat.format("{0} for {1}", CaseUtils.toCamelCase(command.name(), true), - commandLevel.toLowerCase()); + return MessageFormat.format( + "{0} for {1}", CaseUtils.toCamelCase(command.name(), true), commandLevel.toLowerCase()); } } - } diff --git a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/model/dto/ComponentDTO.java b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/model/dto/ComponentDTO.java index b53a1ad1..3589161f 100644 --- a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/model/dto/ComponentDTO.java +++ b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/model/dto/ComponentDTO.java @@ -18,10 +18,10 @@ */ package org.apache.bigtop.manager.server.model.dto; -import java.util.List; - import lombok.Data; +import java.util.List; + @Data public class ComponentDTO { diff --git a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/model/dto/ComponentHostDTO.java b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/model/dto/ComponentHostDTO.java index 10cc4550..d2b4f8d9 100644 --- a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/model/dto/ComponentHostDTO.java +++ b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/model/dto/ComponentHostDTO.java @@ -18,12 +18,11 @@ */ package org.apache.bigtop.manager.server.model.dto; -import java.io.Serializable; -import java.util.List; +import lombok.Data; import jakarta.validation.constraints.NotEmpty; - -import lombok.Data; +import java.io.Serializable; +import java.util.List; @Data public class ComponentHostDTO implements Serializable { diff --git a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/model/dto/OSSpecificDTO.java b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/model/dto/OSSpecificDTO.java index 9b3d19ac..4160f071 100644 --- a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/model/dto/OSSpecificDTO.java +++ b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/model/dto/OSSpecificDTO.java @@ -18,10 +18,10 @@ */ package org.apache.bigtop.manager.server.model.dto; -import java.util.List; - import lombok.Data; +import java.util.List; + @Data public class OSSpecificDTO { diff --git a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/model/dto/PropertyDTO.java b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/model/dto/PropertyDTO.java index ddebd5bf..bab0ae2d 100644 --- a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/model/dto/PropertyDTO.java +++ b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/model/dto/PropertyDTO.java @@ -18,10 +18,10 @@ */ package org.apache.bigtop.manager.server.model.dto; -import java.io.Serializable; - import lombok.Data; +import java.io.Serializable; + @Data public class PropertyDTO implements Serializable { @@ -32,5 +32,4 @@ public class PropertyDTO implements Serializable { private String displayName; private String desc; - } diff --git a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/model/dto/RepoDTO.java b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/model/dto/RepoDTO.java index c3eaf214..aee938d1 100644 --- a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/model/dto/RepoDTO.java +++ b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/model/dto/RepoDTO.java @@ -36,5 +36,4 @@ public class RepoDTO { private String os; private String arch; - } diff --git a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/model/dto/ServiceConfigDTO.java b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/model/dto/ServiceConfigDTO.java index 48ece35d..ae253b2f 100644 --- a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/model/dto/ServiceConfigDTO.java +++ b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/model/dto/ServiceConfigDTO.java @@ -18,11 +18,11 @@ */ package org.apache.bigtop.manager.server.model.dto; +import lombok.Data; + import java.io.Serializable; import java.util.List; -import lombok.Data; - @Data public class ServiceConfigDTO implements Serializable { diff --git a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/model/dto/ServiceDTO.java b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/model/dto/ServiceDTO.java index f33cadb9..4e470071 100644 --- a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/model/dto/ServiceDTO.java +++ b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/model/dto/ServiceDTO.java @@ -18,10 +18,10 @@ */ package org.apache.bigtop.manager.server.model.dto; -import java.util.List; - import lombok.Data; +import java.util.List; + @Data public class ServiceDTO { diff --git a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/model/dto/StackDTO.java b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/model/dto/StackDTO.java index fa1999c9..a1cac071 100644 --- a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/model/dto/StackDTO.java +++ b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/model/dto/StackDTO.java @@ -18,10 +18,10 @@ */ package org.apache.bigtop.manager.server.model.dto; -import java.util.List; - import lombok.Data; +import java.util.List; + @Data public class StackDTO { diff --git a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/model/dto/TypeConfigDTO.java b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/model/dto/TypeConfigDTO.java index c3bcd0a8..40b72b81 100644 --- a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/model/dto/TypeConfigDTO.java +++ b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/model/dto/TypeConfigDTO.java @@ -18,16 +18,15 @@ */ package org.apache.bigtop.manager.server.model.dto; +import lombok.Data; + import java.io.Serializable; import java.util.List; -import lombok.Data; - @Data public class TypeConfigDTO implements Serializable { private String typeName; private List properties; - } diff --git a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/model/dto/command/ClusterCommandDTO.java b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/model/dto/command/ClusterCommandDTO.java index fb79c1ea..c047007e 100644 --- a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/model/dto/command/ClusterCommandDTO.java +++ b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/model/dto/command/ClusterCommandDTO.java @@ -20,10 +20,10 @@ import org.apache.bigtop.manager.server.model.dto.RepoDTO; -import java.util.List; - import lombok.Data; +import java.util.List; + @Data public class ClusterCommandDTO { @@ -38,5 +38,4 @@ public class ClusterCommandDTO { private List repoInfoList; private List hostnames; - } diff --git a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/model/dto/command/ComponentCommandDTO.java b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/model/dto/command/ComponentCommandDTO.java index 460b0eef..daf111cb 100644 --- a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/model/dto/command/ComponentCommandDTO.java +++ b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/model/dto/command/ComponentCommandDTO.java @@ -18,16 +18,15 @@ */ package org.apache.bigtop.manager.server.model.dto.command; +import lombok.Data; + import java.io.Serializable; import java.util.List; -import lombok.Data; - @Data public class ComponentCommandDTO implements Serializable { private String componentName; private List hostnames; - } diff --git a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/model/dto/command/HostCommandDTO.java b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/model/dto/command/HostCommandDTO.java index 88b44d87..94764880 100644 --- a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/model/dto/command/HostCommandDTO.java +++ b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/model/dto/command/HostCommandDTO.java @@ -18,10 +18,10 @@ */ package org.apache.bigtop.manager.server.model.dto.command; -import java.io.Serializable; - import lombok.Data; +import java.io.Serializable; + @Data public class HostCommandDTO implements Serializable { diff --git a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/model/dto/command/ServiceCommandDTO.java b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/model/dto/command/ServiceCommandDTO.java index 849a47cd..ea687df2 100644 --- a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/model/dto/command/ServiceCommandDTO.java +++ b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/model/dto/command/ServiceCommandDTO.java @@ -21,11 +21,11 @@ import org.apache.bigtop.manager.server.model.dto.ComponentHostDTO; import org.apache.bigtop.manager.server.model.dto.TypeConfigDTO; +import lombok.Data; + import java.io.Serializable; import java.util.List; -import lombok.Data; - @Data public class ServiceCommandDTO implements Serializable { diff --git a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/model/mapper/CommandMapper.java b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/model/mapper/CommandMapper.java index 11bd4e3a..8ce164d2 100644 --- a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/model/mapper/CommandMapper.java +++ b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/model/mapper/CommandMapper.java @@ -23,11 +23,11 @@ import org.apache.bigtop.manager.server.model.req.CommandReq; import org.apache.bigtop.manager.server.model.req.command.ServiceCommandReq; -import java.util.List; - import org.mapstruct.Mapper; import org.mapstruct.factory.Mappers; +import java.util.List; + @Mapper public interface CommandMapper { @@ -38,5 +38,4 @@ public interface CommandMapper { ServiceCommandDTO fromServiceReq2DTO(ServiceCommandReq req); List fromServiceReq2DTO(List reqs); - } diff --git a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/model/mapper/ComponentMapper.java b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/model/mapper/ComponentMapper.java index 2c3f7783..43cec48f 100644 --- a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/model/mapper/ComponentMapper.java +++ b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/model/mapper/ComponentMapper.java @@ -25,13 +25,13 @@ import org.apache.bigtop.manager.server.model.vo.ComponentVO; import org.apache.bigtop.manager.server.stack.pojo.ComponentModel; -import java.util.List; - import org.mapstruct.Context; import org.mapstruct.Mapper; import org.mapstruct.Mapping; import org.mapstruct.factory.Mappers; +import java.util.List; + @Mapper(uses = {TypeConvert.class}) public interface ComponentMapper { @@ -55,5 +55,4 @@ public interface ComponentMapper { ComponentVO fromEntity2VO(Component component); List fromEntity2VO(List components); - } diff --git a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/model/mapper/HostComponentMapper.java b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/model/mapper/HostComponentMapper.java index 79da0e18..607e868f 100644 --- a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/model/mapper/HostComponentMapper.java +++ b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/model/mapper/HostComponentMapper.java @@ -20,6 +20,7 @@ import org.apache.bigtop.manager.dao.entity.HostComponent; import org.apache.bigtop.manager.server.model.vo.HostComponentVO; + import org.mapstruct.Mapper; import org.mapstruct.Mapping; import org.mapstruct.factory.Mappers; @@ -40,6 +41,4 @@ public interface HostComponentMapper { HostComponentVO fromEntity2VO(HostComponent hostComponent); List fromEntity2VO(List hostComponents); - - } diff --git a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/model/mapper/HostMapper.java b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/model/mapper/HostMapper.java index aef0c37b..71bbe16c 100644 --- a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/model/mapper/HostMapper.java +++ b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/model/mapper/HostMapper.java @@ -23,12 +23,12 @@ import org.apache.bigtop.manager.server.model.req.HostReq; import org.apache.bigtop.manager.server.model.vo.HostVO; -import java.util.List; - import org.mapstruct.Mapper; import org.mapstruct.Mapping; import org.mapstruct.factory.Mappers; +import java.util.List; + @Mapper public interface HostMapper { @@ -42,5 +42,4 @@ public interface HostMapper { HostVO fromEntity2VO(Host host); List fromEntity2VO(List hosts); - } diff --git a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/model/mapper/JobMapper.java b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/model/mapper/JobMapper.java index 373f7bd4..faec160e 100644 --- a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/model/mapper/JobMapper.java +++ b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/model/mapper/JobMapper.java @@ -22,12 +22,12 @@ import org.apache.bigtop.manager.server.model.vo.CommandVO; import org.apache.bigtop.manager.server.model.vo.JobVO; -import java.util.List; - import org.mapstruct.Mapper; import org.mapstruct.Mapping; import org.mapstruct.factory.Mappers; +import java.util.List; + @Mapper(uses = {StageMapper.class, TaskMapper.class}) public interface JobMapper { diff --git a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/model/mapper/PropertyMapper.java b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/model/mapper/PropertyMapper.java index fc2f399e..abf8a8b3 100644 --- a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/model/mapper/PropertyMapper.java +++ b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/model/mapper/PropertyMapper.java @@ -21,11 +21,11 @@ import org.apache.bigtop.manager.server.model.dto.PropertyDTO; import org.apache.bigtop.manager.server.model.vo.PropertyVO; -import java.util.List; - import org.mapstruct.Mapper; import org.mapstruct.factory.Mappers; +import java.util.List; + @Mapper public interface PropertyMapper { diff --git a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/model/mapper/RepoMapper.java b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/model/mapper/RepoMapper.java index 77f6065f..1ac16089 100644 --- a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/model/mapper/RepoMapper.java +++ b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/model/mapper/RepoMapper.java @@ -23,13 +23,13 @@ import org.apache.bigtop.manager.dao.entity.Repo; import org.apache.bigtop.manager.server.model.dto.RepoDTO; -import java.util.List; - import org.mapstruct.Context; import org.mapstruct.Mapper; import org.mapstruct.Mapping; import org.mapstruct.factory.Mappers; +import java.util.List; + @Mapper public interface RepoMapper { @@ -44,5 +44,4 @@ public interface RepoMapper { RepoInfo fromEntity2Message(Repo repo); List fromDTO2Message(List repoDTOs); - } diff --git a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/model/mapper/ServiceConfigMapper.java b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/model/mapper/ServiceConfigMapper.java index f7d88534..b72e5f7d 100644 --- a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/model/mapper/ServiceConfigMapper.java +++ b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/model/mapper/ServiceConfigMapper.java @@ -21,12 +21,12 @@ import org.apache.bigtop.manager.dao.entity.ServiceConfig; import org.apache.bigtop.manager.server.model.vo.ServiceConfigVO; -import java.util.List; - import org.mapstruct.Mapper; import org.mapstruct.Mapping; import org.mapstruct.factory.Mappers; +import java.util.List; + @Mapper(uses = {TypeConfigMapper.class}) public interface ServiceConfigMapper { diff --git a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/model/mapper/ServiceMapper.java b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/model/mapper/ServiceMapper.java index 70c81cf8..82d6b9f3 100644 --- a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/model/mapper/ServiceMapper.java +++ b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/model/mapper/ServiceMapper.java @@ -24,13 +24,13 @@ import org.apache.bigtop.manager.server.model.vo.ServiceVO; import org.apache.bigtop.manager.server.stack.pojo.ServiceModel; -import java.util.List; - import org.mapstruct.Context; import org.mapstruct.Mapper; import org.mapstruct.Mapping; import org.mapstruct.factory.Mappers; +import java.util.List; + @Mapper(uses = {ComponentMapper.class, TypeConvert.class}) public interface ServiceMapper { @@ -57,5 +57,4 @@ public interface ServiceMapper { ServiceVO fromEntity2VO(Service service); List fromEntity2VO(List services); - } diff --git a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/model/mapper/StackMapper.java b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/model/mapper/StackMapper.java index 4664168e..95e4649a 100644 --- a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/model/mapper/StackMapper.java +++ b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/model/mapper/StackMapper.java @@ -36,5 +36,4 @@ public interface StackMapper { StackVO fromDTO2VO(StackDTO stackDTO); StackDTO fromModel2DTO(StackModel stackModel); - } diff --git a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/model/mapper/TypeConfigMapper.java b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/model/mapper/TypeConfigMapper.java index c48b1a38..b2ee7a10 100644 --- a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/model/mapper/TypeConfigMapper.java +++ b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/model/mapper/TypeConfigMapper.java @@ -22,13 +22,13 @@ import org.apache.bigtop.manager.server.model.dto.TypeConfigDTO; import org.apache.bigtop.manager.server.model.vo.TypeConfigVO; -import java.util.List; - import org.mapstruct.Mapper; import org.mapstruct.Mapping; import org.mapstruct.Named; import org.mapstruct.factory.Mappers; +import java.util.List; + @Mapper(uses = {TypeConvert.class}) public interface TypeConfigMapper { diff --git a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/model/mapper/TypeConvert.java b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/model/mapper/TypeConvert.java index e78cb806..89af1265 100644 --- a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/model/mapper/TypeConvert.java +++ b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/model/mapper/TypeConvert.java @@ -22,12 +22,12 @@ import org.apache.bigtop.manager.server.model.dto.PropertyDTO; import org.apache.bigtop.manager.server.model.vo.PropertyVO; -import java.util.List; - import org.mapstruct.Named; import com.fasterxml.jackson.core.type.TypeReference; +import java.util.List; + public class TypeConvert { @Named("obj2Json") @@ -37,19 +37,16 @@ public String obj2Json(T obj) { @Named("json2List") public List json2List(String json) { - return JsonUtils.readFromString(json, new TypeReference<>() { - }); + return JsonUtils.readFromString(json, new TypeReference<>() {}); } @Named("json2PropertyDTOList") public List json2PropertyDTOList(String json) { - return JsonUtils.readFromString(json, new TypeReference<>() { - }); + return JsonUtils.readFromString(json, new TypeReference<>() {}); } @Named("json2PropertyVOList") public List json2PropertyVOList(String json) { - return JsonUtils.readFromString(json, new TypeReference<>() { - }); + return JsonUtils.readFromString(json, new TypeReference<>() {}); } } diff --git a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/model/req/ClusterReq.java b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/model/req/ClusterReq.java index ca13d1e4..a125df7f 100644 --- a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/model/req/ClusterReq.java +++ b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/model/req/ClusterReq.java @@ -18,13 +18,12 @@ */ package org.apache.bigtop.manager.server.model.req; -import java.util.List; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; import jakarta.validation.constraints.NotEmpty; import jakarta.validation.constraints.NotNull; - -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; +import java.util.List; @Data public class ClusterReq { @@ -33,8 +32,7 @@ public class ClusterReq { @Schema(example = "c1") private String clusterName; - @NotNull - @Schema(example = "1") + @NotNull @Schema(example = "1") private Integer clusterType; @NotEmpty diff --git a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/model/req/CommandReq.java b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/model/req/CommandReq.java index dc8f1c55..3194f4c6 100644 --- a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/model/req/CommandReq.java +++ b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/model/req/CommandReq.java @@ -26,23 +26,21 @@ import org.apache.bigtop.manager.server.model.req.command.HostCommandReq; import org.apache.bigtop.manager.server.model.req.command.ServiceCommandReq; -import java.util.List; - -import jakarta.validation.Valid; -import jakarta.validation.constraints.NotEmpty; -import jakarta.validation.constraints.NotNull; - import org.hibernate.validator.group.GroupSequenceProvider; import io.swagger.v3.oas.annotations.media.Schema; import lombok.Data; +import jakarta.validation.Valid; +import jakarta.validation.constraints.NotEmpty; +import jakarta.validation.constraints.NotNull; +import java.util.List; + @Data @GroupSequenceProvider(CommandGroupSequenceProvider.class) public class CommandReq { - @NotNull - @Schema(example = "start") + @NotNull @Schema(example = "start") private Command command; @Schema(example = "custom_command") @@ -51,24 +49,19 @@ public class CommandReq { @Schema(example = "1") private Long clusterId; - @NotNull - @Schema(example = "cluster") + @NotNull @Schema(example = "cluster") private CommandLevel commandLevel; - @NotNull(groups = {CommandGroupSequenceProvider.ClusterCommandGroup.class}) - @Schema(description = "Command details for cluster level command") + @NotNull(groups = {CommandGroupSequenceProvider.ClusterCommandGroup.class}) @Schema(description = "Command details for cluster level command") private ClusterCommandReq clusterCommand; - @NotNull(groups = {CommandGroupSequenceProvider.HostCommandGroup.class}) - @Schema(description = "Command details for host level command") + @NotNull(groups = {CommandGroupSequenceProvider.HostCommandGroup.class}) @Schema(description = "Command details for host level command") private List<@Valid HostCommandReq> hostCommands; @NotEmpty(groups = {CommandGroupSequenceProvider.ServiceCommandGroup.class}) @Schema(description = "Command details for service level command") private List<@Valid ServiceCommandReq> serviceCommands; - @NotNull(groups = {CommandGroupSequenceProvider.ComponentCommandGroup.class}) - @Schema(description = "Command details for component level command") + @NotNull(groups = {CommandGroupSequenceProvider.ComponentCommandGroup.class}) @Schema(description = "Command details for component level command") private List<@Valid ComponentCommandReq> componentCommands; - } diff --git a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/model/req/ComponentHostReq.java b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/model/req/ComponentHostReq.java index a0e0cb49..515e6249 100644 --- a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/model/req/ComponentHostReq.java +++ b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/model/req/ComponentHostReq.java @@ -18,19 +18,17 @@ */ package org.apache.bigtop.manager.server.model.req; -import java.util.List; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; import jakarta.validation.constraints.NotEmpty; import jakarta.validation.constraints.NotNull; - -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; +import java.util.List; @Data public class ComponentHostReq { - @NotNull - @Schema(description = "Component name", example = "zookeeper-server") + @NotNull @Schema(description = "Component name", example = "zookeeper-server") private String componentName; @NotEmpty diff --git a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/model/req/HostReq.java b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/model/req/HostReq.java index 78c050de..aad20355 100644 --- a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/model/req/HostReq.java +++ b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/model/req/HostReq.java @@ -18,17 +18,16 @@ */ package org.apache.bigtop.manager.server.model.req; -import jakarta.validation.constraints.NotEmpty; -import jakarta.validation.constraints.NotNull; - import io.swagger.v3.oas.annotations.media.Schema; import lombok.Data; +import jakarta.validation.constraints.NotEmpty; +import jakarta.validation.constraints.NotNull; + @Data public class HostReq { - @NotNull - @Schema(example = "1") + @NotNull @Schema(example = "1") private Long clusterId; @NotEmpty diff --git a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/model/req/PropertyReq.java b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/model/req/PropertyReq.java index 1b877fe6..c6655515 100644 --- a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/model/req/PropertyReq.java +++ b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/model/req/PropertyReq.java @@ -18,10 +18,10 @@ */ package org.apache.bigtop.manager.server.model.req; -import jakarta.validation.constraints.NotBlank; - import lombok.Data; +import jakarta.validation.constraints.NotBlank; + @Data public class PropertyReq { @@ -33,5 +33,4 @@ public class PropertyReq { private String displayName; private String desc; - } diff --git a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/model/req/RepoReq.java b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/model/req/RepoReq.java index 1a3d3b70..c2d26ca5 100644 --- a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/model/req/RepoReq.java +++ b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/model/req/RepoReq.java @@ -36,5 +36,4 @@ public class RepoReq { private String os; private String arch; - } diff --git a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/model/req/ServiceConfigReq.java b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/model/req/ServiceConfigReq.java index 06a2d379..63a8b5b8 100644 --- a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/model/req/ServiceConfigReq.java +++ b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/model/req/ServiceConfigReq.java @@ -18,13 +18,12 @@ */ package org.apache.bigtop.manager.server.model.req; -import java.util.List; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; import jakarta.validation.Valid; import jakarta.validation.constraints.NotBlank; - -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; +import java.util.List; @Data public class ServiceConfigReq { diff --git a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/model/req/TypeConfigReq.java b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/model/req/TypeConfigReq.java index 5714c475..f4824a1f 100644 --- a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/model/req/TypeConfigReq.java +++ b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/model/req/TypeConfigReq.java @@ -18,14 +18,13 @@ */ package org.apache.bigtop.manager.server.model.req; -import java.util.List; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; import jakarta.validation.Valid; import jakarta.validation.constraints.NotBlank; import jakarta.validation.constraints.NotEmpty; - -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; +import java.util.List; @Data public class TypeConfigReq { @@ -40,5 +39,4 @@ public class TypeConfigReq { @NotEmpty @Schema(example = "{\"name\":\"clientPort\",\"value\": \"2181\"}") private List<@Valid PropertyReq> properties; - } diff --git a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/model/req/UserReq.java b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/model/req/UserReq.java index 6444a5db..32d7df8f 100644 --- a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/model/req/UserReq.java +++ b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/model/req/UserReq.java @@ -28,5 +28,4 @@ public class UserReq { private String username; private String nickname; - } diff --git a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/model/req/command/ClusterCommandReq.java b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/model/req/command/ClusterCommandReq.java index 44d8dcb0..820a02d6 100644 --- a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/model/req/command/ClusterCommandReq.java +++ b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/model/req/command/ClusterCommandReq.java @@ -20,13 +20,12 @@ import org.apache.bigtop.manager.server.model.req.RepoReq; -import java.util.List; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; import jakarta.validation.constraints.NotEmpty; import jakarta.validation.constraints.NotNull; - -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; +import java.util.List; @Data public class ClusterCommandReq { @@ -35,8 +34,7 @@ public class ClusterCommandReq { @Schema(example = "c1") private String clusterName; - @NotNull - @Schema(example = "1") + @NotNull @Schema(example = "1") private Integer clusterType; @NotEmpty diff --git a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/model/req/command/ComponentCommandReq.java b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/model/req/command/ComponentCommandReq.java index a564d1f9..b00c65f6 100644 --- a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/model/req/command/ComponentCommandReq.java +++ b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/model/req/command/ComponentCommandReq.java @@ -18,13 +18,12 @@ */ package org.apache.bigtop.manager.server.model.req.command; -import java.util.List; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; import jakarta.validation.constraints.NotBlank; import jakarta.validation.constraints.NotEmpty; - -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; +import java.util.List; @Data public class ComponentCommandReq { diff --git a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/model/req/command/HostCommandReq.java b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/model/req/command/HostCommandReq.java index 93cdee56..d7b8f653 100644 --- a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/model/req/command/HostCommandReq.java +++ b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/model/req/command/HostCommandReq.java @@ -18,11 +18,11 @@ */ package org.apache.bigtop.manager.server.model.req.command; -import jakarta.validation.constraints.NotBlank; - import io.swagger.v3.oas.annotations.media.Schema; import lombok.Data; +import jakarta.validation.constraints.NotBlank; + @Data public class HostCommandReq { diff --git a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/model/req/command/ServiceCommandReq.java b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/model/req/command/ServiceCommandReq.java index 22d01b09..ebb015bc 100644 --- a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/model/req/command/ServiceCommandReq.java +++ b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/model/req/command/ServiceCommandReq.java @@ -22,20 +22,18 @@ import org.apache.bigtop.manager.server.model.req.ComponentHostReq; import org.apache.bigtop.manager.server.model.req.TypeConfigReq; -import java.util.List; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; import jakarta.validation.Valid; import jakarta.validation.constraints.NotEmpty; import jakarta.validation.constraints.NotNull; - -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; +import java.util.List; @Data public class ServiceCommandReq { - @NotNull - @Schema(description = "Service name", example = "zookeeper") + @NotNull @Schema(description = "Service name", example = "zookeeper") private String serviceName; @Schema(description = "Config Description", example = "Initial config for zookeeper") diff --git a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/model/vo/ComponentVO.java b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/model/vo/ComponentVO.java index d6c6ec4b..71748c5a 100644 --- a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/model/vo/ComponentVO.java +++ b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/model/vo/ComponentVO.java @@ -36,5 +36,4 @@ public class ComponentVO { private String clusterName; private String cardinality; - } diff --git a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/model/vo/JobVO.java b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/model/vo/JobVO.java index fcfddec1..09986305 100644 --- a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/model/vo/JobVO.java +++ b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/model/vo/JobVO.java @@ -20,10 +20,10 @@ import org.apache.bigtop.manager.common.enums.JobState; -import java.util.List; - import lombok.Data; +import java.util.List; + @Data public class JobVO { @@ -38,5 +38,4 @@ public class JobVO { private String createTime; private String updateTime; - } diff --git a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/model/vo/PageVO.java b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/model/vo/PageVO.java index d8d452d7..e2cbef63 100644 --- a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/model/vo/PageVO.java +++ b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/model/vo/PageVO.java @@ -20,15 +20,15 @@ import org.apache.bigtop.manager.server.exception.ServerException; -import java.lang.reflect.Method; -import java.util.ArrayList; -import java.util.List; - import org.mapstruct.factory.Mappers; import org.springframework.data.domain.Page; import lombok.Data; +import java.lang.reflect.Method; +import java.util.ArrayList; +import java.util.List; + @Data public class PageVO { diff --git a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/model/vo/PropertyVO.java b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/model/vo/PropertyVO.java index 0b53f2e2..8442d84c 100644 --- a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/model/vo/PropertyVO.java +++ b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/model/vo/PropertyVO.java @@ -30,5 +30,4 @@ public class PropertyVO { private String displayName; private String desc; - } diff --git a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/model/vo/RepoVO.java b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/model/vo/RepoVO.java index 247bd56b..ee7ca0f5 100644 --- a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/model/vo/RepoVO.java +++ b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/model/vo/RepoVO.java @@ -32,5 +32,4 @@ public class RepoVO { private String os; private String arch; - } diff --git a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/model/vo/ServiceComponentVO.java b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/model/vo/ServiceComponentVO.java index 28763b3e..52179668 100644 --- a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/model/vo/ServiceComponentVO.java +++ b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/model/vo/ServiceComponentVO.java @@ -18,10 +18,10 @@ */ package org.apache.bigtop.manager.server.model.vo; -import java.util.List; - import lombok.Data; +import java.util.List; + @Data public class ServiceComponentVO { diff --git a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/model/vo/ServiceConfigVO.java b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/model/vo/ServiceConfigVO.java index 91167496..8590eeb2 100644 --- a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/model/vo/ServiceConfigVO.java +++ b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/model/vo/ServiceConfigVO.java @@ -18,10 +18,10 @@ */ package org.apache.bigtop.manager.server.model.vo; -import java.util.List; - import lombok.Data; +import java.util.List; + @Data public class ServiceConfigVO { @@ -36,5 +36,4 @@ public class ServiceConfigVO { private String createTime; private String updateTime; - } diff --git a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/model/vo/ServiceVO.java b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/model/vo/ServiceVO.java index 9436e1e9..568fb4ab 100644 --- a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/model/vo/ServiceVO.java +++ b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/model/vo/ServiceVO.java @@ -18,10 +18,10 @@ */ package org.apache.bigtop.manager.server.model.vo; -import java.util.List; - import lombok.Data; +import java.util.List; + @Data public class ServiceVO { diff --git a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/model/vo/StackConfigVO.java b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/model/vo/StackConfigVO.java index 32ff7b07..02096e6b 100644 --- a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/model/vo/StackConfigVO.java +++ b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/model/vo/StackConfigVO.java @@ -18,10 +18,10 @@ */ package org.apache.bigtop.manager.server.model.vo; -import java.util.List; - import lombok.Data; +import java.util.List; + @Data public class StackConfigVO { diff --git a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/model/vo/StackVO.java b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/model/vo/StackVO.java index 7cd81a33..ac20407d 100644 --- a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/model/vo/StackVO.java +++ b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/model/vo/StackVO.java @@ -18,10 +18,10 @@ */ package org.apache.bigtop.manager.server.model.vo; -import java.util.List; - import lombok.Data; +import java.util.List; + @Data public class StackVO { diff --git a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/model/vo/StageVO.java b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/model/vo/StageVO.java index 92ff1019..302adefe 100644 --- a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/model/vo/StageVO.java +++ b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/model/vo/StageVO.java @@ -20,10 +20,10 @@ import org.apache.bigtop.manager.common.enums.JobState; -import java.util.List; - import lombok.Data; +import java.util.List; + @Data public class StageVO { diff --git a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/model/vo/TaskVO.java b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/model/vo/TaskVO.java index 179a0f6b..18208e09 100644 --- a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/model/vo/TaskVO.java +++ b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/model/vo/TaskVO.java @@ -36,5 +36,4 @@ public class TaskVO { private String createTime; private String updateTime; - } diff --git a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/model/vo/TypeConfigVO.java b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/model/vo/TypeConfigVO.java index e5b7ac54..87ad720f 100644 --- a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/model/vo/TypeConfigVO.java +++ b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/model/vo/TypeConfigVO.java @@ -18,15 +18,14 @@ */ package org.apache.bigtop.manager.server.model.vo; -import java.util.List; - import lombok.Data; +import java.util.List; + @Data public class TypeConfigVO { private String typeName; private List properties; - } diff --git a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/proxy/PrometheusProxy.java b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/proxy/PrometheusProxy.java index a7424089..4a18ea45 100644 --- a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/proxy/PrometheusProxy.java +++ b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/proxy/PrometheusProxy.java @@ -18,10 +18,6 @@ */ package org.apache.bigtop.manager.server.proxy; -import java.time.Instant; -import java.time.LocalDateTime; -import java.time.ZoneId; - import org.springframework.beans.factory.annotation.Value; import org.springframework.http.MediaType; import org.springframework.stereotype.Component; @@ -32,9 +28,12 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.node.ArrayNode; import com.fasterxml.jackson.databind.node.ObjectNode; - import reactor.core.publisher.Mono; +import java.time.Instant; +import java.time.LocalDateTime; +import java.time.ZoneId; + @Component public class PrometheusProxy { @@ -43,22 +42,26 @@ public class PrometheusProxy { @Value("${monitoring.agent-host-job-name}") private String agentHostJobName; - public PrometheusProxy(WebClient.Builder webClientBuilder, - @Value("${monitoring.prometheus-host}") String prometheusHost) { + public PrometheusProxy( + WebClient.Builder webClientBuilder, @Value("${monitoring.prometheus-host}") String prometheusHost) { this.webClient = webClientBuilder.baseUrl(prometheusHost).build(); } public JsonNode queryAgentsHealthyStatus() { - Mono body = webClient.post() + Mono body = webClient + .post() .uri(uriBuilder -> uriBuilder.path("/api/v1/query").build()) .contentType(MediaType.APPLICATION_FORM_URLENCODED) - .body(BodyInserters.fromFormData("query", "up{job=\"%s\"}".formatted(agentHostJobName)).with("timeout", - "10")) - .retrieve().bodyToMono(JsonNode.class); + .body(BodyInserters.fromFormData("query", "up{job=\"%s\"}".formatted(agentHostJobName)) + .with("timeout", "10")) + .retrieve() + .bodyToMono(JsonNode.class); JsonNode result = body.block(); ObjectMapper objectMapper = new ObjectMapper(); - if (result == null || result.isEmpty() || !"success".equals(result.get("status").asText("failure"))) { + if (result == null + || result.isEmpty() + || !"success".equals(result.get("status").asText("failure"))) { return objectMapper.createObjectNode(); } JsonNode agents = result.get("data").get("result"); @@ -69,13 +72,13 @@ public JsonNode queryAgentsHealthyStatus() { temp.put("agentInfo", agentStatus.get("instance").asText()); temp.put("prometheusAgentJob", agentStatus.get("job").asText()); JsonNode status = agent.get("value"); - LocalDateTime instant = - Instant.ofEpochSecond(status.get(0).asLong()).atZone(ZoneId.systemDefault()).toLocalDateTime(); + LocalDateTime instant = Instant.ofEpochSecond(status.get(0).asLong()) + .atZone(ZoneId.systemDefault()) + .toLocalDateTime(); temp.put("time", instant.toString()); temp.put("agentHealthyStatus", status.get(1).asInt() == 1 ? "running" : "down"); agentsHealthyStatus.add(temp); } return agentsHealthyStatus; } - } diff --git a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/scheduled/HostHeartbeatScheduled.java b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/scheduled/HostHeartbeatScheduled.java index 82499122..917b515b 100644 --- a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/scheduled/HostHeartbeatScheduled.java +++ b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/scheduled/HostHeartbeatScheduled.java @@ -24,18 +24,17 @@ import org.apache.bigtop.manager.dao.repository.HostRepository; import org.apache.bigtop.manager.server.ws.ServerWebSocketHandler; -import java.util.List; -import java.util.Map; -import java.util.stream.Collectors; - -import jakarta.annotation.Resource; - import org.springframework.scheduling.annotation.Async; import org.springframework.scheduling.annotation.Scheduled; import org.springframework.stereotype.Component; import lombok.extern.slf4j.Slf4j; +import jakarta.annotation.Resource; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + @Slf4j @Component public class HostHeartbeatScheduled { @@ -78,7 +77,5 @@ public void execute() { hostRepository.save(host); } } - } - } diff --git a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/service/ClusterService.java b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/service/ClusterService.java index 575a845f..17cbd432 100644 --- a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/service/ClusterService.java +++ b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/service/ClusterService.java @@ -52,5 +52,4 @@ public interface ClusterService { * @return Cluster */ ClusterVO update(Long id, ClusterDTO clusterDTO); - } diff --git a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/service/ComponentService.java b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/service/ComponentService.java index 24c30da3..5638d32e 100644 --- a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/service/ComponentService.java +++ b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/service/ComponentService.java @@ -37,5 +37,4 @@ public interface ComponentService { * @return component */ ComponentVO get(Long id); - } diff --git a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/service/impl/ClusterServiceImpl.java b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/service/impl/ClusterServiceImpl.java index 2047daa2..5df9a6ea 100644 --- a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/service/impl/ClusterServiceImpl.java +++ b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/service/impl/ClusterServiceImpl.java @@ -18,8 +18,6 @@ */ package org.apache.bigtop.manager.server.service.impl; -import jakarta.annotation.Resource; -import lombok.extern.slf4j.Slf4j; import org.apache.bigtop.manager.common.enums.MaintainState; import org.apache.bigtop.manager.dao.entity.Cluster; import org.apache.bigtop.manager.dao.entity.Repo; @@ -38,6 +36,9 @@ import org.apache.bigtop.manager.server.service.HostService; import org.apache.bigtop.manager.server.utils.StackUtils; +import lombok.extern.slf4j.Slf4j; + +import jakarta.annotation.Resource; import java.util.ArrayList; import java.util.List; @@ -74,12 +75,14 @@ public ClusterVO save(ClusterDTO clusterDTO) { Stack stack = stackRepository.findByStackNameAndStackVersion(clusterDTO.getStackName(), clusterDTO.getStackVersion()); StackDTO stackDTO = StackUtils.getStackKeyMap() - .get(StackUtils.fullStackName(clusterDTO.getStackName(), clusterDTO.getStackVersion())).getLeft(); + .get(StackUtils.fullStackName(clusterDTO.getStackName(), clusterDTO.getStackVersion())) + .getLeft(); Cluster cluster = ClusterMapper.INSTANCE.fromDTO2Entity(clusterDTO, stackDTO, stack); cluster.setSelected(clusterRepository.count() == 0); cluster.setState(MaintainState.UNINSTALLED); - Cluster oldCluster = clusterRepository.findByClusterName(clusterDTO.getClusterName()).orElse(new Cluster()); + Cluster oldCluster = + clusterRepository.findByClusterName(clusterDTO.getClusterName()).orElse(new Cluster()); if (oldCluster.getId() != null) { cluster.setId(oldCluster.getId()); } @@ -119,5 +122,4 @@ public ClusterVO update(Long id, ClusterDTO clusterDTO) { return ClusterMapper.INSTANCE.fromEntity2VO(cluster); } - } diff --git a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/service/impl/CommandLogServiceImpl.java b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/service/impl/CommandLogServiceImpl.java index 1b39c086..67d340e6 100644 --- a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/service/impl/CommandLogServiceImpl.java +++ b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/service/impl/CommandLogServiceImpl.java @@ -18,16 +18,19 @@ */ package org.apache.bigtop.manager.server.service.impl; -import jakarta.annotation.Resource; import org.apache.bigtop.manager.dao.entity.CommandLog; import org.apache.bigtop.manager.dao.entity.Task; import org.apache.bigtop.manager.dao.repository.CommandLogRepository; import org.apache.bigtop.manager.dao.repository.TaskRepository; import org.apache.bigtop.manager.server.service.CommandLogService; + import org.apache.commons.collections4.CollectionUtils; + import org.springframework.stereotype.Service; + import reactor.core.publisher.FluxSink; +import jakarta.annotation.Resource; import java.util.ArrayList; import java.util.HashMap; import java.util.List; diff --git a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/service/impl/CommandServiceImpl.java b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/service/impl/CommandServiceImpl.java index 23e5c663..aeb3ca37 100644 --- a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/service/impl/CommandServiceImpl.java +++ b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/service/impl/CommandServiceImpl.java @@ -31,10 +31,10 @@ import org.apache.bigtop.manager.server.model.vo.CommandVO; import org.apache.bigtop.manager.server.service.CommandService; -import jakarta.annotation.Resource; - import lombok.extern.slf4j.Slf4j; +import jakarta.annotation.Resource; + @Slf4j @org.springframework.stereotype.Service public class CommandServiceImpl implements CommandService { diff --git a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/service/impl/ComponentServiceImpl.java b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/service/impl/ComponentServiceImpl.java index cc8b737c..31cf66da 100644 --- a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/service/impl/ComponentServiceImpl.java +++ b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/service/impl/ComponentServiceImpl.java @@ -26,15 +26,14 @@ import org.apache.bigtop.manager.server.model.vo.ComponentVO; import org.apache.bigtop.manager.server.service.ComponentService; -import java.util.ArrayList; -import java.util.List; - -import jakarta.annotation.Resource; - import org.springframework.stereotype.Service; import lombok.extern.slf4j.Slf4j; +import jakarta.annotation.Resource; +import java.util.ArrayList; +import java.util.List; + @Slf4j @Service public class ComponentServiceImpl implements ComponentService { @@ -55,9 +54,9 @@ public List list(Long clusterId) { @Override public ComponentVO get(Long id) { - Component component = componentRepository.findById(id) + Component component = componentRepository + .findById(id) .orElseThrow(() -> new ApiException(ApiExceptionEnum.COMPONENT_NOT_FOUND)); return ComponentMapper.INSTANCE.fromEntity2VO(component); } - } diff --git a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/service/impl/ConfigServiceImpl.java b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/service/impl/ConfigServiceImpl.java index fa4a0fd9..a2a9eaf6 100644 --- a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/service/impl/ConfigServiceImpl.java +++ b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/service/impl/ConfigServiceImpl.java @@ -34,14 +34,13 @@ import org.apache.bigtop.manager.server.model.vo.ServiceConfigVO; import org.apache.bigtop.manager.server.service.ConfigService; -import java.util.List; - -import jakarta.annotation.Resource; - import org.springframework.data.domain.Sort; import lombok.extern.slf4j.Slf4j; +import jakarta.annotation.Resource; +import java.util.List; + @Slf4j @org.springframework.stereotype.Service public class ConfigServiceImpl implements ConfigService { @@ -69,8 +68,7 @@ public List list(Long clusterId) { @Override public List latest(Long clusterId) { Cluster cluster = clusterRepository.getReferenceById(clusterId); - List list = - serviceConfigRepository.findAllByClusterAndSelectedIsTrue(cluster); + List list = serviceConfigRepository.findAllByClusterAndSelectedIsTrue(cluster); return ServiceConfigMapper.INSTANCE.fromEntity2VO(list); } @@ -93,10 +91,9 @@ private ServiceConfig findServiceCurrentConfig(Cluster cluster, Service service) return serviceConfigRepository.findByClusterAndServiceAndSelectedIsTrue(cluster, service); } - private void upsertServiceConfig(Cluster cluster, Service service, ServiceConfig currentConfig, - List configs) { - List existConfigs = - TypeConfigMapper.INSTANCE.fromEntity2DTO(currentConfig.getConfigs()); + private void upsertServiceConfig( + Cluster cluster, Service service, ServiceConfig currentConfig, List configs) { + List existConfigs = TypeConfigMapper.INSTANCE.fromEntity2DTO(currentConfig.getConfigs()); if (shouldUpdateConfig(existConfigs, configs)) { // Unselect current config currentConfig.setSelected(false); @@ -109,8 +106,7 @@ private void upsertServiceConfig(Cluster cluster, Service service, ServiceConfig } } - private Boolean shouldUpdateConfig(List existConfigs, - List newConfigs) { + private Boolean shouldUpdateConfig(List existConfigs, List newConfigs) { if (existConfigs.size() != newConfigs.size()) { return true; } @@ -134,8 +130,8 @@ private void addServiceConfig(Cluster cluster, Service service, List configs, - String configDesc, Integer version) { + private void addServiceConfig( + Cluster cluster, Service service, List configs, String configDesc, Integer version) { ServiceConfig serviceConfig = new ServiceConfig(); serviceConfig.setCluster(cluster); serviceConfig.setService(service); diff --git a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/service/impl/HostComponentServiceImpl.java b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/service/impl/HostComponentServiceImpl.java index bf03b95f..368f4782 100644 --- a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/service/impl/HostComponentServiceImpl.java +++ b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/service/impl/HostComponentServiceImpl.java @@ -26,14 +26,13 @@ import org.apache.bigtop.manager.server.model.vo.HostComponentVO; import org.apache.bigtop.manager.server.service.HostComponentService; -import java.util.List; - -import jakarta.annotation.Resource; - import org.springframework.stereotype.Service; import lombok.extern.slf4j.Slf4j; +import jakarta.annotation.Resource; +import java.util.List; + @Slf4j @Service public class HostComponentServiceImpl implements HostComponentService { diff --git a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/service/impl/HostServiceImpl.java b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/service/impl/HostServiceImpl.java index 019963b2..87a5222d 100644 --- a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/service/impl/HostServiceImpl.java +++ b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/service/impl/HostServiceImpl.java @@ -32,17 +32,16 @@ import org.apache.commons.collections4.CollectionUtils; +import org.springframework.stereotype.Service; + +import lombok.extern.slf4j.Slf4j; + +import jakarta.annotation.Resource; import java.util.ArrayList; import java.util.List; import java.util.Map; import java.util.stream.Collectors; -import jakarta.annotation.Resource; - -import org.springframework.stereotype.Service; - -import lombok.extern.slf4j.Slf4j; - @Slf4j @Service public class HostServiceImpl implements HostService { @@ -111,5 +110,4 @@ public Boolean delete(Long id) { hostRepository.deleteById(id); return true; } - } diff --git a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/service/impl/JobServiceImpl.java b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/service/impl/JobServiceImpl.java index e22ceb5c..b4391f7f 100644 --- a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/service/impl/JobServiceImpl.java +++ b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/service/impl/JobServiceImpl.java @@ -18,7 +18,6 @@ */ package org.apache.bigtop.manager.server.service.impl; -import jakarta.annotation.Resource; import org.apache.bigtop.manager.dao.entity.Job; import org.apache.bigtop.manager.dao.repository.JobRepository; import org.apache.bigtop.manager.server.model.mapper.JobMapper; @@ -28,11 +27,14 @@ import org.apache.bigtop.manager.server.service.JobService; import org.apache.bigtop.manager.server.utils.ClusterUtils; import org.apache.bigtop.manager.server.utils.PageUtils; + import org.springframework.data.domain.Page; import org.springframework.data.domain.PageRequest; import org.springframework.data.domain.Pageable; import org.springframework.stereotype.Service; +import jakarta.annotation.Resource; + @Service public class JobServiceImpl implements JobService { diff --git a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/service/impl/LoginServiceImpl.java b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/service/impl/LoginServiceImpl.java index e9578ef1..6fc5de9b 100644 --- a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/service/impl/LoginServiceImpl.java +++ b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/service/impl/LoginServiceImpl.java @@ -27,10 +27,10 @@ import org.apache.bigtop.manager.server.service.LoginService; import org.apache.bigtop.manager.server.utils.JWTUtils; -import jakarta.annotation.Resource; - import org.springframework.stereotype.Service; +import jakarta.annotation.Resource; + @Service public class LoginServiceImpl implements LoginService { diff --git a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/service/impl/MonitoringServiceImpl.java b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/service/impl/MonitoringServiceImpl.java index b3b8f412..f846c5f0 100644 --- a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/service/impl/MonitoringServiceImpl.java +++ b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/service/impl/MonitoringServiceImpl.java @@ -21,14 +21,13 @@ import org.apache.bigtop.manager.server.proxy.PrometheusProxy; import org.apache.bigtop.manager.server.service.MonitoringService; -import jakarta.annotation.Resource; - import org.springframework.stereotype.Service; import com.fasterxml.jackson.databind.JsonNode; - import lombok.extern.slf4j.Slf4j; +import jakarta.annotation.Resource; + @Slf4j @Service public class MonitoringServiceImpl implements MonitoringService { diff --git a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/service/impl/ServiceServiceImpl.java b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/service/impl/ServiceServiceImpl.java index 33b03720..63fbbaab 100644 --- a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/service/impl/ServiceServiceImpl.java +++ b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/service/impl/ServiceServiceImpl.java @@ -28,15 +28,14 @@ import org.apache.bigtop.manager.server.model.vo.ServiceVO; import org.apache.bigtop.manager.server.service.ServiceService; +import lombok.extern.slf4j.Slf4j; + +import jakarta.annotation.Resource; import java.util.ArrayList; import java.util.List; import java.util.Map; import java.util.stream.Collectors; -import jakarta.annotation.Resource; - -import lombok.extern.slf4j.Slf4j; - @Slf4j @org.springframework.stereotype.Service public class ServiceServiceImpl implements ServiceService { @@ -51,9 +50,9 @@ public class ServiceServiceImpl implements ServiceService { public List list(Long clusterId) { List res = new ArrayList<>(); List hostComponentList = hostComponentRepository.findAllByComponentClusterId(clusterId); - Map> serviceIdToHostComponent = hostComponentList - .stream() - .collect(Collectors.groupingBy(hostComponent -> hostComponent.getComponent().getService().getId())); + Map> serviceIdToHostComponent = hostComponentList.stream() + .collect(Collectors.groupingBy(hostComponent -> + hostComponent.getComponent().getService().getId())); for (Map.Entry> entry : serviceIdToHostComponent.entrySet()) { List hostComponents = entry.getValue(); @@ -68,9 +67,9 @@ public List list(Long clusterId) { isClient = false; } - MaintainState expectedState = - category.equalsIgnoreCase(ComponentCategories.CLIENT) ? MaintainState.INSTALLED - : MaintainState.STARTED; + MaintainState expectedState = category.equalsIgnoreCase(ComponentCategories.CLIENT) + ? MaintainState.INSTALLED + : MaintainState.STARTED; if (!hostComponent.getState().equals(expectedState)) { isHealthy = false; } diff --git a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/service/impl/StackServiceImpl.java b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/service/impl/StackServiceImpl.java index 93058c35..ca49509f 100644 --- a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/service/impl/StackServiceImpl.java +++ b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/service/impl/StackServiceImpl.java @@ -35,14 +35,14 @@ import org.apache.commons.lang3.tuple.ImmutablePair; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; - import org.springframework.stereotype.Service; import lombok.extern.slf4j.Slf4j; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + @Slf4j @Service public class StackServiceImpl implements StackService { diff --git a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/service/impl/UserServiceImpl.java b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/service/impl/UserServiceImpl.java index 920cfe03..a0b1adb6 100644 --- a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/service/impl/UserServiceImpl.java +++ b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/service/impl/UserServiceImpl.java @@ -28,10 +28,10 @@ import org.apache.bigtop.manager.server.model.vo.UserVO; import org.apache.bigtop.manager.server.service.UserService; -import jakarta.annotation.Resource; - import org.springframework.stereotype.Service; +import jakarta.annotation.Resource; + @Service public class UserServiceImpl implements UserService { diff --git a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/stack/StackInitializer.java b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/stack/StackInitializer.java index 1c7e10cc..9e77ee42 100644 --- a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/stack/StackInitializer.java +++ b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/stack/StackInitializer.java @@ -24,18 +24,17 @@ import org.apache.bigtop.manager.server.model.dto.StackDTO; import org.apache.bigtop.manager.server.utils.StackUtils; -import java.util.List; -import java.util.Map; - -import jakarta.annotation.Nonnull; -import jakarta.annotation.Resource; - import org.springframework.boot.context.event.ApplicationStartedEvent; import org.springframework.context.ApplicationListener; import org.springframework.stereotype.Component; import lombok.extern.slf4j.Slf4j; +import jakarta.annotation.Nonnull; +import jakarta.annotation.Resource; +import java.util.List; +import java.util.Map; + /** * Initialize the stack and persist to the database. * 1. Get All stacks, Parse the stack.yaml diff --git a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/stack/dag/ComponentCommandWrapper.java b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/stack/dag/ComponentCommandWrapper.java index c71b0d70..3a0e684f 100644 --- a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/stack/dag/ComponentCommandWrapper.java +++ b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/stack/dag/ComponentCommandWrapper.java @@ -20,11 +20,11 @@ import org.apache.bigtop.manager.common.enums.Command; -import java.util.Objects; - import lombok.AllArgsConstructor; import lombok.Data; +import java.util.Objects; + @Data @AllArgsConstructor public class ComponentCommandWrapper { @@ -40,10 +40,8 @@ public String toString() { @Override public boolean equals(Object o) { - if (this == o) - return true; - if (o == null || getClass() != o.getClass()) - return false; + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; ComponentCommandWrapper that = (ComponentCommandWrapper) o; return Objects.equals(componentName, that.componentName) && command == that.command; } diff --git a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/stack/dag/DAG.java b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/stack/dag/DAG.java index 0705f4ff..7e3733c6 100644 --- a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/stack/dag/DAG.java +++ b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/stack/dag/DAG.java @@ -20,6 +20,8 @@ import org.apache.commons.collections4.CollectionUtils; +import lombok.extern.slf4j.Slf4j; + import java.util.AbstractMap; import java.util.ArrayList; import java.util.Collection; @@ -33,8 +35,6 @@ import java.util.concurrent.locks.ReadWriteLock; import java.util.concurrent.locks.ReentrantReadWriteLock; -import lombok.extern.slf4j.Slf4j; - /** * analysis of DAG * Node: node @@ -81,7 +81,6 @@ private void addNode(Node node, NodeInfo nodeInfo) { } finally { lock.writeLock().unlock(); } - } /** @@ -136,7 +135,6 @@ public boolean addEdge(Node fromNode, Node toNode, EdgeInfo edge, boolean create } finally { lock.writeLock().unlock(); } - } /** @@ -240,7 +238,6 @@ public Collection getBeginNode() { } finally { lock.readLock().unlock(); } - } /** @@ -256,7 +253,6 @@ public Collection getEndNode() { } finally { lock.readLock().unlock(); } - } /** @@ -489,7 +485,6 @@ private Map.Entry> topologicalSortImpl() { } else { notZeroIndegreeNodeMap.put(subsequentNode, degree); } - } } diff --git a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/stack/pojo/ComponentModel.java b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/stack/pojo/ComponentModel.java index 79141f7c..ece81ab3 100644 --- a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/stack/pojo/ComponentModel.java +++ b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/stack/pojo/ComponentModel.java @@ -18,15 +18,14 @@ */ package org.apache.bigtop.manager.server.stack.pojo; -import java.util.List; +import lombok.Data; import jakarta.xml.bind.annotation.XmlAccessType; import jakarta.xml.bind.annotation.XmlAccessorType; import jakarta.xml.bind.annotation.XmlElement; import jakarta.xml.bind.annotation.XmlElementWrapper; import jakarta.xml.bind.annotation.XmlElements; - -import lombok.Data; +import java.util.List; @Data @XmlAccessorType(XmlAccessType.FIELD) diff --git a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/stack/pojo/CustomCommandModel.java b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/stack/pojo/CustomCommandModel.java index 52796411..b23d4cfc 100644 --- a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/stack/pojo/CustomCommandModel.java +++ b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/stack/pojo/CustomCommandModel.java @@ -18,12 +18,12 @@ */ package org.apache.bigtop.manager.server.stack.pojo; +import lombok.Data; + import jakarta.xml.bind.annotation.XmlAccessType; import jakarta.xml.bind.annotation.XmlAccessorType; import jakarta.xml.bind.annotation.XmlElement; -import lombok.Data; - @Data @XmlAccessorType(XmlAccessType.FIELD) public class CustomCommandModel { diff --git a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/stack/pojo/OSSpecificModel.java b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/stack/pojo/OSSpecificModel.java index 302fa33d..b38882c2 100644 --- a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/stack/pojo/OSSpecificModel.java +++ b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/stack/pojo/OSSpecificModel.java @@ -18,15 +18,14 @@ */ package org.apache.bigtop.manager.server.stack.pojo; -import java.util.List; +import lombok.Data; import jakarta.xml.bind.annotation.XmlAccessType; import jakarta.xml.bind.annotation.XmlAccessorType; import jakarta.xml.bind.annotation.XmlElement; import jakarta.xml.bind.annotation.XmlElementWrapper; import jakarta.xml.bind.annotation.XmlElements; - -import lombok.Data; +import java.util.List; @Data @XmlAccessorType(XmlAccessType.FIELD) diff --git a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/stack/pojo/PropertyModel.java b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/stack/pojo/PropertyModel.java index ebc67976..657f32ae 100644 --- a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/stack/pojo/PropertyModel.java +++ b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/stack/pojo/PropertyModel.java @@ -18,12 +18,12 @@ */ package org.apache.bigtop.manager.server.stack.pojo; +import lombok.Data; + import jakarta.xml.bind.annotation.XmlAccessType; import jakarta.xml.bind.annotation.XmlAccessorType; import jakarta.xml.bind.annotation.XmlElement; -import lombok.Data; - @Data @XmlAccessorType(XmlAccessType.FIELD) public class PropertyModel { @@ -37,5 +37,4 @@ public class PropertyModel { @XmlElement(name = "description") private String desc; - } diff --git a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/stack/pojo/QuickLinkModel.java b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/stack/pojo/QuickLinkModel.java index 4b6f2018..e688cbfa 100644 --- a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/stack/pojo/QuickLinkModel.java +++ b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/stack/pojo/QuickLinkModel.java @@ -18,5 +18,4 @@ */ package org.apache.bigtop.manager.server.stack.pojo; -public class QuickLinkModel { -} +public class QuickLinkModel {} diff --git a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/stack/pojo/RepoModel.java b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/stack/pojo/RepoModel.java index 3e0b130b..fc7883ee 100644 --- a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/stack/pojo/RepoModel.java +++ b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/stack/pojo/RepoModel.java @@ -18,14 +18,14 @@ */ package org.apache.bigtop.manager.server.stack.pojo; -import jakarta.xml.bind.annotation.XmlAccessType; -import jakarta.xml.bind.annotation.XmlAccessorType; -import jakarta.xml.bind.annotation.XmlElement; - import lombok.AllArgsConstructor; import lombok.Data; import lombok.NoArgsConstructor; +import jakarta.xml.bind.annotation.XmlAccessType; +import jakarta.xml.bind.annotation.XmlAccessorType; +import jakarta.xml.bind.annotation.XmlElement; + @Data @AllArgsConstructor @NoArgsConstructor @@ -44,5 +44,4 @@ public class RepoModel { private String os; private String arch; - } diff --git a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/stack/pojo/ScriptModel.java b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/stack/pojo/ScriptModel.java index 0a64acaa..bc1d04c7 100644 --- a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/stack/pojo/ScriptModel.java +++ b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/stack/pojo/ScriptModel.java @@ -18,12 +18,12 @@ */ package org.apache.bigtop.manager.server.stack.pojo; +import lombok.Data; + import jakarta.xml.bind.annotation.XmlAccessType; import jakarta.xml.bind.annotation.XmlAccessorType; import jakarta.xml.bind.annotation.XmlElement; -import lombok.Data; - @Data @XmlAccessorType(XmlAccessType.FIELD) public class ScriptModel { diff --git a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/stack/pojo/ServiceModel.java b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/stack/pojo/ServiceModel.java index 12586c9d..abdeb0fa 100644 --- a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/stack/pojo/ServiceModel.java +++ b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/stack/pojo/ServiceModel.java @@ -18,15 +18,14 @@ */ package org.apache.bigtop.manager.server.stack.pojo; -import java.util.List; +import lombok.Data; import jakarta.xml.bind.annotation.XmlAccessType; import jakarta.xml.bind.annotation.XmlAccessorType; import jakarta.xml.bind.annotation.XmlElement; import jakarta.xml.bind.annotation.XmlElementWrapper; import jakarta.xml.bind.annotation.XmlElements; - -import lombok.Data; +import java.util.List; @Data @XmlAccessorType(XmlAccessType.FIELD) diff --git a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/stack/pojo/StackModel.java b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/stack/pojo/StackModel.java index 2d076d72..e00c48e8 100644 --- a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/stack/pojo/StackModel.java +++ b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/stack/pojo/StackModel.java @@ -18,15 +18,14 @@ */ package org.apache.bigtop.manager.server.stack.pojo; -import java.util.List; +import lombok.Data; import jakarta.xml.bind.annotation.XmlAccessType; import jakarta.xml.bind.annotation.XmlAccessorType; import jakarta.xml.bind.annotation.XmlElement; import jakarta.xml.bind.annotation.XmlElementWrapper; import jakarta.xml.bind.annotation.XmlElements; - -import lombok.Data; +import java.util.List; @Data @XmlAccessorType(XmlAccessType.FIELD) diff --git a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/stack/xml/ConfigurationXml.java b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/stack/xml/ConfigurationXml.java index 2d9d6ff7..5187be1a 100644 --- a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/stack/xml/ConfigurationXml.java +++ b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/stack/xml/ConfigurationXml.java @@ -20,14 +20,13 @@ import org.apache.bigtop.manager.server.stack.pojo.PropertyModel; -import java.util.List; +import lombok.Data; import jakarta.xml.bind.annotation.XmlAccessType; import jakarta.xml.bind.annotation.XmlAccessorType; import jakarta.xml.bind.annotation.XmlElement; import jakarta.xml.bind.annotation.XmlRootElement; - -import lombok.Data; +import java.util.List; @Data @XmlRootElement(name = "configuration") diff --git a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/stack/xml/ServiceMetainfoXml.java b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/stack/xml/ServiceMetainfoXml.java index 806c84ba..97ee57b0 100644 --- a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/stack/xml/ServiceMetainfoXml.java +++ b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/stack/xml/ServiceMetainfoXml.java @@ -20,13 +20,13 @@ import org.apache.bigtop.manager.server.stack.pojo.ServiceModel; +import lombok.Data; + import jakarta.xml.bind.annotation.XmlAccessType; import jakarta.xml.bind.annotation.XmlAccessorType; import jakarta.xml.bind.annotation.XmlElement; import jakarta.xml.bind.annotation.XmlRootElement; -import lombok.Data; - @Data @XmlRootElement(name = "metainfo") @XmlAccessorType(XmlAccessType.FIELD) diff --git a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/stack/xml/StackMetainfoXml.java b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/stack/xml/StackMetainfoXml.java index 2027bd5a..72baabf3 100644 --- a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/stack/xml/StackMetainfoXml.java +++ b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/stack/xml/StackMetainfoXml.java @@ -20,13 +20,13 @@ import org.apache.bigtop.manager.server.stack.pojo.StackModel; +import lombok.Data; + import jakarta.xml.bind.annotation.XmlAccessType; import jakarta.xml.bind.annotation.XmlAccessorType; import jakarta.xml.bind.annotation.XmlElement; import jakarta.xml.bind.annotation.XmlRootElement; -import lombok.Data; - @Data @XmlRootElement(name = "metainfo") @XmlAccessorType(XmlAccessType.FIELD) diff --git a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/utils/JWTUtils.java b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/utils/JWTUtils.java index debe848d..3bd7bb04 100644 --- a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/utils/JWTUtils.java +++ b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/utils/JWTUtils.java @@ -18,13 +18,13 @@ */ package org.apache.bigtop.manager.server.utils; -import java.util.Calendar; -import java.util.Date; - import com.auth0.jwt.JWT; import com.auth0.jwt.algorithms.Algorithm; import com.auth0.jwt.interfaces.DecodedJWT; +import java.util.Calendar; +import java.util.Date; + public class JWTUtils { public static final String CLAIM_ID = "id"; diff --git a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/utils/JaxbUtils.java b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/utils/JaxbUtils.java index a2904a5e..78d14443 100644 --- a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/utils/JaxbUtils.java +++ b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/utils/JaxbUtils.java @@ -18,11 +18,10 @@ */ package org.apache.bigtop.manager.server.utils; -import java.io.File; - import jakarta.xml.bind.JAXBContext; import jakarta.xml.bind.JAXBException; import jakarta.xml.bind.Unmarshaller; +import java.io.File; public class JaxbUtils { diff --git a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/utils/ResponseEntity.java b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/utils/ResponseEntity.java index 005d6559..81769b13 100644 --- a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/utils/ResponseEntity.java +++ b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/utils/ResponseEntity.java @@ -32,8 +32,7 @@ public class ResponseEntity { private T data; - public ResponseEntity() { - } + public ResponseEntity() {} public ResponseEntity(ResponseStatus status) { this.code = status.getCode(); diff --git a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/utils/ServletUtils.java b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/utils/ServletUtils.java index d04fb9de..e3f54a20 100644 --- a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/utils/ServletUtils.java +++ b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/utils/ServletUtils.java @@ -18,12 +18,12 @@ */ package org.apache.bigtop.manager.server.utils; -import jakarta.servlet.http.HttpServletRequest; - import org.springframework.web.context.request.RequestAttributes; import org.springframework.web.context.request.RequestContextHolder; import org.springframework.web.context.request.ServletRequestAttributes; +import jakarta.servlet.http.HttpServletRequest; + public class ServletUtils { public static String getParameter(String name) { diff --git a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/utils/StackUtils.java b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/utils/StackUtils.java index a57321f7..59bf63ca 100644 --- a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/utils/StackUtils.java +++ b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/utils/StackUtils.java @@ -41,6 +41,10 @@ import org.apache.commons.lang3.EnumUtils; import org.apache.commons.lang3.tuple.ImmutablePair; +import lombok.AccessLevel; +import lombok.NoArgsConstructor; +import lombok.extern.slf4j.Slf4j; + import java.io.File; import java.net.URL; import java.util.ArrayList; @@ -53,10 +57,6 @@ import java.util.function.Function; import java.util.stream.Collectors; -import lombok.AccessLevel; -import lombok.NoArgsConstructor; -import lombok.extern.slf4j.Slf4j; - @Slf4j @NoArgsConstructor(access = AccessLevel.PRIVATE) public class StackUtils { @@ -79,14 +79,11 @@ public class StackUtils { private static final String NOP_STACK = "nop"; - private static final Map>> STACK_DEPENDENCY_MAP = - new HashMap<>(); + private static final Map>> STACK_DEPENDENCY_MAP = new HashMap<>(); - private static final Map>> STACK_CONFIG_MAP = - new HashMap<>(); + private static final Map>> STACK_CONFIG_MAP = new HashMap<>(); - private static final Map>> STACK_KEY_MAP = - new HashMap<>(); + private static final Map>> STACK_KEY_MAP = new HashMap<>(); private static final Map> STACK_DAG_MAP = new HashMap<>(); @@ -114,8 +111,7 @@ public static Map> ge */ public static StackDTO parseStack(File versionFolder) { StackMetainfoXml stackMetainfoXml = JaxbUtils.readFromPath( - versionFolder.getAbsolutePath() + File.separator + META_FILE, - StackMetainfoXml.class); + versionFolder.getAbsolutePath() + File.separator + META_FILE, StackMetainfoXml.class); return StackMapper.INSTANCE.fromModel2DTO(stackMetainfoXml.getStack()); } @@ -136,8 +132,7 @@ public static List parseService(File versionFolder, String fullStack // metainfo.xml ServiceMetainfoXml serviceMetainfoXml = - JaxbUtils.readFromPath(file.getAbsolutePath() + "/" + META_FILE, - ServiceMetainfoXml.class); + JaxbUtils.readFromPath(file.getAbsolutePath() + "/" + META_FILE, ServiceMetainfoXml.class); ServiceModel serviceModel = serviceMetainfoXml.getService(); ServiceDTO serviceDTO = ServiceMapper.INSTANCE.fromModel2DTO(serviceModel); services.add(serviceDTO); @@ -146,15 +141,13 @@ public static List parseService(File versionFolder, String fullStack List serviceConfigList = new ArrayList<>(); File configFolder = new File(file.getAbsolutePath(), CONFIGURATION_FOLDER); if (configFolder.exists()) { - for (File configFile : Optional.ofNullable(configFolder.listFiles()) - .orElse(new File[0])) { + for (File configFile : + Optional.ofNullable(configFolder.listFiles()).orElse(new File[0])) { String configPath = configFile.getAbsolutePath(); - String fileExtension = - configPath.substring(configPath.lastIndexOf(".") + 1); + String fileExtension = configPath.substring(configPath.lastIndexOf(".") + 1); if (fileExtension.equals(CONFIGURATION_FILE_EXTENSION)) { - String typeName = - configPath.substring(configPath.lastIndexOf(File.separator) + 1, - configPath.lastIndexOf(".")); + String typeName = configPath.substring( + configPath.lastIndexOf(File.separator) + 1, configPath.lastIndexOf(".")); List properties = StackConfigUtils.loadConfig(configPath); TypeConfigDTO typeConfigDTO = new TypeConfigDTO(); @@ -173,16 +166,17 @@ public static List parseService(File versionFolder, String fullStack Map> dependencyMap = STACK_DEPENDENCY_MAP.computeIfAbsent(fullStackName, k -> new HashMap<>()); - Map> dependencyMapByFile = - JsonUtils.readFromFile(dependencyFile); + Map> dependencyMapByFile = JsonUtils.readFromFile(dependencyFile); for (Map.Entry> entry : dependencyMapByFile.entrySet()) { String blocked = entry.getKey(); - String fixedBlocked = blocked.split(ROLE_COMMAND_SPLIT)[0].toLowerCase() + - ROLE_COMMAND_SPLIT + blocked.split(ROLE_COMMAND_SPLIT)[1]; + String fixedBlocked = blocked.split(ROLE_COMMAND_SPLIT)[0].toLowerCase() + + ROLE_COMMAND_SPLIT + + blocked.split(ROLE_COMMAND_SPLIT)[1]; List blockers = entry.getValue(); - List fixedBlockers = blockers.stream().map( - x -> x.split(ROLE_COMMAND_SPLIT)[0].toLowerCase() + ROLE_COMMAND_SPLIT + - x.split(ROLE_COMMAND_SPLIT)[1]) + List fixedBlockers = blockers.stream() + .map(x -> x.split(ROLE_COMMAND_SPLIT)[0].toLowerCase() + + ROLE_COMMAND_SPLIT + + x.split(ROLE_COMMAND_SPLIT)[1]) .toList(); dependencyMap.put(fixedBlocked, fixedBlockers); @@ -215,8 +209,7 @@ public static Map> stackList() { continue; } - File[] versionFolders = - Optional.ofNullable(stackFolder.listFiles()).orElse(new File[0]); + File[] versionFolders = Optional.ofNullable(stackFolder.listFiles()).orElse(new File[0]); for (File versionFolder : versionFolders) { String stackVersion = versionFolder.getName(); @@ -241,8 +234,8 @@ public static Map> stackList() { * Initialize the DAG for each stack */ private static void initializeDag() { - for (Map.Entry>> mapEntry : StackUtils.getStackDependencyMap() - .entrySet()) { + for (Map.Entry>> mapEntry : + StackUtils.getStackDependencyMap().entrySet()) { String fullStackName = mapEntry.getKey(); DAG dag = new DAG<>(); @@ -261,8 +254,7 @@ private static void initializeDag() { } } - private static void addToDagNode(DAG dag, - String roleCommand) { + private static void addToDagNode(DAG dag, String roleCommand) { String[] split = roleCommand.split(ROLE_COMMAND_SPLIT); String role = split[0]; String command = split[1]; @@ -271,8 +263,7 @@ private static void addToDagNode(DAG getServiceDTOList(String stackName, String stackVersion) { - Map>> stackKeyMap = - StackUtils.getStackKeyMap(); + Map>> stackKeyMap = StackUtils.getStackKeyMap(); ImmutablePair> immutablePair = stackKeyMap.get(StackUtils.fullStackName(stackName, stackVersion)); - return immutablePair.getRight() - .stream() - .toList(); + return immutablePair.getRight().stream().toList(); } - public static ServiceDTO getServiceDTO(String stackName, String stackVersion, - String serviceName) { - Map serviceNameToDTO = getServiceDTOList(stackName, stackVersion) - .stream() + public static ServiceDTO getServiceDTO(String stackName, String stackVersion, String serviceName) { + Map serviceNameToDTO = getServiceDTOList(stackName, stackVersion).stream() .collect(Collectors.toMap(ServiceDTO::getServiceName, Function.identity())); return serviceNameToDTO.get(serviceName); } public static List getComponentDTOList(String stackName, String stackVersion) { - Map>> stackKeyMap = - StackUtils.getStackKeyMap(); + Map>> stackKeyMap = StackUtils.getStackKeyMap(); ImmutablePair> immutablePair = stackKeyMap.get(StackUtils.fullStackName(stackName, stackVersion)); - return immutablePair.getRight() - .stream() + return immutablePair.getRight().stream() .flatMap(serviceDTO -> serviceDTO.getComponents().stream()) .toList(); } - public static ComponentDTO getComponentDTO(String stackName, String stackVersion, - String componentName) { - Map componentNameToDTO = getComponentDTOList(stackName, stackVersion) - .stream() + public static ComponentDTO getComponentDTO(String stackName, String stackVersion, String componentName) { + Map componentNameToDTO = getComponentDTOList(stackName, stackVersion).stream() .collect(Collectors.toMap(ComponentDTO::getComponentName, Function.identity())); return componentNameToDTO.get(componentName); } diff --git a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/ws/ServerWebSocketHandler.java b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/ws/ServerWebSocketHandler.java index 262afa8d..1ad30c06 100644 --- a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/ws/ServerWebSocketHandler.java +++ b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/ws/ServerWebSocketHandler.java @@ -18,9 +18,6 @@ */ package org.apache.bigtop.manager.server.ws; -import jakarta.annotation.Nonnull; -import jakarta.annotation.Resource; -import lombok.extern.slf4j.Slf4j; import org.apache.bigtop.manager.common.message.entity.BaseMessage; import org.apache.bigtop.manager.common.message.entity.BaseRequestMessage; import org.apache.bigtop.manager.common.message.entity.HeartbeatMessage; @@ -29,11 +26,16 @@ import org.apache.bigtop.manager.common.message.entity.pojo.HostInfo; import org.apache.bigtop.manager.common.ws.AbstractBinaryWebSocketHandler; import org.apache.bigtop.manager.server.service.CommandLogService; + import org.springframework.stereotype.Component; import org.springframework.web.socket.BinaryMessage; import org.springframework.web.socket.CloseStatus; import org.springframework.web.socket.WebSocketSession; +import lombok.extern.slf4j.Slf4j; + +import jakarta.annotation.Nonnull; +import jakarta.annotation.Resource; import java.util.ArrayList; import java.util.List; import java.util.Map; @@ -92,7 +94,8 @@ private void handleMessage(WebSocketSession session, BaseMessage baseMessage) { } else if (baseMessage instanceof CommandResponseMessage commandResponseMessage) { super.handleResponseMessage(commandResponseMessage); } else if (baseMessage instanceof CommandLogMessage commandLogMessage) { - commandLogService.onLogReceived(commandLogMessage.getTaskId(), commandLogMessage.getHostname(), commandLogMessage.getLog()); + commandLogService.onLogReceived( + commandLogMessage.getTaskId(), commandLogMessage.getHostname(), commandLogMessage.getLog()); } else { log.error("Unrecognized message type: {}", baseMessage.getClass().getSimpleName()); } diff --git a/bigtop-manager-server/src/test/java/org/apache/bigtop/manager/server/ServerApplicationTests.java b/bigtop-manager-server/src/test/java/org/apache/bigtop/manager/server/ServerApplicationTests.java index a9d5b679..6e2937ef 100644 --- a/bigtop-manager-server/src/test/java/org/apache/bigtop/manager/server/ServerApplicationTests.java +++ b/bigtop-manager-server/src/test/java/org/apache/bigtop/manager/server/ServerApplicationTests.java @@ -28,15 +28,17 @@ class ServerApplicationTests { @Test - void contextLoads() { - } + void contextLoads() {} @Test public void queryMonitoring() { - WebClient webClient = WebClient.builder().baseUrl("http://localhost:9090").build(); - Mono body = webClient.get().uri("/api/v1/query?query=absent(up{job=bm-agent-host}==1)", "").retrieve() + WebClient webClient = + WebClient.builder().baseUrl("http://localhost:9090").build(); + Mono body = webClient + .get() + .uri("/api/v1/query?query=absent(up{job=bm-agent-host}==1)", "") + .retrieve() .bodyToMono(String.class); System.out.println(body.block()); } - } diff --git a/bigtop-manager-spi/pom.xml b/bigtop-manager-spi/pom.xml index bdf6aad6..18e41f94 100644 --- a/bigtop-manager-spi/pom.xml +++ b/bigtop-manager-spi/pom.xml @@ -17,9 +17,7 @@ ~ specific language governing permissions and limitations ~ under the License. --> - - + 4.0.0 org.apache.bigtop diff --git a/bigtop-manager-spi/src/main/java/org/apache/bigtop/manager/spi/plugin/PrioritySPI.java b/bigtop-manager-spi/src/main/java/org/apache/bigtop/manager/spi/plugin/PrioritySPI.java index acff57c6..cda7a5af 100644 --- a/bigtop-manager-spi/src/main/java/org/apache/bigtop/manager/spi/plugin/PrioritySPI.java +++ b/bigtop-manager-spi/src/main/java/org/apache/bigtop/manager/spi/plugin/PrioritySPI.java @@ -40,5 +40,4 @@ default Integer getPriority() { default int compareTo(@NonNull Integer o) { return Integer.compare(getPriority(), o); } - } diff --git a/bigtop-manager-spi/src/main/java/org/apache/bigtop/manager/spi/plugin/PrioritySPIFactory.java b/bigtop-manager-spi/src/main/java/org/apache/bigtop/manager/spi/plugin/PrioritySPIFactory.java index 645dab68..264ed8fa 100644 --- a/bigtop-manager-spi/src/main/java/org/apache/bigtop/manager/spi/plugin/PrioritySPIFactory.java +++ b/bigtop-manager-spi/src/main/java/org/apache/bigtop/manager/spi/plugin/PrioritySPIFactory.java @@ -18,13 +18,13 @@ */ package org.apache.bigtop.manager.spi.plugin; +import lombok.extern.slf4j.Slf4j; + import java.util.Collections; import java.util.HashMap; import java.util.Map; import java.util.ServiceLoader; -import lombok.extern.slf4j.Slf4j; - @Slf4j public class PrioritySPIFactory { @@ -48,9 +48,8 @@ private void resolveConflict(T newSPI) { T oldSPI = map.get(newSPI.getName()); if (newSPI.compareTo(oldSPI.getPriority()) == 0) { - throw new IllegalArgumentException( - String.format("These two spi plugins has conflict identify name with the same priority: %s, %s", - oldSPI, newSPI)); + throw new IllegalArgumentException(String.format( + "These two spi plugins has conflict identify name with the same priority: %s, %s", oldSPI, newSPI)); } else if (newSPI.compareTo(oldSPI.getPriority()) > 0) { log.info("The {} plugin has high priority, will override {}", newSPI, oldSPI); map.put(newSPI.getName(), newSPI); diff --git a/bigtop-manager-spi/src/main/java/org/apache/bigtop/manager/spi/stack/PackageManager.java b/bigtop-manager-spi/src/main/java/org/apache/bigtop/manager/spi/stack/PackageManager.java index 55850904..1f8add49 100644 --- a/bigtop-manager-spi/src/main/java/org/apache/bigtop/manager/spi/stack/PackageManager.java +++ b/bigtop-manager-spi/src/main/java/org/apache/bigtop/manager/spi/stack/PackageManager.java @@ -30,5 +30,4 @@ public interface PackageManager extends PrioritySPI { ShellResult uninstallPackage(Collection packages); String listPackages(); - } diff --git a/bigtop-manager-spi/src/main/java/org/apache/bigtop/manager/spi/stack/Script.java b/bigtop-manager-spi/src/main/java/org/apache/bigtop/manager/spi/stack/Script.java index da84afb6..b661fe45 100644 --- a/bigtop-manager-spi/src/main/java/org/apache/bigtop/manager/spi/stack/Script.java +++ b/bigtop-manager-spi/src/main/java/org/apache/bigtop/manager/spi/stack/Script.java @@ -43,7 +43,8 @@ default ShellResult restart(Params params) { return shellResult1; } - return new ShellResult(0, + return new ShellResult( + 0, StringUtils.join(shellResult.getOutput(), shellResult1.getOutput()), StringUtils.join(shellResult.getErrMsg(), shellResult1.getErrMsg())); } diff --git a/bigtop-manager-stack/bigtop-manager-stack-bigtop/pom.xml b/bigtop-manager-stack/bigtop-manager-stack-bigtop/pom.xml index 0b05b98f..904524d1 100644 --- a/bigtop-manager-stack/bigtop-manager-stack-bigtop/pom.xml +++ b/bigtop-manager-stack/bigtop-manager-stack-bigtop/pom.xml @@ -17,9 +17,7 @@ ~ specific language governing permissions and limitations ~ under the License. --> - - + 4.0.0 org.apache.bigtop diff --git a/bigtop-manager-stack/bigtop-manager-stack-bigtop/src/main/java/org/apache/bigtop/manager/stack/bigtop/v3_3_0/hdfs/DataNodeScript.java b/bigtop-manager-stack/bigtop-manager-stack-bigtop/src/main/java/org/apache/bigtop/manager/stack/bigtop/v3_3_0/hdfs/DataNodeScript.java index 489453c8..81a551c0 100644 --- a/bigtop-manager-stack/bigtop-manager-stack-bigtop/src/main/java/org/apache/bigtop/manager/stack/bigtop/v3_3_0/hdfs/DataNodeScript.java +++ b/bigtop-manager-stack/bigtop-manager-stack-bigtop/src/main/java/org/apache/bigtop/manager/stack/bigtop/v3_3_0/hdfs/DataNodeScript.java @@ -25,12 +25,11 @@ import org.apache.bigtop.manager.stack.common.utils.PackageUtils; import org.apache.bigtop.manager.stack.common.utils.linux.LinuxOSUtils; -import java.text.MessageFormat; - import com.google.auto.service.AutoService; - import lombok.extern.slf4j.Slf4j; +import java.text.MessageFormat; + @Slf4j @AutoService(Script.class) public class DataNodeScript implements Script { @@ -74,5 +73,4 @@ public ShellResult status(Params params) { HdfsParams hdfsParams = (HdfsParams) params; return LinuxOSUtils.checkProcess(hdfsParams.getDataNodePidFile()); } - } diff --git a/bigtop-manager-stack/bigtop-manager-stack-bigtop/src/main/java/org/apache/bigtop/manager/stack/bigtop/v3_3_0/hdfs/HdfsClientScript.java b/bigtop-manager-stack/bigtop-manager-stack-bigtop/src/main/java/org/apache/bigtop/manager/stack/bigtop/v3_3_0/hdfs/HdfsClientScript.java index d33db020..9208bff1 100644 --- a/bigtop-manager-stack/bigtop-manager-stack-bigtop/src/main/java/org/apache/bigtop/manager/stack/bigtop/v3_3_0/hdfs/HdfsClientScript.java +++ b/bigtop-manager-stack/bigtop-manager-stack-bigtop/src/main/java/org/apache/bigtop/manager/stack/bigtop/v3_3_0/hdfs/HdfsClientScript.java @@ -25,7 +25,6 @@ import org.apache.bigtop.manager.stack.common.utils.PackageUtils; import com.google.auto.service.AutoService; - import lombok.extern.slf4j.Slf4j; @Slf4j @@ -41,5 +40,4 @@ public ShellResult install(Params params) { public ShellResult configure(Params params) { return HdfsSetup.config(params); } - } diff --git a/bigtop-manager-stack/bigtop-manager-stack-bigtop/src/main/java/org/apache/bigtop/manager/stack/bigtop/v3_3_0/hdfs/HdfsParams.java b/bigtop-manager-stack/bigtop-manager-stack-bigtop/src/main/java/org/apache/bigtop/manager/stack/bigtop/v3_3_0/hdfs/HdfsParams.java index c97cf464..bc782f70 100644 --- a/bigtop-manager-stack/bigtop-manager-stack-bigtop/src/main/java/org/apache/bigtop/manager/stack/bigtop/v3_3_0/hdfs/HdfsParams.java +++ b/bigtop-manager-stack/bigtop-manager-stack-bigtop/src/main/java/org/apache/bigtop/manager/stack/bigtop/v3_3_0/hdfs/HdfsParams.java @@ -25,14 +25,14 @@ import org.apache.commons.lang3.StringUtils; +import lombok.Getter; +import lombok.extern.slf4j.Slf4j; + import java.text.MessageFormat; import java.util.Arrays; import java.util.List; import java.util.Map; -import lombok.Getter; -import lombok.extern.slf4j.Slf4j; - @Getter @Slf4j public class HdfsParams extends BaseParams { @@ -98,7 +98,9 @@ public Map hdfsSite() { Map hdfsSite = LocalSettings.configurations(serviceName(), "hdfs-site"); dfsDataDir = (String) hdfsSite.get("dfs.datanode.data.dir"); dfsNameNodeDir = (String) hdfsSite.get("dfs.namenode.name.dir"); - nameNodeFormattedDirs = Arrays.stream(dfsNameNodeDir.split(",")).map(x -> x + "/namenode-formatted/").toList(); + nameNodeFormattedDirs = Arrays.stream(dfsNameNodeDir.split(",")) + .map(x -> x + "/namenode-formatted/") + .toList(); String dfsDomainSocketPath = (String) hdfsSite.get("dfs.domain.socket.path"); if (StringUtils.isNotBlank(dfsDomainSocketPath)) { @@ -139,5 +141,4 @@ public String hdfsHome() { public String hdfsExec() { return stackBinDir() + "/hdfs"; } - } diff --git a/bigtop-manager-stack/bigtop-manager-stack-bigtop/src/main/java/org/apache/bigtop/manager/stack/bigtop/v3_3_0/hdfs/HdfsSetup.java b/bigtop-manager-stack/bigtop-manager-stack-bigtop/src/main/java/org/apache/bigtop/manager/stack/bigtop/v3_3_0/hdfs/HdfsSetup.java index fec2b164..90466b5b 100644 --- a/bigtop-manager-stack/bigtop-manager-stack-bigtop/src/main/java/org/apache/bigtop/manager/stack/bigtop/v3_3_0/hdfs/HdfsSetup.java +++ b/bigtop-manager-stack/bigtop-manager-stack-bigtop/src/main/java/org/apache/bigtop/manager/stack/bigtop/v3_3_0/hdfs/HdfsSetup.java @@ -18,9 +18,7 @@ */ package org.apache.bigtop.manager.stack.bigtop.v3_3_0.hdfs; -import lombok.AccessLevel; -import lombok.NoArgsConstructor; -import lombok.extern.slf4j.Slf4j; +import org.apache.bigtop.manager.common.constants.Constants; import org.apache.bigtop.manager.common.shell.ShellResult; import org.apache.bigtop.manager.spi.stack.Params; import org.apache.bigtop.manager.stack.bigtop.v3_3_0.kafka.KafkaParams; @@ -29,14 +27,17 @@ import org.apache.bigtop.manager.stack.common.log.TaskLogWriter; import org.apache.bigtop.manager.stack.common.utils.linux.LinuxFileUtils; import org.apache.bigtop.manager.stack.common.utils.linux.LinuxOSUtils; + import org.apache.commons.lang3.StringUtils; +import lombok.AccessLevel; +import lombok.NoArgsConstructor; +import lombok.extern.slf4j.Slf4j; + import java.io.File; import java.text.MessageFormat; import java.util.Map; -import static org.apache.bigtop.manager.common.constants.Constants.*; - @Slf4j @NoArgsConstructor(access = AccessLevel.PRIVATE) public class HdfsSetup { @@ -57,65 +58,97 @@ public static ShellResult config(Params params, String componentName) { if (StringUtils.isNotBlank(componentName)) { switch (componentName) { case "namenode": { - LinuxFileUtils.createDirectories(hdfsParams.getDfsNameNodeDir(), hdfsUser, - hdfsGroup, PERMISSION_755, true); + LinuxFileUtils.createDirectories( + hdfsParams.getDfsNameNodeDir(), hdfsUser, hdfsGroup, Constants.PERMISSION_755, true); } case "secondarynamenode": { - LinuxFileUtils.createDirectories(hdfsParams.getDfsNameNodeCheckPointDir(), - hdfsUser, hdfsGroup, PERMISSION_755, true); + LinuxFileUtils.createDirectories( + hdfsParams.getDfsNameNodeCheckPointDir(), + hdfsUser, + hdfsGroup, + Constants.PERMISSION_755, + true); } case "datanode": { - LinuxFileUtils.createDirectories(hdfsParams.getDfsDomainSocketPathPrefix(), - hdfsUser, hdfsGroup, PERMISSION_755, true); + LinuxFileUtils.createDirectories( + hdfsParams.getDfsDomainSocketPathPrefix(), + hdfsUser, + hdfsGroup, + Constants.PERMISSION_755, + true); } } } // mkdir directories - LinuxFileUtils.createDirectories(hdfsParams.getDfsDataDir(), hdfsUser, hdfsGroup, - PERMISSION_755, true); - LinuxFileUtils.createDirectories(hdfsParams.getHadoopLogDir(), hdfsUser, hdfsGroup, - PERMISSION_755, true); - LinuxFileUtils.createDirectories(hdfsParams.getHadoopPidDir(), hdfsUser, hdfsGroup, - PERMISSION_755, true); + LinuxFileUtils.createDirectories( + hdfsParams.getDfsDataDir(), hdfsUser, hdfsGroup, Constants.PERMISSION_755, true); + LinuxFileUtils.createDirectories( + hdfsParams.getHadoopLogDir(), hdfsUser, hdfsGroup, Constants.PERMISSION_755, true); + LinuxFileUtils.createDirectories( + hdfsParams.getHadoopPidDir(), hdfsUser, hdfsGroup, Constants.PERMISSION_755, true); // hdfs.limits - LinuxFileUtils.toFileByTemplate(hdfsParams.hdfsLimits(), + LinuxFileUtils.toFileByTemplate( + hdfsParams.hdfsLimits(), MessageFormat.format("{0}/hdfs.conf", KafkaParams.LIMITS_CONF_DIR), - ROOT_USER, - ROOT_USER, - PERMISSION_644, + Constants.ROOT_USER, + Constants.ROOT_USER, + Constants.PERMISSION_644, hdfsParams.getGlobalParamsMap()); // hadoop-env.sh - LinuxFileUtils.toFileByTemplate(hadoopEnv.get("content").toString(), + LinuxFileUtils.toFileByTemplate( + hadoopEnv.get("content").toString(), MessageFormat.format("{0}/hadoop-env.sh", confDir), - hdfsUser, hdfsGroup, PERMISSION_644, hdfsParams.getGlobalParamsMap()); + hdfsUser, + hdfsGroup, + Constants.PERMISSION_644, + hdfsParams.getGlobalParamsMap()); // core-site.xml - LinuxFileUtils.toFile(ConfigType.XML, MessageFormat.format("{0}/core-site.xml", confDir), - hdfsUser, hdfsGroup, PERMISSION_644, hdfsParams.coreSite()); + LinuxFileUtils.toFile( + ConfigType.XML, + MessageFormat.format("{0}/core-site.xml", confDir), + hdfsUser, + hdfsGroup, + Constants.PERMISSION_644, + hdfsParams.coreSite()); // hdfs-site.xml - LinuxFileUtils.toFile(ConfigType.XML, MessageFormat.format("{0}/hdfs-site.xml", confDir), - hdfsUser, hdfsGroup, PERMISSION_644, hdfsParams.hdfsSite()); + LinuxFileUtils.toFile( + ConfigType.XML, + MessageFormat.format("{0}/hdfs-site.xml", confDir), + hdfsUser, + hdfsGroup, + Constants.PERMISSION_644, + hdfsParams.hdfsSite()); // hdfs-policy.xml - LinuxFileUtils.toFile(ConfigType.XML, + LinuxFileUtils.toFile( + ConfigType.XML, MessageFormat.format("{0}/hadoop-policy.xml", confDir), - hdfsUser, hdfsGroup, PERMISSION_644, hdfsParams.hadoopPolicy()); + hdfsUser, + hdfsGroup, + Constants.PERMISSION_644, + hdfsParams.hadoopPolicy()); // hdfs-policy.xml - LinuxFileUtils.toFileByTemplate(hdfsParams.workers(), + LinuxFileUtils.toFileByTemplate( + hdfsParams.workers(), MessageFormat.format("{0}/workers", confDir), - hdfsUser, hdfsGroup, PERMISSION_644, hdfsParams.getGlobalParamsMap()); + hdfsUser, + hdfsGroup, + Constants.PERMISSION_644, + hdfsParams.getGlobalParamsMap()); // log4j - LinuxFileUtils.toFileByTemplate(hdfsParams.hdfsLog4j().get("content").toString(), + LinuxFileUtils.toFileByTemplate( + hdfsParams.hdfsLog4j().get("content").toString(), MessageFormat.format("{0}/log4j.properties", confDir), hdfsUser, hdfsGroup, - PERMISSION_644, + Constants.PERMISSION_644, hdfsParams.getGlobalParamsMap()); return ShellResult.success("HDFS Configure success!"); @@ -123,9 +156,8 @@ public static ShellResult config(Params params, String componentName) { public static void formatNameNode(HdfsParams hdfsParams) { if (!isNameNodeFormatted(hdfsParams)) { - String formatCmd = - MessageFormat.format("{0} --config {1} namenode -format -nonInteractive", - hdfsParams.hdfsExec(), hdfsParams.confDir()); + String formatCmd = MessageFormat.format( + "{0} --config {1} namenode -format -nonInteractive", hdfsParams.hdfsExec(), hdfsParams.confDir()); try { LinuxOSUtils.sudoExecCmd(formatCmd, hdfsParams.user()); } catch (Exception e) { @@ -133,11 +165,10 @@ public static void formatNameNode(HdfsParams hdfsParams) { } for (String nameNodeFormattedDir : hdfsParams.getNameNodeFormattedDirs()) { - LinuxFileUtils.createDirectories(nameNodeFormattedDir, hdfsParams.user(), - hdfsParams.group(), PERMISSION_755, true); + LinuxFileUtils.createDirectories( + nameNodeFormattedDir, hdfsParams.user(), hdfsParams.group(), Constants.PERMISSION_755, true); } } - } public static boolean isNameNodeFormatted(HdfsParams hdfsParams) { @@ -153,8 +184,8 @@ public static boolean isNameNodeFormatted(HdfsParams hdfsParams) { if (isFormatted) { for (String nameNodeFormattedDir : hdfsParams.getNameNodeFormattedDirs()) { - LinuxFileUtils.createDirectories(nameNodeFormattedDir, hdfsParams.user(), - hdfsParams.group(), PERMISSION_755, true); + LinuxFileUtils.createDirectories( + nameNodeFormattedDir, hdfsParams.user(), hdfsParams.group(), Constants.PERMISSION_755, true); } return true; } @@ -165,12 +196,14 @@ public static boolean isNameNodeFormatted(HdfsParams hdfsParams) { for (String nameNodeDir : nameNodeDirs) { File file = new File(nameNodeDir); if (!file.exists()) { - TaskLogWriter.info("NameNode will not be formatted because the directory " + nameNodeDir + " is missing or cannot be checked for content."); + TaskLogWriter.info("NameNode will not be formatted because the directory " + nameNodeDir + + " is missing or cannot be checked for content."); return true; } else { File[] files = file.listFiles(); if (files != null && files.length > 0) { - TaskLogWriter.info("NameNode will not be formatted since " + nameNodeDir + " exists and contains content"); + TaskLogWriter.info( + "NameNode will not be formatted since " + nameNodeDir + " exists and contains content"); return true; } } diff --git a/bigtop-manager-stack/bigtop-manager-stack-bigtop/src/main/java/org/apache/bigtop/manager/stack/bigtop/v3_3_0/hdfs/NameNodeScript.java b/bigtop-manager-stack/bigtop-manager-stack-bigtop/src/main/java/org/apache/bigtop/manager/stack/bigtop/v3_3_0/hdfs/NameNodeScript.java index a64ddc92..42a74d03 100644 --- a/bigtop-manager-stack/bigtop-manager-stack-bigtop/src/main/java/org/apache/bigtop/manager/stack/bigtop/v3_3_0/hdfs/NameNodeScript.java +++ b/bigtop-manager-stack/bigtop-manager-stack-bigtop/src/main/java/org/apache/bigtop/manager/stack/bigtop/v3_3_0/hdfs/NameNodeScript.java @@ -25,12 +25,11 @@ import org.apache.bigtop.manager.stack.common.utils.PackageUtils; import org.apache.bigtop.manager.stack.common.utils.linux.LinuxOSUtils; -import java.text.MessageFormat; - import com.google.auto.service.AutoService; - import lombok.extern.slf4j.Slf4j; +import java.text.MessageFormat; + @Slf4j @AutoService(Script.class) public class NameNodeScript implements Script { @@ -96,5 +95,4 @@ public ShellResult printTopology(Params params) { throw new StackException(e); } } - } diff --git a/bigtop-manager-stack/bigtop-manager-stack-bigtop/src/main/java/org/apache/bigtop/manager/stack/bigtop/v3_3_0/hdfs/SNameNodeScript.java b/bigtop-manager-stack/bigtop-manager-stack-bigtop/src/main/java/org/apache/bigtop/manager/stack/bigtop/v3_3_0/hdfs/SNameNodeScript.java index 31cbbaf1..bf723701 100644 --- a/bigtop-manager-stack/bigtop-manager-stack-bigtop/src/main/java/org/apache/bigtop/manager/stack/bigtop/v3_3_0/hdfs/SNameNodeScript.java +++ b/bigtop-manager-stack/bigtop-manager-stack-bigtop/src/main/java/org/apache/bigtop/manager/stack/bigtop/v3_3_0/hdfs/SNameNodeScript.java @@ -25,12 +25,11 @@ import org.apache.bigtop.manager.stack.common.utils.PackageUtils; import org.apache.bigtop.manager.stack.common.utils.linux.LinuxOSUtils; -import java.text.MessageFormat; - import com.google.auto.service.AutoService; - import lombok.extern.slf4j.Slf4j; +import java.text.MessageFormat; + @Slf4j @AutoService(Script.class) public class SNameNodeScript implements Script { @@ -74,5 +73,4 @@ public ShellResult status(Params params) { HdfsParams hdfsParams = (HdfsParams) params; return LinuxOSUtils.checkProcess(hdfsParams.getSNameNodePidFile()); } - } diff --git a/bigtop-manager-stack/bigtop-manager-stack-bigtop/src/main/java/org/apache/bigtop/manager/stack/bigtop/v3_3_0/kafka/KafkaBrokerScript.java b/bigtop-manager-stack/bigtop-manager-stack-bigtop/src/main/java/org/apache/bigtop/manager/stack/bigtop/v3_3_0/kafka/KafkaBrokerScript.java index c413430f..e72467d0 100644 --- a/bigtop-manager-stack/bigtop-manager-stack-bigtop/src/main/java/org/apache/bigtop/manager/stack/bigtop/v3_3_0/kafka/KafkaBrokerScript.java +++ b/bigtop-manager-stack/bigtop-manager-stack-bigtop/src/main/java/org/apache/bigtop/manager/stack/bigtop/v3_3_0/kafka/KafkaBrokerScript.java @@ -18,10 +18,6 @@ */ package org.apache.bigtop.manager.stack.bigtop.v3_3_0.kafka; -import static org.apache.bigtop.manager.common.constants.Constants.PERMISSION_644; -import static org.apache.bigtop.manager.common.constants.Constants.PERMISSION_755; -import static org.apache.bigtop.manager.common.constants.Constants.ROOT_USER; - import org.apache.bigtop.manager.common.shell.ShellResult; import org.apache.bigtop.manager.spi.stack.Params; import org.apache.bigtop.manager.spi.stack.Script; @@ -32,15 +28,18 @@ import org.apache.bigtop.manager.stack.common.utils.linux.LinuxFileUtils; import org.apache.bigtop.manager.stack.common.utils.linux.LinuxOSUtils; +import com.google.auto.service.AutoService; +import lombok.extern.slf4j.Slf4j; + import java.io.IOException; import java.text.MessageFormat; import java.util.HashMap; import java.util.List; import java.util.Map; -import com.google.auto.service.AutoService; - -import lombok.extern.slf4j.Slf4j; +import static org.apache.bigtop.manager.common.constants.Constants.PERMISSION_644; +import static org.apache.bigtop.manager.common.constants.Constants.PERMISSION_755; +import static org.apache.bigtop.manager.common.constants.Constants.ROOT_USER; @Slf4j @AutoService(Script.class) @@ -59,19 +58,17 @@ public ShellResult configure(Params params) { String kafkaUser = kafkaParams.user(); String kafkaGroup = kafkaParams.group(); - LinuxFileUtils.createDirectories(kafkaParams.getKafkaDataDir(), kafkaUser, kafkaGroup, - PERMISSION_755, true); - LinuxFileUtils.createDirectories(kafkaParams.getKafkaLogDir(), kafkaUser, kafkaGroup, - PERMISSION_755, true); - LinuxFileUtils.createDirectories(kafkaParams.getKafkaPidDir(), kafkaUser, kafkaGroup, - PERMISSION_755, true); + LinuxFileUtils.createDirectories(kafkaParams.getKafkaDataDir(), kafkaUser, kafkaGroup, PERMISSION_755, true); + LinuxFileUtils.createDirectories(kafkaParams.getKafkaLogDir(), kafkaUser, kafkaGroup, PERMISSION_755, true); + LinuxFileUtils.createDirectories(kafkaParams.getKafkaPidDir(), kafkaUser, kafkaGroup, PERMISSION_755, true); // server.properties List zookeeperServerHosts = LocalSettings.hosts("zookeeper_server"); Map paramMap = new HashMap<>(); paramMap.put("zk_server_list", zookeeperServerHosts); paramMap.put("host", kafkaParams.hostname()); - LinuxFileUtils.toFile(ConfigType.PROPERTIES, + LinuxFileUtils.toFile( + ConfigType.PROPERTIES, MessageFormat.format("{0}/server.properties", confDir), kafkaUser, kafkaGroup, @@ -80,7 +77,8 @@ public ShellResult configure(Params params) { paramMap); // kafka-env - LinuxFileUtils.toFileByTemplate(kafkaParams.getKafkaEnvContent(), + LinuxFileUtils.toFileByTemplate( + kafkaParams.getKafkaEnvContent(), MessageFormat.format("{0}/kafka-env.sh", confDir), kafkaUser, kafkaGroup, @@ -88,7 +86,8 @@ public ShellResult configure(Params params) { kafkaParams.getGlobalParamsMap()); // log4j - LinuxFileUtils.toFileByTemplate(kafkaParams.getKafkaLog4jContent(), + LinuxFileUtils.toFileByTemplate( + kafkaParams.getKafkaLog4jContent(), MessageFormat.format("{0}/log4j.properties", confDir), kafkaUser, kafkaGroup, @@ -96,7 +95,8 @@ public ShellResult configure(Params params) { kafkaParams.getGlobalParamsMap()); // kafka.limits - LinuxFileUtils.toFileByTemplate(kafkaParams.kafkaLimits(), + LinuxFileUtils.toFileByTemplate( + kafkaParams.kafkaLimits(), MessageFormat.format("{0}/kafka.conf", KafkaParams.LIMITS_CONF_DIR), ROOT_USER, ROOT_USER, @@ -124,8 +124,7 @@ public ShellResult start(Params params) { @Override public ShellResult stop(Params params) { KafkaParams kafkaParams = (KafkaParams) params; - String cmd = - MessageFormat.format("sh {0}/bin/kafka-server-stop.sh", kafkaParams.serviceHome()); + String cmd = MessageFormat.format("sh {0}/bin/kafka-server-stop.sh", kafkaParams.serviceHome()); try { return LinuxOSUtils.sudoExecCmd(cmd, kafkaParams.user()); } catch (IOException e) { @@ -147,5 +146,4 @@ public ShellResult test(Params params) { throw new StackException(e); } } - } diff --git a/bigtop-manager-stack/bigtop-manager-stack-bigtop/src/main/java/org/apache/bigtop/manager/stack/bigtop/v3_3_0/kafka/KafkaParams.java b/bigtop-manager-stack/bigtop-manager-stack-bigtop/src/main/java/org/apache/bigtop/manager/stack/bigtop/v3_3_0/kafka/KafkaParams.java index 1175244c..9b6a2ec2 100644 --- a/bigtop-manager-stack/bigtop-manager-stack-bigtop/src/main/java/org/apache/bigtop/manager/stack/bigtop/v3_3_0/kafka/KafkaParams.java +++ b/bigtop-manager-stack/bigtop-manager-stack-bigtop/src/main/java/org/apache/bigtop/manager/stack/bigtop/v3_3_0/kafka/KafkaParams.java @@ -23,10 +23,10 @@ import org.apache.bigtop.manager.stack.common.utils.BaseParams; import org.apache.bigtop.manager.stack.common.utils.LocalSettings; -import java.util.Map; - import lombok.Getter; +import java.util.Map; + @Getter public class KafkaParams extends BaseParams { @@ -74,5 +74,4 @@ public String kafkaLimits() { Map kafkaLimits = LocalSettings.configurations(serviceName(), "kafka.conf"); return (String) kafkaLimits.get("content"); } - } diff --git a/bigtop-manager-stack/bigtop-manager-stack-bigtop/src/main/java/org/apache/bigtop/manager/stack/bigtop/v3_3_0/zookeeper/ZookeeperClientScript.java b/bigtop-manager-stack/bigtop-manager-stack-bigtop/src/main/java/org/apache/bigtop/manager/stack/bigtop/v3_3_0/zookeeper/ZookeeperClientScript.java index de054a82..1001c13e 100644 --- a/bigtop-manager-stack/bigtop-manager-stack-bigtop/src/main/java/org/apache/bigtop/manager/stack/bigtop/v3_3_0/zookeeper/ZookeeperClientScript.java +++ b/bigtop-manager-stack/bigtop-manager-stack-bigtop/src/main/java/org/apache/bigtop/manager/stack/bigtop/v3_3_0/zookeeper/ZookeeperClientScript.java @@ -25,7 +25,6 @@ import org.apache.bigtop.manager.stack.common.utils.PackageUtils; import com.google.auto.service.AutoService; - import lombok.extern.slf4j.Slf4j; @Slf4j @@ -41,5 +40,4 @@ public ShellResult install(Params params) { public ShellResult configure(Params params) { return ZookeeperSetup.config(params); } - } diff --git a/bigtop-manager-stack/bigtop-manager-stack-bigtop/src/main/java/org/apache/bigtop/manager/stack/bigtop/v3_3_0/zookeeper/ZookeeperParams.java b/bigtop-manager-stack/bigtop-manager-stack-bigtop/src/main/java/org/apache/bigtop/manager/stack/bigtop/v3_3_0/zookeeper/ZookeeperParams.java index 48d306db..f5e2acc6 100644 --- a/bigtop-manager-stack/bigtop-manager-stack-bigtop/src/main/java/org/apache/bigtop/manager/stack/bigtop/v3_3_0/zookeeper/ZookeeperParams.java +++ b/bigtop-manager-stack/bigtop-manager-stack-bigtop/src/main/java/org/apache/bigtop/manager/stack/bigtop/v3_3_0/zookeeper/ZookeeperParams.java @@ -23,10 +23,10 @@ import org.apache.bigtop.manager.stack.common.utils.BaseParams; import org.apache.bigtop.manager.stack.common.utils.LocalSettings; -import java.util.Map; - import lombok.Getter; +import java.util.Map; + @Getter public class ZookeeperParams extends BaseParams { diff --git a/bigtop-manager-stack/bigtop-manager-stack-bigtop/src/main/java/org/apache/bigtop/manager/stack/bigtop/v3_3_0/zookeeper/ZookeeperServerScript.java b/bigtop-manager-stack/bigtop-manager-stack-bigtop/src/main/java/org/apache/bigtop/manager/stack/bigtop/v3_3_0/zookeeper/ZookeeperServerScript.java index c2b41afe..b887b25d 100644 --- a/bigtop-manager-stack/bigtop-manager-stack-bigtop/src/main/java/org/apache/bigtop/manager/stack/bigtop/v3_3_0/zookeeper/ZookeeperServerScript.java +++ b/bigtop-manager-stack/bigtop-manager-stack-bigtop/src/main/java/org/apache/bigtop/manager/stack/bigtop/v3_3_0/zookeeper/ZookeeperServerScript.java @@ -25,13 +25,12 @@ import org.apache.bigtop.manager.stack.common.utils.PackageUtils; import org.apache.bigtop.manager.stack.common.utils.linux.LinuxOSUtils; -import java.io.IOException; -import java.text.MessageFormat; - import com.google.auto.service.AutoService; - import lombok.extern.slf4j.Slf4j; +import java.io.IOException; +import java.text.MessageFormat; + @Slf4j @AutoService(Script.class) public class ZookeeperServerScript implements Script { @@ -75,5 +74,4 @@ public ShellResult status(Params params) { ZookeeperParams zookeeperParams = (ZookeeperParams) params; return LinuxOSUtils.checkProcess(zookeeperParams.getZookeeperPidFile()); } - } diff --git a/bigtop-manager-stack/bigtop-manager-stack-bigtop/src/main/java/org/apache/bigtop/manager/stack/bigtop/v3_3_0/zookeeper/ZookeeperSetup.java b/bigtop-manager-stack/bigtop-manager-stack-bigtop/src/main/java/org/apache/bigtop/manager/stack/bigtop/v3_3_0/zookeeper/ZookeeperSetup.java index 2e8b35f8..380c3e53 100644 --- a/bigtop-manager-stack/bigtop-manager-stack-bigtop/src/main/java/org/apache/bigtop/manager/stack/bigtop/v3_3_0/zookeeper/ZookeeperSetup.java +++ b/bigtop-manager-stack/bigtop-manager-stack-bigtop/src/main/java/org/apache/bigtop/manager/stack/bigtop/v3_3_0/zookeeper/ZookeeperSetup.java @@ -18,9 +18,6 @@ */ package org.apache.bigtop.manager.stack.bigtop.v3_3_0.zookeeper; -import static org.apache.bigtop.manager.common.constants.Constants.PERMISSION_644; -import static org.apache.bigtop.manager.common.constants.Constants.PERMISSION_755; - import org.apache.bigtop.manager.common.shell.ShellResult; import org.apache.bigtop.manager.common.utils.NetUtils; import org.apache.bigtop.manager.spi.stack.Params; @@ -29,14 +26,17 @@ import org.apache.bigtop.manager.stack.common.utils.LocalSettings; import org.apache.bigtop.manager.stack.common.utils.linux.LinuxFileUtils; +import lombok.AccessLevel; +import lombok.NoArgsConstructor; +import lombok.extern.slf4j.Slf4j; + import java.text.MessageFormat; import java.util.HashMap; import java.util.List; import java.util.Map; -import lombok.AccessLevel; -import lombok.NoArgsConstructor; -import lombok.extern.slf4j.Slf4j; +import static org.apache.bigtop.manager.common.constants.Constants.PERMISSION_644; +import static org.apache.bigtop.manager.common.constants.Constants.PERMISSION_755; @Slf4j @NoArgsConstructor(access = AccessLevel.PRIVATE) @@ -53,41 +53,53 @@ public static ShellResult config(Params params) { Map zooCfg = zookeeperParams.zooCfg(); List zkHostList = LocalSettings.hosts("zookeeper_server"); - LinuxFileUtils.createDirectories(zookeeperParams.getZookeeperDataDir(), zookeeperUser, zookeeperGroup, - PERMISSION_755, true); - LinuxFileUtils.createDirectories(zookeeperParams.getZookeeperLogDir(), zookeeperUser, zookeeperGroup, - PERMISSION_755, true); - LinuxFileUtils.createDirectories(zookeeperParams.getZookeeperPidDir(), zookeeperUser, zookeeperGroup, - PERMISSION_755, true); + LinuxFileUtils.createDirectories( + zookeeperParams.getZookeeperDataDir(), zookeeperUser, zookeeperGroup, PERMISSION_755, true); + LinuxFileUtils.createDirectories( + zookeeperParams.getZookeeperLogDir(), zookeeperUser, zookeeperGroup, PERMISSION_755, true); + LinuxFileUtils.createDirectories( + zookeeperParams.getZookeeperPidDir(), zookeeperUser, zookeeperGroup, PERMISSION_755, true); // 针对zkHostList排序,获取当前hostname的index+1 // server.${host?index+1}=${host}:2888:3888 zkHostList.sort(String::compareToIgnoreCase); StringBuilder zkServerStr = new StringBuilder(); for (String zkHost : zkHostList) { - zkServerStr.append(MessageFormat.format("server.{0}={1}:2888:3888", zkHostList.indexOf(zkHost) + 1, zkHost)) + zkServerStr + .append(MessageFormat.format("server.{0}={1}:2888:3888", zkHostList.indexOf(zkHost) + 1, zkHost)) .append("\n"); } // myid - LinuxFileUtils.toFile(ConfigType.CONTENT, + LinuxFileUtils.toFile( + ConfigType.CONTENT, MessageFormat.format("{0}/myid", zookeeperParams.getZookeeperDataDir()), - zookeeperUser, zookeeperGroup, PERMISSION_644, + zookeeperUser, + zookeeperGroup, + PERMISSION_644, zkHostList.indexOf(NetUtils.getHostname()) + 1 + ""); // zoo.cfg HashMap map = new HashMap<>(zooCfg); map.remove("content"); - Map paramMap = Map.of( - "zk_server_str", zkServerStr.toString(), - "security_enabled", false); - LinuxFileUtils.toFileByTemplate(zooCfg.get("content").toString(), MessageFormat.format("{0}/zoo.cfg", confDir), - zookeeperUser, zookeeperGroup, PERMISSION_644, Map.of("model", map), paramMap); + Map paramMap = Map.of("zk_server_str", zkServerStr.toString(), "security_enabled", false); + LinuxFileUtils.toFileByTemplate( + zooCfg.get("content").toString(), + MessageFormat.format("{0}/zoo.cfg", confDir), + zookeeperUser, + zookeeperGroup, + PERMISSION_644, + Map.of("model", map), + paramMap); // zookeeper-env - LinuxFileUtils.toFileByTemplate(zookeeperEnv.get("content").toString(), + LinuxFileUtils.toFileByTemplate( + zookeeperEnv.get("content").toString(), MessageFormat.format("{0}/zookeeper-env.sh", confDir), - zookeeperUser, zookeeperGroup, PERMISSION_644, zookeeperParams.getGlobalParamsMap()); + zookeeperUser, + zookeeperGroup, + PERMISSION_644, + zookeeperParams.getGlobalParamsMap()); return ShellResult.success("ZooKeeper Server Configure success!"); } diff --git a/bigtop-manager-stack/bigtop-manager-stack-common/pom.xml b/bigtop-manager-stack/bigtop-manager-stack-common/pom.xml index 916cbe92..27fb90c3 100644 --- a/bigtop-manager-stack/bigtop-manager-stack-common/pom.xml +++ b/bigtop-manager-stack/bigtop-manager-stack-common/pom.xml @@ -17,9 +17,7 @@ ~ specific language governing permissions and limitations ~ under the License. --> - - + 4.0.0 org.apache.bigtop diff --git a/bigtop-manager-stack/bigtop-manager-stack-common/src/main/java/org/apache/bigtop/manager/stack/common/annotations/GlobalParams.java b/bigtop-manager-stack/bigtop-manager-stack-common/src/main/java/org/apache/bigtop/manager/stack/common/annotations/GlobalParams.java index 0721a91f..38a76cab 100644 --- a/bigtop-manager-stack/bigtop-manager-stack-common/src/main/java/org/apache/bigtop/manager/stack/common/annotations/GlobalParams.java +++ b/bigtop-manager-stack/bigtop-manager-stack-common/src/main/java/org/apache/bigtop/manager/stack/common/annotations/GlobalParams.java @@ -31,6 +31,4 @@ @Documented @Target(ElementType.METHOD) @Retention(RetentionPolicy.RUNTIME) -public @interface GlobalParams { - -} +public @interface GlobalParams {} diff --git a/bigtop-manager-stack/bigtop-manager-stack-common/src/main/java/org/apache/bigtop/manager/stack/common/enums/ConfigType.java b/bigtop-manager-stack/bigtop-manager-stack-common/src/main/java/org/apache/bigtop/manager/stack/common/enums/ConfigType.java index 6fb3d2b6..760a7421 100644 --- a/bigtop-manager-stack/bigtop-manager-stack-common/src/main/java/org/apache/bigtop/manager/stack/common/enums/ConfigType.java +++ b/bigtop-manager-stack/bigtop-manager-stack-common/src/main/java/org/apache/bigtop/manager/stack/common/enums/ConfigType.java @@ -19,5 +19,11 @@ package org.apache.bigtop.manager.stack.common.enums; public enum ConfigType { - PROPERTIES, YAML, XML, JSON, ENV, CONTENT, UNKNOWN; + PROPERTIES, + YAML, + XML, + JSON, + ENV, + CONTENT, + UNKNOWN; } diff --git a/bigtop-manager-stack/bigtop-manager-stack-common/src/main/java/org/apache/bigtop/manager/stack/common/enums/PackageManagerType.java b/bigtop-manager-stack/bigtop-manager-stack-common/src/main/java/org/apache/bigtop/manager/stack/common/enums/PackageManagerType.java index 71b9c49e..0263738a 100644 --- a/bigtop-manager-stack/bigtop-manager-stack-common/src/main/java/org/apache/bigtop/manager/stack/common/enums/PackageManagerType.java +++ b/bigtop-manager-stack/bigtop-manager-stack-common/src/main/java/org/apache/bigtop/manager/stack/common/enums/PackageManagerType.java @@ -18,6 +18,12 @@ */ package org.apache.bigtop.manager.stack.common.enums; +import org.apache.bigtop.manager.common.enums.OSType; + +import lombok.Getter; + +import java.util.List; + import static org.apache.bigtop.manager.common.enums.OSType.CENTOS7; import static org.apache.bigtop.manager.common.enums.OSType.DEBIAN10; import static org.apache.bigtop.manager.common.enums.OSType.DEBIAN11; @@ -26,21 +32,13 @@ import static org.apache.bigtop.manager.common.enums.OSType.UBUNTU20; import static org.apache.bigtop.manager.common.enums.OSType.UBUNTU22; -import org.apache.bigtop.manager.common.enums.OSType; - -import java.util.List; - -import lombok.Getter; - @Getter public enum PackageManagerType { - YUM(List.of(CENTOS7)), DNF(List.of(ROCKY8, FEDORA36)), APT(List.of(UBUNTU20, UBUNTU22, DEBIAN10, DEBIAN11)), - ; /** @@ -51,5 +49,4 @@ public enum PackageManagerType { PackageManagerType(List osTypes) { this.osTypes = osTypes; } - } diff --git a/bigtop-manager-stack/bigtop-manager-stack-common/src/main/java/org/apache/bigtop/manager/stack/common/exception/StackException.java b/bigtop-manager-stack/bigtop-manager-stack-common/src/main/java/org/apache/bigtop/manager/stack/common/exception/StackException.java index ee99d7d9..863c1b80 100644 --- a/bigtop-manager-stack/bigtop-manager-stack-common/src/main/java/org/apache/bigtop/manager/stack/common/exception/StackException.java +++ b/bigtop-manager-stack/bigtop-manager-stack-common/src/main/java/org/apache/bigtop/manager/stack/common/exception/StackException.java @@ -35,5 +35,4 @@ public StackException(String msgFormat, Object... args) { public StackException(Throwable cause) { super(cause); } - } diff --git a/bigtop-manager-stack/bigtop-manager-stack-common/src/main/java/org/apache/bigtop/manager/stack/common/repo/AptPackageManager.java b/bigtop-manager-stack/bigtop-manager-stack-common/src/main/java/org/apache/bigtop/manager/stack/common/repo/AptPackageManager.java index 97312034..3b239e5b 100644 --- a/bigtop-manager-stack/bigtop-manager-stack-common/src/main/java/org/apache/bigtop/manager/stack/common/repo/AptPackageManager.java +++ b/bigtop-manager-stack/bigtop-manager-stack-common/src/main/java/org/apache/bigtop/manager/stack/common/repo/AptPackageManager.java @@ -18,8 +18,6 @@ */ package org.apache.bigtop.manager.stack.common.repo; -import com.google.auto.service.AutoService; -import lombok.extern.slf4j.Slf4j; import org.apache.bigtop.manager.common.shell.ShellExecutor; import org.apache.bigtop.manager.common.shell.ShellResult; import org.apache.bigtop.manager.spi.stack.PackageManager; @@ -27,6 +25,9 @@ import org.apache.bigtop.manager.stack.common.exception.StackException; import org.apache.bigtop.manager.stack.common.log.TaskLogWriter; +import com.google.auto.service.AutoService; +import lombok.extern.slf4j.Slf4j; + import java.io.IOException; import java.util.ArrayList; import java.util.Collection; diff --git a/bigtop-manager-stack/bigtop-manager-stack-common/src/main/java/org/apache/bigtop/manager/stack/common/repo/DnfPackageManager.java b/bigtop-manager-stack/bigtop-manager-stack-common/src/main/java/org/apache/bigtop/manager/stack/common/repo/DnfPackageManager.java index ef455a10..a800da38 100644 --- a/bigtop-manager-stack/bigtop-manager-stack-common/src/main/java/org/apache/bigtop/manager/stack/common/repo/DnfPackageManager.java +++ b/bigtop-manager-stack/bigtop-manager-stack-common/src/main/java/org/apache/bigtop/manager/stack/common/repo/DnfPackageManager.java @@ -18,8 +18,6 @@ */ package org.apache.bigtop.manager.stack.common.repo; -import com.google.auto.service.AutoService; -import lombok.extern.slf4j.Slf4j; import org.apache.bigtop.manager.common.shell.ShellExecutor; import org.apache.bigtop.manager.common.shell.ShellResult; import org.apache.bigtop.manager.spi.stack.PackageManager; @@ -27,6 +25,9 @@ import org.apache.bigtop.manager.stack.common.exception.StackException; import org.apache.bigtop.manager.stack.common.log.TaskLogWriter; +import com.google.auto.service.AutoService; +import lombok.extern.slf4j.Slf4j; + import java.io.IOException; import java.util.ArrayList; import java.util.Collection; diff --git a/bigtop-manager-stack/bigtop-manager-stack-common/src/main/java/org/apache/bigtop/manager/stack/common/repo/YumPackageManager.java b/bigtop-manager-stack/bigtop-manager-stack-common/src/main/java/org/apache/bigtop/manager/stack/common/repo/YumPackageManager.java index 761a88a7..acbee9cb 100644 --- a/bigtop-manager-stack/bigtop-manager-stack-common/src/main/java/org/apache/bigtop/manager/stack/common/repo/YumPackageManager.java +++ b/bigtop-manager-stack/bigtop-manager-stack-common/src/main/java/org/apache/bigtop/manager/stack/common/repo/YumPackageManager.java @@ -18,8 +18,6 @@ */ package org.apache.bigtop.manager.stack.common.repo; -import com.google.auto.service.AutoService; -import lombok.extern.slf4j.Slf4j; import org.apache.bigtop.manager.common.shell.ShellExecutor; import org.apache.bigtop.manager.common.shell.ShellResult; import org.apache.bigtop.manager.spi.stack.PackageManager; @@ -27,6 +25,9 @@ import org.apache.bigtop.manager.stack.common.exception.StackException; import org.apache.bigtop.manager.stack.common.log.TaskLogWriter; +import com.google.auto.service.AutoService; +import lombok.extern.slf4j.Slf4j; + import java.io.IOException; import java.util.ArrayList; import java.util.Collection; diff --git a/bigtop-manager-stack/bigtop-manager-stack-common/src/main/java/org/apache/bigtop/manager/stack/common/utils/BaseParams.java b/bigtop-manager-stack/bigtop-manager-stack-common/src/main/java/org/apache/bigtop/manager/stack/common/utils/BaseParams.java index 8c2a01a2..34681e4c 100644 --- a/bigtop-manager-stack/bigtop-manager-stack-common/src/main/java/org/apache/bigtop/manager/stack/common/utils/BaseParams.java +++ b/bigtop-manager-stack/bigtop-manager-stack-common/src/main/java/org/apache/bigtop/manager/stack/common/utils/BaseParams.java @@ -18,8 +18,6 @@ */ package org.apache.bigtop.manager.stack.common.utils; -import lombok.Getter; -import lombok.extern.slf4j.Slf4j; import org.apache.bigtop.manager.common.enums.Command; import org.apache.bigtop.manager.common.message.entity.payload.CommandPayload; import org.apache.bigtop.manager.common.message.entity.pojo.OSSpecificInfo; @@ -28,8 +26,12 @@ import org.apache.bigtop.manager.spi.stack.Params; import org.apache.bigtop.manager.stack.common.annotations.GlobalParams; import org.apache.bigtop.manager.stack.common.log.TaskLogWriter; + import org.apache.commons.lang3.StringUtils; +import lombok.Getter; +import lombok.extern.slf4j.Slf4j; + import java.lang.reflect.Method; import java.text.MessageFormat; import java.util.HashMap; @@ -127,17 +129,18 @@ public String confDir() { } public String user() { - return StringUtils.isNotBlank(this.commandPayload.getServiceUser()) ? this.commandPayload.getServiceUser() + return StringUtils.isNotBlank(this.commandPayload.getServiceUser()) + ? this.commandPayload.getServiceUser() : ROOT_USER; } public String group() { - return StringUtils.isNotBlank(this.commandPayload.getServiceGroup()) ? this.commandPayload.getServiceGroup() + return StringUtils.isNotBlank(this.commandPayload.getServiceGroup()) + ? this.commandPayload.getServiceGroup() : ROOT_USER; } public String serviceName() { return this.commandPayload.getServiceName(); } - } diff --git a/bigtop-manager-stack/bigtop-manager-stack-common/src/main/java/org/apache/bigtop/manager/stack/common/utils/LocalSettings.java b/bigtop-manager-stack/bigtop-manager-stack-common/src/main/java/org/apache/bigtop/manager/stack/common/utils/LocalSettings.java index df591da3..fa04b221 100644 --- a/bigtop-manager-stack/bigtop-manager-stack-common/src/main/java/org/apache/bigtop/manager/stack/common/utils/LocalSettings.java +++ b/bigtop-manager-stack/bigtop-manager-stack-common/src/main/java/org/apache/bigtop/manager/stack/common/utils/LocalSettings.java @@ -18,25 +18,28 @@ */ package org.apache.bigtop.manager.stack.common.utils; -import com.fasterxml.jackson.core.type.TypeReference; -import lombok.extern.slf4j.Slf4j; +import org.apache.bigtop.manager.common.constants.CacheFiles; +import org.apache.bigtop.manager.common.constants.Constants; import org.apache.bigtop.manager.common.message.entity.pojo.ClusterInfo; import org.apache.bigtop.manager.common.message.entity.pojo.ComponentInfo; import org.apache.bigtop.manager.common.message.entity.pojo.RepoInfo; import org.apache.bigtop.manager.common.utils.JsonUtils; import org.apache.bigtop.manager.stack.common.log.TaskLogWriter; -import java.io.File; -import java.util.*; +import com.fasterxml.jackson.core.type.TypeReference; +import lombok.extern.slf4j.Slf4j; -import static org.apache.bigtop.manager.common.constants.CacheFiles.*; -import static org.apache.bigtop.manager.common.constants.Constants.STACK_CACHE_DIR; +import java.io.File; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; @Slf4j public class LocalSettings { - public static Object configurations(String service, String type, String key, - Object defaultValue) { + public static Object configurations(String service, String type, String key, Object defaultValue) { Map configMap = configurations(service, type); return configMap.getOrDefault(key, defaultValue); } @@ -44,21 +47,18 @@ public static Object configurations(String service, String type, String key, public static Map configurations(String service, String type) { Map configDataMap = new HashMap<>(); - File file = new File(STACK_CACHE_DIR + CONFIGURATIONS_INFO); + File file = new File(Constants.STACK_CACHE_DIR + CacheFiles.CONFIGURATIONS_INFO); try { if (file.exists()) { - Map> configJson = - JsonUtils.readFromFile(file, new TypeReference<>() { - }); - Object configData = configJson.getOrDefault(service, new HashMap<>()).get(type); + Map> configJson = JsonUtils.readFromFile(file, new TypeReference<>() {}); + Object configData = + configJson.getOrDefault(service, new HashMap<>()).get(type); if (configData != null) { - configDataMap = - JsonUtils.readFromString((String) configData, new TypeReference<>() { - }); + configDataMap = JsonUtils.readFromString((String) configData, new TypeReference<>() {}); } } } catch (Exception e) { - TaskLogWriter.warn(CONFIGURATIONS_INFO + " parse error: " + e.getMessage()); + TaskLogWriter.warn(CacheFiles.CONFIGURATIONS_INFO + " parse error: " + e.getMessage()); } return configDataMap; @@ -71,10 +71,9 @@ public static List hosts(String componentName) { public static Map> hosts() { Map> hostJson = new HashMap<>(); - File file = new File(STACK_CACHE_DIR + HOSTS_INFO); + File file = new File(Constants.STACK_CACHE_DIR + CacheFiles.HOSTS_INFO); if (file.exists()) { - hostJson = JsonUtils.readFromFile(file, new TypeReference<>() { - }); + hostJson = JsonUtils.readFromFile(file, new TypeReference<>() {}); } return hostJson; } @@ -82,10 +81,9 @@ public static Map> hosts() { public static Map basicInfo() { Map settings = new HashMap<>(); - File file = new File(STACK_CACHE_DIR + SETTINGS_INFO); + File file = new File(Constants.STACK_CACHE_DIR + CacheFiles.SETTINGS_INFO); if (file.exists()) { - settings = JsonUtils.readFromFile(file, new TypeReference<>() { - }); + settings = JsonUtils.readFromFile(file, new TypeReference<>() {}); } return settings; } @@ -93,10 +91,9 @@ public static Map basicInfo() { public static Map> users() { Map> userMap = new HashMap<>(); - File file = new File(STACK_CACHE_DIR + USERS_INFO); + File file = new File(Constants.STACK_CACHE_DIR + CacheFiles.USERS_INFO); if (file.exists()) { - userMap = JsonUtils.readFromFile(file, new TypeReference<>() { - }); + userMap = JsonUtils.readFromFile(file, new TypeReference<>() {}); } return userMap; } @@ -109,10 +106,9 @@ public static List packages() { public static List repos() { List repoInfoList = List.of(); - File file = new File(STACK_CACHE_DIR + REPOS_INFO); + File file = new File(Constants.STACK_CACHE_DIR + CacheFiles.REPOS_INFO); if (file.exists()) { - repoInfoList = JsonUtils.readFromFile(file, new TypeReference<>() { - }); + repoInfoList = JsonUtils.readFromFile(file, new TypeReference<>() {}); } return repoInfoList; } @@ -120,10 +116,9 @@ public static List repos() { public static ClusterInfo cluster() { ClusterInfo clusterInfo = new ClusterInfo(); - File file = new File(STACK_CACHE_DIR + CLUSTER_INFO); + File file = new File(Constants.STACK_CACHE_DIR + CacheFiles.CLUSTER_INFO); if (file.exists()) { - clusterInfo = JsonUtils.readFromFile(file, new TypeReference<>() { - }); + clusterInfo = JsonUtils.readFromFile(file, new TypeReference<>() {}); } return clusterInfo; } @@ -131,10 +126,9 @@ public static ClusterInfo cluster() { public static Map components() { Map componentInfo = new HashMap<>(); - File file = new File(STACK_CACHE_DIR + COMPONENTS_INFO); + File file = new File(Constants.STACK_CACHE_DIR + CacheFiles.COMPONENTS_INFO); if (file.exists()) { - componentInfo = JsonUtils.readFromFile(file, new TypeReference<>() { - }); + componentInfo = JsonUtils.readFromFile(file, new TypeReference<>() {}); } return componentInfo; } diff --git a/bigtop-manager-stack/bigtop-manager-stack-common/src/main/java/org/apache/bigtop/manager/stack/common/utils/PackageUtils.java b/bigtop-manager-stack/bigtop-manager-stack-common/src/main/java/org/apache/bigtop/manager/stack/common/utils/PackageUtils.java index 70d6face..c168ad9f 100644 --- a/bigtop-manager-stack/bigtop-manager-stack-common/src/main/java/org/apache/bigtop/manager/stack/common/utils/PackageUtils.java +++ b/bigtop-manager-stack/bigtop-manager-stack-common/src/main/java/org/apache/bigtop/manager/stack/common/utils/PackageUtils.java @@ -81,5 +81,4 @@ public static ShellResult install(Collection packageList) { return getPackageManager().installPackage(packageList); } - } diff --git a/bigtop-manager-stack/bigtop-manager-stack-common/src/main/java/org/apache/bigtop/manager/stack/common/utils/PropertiesUtils.java b/bigtop-manager-stack/bigtop-manager-stack-common/src/main/java/org/apache/bigtop/manager/stack/common/utils/PropertiesUtils.java index befcdbc1..23738bce 100644 --- a/bigtop-manager-stack/bigtop-manager-stack-common/src/main/java/org/apache/bigtop/manager/stack/common/utils/PropertiesUtils.java +++ b/bigtop-manager-stack/bigtop-manager-stack-common/src/main/java/org/apache/bigtop/manager/stack/common/utils/PropertiesUtils.java @@ -18,11 +18,16 @@ */ package org.apache.bigtop.manager.stack.common.utils; -import lombok.extern.slf4j.Slf4j; import org.apache.bigtop.manager.stack.common.exception.StackException; import org.apache.bigtop.manager.stack.common.log.TaskLogWriter; -import java.io.*; +import lombok.extern.slf4j.Slf4j; + +import java.io.FileOutputStream; +import java.io.FileReader; +import java.io.FileWriter; +import java.io.IOException; +import java.io.OutputStream; import java.nio.charset.StandardCharsets; import java.util.List; import java.util.Map; @@ -71,7 +76,6 @@ public static void writeProperties(String fileName, Map configMa } catch (Exception e) { TaskLogWriter.error("writeProperties error: " + e.getMessage()); } - } /** @@ -86,8 +90,7 @@ public static void writeProperties(String fileName, List> co Properties properties = new Properties(); for (Map map : configList) { - properties.setProperty(String.valueOf(map.get("name")), - String.valueOf(map.get("value"))); + properties.setProperty(String.valueOf(map.get("name")), String.valueOf(map.get("value"))); } TaskLogWriter.info("writeProperties: " + properties); @@ -97,6 +100,5 @@ public static void writeProperties(String fileName, List> co TaskLogWriter.error("writeProperties error: " + e.getMessage()); throw new StackException(e); } - } } diff --git a/bigtop-manager-stack/bigtop-manager-stack-common/src/main/java/org/apache/bigtop/manager/stack/common/utils/XmlUtils.java b/bigtop-manager-stack/bigtop-manager-stack-common/src/main/java/org/apache/bigtop/manager/stack/common/utils/XmlUtils.java index 1385548e..4d55d845 100644 --- a/bigtop-manager-stack/bigtop-manager-stack-common/src/main/java/org/apache/bigtop/manager/stack/common/utils/XmlUtils.java +++ b/bigtop-manager-stack/bigtop-manager-stack-common/src/main/java/org/apache/bigtop/manager/stack/common/utils/XmlUtils.java @@ -18,12 +18,14 @@ */ package org.apache.bigtop.manager.stack.common.utils; -import lombok.extern.slf4j.Slf4j; import org.apache.bigtop.manager.stack.common.exception.StackException; import org.apache.bigtop.manager.stack.common.log.TaskLogWriter; + import org.w3c.dom.Document; import org.w3c.dom.Element; +import lombok.extern.slf4j.Slf4j; + import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.ParserConfigurationException; @@ -94,5 +96,4 @@ public static void writeXml(String fileName, Map configMap) { throw new StackException(e); } } - } diff --git a/bigtop-manager-stack/bigtop-manager-stack-common/src/main/java/org/apache/bigtop/manager/stack/common/utils/linux/LinuxAccountUtils.java b/bigtop-manager-stack/bigtop-manager-stack-common/src/main/java/org/apache/bigtop/manager/stack/common/utils/linux/LinuxAccountUtils.java index daeea53f..1ed58c2d 100644 --- a/bigtop-manager-stack/bigtop-manager-stack-common/src/main/java/org/apache/bigtop/manager/stack/common/utils/linux/LinuxAccountUtils.java +++ b/bigtop-manager-stack/bigtop-manager-stack-common/src/main/java/org/apache/bigtop/manager/stack/common/utils/linux/LinuxAccountUtils.java @@ -18,14 +18,17 @@ */ package org.apache.bigtop.manager.stack.common.utils.linux; -import lombok.extern.slf4j.Slf4j; import org.apache.bigtop.manager.common.shell.ShellExecutor; import org.apache.bigtop.manager.common.shell.ShellResult; import org.apache.bigtop.manager.stack.common.exception.StackException; import org.apache.bigtop.manager.stack.common.log.TaskLogWriter; + import org.apache.commons.lang3.StringUtils; + import org.springframework.util.CollectionUtils; +import lombok.extern.slf4j.Slf4j; + import java.io.IOException; import java.util.ArrayList; import java.util.Collection; @@ -73,9 +76,7 @@ public static void userDel(String user) { * Add user * useradd [options] LOGIN */ - public static void userAdd(String user, - String group, - Collection groups) { + public static void userAdd(String user, String group, Collection groups) { userAdd(user, group, null, groups, null, null, null, false); } @@ -91,14 +92,15 @@ public static void userAdd(String user, * @param comment user comment * @param password user password */ - public static void userAdd(String user, - String group, - String uid, - Collection groups, - String home, - String comment, - String password, - Boolean system) { + public static void userAdd( + String user, + String group, + String uid, + Collection groups, + String home, + String comment, + String password, + Boolean system) { Objects.requireNonNull(user); Objects.requireNonNull(group); @@ -255,7 +257,6 @@ public static boolean isGroupExists(String group) { } catch (IOException e) { throw new StackException(e); } - } /** @@ -279,7 +280,5 @@ public static boolean isUserExists(String user) { } catch (IOException e) { throw new StackException(e); } - } - } diff --git a/bigtop-manager-stack/bigtop-manager-stack-common/src/main/java/org/apache/bigtop/manager/stack/common/utils/linux/LinuxFileUtils.java b/bigtop-manager-stack/bigtop-manager-stack-common/src/main/java/org/apache/bigtop/manager/stack/common/utils/linux/LinuxFileUtils.java index df03284d..ed524ae6 100644 --- a/bigtop-manager-stack/bigtop-manager-stack-common/src/main/java/org/apache/bigtop/manager/stack/common/utils/linux/LinuxFileUtils.java +++ b/bigtop-manager-stack/bigtop-manager-stack-common/src/main/java/org/apache/bigtop/manager/stack/common/utils/linux/LinuxFileUtils.java @@ -18,22 +18,28 @@ */ package org.apache.bigtop.manager.stack.common.utils.linux; -import lombok.extern.slf4j.Slf4j; import org.apache.bigtop.manager.common.constants.Constants; import org.apache.bigtop.manager.common.utils.JsonUtils; import org.apache.bigtop.manager.common.utils.YamlUtils; import org.apache.bigtop.manager.stack.common.enums.ConfigType; import org.apache.bigtop.manager.stack.common.log.TaskLogWriter; import org.apache.bigtop.manager.stack.common.utils.template.TemplateUtils; + import org.apache.commons.lang3.StringUtils; +import lombok.extern.slf4j.Slf4j; + import java.io.File; import java.io.IOException; import java.nio.file.DirectoryStream; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; -import java.nio.file.attribute.*; +import java.nio.file.attribute.GroupPrincipal; +import java.nio.file.attribute.PosixFileAttributeView; +import java.nio.file.attribute.PosixFilePermission; +import java.nio.file.attribute.PosixFilePermissions; +import java.nio.file.attribute.UserPrincipal; import java.util.Set; /** @@ -42,9 +48,8 @@ @Slf4j public class LinuxFileUtils { - public static void toFile(ConfigType type, String filename, String owner, String group, - String permissions, - Object content) { + public static void toFile( + ConfigType type, String filename, String owner, String group, String permissions, Object content) { toFile(type, filename, owner, group, permissions, content, null); } @@ -59,9 +64,14 @@ public static void toFile(ConfigType type, String filename, String owner, String * @param content content map * @param paramMap paramMap */ - public static void toFile(ConfigType type, String filename, String owner, String group, - String permissions, - Object content, Object paramMap) { + public static void toFile( + ConfigType type, + String filename, + String owner, + String group, + String permissions, + Object content, + Object paramMap) { if (type == null || StringUtils.isBlank(filename) || content == null) { TaskLogWriter.error("type, filename, content must not be null"); return; @@ -86,9 +96,8 @@ public static void toFile(ConfigType type, String filename, String owner, String updatePermissions(filename, permissions, false); } - public static void toFileByTemplate(String template, String filename, String owner, - String group, String permissions, - Object modelMap) { + public static void toFileByTemplate( + String template, String filename, String owner, String group, String permissions, Object modelMap) { toFileByTemplate(template, filename, owner, group, permissions, modelMap, null); } @@ -103,9 +112,14 @@ public static void toFileByTemplate(String template, String filename, String own * @param template template * @param paramMap paramMap */ - public static void toFileByTemplate(String template, String filename, String owner, - String group, String permissions, - Object modelMap, Object paramMap) { + public static void toFileByTemplate( + String template, + String filename, + String owner, + String group, + String permissions, + Object modelMap, + Object paramMap) { if (StringUtils.isBlank(filename) || modelMap == null || StringUtils.isEmpty(template)) { TaskLogWriter.error("type, filename, content, template must not be null"); return; @@ -143,8 +157,7 @@ public static void updatePermissions(String dir, String permissions, boolean rec if (recursive && Files.isDirectory(path)) { try (DirectoryStream ds = Files.newDirectoryStream(path)) { for (Path subPath : ds) { - updatePermissions(dir + File.separator + subPath.getFileName(), permissions, - true); + updatePermissions(dir + File.separator + subPath.getFileName(), permissions, true); } } catch (IOException e) { TaskLogWriter.error("[updatePermissions] error: " + e.getMessage()); @@ -176,8 +189,7 @@ public static void updateOwner(String dir, String owner, String group, boolean r GroupPrincipal groupPrincipal = path.getFileSystem().getUserPrincipalLookupService().lookupPrincipalByGroupName(group); - PosixFileAttributeView fileAttributeView = - Files.getFileAttributeView(path, PosixFileAttributeView.class); + PosixFileAttributeView fileAttributeView = Files.getFileAttributeView(path, PosixFileAttributeView.class); fileAttributeView.setOwner(userPrincipal); fileAttributeView.setGroup(groupPrincipal); } catch (IOException e) { @@ -205,8 +217,8 @@ public static void updateOwner(String dir, String owner, String group, boolean r * @param permissions {@code rwxr--r--} * @param recursive recursive */ - public static void createDirectories(String dirPath, String owner, String group, - String permissions, boolean recursive) { + public static void createDirectories( + String dirPath, String owner, String group, String permissions, boolean recursive) { if (StringUtils.isBlank(dirPath)) { TaskLogWriter.error("dirPath must not be null"); return; @@ -227,5 +239,4 @@ public static void createDirectories(String dirPath, String owner, String group, updateOwner(dirPath, owner, group, recursive); updatePermissions(dirPath, permissions, recursive); } - } diff --git a/bigtop-manager-stack/bigtop-manager-stack-common/src/main/java/org/apache/bigtop/manager/stack/common/utils/linux/LinuxOSUtils.java b/bigtop-manager-stack/bigtop-manager-stack-common/src/main/java/org/apache/bigtop/manager/stack/common/utils/linux/LinuxOSUtils.java index b5a5b134..5a47ccd3 100644 --- a/bigtop-manager-stack/bigtop-manager-stack-common/src/main/java/org/apache/bigtop/manager/stack/common/utils/linux/LinuxOSUtils.java +++ b/bigtop-manager-stack/bigtop-manager-stack-common/src/main/java/org/apache/bigtop/manager/stack/common/utils/linux/LinuxOSUtils.java @@ -18,15 +18,17 @@ */ package org.apache.bigtop.manager.stack.common.utils.linux; -import lombok.AccessLevel; -import lombok.NoArgsConstructor; -import lombok.extern.slf4j.Slf4j; import org.apache.bigtop.manager.common.shell.ShellExecutor; import org.apache.bigtop.manager.common.shell.ShellResult; import org.apache.bigtop.manager.common.utils.FileUtils; import org.apache.bigtop.manager.stack.common.log.TaskLogWriter; + import org.apache.commons.lang3.StringUtils; +import lombok.AccessLevel; +import lombok.NoArgsConstructor; +import lombok.extern.slf4j.Slf4j; + import java.io.File; import java.io.IOException; import java.util.ArrayList; @@ -105,15 +107,16 @@ public static ShellResult checkProcess(String filepath) { try { pid = Integer.parseInt(FileUtils.readFile2Str(file).replaceAll("\r|\n", "")); } catch (Exception e) { - TaskLogWriter.warn("Pid file " + filepath + " does not exist or does not contain a process id number, error: " + e.getMessage()); + TaskLogWriter.warn("Pid file " + filepath + + " does not exist or does not contain a process id number, error: " + e.getMessage()); return new ShellResult(-1, "", "Component is not running"); } try { return execCmd("kill -0 " + pid); } catch (IOException e) { - TaskLogWriter.warn("Process with pid " + pid + " is not running. Stale pid file at " + filepath + ", error: " + e.getMessage()); + TaskLogWriter.warn("Process with pid " + pid + " is not running. Stale pid file at " + filepath + + ", error: " + e.getMessage()); return new ShellResult(-1, "", "Component is not running"); } } - } diff --git a/bigtop-manager-stack/bigtop-manager-stack-common/src/main/java/org/apache/bigtop/manager/stack/common/utils/template/BaseTemplate.java b/bigtop-manager-stack/bigtop-manager-stack-common/src/main/java/org/apache/bigtop/manager/stack/common/utils/template/BaseTemplate.java index 7fc17fc6..8ff4e568 100644 --- a/bigtop-manager-stack/bigtop-manager-stack-common/src/main/java/org/apache/bigtop/manager/stack/common/utils/template/BaseTemplate.java +++ b/bigtop-manager-stack/bigtop-manager-stack-common/src/main/java/org/apache/bigtop/manager/stack/common/utils/template/BaseTemplate.java @@ -18,14 +18,15 @@ */ package org.apache.bigtop.manager.stack.common.utils.template; +import org.apache.bigtop.manager.stack.common.exception.StackException; +import org.apache.bigtop.manager.stack.common.log.TaskLogWriter; + import freemarker.core.UndefinedOutputFormat; import freemarker.template.Configuration; import freemarker.template.Template; import freemarker.template.TemplateException; import freemarker.template.TemplateExceptionHandler; import lombok.extern.slf4j.Slf4j; -import org.apache.bigtop.manager.stack.common.exception.StackException; -import org.apache.bigtop.manager.stack.common.log.TaskLogWriter; import java.io.FileWriter; import java.io.IOException; diff --git a/bigtop-manager-stack/bigtop-manager-stack-common/src/main/java/org/apache/bigtop/manager/stack/common/utils/template/TemplateUtils.java b/bigtop-manager-stack/bigtop-manager-stack-common/src/main/java/org/apache/bigtop/manager/stack/common/utils/template/TemplateUtils.java index 28256da1..6437eb65 100644 --- a/bigtop-manager-stack/bigtop-manager-stack-common/src/main/java/org/apache/bigtop/manager/stack/common/utils/template/TemplateUtils.java +++ b/bigtop-manager-stack/bigtop-manager-stack-common/src/main/java/org/apache/bigtop/manager/stack/common/utils/template/TemplateUtils.java @@ -18,10 +18,11 @@ */ package org.apache.bigtop.manager.stack.common.utils.template; -import lombok.extern.slf4j.Slf4j; import org.apache.bigtop.manager.stack.common.enums.ConfigType; import org.apache.bigtop.manager.stack.common.log.TaskLogWriter; +import lombok.extern.slf4j.Slf4j; + import java.util.HashMap; import java.util.Map; @@ -65,5 +66,4 @@ public static void map2CustomTemplate(String template, String fileName, Object c TaskLogWriter.error("writeProperties error: " + e.getMessage()); } } - } diff --git a/bigtop-manager-stack/bigtop-manager-stack-core/pom.xml b/bigtop-manager-stack/bigtop-manager-stack-core/pom.xml index fb3e6535..98325fb5 100644 --- a/bigtop-manager-stack/bigtop-manager-stack-core/pom.xml +++ b/bigtop-manager-stack/bigtop-manager-stack-core/pom.xml @@ -17,9 +17,7 @@ ~ specific language governing permissions and limitations ~ under the License. --> - - + 4.0.0 org.apache.bigtop diff --git a/bigtop-manager-stack/bigtop-manager-stack-core/src/main/java/org/apache/bigtop/manager/stack/core/executor/StackExecutor.java b/bigtop-manager-stack/bigtop-manager-stack-core/src/main/java/org/apache/bigtop/manager/stack/core/executor/StackExecutor.java index 40650ab8..85aaaebe 100644 --- a/bigtop-manager-stack/bigtop-manager-stack-core/src/main/java/org/apache/bigtop/manager/stack/core/executor/StackExecutor.java +++ b/bigtop-manager-stack/bigtop-manager-stack-core/src/main/java/org/apache/bigtop/manager/stack/core/executor/StackExecutor.java @@ -18,7 +18,6 @@ */ package org.apache.bigtop.manager.stack.core.executor; -import lombok.extern.slf4j.Slf4j; import org.apache.bigtop.manager.common.enums.Command; import org.apache.bigtop.manager.common.message.entity.payload.CommandPayload; import org.apache.bigtop.manager.common.message.entity.pojo.CustomCommandInfo; @@ -31,6 +30,8 @@ import org.apache.bigtop.manager.stack.common.exception.StackException; import org.apache.bigtop.manager.stack.common.log.TaskLogWriter; +import lombok.extern.slf4j.Slf4j; + import java.lang.reflect.Method; import java.util.List; import java.util.Map; @@ -105,8 +106,8 @@ public static ShellResult execute(CommandPayload commandPayload, Consumer paramsClass = Class.forName(paramsClassName); - Params params = - (Params) paramsClass.getDeclaredConstructor(CommandPayload.class).newInstance(commandPayload); + Params params = (Params) + paramsClass.getDeclaredConstructor(CommandPayload.class).newInstance(commandPayload); runBeforeHook(command); diff --git a/bigtop-manager-stack/bigtop-manager-stack-core/src/main/java/org/apache/bigtop/manager/stack/core/hook/AbstractHook.java b/bigtop-manager-stack/bigtop-manager-stack-core/src/main/java/org/apache/bigtop/manager/stack/core/hook/AbstractHook.java index f96323ba..c7875b48 100644 --- a/bigtop-manager-stack/bigtop-manager-stack-core/src/main/java/org/apache/bigtop/manager/stack/core/hook/AbstractHook.java +++ b/bigtop-manager-stack/bigtop-manager-stack-core/src/main/java/org/apache/bigtop/manager/stack/core/hook/AbstractHook.java @@ -18,12 +18,13 @@ */ package org.apache.bigtop.manager.stack.core.hook; -import lombok.extern.slf4j.Slf4j; import org.apache.bigtop.manager.spi.stack.Hook; import org.apache.bigtop.manager.stack.common.log.TaskLogWriter; import org.apache.bigtop.manager.stack.common.utils.LocalSettings; import org.apache.bigtop.manager.stack.common.utils.linux.LinuxAccountUtils; +import lombok.extern.slf4j.Slf4j; + import java.util.Map; import java.util.Set; diff --git a/bigtop-manager-stack/bigtop-manager-stack-core/src/main/java/org/apache/bigtop/manager/stack/core/hook/InstallHook.java b/bigtop-manager-stack/bigtop-manager-stack-core/src/main/java/org/apache/bigtop/manager/stack/core/hook/InstallHook.java index 4eb7039a..c6979b49 100644 --- a/bigtop-manager-stack/bigtop-manager-stack-core/src/main/java/org/apache/bigtop/manager/stack/core/hook/InstallHook.java +++ b/bigtop-manager-stack/bigtop-manager-stack-core/src/main/java/org/apache/bigtop/manager/stack/core/hook/InstallHook.java @@ -25,12 +25,11 @@ import org.apache.bigtop.manager.stack.common.utils.PackageUtils; import org.apache.bigtop.manager.stack.common.utils.template.BaseTemplate; -import java.util.List; - import com.google.auto.service.AutoService; - import lombok.extern.slf4j.Slf4j; +import java.util.List; + /** * obtain agent execute command */ @@ -46,9 +45,10 @@ public void doBefore() { String repoTemplate = LocalSettings.cluster().getRepoTemplate(); for (RepoInfo repo : repos) { - if (OSDetection.getOS().equals(repo.getOs()) && OSDetection.getArch().equals(repo.getArch())) { - BaseTemplate.writeCustomTemplate("/etc/yum.repos.d/" + repo.getRepoId().replace(".", "_") + ".repo", - repo, repoTemplate); + if (OSDetection.getOS().equals(repo.getOs()) + && OSDetection.getArch().equals(repo.getArch())) { + BaseTemplate.writeCustomTemplate( + "/etc/yum.repos.d/" + repo.getRepoId().replace(".", "_") + ".repo", repo, repoTemplate); } } @@ -57,8 +57,7 @@ public void doBefore() { } @Override - public void doAfter() { - } + public void doAfter() {} @Override public String getName() { diff --git a/bigtop-manager-stack/bigtop-manager-stack-core/src/main/java/org/apache/bigtop/manager/stack/core/hook/RestartHook.java b/bigtop-manager-stack/bigtop-manager-stack-core/src/main/java/org/apache/bigtop/manager/stack/core/hook/RestartHook.java index c8de5c06..5404c22f 100644 --- a/bigtop-manager-stack/bigtop-manager-stack-core/src/main/java/org/apache/bigtop/manager/stack/core/hook/RestartHook.java +++ b/bigtop-manager-stack/bigtop-manager-stack-core/src/main/java/org/apache/bigtop/manager/stack/core/hook/RestartHook.java @@ -21,7 +21,6 @@ import org.apache.bigtop.manager.spi.stack.Hook; import com.google.auto.service.AutoService; - import lombok.extern.slf4j.Slf4j; /** @@ -34,12 +33,10 @@ public class RestartHook extends AbstractHook { public static final String NAME = "restart"; @Override - public void doBefore() { - } + public void doBefore() {} @Override - public void doAfter() { - } + public void doAfter() {} @Override public String getName() { diff --git a/bigtop-manager-stack/bigtop-manager-stack-core/src/main/java/org/apache/bigtop/manager/stack/core/hook/StartHook.java b/bigtop-manager-stack/bigtop-manager-stack-core/src/main/java/org/apache/bigtop/manager/stack/core/hook/StartHook.java index f08868fa..782ec00b 100644 --- a/bigtop-manager-stack/bigtop-manager-stack-core/src/main/java/org/apache/bigtop/manager/stack/core/hook/StartHook.java +++ b/bigtop-manager-stack/bigtop-manager-stack-core/src/main/java/org/apache/bigtop/manager/stack/core/hook/StartHook.java @@ -21,7 +21,6 @@ import org.apache.bigtop.manager.spi.stack.Hook; import com.google.auto.service.AutoService; - import lombok.extern.slf4j.Slf4j; /** @@ -34,12 +33,10 @@ public class StartHook extends AbstractHook { public static final String NAME = "start"; @Override - public void doBefore() { - } + public void doBefore() {} @Override - public void doAfter() { - } + public void doAfter() {} @Override public String getName() { diff --git a/bigtop-manager-stack/bigtop-manager-stack-core/src/main/java/org/apache/bigtop/manager/stack/core/hook/StopHook.java b/bigtop-manager-stack/bigtop-manager-stack-core/src/main/java/org/apache/bigtop/manager/stack/core/hook/StopHook.java index 51a406d7..e990ece7 100644 --- a/bigtop-manager-stack/bigtop-manager-stack-core/src/main/java/org/apache/bigtop/manager/stack/core/hook/StopHook.java +++ b/bigtop-manager-stack/bigtop-manager-stack-core/src/main/java/org/apache/bigtop/manager/stack/core/hook/StopHook.java @@ -21,7 +21,6 @@ import org.apache.bigtop.manager.spi.stack.Hook; import com.google.auto.service.AutoService; - import lombok.extern.slf4j.Slf4j; /** @@ -34,12 +33,10 @@ public class StopHook extends AbstractHook { public static final String NAME = "stop"; @Override - public void doBefore() { - } + public void doBefore() {} @Override - public void doAfter() { - } + public void doAfter() {} @Override public String getName() { diff --git a/bigtop-manager-stack/bigtop-manager-stack-nop/pom.xml b/bigtop-manager-stack/bigtop-manager-stack-nop/pom.xml index 15dcc0f4..0a0dbcf2 100644 --- a/bigtop-manager-stack/bigtop-manager-stack-nop/pom.xml +++ b/bigtop-manager-stack/bigtop-manager-stack-nop/pom.xml @@ -17,9 +17,7 @@ ~ specific language governing permissions and limitations ~ under the License. --> - - + 4.0.0 org.apache.bigtop diff --git a/bigtop-manager-stack/bigtop-manager-stack-nop/src/main/java/org/apache/bigtop/manager/stack/nop/v1_0_0/kafka/KafkaBrokerScript.java b/bigtop-manager-stack/bigtop-manager-stack-nop/src/main/java/org/apache/bigtop/manager/stack/nop/v1_0_0/kafka/KafkaBrokerScript.java index 1e79c8ee..b25c8d35 100644 --- a/bigtop-manager-stack/bigtop-manager-stack-nop/src/main/java/org/apache/bigtop/manager/stack/nop/v1_0_0/kafka/KafkaBrokerScript.java +++ b/bigtop-manager-stack/bigtop-manager-stack-nop/src/main/java/org/apache/bigtop/manager/stack/nop/v1_0_0/kafka/KafkaBrokerScript.java @@ -21,11 +21,10 @@ import org.apache.bigtop.manager.common.shell.ShellResult; import org.apache.bigtop.manager.spi.stack.Params; import org.apache.bigtop.manager.spi.stack.Script; +import org.apache.bigtop.manager.stack.common.log.TaskLogWriter; import com.google.auto.service.AutoService; - import lombok.extern.slf4j.Slf4j; -import org.apache.bigtop.manager.stack.common.log.TaskLogWriter; @Slf4j @AutoService(Script.class) @@ -65,5 +64,4 @@ public ShellResult test(Params params) { TaskLogWriter.info("Success on dev mode"); return ShellResult.success(); } - } diff --git a/bigtop-manager-stack/bigtop-manager-stack-nop/src/main/java/org/apache/bigtop/manager/stack/nop/v1_0_0/zookeeper/ZookeeperClientScript.java b/bigtop-manager-stack/bigtop-manager-stack-nop/src/main/java/org/apache/bigtop/manager/stack/nop/v1_0_0/zookeeper/ZookeeperClientScript.java index eda2436f..7818c21a 100644 --- a/bigtop-manager-stack/bigtop-manager-stack-nop/src/main/java/org/apache/bigtop/manager/stack/nop/v1_0_0/zookeeper/ZookeeperClientScript.java +++ b/bigtop-manager-stack/bigtop-manager-stack-nop/src/main/java/org/apache/bigtop/manager/stack/nop/v1_0_0/zookeeper/ZookeeperClientScript.java @@ -22,11 +22,10 @@ import org.apache.bigtop.manager.spi.stack.ClientScript; import org.apache.bigtop.manager.spi.stack.Params; import org.apache.bigtop.manager.spi.stack.Script; +import org.apache.bigtop.manager.stack.common.log.TaskLogWriter; import com.google.auto.service.AutoService; - import lombok.extern.slf4j.Slf4j; -import org.apache.bigtop.manager.stack.common.log.TaskLogWriter; @Slf4j @AutoService(Script.class) @@ -43,5 +42,4 @@ public ShellResult configure(Params params) { TaskLogWriter.info("Success on dev mode"); return ShellResult.success(); } - } diff --git a/bigtop-manager-stack/bigtop-manager-stack-nop/src/main/java/org/apache/bigtop/manager/stack/nop/v1_0_0/zookeeper/ZookeeperServerScript.java b/bigtop-manager-stack/bigtop-manager-stack-nop/src/main/java/org/apache/bigtop/manager/stack/nop/v1_0_0/zookeeper/ZookeeperServerScript.java index abf64820..996c4116 100644 --- a/bigtop-manager-stack/bigtop-manager-stack-nop/src/main/java/org/apache/bigtop/manager/stack/nop/v1_0_0/zookeeper/ZookeeperServerScript.java +++ b/bigtop-manager-stack/bigtop-manager-stack-nop/src/main/java/org/apache/bigtop/manager/stack/nop/v1_0_0/zookeeper/ZookeeperServerScript.java @@ -21,11 +21,10 @@ import org.apache.bigtop.manager.common.shell.ShellResult; import org.apache.bigtop.manager.spi.stack.Params; import org.apache.bigtop.manager.spi.stack.Script; +import org.apache.bigtop.manager.stack.common.log.TaskLogWriter; import com.google.auto.service.AutoService; - import lombok.extern.slf4j.Slf4j; -import org.apache.bigtop.manager.stack.common.log.TaskLogWriter; @Slf4j @AutoService(Script.class) @@ -60,5 +59,4 @@ public ShellResult status(Params params) { TaskLogWriter.info("Success on dev mode"); return ShellResult.success(); } - } diff --git a/bigtop-manager-stack/pom.xml b/bigtop-manager-stack/pom.xml index 126875fa..d3dcafba 100644 --- a/bigtop-manager-stack/pom.xml +++ b/bigtop-manager-stack/pom.xml @@ -17,9 +17,7 @@ ~ specific language governing permissions and limitations ~ under the License. --> - - + 4.0.0 diff --git a/bigtop-manager-ui/pom.xml b/bigtop-manager-ui/pom.xml index 1a4b90de..1a8b0432 100644 --- a/bigtop-manager-ui/pom.xml +++ b/bigtop-manager-ui/pom.xml @@ -17,9 +17,7 @@ ~ specific language governing permissions and limitations ~ under the License. --> - - + 4.0.0 org.apache.bigtop @@ -30,7 +28,7 @@ bigtop-manager-ui ${project.artifactId} - Bigtop Manager Admin + Bigtop Manager UI v18.17.0 diff --git a/pom.xml b/pom.xml index 8b4f2e24..78b89cf4 100644 --- a/pom.xml +++ b/pom.xml @@ -17,9 +17,7 @@ ~ specific language governing permissions and limitations ~ under the License. --> - - + 4.0.0 @@ -55,6 +53,7 @@ 3.8.1 3.2.0 3.1.1 + 2.43.0 1.5.5.Final 1.18.30 @@ -150,6 +149,44 @@ org.apache.maven.plugins maven-compiler-plugin + + + com.diffplug.spotless + spotless-maven-plugin + ${spotless-maven-plugin.version} + + + + 2.47.0 + + + + + + + + org.apache.bigtop,org.apache,org,,jakarta|javax|java,\# + + + Remove wildcard imports + import\s+(?:static\s+)?[^\*\s]+\*;(\r\n|\r|\n) + $1 + + + + + UTF-8 + 4 + false + true + + + + + + + + diff --git a/style/license-header b/style/license-header deleted file mode 100644 index 7f9008db..00000000 --- a/style/license-header +++ /dev/null @@ -1,16 +0,0 @@ -Licensed to the Apache Software Foundation (ASF) under one -or more contributor license agreements. See the NOTICE file -distributed with this work for additional information -regarding copyright ownership. The ASF licenses this file -to you under the Apache License, Version 2.0 (the -"License"); you may not use this file except in compliance -with the License. You may obtain a copy of the License at - - https://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, -software distributed under the License is distributed on an -"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -KIND, either express or implied. See the License for the -specific language governing permissions and limitations -under the License.